| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Style plugin to create date back/next navigation. 4 * 5 * The style plugin passes some argument values to the theme, and 6 * ensures that the date argument is present and that the default 7 * value is set to the current date. 8 */ 9 class date_navigation_plugin_style extends views_plugin_style { 10 11 /** 12 * Style validation. 13 */ 14 function validate() { 15 $errors = parent::validate(); 16 17 $arguments = $this->display->handler->get_option('arguments'); 18 $count = 0; 19 $found = FALSE; 20 foreach ($arguments as $id => $argument) { 21 if ($argument['field'] == 'date_argument') { 22 if ($count > 0) { 23 $errors[] = t('The %style cannot use more than one Date: Date argument.', array('%style' => $this->definition['title'])); 24 } 25 elseif ($argument['default_argument_type'] != 'date') { 26 $errors[] = t('The %style requires the Date: Date argument be set to default to the current date.', array('%style' => $this->definition['title'])); 27 } 28 $count++; 29 $found = TRUE; 30 } 31 } 32 if (!$found) { 33 $errors[] = t('The %style requires the Date: Date argument.', array('%style' => $this->definition['title'])); 34 } 35 return $errors; 36 } 37 38 function query() { 39 require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_sql.inc'); 40 41 // Bring the argument information into the view so our theme can access it. 42 $i = 0; 43 foreach ($this->view->argument as $id => $argument) { 44 if ($id == 'date_argument') { 45 $this->view->date_info->granularity = $argument->granularity; 46 $this->view->date_info->date_arg = !empty($this->view->args) && count($this->view->args) > $argument->position ? $this->view->args[$argument->position] : ''; 47 $this->view->date_info->date_arg_pos = $i; 48 $this->view->date_info->year = isset($argument->year) ? $argument->year : NULL; 49 $this->view->date_info->month = isset($argument->month) ? $argument->month: NULL; 50 $this->view->date_info->day = isset($argument->day) ? $argument->day : NULL; 51 $this->view->date_info->week = isset($argument->week) ? $argument->week : NULL; 52 $this->view->date_info->min_date = $argument->min_date; 53 $this->view->date_info->max_date = $argument->max_date; 54 $this->view->date_info->url = $this->view->get_url(); 55 } 56 $i++; 57 } 58 59 // bring the node type into the query so we can use it in the theme 60 $this->view->query->add_field('node', 'type'); 61 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |