<?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('search_option',$this->amazon->search_kind_array);
		$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();
	
	$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_batch_update() {
	$list_table = $this->batch_update();
	if($this->QuictyStatus=='UPDATE') {
		redirect('<!--{$folder_name}-->/items/');
	}
	
	$base_url = quicty_base_url();
	$update_form['display_cmd'] = $base_url.'<!--{$folder_name}-->/items/edit';
	//$update_form['conditions']['any_key'] = $_REQUEST['any_key'];
	$update_form['even_color'] = '#fee';	
	$this->assign_batch_form('table_view',$list_table,$max_column=1,$update_form);
	$navi = $this->list->get_pager_links();
	$this->assign('pager_navi',$navi['all']);
	$this->page['name'] = 'アイテムの一括更新';
	$this->assign_page_and_pathlist();
	$this->assign('page',$this->page);
	return $this->display($this->current_template);
}

} // end of items class
?>