aboutsummaryrefslogtreecommitdiff
path: root/includes/video.views.inc
blob: 1f0682e0276319a812772fb3cbd30bcae0d849fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
//$Id$
/**
* Provides views data and enumerates handlers for video.module
*
* @return
*   array - Enables support in the video module for views integration
* @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com>
* @todo
**/

function video_views_data() {
  // Basic table information.
  // ----------------------------------------------------------------
  // views table
  $data['video']['table']['group']  = t('Video');
  $data['video']['table']['join'] = array(
    // ...to the node table
    'node' => array(
      'left_field' => 'nid',
      'field' => 'vid',
    ),
  );

 // Fields that can be inserted into a view
 // play counter
  $data['video']['play_counter'] = array(
    'title' => t('Play count'),
    'help' => t('This will display the number of times this has been played.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
     ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'title' => t('Play count'),
      'help' => t('Sort by the number of video plays.'),
      'handler' => 'views_handler_sort',
    ),
  );
  $data['video']['download_counter'] = array(
    'title' => t('Download count'),
    'help' => t('This will display the number of times this has been downloaded.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
     ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'title' => t('Download count'),
      'help' => t('Sort by the number of video downloads.'),
      'handler' => 'views_handler_sort',
    ),
  );    
  $data['video']['videox'] = array(
    'title' => t('Width (x)'),
    'help' => t('This will display the width (x) of the video'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
     ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );         
  $data['video']['videoy'] = array(
    'title' => t('Height (y)'),
    'help' => t('This will display the height (y) of the video'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
     ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );         
  $data['video']['playtime_seconds'] = array(
    'title' => t('Length'),
    'help' => t('This will display the play length of the video.'),
    'field' => array(
      'handler' => 'video_views_handler_field_playtime_seconds',
      'click sortable' => TRUE,
     ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'title' => t('Length'),
      'help' => t('Sort by the video length.'),
      'handler' => 'views_handler_sort',
    ),
  );
  $data['video']['download_link'] = array(
    'real field' => 'vidfile',
    'title' => t('Download link'),
    'help' => t('This will display a download link if the node allows it.'),
    'field' => array(
      'handler' => 'video_views_handler_field_download',
      'click sortable' => FALSE,
     )
  );
  $data['video']['play_link'] = array(
    'real field' => 'vidfile',
    'title' => t('Play link'),
    'help' => t('This will display a play link if the node allows it.'),
    'field' => array(
      'handler' => 'video_views_handler_field_play',
      'click sortable' => FALSE,
     ),
  );

  // Add video_image support only if the video_image module is enabled
  if (module_exists('video_image')) {
    $data['video']['video_image'] = array(
      'real field' => 'vidfile',
      'title' => t('Thumbnail'),
      'help' => t('This will display the thumbnail image for the video.'),
      'field' => array(
        'handler' => 'video_views_handler_field_image',
        'click sortable' => FALSE,
      ),
    );
  }
  return $data;
}