<?php
class <!--{$class_name}-->_list_options extends myQuicty {

function __construct($page) {
	parent::__construct();
	$this->page = $page;
	$this->list = $this->page->list;
}

var $perPage = 0; // this value set by <!--{$class_name}-->_base.list_records

function get_pager_option($add_condition='') {
	$where_condition = $this->make_where_condition($add_condition);
	$join_condition = $this->make_join_condition();
	$select_condition = $join_condition.' '.$where_condition;
	$pager_option = $this->set_pager_option($this->perPage,$select_condition);
	return $pager_option;
}

function make_where_condition($add_condition='') {
	$search_system_file = $this->page->home_dir.'/etc/search_view/<!--{$data_name}-->.sys';
	if(file_exists($search_system_file)) {
		$search_system = read_data_array($search_system_file);
	} else {
		$search_system = array(
			'keyword'=>array('title'=>'<!--{$data_name}-->.name','url'=>'<!--{$data_name}-->.url'), // keyword search target column
			'condition'=>array('id'=>'<!--{$data_name}-->.id','application_id'=>'<!--{$data_name}-->.application_id'), // id search target column
			//'period'=>array('start_date'=>array('column'=>'date','end'=>'end_date'))
			);
	}
	return $this->list->make_condition($search_system,$add_condition);
}

function make_join_condition() {
	//$this->list->real_count = true; // set this flag if join other table
	//$joins[] = "LEFT JOIN {table_name} ON <!--{$data_name}-->.{table_name}_id={table_name}.id";
	//$join_condition = implode(' ',$joins);
	return $join_condition;
}

function make_select_fields() {
	$select_system = array(
		'<!--{$data_name}-->'=>'*', // specify all column
		//'<!--{$data_name}-->'=>array('id','name','url'), // specify each column
		//'<!--{$data_name}-->'=>array('id'=>'<!--{$data_name}-->_id'), //specify another column name
		);
	return $this->list->make_select_fields($select_system);
}

function make_sort_condition() {
	$sort_system = array(
		'default'=>' order by id',
		// sort keys
		'columns'=>'*', // specify all column
		//'columns'=>array('id','name','url'), // specify each column
		);
	return $this->list->make_order($sort_system);
}

function set_batch_list_option() {
	$this->list->hide_in_batch_list(
		array(
			// write hide field list ex) 'properties','memo'...
		)
	);
	$this->list->freeze_in_batch_list(
		array(
			// write freeze display field list ex) 'name','url'...
		)
	);
}


} // end of class <!--{$class_name}-->_list_options
?>