本文整理汇总了PHP中eZContentObject::fillNodeListAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fillNodeListAttributes方法的具体用法?PHP eZContentObject::fillNodeListAttributes怎么用?PHP eZContentObject::fillNodeListAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fillNodeListAttributes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subTreeByNodeID
/**
* @param array|bool $params
* @param int $nodeID
* @return array|null
*/
static function subTreeByNodeID($params = false, $nodeID = 0)
{
if (!is_numeric($nodeID) and !is_array($nodeID)) {
return null;
}
if ($params === false) {
$params = array('Depth' => false, 'Offset' => false, 'Language' => false, 'Limit' => false, 'SortBy' => false, 'AttributeFilter' => false, 'ExtendedAttributeFilter' => false, 'ClassFilterType' => false, 'ClassFilterArray' => false, 'GroupBy' => false);
}
$offset = isset($params['Offset']) && is_numeric($params['Offset']) ? $params['Offset'] : false;
//$onlyTranslated = ( isset( $params['OnlyTranslated'] ) ) ? $params['OnlyTranslated'] : false;
$language = isset($params['Language']) ? $params['Language'] : false;
$limit = isset($params['Limit']) && is_numeric($params['Limit']) ? $params['Limit'] : false;
$depth = isset($params['Depth']) && is_numeric($params['Depth']) ? $params['Depth'] : false;
$depthOperator = isset($params['DepthOperator']) ? $params['DepthOperator'] : false;
$asObject = isset($params['AsObject']) ? $params['AsObject'] : true;
$loadDataMap = isset($params['LoadDataMap']) ? $params['LoadDataMap'] : false;
$groupBy = isset($params['GroupBy']) ? $params['GroupBy'] : false;
$mainNodeOnly = isset($params['MainNodeOnly']) ? $params['MainNodeOnly'] : false;
$ignoreVisibility = isset($params['IgnoreVisibility']) ? $params['IgnoreVisibility'] : false;
$objectNameFilter = isset($params['ObjectNameFilter']) ? $params['ObjectNameFilter'] : false;
if ($offset < 0) {
$offset = abs($offset);
}
if (!isset($params['SortBy'])) {
$params['SortBy'] = false;
}
if (!isset($params['ClassFilterType'])) {
$params['ClassFilterType'] = false;
}
$allowCustomSorting = false;
if (isset($params['ExtendedAttributeFilter']) && is_array($params['ExtendedAttributeFilter'])) {
$allowCustomSorting = true;
}
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($params['SortBy'], 'ezcontentobject_tree', $allowCustomSorting);
$classCondition = eZContentObjectTreeNode::createClassFilteringSQLString($params['ClassFilterType'], $params['ClassFilterArray']);
if ($classCondition === false) {
eZDebug::writeNotice("Class filter returned false");
return null;
}
$attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($params['AttributeFilter'], $sortingInfo, $language);
if ($attributeFilter === false) {
return null;
}
$extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings($params['ExtendedAttributeFilter']);
$mainNodeOnlyCond = eZContentObjectTreeNode::createMainNodeConditionSQLString($mainNodeOnly);
$pathStringCond = '';
$notEqParentString = '';
// If the node(s) doesn't exist we return null.
if (!eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($pathStringCond, $notEqParentString, $nodeID, $depth, $depthOperator)) {
return null;
}
if ($language) {
if (!is_array($language)) {
$language = array($language);
}
// This call must occur after eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings,
// because the parent node may not exist in Language
eZContentLanguage::setPrioritizedLanguages($language);
}
$groupBySelectText = '';
$groupBySQL = $extendedAttributeFilter['group_by'];
if (!$groupBySQL) {
eZContentObjectTreeNode::createGroupBySQLStrings($groupBySelectText, $groupBySQL, $groupBy);
} else {
if ($groupBy) {
eZDebug::writeError("Cannot use group_by parameter together with extended attribute filter which sets group_by!", __METHOD__);
}
}
$languageFilter = eZContentLanguage::languagesSQLFilter('ezcontentobject');
$objectNameLanguageFilter = eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
if ($language) {
eZContentLanguage::clearPrioritizedLanguages();
}
$objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString($objectNameFilter);
$limitation = isset($params['Limitation']) && is_array($params['Limitation']) ? $params['Limitation'] : false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
// Determine whether we should show invisible nodes.
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(!$ignoreVisibility);
$query = "SELECT DISTINCT " . "ezcontentobject.contentclass_id, ezcontentobject.current_version, ezcontentobject.id, ezcontentobject.initial_language_id, ezcontentobject.language_mask, " . "ezcontentobject.modified, ezcontentobject.owner_id, ezcontentobject.published, ezcontentobject.remote_id AS object_remote_id, ezcontentobject.section_id, ezcontentobject.status, " . "ezcontentobject_tree.contentobject_is_published, ezcontentobject_tree.contentobject_version, ezcontentobject_tree.depth, " . "ezcontentobject_tree.is_hidden, ezcontentobject_tree.is_invisible, ezcontentobject_tree.main_node_id, ezcontentobject_tree.modified_subnode, ezcontentobject_tree.node_id, " . "ezcontentobject_tree.parent_node_id, ezcontentobject_tree.path_identification_string, ezcontentobject_tree.path_string, ezcontentobject_tree.priority, " . "ezcontentobject_tree.remote_id, ezcontentobject_tree.sort_field, ezcontentobject_tree.sort_order, ezcontentclass.serialized_name_list as class_serialized_name_list, " . "ezcontentclass.identifier as class_identifier, ezcontentclass.is_container as is_container {$groupBySelectText}, ezcontentobject_name.name, ezcontentobject_name.real_translation " . $sortingInfo["attributeTargetSQL"] . " " . $extendedAttributeFilter["columns"] . " " . "FROM " . "ezcontentobject_tree " . "INNER JOIN ezcontentobject ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) " . "INNER JOIN ezcontentclass ON (ezcontentclass.version = 0 AND ezcontentclass.id = ezcontentobject.contentclass_id) " . "INNER JOIN ezcontentobject_name ON ( " . " ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND " . " ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version " . ") " . "{$sortingInfo['attributeFromSQL']} {$attributeFilter['from']} {$extendedAttributeFilter['tables']} {$sqlPermissionChecking['from']} " . "WHERE " . "{$pathStringCond} " . "{$extendedAttributeFilter['joins']} " . "{$sortingInfo['attributeWhereSQL']} " . "{$attributeFilter['where']} " . "{$notEqParentString} " . "{$mainNodeOnlyCond} " . "{$classCondition} " . "{$objectNameLanguageFilter} " . "{$showInvisibleNodesCond} " . "{$sqlPermissionChecking['where']} " . "{$objectNameFilterSQL} AND " . "{$languageFilter} " . $groupBySQL;
if ($sortingInfo['sortingFields']) {
$query .= " ORDER BY {$sortingInfo['sortingFields']}";
}
$db = eZDB::instance();
$server = count($sqlPermissionChecking['temp_tables']) > 0 ? eZDBInterface::SERVER_SLAVE : false;
$nodeListArray = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $limit), $server);
if ($asObject) {
$retNodeList = eZContentObjectTreeNode::makeObjectsArray($nodeListArray);
if ($loadDataMap === true) {
eZContentObject::fillNodeListAttributes($retNodeList);
} else {
if ($loadDataMap && is_numeric($loadDataMap) && $loadDataMap >= count($retNodeList)) {
eZContentObject::fillNodeListAttributes($retNodeList);
}
}
//.........这里部分代码省略.........
示例2: modify
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters )
{
$level = 0;
$done = false;
$i = 0;
$pathArray = array();
$tmpModulePath = $namedParameters['path'];
$classFilter = $namedParameters['class_filter'];
$language = $namedParameters['language'];
$loadDataMap = $namedParameters['load_data_map'];
// node_id is not used anymore
if ( !empty( $namedParameters['node_id'] ) )
{
eZDebug::writeNotice( 'Deprecated parameter "node_id" in treemenu template operator' );
}
if ( $classFilter === false )
{
$classFilter = array();
}
else if ( count( $classFilter ) == 0 )
{
$classFilter = array( 1 );
}
$classFilter = ( count( $classFilter ) == 1 and !isset( $classFilter[0] ) ) ? array( 1 ) : $classFilter;
$tmpModulePathCount = count( $tmpModulePath );
if ( !$tmpModulePath[ $tmpModulePathCount -1 ]['url'] and isset( $tmpModulePath[ $tmpModulePathCount -1 ]['node_id'] ) )
$tmpModulePath[ $tmpModulePathCount -1 ]['url'] = '/content/view/full/' . $tmpModulePath[ $tmpModulePathCount -1 ]['node_id'];
$depthSkip = $namedParameters['depth_skip'];
$indentationLevel = $namedParameters['indentation_level'];
$maxLevel = $namedParameters['max_level'];
$isSelectedMethod = $namedParameters['is_selected_method'];
if ( $maxLevel === false )
$maxLevel = 2;
while ( !$done && isset( $tmpModulePath[$i+$depthSkip] ) )
{
// get node id
$elements = explode( '/', $tmpModulePath[$i+$depthSkip]['url'] );
$nodeID = false;
if ( isset( $elements[4] ) )
$nodeID = $elements[4];
$excludeNode = false;
if ( isset( $elements[1] ) &&
isset( $elements[2] ) &&
$elements[1] == 'content' &&
$elements[2] == 'view' &&
is_numeric( $nodeID ) &&
$excludeNode == false &&
$level < $maxLevel )
{
$node = eZContentObjectTreeNode::fetch( $nodeID );
if ( !isset( $node ) ) { $operatorValue = $pathArray; return; }
if ( isset( $tmpModulePath[$i+$depthSkip+1] ) )
{
$nextElements = explode( '/', $tmpModulePath[$i+$depthSkip+1]['url'] );
if ( isset( $nextElements[4] ) )
{
$nextNodeID = $nextElements[4];
}
else
{
$nextNodeID = false;
}
}
else
$nextNodeID = false;
$menuChildren = eZContentObjectTreeNode::subTreeByNodeID( array( 'Depth' => 1,
'Offset' => 0,
'SortBy' => $node->sortArray(),
'Language' => $language,
'ClassFilterType' => 'include',
'ClassFilterArray' => $classFilter ),
$nodeID );
/// Fill objects with attributes, speed boost, only use if load_data_map is true
// or if less then 16 nodes and param is not set (null)
if ( $loadDataMap || ( $loadDataMap === null && count( $menuChildren ) <= 15 ) )
eZContentObject::fillNodeListAttributes( $menuChildren );
$tmpPathArray = array();
foreach ( $menuChildren as $child )
{
$name = $child->attribute( 'name' );
$tmpNodeID = $child->attribute( 'node_id' );
$url = "/content/view/full/$tmpNodeID/";
$urlAlias = '/' . $child->attribute( 'url_alias' );
$hasChildren = $child->attribute( 'is_container' ) && $child->attribute( 'children_count' ) > 0;
$contentObject = $child->attribute( 'object' );
$indent = ($i - 1) * $indentationLevel;
$isSelected = false;
$nextNextElements = ( $isSelectedMethod == 'node' and isset( $tmpModulePath[$i+$depthSkip+2]['url'] ) ) ? explode( '/', $tmpModulePath[$i+$depthSkip+2]['url'] ) : null;
//.........这里部分代码省略.........
示例3: relatedObjects
//.........这里部分代码省略.........
$attributeID =(int) $attributeID;
$relationTypeMasking .= " contentclassattribute_id=$attributeID AND ";
$relationTypeMask = eZContentObject::RELATION_ATTRIBUTE;
}
elseif ( is_bool( $relationTypeMask ) )
{
$relationTypeMask = eZContentObject::relationTypeMask( $relationTypeMask );
}
if ( $db->databaseName() == 'oracle' )
{
$relationTypeMasking .= " bitand( relation_type, $relationTypeMask ) <> 0 ";
}
else
{
$relationTypeMasking .= " ( relation_type & $relationTypeMask ) <> 0 ";
}
// Create SQL
$fromOrToContentObjectID = $reverseRelatedObjects == false ? " AND ezcontentobject.id=ezcontentobject_link.to_contentobject_id AND
ezcontentobject_link.from_contentobject_id='$objectID' AND
ezcontentobject_link.from_contentobject_version='$fromObjectVersion' "
: " AND ezcontentobject.id=ezcontentobject_link.from_contentobject_id AND
ezcontentobject_link.to_contentobject_id=$objectID AND
ezcontentobject_link.from_contentobject_version=ezcontentobject.current_version ";
$query = "SELECT ";
if ( $groupByAttribute )
{
$query .= "ezcontentobject_link.contentclassattribute_id, ";
}
$query .= "
ezcontentclass.serialized_name_list AS class_serialized_name_list,
ezcontentclass.identifier as contentclass_identifier,
ezcontentclass.is_container as is_container,
ezcontentobject.*, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
$sortingInfo[attributeTargetSQL]
FROM
ezcontentclass,
ezcontentobject,
ezcontentobject_link,
ezcontentobject_name
$sortingInfo[attributeFromSQL]
WHERE
ezcontentclass.id=ezcontentobject.contentclass_id AND
ezcontentclass.version=0 AND
ezcontentobject.status=" . eZContentObject::STATUS_PUBLISHED . " AND
$sortingInfo[attributeWhereSQL]
$relatedClassIdentifiersSQL
$relationTypeMasking
$fromOrToContentObjectID
$showInvisibleNodesCond AND
ezcontentobject.id = ezcontentobject_name.contentobject_id AND
ezcontentobject.current_version = ezcontentobject_name.content_version AND
" . eZContentLanguage::sqlFilter( 'ezcontentobject_name', 'ezcontentobject' ) . "
$sortingString";
if ( !$offset && !$limit )
{
$relatedObjects = $db->arrayQuery( $query );
}
else
{
$relatedObjects = $db->arrayQuery( $query, array( 'offset' => $offset,
'limit' => $limit ) );
}
$ret = array();
$tmp = array();
foreach ( $relatedObjects as $object )
{
if ( $asObject )
{
$obj = new eZContentObject( $object );
$obj->ClassName = eZContentClass::nameFromSerializedString( $object['class_serialized_name_list'] );
}
else
{
$obj = $object;
}
$tmp[] = $obj;
if ( !$groupByAttribute )
{
$ret[] = $obj;
}
else
{
$classAttrID = $object['contentclassattribute_id'];
if ( !isset( $ret[$classAttrID] ) )
$ret[$classAttrID] = array();
$ret[$classAttrID][] = $obj;
}
}
if ( $loadDataMap && $asObject )
eZContentObject::fillNodeListAttributes( $tmp );
return $ret;
}
示例4: fetchNodeByRating
//.........这里部分代码省略.........
}
if (isset($params['offset'])) {
$offset = (int) $params['offset'];
}
if ($includeNotRated) {
$ratingFromSql = 'LEFT JOIN ezstarrating
ON ezstarrating.contentobject_id = ezcontentobject.id';
$ratingWhereSql = '';
} else {
$ratingFromSql = ', ezstarrating';
$ratingWhereSql = 'ezstarrating.contentobject_id = ezcontentobject.id AND';
}
if (isset($params['sort_by']) && is_array($params['sort_by'])) {
$orderBySql = 'ORDER BY ';
$orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
foreach ($orderArr as $key => $order) {
$orderBySqlPart = false;
$direction = isset($order[1]) ? $order[1] : false;
switch ($order[0]) {
case 'rating':
$orderBySqlPart = 'rating ' . ($direction ? 'ASC' : 'DESC');
break;
case 'rating_count':
$orderBySqlPart = 'rating_count ' . ($direction ? 'ASC' : 'DESC');
break;
case 'object_count':
$selectSql .= 'COUNT( ezcontentobject.id ) as object_count,';
$orderBySqlPart = 'object_count ' . ($direction ? 'ASC' : 'DESC');
break;
case 'published':
$orderBySqlPart = 'ezcontentobject.published ' . ($direction ? 'ASC' : 'DESC');
break;
case 'modified':
$orderBySqlPart = 'ezcontentobject.modified ' . ($direction ? 'ASC' : 'DESC');
break;
case 'view_count':
// notice: will only fetch nodes that HAVE a entry in the ezview_counter table!!!
$selectSql .= 'ezview_counter.count as view_count,';
$fromSql .= ', ezview_counter';
$whereSql[] = 'ezcontentobject_tree.node_id = ezview_counter.node_id';
$orderBySqlPart = 'view_count ' . ($direction ? 'ASC' : 'DESC');
break;
default:
if (isset($params['extended_attribute_filter'])) {
$orderBySqlPart = $order[0] . ' ' . ($direction ? 'ASC' : 'DESC');
} else {
eZDebug::writeError("Unsuported sort type '{$order['0']}', for fetch_by_starrating().", __METHOD__);
}
break;
}
if ($orderBySqlPart) {
if ($key !== 0) {
$orderBySql .= ',';
}
$orderBySql .= $orderBySqlPart;
}
}
}
$whereSql = $whereSql ? implode($whereSql, ' AND ') . ' AND ' : '';
$extendedAttributeFilter = eZContentObjectTreeNode::createExtendedAttributeFilterSQLStrings($params['extended_attribute_filter']);
$limitation = isset($params['limitation']) && is_array($params['limitation']) ? $params['limitation'] : false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
$languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
$useVersionName = true;
$versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString($useVersionName);
$versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString($useVersionName);
$versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString($useVersionName, false);
$mainNodeOnlyCond = eZContentObjectTreeNode::createMainNodeConditionSQLString($mainNodeOnly);
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(!$ignoreVisibility);
$db = eZDB::instance();
$sql = "SELECT\n {$selectSql}\n AVG( ezstarrating.rating_average ) as rating,\n SUM( ezstarrating.rating_count ) as rating_count,\n ezcontentclass.serialized_name_list as class_serialized_name_list,\n ezcontentclass.identifier as class_identifier,\n ezcontentclass.is_container as is_container\n {$versionNameTargets}\n {$extendedAttributeFilter['columns']}\n FROM\n ezcontentobject_tree,\n ezcontentobject_tree owner_tree,\n ezcontentclass\n {$fromSql}\n {$versionNameTables}\n {$extendedAttributeFilter['tables']}\n {$sqlPermissionChecking['from']}\n ,ezcontentobject\n {$ratingFromSql}\n WHERE\n {$extendedAttributeFilter['joins']}\n {$ratingWhereSql}\n ezcontentobject.id = ezcontentobject_tree.contentobject_id AND\n ezcontentobject.owner_id = owner_tree.contentobject_id AND\n owner_tree.node_id = owner_tree.main_node_id AND\n ezcontentclass.version=0 AND\n ezcontentclass.id = ezcontentobject.contentclass_id AND\n {$mainNodeOnlyCond}\n {$classCondition}\n {$whereSql}\n\t {$versionNameJoins}\n\t {$showInvisibleNodesCond}\n\t {$sqlPermissionChecking['where']}\n\t {$languageFilter}\n {$groupBySql}\n {$orderBySql}";
$server = isset($sqlPermissionChecking['temp_tables'][0]) ? eZDBInterface::SERVER_SLAVE : false;
if ($offset !== false || $limit !== false) {
$rows = $db->arrayQuery($sql, array('offset' => $offset, 'limit' => $limit), $server);
} else {
$rows = $db->arrayQuery($sql, null, $server);
}
$db->dropTempTableList($sqlPermissionChecking['temp_tables']);
unset($db);
if (isset($rows[0]) && is_array($rows)) {
if ($asObject) {
$ret = ezsrRatingObjectTreeNode::makeObjectsArray($rows);
if ($loadDataMap) {
eZContentObject::fillNodeListAttributes($ret);
}
} else {
$ret = $rows;
}
} else {
if ($rows === false) {
eZDebug::writeError('The ezstarrating table seems to be missing,
contact your administrator', __METHOD__);
$ret = array();
} else {
$ret = array();
}
}
return $ret;
}
示例5: relatedObjects
function relatedObjects($fromObjectVersion = false, $objectID = false, $attributeID = 0, $groupByAttribute = false, $params = false, $reverseRelatedObjects = false)
{
if ($fromObjectVersion == false) {
$fromObjectVersion = isset($this->CurrentVersion) ? $this->CurrentVersion : false;
}
$fromObjectVersion = (int) $fromObjectVersion;
if (!$objectID) {
$objectID = $this->ID;
}
$objectID = (int) $objectID;
$limit = isset($params['Limit']) && is_numeric($params['Limit']) ? $params['Limit'] : false;
$offset = isset($params['Offset']) && is_numeric($params['Offset']) ? $params['Offset'] : false;
$asObject = isset($params['AsObject']) ? $params['AsObject'] : true;
$loadDataMap = isset($params['LoadDataMap']) ? $params['LoadDataMap'] : false;
$db = eZDB::instance();
$sortingString = '';
$sortingInfo = array('attributeFromSQL' => '', 'attributeWhereSQL' => '');
$showInvisibleNodesCond = '';
// process params (only SortBy and IgnoreVisibility currently supported):
// Supported sort_by modes:
// class_identifier, class_name, modified, name, published, section
if (is_array($params)) {
if (isset($params['SortBy'])) {
if (!in_array($params['SortBy'], array('class_identifier', 'class_name', 'modified', 'name', 'published', 'section'))) {
eZDebug::writeWarning("Unsupported sort_by parameter {$params['SortBy']}; check the online documentation for the list of supported sort types", __METHOD__);
} else {
$sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($params['SortBy']);
$sortingString = ' ORDER BY ' . $sortingInfo['sortingFields'];
}
}
if (isset($params['IgnoreVisibility'])) {
$showInvisibleNodesCond = self::createFilterByVisibilitySQLString($params['IgnoreVisibility']);
}
}
$relationTypeMasking = '';
$relationTypeMask = isset($params['AllRelations']) ? $params['AllRelations'] : $attributeID === false;
if ($attributeID && ($relationTypeMask === false || $relationTypeMask === eZContentObject::RELATION_ATTRIBUTE)) {
$attributeID = (int) $attributeID;
$relationTypeMasking .= " AND contentclassattribute_id={$attributeID} ";
$relationTypeMask = eZContentObject::RELATION_ATTRIBUTE;
} elseif (is_bool($relationTypeMask)) {
$relationTypeMask = eZContentObject::relationTypeMask($relationTypeMask);
}
if ($db->databaseName() == 'oracle') {
$relationTypeMasking .= " AND bitand( relation_type, {$relationTypeMask} ) <> 0 ";
} else {
$relationTypeMasking .= " AND ( relation_type & {$relationTypeMask} ) <> 0 ";
}
// Create SQL
$versionNameTables = ', ezcontentobject_name ';
$versionNameTargets = ', ezcontentobject_name.name as name, ezcontentobject_name.real_translation ';
$versionNameJoins = " AND ezcontentobject.id = ezcontentobject_name.contentobject_id AND\n ezcontentobject.current_version = ezcontentobject_name.content_version AND ";
$versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
$fromOrToContentObjectID = $reverseRelatedObjects == false ? " AND ezcontentobject.id=ezcontentobject_link.to_contentobject_id AND\n ezcontentobject_link.from_contentobject_id='{$objectID}' AND\n ezcontentobject_link.from_contentobject_version='{$fromObjectVersion}' " : " AND ezcontentobject.id=ezcontentobject_link.from_contentobject_id AND\n ezcontentobject_link.to_contentobject_id={$objectID} AND\n ezcontentobject_link.from_contentobject_version=ezcontentobject.current_version ";
$query = "SELECT ";
if ($groupByAttribute) {
$query .= "ezcontentobject_link.contentclassattribute_id, ";
}
$query .= "\n ezcontentclass.serialized_name_list AS class_serialized_name_list,\n ezcontentclass.identifier as contentclass_identifier,\n ezcontentclass.is_container as is_container,\n ezcontentobject.* {$versionNameTargets}\n FROM\n ezcontentclass,\n ezcontentobject,\n ezcontentobject_link\n {$versionNameTables}\n {$sortingInfo['attributeFromSQL']}\n WHERE\n ezcontentclass.id=ezcontentobject.contentclass_id AND\n ezcontentclass.version=0 AND\n ezcontentobject.status=" . eZContentObject::STATUS_PUBLISHED . " AND\n {$sortingInfo['attributeWhereSQL']}\n ezcontentobject_link.op_code='0'\n {$relationTypeMasking}\n {$fromOrToContentObjectID}\n {$showInvisibleNodesCond}\n {$versionNameJoins}\n {$sortingString}";
if (!$offset && !$limit) {
$relatedObjects = $db->arrayQuery($query);
} else {
$relatedObjects = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $limit));
}
$ret = array();
$tmp = array();
foreach ($relatedObjects as $object) {
if ($asObject) {
$obj = new eZContentObject($object);
$obj->ClassName = eZContentClass::nameFromSerializedString($object['class_serialized_name_list']);
} else {
$obj = $object;
}
$tmp[] = $obj;
if (!$groupByAttribute) {
$ret[] = $obj;
} else {
$classAttrID = $object['contentclassattribute_id'];
if (!isset($ret[$classAttrID])) {
$ret[$classAttrID] = array();
}
$ret[$classAttrID][] = $obj;
}
}
if ($loadDataMap && $asObject) {
eZContentObject::fillNodeListAttributes($tmp);
}
return $ret;
}
示例6: subTreeByNodeID
//.........这里部分代码省略.........
}
$groupBySelectText = '';
$groupBySQL = $extendedAttributeFilter['group_by'];
if ( !$groupBySQL )
{
eZContentObjectTreeNode::createGroupBySQLStrings( $groupBySelectText, $groupBySQL, $groupBy );
}
else if ( $groupBy )
{
eZDebug::writeError( "Cannot use group_by parameter together with extended attribute filter which sets group_by!", __METHOD__ );
}
$useVersionName = true;
$versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString ( $useVersionName );
$versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString( $useVersionName );
$versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString ( $useVersionName, false );
$languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter( 'ezcontentobject' );
if ( $language )
{
eZContentLanguage::clearPrioritizedLanguages();
}
$objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString( $objectNameFilter );
$limitation = ( isset( $params['Limitation'] ) && is_array( $params['Limitation'] ) ) ? $params['Limitation']: false;
$limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );
// Determine whether we should show invisible nodes.
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( !$ignoreVisibility );
$query = "SELECT DISTINCT
ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.serialized_name_list as class_serialized_name_list,
ezcontentclass.identifier as class_identifier,
ezcontentclass.is_container as is_container
$groupBySelectText
$versionNameTargets
$sortingInfo[attributeTargetSQL]
$extendedAttributeFilter[columns]
FROM
ezcontentobject_tree,
ezcontentobject,ezcontentclass
$versionNameTables
$sortingInfo[attributeFromSQL]
$attributeFilter[from]
$extendedAttributeFilter[tables]
$sqlPermissionChecking[from]
WHERE
$pathStringCond
$extendedAttributeFilter[joins]
$sortingInfo[attributeWhereSQL]
$attributeFilter[where]
ezcontentclass.version=0 AND
$notEqParentString
ezcontentobject_tree.contentobject_id = ezcontentobject.id AND
ezcontentclass.id = ezcontentobject.contentclass_id AND
$mainNodeOnlyCond
$classCondition
$versionNameJoins
$showInvisibleNodesCond
$sqlPermissionChecking[where]
$objectNameFilterSQL
$languageFilter
$groupBySQL";
if ( $sortingInfo['sortingFields'] )
$query .= " ORDER BY $sortingInfo[sortingFields]";
$db = eZDB::instance();
$server = count( $sqlPermissionChecking['temp_tables'] ) > 0 ? eZDBInterface::SERVER_SLAVE : false;
$nodeListArray = $db->arrayQuery( $query, array( 'offset' => $offset,
'limit' => $limit ),
$server );
if ( $asObject )
{
$retNodeList = eZContentObjectTreeNode::makeObjectsArray( $nodeListArray );
if ( $loadDataMap === true )
eZContentObject::fillNodeListAttributes( $retNodeList );
else if ( $loadDataMap && is_numeric( $loadDataMap ) && $loadDataMap >= count( $retNodeList ) )
eZContentObject::fillNodeListAttributes( $retNodeList );
}
else
{
$retNodeList = $nodeListArray;
}
// cleanup temp tables
$db->dropTempTableList( $sqlPermissionChecking['temp_tables'] );
return $retNodeList;
}