You are here

function gallery_assist_load_node_items in Gallery Assist 7

1 call to gallery_assist_load_node_items()
gallery_assist_gallery2_node_form in ./gallery_assist.module

File

./gallery_assist.module, line 855
Extend drupal with gallery functionalities. Manage galleries.

Code

function gallery_assist_load_node_items(&$node) {

  //  dsm('gallery_assist_load_node_items');
  $node->cacao = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  $total = $query = db_select('gallery_assist_item', 'p', array(
    'fetch' => PDO::FETCH_ASSOC,
  ))
    ->extend('PagerDefault')
    ->element(0);
  $query
    ->join('gallery_assist_translated', 't', 'p.pid = t.pid');
  $query
    ->fields('p');
  $query
    ->fields('t', array(
    'lang',
    'ptitle',
    'palt',
    'pdescription',
    'format',
  ));
  $query
    ->condition('p.gref', $node->ga_gref);
  $query
    ->orderBy('p.cover', 'DESC');
  $query
    ->orderBy('p.weight', 'ASC');

  //  if (is_numeric($node->ga_conf[$node->type]['ga_limit'])) {
  //    $query->limit($node->ga_conf[$node->type]['ga_limit']);
  //  }
  $query
    ->limit(4);

  //  dsm('ITEMS LIST');
  $items = array();
  foreach ($query
    ->execute() as $item) {
    $items[$item['pid']] = (object) $item;

    //    dsm($item['pid']);
  }
  $node->mytest_items = $items;
}