本文整理汇总了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;
}
示例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);
}
示例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;
}