当前位置: 首页>>代码示例>>PHP>>正文


PHP eZWorkflow::create方法代码示例

本文整理汇总了PHP中eZWorkflow::create方法的典型用法代码示例。如果您正苦于以下问题:PHP eZWorkflow::create方法的具体用法?PHP eZWorkflow::create怎么用?PHP eZWorkflow::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZWorkflow的用法示例。


在下文中一共展示了eZWorkflow::create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

            $db->commit();
        }
        else
        {
            eZDebug::writeError( "Cannot fetch workflow with WorkfowID = " . $WorkflowID );
            $Module->setExitStatus( eZModule::STATUS_FAILED );
            return;
        }
    }
}
else
{
    // if WorkflowID was not given then create new workflow
    $user = eZUser::currentUser();
    $user_id = $user->attribute( "contentobject_id" );
    $workflow = eZWorkflow::create( $user_id );
    $workflowCount = eZWorkflow::fetchListCount();
    ++$workflowCount;
    $workflow->setAttribute( "name", ezpI18n::tr( 'kernel/workflow/edit', "New Workflow" ) . "$workflowCount" );

    $db = eZDB::instance();
    $db->begin();
    $workflow->store();
    $WorkflowID = $workflow->attribute( "id" );
    $WorkflowVersion = $workflow->attribute( "version" );
    $ingroup = eZWorkflowGroupLink::create( $WorkflowID, $WorkflowVersion, $GroupID, $GroupName );
    $ingroup->store();
    $db->commit();
    return $Module->redirectTo( $Module->functionURI( 'edit' ) . '/' . $WorkflowID . '/' . $GroupID );
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:30,代码来源:edit.php

示例2: createWorkFlow

 /**
  * Creates the test workflow.
  * @todo Currently only handles the fetchtemplaterepeat event. Will have to be
  *       refactored to handle more events when necessary
  *
  * @return eZWorkflow
  */
 function createWorkFlow($adminUserID)
 {
     $registerResult = $this->registerCustomWorkflowEvent('fetchtemplaterepeat', 'tests/toolkit/extras/tests-files/workflowevent_regression_fetchtemplaterepeat.php');
     if ($registerResult == false) {
         $this->markTestSkipped("Unable to register the workflow event");
     }
     $workflow = eZWorkflow::create($adminUserID);
     $workflow->setAttribute("name", "eZWorkflowEventRegression Workflow");
     $workflow->store();
     $workflowID = $workflow->attribute("id");
     $workflowVersion = $workflow->attribute("version");
     $groupID = 1;
     $groupName = "Standard";
     $ingroup = eZWorkflowGroupLink::create($workflowID, $workflowVersion, $groupID, $groupName);
     $ingroup->store();
     $regressionEvent = eZWorkflowEvent::create($workflowID, "event_fetchtemplaterepeat");
     $regressionEventType = $regressionEvent->eventType();
     $regressionEventType->initializeEvent($regressionEvent);
     $regressionEvent->store();
     $eventList = array($regressionEvent);
     $workflow->store($eventList);
     eZWorkflowGroupLink::removeWorkflowMembers($workflowID, 0);
     $workflowgroups = eZWorkflowGroupLink::fetchGroupList($workflowID, 1);
     foreach ($workflowgroups as $workflowgroup) {
         $workflowgroup->setAttribute("workflow_version", 0);
         $workflowgroup->store();
     }
     // Remove version 1
     eZWorkflowGroupLink::removeWorkflowMembers($workflowID, 1);
     // eZWorkflow::removeEvents( false, $workflowID, 0 );
     eZWorkflow::removeEvents(false, $workflowID, 1);
     eZWorkflow::removeWorkflow($workflowID, 1);
     $workflow->setVersion(0, $eventList);
     $workflow->adjustEventPlacements($eventList);
     $workflow->storeDefined($eventList);
     $workflow->cleanupWorkFlowProcess();
     $workflow->store($eventList);
     return $workflow;
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:46,代码来源:ezworkflowevent_regression.php

示例3: createApprovalWorkFlow

 function createApprovalWorkFlow($approvalUserID)
 {
     $workflow = eZWorkflow::create($approvalUserID);
     $workflow->setAttribute("name", "eZApproveTypeRegression Workflow");
     $workflow->store();
     $workflowID = $workflow->attribute("id");
     $workflowVersion = $workflow->attribute("version");
     $groupID = 1;
     $groupName = "Standard";
     $ingroup = eZWorkflowGroupLink::create($workflowID, $workflowVersion, $groupID, $groupName);
     $ingroup->store();
     $approveEvent = eZWorkflowEvent::create($workflowID, "event_ezapprove");
     $approveEventType = $approveEvent->eventType();
     $approveEventType->initializeEvent($approveEvent);
     // Affected sections, -1 == All sections
     $approveEvent->setAttribute("data_text1", "-1");
     // Affected languages, 0 == All languages
     $approveEvent->setAttribute("data_int2", 0);
     // Affected versions
     $approveEvent->setAttribute("data_int3", eZApproveType::VERSION_OPTION_ALL);
     // Editors
     $approveEvent->setAttribute("data_text3", $approvalUserID);
     $approveEvent->store();
     $eventList = array($approveEvent);
     $workflow->store($eventList);
     eZWorkflowGroupLink::removeWorkflowMembers($workflowID, 0);
     $workflowgroups = eZWorkflowGroupLink::fetchGroupList($workflowID, 1);
     foreach ($workflowgroups as $workflowgroup) {
         $workflowgroup->setAttribute("workflow_version", 0);
         $workflowgroup->store();
     }
     // Remove version 1
     eZWorkflowGroupLink::removeWorkflowMembers($workflowID, 1);
     eZWorkflow::removeEvents(false, $workflowID, 0);
     $workflow->setVersion(0, $eventList);
     $workflow->adjustEventPlacements($eventList);
     $workflow->storeDefined($eventList);
     $workflow->cleanupWorkFlowProcess();
     $workflow->store($eventList);
     return $workflow;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:41,代码来源:ezapprovetype_regression.php

示例4: execute

    function execute( $xml )
    {
        $workflowGroupList = $xml->getElementsByTagName( 'WorkflowGroup' );
        $user              = eZUser::currentUser();
        $userID            = $user->attribute( "contentobject_id" );

        foreach ( $workflowGroupList as $workflowGroupNode )
        {
            $groupName        = $workflowGroupNode->getAttribute( 'name' );
            $referenceID      = $workflowGroupNode->getAttribute( 'referenceID' );
            $groupExistAction = $workflowGroupNode->getAttribute( 'groupExistAction' );
            $workflowGroup    = null;

            if ( $groupExistAction == 'keep' )
            {
                $workflowGroupList = eZWorkflowGroup::fetchList();
                foreach ( $workflowGroupList as $workflowGroupItem )
                {
                    if ( $workflowGroupItem->attribute( 'name' ) == $groupName )
                    {
                        $workflowGroup = $workflowGroupItem;
                        break;
                    }
                }
            }
            if ( $workflowGroup !== null )
            {
                $this->writeMessage( "\tWorkflow Group '$groupName' already exists." , 'notice' );
            }
            else
            {
                $this->writeMessage( "\tWorkflow Group '$groupName' will be created." , 'notice' );
                $workflowGroup = eZWorkflowGroup::create( $userID );
                $workflowGroup->setAttribute( "name", $groupName );
                $workflowGroup->store();
            }

            $WorkflowGroupID = $workflowGroup->attribute( "id" );
            $refArray        = array();

            if ( $referenceID )
            {
                $refArray[$referenceID] = $WorkflowGroupID;
            }
            $this->addReference( $refArray );

            $workflowList = $workflowGroupNode->getElementsByTagName( 'Workflow' );
            foreach ( $workflowList as $workflowNode )
            {
                $refArray = array();

                $workflowName        = $workflowNode->getAttribute( 'name' );
                $workflowTypeString  = $workflowNode->getAttribute( 'workflowTypeString' );
                $referenceID         = $workflowNode->getAttribute( 'referenceID' );
                $workflowExistAction = $workflowNode->getAttribute( 'workflowExistAction' );
                $WorkflowID          = $workflowNode->getAttribute( 'id' );
                $workflow            = null;
                $hasWorkflowDraft    = false;
                $db                  = eZDB::instance();

                if ( !$workflowExistAction )
                {
                    $workflowExistAction = 'extend';
                }

                if ( $WorkflowID )
                {
                    $workflow = eZWorkflow::fetch( $WorkflowID, true, 1 );
                    if ( !is_object( $workflow ) )
                    {
                        $workflow = eZWorkflow::fetch( $WorkflowID, true, 0 );
                        if ( is_object( $workflow ) )
                        {
                            $workflowGroups = eZWorkflowGroupLink::fetchGroupList( $WorkflowID, 0, true );

                            $db->begin();
                            foreach ( $workflowGroups as $workflowGroup )
                            {
                                $groupID   = $workflowGroup->attribute( "group_id" );
                                $groupName = $workflowGroup->attribute( "group_name" );
                                $ingroup   = eZWorkflowGroupLink::create( $WorkflowID, 1, $groupID, $groupName );

                                $ingroup->store();
                            }
                            $db->commit();

                        }
                        else
                        {
                            $this->writeMessage( "\tFailed to fetch workflow with ID '$WorkflowID'." , 'notice' );
                            $workflow = null;
                        }
                    }
                }

                $db->begin();

                if ( $workflow === null )
                {
                    $this->writeMessage( "\tWorkflow '$workflowName' will be created." , 'notice' );
//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezcreateworkflow.php


注:本文中的eZWorkflow::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。