You are here

function gallery_assist_item_box in Gallery Assist 6

Build and return the gallery item box.

1 call to gallery_assist_item_box()
gallery_assist_display in ./gallery_assist_display.inc
Display the Gallery Assist Container as grid.

File

./gallery_assist_display.inc, line 271
Build and display the Gallery Assist Container. This file will be included if the parameter "show_layout" is setted to "grid"

Code

function gallery_assist_item_box($type, $item, $conf, $img) {
  global $user;
  $shadow_style = '';
  if ($conf['gallery_items_shadow'] == 1) {
    $withshadow = ' shadow3';
    $shadow_style = '-moz-box-shadow:5px 5px 5px;box-shadow:5px 5px 5px;';
    drupal_add_css(drupal_get_path('module', 'gallery_assist') . '/css/gallery_assist_shadow.css', 'module', 'all', FALSE);
  }
  $item->nodetype = $type;
  $my_title_height = $item->show_title == 1 && $conf['thumbnail_size'] >= 100 ? 30 : 0;
  $my_item_width = $conf['thumbnail_size'] + $conf['thumbnail_size_plus'] + $conf['item_padding'] * 2 + $conf['item_border'] * 2;
  if (variable_get('gallery_assist_use_imagecache', 0) == 1 && $conf['force_image_height'] == 1) {
    $my_item_height = $conf['thumbnail_height_size'] + $conf['item_padding'] * 2 + $conf['item_border'] * 2 + $my_title_height;
  }
  else {
    $my_item_height = $conf['thumbnail_size'] + $conf['item_padding'] * 2 + $conf['item_border'] * 2 + $my_title_height;
  }
  $my_item_attr = array(
    'id' => 'item-box-' . $item->pid,
    'class' => $type . ' item-box',
    'style' => 'height:' . $my_item_height . 'px;' . 'width:' . $my_item_width . 'px;' . $shadow_style,
  );
  if ($item->cover == 1) {
    $item->type == $item->nodetype;
    $item->ga_public_status == $conf['ga_public_status'];
    if (gallery_assist_check_access($item, 'edit')) {
      $my_item_attr['class'] .= ' ga-cover-bg';
    }
  }
  if ($conf['item_margin'] > 0) {
    $my_item_attr['style'] .= 'margin:' . $conf['item_margin'] . 'px;';
  }
  $my_item_attr['style'] .= 'position:relative;';

  //$link = l('edit', 'node/gallery_assist/'. $item->nid .'/'. $item->pid, array('query' => array('page' => $_GET['page'])));
  $a_link = '<div id="image-box-' . $item->pid . '-links" class="' . $type . ' image-box-links">[ ' . $link . ' ]</div>' . "\n";
  $ga_item_attr = drupal_attributes($my_item_attr);
  $edit_link = $user->uid == $item->uid ? $a_link : '';
  $ga_item_box = gallery_assist_image_box($type, $item, $conf, $img);
  $ga_item_title = $item->show_title == 1 && $conf['thumbnail_size'] >= 100 ? gallery_assist_title_box($item, $conf) : '';
  $output = theme('gallery_assist_item_box', $ga_item_box, $ga_item_title, $ga_edit_link, $ga_item_attr);
  return $output;
}