imknight
10/24/2011 - 1:34 AM

Create a dropdown filter on item listing page [FUELCMS]

Create a dropdown filter on item listing page [FUELCMS]

//must be include module controller
require_once(FUEL_PATH.'/controllers/module.php');

class Queue extends Module {
  function __construct()
    {
      parent::__construct();
    }

  function items()
    {
      //you can self define the value here, or call in the module class and pull a series of value here
      $queue_day['']='All';
      $queue_day['today']='Today';
      $queue_day['tomorrow']='Tomorrow';
      if (!empty($this->filters['date_added'])) $this->filters['date_added']['options'] = $queue_day;
      parent::items();
    }
}
$route[FUEL_ROUTE.'operation/queue'] = OPERATION_FOLDER.'/queue';
$route[FUEL_ROUTE.'operation/queue/(.+)'] = OPERATION_FOLDER.'/queue/$1';
$config['modules']['operation_queue'] = array(
		'module_name' => 'Queue Management',
		'module_uri' => 'operation/queue',
		'model_name' => 'queue_model',
		'model_location' => 'operation',
		'permission' => 'operation/queue',
		'nav_selected' => 'operation/queue',
		'default_col' => 'date_added',
		'display_field' => 'id',
		'filters' => array('date_added' => array('default' => date('Y-m-d',time()), 'label' => 'Queue Day', 'type' => 'select')),
		'instructions' => lang('module_instructions_queue')
	);