function ad_admin_ads in Advertisement 7
Same name and namespace in other branches
- 5.2 ad.module \ad_admin_ads()
- 5 ad.module \ad_admin_ads()
- 6.3 ad.admin.inc \ad_admin_ads()
- 6 ad.admin.inc \ad_admin_ads()
- 6.2 ad.admin.inc \ad_admin_ads()
Provide a filterable list of advertisements.
3 string references to 'ad_admin_ads'
- ad_admin_list in ./
ad.admin.inc - Build default ad administration page.
- ad_channel_form_alter in channel/
ad_channel.module - Implementation of hook_form_alter(). Generate a form for selecting channels to associate with an advertisement.
- ad_weight_probability_form_alter in weight/
probability/ ad_weight_probability.module - Implementation of hook_form_alter(). Generate a form for assigning a weight to an advertisement.
File
- ./
ad.admin.inc, line 34 - Advertisement admin pages and functions.
Code
function ad_admin_ads() {
$filter = ad_build_filter_query();
//$result = pager_query('SELECT a.*, n.* FROM {ads} a INNER JOIN {node} n ON a.aid = n.nid '. $filter['join'] .' '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
$result = db_query('SELECT a.*, n.* FROM {ads} a INNER JOIN {node} n ON a.aid = n.nid ' . $filter['join'] . ' ' . $filter['where'] . ' ORDER BY n.changed DESC');
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$ad_options = array();
foreach (module_invoke_all('ad_operations') as $operation => $array) {
$ad_options[$operation] = $array['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $ad_options,
'#default_value' => 'approve',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$destination = drupal_get_destination();
$ads = array();
$rows = array();
foreach ($result as $ad) {
$row = array();
$row['title']['data'] = array(
'#markup' => l($ad->title, 'node/' . $ad->aid),
);
$row['group']['data'] = array(
'#markup' => _ad_get_group($ad->aid),
);
$row['type']['data'] = array(
'#markup' => t(check_plain($ad->adtype)),
);
$row['status']['data'] = array(
'#markup' => t(check_plain($ad->adstatus)),
);
$row['operations']['data'] = array(
'#markup' => l(t('edit'), 'node/' . $ad->aid . '/edit', array(
'query' => $destination,
)),
);
//$row['ads'] = $form['ads'][$key];
$rows[$ad->aid] = $row;
}
// Overview table
$header = array(
'title' => t('Title'),
'group' => t('Group'),
'type' => t('Type'),
'status' => t('Status'),
'operations' => t('Operations'),
);
$form['ads'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $rows,
'#empty' => t('No ads available.'),
);
$form['pager'] = array(
'#markup' => theme('pager'),
);
return $form;
}