Friday 02 July 2010 5:57:22 am
I am not quite sure what you need, but if you need to distinguish article objects which actually have an image uploaded you can use this extended_attribute_filter in your extension:
<?php
class eZExtendedImageFilter{
function eZExtendedImageFilter(){
// Empty...
}
function createSqlParts( $params ) {
$result = array( 'tables' => '', 'joins' => '' );
if ( isset( $params['classes'] ) ) {
$classes = $params['classes'];
} else return;
$attr = 'image';
if ( isset( $params['attr'] ) ) {
$attr = $params['attr'];
}
$attribute_ids = array();
foreach ($classes as $class) {
array_push($attribute_ids,eZContentObjectTreeNode::classAttributeIDByIdentifier( $class . '/' . $attr ));
}
$class_cond = array();
foreach ($attribute_ids as $aid) {
if ($aid) {
array_push($class_cond, 'i1.contentclassattribute_id = '.$aid);
}
}
$string_class_cond = implode(" OR ",$class_cond);
$filterSQL = array();
$filterSQL['from'] = ", ezcontentobject_attribute i1 ";
$filterSQL['where'] = " (i1.contentobject_id = ezcontentobject.id AND (" . $string_class_cond . ") AND i1.version = ezcontentobject_name.content_version AND i1.language_code = ezcontentobject_name.real_translation AND i1.data_text LIKE '%is_valid=\"1\"%' ) AND ";
return array( 'tables' => $filterSQL['from'], 'joins' => $filterSQL['where'] );
}
}
?> Add this into extendedattributefilter.ini.append.php:
[ExtendedImageFilter]
#The name of the extension where the filtering code is defined.
ExtensionName=your_extension
#The name of the filter class.
ClassName=eZExtendedImageFilter
#The name of the method which is called to generate the SQL parts.
MethodName=createSqlParts
#The file which should be included (extension/myextension will automatically be prepended).
FileName=kernel/classes/ezimagefilter.php To learn more about extended_attribute_filter look here: http://ez.no/doc/ez_publish/technical_manual/4_x/reference/modules/content/fetch_functions/list
http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac
|