/** * Returns the ID of the class attribute with the given ID or false if no class/attribute by that identifier * is found. If multiple classes have the same identifier, the first found is returned. * * @param string $identifier * @return int|bool */ static function classAttributeIDByIdentifier($identifier) { return eZContentClassAttribute::classAttributeIDByIdentifier($identifier); }
public static function keyword($params) { $sqlTables = ''; $sqlJoins = ''; $keyword = isset($params['keyword']) ? $params['keyword'] : false; $attribute = isset($params['attribute']) ? $params['attribute'] : false; if ($keyword === false && is_string($keyword) && $keyword != '') { return array(); } $db = eZDB::instance(); $sqlKeyword = $db->escapeString($keyword); $sqlJoins .= 'coa_related_by_keyword' . $params['index'] . '.contentobject_id = ezcontentobject.id AND ' . 'coa_related_by_keyword' . $params['index'] . '.version = ezcontentobject.current_version AND '; $sqlJoins .= eZContentLanguage::sqlFilter('coa_related_by_keyword' . $params['index'], 'ezcontentobject') . ' AND '; if ($attribute !== false) { $attributeID = eZContentClassAttribute::classAttributeIDByIdentifier($attribute); if ($attributeID) { $sqlJoins .= 'coa_related_by_keyword' . $params['index'] . '.contentclassattribute_id = ' . $attributeID . ' AND '; } } $sqlJoins .= 'coa_related_by_keyword' . $params['index'] . '.id = kal_related_by_keyword' . $params['index'] . '.objectattribute_id AND ' . 'kal_related_by_keyword' . $params['index'] . '.keyword_id = k_related_by_keyword' . $params['index'] . '.id AND '; $sqlJoins .= 'k_related_by_keyword' . $params['index'] . ".keyword = '" . $sqlKeyword . "' AND"; $sqlTables .= ', ezcontentobject_attribute coa_related_by_keyword' . $params['index'] . ', ' . 'ezkeyword_attribute_link kal_related_by_keyword' . $params['index'] . ', ' . 'ezkeyword k_related_by_keyword' . $params['index']; return array('tables' => $sqlTables, 'joins' => $sqlJoins); }