<?php
/**
 *	Project:	Quicty: Quick application build environment depends on PEAR and Smarty
 *	File:		Quicty/modules/template/bbs/lib/Pages/thread.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 thread 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)) {
		// フォームの設定
		$this->title['id'] = $_REQUEST['title_id'];
		$TITLE = $this->new_data_set('title');
		$table = $TITLE->select_table('where id='.$this->title['id']);
		$this->assign('title_view',$TITLE->display_table_value($table));

		$form = $this->new_data_set('thread');
		$form->set_base_link_addr(quicty_base_url().'/thread/');
		$form->set_restart_link_addr(quicty_base_url().'/thread/');
		$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('/thread/?title_id='.$this->title['id']);

		// 表示
		$this->site['name'] = 'Quicty Sample:BBS';
		$this->page['name'] = 'スレッド';
		$this->page['base_url'] = quicty_base_url();
		$this->assign_form('input_form',$form);
		$table = $form->select_table('where title_id='.$this->title['id'].' order by id');
		$this->assign('table_view',$form->display_table_value($table));
		$this->assign('site',$this->site);
		$this->assign('page',$this->page);
		//-- End of dispatch_index
	}
	$result = $this->display($this->current_template,$cache_id);
	return $result;
}

} // end of thread class
?>