You are here

rotor.module in Rotor Banner 5

Same filename and directory in other branches
  1. 5.7 rotor.module
  2. 6.2 rotor.module
  3. 6 rotor.module
  4. 7 rotor.module

A rotor banner consists in a set of images that will be changing. This module is made using jquery.

@author Nestor Mata Cuthbert, nestor AT achieveinternet.com. http://www.achieveinternet.com @author Tom Kirkpatrick, tkp AT kirkdesigns.co.uk. http://www.kirkdesigns.co.uk

File

rotor.module
View source
<?php

/**
 * @file
 * A rotor banner consists in a set of images that will be changing.
 * This module is made using jquery.
 *
 * @author Nestor Mata Cuthbert, nestor AT achieveinternet.com. http://www.achieveinternet.com
 * @author Tom Kirkpatrick, tkp AT kirkdesigns.co.uk. http://www.kirkdesigns.co.uk
 */

// CONSTANTS
define('ROTOR_GROUP_TABS', 0);
define('ROTOR_DONT_GROUP_TABS', 1);
if (module_exists('views')) {
  include drupal_get_path('module', 'rotor') . '/views.inc';
}

/**
 * Implementation of hook_info().
 */
function rotor_node_info() {
  return array(
    'rotor_item' => array(
      'name' => t('Rotor item'),
      'module' => 'rotor',
      'description' => t("A node to be presented in the rotor block."),
    ),
  );
}

/**
 * Implementation of hook_perm().
 */
function rotor_perm() {
  return array(
    'administer rotor',
  );
}

/**
 * Implementation of hook_help().
 */
function rotor_help($section) {
  switch ($section) {
    case 'node/add/rotor-item':
      $text = '<p>' . t('A Rotor item is a banner that will appear in the rotor block for advertising' . ' or display important information or images.<br />' . 'The Rotor item will have a tab text that can be configured to be shown or not' . ' in the administration page for the rotor.<br />' . 'The item will show the image if this one is chosen otherwise will show the' . ' content.') . '</p>';
      if (user_access('administer rotor')) {
        $text .= t('You can go to the rotor administration page <a href="@link">here</a>', array(
          '@link' => url('admin/settings/rotor'),
        ));
      }
      return $text;
  }
}

/**
 * Implementation of hook_menu().
 */
function rotor_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/rotor',
      'title' => t('Rotor banner'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'rotor_admin_form',
      ),
      'access' => user_access('administer rotor'),
    );
  }
  return $items;
}

/**
 * Implementation of hook_block().
 */
function rotor_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks[0] = array(
        'info' => t('Rotor banner'),
        'weight' => 0,
        'enabled' => 0,
        'region' => 'content',
      );
      return $blocks;
    case 'view':

      // Only one delta so far so we are not checking the delta
      $block = array(
        'subject' => t('Information'),
        'content' => rotor_block_content(),
      );
      return $block;
  }
}

/**
 * Admin settings form page.
 */
