[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/workflow/ -> process.php (source)

   1  <?php
   2  //
   3  // Created on: <01-Jul-2002 17:06:14 amos>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  $Module =& $Params["Module"];
  28  
  29  $WorkflowProcessID = null;
  30  if ( !isset( $Params["WorkflowProcessID"] ) )
  31  {
  32      $Module->redirectTo( $Module->functionURI( "list" ) );
  33      return;
  34  }
  35  
  36  $WorkflowProcessID = $Params["WorkflowProcessID"];
  37  
  38  include_once ( "kernel/classes/ezworkflowprocess.php" );
  39  
  40  $process = eZWorkflowProcess::fetch( $WorkflowProcessID );
  41  if ( $process === null )
  42  {
  43      $Module->redirectTo( $Module->functionURI( "list" ) );
  44      return;
  45  }
  46  
  47  include_once ( "lib/ezutils/classes/ezhttptool.php" );
  48  $http =& eZHTTPTool::instance();
  49  
  50  if ( $http->hasPostVariable( "Reset" ) )
  51  {
  52      $process->reset();
  53      $process->setAttribute( "modified", time() );
  54      $process->store();
  55  }
  56  
  57  // Template handling
  58  include_once ( "kernel/common/template.php" );
  59  $tpl =& templateInit();
  60  
  61  include_once ( "kernel/classes/ezworkflow.php" );
  62  $workflow = eZWorkflow::fetch( $process->attribute( "workflow_id" ) );
  63  $workflowEvent = false;
  64  if ( $process->attribute( "event_id" ) != 0 )
  65      $workflowEvent = eZWorkflowEvent::fetch( $process->attribute( "event_id" ) );
  66  
  67  $lastEventStatus = $process->attribute( "last_event_status" );
  68  
  69  if ( $http->hasPostVariable( "RunProcess" ) )
  70  {
  71  //     $Module->redirectTo( $Module->functionURI( "process" ) . "/" . $WorkflowProcessID );
  72  //     return;
  73      if ( get_class( $workflowEvent ) == "ezworkflowevent" )
  74      {
  75          $eventType =& $workflowEvent->eventType();
  76          $lastEventStatus = $eventType->execute( $process, $workflowEvent );
  77      }
  78      $event_pos = $process->attribute( "event_position" );
  79      $next_event_pos = $event_pos + 1;
  80      $next_event_id = $workflow->fetchEventIndexed( $next_event_pos );
  81      if ( $next_event_id !== null )
  82      {
  83          $process->advance( $next_event_id, $next_event_pos, $lastEventStatus  );
  84          $workflowEvent = eZWorkflowEvent::fetch( $next_event_id );
  85      }
  86      else
  87      {
  88          unset( $workflowEvent );
  89          $workflowEvent = false;
  90          $process->advance();
  91      }
  92      $process->setAttribute( "modified", time() );
  93      $process->store();
  94  }
  95  $tpl->setVariable( "event_status", eZWorkflowType::statusName( $lastEventStatus ) );
  96  $tpl->setVariable( "current_workflow", $workflow );
  97  $tpl->setVariable( "current_event", $workflowEvent );
  98  
  99  $Module->setTitle( "Workflow process" );
 100  
 101  $tpl->setVariable( "process", $process );
 102  $tpl->setVariable( "module", $Module );
 103  $tpl->setVariable( "http", $http );
 104  
 105  $Result = array();
 106  $Result['content'] =& $tpl->fetch( "design:workflow/process.tpl" );
 107  
 108  
 109  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7