本文整理汇总了PHP中eZWorkflowProcess类的典型用法代码示例。如果您正苦于以下问题:PHP eZWorkflowProcess类的具体用法?PHP eZWorkflowProcess怎么用?PHP eZWorkflowProcess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZWorkflowProcess类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param eZWorkflowProcess $process
* @param eZWorkflowEvent $event
* @return int
*/
function execute( $process, $event )
{
$parameters = $process->attribute( 'parameter_list' );
$deleteNodeIds = isset($parameters['node_id_list']) ? $parameters['node_id_list'] : array();
$removeLocationNodeIds = array();
if(isset($parameters['node_list']))
{
foreach($parameters['node_list'] as $node)
{
$removeLocationNodeIds[] = $node->attribute('node_id');
}
}
$nodeIds = array_merge($deleteNodeIds, $removeLocationNodeIds);
/* @type $selections MMSelections[] */
$selections = MMSelections::fetchObjectList(
MMSelections::definition(),
null,
array( 'node_id' => array( array( $nodeIds ) ) )
);
foreach( $selections as $selection )
{
$selection->remove();
}
return self::STATUS_ACCEPTED;
}
示例2: continueWorkflow
static function continueWorkflow($workflowProcessID)
{
$operationResult = null;
$theProcess = eZWorkflowProcess::fetch($workflowProcessID);
if ($theProcess != null) {
//restore memento and run it
$bodyMemento = eZOperationMemento::fetchChild($theProcess->attribute('memento_key'));
if ($bodyMemento === null) {
eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
return $operationResult;
}
$bodyMementoData = $bodyMemento->data();
$mainMemento = $bodyMemento->attribute('main_memento');
if (!$mainMemento) {
return $operationResult;
}
$mementoData = $bodyMemento->data();
$mainMementoData = $mainMemento->data();
$mementoData['main_memento'] = $mainMemento;
$mementoData['skip_trigger'] = false;
$mementoData['memento_key'] = $theProcess->attribute('memento_key');
$bodyMemento->remove();
$operationParameters = array();
if (isset($mementoData['parameters'])) {
$operationParameters = $mementoData['parameters'];
}
$operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
}
return $operationResult;
}
示例3: execute
/**
* @param eZWorkflowProcess $process
* @param eZWorkflowEvent $event
* @return int
*/
function execute( $process, $event )
{
// Get some information about the object being passed
$parameters = $process->attribute( 'parameter_list' );
$object = eZContentObject::fetch( $parameters['object_id'] );
if($object->ClassIdentifier != 'article')
return self::STATUS_ACCEPTED;
/* @type $dataMap eZContentObjectAttribute[] */
$dataMap = $object->dataMap();
if(isset($dataMap['source']))
{
$sourceString = MMNewsSource::getSourceString($object);
if($sourceString)
{
$dataMap['source']->setAttribute('data_text', $sourceString);
$dataMap['source']->store();
}
eZContentCacheManager::clearContentCache($object->attribute('id'));
}
return self::STATUS_ACCEPTED;
}
示例4: array
} else {
$conds['memento_key'] = array('!=', '');
}
$offset = $Params['Offset'];
if (!is_numeric($offset)) {
$offset = 0;
}
$limitList = array(1 => 10, 2 => 25, 3 => 50, 4 => 100);
$limit = 10;
$limitId = eZPreferences::value('admin_workflow_processlist_limit');
if ($limitId and isset($limitList[$limitId])) {
$limit = $limitList[$limitId];
}
$viewParameters = array('offset' => $offset);
$plist = eZWorkflowProcess::fetchList($conds, true, $offset, $limit);
$plistCount = eZWorkflowProcess::count(eZWorkflowProcess::definition(), $conds);
$totalProcessCount = 0;
$outList2 = array();
foreach ($plist as $p) {
$mementoMain = eZOperationMemento::fetchMain($p->attribute('memento_key'));
$mementoChild = eZOperationMemento::fetchChild($p->attribute('memento_key'));
if (!$mementoMain or !$mementoChild) {
continue;
}
$mementoMainData = $mementoMain->data();
$mementoChildData = $mementoChild->data();
$triggers = eZTrigger::fetchList(array('module_name' => $mementoChildData['module_name'], 'function_name' => $mementoChildData['operation_name'], 'name' => $mementoChildData['name']));
if (count($triggers) > 0) {
$trigger = $triggers[0];
if (is_object($trigger)) {
$nkey = $trigger->attribute('module_name') . '/' . $trigger->attribute('function_name') . '/' . $trigger->attribute('name');
示例5:
{
$cli->warning( "$productCount product collections still exists, must be a leak" );
}
}
if ( $clean['forgotpassword'] )
{
$cli->output( "Removing all forgot password requests" );
eZForgotPassword::cleanup();
}
if ( $clean['workflow'] )
{
$cli->output( "Removing all workflow processes and operation mementos" );
eZOperationMemento::cleanup();
eZWorkflowProcess::cleanup();
}
if ( $clean['collaboration'] )
{
$cli->output( "Removing all collaboration elements" );
eZCollaborationItem::cleanup();
}
if ( $clean['collectedinformation'] )
{
$cli->output( "Removing all collected information" );
eZInformationCollection::cleanup();
}
if ( $clean['notification'] )
示例6: array
/**
* File containing the workflow.php cronjob
*
* @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
* @package kernel
*/
$runInBrowser = true;
if ( isset( $webOutput ) )
$runInBrowser = $webOutput;
$db = eZDB::instance();
$workflowProcessList = eZWorkflowProcess::fetchForStatus( eZWorkflow::STATUS_DEFERRED_TO_CRON );
$cli->output( "Checking for workflow processes" );
$removedProcessCount = 0;
$processCount = 0;
$statusMap = array();
foreach( $workflowProcessList as $process )
{
$db->begin();
$workflow = eZWorkflow::fetch( $process->attribute( "workflow_id" ) );
if ( $process->attribute( "event_id" ) != 0 )
$workflowEvent = eZWorkflowEvent::fetch( $process->attribute( "event_id" ) );
$process->run( $workflow, $workflowEvent, $eventLog );
// Store changes to process
示例7: runWorkflow
function runWorkflow()
{
$workflowProcessList = eZWorkflowProcess::fetchForStatus(eZWorkflow::STATUS_DEFERRED_TO_CRON);
foreach ($workflowProcessList as $process) {
$workflow = eZWorkflow::fetch($process->attribute("workflow_id"));
if ($process->attribute("event_id") != 0) {
$workflowEvent = eZWorkflowEvent::fetch($process->attribute("event_id"));
}
$process->run($workflow, $workflowEvent, $eventLog);
// Store changes to process
if ($process->attribute('status') != eZWorkflow::STATUS_DONE) {
if ($process->attribute('status') == eZWorkflow::STATUS_RESET || $process->attribute('status') == eZWorkflow::STATUS_FAILED || $process->attribute('status') == eZWorkflow::STATUS_NONE || $process->attribute('status') == eZWorkflow::STATUS_CANCELLED || $process->attribute('status') == eZWorkflow::STATUS_BUSY) {
$bodyMemento = eZOperationMemento::fetchMain($process->attribute('memento_key'));
$mementoList = eZOperationMemento::fetchList($process->attribute('memento_key'));
$bodyMemento->remove();
foreach ($mementoList as $memento) {
$memento->remove();
}
}
if ($process->attribute('status') == eZWorkflow::STATUS_CANCELLED) {
$process->removeThis();
} else {
$process->store();
}
} else {
//restore memento and run it
$bodyMemento = eZOperationMemento::fetchChild($process->attribute('memento_key'));
if (is_null($bodyMemento)) {
eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php");
continue;
}
$bodyMementoData = $bodyMemento->data();
$mainMemento = $bodyMemento->attribute('main_memento');
if (!$mainMemento) {
continue;
}
$mementoData = $bodyMemento->data();
$mainMementoData = $mainMemento->data();
$mementoData['main_memento'] = $mainMemento;
$mementoData['skip_trigger'] = true;
$mementoData['memento_key'] = $process->attribute('memento_key');
$bodyMemento->remove();
$operationParameters = array();
if (isset($mementoData['parameters'])) {
$operationParameters = $mementoData['parameters'];
}
$operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData);
$process->removeThis();
}
}
}
示例8: time
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
* @version //autogentag//
* @package kernel
*/
$Module = $Params['Module'];
$WorkflowProcessID = null;
if (!isset($Params["WorkflowProcessID"])) {
$Module->redirectTo($Module->functionURI("list"));
return;
}
$WorkflowProcessID = $Params["WorkflowProcessID"];
$process = eZWorkflowProcess::fetch($WorkflowProcessID);
if ($process === null) {
$Module->redirectTo($Module->functionURI("list"));
return;
}
$http = eZHTTPTool::instance();
if ($http->hasPostVariable("Reset")) {
$process->reset();
$process->setAttribute("modified", time());
$process->store();
}
// Template handling
$tpl = eZTemplate::factory();
$workflow = eZWorkflow::fetch($process->attribute("workflow_id"));
$workflowEvent = false;
if ($process->attribute("event_id") != 0) {
示例9: runTrigger
static function runTrigger($name, $moduleName, $function, $parameters, $keys = null)
{
$trigger = eZPersistentObject::fetchObject(eZTrigger::definition(), null, array('name' => $name, 'module_name' => $moduleName, 'function_name' => $function), true);
if ($trigger !== NULL) {
$workflowID = $trigger->attribute('workflow_id');
$workflow = eZWorkflow::fetch($workflowID);
if ($keys != null) {
$keys[] = 'workflow_id';
}
$parameters['workflow_id'] = $workflowID;
$parameters['trigger_name'] = $name;
$parameters['module_name'] = $moduleName;
$parameters['module_function'] = $function;
// It is very important that the user_id is set correctly.
// If it was not supplied by the calling code we will use
// the currently logged in user.
if (!isset($parameters['user_id']) or $parameters['user_id'] == 0) {
$user = eZUser::currentUser();
$parameters['user_id'] = $user->attribute('contentobject_id');
}
$processKey = eZWorkflowProcess::createKey($parameters, $keys);
// $searchKey = eZWorkflowProcess::createKey( $keyArray );
$workflowProcessList = eZWorkflowProcess::fetchListByKey($processKey);
if (count($workflowProcessList) > 0) {
$existingWorkflowProcess = $workflowProcessList[0];
$existingWorkflowStatus = $existingWorkflowProcess->attribute('status');
switch ($existingWorkflowStatus) {
case eZWorkflow::STATUS_FAILED:
case eZWorkflow::STATUS_CANCELLED:
case eZWorkflow::STATUS_NONE:
case eZWorkflow::STATUS_BUSY:
$existingWorkflowProcess->removeThis();
return array('Status' => eZTrigger::WORKFLOW_CANCELLED, 'Result' => null);
break;
case eZWorkflow::STATUS_FETCH_TEMPLATE:
case eZWorkflow::STATUS_FETCH_TEMPLATE_REPEAT:
case eZWorkflow::STATUS_REDIRECT:
case eZWorkflow::STATUS_RESET:
return eZTrigger::runWorkflow($existingWorkflowProcess);
// return eZTrigger::FETCH_TEMPLATE;
break;
case eZWorkflow::STATUS_DEFERRED_TO_CRON:
return eZTrigger::runWorkflow($existingWorkflowProcess);
/* return array( 'Status' => eZTrigger::STATUS_CRON_JOB,
'Result' => array( 'content' => 'Operation halted during execution.<br/>Refresh page to continue<br/><br/><b>Note: The halt is just a temporary test</b><br/>',
'path' => array( array( 'text' => 'Operation halt',
'url' => false ) ) ) );
*/
break;
case eZWorkflow::STATUS_DONE:
$existingWorkflowProcess->removeThis();
return array('Status' => eZTrigger::WORKFLOW_DONE, 'Result' => null);
}
return array('Status' => eZTrigger::WORKFLOW_CANCELLED, 'Result' => null);
} else {
// print( "\n starting new workflow process \n");
// var_dump( $keyArray );
// print( " $workflowID, $userID, $objectID, $version, $nodeID, \n ");
}
$workflowProcess = eZWorkflowProcess::create($processKey, $parameters);
$workflowProcess->store();
return eZTrigger::runWorkflow($workflowProcess);
} else {
return array('Status' => eZTrigger::NO_CONNECTED_WORKFLOWS, 'Result' => null);
}
}
示例10: execute
function execute($process, $event)
{
$processParameters = $process->attribute('parameter_list');
$storeProcessParameters = false;
$classID = false;
$object = false;
$sectionID = false;
$languageID = 0;
if (isset($processParameters['object_id'])) {
$object = eZContentObject::fetch($processParameters['object_id']);
} else {
if (isset($processParameters['node_id'])) {
$object = eZContentObject::fetchByNodeID($processParameters['node_id']);
}
}
if ($object instanceof eZContentObject) {
// Examine if the published version contains one of the languages we
// match for.
if (isset($processParameters['version'])) {
$versionID = $processParameters['version'];
$version = $object->version($versionID);
if (is_object($version)) {
$version_option = $event->attribute('version_option');
if ($version_option == eZMultiplexerType::VERSION_OPTION_FIRST_ONLY and $processParameters['version'] > 1 or $version_option == eZMultiplexerType::VERSION_OPTION_EXCEPT_FIRST and $processParameters['version'] == 1) {
return eZWorkflowType::STATUS_ACCEPTED;
}
// If the language ID is part of the mask the result is non-zero.
$languageID = (int) $version->attribute('initial_language_id');
}
}
$sectionID = $object->attribute('section_id');
$class = $object->attribute('content_class');
if ($class) {
$classID = $class->attribute('id');
}
}
$userArray = explode(',', $event->attribute('data_text2'));
$classArray = explode(',', $event->attribute('data_text5'));
$languageMask = $event->attribute('data_int2');
if (!isset($processParameters['user_id'])) {
$user = eZUser::currentUser();
$userID = $user->id();
$processParameters['user_id'] = $userID;
$storeProcessParameters = true;
} else {
$userID = $processParameters['user_id'];
$user = eZUser::fetch($userID);
if (!$user instanceof eZUser) {
$user = eZUser::currentUser();
$userID = $user->id();
$processParameters['user_id'] = $userID;
$storeProcessParameters = true;
}
}
$userGroups = $user->attribute('groups');
$inExcludeGroups = count(array_intersect($userGroups, $userArray)) != 0;
if ($storeProcessParameters) {
$process->setParameters($processParameters);
$process->store();
}
// All languages match by default
$hasLanguageMatch = true;
if ($languageMask != 0) {
// Match ID with mask.
$hasLanguageMatch = (bool) ($languageMask & $languageID);
}
if ($hasLanguageMatch && !$inExcludeGroups && (in_array(-1, $classArray) || in_array($classID, $classArray))) {
$sectionArray = explode(',', $event->attribute('data_text1'));
if (in_array($sectionID, $sectionArray) || in_array(-1, $sectionArray)) {
$workflowToRun = $event->attribute('data_int1');
$childParameters = array_merge($processParameters, array('workflow_id' => $workflowToRun, 'user_id' => $userID, 'parent_process_id' => $process->attribute('id')));
$childProcessKey = eZWorkflowProcess::createKey($childParameters);
$childProcessArray = eZWorkflowProcess::fetchListByKey($childProcessKey);
$childProcess =& $childProcessArray[0];
if ($childProcess == null) {
$childProcess = eZWorkflowProcess::create($childProcessKey, $childParameters);
$childProcess->store();
}
$workflow = eZWorkflow::fetch($childProcess->attribute("workflow_id"));
$workflowEvent = null;
if ($childProcess->attribute("event_id") != 0) {
$workflowEvent = eZWorkflowEvent::fetch($childProcess->attribute("event_id"));
}
$childStatus = $childProcess->run($workflow, $workflowEvent, $eventLog);
$childProcess->store();
if ($childStatus == eZWorkflow::STATUS_DEFERRED_TO_CRON) {
$this->setActivationDate($childProcess->attribute('activation_date'));
$childProcess->setAttribute("status", eZWorkflow::STATUS_WAITING_PARENT);
$childProcess->store();
return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE or $childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE_REPEAT) {
$process->Template =& $childProcess->Template;
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_REDIRECT) {
$process->RedirectUrl =& $childProcess->RedirectUrl;
return eZWorkflowType::STATUS_REDIRECT_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_DONE) {
//.........这里部分代码省略.........
示例11: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$objectId = $parameters['object_id'];
$object = eZContentObject::fetch($objectId);
$subtreeNodeID = $event->attribute('target_subtree');
$subtreeNode = eZContentObjectTreeNode::fetch($subtreeNodeID);
eZDebug::writeDebug("Event begins execution for object {$objectId}, subtree {$subtreeNodeID}", __METHOD__);
if ($object != null && $subtreeNode != null) {
$is_child = false;
$locations = $object->assignedNodes();
if ($locations == null) {
// pre-creation event: obj has no node on its own, but a putative parent
//eZDebug::writeDebug( 'Obj node is new!', __METHOD__ );
$locations = eZNodeAssignment::fetchForObject($objectId, $object->attribute("current_version"));
foreach ($locations as $key => $location) {
$locations[$key] = $location->getParentNode();
}
}
foreach ($locations as $node) {
$subtreeNodePath = $node->pathArray();
//eZDebug::writeDebug( 'Testing if obj node '.$node->NodeID.' is child of : ' . $subtreeNodeID, __METHOD__ );
if (in_array($subtreeNodeID, $subtreeNodePath)) {
eZDebug::writeDebug('Found that obj node ' . $node->NodeID . ' is child of node ' . $subtreeNodeID, __METHOD__);
$is_child = true;
break;
}
}
if ($is_child) {
$workflowToRun = $event->attribute('target_workflow');
$user = eZUser::currentUser();
$userID = $user->id();
$processParameters = $process->attribute('parameter_list');
// code copy+pasted from ez multoplexer worflow...
$childParameters = array_merge($processParameters, array('workflow_id' => $workflowToRun, 'user_id' => $userID, 'parent_process_id' => $process->attribute('id')));
$childProcessKey = eZWorkflowProcess::createKey($childParameters);
$childProcessArray = eZWorkflowProcess::fetchListByKey($childProcessKey);
$childProcess =& $childProcessArray[0];
if ($childProcess == null) {
$childProcess = eZWorkflowProcess::create($childProcessKey, $childParameters);
$childProcess->store();
}
$workflow = eZWorkflow::fetch($childProcess->attribute("workflow_id"));
$workflowEvent = null;
if ($childProcess->attribute("event_id") != 0) {
$workflowEvent = eZWorkflowEvent::fetch($childProcess->attribute("event_id"));
}
$childStatus = $childProcess->run($workflow, $workflowEvent, $eventLog);
$childProcess->store();
if ($childStatus == eZWorkflow::STATUS_DEFERRED_TO_CRON) {
$this->setActivationDate($childProcess->attribute('activation_date'));
$childProcess->setAttribute("status", eZWorkflow::STATUS_WAITING_PARENT);
$childProcess->store();
return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE) {
$process->Template =& $childProcess->Template;
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_REDIRECT) {
$process->RedirectUrl =& $childProcess->RedirectUrl;
return eZWorkflowType::STATUS_REDIRECT_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_DONE) {
$childProcess->removeThis();
return eZWorkflowType::STATUS_ACCEPTED;
} else {
if ($childStatus == eZWorkflow::STATUS_CANCELLED || $childStatus == eZWorkflow::STATUS_FAILED) {
$childProcess->removeThis();
return eZWorkflowType::STATUS_REJECTED;
}
}
}
}
}
return $childProcess->attribute('event_status');
}
return eZWorkflowType::STATUS_ACCEPTED;
} else {
eZDebug::writeError("Event triggered for inexisting object ({$objectId}) or subtree ({$subtreeNodeID})", __METHOD__);
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
}
示例12: removeThis
function removeThis()
{
$workflowParameters = $this->attribute('parameter_list');
$cleanupList = array();
$db = eZDB::instance();
$db->begin();
if (isset($workflowParameters['cleanup_list']) && is_array($workflowParameters['cleanup_list'])) {
$cleanupList = $workflowParameters['cleanup_list'];
foreach ($cleanupList as $workflowEventID) {
$workflowEvent = eZWorkflowEvent::fetch($workflowEventID);
$workflowType = $workflowEvent->eventType();
$workflowType->cleanup($this, eZWorkflowEvent::fetch($workflowEventID));
}
}
eZPersistentObject::removeObject(eZWorkflowProcess::definition(), array('id' => $this->attribute('id')));
$db->commit();
}
示例13: time
#include_once( 'kernel/classes/ezcontentobjectversion.php' );
$contentObjectVersion = $approveStatus->attribute('object_version');
$contentObjectVersion->setAttribute('status', eZContentObjectVersion::STATUS_PENDING);
$contentObjectVersion->sync();
$approveStatus->setAttribute('approve_status', eZXApproveStatus::StatusInApproval);
$approveStatus->store();
$workflowProcess = $approveStatus->attribute('workflow_process');
if (!$workflowProcess) {
$approveStatus->remove();
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$workflowProcess->setAttribute('status', eZWorkflow::STATUS_DEFERRED_TO_CRON);
$workflowProcess->setAttribute('modified', time());
$parameterList = $workflowProcess->attribute('parameter_list');
if (isset($parameterList['parent_process_id'])) {
$parentProcess = eZWorkflowProcess::fetch($parameterList['parent_process_id']);
if (is_object($parentProcess)) {
$parentProcess->setAttribute('status', eZWorkflow::STATUS_DEFERRED_TO_CRON);
$parentProcess->setAttribute('modified', time());
$parentProcess->store();
}
}
$workflowProcess->store();
$approveINI = eZINI::instance('ezapprove2.ini');
if ($approveINI->variable('ApproveSettings', 'ObjectLockOnEdit') == 'true') {
// Lock all related objects for editing and removal
$object = $approveStatus->attribute('contentobject');
// #HACK#
if ($object->attribute('contentclass_id') == 17) {
foreach ($object->relatedContentObjectList($approveStatus->attribute('active_version'), false, false) as $relatedObject) {
$relatedObject->setAttribute('flags', $relatedObject->attribute('flags') | EZ_CONTENT_OBJECT_FLAG_LOCK_EDIT | EZ_CONTENT_OBJECT_FLAG_LOCK_REMOVE);
示例14: approve2Event
function approve2Event()
{
#include_once( 'kernel/classes/ezworkflowprocess.php' );
$workflowProcess = eZWorkflowProcess::fetch($this->attribute('workflowprocess_id'), false);
$retVal = false;
if (!$workflowProcess) {
return $retVal;
}
#include_once( eZExtension::baseDirectory() . '/ezapprove2/eventtypes/event/ezxapprove2/ezxapprove2type.php' );
$retVal = eZApprove2Event::fetch($workflowProcess['event_id']);
return $retVal;
}