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


PHP eZContentObjectTreeNode::sortKeyByClassAttributeID方法代码示例

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


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

示例1: buildSortSQL

 function buildSortSQL($sortArray)
 {
     $sortCount = 0;
     $sortList = false;
     if (isset($sortArray) and is_array($sortArray) and count($sortArray) > 0) {
         $sortList = $sortArray;
         if (count($sortList) > 1 and !is_array($sortList[0])) {
             $sortList = array($sortList);
         }
     }
     $attributeJoinCount = 0;
     $attributeFromSQL = "";
     $attributeWereSQL = "";
     $selectSQL = '';
     if ($sortList !== false) {
         $sortingFields = '';
         foreach ($sortList as $sortBy) {
             if (is_array($sortBy) and count($sortBy) > 0) {
                 if ($sortCount > 0) {
                     $sortingFields .= ', ';
                 }
                 $sortField = $sortBy[0];
                 switch ($sortField) {
                     case 'path':
                         $sortingFields .= 'path_string';
                         break;
                     case 'published':
                         $sortingFields .= 'ezcontentobject.published';
                         break;
                     case 'modified':
                         $sortingFields .= 'ezcontentobject.modified';
                         break;
                     case 'section':
                         $sortingFields .= 'ezcontentobject.section_id';
                         break;
                     case 'depth':
                         $sortingFields .= 'depth';
                         break;
                     case 'class_identifier':
                         $sortingFields .= 'ezcontentclass.identifier';
                         $selectSQL .= ', ezcontentclass.identifier';
                         break;
                     case 'class_name':
                         $classNameFilter = eZContentClassName::sqlFilter();
                         $selectSQL .= ", " . $classNameFilter['nameField'] . " AS class_name";
                         $sortingFields .= "class_name";
                         $attributeFromSQL .= " INNER JOIN {$classNameFilter['from']} ON ({$classNameFilter['where']})";
                         break;
                     case 'priority':
                         $sortingFields .= 'ezcontentobject_tree.priority';
                         break;
                     case 'name':
                         $sortingFields .= 'ezcontentobject_name.name';
                         break;
                     case 'attribute':
                         $sortClassID = $sortBy[2];
                         // Look up datatype for sorting
                         if (!is_numeric($sortClassID)) {
                             $sortClassID = eZContentObjectTreeNode::classAttributeIDByIdentifier($sortClassID);
                         }
                         $sortDataType = $sortClassID === false ? false : eZContentObjectTreeNode::sortKeyByClassAttributeID($sortClassID);
                         $sortKey = false;
                         if ($sortDataType == 'string') {
                             $sortKey = 'sort_key_string';
                         } else {
                             $sortKey = 'sort_key_int';
                         }
                         $sortingFields .= "a{$attributeJoinCount}.{$sortKey}";
                         $attributeFromSQL .= " INNER JOIN ezcontentobject_attribute as a{$attributeJoinCount} ON (a{$attributeJoinCount}.contentobject_id = ezcontentobject.id AND a{$attributeJoinCount}.version = ezcontentobject_name.content_version)";
                         $attributeWereSQL .= " AND a{$attributeJoinCount}.contentclassattribute_id = {$sortClassID}";
                         $selectSQL .= ", a{$attributeJoinCount}.{$sortKey}";
                         $attributeJoinCount++;
                         break;
                     default:
                         eZDebug::writeWarning('Unknown sort field: ' . $sortField, __METHOD__);
                         continue;
                 }
                 $sortOrder = true;
                 // true is ascending
                 if (isset($sortBy[1])) {
                     $sortOrder = $sortBy[1];
                 }
                 $sortingFields .= $sortOrder ? " ASC" : " DESC";
                 ++$sortCount;
             }
         }
     }
     // Should we sort?
     if ($sortCount == 0) {
         $sortingFields = " ezcontentobject.published ASC";
     }
     return array('sortingFields' => $sortingFields, 'selectSQL' => $selectSQL, 'fromSQL' => $attributeFromSQL, 'whereSQL' => $attributeWereSQL);
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:93,代码来源:ezsearchengine.php

示例2: createAttributeFilterSQLStrings


//.........这里部分代码省略.........
                         $filterSQL['from'] .= " INNER JOIN {$classNameFilter['from']} ON ({$classNameFilter['where']})";
                         break;
                     case 'priority':
                         $filterField = 'ezcontentobject_tree.priority';
                         break;
                     case 'name':
                         $filterField = 'ezcontentobject_name.name';
                         break;
                     case 'owner':
                         $filterField = 'ezcontentobject.owner_id';
                         break;
                     case 'visibility':
                         $filterValue = $filterValue == '1' ? 0 : 1;
                         $filterField = 'ezcontentobject_tree.is_invisible';
                         break;
                     default:
                         $useAttributeFilter = true;
                         break;
                 }
                 if ($useAttributeFilter) {
                     if (!is_numeric($filterAttributeID)) {
                         $filterAttributeID = eZContentObjectTreeNode::classAttributeIDByIdentifier($filterAttributeID);
                     }
                     if ($filterAttributeID === false) {
                         $isFilterValid = false;
                         if ($filterJoinType === 'AND') {
                             // go out
                             $invalidAttributesFiltersCount = $totalAttributesFiltersCount;
                             break;
                         }
                         ++$invalidAttributesFiltersCount;
                     } else {
                         // Check datatype for filtering
                         $filterDataType = eZContentObjectTreeNode::sortKeyByClassAttributeID($filterAttributeID);
                         if ($filterDataType === false) {
                             $isFilterValid = false;
                             if ($filterJoinType === 'AND') {
                                 // go out
                                 $invalidAttributesFiltersCount = $totalAttributesFiltersCount;
                                 break;
                             }
                             // check next filter
                             ++$invalidAttributesFiltersCount;
                         } else {
                             $sortKey = false;
                             if ($filterDataType == 'string') {
                                 $sortKey = 'sort_key_string';
                             } else {
                                 $sortKey = 'sort_key_int';
                             }
                             $filterField = "a{$filterCount}.{$sortKey}";
                             // Use the same joins as we do when sorting,
                             // if more attributes are filtered by we will append them
                             if ($filterCount >= $sortingInfo['attributeJoinCount']) {
                                 $filterSQL['from'] .= " INNER JOIN ezcontentobject_attribute a{$filterCount} ON (a{$filterCount}.contentobject_id = ezcontentobject.id) ";
                             }
                             // Ref http://issues.ez.no/19190
                             // If language param is set, we must take it into account.
                             if ($language) {
                                 eZContentLanguage::setPrioritizedLanguages($language);
                             }
                             $filterSQL['where'] .= "\n                                  a{$filterCount}.contentobject_id = ezcontentobject.id AND\n                                  a{$filterCount}.contentclassattribute_id = {$filterAttributeID} AND\n                                  a{$filterCount}.version = ezcontentobject_name.content_version AND ";
                             $filterSQL['where'] .= eZContentLanguage::sqlFilter("a{$filterCount}", 'ezcontentobject') . ' AND ';
                             if ($language) {
                                 eZContentLanguage::clearPrioritizedLanguages();
                             }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:67,代码来源:ezcontentobjecttreenode.php


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