function ad_client_block in Advertisement 6.3
Implementation of hook_block().
File
- client/
ad_client.module, line 38 - An advertising system for Drupal powered websites.
Code
function ad_client_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
$groups = ad_groups_list();
foreach ($groups as $tid => $name) {
$blocks[$tid] = array(
'info' => t('ad group: @name', array(
'@name' => $name,
)),
'cache' => BLOCK_CACHE_PER_PAGE,
);
}
return $blocks;
case 'configure':
$form['ad_block_quantity_' . $delta] = array(
'#type' => 'select',
'#title' => t('Number of ads'),
'#default_value' => variable_get('ad_block_quantity_' . $delta, 1),
'#options' => drupal_map_assoc(array(
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
)),
'#description' => t('Select the maximum number of unique ads that should be displayed together in this block. If you specify a number larger than the maximum number of ads in this ad group, all ads will be displayed once.'),
);
return $form;
case 'save':
variable_set('ad_block_quantity_' . $delta, $edit['ad_block_quantity_' . $delta]);
break;
case 'view':
$block['content'] = ad($delta, variable_get('ad_block_quantity_' . $delta, 1));
return $block;
}
}