{
        $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');
 * 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");
      */
    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');
        }
        $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');
                }
            }
        }
        $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');
        $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
0
    public function __construct()
    {
        $this->eZWorkflowEventType(eZFinishUserRegisterType::WORKFLOW_TYPE_STRING, ezpI18n::tr('kernel/workflow/event', "Finish User Registration"));
        $this->setTriggerTypes(array('content' => array('publish' => array('after'))));
    }
    function execute($process, $event)
    {
        //execute user register operation
        $parameterList = $process->attribute('parameter_list');
        $objectID = $parameterList['object_id'];
        $object = eZContentObject::fetch($objectID);
        // @todo: improve the possible performance.
        if ($object->attribute('class_identifier') == 'user') {
            $result = eZOperationHandler::execute('user', 'register', array('user_id' => $objectID));
            return $result['status'];
        }
    }
    function typeFunctionalAttributes()
    {
        return array('selected_sections', 'approve_users', 'approve_groups', 'selected_usergroups', 'language_list', 'version_option');
    }
    function attributeDecoder($event, $attr)
    {
    }
    function attributes()
    {
        return array_merge(array('sections', 'languages', 'users', 'usergroups'), eZWorkflowEventType::attributes());
    }
}
eZWorkflowEventType::registerEventType(eZFinishUserRegisterType::WORKFLOW_TYPE_STRING, "eZFinishUserRegisterType");
            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);
            // 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');
     * @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" );
예제 #11
0
        $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");
예제 #12
0
    }
    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");
                // 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);
<?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");
    {
        $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");
            $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');
                return eZWorkflowType::STATUS_ACCEPTED;
            }
        }
        // Get send item, and check that is contains the object id.
        if (!$sendItem) {
            return eZWorkflowType::STATUS_REJECTED;
        }
        $sendItemIDList = $sendItem->attribute('newsletter_related_object_list');
        if (!$sendItemIDList || !in_array($objectID, $sendItemIDList)) {
            return eZWorkflowType::STATUS_REJECTED;
        }
        $sendNodeIDArray = array();
        // Set session variables
        foreach ($sendItemIDList as $sendObjectID) {
            $sendObject = eZContentObject::fetch($sendObjectID);
            if ($sendObject) {
                foreach ($sendObject->assignedNodes(false) as $nodeArray) {
                    $http->setSessionVariable('NewletterNodeMap_' . $nodeArray['node_id'], $sendItem->attribute('id'));
                    $sendNodeIDArray[] = $nodeArray['node_id'];
                }
            }
        }
        $globalNodeIDList = array_unique(array_merge($globalNodeIDList, $sendNodeIDArray));
        $http->setSessionVariable('NewsletterNodeIDArray', $globalNodeIDList);
        // Add object read
        $sendItem->addObjectRead($objectID);
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}
eZWorkflowEventType::registerEventType(eZNewsletterReadType::EventName, "eznewsletterreadtype");
                break;
        }
        return null;
    }
    function validateHTTPInput($http, $base, $workflowEvent, &$validation)
    {
        $http_input_state_before = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_state_before_' . $workflowEvent->attribute('id');
        $http_input_state_after = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_state_after_' . $workflowEvent->attribute('id');
        if ($http->hasPostVariable($http_input_state_before) && $http->hasPostVariable($http_input_state_after)) {
            /// @todo check that the states are integers
            $returnState = eZInputValidator::STATE_ACCEPTED;
        } else {
            $returnState = eZInputValidator::STATE_INVALID;
            $reason['text'] = "Select at least one before state and one after state.";
        }
        return $returnState;
    }
    function fetchHTTPInput($http, $base, $event)
    {
        $http_input_state_before = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_state_before_' . $event->attribute('id');
        $http_input_state_after = $base . '_event_' . self::WORKFLOW_TYPE_STRING . '_state_after_' . $event->attribute('id');
        if ($http->hasPostVariable($http_input_state_before)) {
            $event->setAttribute("data_int1", $http->postVariable($http_input_state_before));
        }
        if ($http->hasPostVariable($http_input_state_after)) {
            $event->setAttribute("data_int2", $http->postVariable($http_input_state_after));
        }
    }
}
eZWorkflowEventType::registerEventType(objectStateUpdateType::WORKFLOW_TYPE_STRING, 'objectstateupdatetype');
예제 #19
0
    }
    function fetchHTTPInput($http, $base, $event)
    {
        $modifyDateVariable = $base . "_data_waituntildate_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 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(eZWaitUntilDateType::WORKFLOW_TYPE_STRING, "eZWaitUntilDateType");
                    }
                }
            }
        } else {
            self::writeDebug('writeNotice', $objectName . ' is not a user class object');
        }
        if (self::WORKFLOW_TYPE_DEBUG_STOP_EXECUTION === true) {
            die("<hr />\n\nWorkflow: " . self::WORKFLOW_TYPE_STRING . " execution has been ended before normal completion for debugging");
        }
        /**
         * Return default succesful workflow event status code, by default, regardless of results of execution, always.
         * Image alias image variation image files may not always need to be created. Also returning any other status
         * will result in problems with the succesfull and normal completion of the workflow event process
         */
        return eZWorkflowType::STATUS_ACCEPTED;
    }
    /**
     * Workflow Event Type writeDebug method
     */
    function writeDebug($type = 'writeDebug', $string = null, $label = 'Workflow : BC User Register User Placement', $force = false)
    {
        if ($string != null && $force === true || $string != null && self::WORKFLOW_TYPE_DEBUG === true) {
            eZDebug::$type($string, $label);
        }
    }
}
/**
 * Register workflow event type class BCUserRegisterUserPlacementType
 */
