function ad_channel_ad_admin_ads in Advertisement 7
Same name and namespace in other branches
- 6.3 channel/ad_channel.module \ad_channel_ad_admin_ads()
- 6.2 channel/ad_channel.module \ad_channel_ad_admin_ads()
Implement custom theme function for displaying ad overview, replacing groups with channels.
1 string reference to 'ad_channel_ad_admin_ads'
- ad_channel_theme_registry_alter in channel/
ad_channel.module - Register our own ad_admin_ads theme function.
File
- channel/
ad_channel.module, line 327 - Ad Channel module.
Code
function ad_channel_ad_admin_ads($form) {
$list = variable_get('ad_channel_admin_list', AD_CHANNEL_LIST_CHANNEL);
// Conditionally build the header based on list type and
// the availability of probability values from the
// ad_weight_probability module
$header = array(
theme('table_select_header_cell'),
t('Title'),
);
// Overview table:
if ($list != AD_CHANNEL_LIST_CHANNEL) {
$header[] = t('Group');
}
$header = array_merge($header, array(
t('Channel'),
));
if (isset($form['probability']) && is_array($form['probability'])) {
$header[] = t('Probability');
}
$header[] = t('Type');
$header[] = t('Status');
$header[] = t('Operations');
$output = drupal_render($form['options']);
if (isset($form['title']) && is_array($form['title'])) {
foreach (element_children($form['title']) as $key) {
$row = array();
$row[] = drupal_render($form['ads'][$key]);
$row[] = drupal_render($form['title'][$key]);
if ($list == AD_CHANNEL_LIST_BOTH) {
$row[] = drupal_render($form['group'][$key]);
}
$row[] = drupal_render($form['channel'][$key]);
if (isset($form['probability']) && is_array($form['probability'])) {
$row[] = drupal_render($form['probability'][$key]);
}
$row[] = drupal_render($form['adtype'][$key]);
$row[] = drupal_render($form['adstatus'][$key]);
$row[] = drupal_render($form['operations'][$key]);
$rows[] = $row;
}
}
else {
$rows[] = array(
array(
'data' => t('No ads available.'),
'colspan' => '6',
),
);
}
$output .= theme('table', $header, $rows);
if ($form['pager']['#value']) {
$output .= drupal_render($form['pager']);
}
$output .= drupal_render($form);
return $output;
}