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


PHP eZContentObjectTreeNode::dataTypeByClassAttributeID方法代码示例

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


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

示例1: createSortingSQLStrings

 /**
  * Creates an array with sorting SQL strings to be appended to a query
  *
  * @param array|bool $sortList
  * @param string $treeTableName
  * @param bool $allowCustomColumns
  * @return array
  */
 static function createSortingSQLStrings($sortList, $treeTableName = 'ezcontentobject_tree', $allowCustomColumns = false)
 {
     $sortingInfo = array('sortCount' => 0, 'sortingFields' => " path_string ASC", 'attributeJoinCount' => 0, 'attributeFromSQL' => "", 'attributeTargetSQL' => "", 'attributeWhereSQL' => "");
     if ($sortList and is_array($sortList) and count($sortList) > 0) {
         if (count($sortList) > 1 and !is_array($sortList[0])) {
             $sortList = array($sortList);
         }
         $sortingFields = '';
         $sortCount = 0;
         $attributeJoinCount = 0;
         $stateJoinCount = 0;
         $attributeFromSQL = "";
         $attributeWhereSQL = "";
         $datatypeSortingTargetSQL = "";
         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 'path_string':
                         $sortingFields .= 'path_identification_string';
                         break;
                     case 'published':
                         $sortingFields .= 'ezcontentobject.published';
                         break;
                     case 'modified':
                         $sortingFields .= 'ezcontentobject.modified';
                         break;
                     case 'modified_subnode':
                         $sortingFields .= 'modified_subnode';
                         break;
                     case 'section':
                         $sortingFields .= 'ezcontentobject.section_id';
                         break;
                     case 'node_id':
                         $sortingFields .= $treeTableName . '.node_id';
                         break;
                     case 'contentobject_id':
                         $sortingFields .= 'ezcontentobject.id';
                         break;
                     case 'depth':
                         $sortingFields .= 'depth';
                         break;
                     case 'class_identifier':
                         $sortingFields .= 'ezcontentclass.identifier';
                         break;
                     case 'class_name':
                         $classNameFilter = eZContentClassName::sqlFilter();
                         $sortingFields .= 'contentclass_name';
                         $datatypeSortingTargetSQL .= ", {$classNameFilter['nameField']} AS contentclass_name";
                         $attributeFromSQL .= " INNER JOIN {$classNameFilter['from']} ON ({$classNameFilter['where']})";
                         break;
                     case 'priority':
                         $sortingFields .= $treeTableName . '.priority';
                         break;
                     case 'name':
                         $sortingFields .= 'ezcontentobject_name.name';
                         break;
                     case 'attribute':
                         $classAttributeID = $sortBy[2];
                         if (!is_numeric($classAttributeID)) {
                             $classAttributeID = eZContentObjectTreeNode::classAttributeIDByIdentifier($classAttributeID);
                         }
                         $contentAttributeTableAlias = "a{$attributeJoinCount}";
                         $datatypeFromSQL = "ezcontentobject_attribute {$contentAttributeTableAlias}";
                         $datatypeWhereSQL = "\n                                   {$contentAttributeTableAlias}.contentobject_id = ezcontentobject.id AND\n                                   {$contentAttributeTableAlias}.contentclassattribute_id = {$classAttributeID} AND\n                                   {$contentAttributeTableAlias}.version = ezcontentobject.current_version AND";
                         $datatypeWhereSQL .= eZContentLanguage::sqlFilter($contentAttributeTableAlias, 'ezcontentobject');
                         $dataType = eZDataType::create(eZContentObjectTreeNode::dataTypeByClassAttributeID($classAttributeID));
                         if (is_object($dataType) && $dataType->customSorting()) {
                             $params = array();
                             $params['contentobject_attr_id'] = "{$contentAttributeTableAlias}.id";
                             $params['contentobject_attr_version'] = "{$contentAttributeTableAlias}.version";
                             $params['table_alias_suffix'] = "{$attributeJoinCount}";
                             $sql = $dataType->customSortingSQL($params);
                             $datatypeFromSQL .= " INNER JOIN {$sql['from']} ON ({$sql['where']})";
                             $datatypeSortingFieldSQL = $sql['sorting_field'];
                             $datatypeSortingTargetSQL .= ', ' . $sql['sorting_field'];
                         } else {
                             // Look up datatype for standard sorting
                             $sortKeyType = eZContentObjectTreeNode::sortKeyByClassAttributeID($classAttributeID);
                             switch ($sortKeyType) {
                                 case 'string':
                                     $sortKey = 'sort_key_string';
                                     break;
                                 case 'int':
                                 default:
                                     $sortKey = 'sort_key_int';
//.........这里部分代码省略.........
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:101,代码来源:ezcontentobjecttreenode.php


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