[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/shop/ -> status.php (source)

   1  <?php
   2  //
   3  // Created on: <07-Nov-2005 18:07:10 jhe>
   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/common/template.php" );
  28  include_once ( "kernel/classes/ezorderstatus.php" );
  29  include_once ( "lib/ezutils/classes/ezhttppersistence.php" );
  30  
  31  $module =& $Params["Module"];
  32  $http =& eZHttpTool::instance();
  33  $messages = array();
  34  
  35  if ( $http->hasPostVariable( "SaveOrderStatusButton" ) or
  36       $http->hasPostVariable( "AddOrderStatusButton" ) or
  37       $http->hasPostVariable( "RemoveOrderStatusButton" ) )
  38  {
  39      $orderStatusArray = eZOrderStatus::fetchList( true, true );
  40      foreach ( $orderStatusArray as $orderStatus )
  41      {
  42          $id = $orderStatus->attribute( 'id' );
  43          if ( $http->hasPostVariable( "orderstatus_name_" . $id ) )
  44          {
  45              $orderStatus->setAttribute( 'name', $http->postVariable( "orderstatus_name_" . $id ) );
  46          }
  47          // Only check the checkbox value if the has_input variable is set
  48          if ( $http->hasPostVariable( "orderstatus_active_has_input_" . $id ) )
  49          {
  50              $orderStatus->setAttribute( 'is_active', $http->hasPostVariable( "orderstatus_active_" . $id ) );
  51          }
  52          $orderStatus->sync();
  53      }
  54  
  55      eZOrderStatus::flush();
  56  }
  57  
  58  if ( $http->hasPostVariable( "AddOrderStatusButton" ) )
  59  {
  60      $orderStatus = eZOrderStatus::create();
  61      $orderStatus->storeCustom();
  62      $messages[] = array( 'description' => ezi18n( 'kernel/shop', 'New order status was successfully added.' ) );
  63  }
  64  
  65  if ( $http->hasPostVariable( "SaveOrderStatusButton" ) )
  66  {
  67      $messages[] = array( 'description' => ezi18n( 'kernel/shop', 'Changes to order status were successfully stored.' ) );
  68  }
  69  
  70  if ( $http->hasPostVariable( "RemoveOrderStatusButton" ) )
  71  {
  72      $orderStatusIDList = array();
  73      if ( $http->hasPostVariable( 'orderStatusIDList' ) )
  74          $orderStatusIDList = $http->postVariable( "orderStatusIDList" );
  75  
  76      $hasRemoved = false;
  77      $triedRemoveInternal = false;
  78      foreach ( $orderStatusIDList as $orderStatusID )
  79      {
  80          $status = eZOrderStatus::fetch( $orderStatusID );
  81          // Internal status items must not be removed
  82          if ( $status->isInternal() )
  83          {
  84              $triedRemoveInternal = true;
  85              continue;
  86          }
  87          $status->remove();
  88          $hasRemoved = true;
  89      }
  90      if ( $hasRemoved )
  91          $messages[] = array( 'description' => ezi18n( 'kernel/shop', 'Selected order statuses were successfully removed.' ) );
  92      if ( $triedRemoveInternal )
  93          $messages[] = array( 'description' => ezi18n( 'kernel/shop', 'Internal orders cannot be removed.' ) );
  94  }
  95  
  96  $orderStatusArray = eZOrderStatus::fetchList( true, true );
  97  
  98  $tpl =& templateInit();
  99  $tpl->setVariable( "orderstatus_array", $orderStatusArray );
 100  $tpl->setVariable( "module", $module );
 101  $tpl->setVariable( "messages", $messages );
 102  
 103  $path = array();
 104  $path[] = array( 'text' => ezi18n( 'kernel/shop', 'Order list' ),
 105                   'url' => 'shop/orderlist' );
 106  $path[] = array( 'text' => ezi18n( 'kernel/shop', 'Status' ),
 107                   'url' => false );
 108  
 109  $Result = array();
 110  $Result['path'] =& $path;
 111  $Result['content'] =& $tpl->fetch( "design:shop/status.tpl" );
 112  
 113  ?>


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