function rotor_admin_form() {
  $form['basic_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basics'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['basic_settings']['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => variable_get('rotor_height', 200),
    '#rows' => 1,
    '#size' => 4,
    '#description' => t('The Rotor item height, in pixels.'),
  );
  $form['basic_settings']['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => variable_get('rotor_width', 200),
    '#rows' => 1,
    '#size' => 4,
    '#description' => t('The Rotor item width, in pixels.'),
  );
  $form['basic_settings']['max_items'] = array(
    '#type' => 'textfield',
    '#title' => t('Max nodes'),
    '#default_value' => variable_get('rotor_max_items', 3),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('Define the maximun number of nodes to present in the rotor block.'),
  );
  $form['basic_settings']['random_items'] = array(
    '#type' => 'checkbox',
    '#title' => t('Randomize nodes'),
    '#default_value' => variable_get('rotor_random_items', 0),
    '#description' => t('Enables/Disables random selection of nodes that will be present in the rotor block.'),
  );
  if (module_exists('nodequeue')) {
    $queues = nodequeue_load_queues(nodequeue_get_all_qids());
    $queue_list[0] = t('None');
    foreach ($queues as $qid => $queue) {
      $queue_list[$qid] = $queue->title;
    }
    $form['queue_group'] = array(
      '#type' => 'fieldset',
      '#title' => t('Node Queue Settings'),
      '#description' => t("If you select a queue the Rotor item 'basic' settings will be ignored. " . 'To administrate the queue please go <a href="@nodequeue_url">here</a>', array(
        '@nodequeue_url' => url('admin/content/nodequeue'),
      )),
      '#weight' => -2,
    );
    $form['queue_group']['nodequeue'] = array(
      '#type' => 'select',
      '#title' => t('Node Queue'),
      '#default_value' => variable_get('rotor_nodequeue', 0),
      '#options' => $queue_list,
      '#description' => t('Use node a nodequeue instead of Rotor items'),
    );
  }
  $form['animation_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Animation'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['animation_settings']['time'] = array(
    '#type' => 'textfield',
    '#title' => t('Time'),
    '#default_value' => variable_get('rotor_seconds', 10),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('The time in seconds that will be shown every Rotor item before change to the next one.'),
  );
  $form['animation_settings']['speed'] = array(
    '#type' => 'textfield',
    '#title' => t('Speed'),
    '#default_value' => variable_get('rotor_speed', 1),
    '#rows' => 1,
    '#size' => 2,
    '#description' => t('The time in seconds of the transition effect between each Rotor item (set to 0 for no transition).'),
  );
  $form['animation_settings']['effect'] = array(
    '#type' => 'select',
    '#title' => t('Effect'),
    '#default_value' => variable_get('rotor_effect', 'fade'),
    '#options' => _rotor_get_effects(),
    '#description' => t('The effect to use when changing to the next Rotor item.'),
  );
  $form['animation_settings']['pause'] = array(
    '#type' => 'checkbox',
    '#title' => t('Pause on hover'),
    '#default_value' => variable_get('rotor_pause', 0),
    '#description' => t('Enables/Disables pause on hover.'),
  );
  $form['tab_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tabs'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['tab_settings']['show_tab'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable tabs'),
    '#default_value' => variable_get('rotor_show_tabs', 1),
    '#description' => t('Shows/Hide the item tabs in the block'),
  );
  $form['tab_settings']['group_tabs'] = array(
    '#type' => 'radios',
    '#title' => t('Group tabs'),
    '#default_value' => variable_get('rotor_group_tabs', ROTOR_GROUP_TABS),
    '#options' => array(
      ROTOR_GROUP_TABS => t('Group tabs'),
      ROTOR_DONT_GROUP_TABS => t("Each tab with its own item"),
    ),
    '#description' => t("If tabs are grouped, all Rotor item tabs will be displayed together (all at once). Clicking on a tab will take force the rotor to rotate to the tabs content. otherwise each tab will be displayed with its own content only and will not be clickable."),
  );
  $form['tab_settings']['tab_position'] = array(
    '#type' => 'select',
    '#title' => t('Tab position'),
    '#default_value' => variable_get('rotor_tab_position', ROTOR_TAB_POSITION_TOP),
    '#options' => array(
      ROTOR_TAB_POSITION_TOP => t("Above"),
      ROTOR_TAB_POSITION_BOTTOM => t("Below"),
    ),
    '#description' => t("Where the tabs should be positioned."),
  );
  if (module_exists('imagecache')) {
    $presets = rotor_get_imagecache_presets();
    $presets[0] = t('None');
    $form['imagecache'] = array(
      '#type' => 'select',
      '#title' => t('Imagecache preset'),
      '#default_value' => variable_get('rotor_imagecache_preset', 0),
      '#options' => $presets,
      '#description' => t('Select the imagecache preset to use for the images'),
    );
  }
  $form['#suffix'] = theme('rotor_admin_list', rotor_get_items());
  return system_settings_form($form);
}

/**
 * Admin settings form submit function
 */
function rotor_admin_form_submit($formid, $values, $extra = NULL) {
  if ($formid == 'rotor_admin_form') {
    if ($values['op'] == $values['submit']) {
      variable_set('rotor_height', $values['height']);
      variable_set('rotor_width', $values['width']);
      variable_set('rotor_max_items', $values['max_items']);
      variable_set('rotor_seconds', $values['time']);
      variable_set('rotor_speed', $values['speed']);
      variable_set('rotor_effect', $values['effect']);
      variable_set('rotor_pause', $values['pause']);
      variable_set('rotor_random_items', $values['random_items']);
      variable_set('rotor_show_tabs', $values['show_tab']);
      variable_set('rotor_group_tabs', $values['group_tabs']);
      variable_set('rotor_tab_position', $values['tab_position']);
      variable_set('rotor_imagecache_preset', $values['imagecache']);
      variable_set('rotor_nodequeue', $values['nodequeue']);
      drupal_set_message(t('Settings saved'));
    }
    else {
      variable_set('rotor_height', 200);
      variable_set('rotor_width', 200);
      variable_set('rotor_max_items', 3);
      variable_set('rotor_seconds', 10);
      variable_set('rotor_speed', $values['speed']);
      variable_set('rotor_effect', 'fade');
      variable_set('rotor_pause', 0);
      variable_set('rotor_random_items', 0);
      variable_set('rotor_show_tabs', 1);
      variable_set('rotor_group_tabs', ROTOR_GROUP_TABS);
      variable_set('rotor_tab_position', ROTOR_TAB_POSITION_TOP);
      variable_set('rotor_imagecache_preset', 0);
      variable_set('rotor_nodequeue', 0);
      drupal_set_message(t('Settings back to defaults'));
    }
  }
}

/**
 * Node form hook
 */
function rotor_form($node) {
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Tab Text'),
    '#required' => TRUE,
    '#default_value' => $node->title,
    '#weight' => -5,
    '#description' => t('The text that will be shown in the tab for this item.'),
  );
  $image = $node->rotor_image ? theme('rotor_image', $node) : '';
  $form['rotor_image'] = array(
    '#type' => 'file',
    '#title' => t('Attach an image'),
    '#default_value' => $node->rotor_image->filepath,
    '#weight' => -4,
    '#prefix' => $image,
    '#description' => t('The image that will be shown in the rotor content.' . ' If an image is uploaded only the image will be shown, otherwise only the content.'),
  );
  $form['alt_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Image Alt text'),
    '#default_value' => $node->rotor_image->alt_text,
    '#weight' => -3,
    '#description' => t('That alt text for the image. This will also be displayed when the mouse is vovered over the image.'),
  );
  $form['link'] = array(
    '#type' => 'fieldset',
    '#title' => t('Link'),
    '#attributes' => array(
      'class' => 'rotor-link',
    ),
    '#weight' => -2,
  );
  $form['link']['url'] = array(
    '#type' => 'textfield',
    '#title' => t('Link URL'),
    '#default_value' => $node->rotor_image->url,
    '#description' => t('The link that will be actived for this item. Example: http://www.drupal.org, node/3'),
  );
  $target_options = array(
    'default' => t('Default (no target attribute)'),
    '_top' => t('Open link in window root (_top)'),
    '_blank' => t('Open link in new window (_blank)'),
  );
  $form['link']['link_target'] = array(
    '#type' => 'select',
    '#title' => t('Link target'),
    '#options' => $target_options,
    '#default_value' => $node->rotor_image->link_target,
    '#description' => t('The target of the link'),
  );
  $form['body_filter']['body'] = array(
    '#type' => 'textarea',
    '#title' => t('Content'),
    '#default_value' => $node->body,
    '#rows' => 10,
    '#weight' => -3,
    '#description' => t('The content that will be shown in case no image is uploaded.'),
  );
  $form['body_filter']['filter'] = filter_form($node->format);

  // Change the enctype of the form to handle the upload file.
  $form['#attributes']['enctype'] = 'multipart/form-data';
  return $form;
}

/**
 * Node form submit function.
 * We handle the image submition.
 */
function rotor_submit(&$node) {
  $upload_dir = file_directory_path();
  if (!empty($_FILES['files']['name']['rotor_image'])) {
    if (file_check_directory($upload_dir, FILE_CREATE_DIRECTORY)) {
      $file = file_save_upload('rotor_image', file_directory_path(), FILE_EXISTS_RENAME);
      if (!$file) {
        drupal_set_message(t("The uploaded file %filename was unable to be saved. The destination directory may not be writable.", array(
          '%filename' => $file_saved['filename'],
        )), "error");
        watchdog('rotor', 'Imaged not saved: ' . $file_saved['filepath']);
      }
      else {
        $file = (object) $file;
        $file->fid = db_next_id('{files}_fid');
        db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize);
        $node->rotor_image = $file->fid;
        watchdog('rotor', 'Imaged saved: ' . $file->filepath);
      }
    }
    else {
      drupal_set_message(t("The uploaded file was unable to be saved. The destination directory does not exist."), "error");
    }
  }

  // Remove the target attribute if not selected.
  if (!$node->link_target || $node->link_target == "default") {
    $node->link_target = '';
  }
}

