[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Created on: <16-Apr-2002 11:00:12 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  
  28  include_once ( 'kernel/classes/ezworkflow.php' );
  29  include_once ( 'kernel/classes/ezworkflowgroup.php' );
  30  include_once ( "kernel/classes/ezworkflowgrouplink.php" );
  31  include_once ( 'lib/ezutils/classes/ezhttppersistence.php' );
  32  
  33  $Module =& $Params['Module'];
  34  $WorkflowGroupID = null;
  35  if ( isset( $Params["GroupID"] ) )
  36      $WorkflowGroupID =& $Params["GroupID"];
  37  
  38  // include_once( 'lib/ezutils/classes/ezexecutionstack.php' );
  39  // $execStack =& eZExecutionStack::instance();
  40  // $execStack->clear();
  41  // $execStack->addEntry( $Module->functionURI( 'list' ),
  42  //                       $Module->attribute( 'name' ), 'list' );
  43  
  44  $http =& eZHTTPTool::instance();
  45  
  46  if ( $http->hasPostVariable( 'NewWorkflowButton' ) )
  47  {
  48      if ( $http->hasPostVariable( "CurrentGroupID" ) )
  49          $GroupID = $http->postVariable( "CurrentGroupID" );
  50      if ( $http->hasPostVariable( "CurrentGroupName" ) )
  51          $GroupName = $http->postVariable( "CurrentGroupName" );
  52      $params = array( null, $GroupID, $GroupName );
  53      $Module->run( 'edit', $params );
  54      return;
  55  }
  56  
  57  if ( $http->hasPostVariable( 'DeleteButton' ) and
  58       $http->hasPostVariable( 'Workflow_id_checked' ) )
  59  {
  60      if ( $http->hasPostVariable( 'CurrentGroupID' ) )
  61      {
  62          // If CurrentGroupID variable exist, delete in that group only:
  63          $groupID = $http->postVariable( 'CurrentGroupID' );
  64          $workflowIDs = $http->postVariable( 'Workflow_id_checked' );
  65          foreach ( $workflowIDs as $workflowID )
  66          {
  67              // for all workflows which are tagged for deleting:
  68              $workflow = eZWorkflow::fetch( $workflowID );
  69              if ( $workflow )
  70              {
  71                  $workflowInGroups = $workflow->attribute( 'ingroup_list' );
  72                  if ( count( $workflowInGroups ) == 1 )
  73                  {
  74                      //remove entry from eztrigger table also, if it exists there.
  75                      include_once ( "kernel/classes/eztrigger.php" );
  76                      eZTrigger::removeTriggerForWorkflow( $workflowID );
  77  
  78                      // if there is only one group which the workflow belongs to, delete (=disable) it:
  79                      eZWorkflow::setIsEnabled( false, $workflowID );
  80                  }
  81                  else
  82                  {
  83                      // if there is more than 1 group, remove only from the group:
  84                      include_once ( "kernel/workflow/ezworkflowfunctions.php" );
  85  
  86                      eZWorkflowFunctions::removeGroup( $workflowID, 0, array( $groupID ) );
  87                  }
  88              
  89              }
  90              else
  91              {
  92                  // just for sure :-)
  93                  eZWorkflow::setIsEnabled( false, $workflowID );
  94              }
  95          }
  96      }
  97      else
  98      {
  99          // if there is no CurrentGroupID variable, disable every group in variable Workflow_id_checked:
 100          eZWorkflow::setIsEnabled( false, $http->postVariable( 'Workflow_id_checked' ) );
 101      }
 102  }
 103  
 104  if ( $http->hasPostVariable( 'DeleteButton' ) and
 105       $http->hasPostVariable( 'Temp_Workflow_id_checked' ) )
 106  {
 107      $checkedIDs = $http->postVariable( 'Temp_Workflow_id_checked' );
 108      foreach ( $checkedIDs as $checkedID )
 109      {
 110          eZWorkflow::removeWorkflow( $checkedID, 1 );
 111          eZWorkflowGroupLink::removeWorkflowMembers( $checkedID, 1 );
 112      }
 113  }
 114  
 115  /*$workflows = eZWorkflow::fetchList();
 116  $workflowList = array();
 117  foreach( array_keys( $workflows ) as $workflowID )
 118  {
 119      $workflow =& $workflows[$workflowID];
 120      $workflowList[$workflow->attribute( 'id' )] =& $workflow;
 121  }
 122  */
 123  include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" );
 124  $user =& eZUser::currentUser();
 125  
 126  $list_in_group = & eZWorkflowGroupLink::fetchWorkflowList( 0, $WorkflowGroupID, $asObject = true);
 127  
 128  $workflow_list =  eZWorkflow::fetchList( );
 129  
 130  $list = array();
 131  for ( $i=0;$i<count( $workflow_list );$i++ )
 132  {
 133      for ( $j=0;$j<count( $list_in_group );$j++ )
 134      {
 135          $id =  $workflow_list[$i]->attribute("id");
 136          $workflow_id =  $list_in_group[$j]->attribute("workflow_id");
 137          if ( $id === $workflow_id )
 138          {
 139              $list[] =& $workflow_list[$i];
 140          }
 141      }
 142  }
 143  
 144  $templist_in_group = & eZWorkflowGroupLink::fetchWorkflowList( 1, $WorkflowGroupID, $asObject = true);
 145  $tempworkflow_list =  eZWorkflow::fetchList( 1 );
 146  
 147  $temp_list =array();
 148  for ( $i=0;$i<count( $tempworkflow_list );$i++ )
 149  {
 150      for ( $j=0;$j<count( $templist_in_group );$j++ )
 151      {
 152          $id =  $tempworkflow_list[$i]->attribute("id");
 153          $workflow_id =  $templist_in_group[$j]->attribute("workflow_id");
 154          if ( $id === $workflow_id )
 155          {
 156              $temp_list[] =& $tempworkflow_list[$i];
 157          }
 158      }
 159  }
 160  
 161  $Module->setTitle( ezi18n( 'kernel/workflow', 'Workflow list of group' ) . ' ' . $WorkflowGroupID );
 162  
 163  $WorkflowgroupInfo =  eZWorkflowGroup::fetch( $WorkflowGroupID );
 164  if ( !$WorkflowgroupInfo )
 165  {
 166      return $Module->handleError( EZ_ERROR_KERNEL_NOT_AVAILABLE, 'kernel' );
 167  }
 168  
 169  include_once ( 'kernel/common/template.php' );
 170  $tpl =& templateInit();
 171  $tpl->setVariable( "temp_workflow_list", $temp_list );
 172  $tpl->setVariable( "group_id", $WorkflowGroupID );
 173  $WorkflowGroupName = $WorkflowgroupInfo->attribute("name");
 174  $tpl->setVariable( "group", $WorkflowgroupInfo );
 175  $tpl->setVariable( "group_name", $WorkflowGroupName );
 176  $tpl->setVariable( 'workflow_list', $list );
 177  $tpl->setVariable( 'module', $Module );
 178  
 179  $Result = array();
 180  $Result['content'] =& $tpl->fetch( 'design:workflow/workflowlist.tpl' );
 181  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/workflow', 'Workflow' ),
 182                                  'url' => false ),
 183                           array( 'text' => ezi18n( 'kernel/workflow', 'List' ),
 184                                  'url' => false ) );
 185  ?>


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