Hello,

How to filter quiz by quiz "Close date" using Views?
We need to display all quiz (title, teaser) in a list that ended.
We tried using the "Quiz End Time" filter, but this isn't works for us, because this filters on the quiz results end time (quiz_node_results.time_end).

Thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

delykj’s picture

Solved. I modified quiz.views.inc file:
changed:

'quiz_close' => array(
      'title' => t('Close time'),
      'help' => t('The last time a new quiz can be taken.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
        'numeric' => TRUE,
      ),
      'sort' => array('handler' => 'views_handler_sort_date'),
    ),

to:

'quiz_close' => array(
      'title' => t('Close time'),
      'help' => t('The last time a new quiz can be taken.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
        'numeric' => TRUE,
      ),
      'sort' => array('handler' => 'views_handler_sort_date'),
      'filter' => array(
        'handler' => 'views_handler_filter_date',
        'allow empty' => TRUE,
       ),
    ),
Sivaji_Ganesh_Jojodae’s picture

does views_handler_filter_date works with Date popup ? I tried the same trick as you did for one of my recent projects but views_handler_filter_date provides only textfield which is not much convenient to us.

I added an additional field "quiz status" by implementing custom field and filter. This filter will allow to list quizzes by its status like "any", "In progress" or "Finished".

delykj’s picture

No, I didn't tried it with popups.
Could you share your custom field and filter?

hlykos’s picture

sub

sibinx7’s picture

Issue summary: View changes
FileSize
4.15 KB
18.22 KB
17.87 KB

Thank you very much. I was searching for this for last two days. Now everything works fine.
In my project I need to display Exams/Quiz based on Open and Close time.

I added

'filter' => array(
        'handler' => 'views_handler_filter_date',
        'allow empty' => TRUE,
       ),

on the open time also . Now my codes

/**
*  Quiz Open : Code to add Open time in filter section
*  Open time < current time
*
*/

'quiz_open' => array(
      'title' => t('Open time'),
      'help' => t('The first time a new quiz can be taken.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
        'numeric' => TRUE,
      ),
      'sort' => array('handler' => 'views_handler_sort_date'),
       'filter' => array(
        'handler' => 'views_handler_filter_date',
        'allow empty' => TRUE,
       ),
    ),
  
/**
*  Quiz Close : Code to add Close ime in filter section
*  Close time > Current time
*
*/
    'quiz_close' => array(
      'title' => t('Close time'),
      'help' => t('The last time a new quiz can be taken.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
        'numeric' => TRUE,
      ),
      'sort' => array('handler' => 'views_handler_sort_date'),
      'filter' => array(
        'handler' => 'views_handler_filter_date',
        'allow empty' => TRUE,
       ),
    ),
djdevin’s picture

Status: Active » Closed (outdated)

This issue is being closed because it is filed against a version that is no longer supported.