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 attributes()
    {
        return array_merge( array( 'sections',
                                   'languages',
                                   'users',
                                   'usergroups' ),
                            eZWorkflowEventType::attributes() );

    }
 function attribute($attr)
 {
     switch ($attr) {
         case 'state_group':
             return eZContentObjectStateGroup::fetchByOffset();
         default:
             return eZWorkflowEventType::attribute($attr);
     }
 }
 function attribute($attr)
 {
     switch ($attr) {
         case 'sections':
             $sections = eZSection::fetchList(false);
             foreach ($sections as $key => $section) {
                 $sections[$key]['Name'] = $section['name'];
                 $sections[$key]['value'] = $section['id'];
             }
             return $sections;
             break;
         case 'languages':
             return eZContentLanguage::fetchList();
             break;
     }
     return eZWorkflowEventType::attribute($attr);
 }
        $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" );
                // 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');
    {
        $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");
            foreach ($createClasses as $class => $name) {
                $result = $this->createObject($class, $parentNodeID, $name);
            }
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }
    function createObject($classIdentifier, $parentNodeID, $name)
    {
        $user = eZUser::currentUser();
        $Class = eZContentClass::fetchByIdentifier($classIdentifier);
        if (!$Class) {
            eZDebug::writeError("No class with identifier {$classIdentifier}", "classCreation");
            return false;
        }
        $contentObject = $Class->instantiate($user->attribute('contentobject_id'));
        $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => $contentObject->attribute('current_version'), 'parent_node' => $parentNodeID, 'is_main' => 1));
        $nodeAssignment->store();
        $version = $contentObject->version(1);
        $version->setAttribute('modified', eZDateTime::currentTimeStamp());
        $version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
        $version->store();
        $contentObjectID = $contentObject->attribute('id');
        $attributes = $contentObject->attribute('contentobject_attributes');
        $attributes[0]->fromString($name);
        $attributes[0]->store();
        $operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObjectID, 'version' => 1));
        return true;
    }
}
eZWorkflowEventType::registerEventType(autocreateObjectType::WORKFLOW_TYPE_STRING, "autocreateObjectType");
<?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);
예제 #10
0
 function attribute($attr)
 {
     switch ($attr) {
         case 'contentclass_list':
             return eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true);
             break;
         case 'contentclassattribute_list':
             //                $postvarname = 'WorkflowEvent' . '_event_ezwaituntildate_' .'class_' . $workflowEvent->attribute( 'id' ); and $http->hasPostVariable( $postvarname )
             if (isset($GLOBALS['eZWaitUntilDateSelectedClass'])) {
                 $classID = $GLOBALS['eZWaitUntilDateSelectedClass'];
             } else {
                 // if nothing was preselected, we will use the first one:
                 // POSSIBLE ENHANCEMENT: in the common case, the contentclass_list fetch will be called twice
                 $classList = eZWaitUntilDateType::attribute('contentclass_list');
                 if (isset($classList[0])) {
                     $classID = $classList[0]->attribute('id');
                 } else {
                     $classID = false;
                 }
             }
             if ($classID) {
                 return eZContentClassAttribute::fetchListByClassID($classID);
             }
             return array();
             break;
         case 'has_class_attributes':
             // for the backward compatibility:
             return 1;
             break;
         default:
             return eZWorkflowEventType::attribute($attr);
     }
 }
 function __construct()
 {
     parent::__construct(eZSimpleShippingType::WORKFLOW_TYPE_STRING, ezpI18n::tr('kernel/workflow/event', "Simple shipping"));
     $this->setTriggerTypes(array('shop' => array('confirmorder' => array('before'))));
 }
            $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');
예제 #13
0
 function attribute($attr)
 {
     switch ($attr) {
         case 'sections':
             $sections = eZSection::fetchList(false);
             foreach ($sections as $key => $section) {
                 $sections[$key]['Name'] = $section['name'];
                 $sections[$key]['value'] = $section['id'];
             }
             return $sections;
             break;
         case 'languages':
             return eZContentLanguage::fetchList();
             break;
         case 'usergroups':
             $groups = eZPersistentObject::fetchObjectList(eZContentObject::definition(), array('id', 'name'), array('contentclass_id' => 3, 'status' => eZContentObject::STATUS_PUBLISHED), null, null, false);
             foreach ($groups as $key => $group) {
                 $groups[$key]['Name'] = $group['name'];
                 $groups[$key]['value'] = $group['id'];
             }
             return $groups;
             break;
         case 'contentclass_list':
             $classes = eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true, false, array('name' => 'asc'));
             $classList = array();
             for ($i = 0; $i < count($classes); $i++) {
                 $classList[$i]['Name'] = $classes[$i]->attribute('name');
                 $classList[$i]['value'] = $classes[$i]->attribute('id');
             }
             return $classList;
             break;
         case 'workflow_list':
             $workflows = eZWorkflow::fetchList();
             $workflowList = array();
             for ($i = 0; $i < count($workflows); $i++) {
                 $workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
                 $workflowList[$i]['value'] = $workflows[$i]->attribute('id');
             }
             return $workflowList;
             break;
     }
     return eZWorkflowEventType::attribute($attr);
 }
 public function __construct()
 {
     parent::eZWorkflowEventType(self::EVENT_TYPE, self::EVENT_NAME);
     $this->setTriggerTypes(array('content' => array('publish' => array('after'))));
 }
 function attribute($attr)
 {
     switch ($attr) {
         case 'contentclass_list':
             return eZContentClass::fetchList(eZContentClass::VERSION_STATUS_DEFINED, true);
             break;
         default:
             return eZWorkflowEventType::attribute($attr);
     }
 }
예제 #16
0
 function storeEventData($event, $version)
 {
     $eventData = eZApprove2Event::fetch($event->attribute('id'), 1);
     switch ($version) {
         case 0:
             $eventData->publish();
             $eventData->removeDraft();
             break;
         case 1:
             $eventData->store();
             break;
     }
     eZWorkflowEventType::storeEventData($event, $version);
 }
     * @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" );
    {
        $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');
                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");
            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" );

?>
        $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');
            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' );

?>
 function attribute($attr)
 {
     switch ($attr) {
         case 'workflow_list':
             $workflows = eZWorkflow::fetchList();
             $workflowList = array();
             for ($i = 0; $i < count($workflows); $i++) {
                 $workflowList[$i]['Name'] = $workflows[$i]->attribute('name');
                 $workflowList[$i]['value'] = $workflows[$i]->attribute('id');
             }
             return $workflowList;
     }
     return eZWorkflowEventType::attribute($attr);
 }
<?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");
                }
            }
        }
        $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');
                    }
                }
            }
        } 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");
 * 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");
        $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');
 function attribute($attr)
 {
     switch ($attr) {
         case 'available_gateways':
             return $this->getGateways(array(-1));
             break;
     }
     return eZWorkflowEventType::attribute($attr);
 }
예제 #30
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);