function ad_admin_ads in Advertisement 6.3
Same name and namespace in other branches
- 5.2 ad.module \ad_admin_ads()
- 5 ad.module \ad_admin_ads()
- 6 ad.admin.inc \ad_admin_ads()
- 6.2 ad.admin.inc \ad_admin_ads()
- 7 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 30 - 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']);
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$options = array();
foreach (module_invoke_all('ad_operations') as $operation => $array) {
$options[$operation] = $array['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 'approve',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$destination = drupal_get_destination();
$ads = array();
while ($ad = db_fetch_object($result)) {
$ads[$ad->aid] = '';
$form['title'][$ad->aid] = array(
'#value' => l($ad->title, 'node/' . $ad->aid),
);
$form['group'][$ad->aid] = array(
'#value' => _ad_get_group($ad->aid),
);
$form['adtype'][$ad->aid] = array(
'#value' => t(check_plain($ad->adtype)),
);
$form['adstatus'][$ad->aid] = array(
'#value' => t(check_plain($ad->adstatus)),
);
$form['operations'][$ad->aid] = array(
'#value' => l(t('edit'), 'node/' . $ad->aid . '/edit', array(
'query' => $destination,
)),
);
}
$form['ads'] = array(
'#type' => 'checkboxes',
'#options' => $ads,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0),
);
return $form;
}