function quiz_views_default_views in Quiz 5.2
Same name and namespace in other branches
- 8.6 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 8.4 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 8.5 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 6.6 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 6.3 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 6.4 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 6.5 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 7.6 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 7 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 7.4 includes/views/quiz.views_default.inc \quiz_views_default_views()
- 7.5 includes/views/quiz.views_default.inc \quiz_views_default_views()
Implementation of hook_default_views().
File
- ./
quiz_views.module, line 496 - This include file implements views 5.x-1.x functionality on behalf of quiz.module
Code
function quiz_views_default_views() {
// quiz_results default view, this defaults to enabled, and only viewable by the head admin.
$view = new stdClass();
$view->name = 'quiz_results';
$view->description = t('Quiz Results');
$view->access = array(
0 => '-1',
);
$view->page = TRUE;
$view->page_title = t('Quiz Results');
$view->page_empty = t('There are no quiz results.');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'admin/quiz/results';
$view->use_pager = TRUE;
$view->nodes_per_page = '25';
$view->menu = TRUE;
$view->menu_title = t('Quiz Results');
$view->field = array(
array(
'tablename' => 'quiz_node_results',
'field' => 'result_id',
'label' => t('Action'),
'options' => 'actions',
),
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Quiz Title'),
'handler' => 'views_handler_field_nodelink',
'sortable' => '1',
'options' => 'link',
),
array(
'tablename' => 'quiz_user',
'field' => 'name',
'label' => t('User Name'),
'handler' => 'quiz_views_handler_field_username_link',
'sortable' => '1',
),
array(
'tablename' => 'quiz_node_results',
'field' => 'result_id',
'label' => t('Result ID'),
'sortable' => '1',
'options' => 'nolink',
),
array(
'tablename' => 'quiz_node_results',
'field' => 'time_end',
'label' => t('Finished'),
'sortable' => '1',
'handler' => 'views_handler_field_date_small',
),
array(
'tablename' => 'quiz_node_results',
'field' => 'score',
'label' => t('Score'),
'sortable' => '1',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array(
0 => 'quiz',
),
),
);
$view->requires = array(
quiz_node_results,
node,
quiz_user,
);
$views[$view->name] = $view;
// myresults view
$view = new stdClass();
$view->name = 'myresults';
$view->description = t('Overrides default myresults with a more flexible user result page.');
$view->access = array(
0 => '2',
);
$view->page = TRUE;
$view->page_empty = t('This user has not taken any quizzes.');
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'user/$arg/myresults';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array(
array(
'tablename' => 'quiz_node_results',
'field' => 'time_start',
'sortorder' => 'ASC',
'options' => 'normal',
),
);
$view->argument = array(
array(
'type' => 'quiz_taker_uid',
'argdefault' => '7',
'title' => t('%1\'s Results'),
'options' => '1',
),
);
$view->field = array(
array(
'tablename' => 'node',
'field' => 'title',
'label' => t('Quiz Name'),
'handler' => 'views_handler_field_nodelink',
'sortable' => '1',
'defaultsort' => 'ASC',
'options' => 'link',
),
array(
'tablename' => 'quiz_node_results',
'field' => 'score',
'label' => t('Score'),
),
array(
'tablename' => 'quiz_node_results',
'field' => 'time_end',
'label' => t('Finished?'),
'handler' => 'views_handler_field_date_small',
),
array(
'tablename' => 'quiz_node_results',
'field' => 'quiz_result_actions',
'options' => 'onlylink',
),
);
$view->filter = array(
array(
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'value' => array(
0 => 'quiz',
),
),
);
$view->requires = array(
quiz_node_results,
node,
quiz_user,
);
$views['myresults'] = $view;
return $views;
}