Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
/** 
 * Allows to detect if item has any additional images available 
 * 
 * @param Array $params 
 * @return string 
 */ 
function HasAdditionalImages($params) 
{ 
    static $cache = null; 

     $object =& $this->getObject($params); 
    /* @var $object kDBList */ 

    if (!isset($cache)) { 
        $resource_ids = $object->GetCol('ResourceId'); 
        $sql = 'SELECT ImageId, ResourceId 
                FROM ' . $this->Application->getUnitOption('img', 'TableName') . ' 
                WHERE ResourceId IN (' . implode(',', $resource_ids) . ') AND DefaultImg != 1 AND Enabled = 1 
                GROUP BY ResourceId'; 
        $cache = $this->Conn->GetCol($sql, 'ResourceId'); 
    } 

    $resource_id = $object->GetDBField('ResourceId'); 

    return array_key_exists($resource_id, $cache) ? $cache[$resource_id] : false; 
} 

...