View source
<?php
function ad_views_data() {
$data = array();
$data['ads'] = array(
'table' => array(
'group' => t('Advertisements'),
),
);
$data['ads']['table']['join']['node'] = array(
'left_field' => 'nid',
'field' => 'aid',
);
$data['ads']['adstatus'] = array(
'title' => 'Status',
'help' => t('The ad status.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['adtype'] = array(
'title' => 'Type',
'help' => t('The ad type.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['redirect'] = array(
'title' => 'Redirect URL',
'help' => t('The ad redirect URL.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['autoactivate'] = array(
'title' => t('Auto activate'),
'help' => t('Is ad auto activating?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['autoactivated'] = array(
'title' => t('Auto activated'),
'help' => t('Is ad auto activated?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['autoexpire'] = array(
'title' => t('Auto expire'),
'help' => t('Is ad auto expiring?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['autoexpired'] = array(
'title' => t('Auto expired'),
'help' => t('Is ad auto expired?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['expired'] = array(
'title' => t('Expired'),
'help' => t('Is ad expired?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['activated'] = array(
'title' => t('Activated'),
'help' => t('Is ad activated?'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Active'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['maxviews'] = array(
'title' => 'Maximum views',
'help' => t('The maximum ad impressions.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ads']['maxclicks'] = array(
'title' => 'Maximum clicks',
'help' => t('The maximum ad clicks.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ad_statistics'] = array(
'table' => array(
'group' => t('Advertisement Statistics'),
),
);
$data['ad_statistics']['table']['join']['node'] = array(
'left_table' => 'ads',
'left_field' => 'aid',
'field' => 'aid',
);
$data['ad_statistics']['action'] = array(
'title' => 'Type',
'help' => t('The statistic type.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_ad_statistics_action',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ad_statistics']['date'] = array(
'title' => 'Date',
'help' => t('The date when this action was made.'),
'field' => array(
'handler' => 'views_handler_field_ad_statistics_date',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_ad_statistics_date',
),
'argument' => array(
'handler' => 'views_handler_argument_date',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ad_statistics']['adgroup'] = array(
'title' => 'Ad group',
'help' => t('The ad group.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['ad_statistics']['count'] = array(
'title' => 'Count',
'help' => t('The count of actions triggered.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
return $data;
}
function ad_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'ad') . '/views/handlers',
),
'handlers' => array(
'views_handler_filter_ad_statistics_action' => array(
'parent' => 'views_handler_filter_in_operator',
),
'views_handler_field_ad_statistics_date' => array(
'parent' => 'views_handler_field_date',
),
'views_handler_filter_ad_statistics_date' => array(
'parent' => 'views_handler_filter_date',
),
),
);
}