当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentObjectTreeNode::createVersionNameTargetsSQLString方法代码示例

本文整理汇总了PHP中eZContentObjectTreeNode::createVersionNameTargetsSQLString方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::createVersionNameTargetsSQLString方法的具体用法?PHP eZContentObjectTreeNode::createVersionNameTargetsSQLString怎么用?PHP eZContentObjectTreeNode::createVersionNameTargetsSQLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentObjectTreeNode的用法示例。


在下文中一共展示了eZContentObjectTreeNode::createVersionNameTargetsSQLString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchNodesByPathString

 static function fetchNodesByPathString($nodePath, $withLastNode = false, $asObjects = true, $limit = false)
 {
     $nodesListArray = array();
     $pathString = eZContentObjectTreeNode::createNodesConditionSQLStringFromPath($nodePath, $withLastNode, $limit);
     if ($pathString) {
         $useVersionName = true;
         $versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString($useVersionName);
         $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString($useVersionName);
         $versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString($useVersionName);
         $query = "SELECT ezcontentobject.*,\n                             ezcontentobject_tree.*,\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                      FROM ezcontentobject_tree,\n                           ezcontentobject,\n                           ezcontentclass\n                           {$versionNameTables}\n                      WHERE {$pathString}\n                            ezcontentobject_tree.contentobject_id=ezcontentobject.id  AND\n                            ezcontentclass.version=0 AND\n                            ezcontentclass.id = ezcontentobject.contentclass_id\n                            {$versionNameJoins}\n                      ORDER BY path_string";
         $db = eZDB::instance();
         $nodesListArray = $db->arrayQuery($query);
     }
     if ($asObjects) {
         return eZContentObjectTreeNode::makeObjectsArray($nodesListArray);
     }
     return $nodesListArray;
 }
开发者ID:radca,项目名称:ezpublish,代码行数:18,代码来源:ezcontentobjecttreenode.php

示例2: 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;
 }
开发者ID:nlescure,项目名称:ezstarrating,代码行数:101,代码来源:ezsrratingobject.php