eZWorkflowEventType::registerEventType(BCUserRegisterUserPlacementType::WORKFLOW_TYPE_STRING, "BCUserRegisterUserPlacementType");
    }
    // *** storage/retrieval of per-event attributes values (these will be added to the event attributes) ***
    function typeFunctionalAttributes()
    {
        return array('target_subtree', 'target_workflow');
    }
    function attributeDecoder($event, $attribute)
    {
        switch ($attribute) {
            case 'target_subtree':
                return $event->attribute('data_int1');
            case 'target_workflow':
                return $event->attribute('data_int2');
        }
        return null;
    }
    // get the values to be used for the custom attributes from http post and store them
    function fetchHTTPInput($http, $base, $event)
    {
        $varName = $base . "_event_subtreemultiplexer_target_subtree_" . $event->attribute("id");
        if ($http->hasPostVariable($varName)) {
            $event->setAttribute('data_int1', (int) $http->PostVariable($varName));
        }
        $varName = $base . "_event_subtreemultiplexer_target_workflow_" . $event->attribute("id");
        if ($http->hasPostVariable($varName)) {
            $event->setAttribute('data_int2', (int) $http->PostVariable($varName));
        }
    }
}
eZWorkflowEventType::registerEventType(SubTreeMultiplexerType::WORKFLOW_TYPE_STRING, 'subtreemultiplexertype');
        $node = eZContentObjectTreeNode::fetch($nodeID);
        if (!$node) {
            return eZWorkflowType::STATUS_ACCEPTED;
        }
        $http = eZHTTPTool::instance();
        $http->setSessionVariable("RedirectAfterLogin", 'content/view/full/' . $nodeID);
        $identifiers = $ini->hasVariable('Subsite', 'Classes') ? $ini->variable('Subsite', 'Classes') : array();
        if (in_array($node->attribute('class_identifier'), $identifiers)) {
            $dataMap = $node->attribute('data_map');
            if (isset($dataMap['link']) && $dataMap['link']->hasContent()) {
                if ($dataMap['link']->Content() !== "http://" . eZSys::hostname() . '/') {
                    header('Location: ' . $dataMap['link']->Content());
                }
            }
        }
        $path = $node->attribute('path');
        foreach ($path as $item) {
            if (in_array($item->attribute('class_identifier'), $identifiers)) {
                $dataMap = $item->attribute('data_map');
                if (isset($dataMap['link']) && $dataMap['link']->hasContent()) {
                    if ($dataMap['link']->Content() !== "http://" . eZSys::hostname() . '/') {
                        header('Location: ' . $dataMap['link']->Content() . 'content/view/full/' . $nodeID);
                    }
                }
            }
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}
eZWorkflowEventType::registerEventType(eZRedirectSubisteType::WORKFLOW_TYPE_STRING, 'eZRedirectSubisteType');
예제 #23
0
class eZPageSwapType extends eZWorkflowEventType
{
    const WORKFLOW_TYPE_STRING = 'ezpageswap';
    function __construct()
    {
        parent::__construct(self::WORKFLOW_TYPE_STRING, ezpI18n::tr('kernel/workflow/event', 'eZ Page swap workflow event'));
        $this->setTriggerTypes(array('content' => array('swap' => array('after'))));
    }
    function execute($process, $event)
    {
        $parameters = $process->attribute('parameter_list');
        $oldNodeID = $parameters['node_id'];
        $newNodeID = $parameters['selected_node_id'];
        // Fetch blocks which require node_id update
        $oldNodeBlocks = eZFlowBlock::fetchObjectList(eZFlowBlock::definition(), null, array('node_id' => $oldNodeID));
        $newNodeBlocks = eZFlowBlock::fetchObjectList(eZFlowBlock::definition(), null, array('node_id' => $newNodeID));
        // Loop over fetched blocks for old node and update node_id with new value
        foreach ($oldNodeBlocks as $oldNodeBlock) {
            $oldNodeBlock->setAttribute('node_id', $newNodeID);
            $oldNodeBlock->store();
        }
        // Loop over fetched blocks for new node and update node_id with new value
        foreach ($newNodeBlocks as $newNodeBlock) {
            $newNodeBlock->setAttribute('node_id', $oldNodeID);
            $newNodeBlock->store();
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}
eZWorkflowEventType::registerEventType(eZPageSwapType::WORKFLOW_TYPE_STRING, 'eZPageSwapType');
예제 #24
0
        $filterArray = $ini->variable("Classes", 'ClassFilterArray');
        $parameters = $process->attribute('parameter_list');
        $publishedObject = ezContentObject::fetch($parameters["object_id"]);
        if (!is_object($publishedObject)) {
            $this->cleanUp();
            //eZDebug::writeDebug( "Couldn't find the current Object", "VarnishWorkflow" );
            //return eZWorkflowType::STATUS_REJECTED;
        } else {
            $objectClass = $publishedObject->attribute("class_identifier");
            if ($filterType == "include") {
                if (in_array($objectClass, $filterArray) || empty($filterArray)) {
                    $this->cleanUp();
                }
            } else {
                if (!in_array($objectClass, $filterArray) || empty($filterArray)) {
                    $this->cleanUp();
                }
            }
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
    function cleanUp()
    {
        $ini = eZINI::instance("all2evarnish.ini");
        $blocknames = $ini->variable("WorkflowSettings", "VarnishDomains");
        $varnish = new all2eVarnish();
        $varnish->purgeDomain($blocknames);
    }
}
eZWorkflowEventType::registerEventType(varnishType::WORKFLOW_TYPE_STRING, varnishType::WORKFLOW_TYPE_CLASS);
            foreach ( $orderItems as $orderItem )
            {
                if ( $orderItem->attribute( 'type' ) == 'ezsimpleshipping' )
                {
                    $addShipping = false;
                    break;
                }
            }
            if ( $addShipping )
            {
                $productCollection = $order->attribute( 'productcollection' );
                $orderCurrency = $productCollection->attribute( 'currency_code' );

                $cost = eZShopFunctions::convertAdditionalPrice( $orderCurrency, $cost );

                $orderItem = new eZOrderItem( array( 'order_id' => $orderID,
                                                     'description' => $description,
                                                     'price' => $cost,
                                                     'type' => 'ezsimpleshipping' )
                                              );
                $orderItem->store();
            }
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}

eZWorkflowEventType::registerEventType( eZSimpleShippingType::WORKFLOW_TYPE_STRING, "eZSimpleShippingType" );

?>
예제 #26
0
<?php

class sCacheCookieType extends eZWorkflowEventType
{
    const WORKFLOW_TYPE_STRING = 'scachecookie';
    const WORKFLOW_TYPE_CLASS = 'sCacheCookieType';
    const WORKFLOW_TYPE_DESC = 'Update Cache Cookie';
    function __construct()
    {
        $this->eZWorkflowEventType(self::WORKFLOW_TYPE_STRING, self::WORKFLOW_TYPE_DESC);
        $this->setTriggerTypes(array('user' => array('preferences' => array('before', 'after')), 'shop' => array('addtobasket' => array('before', 'after'), 'updatebasket' => array('before', 'after'))));
    }
    function execute($process, $event)
    {
        sCacheCookieHelper::setCookie();
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}
eZWorkflowEventType::registerEventType(sCacheCookieType::WORKFLOW_TYPE_STRING, sCacheCookieType::WORKFLOW_TYPE_CLASS);
            if( !$doc->loadXML( $xml ) )
            {
                eZDebug::writeError( "Cannot parse XML", "eZXMLPublisherType::execute" );
                return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
            }

