[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/calendar/includes/ -> calendar_plugin_display_block.inc (source)

   1  <?php
   2  // $Id: calendar_plugin_display_block.inc,v 1.1.2.12 2010/12/28 15:35:50 karens Exp $
   3  /**
   4   * The plugin that handles a calendar block.
   5   * 
   6   * The only style option that will be available is the calendar
   7   * style, which creates the navigation and links to other calendar
   8   * displays. All options for paging, row plugins, etc. are
   9   * deferred to the attachments.
  10   */
  11  class calendar_plugin_display_block extends views_plugin_display_block {
  12  
  13    function init(&$view, &$display, $options = NULL) {
  14      parent::init($view, $display, $options);
  15    }
  16    
  17    /**
  18     * Display validation.
  19     */
  20    function validate() {
  21      $errors = parent::validate();
  22      
  23      $arguments = $this->display->handler->get_option('arguments');
  24      if (!in_array('date_argument', array_keys($arguments))) {
  25        if (empty($this->view->date_info->arg_missing)) {
  26          $errors[] = t("The Calendar period display '@display_title' will not work without a Date argument.", array('@display_title' => $this->definition['title']));      
  27        }
  28        $this->view->date_info->arg_missing = TRUE;
  29      }
  30      elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
  31        if (empty($this->view->date_info->arg_missing_default)) {
  32          $errors[] = calendar_errors('missing_argument_default');      
  33        }
  34        $this->view->date_info->arg_missing_default = TRUE;
  35      }
  36      return $errors;
  37    }
  38    
  39    function get_style_type() { return 'calendar'; }
  40    
  41    function defaultable_sections($section = NULL) {
  42      if (in_array($section, array('style_plugin', 'row_options', 'row_plugin', 'items_per_page'))) {
  43        return FALSE;
  44      }
  45      return parent::defaultable_sections($section);
  46    }
  47  
  48    /**
  49     * Override some of the parent options.
  50     */
  51    function options(&$display) {
  52      parent::options($display);
  53      $display['style_plugin'] = 'calendar_nav';
  54      $display['items_per_page'] = 0;
  55      $display['row_plugin'] = '';
  56      $display['defaults']['style_plugin'] = FALSE;
  57      $display['defaults']['style_options'] = FALSE;
  58      $display['defaults']['items_per_page'] = FALSE;
  59      $display['defaults']['row_plugin'] = FALSE;
  60      $display['defaults']['row_options'] = FALSE;
  61    } 
  62  
  63    /**
  64     * The display block handler returns the structure necessary for a block.
  65     * 
  66     * TODO This can be removed when the patch at http://drupal.org/node/290328
  67     * gets into an official release.
  68     */
  69    function execute() {
  70      // Prior to this being called, the $view should already be set to this
  71      // display, and arguments should be set on the view.
  72      $info['content'] = $this->view->render();
  73      $info['subject'] = filter_xss_admin($this->view->get_title());
  74      if (!empty($this->view->result) || $this->get_option('empty') || !empty($this->view->style_plugin->definition['even empty'])) {
  75        return $info;
  76      }
  77    }
  78  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7