You are here

node_gallery_views_handler_image_count.inc in Node Gallery 6.2

node_gallery_handler_image_count.inc

File

includes/node_gallery_views_handler_image_count.inc
View source
<?php

/**
 * @file node_gallery_handler_image_count.inc
 *
 * 
 */
class node_gallery_views_handler_image_count extends views_handler_field_numeric {
  function query() {
    $table = $this
      ->ensure_my_table();
    $sql = "SELECT COUNT(*) FROM {node_galleries} ng JOIN {node} n on ng.nid = n.nid WHERE n.status = 1 AND ng.gid = %d";
    $sql = str_replace('%d', $this->table . '.gid', $sql);
    $this->query
      ->add_field('', "({$sql})", 'image_count');
    $this->field_alias = 'image_count';
  }

}

Classes

Namesort descending Description
node_gallery_views_handler_image_count @file node_gallery_handler_image_count.inc