function _simpleads_listing in SimpleAds 7
Callback for Ads Listing page.
1 string reference to '_simpleads_listing'
- simpleads_menu in ./
simpleads.module - Implements hook_menu().
File
- ./
simpleads.stat.inc, line 176 - SimpleAds Statistics.
Code
function _simpleads_listing() {
drupal_set_title(t('Advertisement Listing'));
$filter_render = drupal_get_form('_simpleads_group_filter_form');
$filter_form = drupal_render($filter_render);
$listing_render = drupal_get_form('_simpleads_after_listing_form');
$form_after_listing = drupal_render($listing_render);
$header = array(
array(
'data' => t('Ad Title'),
),
array(
'data' => t('Ad Group'),
),
array(
'data' => t('Status'),
),
array(
'data' => t('Active'),
),
array(
'data' => t('Operations'),
),
);
$filter = array(
'adgroup' => '',
'adstatus' => '',
'adsperpage' => 35,
);
$filters = variable_get('simpleads_filters', FALSE);
if ($filters) {
$filter = unserialize($filters);
}
$results = _simpleads_ads_listing_query($filter);
$rows = array();
foreach ($results as $record) {
$node = node_load($record->nid);
if ($node) {
$ad_title = _simpleads_stats_info($node, 'list');
$ad_group = _simpleads_stats_info($node, 'ad_group');
$rows[] = array(
array(
'data' => $ad_title,
),
array(
'data' => $ad_group,
),
array(
'data' => _simpleads_stats_info($node, 'ad_status'),
),
array(
'data' => _simpleads_stats_info($node, 'ad_activity'),
),
array(
'data' => _simpleads_stats_info($node, 'ad_operations'),
),
);
}
}
return $filter_form . theme('table', array(
'header' => $header,
'rows' => $rows,
'empty' => t('There are no Ads'),
)) . theme('pager') . $form_after_listing;
}