本文整理汇总了PHP中eZContentObjectStateGroup::fetchByIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectStateGroup::fetchByIdentifier方法的具体用法?PHP eZContentObjectStateGroup::fetchByIdentifier怎么用?PHP eZContentObjectStateGroup::fetchByIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectStateGroup
的用法示例。
在下文中一共展示了eZContentObjectStateGroup::fetchByIdentifier方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setParameters
function setParameters($parm_array)
{
// Make sure no unsupported parameters are specified
$supported_parameters = array('state_group', 'state');
$parm_keys = array_keys($parm_array);
$unsupported_list = array_diff($parm_keys, $supported_parameters);
if (isset($unsupported_list[0])) {
return "Unsupported parameter '{$unsupported_list[0]}' in operation";
}
// Fetch state id's from the identifiers
$state_group = eZContentObjectStateGroup::fetchByIdentifier($parm_array['state_group']);
if ($state_group === false) {
return 'Missing or illegal state group identifier';
}
$state_group_id = $state_group->attribute('id');
$state = eZContentObjectState::fetchByIdentifier($parm_array['state'], $state_group_id);
if ($state === false) {
return 'Missing or illegal state identifier';
}
$this->state_id = $state->attribute('id');
return true;
}
示例2: array
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2012.8
* @package kernel
*/
$Module = $Params['Module'];
$GroupIdentifier = $Params['GroupIdentifier'];
$StateIdentifier = $Params['StateIdentifier'];
$LanguageCode = $Params['Language'];
$group = eZContentObjectStateGroup::fetchByIdentifier($GroupIdentifier);
if (!is_object($group)) {
return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
$state = $group->stateByIdentifier($StateIdentifier);
if (!is_object($state)) {
return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
$currentAction = $Module->currentAction();
if ($currentAction == 'Edit') {
return $Module->redirectTo("state/edit/{$GroupIdentifier}/{$StateIdentifier}");
}
if ($LanguageCode) {
$state->setCurrentLanguage($LanguageCode);
}
$tpl = eZTemplate::factory();
$tpl->setVariable('group', $group);
$tpl->setVariable('state', $state);
$Result = array('content' => $tpl->fetch('design:state/view.tpl'), 'path' => array(array('url' => false, 'text' => ezpI18n::tr('kernel/state', 'State')), array('url' => 'state/group/' . $group->attribute('identifier'), 'text' => $group->attribute('identifier')), array('url' => false, 'text' => $state->attribute('identifier'))));
示例3: eZContentObjectStateGroup
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2012.6
* @package kernel
*/
$GroupIdentifier = $Params['GroupIdentifier'];
$Module = $Params['Module'];
$group = $GroupIdentifier === null ? new eZContentObjectStateGroup() : eZContentObjectStateGroup::fetchByIdentifier($GroupIdentifier);
if (!is_object($group)) {
return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
if ($group->isInternal()) {
return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
$tpl = eZTemplate::factory();
$currentAction = $Module->currentAction();
if ($currentAction == 'Cancel') {
return $Module->redirectTo('state/groups');
} else {
if ($currentAction == 'Store') {
$group->fetchHTTPPersistentVariables();
$messages = array();
$isValid = $group->isValid($messages);
if ($isValid) {
$group->store();
if ($GroupIdentifier === null) {
return $Module->redirectTo('state/group/' . $group->attribute('identifier'));
} else {
示例4: createSortingSQLStrings
//.........这里部分代码省略.........
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';
break;
}
$datatypeSortingFieldSQL = "a{$attributeJoinCount}.{$sortKey}";
$datatypeSortingTargetSQL .= ', ' . $datatypeSortingFieldSQL;
}
$sortingFields .= "{$datatypeSortingFieldSQL}";
$attributeFromSQL .= " INNER JOIN {$datatypeFromSQL} ON ({$datatypeWhereSQL})";
$attributeJoinCount++;
break;
case 'state':
$stateGroupID = $sortBy[2];
if (!is_numeric($stateGroupID)) {
$stateGroup = eZContentObjectStateGroup::fetchByIdentifier($stateGroupID);
if ($stateGroup) {
$stateGroupID = $stateGroup->attribute('id');
} else {
eZDebug::writeError("Unknown content object state group '{$stateGroupID}'");
continue 2;
}
}
$stateAlias = "s{$stateJoinCount}";
$stateLinkAlias = "sl{$stateJoinCount}";
$sortingFields .= "{$stateAlias}.priority";
$datatypeSortingTargetSQL .= ", {$stateAlias}.priority";
$attributeFromSQL .= " INNER JOIN ezcobj_state {$stateAlias} ON ({$stateAlias}.group_id = {$stateGroupID})" . " INNER JOIN ezcobj_state_link {$stateLinkAlias}" . " ON ({$stateLinkAlias}.contentobject_id = ezcontentobject.id AND {$stateLinkAlias}.contentobject_state_id = {$stateAlias}.id)";
break;
default:
if ($allowCustomColumns) {
$sortingFields .= $sortField;
} else {
eZDebug::writeWarning('Unknown sort field: ' . $sortField, __METHOD__);
continue;
}
}
$sortOrder = true;
// true is ascending
if (isset($sortBy[1])) {
$sortOrder = $sortBy[1];
}
$sortingFields .= $sortOrder ? " ASC" : " DESC";
++$sortCount;
}
}
$sortingInfo['sortCount'] = $sortCount;
$sortingInfo['sortingFields'] = $sortingFields;
$sortingInfo['attributeTargetSQL'] = $datatypeSortingTargetSQL;
$sortingInfo['attributeJoinCount'] = $attributeJoinCount;
$sortingInfo['attributeFromSQL'] = $attributeFromSQL;
$sortingInfo['attributeWhereSQL'] = $attributeWhereSQL;
} else {
if ($sortList === array()) {
$sortingInfo['sortingFields'] = '';
}
}
return $sortingInfo;
}
示例5: array
$scriptSettings = array();
$scriptSettings['description'] = 'Add the ez_lock system state group';
$scriptSettings['use-session'] = true;
$scriptSettings['use-modules'] = true;
$scriptSettings['use-extensions'] = true;
$script = eZScript::instance($scriptSettings);
$script->startup();
$config = '';
$argumentConfig = '';
$optionHelp = false;
$arguments = false;
$useStandardOptions = true;
$options = $script->getOptions($config, $argumentConfig, $optionHelp, $arguments, $useStandardOptions);
$script->initialize();
eZContentObjectStateGroup::$allowInternalCUD = true;
$lockGroup = eZContentObjectStateGroup::fetchByIdentifier('ez_lock');
if ($lockGroup) {
$script->shutdown(1, 'ez_lock state group already exists');
}
$db = eZDB::instance();
$db->begin();
$locales = eZContentLanguage::fetchLocaleList();
$localeToUse = false;
$localeIDToUse = false;
// this script inserts English names, so preferably use an English locale
$preferredLocales = array('eng-GB', 'eng-US');
foreach ($preferredLocales as $preferredLocale) {
if (in_array($preferredLocale, $locales)) {
$localeToUse = $preferredLocale;
break;
}