[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

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

   1  <?php
   2  //
   3  // Created on: <01-Aug-2002 10:40:10 bf>
   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/ezorder.php' );
  29  include_once ( 'kernel/classes/ezorderstatus.php' );
  30  include_once ( 'kernel/classes/ezpreferences.php' );
  31  
  32  $module =& $Params['Module'];
  33  
  34  $tpl =& templateInit();
  35  
  36  $offset = $Params['Offset'];
  37  $limit = 15;
  38  
  39  
  40  if( eZPreferences::value( 'admin_orderlist_sortfield' ) )
  41  {
  42      $sortField = eZPreferences::value( 'admin_orderlist_sortfield' );
  43  }
  44  
  45  if ( !isset( $sortField ) || ( ( $sortField != 'created' ) && ( $sortField!= 'user_name' ) ) )
  46  {
  47      $sortField = 'created';
  48  }
  49  
  50  if( eZPreferences::value( 'admin_orderlist_sortorder' ) )
  51  {
  52      $sortOrder = eZPreferences::value( 'admin_orderlist_sortorder' );
  53  }
  54  
  55  if ( !isset( $sortOrder ) || ( ( $sortOrder != 'asc' ) && ( $sortOrder!= 'desc' ) ) )
  56  {
  57      $sortOrder = 'asc';
  58  }
  59  
  60  $http =& eZHttpTool::instance();
  61  
  62  // The RemoveButton is not present in the orderlist, but is here for backwards
  63  // compatibility. Simply replace the ArchiveButton for the RemoveButton will
  64  // do the trick.
  65  //
  66  // Note that removing order can cause wrong order numbers (order_nr are
  67  // reused).  See eZOrder::activate.
  68  if ( $http->hasPostVariable( 'RemoveButton' ) )
  69  {
  70      if ( $http->hasPostVariable( 'OrderIDArray' ) )
  71      {
  72          $orderIDArray = $http->postVariable( 'OrderIDArray' );
  73          if ( $orderIDArray !== null )
  74          {
  75              $http->setSessionVariable( 'DeleteOrderIDArray', $orderIDArray );
  76              $Module->redirectTo( $Module->functionURI( 'removeorder' ) . '/' );
  77          }
  78      }
  79  }
  80  
  81  // Archive options.
  82  if ( $http->hasPostVariable( 'ArchiveButton' ) )
  83  {
  84      if ( $http->hasPostVariable( 'OrderIDArray' ) )
  85      {
  86          $orderIDArray = $http->postVariable( 'OrderIDArray' );
  87          if ( $orderIDArray !== null )
  88          {
  89              $http->setSessionVariable( 'OrderIDArray', $orderIDArray );
  90              $Module->redirectTo( $Module->functionURI( 'archiveorder' ) . '/' );
  91          }
  92      }
  93  }
  94  
  95  if ( $http->hasPostVariable( 'SaveOrderStatusButton' ) )
  96  {
  97      if ( $http->hasPostVariable( 'StatusList' ) )
  98      {
  99          foreach ( $http->postVariable( 'StatusList' ) as $orderID => $statusID )
 100          {
 101              $order = eZOrder::fetch( $orderID );
 102              $access = $order->canModifyStatus( $statusID );
 103              if ( $access and $order->attribute( 'status_id' ) != $statusID )
 104              {
 105                  $order->modifyStatus( $statusID );
 106              }
 107          }
 108      }
 109  }
 110  
 111  $orderArray =& eZOrder::active( true, $offset, $limit, $sortField, $sortOrder );
 112  $orderCount = eZOrder::activeCount( $offset, $limit );
 113  
 114  $tpl->setVariable( 'order_list', $orderArray );
 115  $tpl->setVariable( 'order_list_count', $orderCount );
 116  $tpl->setVariable( 'limit', $limit );
 117  
 118  $viewParameters = array( 'offset' => $offset );
 119  $tpl->setVariable( 'view_parameters', $viewParameters );
 120  $tpl->setVariable( 'sort_field', $sortField );
 121  $tpl->setVariable( 'sort_order', $sortOrder );
 122  
 123  $path = array();
 124  $path[] = array( 'text' => ezi18n( 'kernel/shop', 'Order list' ),
 125                   'url' => false );
 126  
 127  $Result = array();
 128  $Result['path'] =& $path;
 129  
 130  $Result['content'] =& $tpl->fetch( 'design:shop/orderlist.tpl' );
 131  ?>


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