本文整理汇总了PHP中eZContentOperationCollection::updateObjectState方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentOperationCollection::updateObjectState方法的具体用法?PHP eZContentOperationCollection::updateObjectState怎么用?PHP eZContentOperationCollection::updateObjectState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentOperationCollection
的用法示例。
在下文中一共展示了eZContentOperationCollection::updateObjectState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($process, $event)
{
// get object being published
$parameters = $process->attribute('parameter_list');
$objectID = $parameters['object_id'];
eZDebug::writeDebug('Update object state for object: ' . $objectID);
$object = eZContentObject::fetch($objectID);
$state_before = $event->attribute('state_before');
$state_after = $event->attribute('state_after');
if ($object == null) {
eZDebug::writeError('Update object state failed for inexisting object: ' . $objectID, __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
if ($state_before == null || $state_after == null) {
eZDebug::writeError('Update object state failed: badly configured states', __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
$currentStateIDArray = $object->attribute('state_id_array');
if (in_array($state_before->attribute('id'), $currentStateIDArray)) {
$canAssignStateIDList = $object->attribute('allowed_assign_state_id_list');
if (!in_array($state_after->attribute('id'), $canAssignStateIDList)) {
eZDebug::writeWarning("Not enough rights to assign state to object {$objectID}: " . $state_after->attribute('id'), __METHOD__);
} else {
eZDebug::writeDebug('Changing object state from ' . $state_before->attribute('name') . ' to ' . $state_after->attribute('name'), __METHOD__);
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($state_after->attribute('id'))));
} else {
eZContentOperationCollection::updateObjectState($objectID, array($state_after->attribute('id')));
}
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例2: stateEditActionCheck
function stateEditActionCheck($module, $class, $object, $version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage)
{
if ($module->isCurrentAction('StateEdit')) {
$http = eZHTTPTool::instance();
if ($http->hasPostVariable('SelectedStateIDList')) {
$selectedStateIDList = $http->postVariable('SelectedStateIDList');
$objectID = $object->attribute('id');
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => $selectedStateIDList));
} else {
eZContentOperationCollection::updateObjectState($objectID, $selectedStateIDList);
}
}
}
}
示例3: isset
$objectID = isset( $Params['ObjectID'] ) ? $Params['ObjectID'] : false;
$selectedStateIDList = isset( $Params['SelectedStateID'] ) ? array( $Params['SelectedStateID'] ) : false ;
}
// Change object's state
if ( $objectID and $selectedStateIDList )
{
if ( eZOperationHandler::operationIsAvailable( 'content_updateobjectstate' ) )
{
$operationResult = eZOperationHandler::execute( 'content', 'updateobjectstate',
array( 'object_id' => $objectID,
'state_id_list' => $selectedStateIDList ) );
}
else
{
eZContentOperationCollection::updateObjectState( $objectID, $selectedStateIDList );
}
// Redirect to the provided URI, or to the root if not provided.
// @TODO : in case this view is called through Ajax, make sure the module ends another way.
$Module->hasActionParameter( 'RedirectRelativeURI' ) ? $Module->redirectTo( $Module->actionParameter( 'RedirectRelativeURI' ) ) : $Module->redirectTo( '/' );
}
elseif ( $objectID )
{
// Propose an interface. The end-user probably accessed this view through a simple URL like
// '/state/assign/<object_id>'
if ( ( $object = eZContentObject::fetch( $objectID ) ) !== null )
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'node', $object->attribute( 'main_node' ) );
$Result['content'] = $tpl->fetch( 'design:state/assign.tpl' );
示例4: implode
$cli->output('Published : Starting.');
$cli->output('Supported Classes : ' . implode(', ', $unpublishClasses));
foreach ($rootNodeIDList as $nodeID) {
$rootNode = eZContentObjectTreeNode::fetch($nodeID);
$articleNodeArray = $rootNode->subTree(array('ClassFilterType' => 'include', 'ClassFilterArray' => $unpublishClasses));
foreach ($articleNodeArray as $articleNode) {
$article = $articleNode->attribute('object');
// Si le contenu est à l'état Mise en ligne programmée 'publish_chain/waituntildate'
if (in_array($ini->variable('UpdateObjectStatesSettings', 'PendingObjectState'), $article->attribute('state_id_array'))) {
$dataMap = $article->attribute('data_map');
$dateAttribute = $dataMap['publish_date'];
if ($dateAttribute === null) {
continue;
}
$date = $dateAttribute->content();
$articleRetractDate = $date->attribute('timestamp');
if ($articleRetractDate > 0 && $articleRetractDate < $currrentDate) {
$ok = "NOT-OK";
// Switch Object state to Published
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $articleNode->attribute('contentobject_id'), 'state_id_list' => array($targetState)));
$ok = "OK";
} else {
eZContentOperationCollection::updateObjectState($articleNode->attribute('contentobject_id'), array($targetState));
$ok = "OK";
}
$cli->output('Archived : ' . $ok . ' - ' . $articleNode->attribute('name'));
}
}
}
}
示例5: foreach
$state = $ini->variable('UpdateObjectStatesSettings', 'DefaultObjectState');
}
if ($http->hasVariable('SelectIDArray') && $http->hasVariable('UpdateObjectStateButton') && $http->hasVariable('TargetObjectState')) {
$targetState = null;
if ($http->variable('TargetObjectState') > 0) {
$targetState = $http->variable('TargetObjectState');
$targetState = eZContentObjectState::fetchById($targetState);
}
if ($targetState != null) {
foreach ($http->variable('SelectIDArray') as $objectID) {
$object = eZContentObject::fetch($objectID);
if ($object != null) {
if (eZOperationHandler::operationIsAvailable('content_updateobjectstate')) {
$operationResult = eZOperationHandler::execute('content', 'updateobjectstate', array('object_id' => $objectID, 'state_id_list' => array($targetState->attribute('id'))));
} else {
eZContentOperationCollection::updateObjectState($objectID, array($targetState->attribute('id')));
}
}
}
}
}
$state = eZContentObjectState::fetchById($state);
if (!is_object($state)) {
return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
} else {
$stateName = $state->attribute('current_translation');
$stateName = $stateName->attribute('name');
}
$tpl = templateInit();
$tpl->setVariable('state', $state);
$tpl->setVariable('state_name', $stateName);
示例6: runOperation
function runOperation(&$node)
{
eZContentOperationCollection::updateObjectState($node->attribute('contentobject_id'), array($this->state_id));
return true;
}