<?php
require_once 'items_classes/_base.class.php';
class items extends items_base {

function dispatch_index() {
	if(!$this->is_cached($this->current_template,$this->cache_id)) {
		$this->assign_search_form();
		$list_table = $this->list_records('');
			
		$this->assign('table_view',$this->list->display_table_value($list_table));
		$this->assign('display_cmd','info');
		$this->page['pager'] = $this->list->get_pager_links();
		$this->page['name'] = 'アイテムの一覧';
		$this->assign('page',$this->page);
	}
	return $this->display($this->current_template,$this->cache_id);
}

function dispatch_info() {
	$this->assign_search_form();
	$result = $this->display_record();
	
	$items_id = $_GET['id'];
	require_once 'reviews.class.php';
	$reviews = new reviews();
	$reviews_list = $reviews->list_records('reviews.id='.$items_id);
	$this->assign('reviews_view',$reviews->list->display_table_value($reviews_list));

	$this->assign_form('input_form',$this->form);
	$this->page['name'] = 'アイテムの表示';
	$this->assign_page_and_pathlist();
	return $this->display($this->current_template);
}

function dispatch_add() {
	$this->assign_search_form();
	$result = $this->display_record();
	if($this->QuictyStatus=='INSERT') {
		redirect('<!--{$folder_name}-->/items/');
	}
	
	$this->assign_form('input_form',$this->form);
	$this->page['name'] = 'アイテムの追加';
	$this->assign_page_and_pathlist();
	return $this->display($this->current_template);
}

function dispatch_edit() {
	$this->assign_search_form();
	$result = $this->display_record();
	if($this->QuictyStatus=='UPDATE') {
		redirect('<!--{$folder_name}-->/items/');
	}
	
	$this->assign_form('input_form',$this->form);
	$this->page['name'] = 'アイテムの編集';
	$this->assign_page_and_pathlist();
	return $this->display($this->current_template);
}

function dispatch_delete() {
	$this->assign_search_form();
	$result = $this->display_record();
	if($this->QuictyStatus=='DELETE') {
		redirect('<!--{$folder_name}-->/items/');
	}
	
	$this->assign_form('input_form',$this->form);
	$this->page['name'] = 'アイテムの削除';
	$this->assign_page_and_pathlist();
	return $this->display($this->current_template);
}

function dispatch_error() {
	$this->page['message'] = 'ログインしないと、書き込めません。';
	$this->page['name'] = 'ログインしてください';
	$this->assign_page_and_pathlist();
	return $this->display($this->current_template);
}

} // end of items class
?>