You are here

function ad_image_global_settings in Advertisement 5.2

Same name and namespace in other branches
  1. 5 image/ad_image.module \ad_image_global_settings()
  2. 6.3 image/ad_image.module \ad_image_global_settings()
  3. 6 image/ad_image.module \ad_image_global_settings()
  4. 6.2 image/ad_image.module \ad_image_global_settings()
  5. 7 image/ad_image.module \ad_image_global_settings()

File

image/ad_image.module, line 56
Enhances the ad module to support banner ads.

Code

function ad_image_global_settings($edit = array()) {
  $form = array();
  $groups = module_invoke('ad', 'groups_list', TRUE);
  foreach ($groups as $tid => $group) {
    $form["group-{$tid}"] = array(
      '#type' => 'fieldset',
      '#title' => $group->name,
      '#collapsible' => TRUE,
    );
    $form["group-{$tid}"]["description-{$tid}"] = array(
      '#type' => 'markup',
      '#prefix' => '<div>',
      '#suffix' => '</div>',
      '#value' => theme_placeholder("{$group->description}"),
    );
    $format = db_fetch_object(db_query('SELECT * FROM {ad_image_format} WHERE gid = %d', $tid));
    $form["group-{$tid}"]["min-height-{$tid}"] = array(
      '#type' => 'textfield',
      '#title' => t('Minimum height'),
      '#size' => 5,
      '#maxlength' => 5,
      '#default_value' => $format->min_height ? $format->min_height : 0,
      '#description' => t('Optionally specify a minimum height in pixels for images in this group.  To specify no minimum height, enter <em>0</em>.'),
    );
    $form["group-{$tid}"]["min-width-{$tid}"] = array(
      '#type' => 'textfield',
      '#title' => t('Minimum width'),
      '#size' => 5,
      '#maxlength' => 5,
      '#default_value' => $format->min_width ? $format->min_width : 0,
      '#description' => t('Optionally specify a minimum width in pixels for images in this group.  To specify no minimum width, enter <em>0</em>.'),
    );
    $form["group-{$tid}"]["max-height-{$tid}"] = array(
      '#type' => 'textfield',
      '#title' => t('Maximum height'),
      '#size' => 5,
      '#maxlength' => 5,
      '#default_value' => $format->max_height ? $format->max_height : 0,
      '#description' => t('Optionally specify a maximum height in pixels for images in this group.  To specify no maximum height, enter <em>0</em>.'),
    );
    $form["group-{$tid}"]["max-width-{$tid}"] = array(
      '#type' => 'textfield',
      '#title' => t('Maximum width'),
      '#size' => 5,
      '#maxlength' => 5,
      '#default_value' => $format->max_width ? $format->max_width : 0,
      '#description' => t('Optionally specify a maximum width in pixels for images in this group.  To specify no maximum width, enter <em>0</em>.'),
    );
  }
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}