View source
<?php
function regcode_views_default_views() {
$view = new view();
$view->name = 'regcode';
$view->description = 'Provides an administrative interface to manage registration codes.';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'regcode';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Defaults', 'default');
$handler
->override_option('relationships', array(
'uid' => array(
'label' => 'Last user',
'required' => 0,
'id' => 'uid',
'table' => 'regcode',
'field' => 'uid',
'relationship' => 'none',
),
));
$handler
->override_option('fields', array(
'rid' => array(
'label' => 'ID',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 1,
'id' => 'rid',
'table' => 'regcode',
'field' => 'rid',
'relationship' => 'none',
),
'created' => array(
'label' => 'Created',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'd/m/y',
'exclude' => 0,
'id' => 'created',
'table' => 'regcode',
'field' => 'created',
'relationship' => 'none',
),
'is_active' => array(
'label' => 'Active',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'yes-no',
'not' => 0,
'exclude' => 0,
'id' => 'is_active',
'table' => 'regcode',
'field' => 'is_active',
'relationship' => 'none',
),
'code' => array(
'label' => 'Code',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'code',
'table' => 'regcode',
'field' => 'code',
'relationship' => 'none',
),
'uses' => array(
'label' => 'Uses',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '0',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'uses',
'table' => 'regcode',
'field' => 'uses',
'relationship' => 'none',
),
'maxuses' => array(
'label' => 'Max',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'maxuses',
'table' => 'regcode',
'field' => 'maxuses',
'relationship' => 'none',
),
'begins' => array(
'label' => 'Begins',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '-',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'd/m/y',
'exclude' => 0,
'id' => 'begins',
'table' => 'regcode',
'field' => 'begins',
'relationship' => 'none',
),
'expires' => array(
'label' => 'Expires',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '-',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'd/m/y',
'exclude' => 0,
'id' => 'expires',
'table' => 'regcode',
'field' => 'expires',
'relationship' => 'none',
),
'lastused' => array(
'label' => 'Last used',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '-',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'lastused',
'table' => 'regcode',
'field' => 'lastused',
'relationship' => 'none',
),
'name' => array(
'label' => 'User',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 1,
'anonymous_text' => '-',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'uid',
),
'tid' => array(
'label' => 'Tags',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'separator',
'separator' => ', ',
'link_to_taxonomy' => 0,
'limit' => 1,
'vids' => array(
'1' => 1,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'regcode_term',
'field' => 'tid',
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'tid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => 'tid_op',
'label' => 'Tag',
'use_operator' => 1,
'identifier' => 'tid',
'optional' => 1,
'single' => 1,
'remember' => 1,
'reduce' => 0,
),
'type' => 'select',
'limit' => TRUE,
'vid' => '1',
'id' => 'tid',
'table' => 'term_data',
'field' => 'tid',
'hierarchy' => 0,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'created' => array(
'operator' => '>=',
'value' => array(
'type' => 'offset',
'value' => '',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'created_op',
'identifier' => 'created',
'label' => 'Created',
'optional' => 1,
'remember' => 1,
),
'id' => 'created',
'table' => 'regcode',
'field' => 'created',
'relationship' => 'none',
),
'is_active' => array(
'operator' => '=',
'value' => 'All',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'active',
'label' => 'Active',
'optional' => 1,
'remember' => 1,
),
'id' => 'is_active',
'table' => 'regcode',
'field' => 'is_active',
'relationship' => 'none',
),
));
$handler
->override_option('access', array(
'type' => 'perm',
'perm' => 'administer registration codes',
));
$handler
->override_option('cache', array(
'type' => 'none',
));
$handler
->override_option('title', 'Registration codes');
$handler
->override_option('items_per_page', 50);
$handler
->override_option('pager_element', NULL);
$handler
->override_option('style_plugin', 'table');
$handler
->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'columns' => array(
'rid' => 'rid',
'created' => 'created',
'is_active' => 'is_active',
'code' => 'code',
'uses' => 'uses',
'maxuses' => 'maxuses',
'begins' => 'begins',
'expires' => 'expires',
'lastused' => 'lastused',
'name' => 'name',
'tid' => 'tid',
),
'info' => array(
'rid' => array(
'sortable' => 0,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'is_active' => array(
'sortable' => 1,
'separator' => '',
),
'code' => array(
'sortable' => 1,
'separator' => '',
),
'uses' => array(
'sortable' => 1,
'separator' => '',
),
'maxuses' => array(
'sortable' => 1,
'separator' => '',
),
'begins' => array(
'sortable' => 1,
'separator' => '',
),
'expires' => array(
'sortable' => 1,
'separator' => '',
),
'lastused' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'tid' => array(
'separator' => '',
),
),
'default' => 'created',
));
$handler = $view
->new_display('page', 'List', 'page_admin');
$handler
->override_option('empty', 'You have not created any registration codes.');
$handler
->override_option('items_per_page', 100);
$handler
->override_option('use_pager', '1');
$handler
->override_option('pager_element', 0);
$handler
->override_option('path', 'admin/user/regcode/list');
$handler
->override_option('menu', array(
'type' => 'default tab',
'title' => 'List',
'description' => 'List and manage registration codes',
'weight' => '10',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'normal',
'title' => 'Registration codes',
'description' => 'Manage user registration codes.',
'weight' => '0',
'name' => 'navigation',
));
if (module_exists('views_bulk_operations')) {
$handler
->override_option('style_plugin', 'bulk');
$handler
->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'rid' => 'rid',
'created' => 'created',
'is_active' => 'is_active',
'code' => 'code',
'uses' => 'uses',
'maxuses' => 'maxuses',
'begins' => 'begins',
'expires' => 'expires',
'lastused' => 'lastused',
'name' => 'name',
'tid' => 'tid',
),
'info' => array(
'rid' => array(
'sortable' => 0,
'separator' => '',
),
'created' => array(
'sortable' => 1,
'separator' => '',
),
'is_active' => array(
'sortable' => 1,
'separator' => '',
),
'code' => array(
'sortable' => 1,
'separator' => '',
),
'uses' => array(
'sortable' => 1,
'separator' => '',
),
'maxuses' => array(
'sortable' => 1,
'separator' => '',
),
'begins' => array(
'sortable' => 1,
'separator' => '',
),
'expires' => array(
'sortable' => 1,
'separator' => '',
),
'lastused' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'tid' => array(
'separator' => '',
),
),
'default' => 'created',
'execution_type' => '1',
'display_type' => '0',
'hide_select_all' => 0,
'skip_confirmation' => 0,
'display_result' => 1,
'merge_single_action' => 0,
'selected_operations' => array(
'regcode_activate_action' => 'regcode_activate_action',
'regcode_deactivate_action' => 'regcode_deactivate_action',
'regcode_delete_action' => 'regcode_delete_action',
'regcode_mailer_mail_action' => 'regcode_mailer_mail_action',
'regcode_tag_action' => 'regcode_tag_action',
'system_message_action' => 0,
'views_bulk_operations_action' => 0,
'views_bulk_operations_script_action' => 0,
'views_bulk_operations_argument_selector_action' => 0,
'system_goto_action' => 0,
'system_send_email_action' => 0,
),
));
}
$views[$view->name] = $view;
return $views;
}