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


PHP eZContentClass::fetchAllClasses方法代码示例

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


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

示例1: availableClassListJsArray

 /**
  * Returns available classes as Js array.
  * Checks for ini settings.
  *
  * @param array|bool $parameters
  * @return string
  */
 static function availableClassListJsArray($parameters = false)
 {
     $iniMenu = eZINI::instance('contentstructuremenu.ini');
     $falseValue = "''";
     if ($iniMenu->hasVariable('TreeMenu', 'CreateHereMenu')) {
         $createHereMenu = $iniMenu->variable('TreeMenu', 'CreateHereMenu');
     } else {
         $createHereMenu = 'simplified';
     }
     if ($createHereMenu != 'simplified' and $createHereMenu != 'full') {
         return $falseValue;
     }
     $ini = eZINI::instance('content.ini');
     list($usersClassGroupID, $setupClassGroupID) = $ini->variableMulti('ClassGroupIDs', array('Users', 'Setup'));
     $userRootNode = $ini->variable('NodeSettings', 'UserRootNode');
     $groupIDs = false;
     $filterType = 'include';
     if (!is_array($parameters)) {
         return $falseValue;
     }
     $node = isset($parameters['node']) ? $parameters['node'] : false;
     if (is_object($node)) {
         if ($createHereMenu == 'full' and !$node->canCreate()) {
             return $falseValue;
         }
         $obj = $node->object();
         $contentClass = $obj->attribute('content_class');
         if (!$contentClass->attribute('is_container')) {
             return $falseValue;
         }
         $pathArray = $node->pathArray();
     } else {
         // If current object is not container we should not return class list, should not display "create here" menu.
         if (isset($parameters['is_container']) and !$parameters['is_container']) {
             return $falseValue;
         }
         // Check if current user can create under this node
         if ($createHereMenu == 'full' and isset($parameters['node_id'])) {
             $node = eZContentObjectTreeNode::fetch($parameters['node_id']);
             if (is_object($node) and !$node->canCreate()) {
                 return $falseValue;
             }
         }
         $pathString = isset($parameters['path_string']) ? $parameters['path_string'] : false;
         if (!$pathString) {
             return $falseValue;
         }
         $pathItems = explode('/', $pathString);
         $pathArray = array();
         foreach ($pathItems as $pathItem) {
             if ($pathItem != '') {
                 $pathArray[] = (int) $pathItem;
             }
         }
     }
     if (in_array($userRootNode, $pathArray)) {
         $groupIDs = array($usersClassGroupID);
     } else {
         $groupIDs = array($usersClassGroupID, $setupClassGroupID);
         $filterType = 'exclude';
     }
     if ($createHereMenu == 'simplified') {
         $classes = eZContentClass::fetchAllClasses(false, $filterType == 'include', $groupIDs);
         return eZContentObjectTreeNode::getClassesJsArray(false, $filterType == 'include', $groupIDs, false, $classes);
     }
     return eZContentObjectTreeNode::getClassesJsArray($node, $filterType == 'include', $groupIDs);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:74,代码来源:ezcontentobjecttreenode.php

示例2: listAllAttributes

 private function listAllAttributes()
 {
     $attributeList = @eZContentClassAttribute::fetchList();
     $contentClassList = eZContentClass::fetchAllClasses(true, false, false);
     $classDictionary = array();
     foreach ($contentClassList as $classInfo) {
         $classId = $classInfo->ID;
         $classDictionary[$classInfo->ID] = $classInfo->Identifier;
     }
     $results = array();
     $results[] = array("ID", "Identifier", "Data Type", "Content Class ID", "Content class identifier");
     foreach ($attributeList as $attributeInfo) {
         $attributeId = $attributeInfo->ID;
         $ContentClassID = $attributeInfo->ContentClassID;
         $results[] = array($attributeId, $attributeInfo->Identifier, $attributeInfo->DataTypeString, $attributeInfo->ContentClassID, isset($classDictionary[$attributeInfo->ContentClassID]) ? $classDictionary[$attributeInfo->ContentClassID] : "Doesn't exist");
     }
     eep::printTable($results, "list all attributes");
 }
开发者ID:truffo,项目名称:eep,代码行数:18,代码来源:index.php

示例3: updateClass

if (isset($options['admin-user'])) {
    $adminUser = $options['admin-user'];
} else {
    $adminUser = 'admin';
}
$user = eZUser::fetchByName($adminUser);
if ($user) {
    eZUser::setCurrentlyLoggedInUser($user, $user->attribute('id'));
} else {
    $cli->error('Could not fetch admin user object');
    $script->shutdown(1);
    return;
}
// Take care of script monitoring
$scheduledScript = false;
if (isset($options['scriptid']) and in_array('ezscriptmonitor', eZExtension::activeExtensions()) and class_exists('eZScheduledScript')) {
    $scriptID = $options['scriptid'];
    $scheduledScript = eZScheduledScript::fetch($scriptID);
}
// Do the update
if (isset($options['classid'])) {
    updateClass($options['classid']);
} else {
    $cli->notice('The classid parameter was not given, will check all classes.');
    $classes = eZContentClass::fetchAllClasses(false);
    foreach ($classes as $class) {
        $cli->notice('Checking class ' . $class['id'] . ': ' . $class['name']);
        updateClass($class['id']);
    }
}
$script->shutdown();
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:addmissingobjectattributes.php

示例4: foreach

        foreach ($sourceClassesInfo as $identifier => $classInfo) {
            if (isset($compareOptions['class_ids']) && in_array(-1, $compareOptions['class_ids']) === false) {
                $class = eZContentClass::fetchByIdentifier($identifier, false);
                if (in_array($class['id'], $compareOptions['class_ids'], false) === false) {
                    continue;
                }
            }
            if (isset($currentClassesInfo[$identifier]) === false) {
                $diff[$identifier] = $classInfo;
            } elseif (serialize($classInfo['attributes']) != serialize($currentClassesInfo[$identifier]['attributes'])) {
                $diff[$identifier] = $classInfo;
            }
        }
    } else {
        $error = ezpI18n::tr('extension/nxc_content_class_diff', 'Could not fetch compare source or it does not contain any class definitions. Please update compare source.');
    }
}
$tpl = eZTemplate::factory();
$tpl->setVariable('classes', eZContentClass::fetchAllClasses(false));
$tpl->setVariable('compare', $compare);
$tpl->setVariable('compare_options', $compareOptions);
$tpl->setVariable('error', $error);
$tpl->setVariable('is_source_updated', $isSourceUpdated);
if ($compare) {
    $tpl->setVariable('current_classes_info', $currentClassesInfo);
    $tpl->setVariable('source_classes_info', $sourceClassesInfo);
    $tpl->setVariable('diff', $diff);
}
$Result = array();
$Result['content'] = $tpl->fetch('design:compare_classes.tpl');
$Result['path'] = array(array('text' => ezpI18n::tr('extension/nxc_content_class_diff', 'Compare content classes'), 'url' => false));
开发者ID:nxc,项目名称:nxc_content_class_diff,代码行数:31,代码来源:view.php


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