| 1 |
<?php
|
| 2 |
// $Id: ad_views.views.inc,v 1.17 2009/09/10 12:06:14 milesgillham Exp $
|
| 3 |
/*
|
| 4 |
* @file
|
| 5 |
*
|
| 6 |
* This file provides multiple module Views interfaces:
|
| 7 |
* Ad Module (ad)
|
| 8 |
* Implemented as a separate base type.
|
| 9 |
* {ads}
|
| 10 |
* {ad_statistics}
|
| 11 |
* {ad_clicks}
|
| 12 |
* Ad External (ad_external)
|
| 13 |
* {ad_external}
|
| 14 |
* Ad HTML (ad_html)
|
| 15 |
* {ad_html}
|
| 16 |
* Ad Image (ad_image)
|
| 17 |
* {ad_image}
|
| 18 |
* {ad_image_format}
|
| 19 |
* Ad Notify (ad_notify)
|
| 20 |
* {ad_notify}
|
| 21 |
* {ad_owners}
|
| 22 |
* {ad_permissions}
|
| 23 |
* {ad_hosts}
|
| 24 |
* Ad Text (ad_text)
|
| 25 |
* {ad_text}
|
| 26 |
* Flash Ad (ad_flash)
|
| 27 |
* {ad_flash}
|
| 28 |
* {ad_flash_format}
|
| 29 |
* Ad GeoIP (ad_geoip)
|
| 30 |
* {ad_geoip_codes}
|
| 31 |
* {ad_geoip_ads_country}
|
| 32 |
* {ad_geoip_ads_city}
|
| 33 |
* {ad_geoip_ads_region}
|
| 34 |
* Ad Memcache (ad_memcache)
|
| 35 |
* None.
|
| 36 |
*
|
| 37 |
*/
|
| 38 |
|
| 39 |
/*
|
| 40 |
* Implements hook_views_plugins()
|
| 41 |
*/
|
| 42 |
|
| 43 |
function ad_views_views_plugins() {
|
| 44 |
$data = array();
|
| 45 |
$data['row']['ad'] = array(
|
| 46 |
'title' => t('Advertisement'),
|
| 47 |
'help' => t('Display the advertisement node view.'),
|
| 48 |
'handler' => 'ad_views_plugin_row_ad',
|
| 49 |
'theme' => 'ad_views_view_row_ad',
|
| 50 |
'uses options' => TRUE,
|
| 51 |
'type' => 'normal',
|
| 52 |
);
|
| 53 |
return $data;
|
| 54 |
}
|
| 55 |
|
| 56 |
/*
|
| 57 |
* Implements hook_views_data()
|
| 58 |
*/
|
| 59 |
|
| 60 |
function ad_views_views_data() {
|
| 61 |
$ad_data = array();
|
| 62 |
// If the Views module and the Ad module are present then provide some views support
|
| 63 |
if ((module_exists('views')) && (module_exists('ad'))) {
|
| 64 |
// Primary table(s) supplied by Ad module
|
| 65 |
$ad_data = array_merge($ad_data, get_ad_views_data());
|
| 66 |
// We support these modules by module name
|
| 67 |
// TODO, just look up all .inc files of the right format and load
|
| 68 |
$supported_modules = array('ad_text', 'ad_image', 'ad_external', 'ad_flash');
|
| 69 |
// Step through each module to load efficiently only what is required
|
| 70 |
foreach ($supported_modules as $module) {
|
| 71 |
// File name is ad_views.views-module.inc
|
| 72 |
module_load_include('inc', 'ad_views', 'ad_views.views-'. $module);
|
| 73 |
// Load function is get_module_views_data()
|
| 74 |
$func = 'get_'. $module .'_views_data';
|
| 75 |
$ad_data = array_merge($ad_data, $func());
|
| 76 |
}
|
| 77 |
}
|
| 78 |
return $ad_data;
|
| 79 |
}
|
| 80 |
|
| 81 |
#####################################################################
|
| 82 |
### Internal functions
|
| 83 |
#####################################################################
|
| 84 |
|
| 85 |
/*
|
| 86 |
* Ad Module
|
| 87 |
* ads is a valid base as it has first class data
|
| 88 |
*/
|
| 89 |
function get_ad_views_data() {
|
| 90 |
$data = array();
|
| 91 |
$data['ads']['table']['group'] = t('Ad');
|
| 92 |
$data['ad_statistics']['table']['group'] = t('Ad Stats');
|
| 93 |
$data['ad_clicks']['table']['group'] = t('Ad Clicks');
|
| 94 |
// Base table is 'ads'
|
| 95 |
$data['ads']['table']['base'] = array(
|
| 96 |
'field' => 'aid',
|
| 97 |
'title' => t('Advertisement'),
|
| 98 |
'help' => t('The Ad item type allows views of Ad Module advertisements.'),
|
| 99 |
'weight' => -10
|
| 100 |
);
|
| 101 |
|
| 102 |
// Join to Ads from Taxonomy Terms via a bunch of tables
|
| 103 |
$data['term_data']['table']['join']['ads'] = array(
|
| 104 |
'left_field' => 'tid',
|
| 105 |
'field' => 'tid'
|
| 106 |
);
|
| 107 |
$data['term_node']['table']['join']['ads'] = array(
|
| 108 |
'left_field' => 'tid',
|
| 109 |
'field' => 'tid'
|
| 110 |
);
|
| 111 |
$data['node']['table']['join']['ads'] = array(
|
| 112 |
'left_table' => 'ads',
|
| 113 |
'left_field' => 'aid',
|
| 114 |
'field' => 'nid'
|
| 115 |
);
|
| 116 |
|
| 117 |
// ad_statistics is a related table to ads
|
| 118 |
$data['ad_statistics']['table']['join']['ads'] = array(
|
| 119 |
'left_field' => 'aid',
|
| 120 |
'field' => 'aid'
|
| 121 |
);
|
| 122 |
// ad_clicks is a related table to ads
|
| 123 |
$data['ad_clicks']['table']['join']['ads'] = array(
|
| 124 |
'left_field' => 'aid',
|
| 125 |
'field' => 'aid'
|
| 126 |
);
|
| 127 |
// Ad ID - 'aid'
|
| 128 |
$data['ads']['aid'] = array(
|
| 129 |
'title' => t('Aid'),
|
| 130 |
// The help that appears on the UI
|
| 131 |
'help' => t('The Ad ID of the ad.'),
|
| 132 |
// Information for displaying
|
| 133 |
'field' => array(
|
| 134 |
'handler' => 'views_handler_field_numeric',
|
| 135 |
'click sortable' => TRUE
|
| 136 |
),
|
| 137 |
// Information for accepting as an argument
|
| 138 |
'argument' => array(
|
| 139 |
'handler' => 'views_handler_argument_numeric',
|
| 140 |
'name field' => 'title',
|
| 141 |
'numeric' => TRUE,
|
| 142 |
'validate type' => 'aid'
|
| 143 |
),
|
| 144 |
// Information for accepting as a filter
|
| 145 |
'filter' => array(
|
| 146 |
'handler' => 'views_handler_filter_numeric'
|
| 147 |
),
|
| 148 |
// Information for sorting
|
| 149 |
'sort' => array(
|
| 150 |
'handler' => 'views_handler_sort'
|
| 151 |
)
|
| 152 |
);
|
| 153 |
// Ad uid - 'uid'
|
| 154 |
$data['ads']['uid'] = array(
|
| 155 |
'title' => t('User'),
|
| 156 |
// The help that appears on the UI
|
| 157 |
'help' => t('The {users}.uid that owns this node; initially, this is the user that created it.'),
|
| 158 |
// Table relationship
|
| 159 |
'relationship' => array(
|
| 160 |
'label' => t('User'),
|
| 161 |
'base' => 'users',
|
| 162 |
'base field' => 'uid',
|
| 163 |
// This allows us to not show this relationship if the base is already
|
| 164 |
// user so users won't create circular relationships.
|
| 165 |
'skip base' => array('users')
|
| 166 |
)
|
| 167 |
);
|
| 168 |
// Ad Status - 'adstatus'
|
| 169 |
$data['ads']['adstatus'] = array(
|
| 170 |
'title' => t('Status'),
|
| 171 |
// The help that appears on the UI
|
| 172 |
'help' => t('The approval status of the ad.'),
|
| 173 |
// Information for displaying
|
| 174 |
'field' => array(
|
| 175 |
'handler' => 'views_handler_field',
|
| 176 |
'click sortable' => TRUE
|
| 177 |
),
|
| 178 |
// Information for accepting as an argument
|
| 179 |
'argument' => array(
|
| 180 |
'handler' => 'views_handler_argument_string',
|
| 181 |
'name field' => 'title',
|
| 182 |
'numeric' => FALSE,
|
| 183 |
),
|
| 184 |
// Information for accepting as a filter
|
| 185 |
'filter' => array(
|
| 186 |
'handler' => 'views_handler_filter_string'
|
| 187 |
),
|
| 188 |
// Information for sorting
|
| 189 |
'sort' => array(
|
| 190 |
'handler' => 'views_handler_sort'
|
| 191 |
)
|
| 192 |
);
|
| 193 |
// Ad Type - 'adtype'
|
| 194 |
$data['ads']['adtype'] = array(
|
| 195 |
'title' => t('Type'),
|
| 196 |
// The help that appears on the UI
|
| 197 |
'help' => t('The type of ad.'),
|
| 198 |
// Information for displaying
|
| 199 |
'field' => array(
|
| 200 |
'handler' => 'views_handler_field',
|
| 201 |
'click sortable' => TRUE
|
| 202 |
),
|
| 203 |
// Information for accepting as an argument
|
| 204 |
'argument' => array(
|
| 205 |
'handler' => 'views_handler_argument_string',
|
| 206 |
'name field' => 'title',
|
| 207 |
'numeric' => FALSE,
|
| 208 |
),
|
| 209 |
// Information for accepting as a filter
|
| 210 |
'filter' => array(
|
| 211 |
'handler' => 'views_handler_filter_string'
|
| 212 |
),
|
| 213 |
// Information for sorting
|
| 214 |
'sort' => array(
|
| 215 |
'handler' => 'views_handler_sort'
|
| 216 |
)
|
| 217 |
);
|
| 218 |
// Ad Redirect - 'redirect'
|
| 219 |
$data['ads']['redirect'] = array(
|
| 220 |
'title' => t('Redirect URL'),
|
| 221 |
// The help that appears on the UI
|
| 222 |
'help' => t('The URL to redirect to.'),
|
| 223 |
// Information for displaying
|
| 224 |
'field' => array(
|
| 225 |
'handler' => 'views_handler_field_url',
|
| 226 |
'click sortable' => TRUE
|
| 227 |
),
|
| 228 |
// Information for accepting as an argument
|
| 229 |
'argument' => array(
|
| 230 |
'handler' => 'views_handler_argument_string',
|
| 231 |
'name field' => 'title',
|
| 232 |
'numeric' => FALSE,
|
| 233 |
),
|
| 234 |
// Information for accepting as a filter
|
| 235 |
'filter' => array(
|
| 236 |
'handler' => 'views_handler_filter_string'
|
| 237 |
),
|
| 238 |
// Information for sorting
|
| 239 |
'sort' => array(
|
| 240 |
'handler' => 'views_handler_sort'
|
| 241 |
)
|
| 242 |
);
|
| 243 |
// Ad autoactivate - 'autoactivate'
|
| 244 |
$data['ads']['autoactivate'] = array(
|
| 245 |
'title' => t('Auto activate'),
|
| 246 |
// The help that appears on the UI
|
| 247 |
'help' => t('Is ad autoactivating?'),
|
| 248 |
// Information for displaying
|
| 249 |
'field' => array(
|
| 250 |
'handler' => 'views_handler_field_boolean',
|
| 251 |
'click sortable' => TRUE
|
| 252 |
),
|
| 253 |
// Information for accepting as an argument
|
| 254 |
'argument' => array(
|
| 255 |
'handler' => 'views_handler_argument_numeric',
|
| 256 |
'name field' => 'title',
|
| 257 |
'numeric' => TRUE,
|
| 258 |
),
|
| 259 |
// Information for accepting as a filter
|
| 260 |
'filter' => array(
|
| 261 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 262 |
),
|
| 263 |
// Information for sorting
|
| 264 |
'sort' => array(
|
| 265 |
'handler' => 'views_handler_sort'
|
| 266 |
)
|
| 267 |
);
|
| 268 |
// Ad autoactivated - 'autoactivated'
|
| 269 |
$data['ads']['autoactivated'] = array(
|
| 270 |
'title' => t('Auto activated'),
|
| 271 |
// The help that appears on the UI
|
| 272 |
'help' => t('Is ad autoactivated?'),
|
| 273 |
// Information for displaying
|
| 274 |
'field' => array(
|
| 275 |
'handler' => 'views_handler_field_boolean',
|
| 276 |
'click sortable' => TRUE
|
| 277 |
),
|
| 278 |
// Information for accepting as an argument
|
| 279 |
'argument' => array(
|
| 280 |
'handler' => 'views_handler_argument_numeric',
|
| 281 |
'name field' => 'title',
|
| 282 |
'numeric' => TRUE,
|
| 283 |
),
|
| 284 |
// Information for accepting as a filter
|
| 285 |
'filter' => array(
|
| 286 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 287 |
),
|
| 288 |
// Information for sorting
|
| 289 |
'sort' => array(
|
| 290 |
'handler' => 'views_handler_sort'
|
| 291 |
)
|
| 292 |
);
|
| 293 |
// Ad autoexpire - 'autoexpire'
|
| 294 |
$data['ads']['autoexpire'] = array(
|
| 295 |
'title' => t('Auto expire'),
|
| 296 |
// The help that appears on the UI
|
| 297 |
'help' => t('Is ad autoexpiring?'),
|
| 298 |
// Information for displaying
|
| 299 |
'field' => array(
|
| 300 |
'handler' => 'views_handler_field_boolean',
|
| 301 |
'click sortable' => TRUE
|
| 302 |
),
|
| 303 |
// Information for accepting as an argument
|
| 304 |
'argument' => array(
|
| 305 |
'handler' => 'views_handler_argument_numeric',
|
| 306 |
'name field' => 'title',
|
| 307 |
'numeric' => TRUE,
|
| 308 |
),
|
| 309 |
// Information for accepting as a filter
|
| 310 |
'filter' => array(
|
| 311 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 312 |
),
|
| 313 |
// Information for sorting
|
| 314 |
'sort' => array(
|
| 315 |
'handler' => 'views_handler_sort'
|
| 316 |
)
|
| 317 |
);
|
| 318 |
// Ad autoexpired - 'autoexpired'
|
| 319 |
$data['ads']['autoexpired'] = array(
|
| 320 |
'title' => t('Auto expired'),
|
| 321 |
// The help that appears on the UI
|
| 322 |
'help' => t('Is ad autoexpired?'),
|
| 323 |
// Information for displaying
|
| 324 |
'field' => array(
|
| 325 |
'handler' => 'views_handler_field_boolean',
|
| 326 |
'click sortable' => TRUE
|
| 327 |
),
|
| 328 |
// Information for accepting as an argument
|
| 329 |
'argument' => array(
|
| 330 |
'handler' => 'views_handler_argument_numeric',
|
| 331 |
'name field' => 'title',
|
| 332 |
'numeric' => TRUE,
|
| 333 |
),
|
| 334 |
// Information for accepting as a filter
|
| 335 |
'filter' => array(
|
| 336 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 337 |
),
|
| 338 |
// Information for sorting
|
| 339 |
'sort' => array(
|
| 340 |
'handler' => 'views_handler_sort'
|
| 341 |
)
|
| 342 |
);
|
| 343 |
// Ad activated - 'activated'
|
| 344 |
$data['ads']['activated'] = array(
|
| 345 |
'title' => t('Activated'),
|
| 346 |
// The help that appears on the UI
|
| 347 |
'help' => t('Is ad activated?'),
|
| 348 |
// Information for displaying
|
| 349 |
'field' => array(
|
| 350 |
'handler' => 'views_handler_field_boolean',
|
| 351 |
'click sortable' => TRUE
|
| 352 |
),
|
| 353 |
// Information for accepting as an argument
|
| 354 |
'argument' => array(
|
| 355 |
'handler' => 'views_handler_argument_numeric',
|
| 356 |
'name field' => 'title',
|
| 357 |
'numeric' => TRUE,
|
| 358 |
),
|
| 359 |
// Information for accepting as a filter
|
| 360 |
'filter' => array(
|
| 361 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 362 |
),
|
| 363 |
// Information for sorting
|
| 364 |
'sort' => array(
|
| 365 |
'handler' => 'views_handler_sort'
|
| 366 |
)
|
| 367 |
);
|
| 368 |
// Ad maxviews - 'maxviews'
|
| 369 |
$data['ads']['maxviews'] = array(
|
| 370 |
'title' => t('Max views'),
|
| 371 |
// The help that appears on the UI
|
| 372 |
'help' => t('Maximum ad impressions.'),
|
| 373 |
// Information for displaying
|
| 374 |
'field' => array(
|
| 375 |
'handler' => 'views_handler_field_numeric',
|
| 376 |
'click sortable' => TRUE
|
| 377 |
),
|
| 378 |
// Information for accepting as an argument
|
| 379 |
'argument' => array(
|
| 380 |
'handler' => 'views_handler_argument_numeric',
|
| 381 |
'name field' => 'title',
|
| 382 |
'numeric' => TRUE,
|
| 383 |
),
|
| 384 |
// Information for accepting as a filter
|
| 385 |
'filter' => array(
|
| 386 |
'handler' => 'views_handler_filter_numeric'
|
| 387 |
),
|
| 388 |
// Information for sorting
|
| 389 |
'sort' => array(
|
| 390 |
'handler' => 'views_handler_sort'
|
| 391 |
)
|
| 392 |
);
|
| 393 |
// Ad maxclicks - 'maxclicks'
|
| 394 |
$data['ads']['maxclicks'] = array(
|
| 395 |
'title' => t('Max clicks'),
|
| 396 |
// The help that appears on the UI
|
| 397 |
'help' => t('Maximum ad clicks.'),
|
| 398 |
// Information for displaying
|
| 399 |
'field' => array(
|
| 400 |
'handler' => 'views_handler_field_numeric',
|
| 401 |
'click sortable' => TRUE
|
| 402 |
),
|
| 403 |
// Information for accepting as an argument
|
| 404 |
'argument' => array(
|
| 405 |
'handler' => 'views_handler_argument_numeric',
|
| 406 |
'name field' => 'title',
|
| 407 |
'numeric' => TRUE,
|
| 408 |
),
|
| 409 |
// Information for accepting as a filter
|
| 410 |
'filter' => array(
|
| 411 |
'handler' => 'views_handler_filter_numeric'
|
| 412 |
),
|
| 413 |
// Information for sorting
|
| 414 |
'sort' => array(
|
| 415 |
'handler' => 'views_handler_sort'
|
| 416 |
)
|
| 417 |
);
|
| 418 |
// Ad expired - 'expired'
|
| 419 |
$data['ads']['expired'] = array(
|
| 420 |
'title' => t('Expired'),
|
| 421 |
// The help that appears on the UI
|
| 422 |
'help' => t('Is ad expired?'),
|
| 423 |
// Information for displaying
|
| 424 |
'field' => array(
|
| 425 |
'handler' => 'views_handler_field_boolean',
|
| 426 |
'click sortable' => TRUE
|
| 427 |
),
|
| 428 |
// Information for accepting as an argument
|
| 429 |
'argument' => array(
|
| 430 |
'handler' => 'views_handler_argument_numeric',
|
| 431 |
'name field' => 'title',
|
| 432 |
'numeric' => TRUE,
|
| 433 |
),
|
| 434 |
// Information for accepting as a filter
|
| 435 |
'filter' => array(
|
| 436 |
'handler' => 'views_handler_filter_boolean_operator'
|
| 437 |
),
|
| 438 |
// Information for sorting
|
| 439 |
'sort' => array(
|
| 440 |
'handler' => 'views_handler_sort'
|
| 441 |
)
|
| 442 |
);
|
| 443 |
// Ad statistics - 'date'
|
| 444 |
$data['ad_statistics']['date'] = array(
|
| 445 |
'title' => t('Action date'),
|
| 446 |
// The help that appears on the UI
|
| 447 |
'help' => t('Date when action was made.'),
|
| 448 |
// Information for displaying
|
| 449 |
'field' => array(
|
| 450 |
'handler' => 'views_handler_field_date',
|
| 451 |
'click sortable' => TRUE
|
| 452 |
),
|
| 453 |
// Information for accepting as an argument
|
| 454 |
'argument' => array(
|
| 455 |
'handler' => 'views_handler_argument_date',
|
| 456 |
'name field' => 'title',
|
| 457 |
'numeric' => TRUE,
|
| 458 |
),
|
| 459 |
// Information for accepting as a filter
|
| 460 |
'filter' => array(
|
| 461 |
'handler' => 'views_handler_filter_date'
|
| 462 |
),
|
| 463 |
// Information for sorting
|
| 464 |
'sort' => array(
|
| 465 |
'handler' => 'views_handler_sort_date'
|
| 466 |
)
|
| 467 |
);
|
| 468 |
// Ad statistics - 'action'
|
| 469 |
// TODO - can we make this an enum with some custom
|
| 470 |
// handlers?
|
| 471 |
$data['ad_statistics']['action'] = array(
|
| 472 |
'title' => t('Action type'),
|
| 473 |
// The help that appears on the UI
|
| 474 |
'help' => t('Actions: "view", "click", "enable", "disable".'),
|
| 475 |
// Information for displaying
|
| 476 |
'field' => array(
|
| 477 |
'handler' => 'views_handler_field',
|
| 478 |
'click sortable' => TRUE
|
| 479 |
),
|
| 480 |
// Information for accepting as an argument
|
| 481 |
'argument' => array(
|
| 482 |
'handler' => 'views_handler_argument_string',
|
| 483 |
'name field' => 'title',
|
| 484 |
'numeric' => FALSE,
|
| 485 |
),
|
| 486 |
// Information for accepting as a filter
|
| 487 |
'filter' => array(
|
| 488 |
'handler' => 'views_handler_filter_string'
|
| 489 |
),
|
| 490 |
// Information for sorting
|
| 491 |
'sort' => array(
|
| 492 |
'handler' => 'views_handler_sort'
|
| 493 |
)
|
| 494 |
);
|
| 495 |
// Ad statistics - 'adgroup'
|
| 496 |
$data['ad_statistics']['adgroup'] = array(
|
| 497 |
'title' => t('Ad group'),
|
| 498 |
// The help that appears on the UI
|
| 499 |
'help' => t('Ad group.'),
|
| 500 |
// Information for displaying
|
| 501 |
'field' => array(
|
| 502 |
'handler' => 'views_handler_field',
|
| 503 |
'click sortable' => TRUE
|
| 504 |
),
|
| 505 |
// Information for accepting as an argument
|
| 506 |
'argument' => array(
|
| 507 |
'handler' => 'views_handler_argument_string',
|
| 508 |
'name field' => 'title',
|
| 509 |
'numeric' => FALSE,
|
| 510 |
),
|
| 511 |
// Information for accepting as a filter
|
| 512 |
'filter' => array(
|
| 513 |
'handler' => 'views_handler_filter_string'
|
| 514 |
),
|
| 515 |
// Information for sorting
|
| 516 |
'sort' => array(
|
| 517 |
'handler' => 'views_handler_sort'
|
| 518 |
)
|
| 519 |
);
|
| 520 |
// Ad statistics - 'hostid'
|
| 521 |
$data['ad_statistics']['hostid'] = array(
|
| 522 |
'title' => t('Hostid'),
|
| 523 |
// The help that appears on the UI
|
| 524 |
'help' => t('Host from which action was made.'),
|
| 525 |
// Information for displaying
|
| 526 |
'field' => array(
|
| 527 |
'handler' => 'views_handler_field_numeric',
|
| 528 |
'click sortable' => TRUE
|
| 529 |
),
|
| 530 |
// Information for accepting as an argument
|
| 531 |
'argument' => array(
|
| 532 |
'handler' => 'views_handler_argument_numeric',
|
| 533 |
'name field' => 'title',
|
| 534 |
'numeric' => TRUE,
|
| 535 |
'validate type' => 'aid'
|
| 536 |
),
|
| 537 |
// Information for accepting as a filter
|
| 538 |
'filter' => array(
|
| 539 |
'handler' => 'views_handler_filter_numeric'
|
| 540 |
),
|
| 541 |
// Information for sorting
|
| 542 |
'sort' => array(
|
| 543 |
'handler' => 'views_handler_sort'
|
| 544 |
)
|
| 545 |
);
|
| 546 |
// Ad statistics - 'count'
|
| 547 |
$data['ad_statistics']['count'] = array(
|
| 548 |
'title' => t('Action count'),
|
| 549 |
// The help that appears on the UI
|
| 550 |
'help' => t('Count of actions triggered.'),
|
| 551 |
// Information for displaying
|
| 552 |
'field' => array(
|
| 553 |
'handler' => 'views_handler_field_numeric',
|
| 554 |
'click sortable' => TRUE
|
| 555 |
),
|
| 556 |
// Information for accepting as an argument
|
| 557 |
'argument' => array(
|
| 558 |
'handler' => 'views_handler_argument_numeric',
|
| 559 |
'name field' => 'title',
|
| 560 |
'numeric' => TRUE,
|
| 561 |
'validate type' => 'aid'
|
| 562 |
),
|
| 563 |
// Information for accepting as a filter
|
| 564 |
'filter' => array(
|
| 565 |
'handler' => 'views_handler_filter_numeric'
|
| 566 |
),
|
| 567 |
// Information for sorting
|
| 568 |
'sort' => array(
|
| 569 |
'handler' => 'views_handler_sort'
|
| 570 |
)
|
| 571 |
);
|
| 572 |
// Ad statistics - 'extra'
|
| 573 |
$data['ad_statistics']['extra'] = array(
|
| 574 |
'title' => t('Extra'),
|
| 575 |
// The help that appears on the UI
|
| 576 |
'help' => t('Allow add-on modules to provide additional statistics granularity.'),
|
| 577 |
// Information for displaying
|
| 578 |
'field' => array(
|
| 579 |
'handler' => 'views_handler_field',
|
| 580 |
'click sortable' => TRUE
|
| 581 |
),
|
| 582 |
// Information for accepting as an argument
|
| 583 |
'argument' => array(
|
| 584 |
'handler' => 'views_handler_argument_string',
|
| 585 |
'name field' => 'title',
|
| 586 |
'numeric' => FALSE,
|
| 587 |
),
|
| 588 |
// Information for accepting as a filter
|
| 589 |
'filter' => array(
|
| 590 |
'handler' => 'views_handler_filter_string'
|
| 591 |
),
|
| 592 |
// Information for sorting
|
| 593 |
'sort' => array(
|
| 594 |
'handler' => 'views_handler_sort'
|
| 595 |
)
|
| 596 |
);
|
| 597 |
// Ad clicks - 'uid'
|
| 598 |
$data['ad_clicks']['uid'] = array(
|
| 599 |
'title' => t('User'),
|
| 600 |
// The help that appears on the UI
|
| 601 |
'help' => t('The {users}.uid that clicked this node.'),
|
| 602 |
// Table relationship
|
| 603 |
'relationship' => array(
|
| 604 |
'label' => t('User'),
|
| 605 |
'base' => 'users',
|
| 606 |
'base field' => 'uid',
|
| 607 |
// This allows us to not show this relationship if the base is already
|
| 608 |
// user so users won't create circular relationships.
|
| 609 |
'skip base' => array('users')
|
| 610 |
)
|
| 611 |
);
|
| 612 |
// Ad clicks - 'status'
|
| 613 |
$data['ad_clicks']['status'] = array(
|
| 614 |
'title' => t('Status'),
|
| 615 |
// The help that appears on the UI
|
| 616 |
'help' => t('Status.'),
|
| 617 |
// Information for displaying
|
| 618 |
'field' => array(
|
| 619 |
'handler' => 'views_handler_field_numeric',
|
| 620 |
'click sortable' => TRUE
|
| 621 |
),
|
| 622 |
// Information for accepting as an argument
|
| 623 |
'argument' => array(
|
| 624 |
'handler' => 'views_handler_argument_numeric',
|
| 625 |
'name field' => 'title',
|
| 626 |
'numeric' => TRUE,
|
| 627 |
'validate type' => 'aid'
|
| 628 |
),
|
| 629 |
// Information for accepting as a filter
|
| 630 |
'filter' => array(
|
| 631 |
'handler' => 'views_handler_filter_numeric'
|
| 632 |
),
|
| 633 |
// Information for sorting
|
| 634 |
'sort' => array(
|
| 635 |
'handler' => 'views_handler_sort'
|
| 636 |
)
|
| 637 |
);
|
| 638 |
// Ad clicks - 'hostname'
|
| 639 |
$data['ad_clicks']['hostname'] = array(
|
| 640 |
'title' => t('Host name'),
|
| 641 |
// The help that appears on the UI
|
| 642 |
'help' => t('Host from which action was made.'),
|
| 643 |
// Information for displaying
|
| 644 |
'field' => array(
|
| 645 |
'handler' => 'views_handler_field',
|
| 646 |
'click sortable' => TRUE
|
| 647 |
),
|
| 648 |
// Information for accepting as an argument
|
| 649 |
'argument' => array(
|
| 650 |
'handler' => 'views_handler_argument_string',
|
| 651 |
'name field' => 'title',
|
| 652 |
'numeric' => FALSE,
|
| 653 |
),
|
| 654 |
// Information for accepting as a filter
|
| 655 |
'filter' => array(
|
| 656 |
'handler' => 'views_handler_filter_string'
|
| 657 |
),
|
| 658 |
// Information for sorting
|
| 659 |
'sort' => array(
|
| 660 |
'handler' => 'views_handler_sort'
|
| 661 |
)
|
| 662 |
);
|
| 663 |
// Ad clicks - 'user_agent'
|
| 664 |
$data['ad_clicks']['user_agent'] = array(
|
| 665 |
'title' => t('User agent'),
|
| 666 |
// The help that appears on the UI
|
| 667 |
'help' => t('Clicker\'s browser agent.'),
|
| 668 |
// Information for displaying
|
| 669 |
'field' => array(
|
| 670 |
'handler' => 'views_handler_field',
|
| 671 |
'click sortable' => TRUE
|
| 672 |
),
|
| 673 |
// Information for accepting as an argument
|
| 674 |
'argument' => array(
|
| 675 |
'handler' => 'views_handler_argument_string',
|
| 676 |
'name field' => 'title',
|
| 677 |
'numeric' => FALSE,
|
| 678 |
),
|
| 679 |
// Information for accepting as a filter
|
| 680 |
'filter' => array(
|
| 681 |
'handler' => 'views_handler_filter_string'
|
| 682 |
),
|
| 683 |
// Information for sorting
|
| 684 |
'sort' => array(
|
| 685 |
'handler' => 'views_handler_sort'
|
| 686 |
)
|
| 687 |
);
|
| 688 |
// Ad clicks - 'adgroup'
|
| 689 |
$data['ad_clicks']['adgroup'] = array(
|
| 690 |
'title' => t('Ad group'),
|
| 691 |
// The help that appears on the UI
|
| 692 |
'help' => t('Ad group.'),
|
| 693 |
// Information for displaying
|
| 694 |
'field' => array(
|
| 695 |
'handler' => 'views_handler_field',
|
| 696 |
'click sortable' => TRUE
|
| 697 |
),
|
| 698 |
// Information for accepting as an argument
|
| 699 |
'argument' => array(
|
| 700 |
'handler' => 'views_handler_argument_string',
|
| 701 |
'name field' => 'title',
|
| 702 |
'numeric' => FALSE,
|
| 703 |
),
|
| 704 |
// Information for accepting as a filter
|
| 705 |
'filter' => array(
|
| 706 |
'handler' => 'views_handler_filter_string'
|
| 707 |
),
|
| 708 |
// Information for sorting
|
| 709 |
'sort' => array(
|
| 710 |
'handler' => 'views_handler_sort'
|
| 711 |
)
|
| 712 |
);
|
| 713 |
// Ad clicks - 'hostid'
|
| 714 |
$data['ad_clicks']['hostid'] = array(
|
| 715 |
'title' => t('Hostid'),
|
| 716 |
// The help that appears on the UI
|
| 717 |
'help' => t('Host from which action was made.'),
|
| 718 |
// Information for displaying
|
| 719 |
'field' => array(
|
| 720 |
'handler' => 'views_handler_field_numeric',
|
| 721 |
'click sortable' => TRUE
|
| 722 |
),
|
| 723 |
// Information for accepting as an argument
|
| 724 |
'argument' => array(
|
| 725 |
'handler' => 'views_handler_argument_numeric',
|
| 726 |
'name field' => 'title',
|
| 727 |
'numeric' => TRUE,
|
| 728 |
'validate type' => 'aid'
|
| 729 |
),
|
| 730 |
// Information for accepting as a filter
|
| 731 |
'filter' => array(
|
| 732 |
'handler' => 'views_handler_filter_numeric'
|
| 733 |
),
|
| 734 |
// Information for sorting
|
| 735 |
'sort' => array(
|
| 736 |
'handler' => 'views_handler_sort'
|
| 737 |
)
|
| 738 |
);
|
| 739 |
// Ad clicks - 'url'
|
| 740 |
$data['ad_clicks']['url'] = array(
|
| 741 |
'title' => t('URL'),
|
| 742 |
// The help that appears on the UI
|
| 743 |
'help' => t('Clicked URL.'),
|
| 744 |
// Information for displaying
|
| 745 |
'field' => array(
|
| 746 |
'handler' => 'views_handler_field_url',
|
| 747 |
'click sortable' => TRUE
|
| 748 |
),
|
| 749 |
// Information for accepting as an argument
|
| 750 |
'argument' => array(
|
| 751 |
'handler' => 'views_handler_argument_string',
|
| 752 |
'name field' => 'title',
|
| 753 |
'numeric' => FALSE,
|
| 754 |
),
|
| 755 |
// Information for accepting as a filter
|
| 756 |
'filter' => array(
|
| 757 |
'handler' => 'views_handler_filter_string'
|
| 758 |
),
|
| 759 |
// Information for sorting
|
| 760 |
'sort' => array(
|
| 761 |
'handler' => 'views_handler_sort'
|
| 762 |
)
|
| 763 |
);
|
| 764 |
// Ad clicks - 'timestamp'
|
| 765 |
$data['ad_clicks']['timestamp'] = array(
|
| 766 |
'title' => t('Time stamp'),
|
| 767 |
// The help that appears on the UI
|
| 768 |
'help' => t('Date when action was made.'),
|
| 769 |
// Information for displaying
|
| 770 |
'field' => array(
|
| 771 |
'handler' => 'views_handler_field_date',
|
| 772 |
'click sortable' => TRUE
|
| 773 |
),
|
| 774 |
// Information for accepting as an argument
|
| 775 |
'argument' => array(
|
| 776 |
'handler' => 'views_handler_argument_date',
|
| 777 |
'name field' => 'title',
|
| 778 |
'numeric' => TRUE,
|
| 779 |
),
|
| 780 |
// Information for accepting as a filter
|
| 781 |
'filter' => array(
|
| 782 |
'handler' => 'views_handler_filter_date'
|
| 783 |
),
|
| 784 |
// Information for sorting
|
| 785 |
'sort' => array(
|
| 786 |
'handler' => 'views_handler_sort_date'
|
| 787 |
)
|
| 788 |
);
|
| 789 |
// Ad clicks - 'extra'
|
| 790 |
$data['ad_clicks']['extra'] = array(
|
| 791 |
'title' => t('Extra'),
|
| 792 |
// The help that appears on the UI
|
| 793 |
'help' => t('Allow add-on modules to provide additional statistics granularity.'),
|
| 794 |
// Information for displaying
|
| 795 |
'field' => array(
|
| 796 |
'handler' => 'views_handler_field',
|
| 797 |
'click sortable' => TRUE
|
| 798 |
),
|
| 799 |
// Information for accepting as an argument
|
| 800 |
'argument' => array(
|
| 801 |
'handler' => 'views_handler_argument_string',
|
| 802 |
'name field' => 'title',
|
| 803 |
'numeric' => FALSE,
|
| 804 |
),
|
| 805 |
// Information for accepting as a filter
|
| 806 |
'filter' => array(
|
| 807 |
'handler' => 'views_handler_filter_string'
|
| 808 |
),
|
| 809 |
// Information for sorting
|
| 810 |
'sort' => array(
|
| 811 |
'handler' => 'views_handler_sort'
|
| 812 |
)
|
| 813 |
);
|
| 814 |
return $data;
|
| 815 |
}
|
| 816 |
|