view->date_info->forbid)) { drupal_not_found(); exit; } return parent::render(); } /** * Display validation. */ function validate() { $errors = parent::validate(); $arguments = $this->display->handler->get_option('arguments'); if (!in_array('date_argument', array_keys($arguments))) { if (empty($this->view->date_info->arg_missing)) { $errors[] = t("The Calendar display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title'])); } $this->view->date_info->arg_missing = TRUE; } elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') { if (empty($this->view->date_info->arg_missing_default)) { $errors[] = calendar_errors('missing_argument_default'); } $this->view->date_info->arg_missing_default = TRUE; } return $errors; } function get_style_type() { return 'calendar'; } function defaultable_sections($section = NULL) { if (in_array($section, array('style_plugin', 'row_options', 'row_plugin', 'items_per_page'))) { return FALSE; } return parent::defaultable_sections($section); } /** * Override some of the parent options. */ function options(&$display) { parent::options($display); $display['displays'] = array(); $display['style_plugin'] = 'calendar_nav'; $display['items_per_page'] = 0; $display['row_plugin'] = ''; $display['defaults']['style_plugin'] = FALSE; $display['defaults']['style_options'] = FALSE; $display['defaults']['row_plugin'] = FALSE; $display['defaults']['row_options'] = FALSE; $display['defaults']['items_per_page'] = FALSE; } /** * Add custom option definitions. */ function option_definition() { $options = parent::option_definition(); $options['calendar_colors'] = array('default' => array()); $options['calendar_colors_vocabulary'] = array('default' => array()); $options['calendar_colors_taxonomy'] = array('default' => array()); $options['calendar_colors_group'] = array('default' => array()); $options['calendar_popup'] = array('default' => 0); $options['calendar_date_link'] = array('default' => ''); return $options; } /** * Provide the summary for attachment options in the views UI. * * This output is returned as an array. */ function options_summary(&$categories, &$options) { // It is very important to call the parent function here: parent::options_summary($categories, $options); $variables = array( 'module' => 'calendar', 'topic' => 'settings', ); $categories['calendar_settings'] = array( 'title' => theme('advanced_help_topic', $variables) . t('Calendar settings'), ); $colors = $this->get_option('calendar_colors'); $colors_taxonomy = $this->get_option('calendar_colors_taxonomy'); $options['calendar_colors'] = array( 'category' => 'calendar_settings', 'title' => t('Legend Content Types'), 'value' => t('Edit'), ); $options['calendar_colors_vocabulary'] = array( 'category' => 'calendar_settings', 'title' => t('Legend Vocabularies'), 'value' => t('Edit'), ); $options['calendar_colors_taxonomy'] = array( 'category' => 'calendar_settings', 'title' => t('Legend Terms'), 'value' => t('Edit'), ); if (function_exists('og_all_groups_options')) { $colors_group = $this->get_option('calendar_colors_group'); $options['calendar_colors_group'] = array( 'category' => 'calendar_settings', 'title' => t('Legend Groups'), 'value' => t('Edit'), ); } $popup_options = $this->popup_options(); $default = $this->get_option('calendar_popup'); $options['calendar_popup'] = array( 'category' => 'calendar_settings', 'title' => t('Date changer'), 'value' => isset($default) ? $popup_options[$default] : $popup_options[0], ); $default = $this->get_option('calendar_date_link'); $options['calendar_date_link'] = array( 'category' => 'calendar_settings', 'title' => t('Add new date link'), 'value' => !empty($default) ? check_plain(node_type_get_name($default)) : t('None'), ); } function popup_options() { return array(0 => t('No'), 1 => t('Yes')); } /** * @TODO Figure out how to get the colorpicker working in D7. */ function options_form(&$form, &$form_state) { // It is very important to call the parent function here: parent::options_form($form, $form_state); switch ($form_state['section']) { case 'calendar_popup': $form['#title'] .= t('Date changer'); $form['calendar_popup'] = array( '#type' => 'radios', '#default_value' => $this->get_option('calendar_popup'), '#options' => $this->popup_options(), '#description' => t('Display a popup calendar date selector?'), ); break; case 'calendar_date_link': $form['#title'] .= t('Add new date link'); $form['calendar_date_link'] = array( '#type' => 'radios', '#default_value' => $this->get_option('calendar_date_link'), '#options' => array('' => t('No link')) + node_type_get_names(), '#description' => t('Display a link to add a new date of the specified content type. Displayed only to users with appropriate permissions.'), ); break; case 'calendar_colors': $method = 'types'; // TODO Move the embedded styles other than the color into a stylesheet. $form['#title'] .= t('Content Type Legend Colors'); $form['calendar_colors']['#tree'] = TRUE; $form['calendar_colors']['#prefix'] = '
' . t('Set a hex color value (like #ffffff) to use in the calendar legend for each content type. Types with empty values will have no stripe in the calendar and will not be added to the legend.') . '
' . t('Set a hex color value (like #ffffff) to use in the calendar legend for each taxonomy term. Terms with empty values will have no stripe in the calendar and will not be added to the legend. IMPORTANT!You must add the taxonomy field, Taxonomy: Term ID, to the view for this to do anything. You can exclude it from output if you do not want to see it in the view, but the field must be included.') . '
' . t('Set a hex color value (like #ffffff) to use in the calendar legend for each group. Groups with empty values will have no stripe in the calendar and will not be added to the legend.') .'