/**
 * Implementation of hook_insert().
 */
function rotor_insert($node) {
  db_query("INSERT INTO {rotor_item} (nid, fid, alt_text, url, link_target) VALUES (%d, %d, '%s', '%s', '%s')", $node->nid, $node->rotor_image, $node->alt_text, $node->url, $node->link_target);
}

/**
 * Implementation of hook_update().
 */
function rotor_update($node) {
  $rotor_item = db_fetch_object(db_query('SELECT fid FROM {rotor_item} where nid = %d', $node->nid));
  $file = db_fetch_object(db_query('SELECT * FROM {files} where fid = %d', $rotor_item->fid));
  db_query('DELETE FROM {files} WHERE fid = %d', $rotor_item->fid);
  file_delete($file->filepath);
  db_query("UPDATE {rotor_item} SET fid = %d, alt_text = '%s', url = '%s', link_target = '%s'  WHERE nid = %d", $node->rotor_image, $node->alt_text, $node->url, $node->link_target, $node->nid);
}

/**
 * Implementation of hook_delete().
 */
function rotor_delete($node) {
  db_query("DELETE FROM {rotor_item} WHERE nid = %d", $node->nid);
}

/**
 * Implementation of hook_load().
 */
function rotor_load($node) {
  $additions = new stdClass();
  $rotor_item = db_fetch_object(db_query('SELECT fid, alt_text, url, link_target FROM {rotor_item} WHERE nid = %d', $node->nid));
  $file = db_fetch_object(db_query('SELECT * FROM {files} where fid = %d', $rotor_item->fid));
  $additions->rotor_image->alt_text = $rotor_item->alt_text;
  $additions->rotor_image->url = $rotor_item->url;
  $additions->rotor_image->link_target = $rotor_item->link_target;
  $additions->rotor_image->filepath = $file->filepath;
  return $additions;
}

