/[drupal]/contributions/modules/og_node_approval/og_node_approval.views.inc
ViewVC logotype

Contents of /contributions/modules/og_node_approval/og_node_approval.views.inc

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


Revision 1.1 - (show annotations) (download) (as text)
Fri Nov 7 00:50:06 2008 UTC (12 months, 2 weeks ago) by mradcliffe
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1, DRUPAL-6--2
File MIME type: text/x-php
  * new module og_node_approval
1 <?php
2 /* $Id$ */
3
4 /**
5 * hook_views_data -- define our views
6 */
7 function og_node_approval_views_data()
8 {
9 $atype = variable_get('approval_type',2);
10
11 $data['og_node_approval']['table']['group'] = t('Node');
12
13 $data['og_node_approval']['table']['join'] = array(
14 'node' => array(
15 'left_field' => 'nid',
16 'field' => 'nid',
17 ),
18 );
19
20 $data['og_node_approval']['status'] = array(
21 'title' => t('Node Approval: User Status'),
22 'help' => t('The integer value for a particular user approval of this node.'),
23 'field' => array(
24 'handler' => 'views_handler_field_numeric',
25 'click sortable' => TRUE,
26 ),
27 'sort' => array(
28 'handler' => 'views_handler_sort',
29 ),
30 'filter' => array(
31 'handler' => 'views_handler_filter_numeric',
32 ),
33 );
34
35
36 $data['og_node_approval']['uid'] = array(
37 'title' => t('Node Approval: User Id'),
38 'help' => t('The user id associated with the node approval and node'),
39 'field' => array(
40 'handler' => 'views_handler_field',
41 'click sortable' => TRUE,
42 ),
43 'relationship' => array(
44 'handler' => 'views_handler_relationship',
45 'base' => 'users',
46 'relationship field' => 'uid',
47 'label' => t('Node Approval: Users'),
48 ),
49 );
50
51 if ($atype == 2)
52 _og_node_approval_views_add_node_status($data);
53 else if ($atype == 0)
54 _og_node_approval_views_add_status_handler($data);
55
56 return $data;
57
58 } // function og_node_approval_views_data
59
60
61 /**
62 * _og_node_approval_views_add_node_status -- only add this to views if we're using node_status table
63 */
64 function _og_node_approval_views_add_node_status(&$data)
65 {
66 $data['node_status']['table']['group'] = t('Node');
67 $data['node_status']['table']['join'] = array(
68 'node' => array(
69 'left_field' => 'nid',
70 'field' => 'nid',
71 ),
72 );
73
74 $data['node_status']['status'] = array(
75 'title' => t('Node Approval: Status'),
76 'help' => t('The integer value for a particular node approval status.'),
77 'field' => array(
78 'handler' => 'views_handler_field_numeric',
79 'click sortable' => TRUE,
80 ),
81 'sort' => array(
82 'handler' => 'views_handler_sort',
83 ),
84 'filter' => array(
85 'handler' => 'views_handler_filter_numeric',
86 ),
87 );
88 } // function _og_node_approval_views_add_node_status
89
90
91 function _og_node_approval_views_add_status_handler(&$data)
92 {
93
94 } // fuction _og_node_approval_views_add_status_handler

  ViewVC Help
Powered by ViewVC 1.1.2