[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/workflow/ -> grouplist.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  include_once ( "kernel/classes/ezworkflow.php" );
  28  include_once ( "kernel/classes/eztrigger.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  function removeSelectedGroups( &$http, &$groups, $base )
  34  {
  35      if ( $http->hasPostVariable( "DeleteGroupButton" ) )
  36      {
  37          if ( eZHttpPersistence::splitSelected( $base,
  38                                                 $groups, $http, "id",
  39                                                 $keepers, $rejects ) )
  40          {
  41              $groups = $keepers;
  42              for ( $i = 0; $i < count( $rejects ); ++$i )
  43              {
  44                  $reject =& $rejects[$i];
  45                  $group_id = $reject->attribute("id");
  46  
  47                  // Remove all workflows in current group
  48                  $list_in_group = & eZWorkflowGroupLink::fetchWorkflowList( 0, $group_id, $asObject = true);
  49                  $workflow_list =  eZWorkflow::fetchList( );
  50  
  51                  $list = array();
  52                  for ( $k=0; $k<count( $workflow_list ); $k++ )
  53                  {
  54                      for ( $j=0;$j<count( $list_in_group );$j++ )
  55                      {
  56                          $id =  $workflow_list[$k]->attribute("id");
  57                          $workflow_id =  $list_in_group[$j]->attribute("workflow_id");
  58                          if ( $id === $workflow_id )
  59                          {
  60                              $list[] =& $workflow_list[$k];
  61                          }
  62                      }
  63                  }
  64                  foreach ( $list as $workFlow )
  65                  {
  66                    eZTrigger::removeTriggerForWorkflow( $workFlow->attribute( 'id' ) );
  67                    $workFlow->remove();
  68                  }
  69  
  70                  $reject->remove( );
  71                  eZWorkflowGroupLink::removeGroupMembers( $group_id );
  72              }
  73          }
  74      }
  75  }
  76  
  77  $Module =& $Params["Module"];
  78  
  79  $http =& eZHttpTool::instance();
  80  
  81  if ( $http->hasPostVariable( "EditGroupButton" ) && $http->hasPostVariable( "EditGroupID" ) )
  82  {
  83      $Module->redirectTo( $Module->functionURI( "groupedit" ) . "/" . $http->postVariable( "EditGroupID" ) );
  84      return;
  85  }
  86  
  87  if ( $http->hasPostVariable( "NewGroupButton" ) )
  88  {
  89      $params = array();
  90  
  91      $Module->redirectTo( $Module->functionURI( "groupedit" ) );
  92      return;
  93  }
  94  
  95  $sorting = null;
  96  
  97  if ( !isset( $TemplateData ) or !is_array( $TemplateData ) )
  98  {
  99      $TemplateData = array( array( "name" => "groups",
 100                                    "http_base" => "ContentClass",
 101                                    "data" => array( "command" => "group_list",
 102                                                     "type" => "class" ) ) );
 103  }
 104  
 105  $Module->setTitle( ezi18n( 'kernel/workflow', 'Workflow group list' ) );
 106  include_once ( "kernel/common/template.php" );
 107  $tpl =& templateInit();
 108  
 109  include_once ( "kernel/classes/datatypes/ezuser/ezuser.php" );
 110  $user =& eZUser::currentUser();
 111  foreach( $TemplateData as $tpldata )
 112  {
 113      $tplname = $tpldata["name"];
 114      $data = $tpldata["data"];
 115      $asObject = isset( $data["as_object"] ) ? $data["as_object"] : true;
 116      $base = $tpldata["http_base"];
 117      unset( $list );
 118      $list = eZWorkflowGroup::fetchList( $asObject );
 119      removeSelectedGroups( $http, $list, $base );
 120      $tpl->setVariable( $tplname, $list );
 121  }
 122  
 123  $tpl->setVariable( "module", $Module );
 124  
 125  $Result = array();
 126  $Result['content'] =& $tpl->fetch( "design:workflow/grouplist.tpl" );
 127  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/workflow', 'Workflow' ),
 128                                  'url' => false ),
 129                           array( 'text' => ezi18n( 'kernel/workflow', 'Group list' ),
 130                                  'url' => false ) );
 131  
 132  
 133  ?>


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