/**
 * Implementation of hook_file_download().
 */
function rotor_file_download($file) {
  $result = db_query("SELECT r.nid, r.fid, f.filemime, f.filesize FROM {rotor_item} r INNER JOIN {files} f ON r.fid = f.fid WHERE f.filepath = '%s'", file_create_path($file));
  if ($file = db_fetch_object($result)) {
    $node = node_load(array(
      'type' => 'rotor_item',
      'nid' => $file->nid,
    ));
    if (node_access('view', $node)) {
      return array(
        'Content-Type: ' . mime_header_encode($file->filemime),
        'Content-Length: ' . (int) $file->filesize,
      );
    }
    return -1;
  }
}

/**
 * Implementation of hook_view().
 */
function rotor_view($node, $teaser = FALSE, $page = FALSE) {
  $node = node_prepare($node, $teaser);
  if ($node->rotor_image) {
    $node->content['body']['#value'] = theme('rotor_image', $node);
  }
  return $node;
}

/**
 * Returns the block content.
 */
function rotor_block_content() {
  $limit = variable_get('rotor_max_items', 3);
  $random = variable_get('rotor_random_items', 0);
  $items = rotor_get_items($limit, $random);
  if (sizeof($items > 0)) {
    drupal_add_css(drupal_get_path('module', 'rotor') . '/rotor.css');
    _rotor_setup_js();
    return theme('rotor_block', $items);
  }
}

