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


PHP eZContentClass::canInstantiateClassList方法代码示例

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


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

示例1: getClassesJsArray

 /**
  * Returns available classes as a JSON string
  *
  * @param eZContentObjectTreeNode|bool $node
  * @param array|bool $includeFilter
  * @param array|bool $groupList
  * @param int|bool $fetchID
  * @param array|bool $classes
  * @return string
  */
 static function getClassesJsArray($node = false, $includeFilter = true, $groupList = false, $fetchID = false, $classes = false)
 {
     $falseValue = "''";
     // If $classes is false we should check $node and fetch class list
     if ($classes === false) {
         // If $node is object we should fetch available classes from node, from ezcontentclass otherwise
         $classes = $node instanceof eZContentObjectTreeNode ? $node->canCreateClassList(false, $includeFilter, $groupList, $fetchID) : eZContentClass::canInstantiateClassList(false, $includeFilter, $groupList, $fetchID);
     }
     if (!is_array($classes)) {
         return $falseValue;
     }
     // Create javascript array
     $classList = array();
     foreach ($classes as $class) {
         if ($class instanceof eZContentClass) {
             $classID = $class->attribute('id');
             $className = $class->attribute('name');
         } elseif (is_array($class)) {
             $classID = $class['id'];
             $className = $class['name'];
         }
         $classList[] = array('classID' => (int) $classID, 'name' => $className);
     }
     if ($classList) {
         return json_encode($classList);
     }
     return $falseValue;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:38,代码来源:ezcontentobjecttreenode.php

示例2: canInstantiateClassList

 public static function canInstantiateClassList($groupID, $parentNode, $filterType = 'include', $fetchID, $asObject, $groupByClassGroup = false)
 {
     $ClassGroupIDs = false;
     if (is_numeric($groupID) && $groupID > 0) {
         $ClassGroupIDs = array($groupID);
     } else {
         if (is_array($groupID)) {
             $ClassGroupIDs = $groupID;
         }
     }
     if (is_numeric($parentNode)) {
         $parentNode = eZContentObjectTreeNode::fetch($parentNode);
     }
     if (is_object($parentNode)) {
         $classList = $parentNode->canCreateClassList($asObject, $filterType == 'include', $ClassGroupIDs, $fetchID);
     } else {
         $classList = eZContentClass::canInstantiateClassList($asObject, $filterType == 'include', $ClassGroupIDs, $fetchID);
     }
     if ($groupByClassGroup && $asObject) {
         $tmpClassList = array();
         $ini = eZINI::instance('content.ini');
         foreach ($classList as $class) {
             foreach ($class->fetchGroupList() as $group) {
                 $groupID = $group->attribute('group_id');
                 if (!in_array($class->attribute('identifier'), $ini->variable('FetchFunctionSettings', 'InstClassListFilter'))) {
                     if (isset($tmpClassList[$groupID])) {
                         $tmpClassList[$groupID]['items'][] = $class;
                     } else {
                         $tmpClassList[$groupID]['items'] = array($class);
                         $tmpClassList[$groupID]['group_name'] = $group->attribute('group_name');
                     }
                 }
             }
         }
         $classList = $tmpClassList;
     }
     return array('result' => $classList);
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:38,代码来源:ezcontentfunctioncollection.php

示例3: getClassesJsArray

 static function getClassesJsArray($node = false, $includeFilter = true, $groupList = false, $fetchID = false, $classes = false)
 {
     $falseValue = "''";
     // If $classes is false we should check $node and fetch class list
     if ($classes === false) {
         // If $node is object we should fetch available classes from node, from ezcontentclass otherwise
         $classes = (is_object($node) and strtolower(get_class($node)) == 'ezcontentobjecttreenode') ? $node->canCreateClassList(false, $includeFilter, $groupList, $fetchID) : eZContentClass::canInstantiateClassList(false, $includeFilter, $groupList, $fetchID);
     }
     if (!is_array($classes)) {
         return $falseValue;
     }
     // Create javascript array
     $jsArray = array();
     $db = eZDB::instance();
     foreach ($classes as $class) {
         if (is_object($class)) {
             $classID = $class->attribute('id');
             $className = $class->attribute('name');
         } elseif (is_array($class)) {
             $classID = $class['id'];
             $className = $class['name'];
         }
         $jsArray[] = "{ classID: '" . $db->escapeString($classID) . "', name: '" . $db->escapeString($className) . "' }";
     }
     if ($jsArray) {
         return '[ ' . implode(', ', $jsArray) . ' ]';
     }
     return $falseValue;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:29,代码来源:ezcontentobjecttreenode.php


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