            $xmlInstaller = new eZXMLInstaller( $doc );

            if (! $xmlInstaller->proccessXML() )
            {
                eZDebug::writeError( "Cannot proccess XML", "eZXMLPublisherType::execute" );
                return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
            }

            return eZWorkflowType::STATUS_ACCEPTED;
        }
        // otherwise we need only to enable, disable the selected features.
        else
        {
        }


        return eZWorkflowType::STATUS_ACCEPTED;
    }
}


eZWorkflowEventType::registerEventType( 'ezxmlpublisher', 'eZXMLPublisherType' );

?>
                // smart-cache enabled version
                // get list of nodes whose view-cache is expired
                $assigned_nodes = array();
                eZContentCacheManager::nodeListForObject($object, true, eZContentCacheManager::CLEAR_DEFAULT, $assigned_nodes, $handledObjectList);
                foreach ($assigned_nodes as $i => $nodeID) {
                    $assigned_nodes[$i] = eZContentObjectTreeNode::fetch($nodeID);
                }
            }
            $domains = $ini->variable('ExpireRemoteCacheFlowSettings', 'ExpireDomains');
            foreach ($assigned_nodes as $assigned_node) {
                // for every node, call eZHTTPCacheManager to clean the remote cache
                $url = $assigned_node->urlAlias();
                if (is_array($domains) && (count($domains) > 1 || count($domains) > 0 && $domains[0] != '')) {
                    eZURI::transformURI($url);
                    foreach ($domains as $domain) {
                        eZHTTPCacheManager::execute($domain . $url);
                    }
                } else {
                    eZURI::transformURI($url, false, 'full');
                    eZHTTPCacheManager::execute($url);
                }
            }
        } else {
            eZDebug::writeError('Expire remote cache event triggered for inexisting object: ' . $objectId);
            return eZWorkflowType::STATUS_WORKFLOW_CANCELLED;
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
}
eZWorkflowEventType::registerEventType(expireremotecacheflowType::WORKFLOW_TYPE_STRING, 'expireremotecacheflowtype');
예제 #29
0
            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( eZApproveType::WORKFLOW_TYPE_STRING, "eZApproveType" );

?>
        $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;
    }
}

eZWorkflowEventType::registerEventType( mySelectionRemoveWorkflowType::WORKFLOW_TYPE_STRING, "mySelectionRemoveWorkflowType" );