/**
 * This is a theme function to act as a wrapper for the image either case
 * that we are using imagecache or not.
 *
 * @param integer $limit How many nodes to fetch (0 for unlimited)
 * @param boolean $random Should the items be returned in a random order
 * @return array A list of published rotor_item nodes.
 */
function rotor_get_items($limit = 0, $random = FALSE) {
  $items = array();
  if (module_exists('nodequeue') && variable_get('rotor_nodequeue', 0) > 0) {
    $queue_id = variable_get('rotor_nodequeue', 0);
    $result = db_query("SELECT n.nid FROM {node} n LEFT JOIN {nodequeue_nodes} nn ON n.nid = nn.nid WHERE nn.sqid = %d AND n.status = 1 ORDER BY nn.position", $queue_id);
  }
  else {
    $query = "SELECT nid FROM {node} WHERE type = 'rotor_item' AND status=1";
    if ($random) {
      $query .= ' ORDER BY RAND()';
    }
    if ($limit) {
      $query .= ' LIMIT ' . (int) $limit;
    }
    $result = db_query($query);
  }
  while ($node = db_fetch_array($result)) {
    $items[] = node_load($node);
  }
  return $items;
}

/**
 * Wrapper function to get imagecache presets.
 * It checks which function should use, the imagecache2 or imagecache function.
 *
 * @return array Imagecache presets.
 */
function rotor_get_imagecache_presets($reset = FALSE) {
  if (module_exists('imagecache')) {
    if (function_exists('imagecache_presets')) {
      $presets_full = imagecache_presets($reset);
      $presets = array();
      foreach ($presets_full as $preset_id => $preset) {
        $presets[$preset_id] = $preset['presetname'];
      }
      return $presets;
    }
    else {
      return _imagecache_get_presets($reset);
    }
  }
  return array();
}

/**
 * This is a theme function to act as a wrapper for the image either case
 * that we are using imagecache or not.
 *
 * @param string $rotor_image The path for the image to be themed
 * @return string The image themed
 */
function theme_rotor_image($node) {
  $presset_id = variable_get('rotor_imagecache_preset', 0);
  if (module_exists('imagecache') && $presset_id > 0) {
    $pressets = rotor_get_imagecache_presets();
    $presset = $pressets[$presset_id];
    return theme('imagecache', $presset, $node->rotor_image->filepath, $node->rotor_image->alt_text, $node->title);
  }
  return theme('image', $node->rotor_image->filepath, $node->rotor_image->alt_text, $node->title);
}

/**
 * Theme function for the block
 *
 * @param array $items The list of nodes to present in the block.
 */
function theme_rotor_block($items = array()) {
  if (count($items) == 0) {
    return '';
  }

  // Setting the image height and width
  $css_width = variable_get('rotor_width', 200) . 'px';
  $css_height = variable_get('rotor_height', 200) . 'px';

  // Print the Rotor items.
  $output = "<div class='rotor' style=\"width:{$css_width};\">\n";
  if (variable_get('rotor_group_tabs', ROTOR_GROUP_TABS) == ROTOR_GROUP_TABS) {
    $output .= theme('rotor_tabs', $items);
  }
  $output .= theme('rotor_items', $items);
  $output .= '</div>';
  return $output;
}

/**
 * Theme for the rotor tabs.
 *
 * @param array $items The array of rotor_item nodes from where to get the tabs.
 */
function theme_rotor_tabs($items = array()) {
  $show_tabs = variable_get('rotor_show_tabs', 1);
  $group_tabs = variable_get('rotor_group_tabs', ROTOR_GROUP_TABS);
  $output = '';
  if ($show_tabs && $group_tabs == ROTOR_GROUP_TABS) {
    $output = '<div class="rotor-tabs">';
    foreach ($items as $node) {
      $output .= '<div class="rotor-tab">' . $node->title . '</div>';
    }
    $output .= '</div>';
  }
  return $output;
}

/**
 * Theme for the Rotor items list.
 *
 * @param array $items The array of rotor_item nodes.
 */
function theme_rotor_items($items = array()) {

  // Setting the image height and width
  $css_width = variable_get('rotor_width', 200) . 'px';
  $css_height = variable_get('rotor_height', 200) . 'px';
  $output = "<div class='rotor-items' style=\"height:{$css_height}; width:{$css_width};\">";
  foreach ($items as $node) {
    $output .= theme('rotor_item', $node);
  }
  $output .= '</div>';
  return $output;
}

/**
 * Theme for each Rotor item.
 *
 * @param node $item The rotor_item node to theme.
 */
function theme_rotor_item($node) {
  $show_tabs = variable_get('rotor_show_tabs', 1);
  $group_tabs = variable_get('rotor_group_tabs', ROTOR_GROUP_TABS);
  $css_width = variable_get('rotor_width', 200) . 'px';
  $css_height = variable_get('rotor_height', 200) . 'px';
  $output = '<div class="rotor-content">';
  if ($show_tabs && $group_tabs == ROTOR_DONT_GROUP_TABS) {
    $output .= '<div class="rotor-tab">' . $node->title . '</div>';
  }
  $output .= " <div class='rotor-content-detail' style=\"height:{$css_height}; width:{$css_width};\">";
  if ($node->rotor_image) {
    $output .= $node->rotor_image->url ? l(theme('rotor_image', $node), $node->rotor_image->url, array(
      'target' => $node->rotor_image->link_target,
    ), NULL, NULL, FALSE, $html = TRUE) : theme('rotor_image', $node);
  }
  else {
    $output .= check_markup($node->body, $item->format, FALSE);
  }
  $output .= '</div>';
  $output .= '</div>';
  return $output;
}

/**
 * Theme the admin list to include in the rotor administration page.
 *
 * @param array $list The list of rotor_item nodes to display in the list.
 */
function theme_rotor_admin_list($list = array()) {
  $headers = array(
    t('Tab'),
    t('Content'),
    t('Actions'),
  );
  $rows = array();
  $count = 0;
  foreach ($list as $node) {
    if ($node->rotor_image) {
      $output = $node->rotor_image->url ? l(theme('rotor_image', $node), $node->rotor_image->url, array(
        'title' => $node->rotor_image->alt_text,
      ), NULL, NULL, FALSE, $html = TRUE) : theme('rotor_image', $node);
    }
    else {
      $output = check_markup($node->body);
    }
    $rows[] = array(
      l($node->title, 'node/' . $node->nid . '/edit'),
      $output,
      l(t('Edit'), 'node/' . $node->nid . '/edit') . ' | ' . l(t('Remove'), 'node/' . $node->nid . '/delete'),
    );
  }
  $output = l(t('Add new item'), 'node/add/rotor-item');
  $output .= theme('table', $headers, $rows, array(
    'class' => 'rotor_admin_list',
  ));
  return $output;
}

/**
 * Add required js and css as appropriate.
 */
