| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Admin settings for the Shoppingads module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Admin settings form for the Shoppingads module
|
| 11 |
*/
|
| 12 |
function shoppingads_admin_settings() {
|
| 13 |
$form = array();
|
| 14 |
$form['shoppingads'] = array(
|
| 15 |
'#type' => 'fieldset',
|
| 16 |
'#title' => 'shoppingads '. t('settings'),
|
| 17 |
'#collapsible' => TRUE,
|
| 18 |
'#collapsed' => FALSE
|
| 19 |
);
|
| 20 |
|
| 21 |
$form['shoppingads']['shoppingads_publisher_id'] = array(
|
| 22 |
'#type' => 'textfield',
|
| 23 |
'#title' => t('Publisher ID'),
|
| 24 |
'#default_value' => variable_get('shoppingads_publisher_id', ''),
|
| 25 |
'#size' => 30,
|
| 26 |
'#maxlength' => 30,
|
| 27 |
'#required' => TRUE,
|
| 28 |
'#description' => t('Enter your shoppingads.com publisher ID.')
|
| 29 |
);
|
| 30 |
|
| 31 |
$form['shoppingads']['shoppingads_ad_campaign'] = array(
|
| 32 |
'#type' => 'textfield',
|
| 33 |
'#title' => t('Campaign ID'),
|
| 34 |
'#default_value' => variable_get('shoppingads_ad_campaign', 'default'),
|
| 35 |
'#size' => 40,
|
| 36 |
'#maxlength' => 40,
|
| 37 |
'#description' => t('Enter an shoppingads.com campaign ID (optional).')
|
| 38 |
);
|
| 39 |
|
| 40 |
$form['shoppingads']['shoppingads_ad_format'] = array(
|
| 41 |
'#type' => 'select',
|
| 42 |
'#title' => t('Ad Format'),
|
| 43 |
'#default_value' => variable_get('shoppingads_ad_format', ''),
|
| 44 |
'#options' => shoppingads_ad_formats(),
|
| 45 |
'#required' => TRUE,
|
| 46 |
'#description' => t('The Ad format you want to use in your nodes.')
|
| 47 |
);
|
| 48 |
|
| 49 |
$form['shoppingads']['shoppingads_ad_attitude'] = array(
|
| 50 |
'#type' => 'select',
|
| 51 |
'#title' => t('Attitude Selection'),
|
| 52 |
'#default_value' => variable_get('shoppingads_ad_attitude', ''),
|
| 53 |
'#options' => array(
|
| 54 |
'true' => 'Classic',
|
| 55 |
'false' => 'Basic',
|
| 56 |
'cool' => 'Cool Blue',
|
| 57 |
'fader' => 'Ad Fader',
|
| 58 |
'etched' => 'Etched'
|
| 59 |
),
|
| 60 |
'#required' => TRUE,
|
| 61 |
'#description' => t('The Ad style.')
|
| 62 |
);
|
| 63 |
|
| 64 |
$form['shoppingads']['shoppingads_weight'] = array(
|
| 65 |
'#type' => 'select',
|
| 66 |
'#title' => t('Weight'),
|
| 67 |
'#default_value' => variable_get('shoppingads_weight', 0),
|
| 68 |
'#options' => drupal_map_assoc(range(-20, 20)),
|
| 69 |
'#description' => t('Specifies the position of the ad. A low weight, e.g. <strong>-20</strong> will display the ad above the content and a high weight, e.g. <strong>20</strong> below the content.')
|
| 70 |
);
|
| 71 |
|
| 72 |
$form['shoppingads']['shoppingads_new_window'] = array(
|
| 73 |
'#type' => 'checkbox',
|
| 74 |
'#title' => t('New window'),
|
| 75 |
'#default_value' => variable_get('shoppingads_new_window', ''),
|
| 76 |
'#description' => t('Check this to open ad links in a new window.')
|
| 77 |
);
|
| 78 |
|
| 79 |
$form['shoppingads']['shoppingads_teaser_full_view'] = array(
|
| 80 |
'#type' => 'select',
|
| 81 |
'#title' => t('Display in teaser and/or full view'),
|
| 82 |
'#default_value' => variable_get('shoppingads_teaser_full_view', 0),
|
| 83 |
'#options' => array(0 => t('Full view'), 1 => t('Teaser'), 2 => t('Teasers and full view')),
|
| 84 |
'#description' => t('When to display shoppingads.'),
|
| 85 |
);
|
| 86 |
|
| 87 |
$form['shoppingads']['shoppingads_node_types'] = array(
|
| 88 |
'#type' => 'checkboxes',
|
| 89 |
'#title' => t('Node Types'),
|
| 90 |
'#default_value' => variable_get('shoppingads_node_types', array()),
|
| 91 |
'#options' => node_get_types('names'),
|
| 92 |
'#description' => t('Activate the node types where shoppingads.com advertising shall be displayed.')
|
| 93 |
);
|
| 94 |
|
| 95 |
// Ad keywords
|
| 96 |
$form['shoppingads_kw'] = array(
|
| 97 |
'#type' => 'fieldset',
|
| 98 |
'#title' => t('Ad Keywords'),
|
| 99 |
'#collapsible' => TRUE,
|
| 100 |
'#collapsed' => FALSE
|
| 101 |
);
|
| 102 |
|
| 103 |
$form['shoppingads_kw']['shoppingads_keywords'] = array(
|
| 104 |
'#type' => 'textfield',
|
| 105 |
'#title' => t('Ad Keywords'),
|
| 106 |
'#default_value' => variable_get('shoppingads_keywords', ''),
|
| 107 |
'#size' => 60,
|
| 108 |
'#maxlength' => 128,
|
| 109 |
'#required' => TRUE,
|
| 110 |
'#description' => t('Enter up to 15 keywords separated by semicolons ";". The keywords determine what kind of ads are displayed is as few as possible.')
|
| 111 |
);
|
| 112 |
|
| 113 |
if (module_exists('taxonomy')) {
|
| 114 |
$form['shoppingads_kw']['shoppingads_use_terms_as_keywords'] = array(
|
| 115 |
'#type' => 'checkbox',
|
| 116 |
'#title' => t('Use terms as keywords'),
|
| 117 |
'#default_value' => variable_get('shoppingads_use_terms_as_keywords', ''),
|
| 118 |
'#description' => t('By activating this option the terms/tags associated with the node will be used as keywords. If no terms are associated with the displayed node the keywords entered above will be used. For this feature the taxonomy module must be enabled.')
|
| 119 |
);
|
| 120 |
$v_options = shoppingads_get_vocabularies_options();
|
| 121 |
$form['shoppingads_kw']['shoppingads_restrict_vocabulary'] = array(
|
| 122 |
'#type' => 'select',
|
| 123 |
'#title' => t('Restrict to vocabulary'),
|
| 124 |
'#options' => $v_options,
|
| 125 |
'#default_value' => variable_get('shoppingads_restrict_vocabulary', 0),
|
| 126 |
'#description' => t('If you activated the <strong>Use terms as keywords</strong> option you can restrict the terms used as Ad search words to one vocabulary.')
|
| 127 |
);
|
| 128 |
$form['shoppingads_kw']['shoppingads_term_limit'] = array(
|
| 129 |
'#type' => 'select',
|
| 130 |
'#title' => t('Number of terms'),
|
| 131 |
'#default_value' => variable_get('shoppingads_term_limit', 2),
|
| 132 |
'#options' => drupal_map_assoc(range(1, 15)),
|
| 133 |
'#description' => t('If you activated the <strong>Use terms as keywords</strong> option you can limit the number of terms to be used as search ad words here. 15 is the maximum number currently supported by shoppingads.')
|
| 134 |
);
|
| 135 |
}
|
| 136 |
|
| 137 |
// Ad colors
|
| 138 |
$form['shoppingads_colors'] = array(
|
| 139 |
'#type' => 'fieldset',
|
| 140 |
'#title' => t('Ad Colors'),
|
| 141 |
'#collapsible' => TRUE,
|
| 142 |
'#collapsed' => FALSE
|
| 143 |
);
|
| 144 |
foreach (shoppingads_ad_colors() as $area => $color) {
|
| 145 |
$title = ucwords(str_replace('_', ' ', $area));
|
| 146 |
$form['shoppingads_colors'][$area] = array(
|
| 147 |
'#type' => 'textfield',
|
| 148 |
'#title' => $title,
|
| 149 |
'#default_value' => variable_get($area, $color),
|
| 150 |
'#size' => 6,
|
| 151 |
'#maxlength' => 6,
|
| 152 |
'#description' => t('Enter a hexadecimal color value here, e.g. <code>ff9900</code>.')
|
| 153 |
);
|
| 154 |
}
|
| 155 |
return system_settings_form($form);
|
| 156 |
}
|