Posted by fred0 on June 18, 2009 at 11:07pm
Jump to:
| Project: | Views Calc |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (works as designed) |
Issue Summary
I created what I thought to be a fairly simple view with this module to give a quick list of new user signups in a date range and, while it works, every time I load the view, I get "An illegal choice has been detected. Please contact the site administrator." Can't figure out what it might be since the error isn't very descriptive.
Here's the export from views:
$view = new view;
$view->name = 'signup_report';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'created' => array(
'label' => 'Created date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => 'm/d/Y',
'exclude' => 0,
'id' => 'created',
'table' => 'users',
'field' => 'created',
'relationship' => 'none',
),
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'mail' => array(
'label' => 'E-mail',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => '0',
'exclude' => 0,
'id' => 'mail',
'table' => 'users',
'field' => 'mail',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'rid' => array(
'label' => 'Roles',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'exclude' => 0,
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'date_filter' => array(
'operator' => 'between',
'value' => array(
'value' => NULL,
'min' => NULL,
'max' => NULL,
'default_date' => 'now',
'default_to_date' => 'now',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'date_filter_op',
'identifier' => 'date_filter',
'label' => 'Date Range',
'optional' => 0,
'remember' => 1,
),
'date_fields' => array(
'users.created' => 'users.created',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => 'now',
'default_to_date' => 'now',
'year_range' => '-10:+0',
'id' => 'date_filter',
'table' => 'users',
'field' => 'date_filter',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('access', array(
'type' => 'role',
'role' => array(
'3' => 3,
),
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Signups Report');
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'views_calc');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'desc',
'columns' => array(
'created' => 'created',
'name' => 'name',
'mail' => 'mail',
'rid' => 'rid',
),
'info' => array(
'created' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(
'COUNT' => 'COUNT',
),
),
'name' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 1,
'calc' => array(
'COUNT' => 'COUNT',
),
),
'mail' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(),
),
'rid' => array(
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 1,
'calc' => array(
'COUNT' => 'COUNT',
),
),
),
'default' => 'created',
'detailed_values' => '0',
));
$handler = $view->new_display('page', 'List Page', 'page_1');
$handler->override_option('path', 'signups');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Signups Report',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comments
#1
Tested together with date.module (latest dev) and exposed dates work cleanly meanwhile.
BTW: There seems to be a bug in the exposed date filter.. You might hit issues that the date entered won't be the date matched in the database.
Push this issue in the date module if it's still not fixed for you.