本文整理汇总了PHP中eZContentObject::fetchFilteredList方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fetchFilteredList方法的具体用法?PHP eZContentObject::fetchFilteredList怎么用?PHP eZContentObject::fetchFilteredList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fetchFilteredList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
switch ($operatorName) {
// note: these functions are not cache-block safe
// as in: if called inside a cache-block then they will not be called when cache is used.
case 'ezpagedata_set':
case 'ezpagedata_append':
self::setPersistentVariable($namedParameters['key'], $namedParameters['value'], $tpl, $operatorName === 'ezpagedata_append');
break;
case 'ezpagedata':
$currentNodeId = 0;
$pageData = array();
$parameters = $namedParameters['params'];
// Get module_result for later use
if ($tpl->hasVariable('module_result')) {
$moduleResult = $tpl->variable('module_result');
} else {
$moduleResult = array();
}
if (isset($moduleResult['content_info'])) {
$contentInfo = $moduleResult['content_info'];
} else {
$contentInfo = array();
}
// Get persistent_variable
if (isset($contentInfo['persistent_variable']) && is_array($contentInfo['persistent_variable'])) {
$pageData['persistent_variable'] = $contentInfo['persistent_variable'];
} else {
$pageData['persistent_variable'] = self::getPersistentVariable();
if ($pageData['persistent_variable'] === null) {
$pageData['persistent_variable'] = array();
}
}
// Merge parameters with persistent_variable
$parameters = array_merge($parameters, $pageData['persistent_variable']);
// Figgure out current node id
if (isset($parameters['current_node_id'])) {
$currentNodeId = (int) $parameters['current_node_id'];
// Allow parameters to set current path
if (isset($parameters['set_current_node_path']) && $parameters['set_current_node_path']) {
if ($setPath = self::getNodePath($currentNodeId)) {
$moduleResult['path'] = $setPath['path'];
$moduleResult['title_path'] = $setPath['title_path'];
$tpl->setVariable('module_result', $moduleResult);
} else {
eZDebug::writeWarning("Could not fetch 'current_node_id'", 'eZPageData::getNodePath()');
}
}
} else {
if ($tpl->hasVariable('current_node_id')) {
$currentNodeId = (int) $tpl->variable('current_node_id');
} else {
if (isset($moduleResult['node_id'])) {
$currentNodeId = (int) $moduleResult['node_id'];
} else {
if (isset($moduleResult['path'], $moduleResult['path'][count($moduleResult['path']) - 1]['node_id'])) {
$currentNodeId = (int) $moduleResult['path'][count($moduleResult['path']) - 1]['node_id'];
}
}
}
}
// Init variables and return values
$ini = eZINI::instance('site.ini');
$menuIni = eZINI::instance('menu.ini');
$contentIni = eZINI::instance('content.ini');
$uiContext = $tpl->variable('ui_context');
$uriString = $tpl->variable('uri_string');
$pageDepth = isset($moduleResult['path']) ? count($moduleResult['path']) : 0;
$pageData['main_node_id'] = isset($contentInfo['main_node_id']) ? $contentInfo['main_node_id'] : $currentNodeId;
$pageData['show_path'] = 'path';
$pageData['website_toolbar'] = false;
$pageData['node_id'] = $currentNodeId;
$pageData['is_edit'] = false;
$pageData['page_root_depth'] = 0;
$pageData['page_depth'] = $pageDepth;
$pageData['root_node'] = (int) $contentIni->variable('NodeSettings', 'RootNode');
$pageData['canonical_url'] = false;
$pageData['canonical_language_url'] = false;
// is_edit if not on user/edit and not on content/action when
// you get info collector warning about missing attributes
if ($uiContext === 'edit' && strpos($uriString, 'user/edit') === false && (empty($contentInfo) || strpos($uriString, 'content/action') === false)) {
$pageData['is_edit'] = true;
}
if (isset($contentInfo['viewmode'])) {
$viewMode = $contentInfo['viewmode'];
} else {
$viewMode = '';
}
// Get custom template_look object. false|eZContentObject (set as parameter from caller)
if (isset($parameters['template_look'])) {
$pageData['template_look'] = $parameters['template_look'];
} else {
// Get template_look eZContentObject
if (!isset($parameters['template_look_class'])) {
$parameters['template_look_class'] = 'template_look';
}
$templateLookClassID = eZContentObjectTreeNode::classIDByIdentifier($parameters['template_look_class']);
$templateLookObjectList = eZContentObject::fetchFilteredList(array('contentclass_id' => $templateLookClassID), 0, 1);
if ($templateLookObjectList) {
$pageData['template_look'] = $templateLookObjectList[0];
//.........这里部分代码省略.........
示例2: fetchSameClassList
/**
* Returns an array of content objects with the content class id $contentClassID
*
* @param int $contentClassID
* @param bool $asObject Whether to return objects or not
* @param int|bool $offset Where to start fetch from, set to false to skip it.
* @param int|bool $limit Maximum number of objects to fetch, set false to skip it.
* @return eZContentObject[]|array|null
*/
static function fetchSameClassList( $contentClassID, $asObject = true, $offset = false, $limit = false )
{
$conditions = array( 'contentclass_id' => $contentClassID );
return eZContentObject::fetchFilteredList( $conditions, $offset, $limit, $asObject );
}
示例3: sleep
}
$cli->warning("This script will NOT republish objects, but rather update the CURRENT");
$cli->warning("version of published objects. If you do not wish to do that, you have");
$cli->warning("15 seconds to cancel the script! (press Ctrl-C)\n");
sleep(15);
$sourceClassAttributeIdentifier = $sourceClassAttribute->attribute('identifier');
$destClassAttributeIdentifier = $destClassAttribute->attribute('identifier');
$isDestClassAttributeTranslatable = (bool) $destClassAttribute->attribute('can_translate');
$adminUser = eZUser::fetchByName('admin');
$adminUser->loginCurrent();
$db = eZDB::instance();
$offset = 0;
$limit = 50;
$objectCount = eZPersistentObject::count(eZContentObject::definition(), array('contentclass_id' => $sourceClassAttribute->attribute('contentclass_id'), 'status' => eZContentObject::STATUS_PUBLISHED));
while ($offset < $objectCount) {
$objects = eZContentObject::fetchFilteredList(array('contentclass_id' => $sourceClassAttribute->attribute('contentclass_id'), 'status' => eZContentObject::STATUS_PUBLISHED), $offset, $limit);
foreach ($objects as $object) {
foreach ($object->availableLanguages() as $languageCode) {
$object->fetchDataMap(false, $languageCode);
}
if (isset($object->DataMap[$object->attribute('current_version')])) {
$db->begin();
$languageDataMap = $object->DataMap[$object->attribute('current_version')];
$initialLanguageCode = $object->initialLanguageCode();
// first convert the initial (main) language
$objectAttributes = $languageDataMap[$initialLanguageCode];
if (isset($objectAttributes[$sourceClassAttributeIdentifier]) && isset($objectAttributes[$destClassAttributeIdentifier])) {
$sourceObjectAttribute = $objectAttributes[$sourceClassAttributeIdentifier];
$destObjectAttribute = $objectAttributes[$destClassAttributeIdentifier];
if ($sourceObjectAttribute->hasContent()) {
$keywordArray = $sourceObjectAttribute->content()->keywordArray();