You are here

rotor.module in Rotor Banner 6

Same filename and directory in other branches
  1. 5.7 rotor.module
  2. 5 rotor.module
  3. 6.2 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@achieveinternet.com. http://www.achieveinternet.com

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@achieveinternet.com. http://www.achieveinternet.com
 */

// CONSTANTS
define('ROTOR_GROUP_TABS', 0);
define('ROTOR_DONT_GROUP_TABS', 1);
define('ROTOR_TAB_POSITION_TOP', 0);
define('ROTOR_TAB_POSITION_BOTTOM', 1);
define('ROTOR_TAB_POSITION_LEFT', 2);
define('ROTOR_TAB_POSITION_RIGHT', 3);

/**
 * 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',
    'create rotor item',
    'edit any rotor item',
    'edit own rotor item',
    'delete any rotor item',
    'delete own rotor item',
  );
}

/**
 * Implementation of hook_access().
 */
function rotor_access($op, $node, $account) {
  $is_author = $account->uid == $node->uid;
  if ($op == 'create') {

    // return TRUE;
    return user_access('create rotor item');
  }
  if ($op == 'update') {
    if (user_access('edit any rotor item') || user_access('edit own rotor item') && $is_author) {
      return TRUE;
    }
  }
  if ($op == 'delete') {
    if (user_access('delete any rotor item') || user_access('delete own rotor item') && $is_author) {
      return TRUE;
    }
  }
}

/**
 * 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.' . ' The Rotor item will have a tab text that can be configured to be shown or not' . ' in the administration page for the rotor.' . ' 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() {
  $items = array();
  $items['admin/settings/rotor'] = array(
    'title' => t('Rotor banner'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rotor_admin_form',
    ),
    'access arguments' => array(
      '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',
        'cache' => BLOCK_NO_CACHE,
      );
      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());
  $form['#submit'] = array(
    'rotor_admin_form_submit',
  );
  return system_settings_form($form);
}

/**
 * Admin settings form submit function
 */
function rotor_admin_form_submit(&$node, &$form_state) {
  $values = $form_state['values'];
  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, &$param) {
  $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,
    '#prefix' => $image,
    '#weight' => -4,
    '#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->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,
  );
  $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']['url'] = array(
    '#type' => 'textfield',
    '#title' => t('Link URL'),
    '#default_value' => $node->url,
    '#description' => t('The link that will be actived for this item. Example: http://www.drupal.org, node/3'),
  );
  $form['link']['link_target'] = array(
    '#type' => 'select',
    '#title' => t('Link target'),
    '#options' => $target_options,
    '#default_value' => $node->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';
  $form['#submit'] = array(
    'rotor_submit',
  );
  return $form;
}

/**
 * Node form submit function.
 * We handle the image submition.
 */
function rotor_submit(&$node, &$form_state) {
  $upload_dir = file_directory_path();
  if (!empty($_FILES['files']['name']['rotor_image'])) {
    if (file_check_directory($upload_dir, FILE_CREATE_DIRECTORY)) {
      $file_saved = file_save_upload('rotor_image', array(), file_directory_path(), FILE_EXISTS_RENAME);
      if (!$file_saved) {
        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->file_path);
      }
      else {
        file_set_status($file_saved, FILE_STATUS_PERMANENT);
        $form_state['values']['rotor_image'] = $file_saved->filepath;
        watchdog('rotor', 'Imaged saved: ' . $file_saved->file_path);
      }
    }
    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 (!$form_state['values']['link_target'] || $form_state['values']['link_target'] == "default") {
    unset($form_state['values']['link_target']);
  }
}

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

/**
 * Implementation of hook_update().
 */