示例3: subTree

    function subTree( $params, $nodeID, $countChildren = false )
    {
        $nodeListArray = array();

        // sorting params
        $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $params['SortBy'] );

        // node params
        $notEqParentString = '';
        $pathStringCond    = '';
        eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings( $pathStringCond, $notEqParentString, $nodeID, 1, false );

        // class filter
        $classCondition = eZContentObjectTreeNode::createClassFilteringSQLString( $params['ClassFilterType'], $params['ClassFilterArray'] );
        if ( $classCondition === false )
        {
            return $nodeListArray;
        }

        // permissions
        $limitationParams = false;
        $limitationList = eZContentObjectTreeNode::getLimitationList( $limitationParams );

        if ( $limitationList === false )
        {
            return $nodeListArray;
        }

        $permissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );

        // version
        $useVersionName = true;
        $versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString( $useVersionName );
        $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString( $useVersionName );
        $versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString( $useVersionName );

        // invisible nodes.
        $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( false, $params['FetchHidden'] );

        $query = '';
        if ( $countChildren )
        {
            $query = "SELECT count(*) as count
                          FROM
                               ezcontentobject_tree,
                               ezcontentobject,ezcontentclass
                               $versionNameTables
                               $permissionChecking[from]
                          WHERE $pathStringCond
                                $classCondition
                                ezcontentclass.version=0 AND
                                $notEqParentString
                                ezcontentobject_tree.contentobject_id = ezcontentobject.id  AND
                                ezcontentclass.id = ezcontentobject.contentclass_id
                                $versionNameJoins
                                $permissionChecking[where] ";
        }
        else
        {
            $query = "SELECT ezcontentobject.*,
                             ezcontentobject_tree.*,
                             ezcontentclass.serialized_name_list as class_serialized_name_list,
                             ezcontentclass.identifier as class_identifier,
                             ezcontentclass.is_container as is_container
                             $versionNameTargets
                      FROM
                             ezcontentobject_tree,
                             ezcontentobject,ezcontentclass
                             $versionNameTables
                             $sortingInfo[attributeFromSQL]
                             $permissionChecking[from]
                      WHERE
                             $pathStringCond
                             $sortingInfo[attributeWhereSQL]
                             ezcontentclass.version=0 AND
                             $notEqParentString
                             ezcontentobject_tree.contentobject_id = ezcontentobject.id  AND
                             ezcontentclass.id = ezcontentobject.contentclass_id AND
                             $classCondition
                             ezcontentobject_tree.contentobject_is_published = 1
                             $versionNameJoins
                             $showInvisibleNodesCond
                             $permissionChecking[where]
                      ORDER BY $sortingInfo[sortingFields]";

        }

        $db = eZDB::instance();
        $nodeListArray = $db->arrayQuery( $query );

        // cleanup temp tables
        $db->dropTempTableList( $permissionChecking['temp_tables'] );

        if ( $countChildren )
        {
            return $nodeListArray[0]['count'];
        }
        else
        {
            foreach ( $nodeListArray as $key => $row )
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezcontentstructuretreeoperator.php

示例4: trashList

 static function trashList($params = false, $asCount = false)
 {
     if ($params === false) {
         $params = array('Offset' => false, 'Limit' => false, 'SortBy' => false, 'AttributeFilter' => false);
     }
     $offset = isset($params['Offset']) && is_numeric($params['Offset']) ? $params['Offset'] : false;
     $limit = isset($params['Limit']) && is_numeric($params['Limit']) ? $params['Limit'] : false;
     $asObject = isset($params['AsObject']) ? $params['AsObject'] : true;
     $objectNameFilter = isset($params['ObjectNameFilter']) ? $params['ObjectNameFilter'] : false;
     $sortBy = isset($params['SortBy']) && is_array($params['SortBy']) ? $params['SortBy'] : array(array('name'));
     if ($asCount) {
         $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings(false);
     } else {
         $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($sortBy, 'ezcot');
     }
     $attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($params['AttributeFilter'], $sortingInfo);
     if ($attributeFilter === false) {
         return null;
     }
     $useVersionName = true;
     $versionNameTables = eZContentObjectTreeNode::createVersionNameTablesSQLString($useVersionName);
     $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString($useVersionName);
     $versionNameJoins = eZContentObjectTreeNode::createVersionNameJoinsSQLString($useVersionName, false, false, false, 'ezcot');
     $languageFilter = ' AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
     $objectNameFilterSQL = eZContentObjectTreeNode::createObjectNameFilterConditionSQLString($objectNameFilter);
     $limitation = isset($params['Limitation']) && is_array($params['Limitation']) ? $params['Limitation'] : false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList, 'ezcontentobject_trash', 'ezcot');
     if ($asCount) {
         $query = "SELECT count(*) as count ";
     } else {
         $query = "SELECT\n                        ezcontentobject.*,\n                        ezcot.*,\n                        ezcontentclass.serialized_name_list as class_serialized_name_list,\n                        ezcontentclass.identifier as class_identifier\n                        {$versionNameTargets}\n                        {$sortingInfo['attributeTargetSQL']} ";
     }
     $query .= "FROM\n                        ezcontentobject_trash ezcot,\n                        ezcontentobject,\n                        ezcontentclass\n                        {$versionNameTables}\n                        {$sortingInfo['attributeFromSQL']}\n                        {$attributeFilter['from']}\n                        {$sqlPermissionChecking['from']}\n                   WHERE\n                        ezcontentclass.version=0 AND\n                        ezcot.contentobject_id = ezcontentobject.id  AND\n                        ezcontentclass.id = ezcontentobject.contentclass_id AND\n                        {$sortingInfo['attributeWhereSQL']}\n                        {$attributeFilter['where']}\n                        {$versionNameJoins}\n                        {$sqlPermissionChecking['where']}\n                        {$objectNameFilterSQL}\n                        {$languageFilter}\n                        ";
     if (!$asCount && $sortingInfo['sortingFields'] && strlen($sortingInfo['sortingFields']) > 5) {
         $query .= " ORDER BY {$sortingInfo['sortingFields']}";
     }
     $db = eZDB::instance();
     if (!$offset && !$limit) {
         $trashRowsArray = $db->arrayQuery($query);
     } else {
         $trashRowsArray = $db->arrayQuery($query, array('offset' => $offset, 'limit' => $limit));
     }
     // cleanup temp tables
     $db->dropTempTableList($sqlPermissionChecking['temp_tables']);
     if ($asCount) {
         return $trashRowsArray[0]['count'];
     } else {
         if ($asObject) {
             $retTrashNodes = array();
             foreach (array_keys($trashRowsArray) as $key) {
                 $trashRow =& $trashRowsArray[$key];
                 $retTrashNodes[] = new eZContentObjectTrashNode($trashRow);
             }
             return $retTrashNodes;
         } else {
             return $trashRowsArray;
         }
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:60,代码来源:ezcontentobjecttrashnode.php


注:本文中的eZContentObjectTreeNode::createVersionNameTargetsSQLString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。