本文整理汇总了PHP中eZWorkflowEventType::registerEventType方法的典型用法代码示例。如果您正苦于以下问题:PHP eZWorkflowEventType::registerEventType方法的具体用法?PHP eZWorkflowEventType::registerEventType怎么用?PHP eZWorkflowEventType::registerEventType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZWorkflowEventType
的用法示例。
在下文中一共展示了eZWorkflowEventType::registerEventType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchHTTPInput
{
$http_input_sa = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_source_attribute_' . $event->attribute('id');
$http_input_er = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_external_redirect_' . $event->attribute('id');
$http_input_ar = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_at_root_' . $event->attribute('id');
/// @todo add more validation for _er and _ar: should be bool values...
if ($http->hasPostVariable($http_input_sa)) {
$returnState = eZInputValidator::STATE_ACCEPTED;
} else {
$returnState = eZInputValidator::STATE_INVALID;
//$reason[ 'text' ] = "Select at least one group, then one state.";
}
return $returnState;
}
function fetchHTTPInput($http, $base, $event)
{
$http_input_sa = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_source_attribute_' . $event->attribute('id');
$http_input_er = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_external_redirect_' . $event->attribute('id');
$http_input_ar = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_at_root_' . $event->attribute('id');
if ($http->hasPostVariable($http_input_sa)) {
$event->setAttribute("data_text1", $http->postVariable($http_input_sa));
}
if ($http->hasPostVariable($http_input_er)) {
$event->setAttribute("data_int1", (bool) $http->postVariable($http_input_er));
}
if ($http->hasPostVariable($http_input_ar)) {
$event->setAttribute("data_int2", (bool) $http->postVariable($http_input_ar));
}
}
}
eZWorkflowEventType::registerEventType(addUrlAliasType::WORKFLOW_TYPE_STRING, 'addUrlAliasType');
示例2: __construct
* File containing the WorkflowEventRegressionFetchTemplateRepeatType class.
*
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
* @package tests
*/
class WorkflowEventRegressionFetchTemplateRepeatType extends eZWorkflowEventType
{
const WORKFLOW_TYPE_STRING = 'fetchtemplaterepeat';
function __construct()
{
$this->eZWorkflowEventType(WorkflowEventRegressionFetchTemplateRepeatType::WORKFLOW_TYPE_STRING, "WorkflowEventRegressionFetchTemplateRepeatType test");
$this->setTriggerTypes(array('content' => array('publish' => array('before'))));
}
function execute($process, $event)
{
if (!isset($_POST['CompletePublishing'])) {
$index = eZSys::indexFile(true);
$requestUri = eZSys::indexFile(false) . eZSys::requestUri();
$replace = "@" . preg_quote($index) . "@i";
$requestUri = preg_replace(array($replace), array(''), $requestUri, 1);
$process->Template = array('templateName' => 'file:' . dirname(__FILE__) . basename(__FILE__, '.php') . '.tpl', 'templateVars' => array('uri' => $requestUri), 'path' => array(array('url' => false, 'text' => 'Workflow event regression: fetch template repeat')));
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
return eZWorkflowType::STATUS_ACCEPTED;
}
}
}
eZWorkflowEventType::registerEventType(WorkflowEventRegressionFetchTemplateRepeatType::WORKFLOW_TYPE_STRING, "WorkflowEventRegressionFetchTemplateRepeatType");
示例3: cleanup
*/
function cleanup($process, $event)
{
$theGateway = $this->getCurrentGateway($event);
if ($theGateway != null and $theGateway->needCleanup()) {
$theGateway->cleanup($process, $event);
}
}
function initializeEvent($event)
{
}
/*!
Sets 'selected' gateways. -1 means 'Any' - all 'available' gateways
becomes 'selected'.
*/
function fetchHTTPInput($http, $base, $event)
{
$gatewaysVar = $base . "_event_ezpaymentgateway_gateways_" . $event->attribute("id");
if ($http->hasPostVariable($gatewaysVar)) {
$gatewaysArray = $http->postVariable($gatewaysVar);
if (in_array('-1', $gatewaysArray)) {
$gatewaysArray = array(-1);
}
$gatewaysString = implode(',', $gatewaysArray);
$event->setAttribute("data_text1", $gatewaysString);
}
}
public $logger;
}
eZWorkflowEventType::registerEventType(eZPaymentGatewayType::WORKFLOW_TYPE_STRING, 'ezpaymentgatewaytype');
示例4: array
}
$classesVar = $base . "_event_ezmultiplexer_class_ids_" . $event->attribute("id");
if ($http->hasPostVariable($classesVar)) {
$classesArray = $http->postVariable($classesVar);
if (in_array('-1', $classesArray)) {
$classesArray = array(-1);
}
$classesString = implode(',', $classesArray);
$event->setAttribute("data_text5", $classesString);
}
$workflowVar = $base . "_event_ezmultiplexer_workflow_id_" . $event->attribute("id");
if ($http->hasPostVariable($workflowVar)) {
$workflowID = $http->postVariable($workflowVar);
$event->setAttribute("data_int1", $workflowID);
}
$versionOptionVar = $base . "_event_ezmultiplexer_version_option_" . $event->attribute("id");
if ($http->hasPostVariable($versionOptionVar)) {
$versionOptionArray = $http->postVariable($versionOptionVar);
$versionOption = 0;
if (is_array($versionOptionArray)) {
foreach ($versionOptionArray as $vv) {
$versionOption = $versionOption | $vv;
}
}
$versionOption = $versionOption & eZMultiplexerType::VERSION_OPTION_ALL;
$event->setAttribute('data_int3', $versionOption);
}
}
}
eZWorkflowEventType::registerEventType(eZMultiplexerType::WORKFLOW_TYPE_STRING, 'eZMultiplexerType');
示例5: createNotificationRuleIfNeeded
}
}
}
$ownerID = $object->attribute('owner_id');
if ($event->attribute('use_owner')) {
CreateSubtreeNotificationRuleType::createNotificationRuleIfNeeded($ownerID, $mainNodeID);
}
if ($event->attribute('use_creator')) {
$version = eZContentObjectVersion::fetchVersion($parameters['version'], $parameters['object_id']);
$creatorID = $version->attribute('creator_id');
if (!$event->attribute('use_owner') || $creatorID != $ownerID) {
CreateSubtreeNotificationRuleType::createNotificationRuleIfNeeded($creatorID, $mainNodeID);
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
/*!
\static
*/
function createNotificationRuleIfNeeded($userID, $nodeID)
{
include_once 'kernel/classes/notification/handler/ezsubtree/ezsubtreenotificationrule.php';
$nodeIDList = eZSubtreeNotificationRule::fetchNodesForUserID($userID, false);
if (!in_array($nodeID, $nodeIDList)) {
$rule = eZSubtreeNotificationRule::create($nodeID, $userID);
$rule->store();
}
}
}
eZWorkflowEventType::registerEventType(CreateSubtreeNotificationRuleType::WORKFLOW_TYPE_STRING, 'CreateSubtreeNotificationRuleType');
开发者ID:Opencontent,项目名称:createsubtreenotificationruleevent,代码行数:30,代码来源:createsubtreenotificationruletype.php
示例6: foreach
$http = eZHTTPTool::instance();
eZDebug::writeNotice($parameters, "parameters");
$orderID = $parameters['order_id'];
$order = eZOrder::fetch($orderID);
if (empty($orderID) || get_class($order) != 'ezorder') {
eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
}
// Decrement the quantitity field
$order = eZOrder::fetch($orderID);
$productCollection = $order->productCollection();
$ordereditems = $productCollection->itemList();
foreach ($ordereditems as $item) {
$contentObject = $item->contentObject();
$contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
$contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
foreach (array_keys($contentObjectAttributes) as $key) {
$contentObjectAttribute = $contentObjectAttributes[$key];
$contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
// Each attribute has an attribute identifier called 'quantity' that identifies it.
if ($contentClassAttribute->attribute("identifier") == "quantity") {
$contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
$contentObjectAttribute->store();
}
}
}
return eZWorkflowEventType::STATUS_ACCEPTED;
}
}
eZWorkflowEventType::registerEventType(eZSimpleStockCheckType::WORKFLOW_TYPE_STRING, 'ezsimplestockchecktype');
示例7: array
return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
// current parent node(s)
$parentNodeIds = $object->attribute('parent_nodes');
$checkedObjs = array();
foreach ($parentNodeIds as $parentNodeId) {
//eZDebug::writeDebug( "Checking parent node: " . $parentNodeId, __METHOD__ );
$parentNode = eZContentObjectTreeNode::fetch($parentNodeId);
$parentObj = $parentNode->attribute('object');
if (!in_array($parentObj->attribute('id'), $checkedObjs)) {
//eZDebug::writeDebug( "Checking all nodes of parent obj: " . $parentObj->attribute( 'id' ), __METHOD__ );
foreach ($parentObj->attribute('assigned_nodes') as $node) {
if (!in_array($node->attribute('node_id'), $parentNodeIds)) {
//eZDebug::writeDebug( "Found a node which is not parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
// the current obj has no node which is children of the given node of one of its parent objects
$operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $object->attribute('main_node_id'), 'object_id' => $object->attribute('id'), 'select_node_id_array' => array($node->attribute('node_id'))), null, true);
if ($operationResult == null || $operationResult['status'] != true) {
eZDebug::writeError("Unable to add new location to object: " . $object->attribute('id'), __METHOD__);
}
} else {
//eZDebug::writeDebug( "Found a node which is already parent of current obj: " . $node->attribute( 'node_id' ), __METHOD__ );
}
}
}
$checkedObjs[] = $parentObj->attribute('id');
}
return eZWorkflowType::STATUS_ACCEPTED;
}
}
eZWorkflowEventType::registerEventType(copyNodeToAllParentLocationsType::EVENT_TYPE, copyNodeToAllParentLocationsType::EVENT_CLASS);
示例8: implode
// clean up the stuff
if ($targetNodes != '') {
$targetNodes = implode(',', array_unique(array_map('intval', explode(',', $targetNodes))));
}
$event->setAttribute("data_text1", $targetNodes);
} else {
/// @todo log some warning ???
}
}
function workflowEventContent($event)
{
$id = $event->attribute("id");
$version = $event->attribute("version");
return new eZWaitUntilDate($id, $version);
}
function storeEventData($event, $version)
{
$event->content()->setVersion($version);
}
function storeDefinedEventData($event)
{
$id = $event->attribute('id');
$version = 1;
$waitUntilDateVersion1 = new eZWaitUntilDate($id, $version);
$waitUntilDateVersion1->setVersion(0);
//strange name but we are creating version 0 here
eZWaitUntilDate::removeWaitUntilDateEntries($id, 1);
}
}
eZWorkflowEventType::registerEventType(multiPublishType::WORKFLOW_TYPE_STRING, 'multipublishtype');
示例9: execute
* @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;
}
}
eZWorkflowEventType::registerEventType( updateNewsSourceType::WORKFLOW_TYPE_STRING, "updateNewsSourceType" );
示例10:
$collaborationItem = eZCollaborationItem::fetch($collaborationID);
$contentObjectVersion = eZApproveCollaborationHandler::contentObjectVersion($collaborationItem);
$approvalStatus = eZApproveCollaborationHandler::checkApproval($collaborationID);
if ($approvalStatus == eZApproveCollaborationHandler::STATUS_WAITING) {
eZDebugSetting::writeDebug('kernel-workflow-approve', $event, 'approval still waiting');
return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
} else {
if ($approvalStatus == eZApproveCollaborationHandler::STATUS_ACCEPTED) {
eZDebugSetting::writeDebug('kernel-workflow-approve', $event, 'approval was accepted');
$status = eZWorkflowType::STATUS_ACCEPTED;
} else {
if ($approvalStatus == eZApproveCollaborationHandler::STATUS_DENIED or $approvalStatus == eZApproveCollaborationHandler::STATUS_DEFERRED) {
eZDebugSetting::writeDebug('kernel-workflow-approve', $event, 'approval was denied');
$contentObjectVersion->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$status = eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
} else {
eZDebugSetting::writeDebug('kernel-workflow-approve', $event, "approval unknown status '{$approvalStatus}'");
$contentObjectVersion->setAttribute('status', eZContentObjectVersion::STATUS_REJECTED);
$status = eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
}
}
}
$contentObjectVersion->sync();
if ($approvalStatus != eZApproveCollaborationHandler::STATUS_DEFERRED) {
$db->query('DELETE FROM ezapprove_items WHERE workflow_process_id = ' . $process->attribute('id'));
}
return $status;
}
}
eZWorkflowEventType::registerEventType(eZApprove2Type::ID, "ezapprove2type");
示例11: fetchHTTPInput
}
function fetchHTTPInput($http, $base, $event)
{
$modifyDateVariable = $base . "_data_hideuntildate_modifydate_" . $event->attribute("id");
if ($http->hasPostVariable($modifyDateVariable)) {
$modifyDateValue = (int) $http->postVariable($modifyDateVariable);
$event->setAttribute('data_int1', $modifyDateValue);
}
}
function workflowEventContent($event)
{
$id = $event->attribute("id");
$version = $event->attribute("version");
return new hideUntilDate($id, $version);
}
function storeEventData($event, $version)
{
$event->content()->setVersion($version);
}
function storeDefinedEventData($event)
{
$id = $event->attribute('id');
$version = 1;
$hideUntilDateVersion1 = new hideUntilDate($id, $version);
$hideUntilDateVersion1->setVersion(0);
//strange name but we are creating version 0 here
hideUntilDate::removeHideUntilDateEntries($id, 1);
}
}
eZWorkflowEventType::registerEventType(hideUntilDateType::WORKFLOW_TYPE_STRING, "hideUntilDateType");
示例12: foreach
// check if child is already also a child of the new locations
// (avoid checking the same object many times)
$childObj = $childNode->attribute('object');
//eZDebug::writeDebug( "Found child obj: " . $childObj->attribute( 'id' ), __METHOD__ );
if (!in_array($childObj->attribute('id'), $checkedObjs)) {
$childParentNodeIds = $childObj->attribute('parent_nodes');
foreach ($assignedNodeIDs as $newNodeId) {
//eZDebug::writeDebug( "Checking it against new node: " . $newNodeId, __METHOD__ );
if (!in_array($newNodeId, $childParentNodeIds)) {
//eZDebug::writeDebug( "Obj is not child of new node, adding it", __METHOD__ );
// this child is not a child of new parent $newNode: add it there
$operationResult = eZOperationHandler::execute('content', 'addlocation', array('node_id' => $childObj->attribute('main_node_id'), 'object_id' => $childObj->attribute('id'), 'select_node_id_array' => array($newNodeId)), null, true);
//eZDebug::writeDebug( var_export( $operationResult, true ), __METHOD__ );
if ($operationResult == null || $operationResult['status'] != true) {
eZDebug::writeError("Unable to add new location to object: " . $childObj->attribute('id'), __METHOD__);
}
// doing the same without recursion
//eZContentOperationCollection::addAssignment( $childObj->attribute( 'main_node_id' ), $childObj->attribute( 'id' ),array( $newNodeId ) );
} else {
//eZDebug::writeDebug( "Obj is already child of new node", __METHOD__ );
}
}
}
$checkedObjs[] = $childObj->attribute('id');
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
}
eZWorkflowEventType::registerEventType(copyChildrenOnAddLocationType::EVENT_TYPE, copyChildrenOnAddLocationType::EVENT_CLASS);
示例13: ImportNewsletterType
<?php
class ImportNewsletterType extends eZWorkflowEventType
{
const WORKFLOW_TYPE_STRING = "importnewsletter";
function ImportNewsletterType()
{
$this->eZWorkflowEventType(ImportNewsletterType::WORKFLOW_TYPE_STRING, ezpI18n::tr('newsletteraddon/event', 'Newsletter import event'));
$this->setTriggerTypes(array('content' => array('publish' => array('after'))));
}
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$co = eZContentObject::fetch($parameters['object_id']);
$parent = eZContentObjectTreeNode::fetch($co->attribute('main_parent_node_id'));
$parentco = $parent->attribute('object');
$newslettertype = eZPersistentObject::fetchObject(eZNewsletterType::definition(), null, array('article_pool_object_id' => $parentco->attribute('id'), 'status' => eZNewsletterType_StatusPublished));
$list = eZNewsletter::fetchByContentObject($parameters['object_id']);
if (empty($list) and is_object($newslettertype)) {
$newsletter = eZNewsletter::create($co->attribute('name'), $co->attribute('owner_id'), $newslettertype->attribute('id'));
$newsletter->setAttribute('contentobject_id', $parameters['object_id']);
$newsletter->setAttribute('template_to_use', 'mobotixnewsletter');
$newsletter->setAttribute('contentobject_version', $parameters['version']);
$newsletter->store();
$newsletter->publish();
}
return eZWorkflowType::STATUS_ACCEPTED;
}
}
eZWorkflowEventType::registerEventType(ImportNewsletterType::WORKFLOW_TYPE_STRING, "ImportNewsletterType");
示例14: array
{
$filter = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
foreach ($order->productItems() as $item) {
$dataMap = $item['item_object']->contentObject()->dataMap();
if (!array_key_exists('paymethod', $dataMap)) {
return $filter;
}
$paymethod = $dataMap['paymethod'];
$content = $paymethod->content();
$filter = array_intersect($filter, $content);
}
return $filter;
}
public function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$order = eZOrder::fetch($parameters['order_id']);
$filter = self::filterOrderPayment($order);
$process->Template = array();
$process->Template['templateName'] = 'design:workflow/ezpaymentselect.tpl';
$process->Template['templateVars'] = array('order' => $order, 'filter' => $filter);
if (!$this->checkPayment()) {
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
eZPaymentSelectType::storeOrderData($order, $_POST['payment'], serialize($_POST));
return eZWorkflowType::STATUS_ACCEPTED;
}
}
}
eZWorkflowEventType::registerEventType(eZPaymentSelectType::WORKFLOW_TYPE_STRING, "eZPaymentSelectType");
示例15: foreach
$classIdentifier = $version->ContentObject->ClassIdentifier;
// Verifica se la classe è corretta
if ($classIdentifier == self::PUBLISH_CLASS) {
$objectAttributes = $version->attribute('contentobject_attributes');
// cicla sugl iattributi
foreach ($objectAttributes as $objectAttribute) {
$contentClassAttributeIdentifier = $objectAttribute->ContentClassAttributeIdentifier;
if ($contentClassAttributeIdentifier == 'published') {
// recupera la data di pubblicazione
$publisheddate = $objectAttribute->attribute('content');
}
}
// set della data di pubblicazione
if ($publisheddate instanceof eZDateTime || $publisheddate instanceof eZDate) {
$object->setAttribute('published', $publisheddate->timeStamp());
$object->store();
eZContentOperationCollection::registerSearchObject($object->attribute('id'));
eZDebug::writeNotice('Workflow change object publish date', __METHOD__);
}
//echo('<br>*** die workflow ***');
//die();
}
return eZWorkflowType::STATUS_ACCEPTED;
} catch (Exception $e) {
eZDebug::writeError($e->getMessage(), __METHOD__);
return eZWorkflowType::STATUS_REJECTED;
}
}
}
eZWorkflowEventType::registerEventType(ImportComunicatiType::WORKFLOW_TYPE_STRING, 'ImportComunicatiType');