Skip to content
Snippets Groups Projects
Commit 3b1fbceb authored by Sam Boyer's avatar Sam Boyer
Browse files

Smarter admin summary for the quiz state filter.

parent bd208a71
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
// $Id$ // $Id$
class quiz_views_handler_filter_user_quiz_state extends views_handler_filter { class quiz_views_handler_filter_user_quiz_state extends views_handler_filter {
var $states = array();
function init(&$view, $options) {
parent::init($view, $options);
$this->states = array(
'not_started' => t('Not Started'),
'in_progress' => t('In Progress'),
'finished' => t('Finished'),
);
}
function options_definition() { function options_definition() {
$options = parent::option_definition(); $options = parent::option_definition();
...@@ -14,15 +23,15 @@ class quiz_views_handler_filter_user_quiz_state extends views_handler_filter { ...@@ -14,15 +23,15 @@ class quiz_views_handler_filter_user_quiz_state extends views_handler_filter {
'#type' => 'radios', '#type' => 'radios',
'#description' => t('The final result set will only include quiz results in the state you select here.'), '#description' => t('The final result set will only include quiz results in the state you select here.'),
'#title' => t('Quiz State'), '#title' => t('Quiz State'),
'#options' => array( '#options' => $this->states,
'not_started' => t('Not Started'),
'in_progress' => t('In Progress'),
'finished' => t('Finished'),
),
'#default_value' => $this->options['quiz_state'], '#default_value' => $this->options['quiz_state'],
); );
} }
function admin_summary() {
return 'is ' . $this->states[$this->options['quiz_state']];
}
function query() { function query() {
$this->ensure_my_table(); $this->ensure_my_table();
if ($this->options['quiz_state'] == 'not_started') { if ($this->options['quiz_state'] == 'not_started') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment