<?php
/**
 *	Project:	Quicty: Quick application build environment depends on PEAR and Smarty
 *	File:		Quicty/modules/template/guestbook/lib/Pages/index.class.php
 *
 *	@copyright	Tomoyuki Negishi and ZubaPitaTech, Inc.
 *	@author		Tomoyuki Negishi <tomoyu-n@zubapita.jp>
 *	@license	http://www.opensource.org/licenses/bsd-license.php The BSD License
 *	@package	Quicty
 *	@version	$Id:$
 */
class index extends myQuicty {

function dispatch_index() {
	$this->caching = 0;// caching page flag: 0 = none; 1 = simple; 2 = each query;
	$this->cache_lifetime = 1800; // cache life time by seconds
	$cache_id = get_query_id(); // get uniqe id by query
	if(!$this->is_cached($this->current_template,$cache_id)) {
		// フォームの設定
		$_FORM = $this->new_data_set('guestbook');
		$_FORM->set_base_link_addr(quicty_base_url().'/');
		$_FORM->set_restart_link_addr(quicty_base_url().'/');
		$_FORM->validate_and_freeze();
		$_FORM->set_button_status('use_confirm',false);
		$_FORM->bind_button_control();
		$result = $_FORM->automatic_form_handler($condition);
		if($this->QuictyStatus=='INSERT' or $this->QuictyStatus=='UPDATE' or $this->QuictyStatus=='DELETE')
			redirect('/');

		// 表示
		$this->site['name'] = 'Quicty Sample:Guestbook';
		$this->page['name'] = 'guestbook';
		$this->page['base_url'] = quicty_base_url();
		$this->assign_form('input_form',$_FORM);
		$table = $_FORM->select_table(' order by id desc');
		$this->assign('table_view',$_FORM->display_table_value($table));
		$this->assign('display_cmd','none');
		$this->assign('site',$this->site);
		$this->assign('page',$this->page);
	}
	$result = $this->display($this->current_template,$cache_id);
	return $result;
}

} // end of index class
?>