/[drupal]/contributions/modules/views/modules/statistics.views_convert.inc
ViewVC logotype

Contents of /contributions/modules/views/modules/statistics.views_convert.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Wed Jun 3 19:06:05 2009 UTC (5 months, 3 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, DRUPAL-6--2-6, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3, DRUPAL-7--3
File MIME type: text/x-php
Whoops, forgot to add these files.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Field conversion for fields handled by this module.
7 */
8
9 /**
10 * Implementation of hook_views_convert().
11 *
12 * Intervene to convert field values from the Views 1 format to the
13 * Views 2 format. Intervene only if $view->add_item() won't produce
14 * the right results, usually needed to set field options or values.
15 */
16 function statistics_views_convert($display, $type, &$view, $field, $id = NULL) {
17 switch ($type) {
18 case 'field':
19 switch ($field['tablename']) {
20 case 'node_counter':
21 switch ($field['field']) {
22 case 'timestamp':
23 $handlers = array(
24 'views_handler_field_date_small' => 'small',
25 'views_handler_field_date' => 'medium',
26 'views_handler_field_date_large' => 'large',
27 'views_handler_field_date_custom' => 'custom',
28 'views_handler_field_since' => 'time ago',
29 );
30 $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]);
31 if (!empty($field['options'])) {
32 $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']);
33 }
34 break;
35 }
36 break;
37 }
38 break;
39 case 'sort':
40 switch ($field['tablename']) {
41 case 'node_counter':
42 switch ($field['field']) {
43 case 'timestamp':
44 $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options'];
45 $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']);
46 break;
47 }
48 break;
49 }
50 break;
51 }
52 }

  ViewVC Help
Powered by ViewVC 1.1.2