Skip to content

Instantly share code, notes, and snippets.

@imknight
Created October 24, 2011 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imknight/1308188 to your computer and use it in GitHub Desktop.
Save imknight/1308188 to your computer and use it in GitHub Desktop.
Create a dropdown filter on item listing page [FUELCMS]
$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')
);
$route[FUEL_ROUTE.'operation/queue'] = OPERATION_FOLDER.'/queue';
$route[FUEL_ROUTE.'operation/queue/(.+)'] = OPERATION_FOLDER.'/queue/$1';
//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();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment