Projet

Général

Profil

Paste
Télécharger (3,63 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / print / print_pdf / print_pdf.views.inc @ a2baadd1

1
<?php
2

    
3
/**
4
 * @file
5
 * PDF Version Views integration
6
 *
7
 * @ingroup print
8
 */
9

    
10
/**
11
 * Implements hook_views_data().
12
 */
13
function print_pdf_views_data() {
14
  // The 'group' index will be used as a prefix in the UI for any of this
15
  // table's fields, sort criteria, etc. so it's easy to tell where they came
16
  // from.
17
  $data['print_pdf_node_conf']['table']['group'] = t('Printer-friendly version');
18
  $data['print_pdf_page_counter']['table']['group'] = t('Printer-friendly version');
19

    
20
  // This table references the {node} table. The declaration below creates an
21
  // 'implicit' relationship to the node table, so that when 'node' is the base
22
  // table, the fields are automatically available.
23
  $data['print_pdf_node_conf']['table']['join']['node'] = array(
24
    // 'left_field' is the primary key in the referenced table.
25
    // 'field' is the foreign key in this table.
26
    'left_field' => 'nid',
27
    'field' => 'nid',
28
//    'type' => 'INNER',
29
  );
30
  $data['print_pdf_page_counter']['table']['join']['node'] = array(
31
    // 'left_field' is the primary key in the referenced table.
32
    // 'field' is the foreign key in this table.
33
    'left_field' => 'nid',
34
    'field' => 'path',
35
//    'type' => 'INNER',
36
    'handler' => 'print_join_page_counter',
37
  );
38

    
39
  // print_pdf_node_conf fields
40
  $data['print_pdf_node_conf']['link'] = array(
41
    'title' => t('PDF: Show link'),
42
    'help' => t('Whether to show the PDF version link.'),
43
    'field' => array(
44
      'handler' => 'views_handler_field_boolean',
45
      'click sortable' => TRUE,
46
    ),
47
    'filter' => array(
48
      'handler' => 'views_handler_filter_boolean_operator',
49
      'label' => t('Active'),
50
      'type' => 'yes-no',
51
    ),
52
    'sort' => array(
53
      'handler' => 'views_handler_sort',
54
    ),
55
  );
56
  $data['print_pdf_node_conf']['comments'] = array(
57
    'title' => t('PDF: Show link in individual comments'),
58
    'help' => t('Whether to show the PDF version link in individual comments.'),
59
    'field' => array(
60
      'handler' => 'views_handler_field_boolean',
61
      'click sortable' => TRUE,
62
    ),
63
    'filter' => array(
64
      'handler' => 'views_handler_filter_boolean_operator',
65
      'label' => t('Active'),
66
      'type' => 'yes-no',
67
    ),
68
    'sort' => array(
69
      'handler' => 'views_handler_sort',
70
    ),
71
  );
72
  $data['print_pdf_node_conf']['url_list'] = array(
73
    'title' => t('PDF: Show Printer-friendly URLs list'),
74
    'help' => t('Whether to show the URL list.'),
75
    'field' => array(
76
      'handler' => 'views_handler_field_boolean',
77
      'click sortable' => TRUE,
78
    ),
79
    'filter' => array(
80
      'handler' => 'views_handler_filter_boolean_operator',
81
      'label' => t('Active'),
82
      'type' => 'yes-no',
83
    ),
84
    'sort' => array(
85
      'handler' => 'views_handler_sort',
86
    ),
87
  );
88

    
89

    
90
  // print_pdf_page_counter fields
91
  $data['print_pdf_page_counter']['totalcount'] = array(
92
    'title' => t('PDF: Number of page accesses'),
93
    'help' => t('Counter of accesses to the PDF version for this node.'),
94
    'field' => array(
95
      'handler' => 'views_handler_field_numeric',
96
      'click sortable' => TRUE,
97
    ),
98
    'sort' => array(
99
      'handler' => 'views_handler_sort',
100
    ),
101
    'filter' => array(
102
      'handler' => 'views_handler_filter_numeric',
103
    ),
104
  );
105
  $data['print_pdf_page_counter']['timestamp'] = array(
106
    'title' => t('PDF: Last access'),
107
    'help' => t("The date of the last access to the node's PDF version."),
108
    'field' => array(
109
      'handler' => 'views_handler_field_date',
110
      'click sortable' => TRUE,
111
    ),
112
    'sort' => array(
113
      'handler' => 'views_handler_sort_date',
114
    ),
115
    'filter' => array(
116
      'handler' => 'views_handler_filter_date',
117
    ),
118
  );
119

    
120
  return $data;
121
}