3 * @file Hosting site views integration.
9 * Implements hook_views_data().
11 function hosting_site_views_data() {
12 $data['hosting_site']['table'] = array(
13 'group' => 'Hosting Site',
17 'left_field' => 'vid',
23 $data['hosting_site']['client'] = array(
24 'title' => t('Client'),
25 'help' => t('Relate a node revision to the user who created the revision.'),
26 'relationship' => array(
27 'handler' => 'views_handler_relationship',
30 'label' => t('client'),
34 $data['hosting_site']['db_server'] = array(
35 'title' => t('Database Server'),
36 'help' => t('Database where the site is installed.'),
37 'relationship' => array(
38 'handler' => 'views_handler_relationship',
41 'label' => t('db server'),
45 $data['hosting_site']['profile'] = array(
46 'title' => t('Install Profile'),
47 'help' => t('Type of drupal site.'),
48 'relationship' => array(
49 'handler' => 'views_handler_relationship',
52 'label' => t('profile'),
55 $data['hosting_site']['platform'] = array(
56 'title' => t('Platform'),
57 'help' => t('Platform'),
58 'relationship' => array(
59 'handler' => 'views_handler_relationship',
62 'label' => t('platform'),
66 $data['hosting_site']['verified'] = array(
67 'title' => t('Verified'),
68 'help' => t('The last date verified task run on this site.'),
70 'handler' => 'hosting_views_field_handler_interval',
71 'click sortable' => TRUE
,
75 $data['hosting_site']['last_cron'] = array(
76 'title' => t('Last Cron Run'),
77 'help' => t('The time the last cron run was executed on this site.'),
79 'handler' => 'hosting_views_field_handler_interval',
80 'click sortable' => TRUE
,
83 $data['hosting_site']['language'] = array(
84 'title' => t('Language'),
85 'help' => t('The default language of this site.'),
87 'handler' => 'views_handler_field_hosting_language',
88 'click sortable' => TRUE
,
92 $data['hosting_site']['status'] = array(
93 'title' => t('Status'),
94 'help' => t('The current state of this site.'),
96 'handler' => 'views_handler_field_hosting_site_status',
99 'handler' => 'views_handler_filter_numeric',
106 function hosting_site_views_handlers() {
109 'path' => drupal_get_path('module', 'hosting_site'),
113 'views_handler_field_hosting_language' => array(
114 'parent' => 'views_handler_field',
117 'views_handler_field_hosting_site_status' => array(
118 'parent' => 'views_handler_field',
125 function hosting_site_views_plugins() {
128 'hosting_site_list' => array(
129 'title' => t('Site listing'),
130 'help' => t('Displays sites in a table.'),
131 'handler' => 'views_plugin_style_site_table',
132 'theme' => 'views_view_table',
134 'path' => drupal_get_path('module', 'hosting_site'),
135 'uses row plugin' => FALSE
,
136 'uses fields' => TRUE
,
137 'uses options' => TRUE
,
146 function hosting_site_views_default_views() {
148 $view->name
= 'hosting_site_list';
149 $view->description
= 'Display a list of sites hosted in aegir';
151 $view->view_php
= '';
152 $view->base_table
= 'node';
153 $view->is_cacheable
= FALSE
;
154 $view->api_version
= 2;
155 $view->disabled
= FALSE
; /* Edit this to true to make a default view disabled initially */
156 $handler = $view->new_display('default', 'Defaults', 'default');
157 $handler->override_option('relationships', array(
160 'table' => 'hosting_site',
163 'db_server' => array(
165 'table' => 'hosting_site',
166 'field' => 'db_server',
170 'table' => 'hosting_site',
171 'field' => 'profile',
175 'table' => 'hosting_site',
176 'field' => 'platform',
178 'web_server' => array(
179 'label' => 'web server',
181 'id' => 'web_server',
182 'table' => 'hosting_platform',
183 'field' => 'web_server',
184 'relationship' => 'platform',
187 $handler->override_option('fields', array(
202 'word_boundary' => 1,
207 'status_icon' => '1',
210 'table' => 'hosting_site',
212 'relationship' => 'none',
214 'button' => 'Override',
231 'word_boundary' => 1,
241 'relationship' => 'none',
244 'label' => 'Install Profile',
257 'word_boundary' => 1,
267 'relationship' => 'profile',
270 'label' => 'Language',
283 'word_boundary' => 1,
290 'table' => 'hosting_site',
291 'field' => 'language',
292 'relationship' => 'none',
307 'max_length' => '10',
308 'word_boundary' => 1,
318 'relationship' => 'client',
320 'button' => 'Override',
324 'label' => 'Verified',
337 'word_boundary' => 1,
342 'date_format' => 'small',
343 'custom_date_format' => '',
346 'table' => 'hosting_site',
347 'field' => 'verified',
348 'relationship' => 'none',
351 'label' => 'Platform',
363 'max_length' => '20',
364 'word_boundary' => 1,
374 'relationship' => 'platform',
376 'button' => 'Override',
380 'label' => 'Web Server',
393 'word_boundary' => 1,
403 'relationship' => 'web_server',
405 'button' => 'Override',
409 'label' => 'Database Server',
422 'word_boundary' => 1,
432 'relationship' => 'db_server',
434 'button' => 'Override',
438 $handler->override_option('sorts', array(
444 'relationship' => 'none',
447 $handler->override_option('filters', array(
462 'relationship' => 'none',
478 'table' => 'hosting_site',
480 'relationship' => 'none',
483 $handler->override_option('access', array(
486 $handler->override_option('cache', array(
489 $handler->override_option('items_per_page', 30);
490 $handler->override_option('use_pager', 'mini');
491 $handler->override_option('style_plugin', 'hosting_site_list');
492 $handler->override_option('style_options', array(
499 'status' => 'status',
513 $views[$view->name
] = $view;