function _rotor_setup_js() {
  static $rotor_initialized = FALSE;
  if ($rotor_initialized) {
    return;
  }
  $settings = array(
    'RotorBanner' => array(),
  );
  $settings['RotorBanner']['enabled'] = 'true';
  $settings['RotorBanner']['effect'] = variable_get('rotor_effect', 'fade');
  $settings['RotorBanner']['time'] = variable_get('rotor_seconds', 10);
  $settings['RotorBanner']['speed'] = variable_get('rotor_speed', 1) == 0 ? 1 : variable_get('rotor_speed', 1) * 1000;
  $settings['RotorBanner']['pause'] = variable_get('rotor_pause', 0);
  drupal_add_js($settings, 'setting');
  drupal_add_js(drupal_get_path('module', 'rotor') . '/rotor.js');
  jquery_plugin_add('cycle');
  $styles_ie6 = ".rotor-content {background-color:#FFFFFF;}";
  drupal_set_html_head('<!--[if lte IE 7]><style type="text/css" media="all">' . $styles_ie6 . '</style><![endif]-->');
  $rotor_initialized = TRUE;
}

/**
 * Return available effect for the Rotor Banner.
 *
 * @return
 *   An associative array containing the available effect for the Rotor Banner.
 */
function _rotor_get_effects() {
  $effects = array(
    'blindX' => t('BlindX'),
    'blindY' => t('BlindY'),
    'blindZ' => t('BlindZ'),
    'cover' => t('Cover'),
    'curtainX' => t('CurtainX'),
    'curtainY' => t('CurtainY'),
    'fade' => t('Fade'),
    'fadeZoom' => t('FadeZoom'),
    'growX' => t('GrowX'),
    'growY' => t('GrowY'),
    'scrollUp' => t('Scroll Up'),
    'scrollDown' => t('Scroll Down'),
    'scrollLeft' => t('Scroll Left'),
    'scrollRight' => t('Scroll Right'),
    'scrollHorz' => t('Scroll Horz'),
    'scrollVert' => t('Scroll Vert'),
    'shuffle' => t('Shuffle'),
    'slideX' => t('Slide X'),
    'slideY' => t('Slide Y'),
    'toss' => t('Toss'),
    'turnUp' => t('Turn Up'),
    'turnDown' => t('Turn Down'),
    'turnLeft' => t('Turn Left'),
    'turnRight' => t('Turn Right'),
    'uncover' => t('Uncover'),
    'wipe' => t('Wipe'),
    'zoom' => t('Zoom'),
    'random' => t('Random*'),
  );
  return $effects;
}

Functions

Namesort descending Description
rotor_admin_form Admin settings form page.
rotor_admin_form_submit Admin settings form submit function
rotor_block Implementation of hook_block().
rotor_block_content Returns the block content.
rotor_delete Implementation of hook_delete().
rotor_file_download Implementation of hook_file_download().
rotor_form Node form hook
rotor_get_imagecache_presets Wrapper function to get imagecache presets. It checks which function should use, the imagecache2 or imagecache function.
rotor_get_items This is a theme function to act as a wrapper for the image either case that we are using imagecache or not.
rotor_help Implementation of hook_help().
rotor_insert Implementation of hook_insert().
rotor_load Implementation of hook_load().
rotor_menu Implementation of hook_menu().
rotor_node_info Implementation of hook_info().
rotor_perm Implementation of hook_perm().
rotor_submit Node form submit function. We handle the image submition.
rotor_update Implementation of hook_update().
rotor_view Implementation of hook_view().
theme_rotor_admin_list Theme the admin list to include in the rotor administration page.
theme_rotor_block Theme function for the block
theme_rotor_image This is a theme function to act as a wrapper for the image either case that we are using imagecache or not.
theme_rotor_item Theme for each Rotor item.
theme_rotor_items Theme for the Rotor items list.
theme_rotor_tabs Theme for the rotor tabs.
_rotor_get_effects Return available effect for the Rotor Banner.
_rotor_setup_js Add required js and css as appropriate.

Constants