You are here

function gallery_assist_display_item in Gallery Assist 6

Allow to use jquery effects on the image view such as flash, slideshow, zoom viewer, galleria.

Parameters

$node: A object containing the node data.

$pid: A integer contains the PID (picture ID) should be displayed.

1 string reference to 'gallery_assist_display_item'
gallery_assist_menu in ./gallery_assist.module
Implementation of hook_menu().

File

./gallery_assist.module, line 3748
Drupal content type with gallery functionality.

Code

function gallery_assist_display_item($node, $pid) {
  if (is_numeric($pid) || $pid == 'cover') {
    if (!is_numeric($pid)) {
      if ($pid == 'lightbox2') {
        return;
      }
      elseif ($pid == 'cover') {
        $pid = db_result(db_query("SELECT pid FROM {gallery_assist_item} WHERE gref = %d AND cover = 1", $node->gref));
      }
      else {
        $pid = db_result(db_query("SELECT p.pid FROM {gallery_assist_item} p JOIN {gallery_assist_translated} t ON p.pid = t.pid WHERE p.gref = %d AND t.ptitle = '%s'", $node->gref, $pid));
      }
    }

    // Check if the image exists.
    if (!isset($node->gallitems[$pid])) {
      drupal_set_message(t('The requested image not exist or is not longer published.'));
      drupal_goto('node/' . $node->nid);
    }
    global $user;
    $data = variable_get('gallery_assist_' . $node->type . '_data', FALSE);

    //$data['item_display_option'] = 'mbImgNav';
    $item_effect = $node->gallconf[$node->type]['item_effect'] ? $node->gallconf[$node->type]['item_effect'] : 'default';
    switch ($item_effect) {
      case 'default':
        $output = gallery_assist_display_item_default($node, $pid, $data);
        break;
      case 'cicle':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_cicle($node, $pid, $data);
        }
        break;
      case 'innerfade':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_innerfade($node, $pid, $data);
        }
        break;
      case 'dewslider':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_dewslider($node, $pid, $data);
        }
        break;
      case 'jcarousellite':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_jcarousellite($node, $pid, $data);
        }
        break;
      case 'galleria':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_galleria($node, $pid, $data);
        }
        break;
      case 'mbgallery':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_mbgallery($node, $pid, $data);
        }
        break;
      case 'mbImgNav':
        if (module_exists('gallery_assist_item')) {
          module_load_include('inc', 'gallery_assist_item', 'gallery_assist_display_item_cicle');
          $output = gallery_assist_display_item_mbImgNav($node, $pid, $data);
        }
        break;
    }
    return $output;
  }
  else {
    return FALSE;
  }
}