function rotor_update($node) {
  db_query("UPDATE {rotor_item} SET file_path = '%s', 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 = db_fetch_object(db_query('SELECT file_path AS rotor_image, alt_text, url, link_target FROM {rotor_item} WHERE nid = %d', $node->nid));
  return $additions;
}

/**
 * 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;
}

/**
 * Implementation of hook_theme().
 */
function rotor_theme() {
  $functions = array(
    'rotor_tabs' => array(
      'arguments' => array(
        'items' => array(),
      ),
    ),
    'rotor_block' => array(
      'arguments' => array(
        'items' => array(),
      ),
    ),
    'rotor_items' => array(
      'arguments' => array(
        'items' => array(),
      ),
    ),
    'rotor_item' => array(
      'arguments' => array(
        'item' => NULL,
      ),
    ),
    'rotor_admin_list' => array(
      'arguments' => array(
        'list' => array(),
      ),
    ),
    'rotor_image' => array(
      'arguments' => array(
        'rotor_image' => NULL,
      ),
    ),
  );
  return $functions;
}

/**
 * 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 {
    $limit = !$limit ? '' : " LIMIT " . $limit;
    $random = $random ? "ORDER BY RAND()" : "";
    $result = db_query("SELECT nid FROM {node} WHERE type = 'rotor_item' AND status=1 %s %s", $random, $limit);
  }
  while ($node = db_fetch_array($result)) {
    $items[] = node_load($node);
  }
  return $items;
}
function rotor_get_imagecache_presets($reset = FALSE) {
  $presets_full = imagecache_presets($reset);
  $presets = array();
  foreach ($presets_full as $preset_id => $preset) {
    $presets[$preset_id] = $preset['presetname'];
  }
  return $presets;
}

/**
 * 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($rotor_item) {
  $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, $rotor_item->rotor_image, $rotor_item->alt_text, $rotor_item->title);
  }
  return theme('image', file_create_url($rotor_item->rotor_image), $rotor_item->alt_text, $rotor_item->title, NULL, FALSE);
}

/**
 * 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 && variable_get('rotor_tab_position', ROTOR_TAB_POSITION_TOP) == ROTOR_TAB_POSITION_TOP) {
    $output .= theme('rotor_tabs', $items);
  }
  $output .= theme('rotor_items', $items);
  if (variable_get('rotor_group_tabs', ROTOR_GROUP_TABS) == ROTOR_GROUP_TABS && variable_get('rotor_tab_position', ROTOR_TAB_POSITION_TOP) == ROTOR_TAB_POSITION_BOTTOM) {
    $output .= theme('rotor_tabs', $items);
  }
  $output .= '</div>';
  return $output;
}

/**
 * Theme for the rotor tabs.
 *
 * @param array $items The array of items 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 $item) {
      $output .= theme_rotor_tab($item);
    }
    $output .= '</div>';
  }
  return $output;
}

/**
 * Theme for one Rotor tab.
 *
 * @param array $item The Rotor item whose tab is being displayed.
 */
function theme_rotor_tab($item) {
  return '<div class="rotor-tab">' . $item->title . '</div>';
}

/**
 * Theme for the Rotor items list.
 *
 * @param array $items The array of items.
 */
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 $item) {
    $output .= theme('rotor_item', $item);
  }
  $output .= '</div>';
  return $output;
}

/**
 * Theme for each Rotor item.
 *
 * @param node $item The rotor_item node to theme.
 */
function theme_rotor_item($item) {
  $show_tabs = variable_get('rotor_show_tabs', 1);
  $group_tabs = variable_get('rotor_group_tabs', ROTOR_GROUP_TABS);
  $tab_position = variable_get('rotor_tab_position', ROTOR_TAB_POSITION_TOP);
  $output = '<div class="rotor-content">';
  if ($show_tabs && $group_tabs == ROTOR_DONT_GROUP_TABS && $tab_position == ROTOR_TAB_POSITION_TOP) {
    $output .= theme_rotor_tab($item);
  }
  $output .= ' <div class="rotor-content-detail">';
  if ($item->rotor_image) {
    $output .= $item->url ? l(theme('rotor_image', $item), $item->url, array(
      'html' => TRUE,
      'attributes' => array(
        'target' => $item->link_target,
      ),
    )) : theme('rotor_image', $item);
  }
  else {
    $output .= check_markup($item->body, $item->format, FALSE);
  }
  $output .= '</div>';
  if ($show_tabs && $group_tabs == ROTOR_DONT_GROUP_TABS && $tab_position == ROTOR_TAB_POSITION_BOTTOM) {
    $output .= theme_rotor_tab($item);
  }
  $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 $item) {
    if ($item->rotor_image) {
      $output = $item->url ? l(theme('rotor_image', $item), $item->url, array(
        'html' => TRUE,
        'attributes' => array(
          'title' => $item->alt_text,
        ),
      )) : theme('rotor_image', $item);
    }
    else {
      $output = check_markup($item->body);
    }
    $rows[] = array(
      l($item->title, 'node/' . $item->nid . '/edit'),
      $output,
      l(t('Edit'), 'node/' . $item->nid . '/edit') . ' | ' . l(t('Remove'), 'node/' . $item->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 files.
 */
function _rotor_setup_js() {
  $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');
}

/**
 * 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'),
    'slideX' => t('Slide X'),
    'slideY' => t('Slide Y'),
    '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'),
  );
  return $effects;
}

Functions

Namesort descending Description
rotor_access Implementation of hook_access().
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_form Node form hook
rotor_get_imagecache_presets
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_theme Implementation of hook_theme().
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_tab Theme for one Rotor tab.
theme_rotor_tabs Theme for the rotor tabs.
_rotor_get_effects Return available effect for the Rotor Banner.
_rotor_setup_js Add required js files.

Constants