You are here

function photos_data_sub_block_slide in Album Photos 7.3

Sub-album slideshow page.

1 string reference to 'photos_data_sub_block_slide'
photos_menu in ./photos.module
Implements hook_menu().

File

inc/photos.data.inc, line 80
Handles slideshow integration.

Code

function photos_data_sub_block_slide($node, $op) {
  drupal_add_http_header('Content-Type:', 'text/plain;');
  drupal_add_http_header('Cache-Control:', 'no-cache, must-revalidate');
  drupal_add_http_header('Expires:', 'Sat, 26 Jul 1997 05:00:00 GMT');
  switch ($op) {
    case 'block_new':
      $query = db_select('file_managed', 'f');
      $query
        ->join('photos_image', 'p', 'p.fid = f.fid');
      $query
        ->join('node', 'n', 'n.nid = p.pid');
      $query
        ->join('users', 'u', 'u.uid = f.uid');
      $query
        ->join('photos_node', 'a', 'a.fid = p.fid');
      $query
        ->addField('p', 'title', 'image_title');
      $query
        ->fields('f', array(
        'fid',
        'uri',
        'filemime',
        'timestamp',
        'filename',
        'filesize',
      ))
        ->fields('n', array(
        'title',
      ))
        ->fields('u', array(
        'uid',
        'name',
      ))
        ->fields('p', array(
        'pid',
        'comcount',
        'count',
      ))
        ->condition('a.nid', $node->nid)
        ->orderBy('f.fid', 'DESC')
        ->range(0, 4);
      $result = $query
        ->execute();
      $i = 0;
      $pager_image_style = variable_get('photos_pager_imagesize', 'thumbnail');
      foreach ($result as $image) {
        $t = array();
        $styled_image_url = image_style_url($pager_image_style, $image->uri);
        $t['url'] = _photos_l($image->uri, $pager_image_style);
        $t['filename'] = $image->image_title;
        $t['link'] = url('photos/image/' . $image->fid);
        $array[] = $t;
        ++$i;
      }
      $array['count'] = $i;
  }
  if (!isset($_GET['type']) && $array['count'] || isset($_GET['type']) && $_GET['type'] != 'xml' && $array['count']) {
    print _photos_json('en', $array);
  }
}