[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/content/ -> trash.php (source)

   1  <?php
   2  //
   3  // Definition of Trash class
   4  //
   5  // Created on: <28-Jan-2003 13:19:47 sp>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file trash.php
  30  */
  31  
  32  include_once ( 'kernel/common/template.php' );
  33  include_once ( 'kernel/classes/ezcontentobject.php' );
  34  include_once ( "lib/ezdb/classes/ezdb.php" );
  35  
  36  $Module =& $Params['Module'];
  37  $Offset = $Params['Offset'];
  38  if ( isset( $Params['UserParameters'] ) )
  39  {
  40      $UserParameters = $Params['UserParameters'];
  41  }
  42  else
  43  {
  44      $UserParameters = array();
  45  }
  46  $viewParameters = array( 'offset' => $Offset, 'namefilter' => false );
  47  $viewParameters = array_merge( $viewParameters, $UserParameters );
  48  
  49  $http =& eZHTTPTool::instance();
  50  
  51  $user =& eZUser::currentUser();
  52  $userID = $user->id();
  53  
  54  if ( $http->hasPostVariable( 'RemoveButton' )  )
  55  {
  56      if ( $http->hasPostVariable( 'DeleteIDArray' ) )
  57      {
  58          $access = $user->hasAccessTo( 'content', 'cleantrash' );
  59          if ( $access['accessWord'] == 'yes' || $access['accessWord'] == 'limited' )
  60          {
  61              $deleteIDArray = $http->postVariable( 'DeleteIDArray' );
  62  
  63              $db =& eZDB::instance();
  64              $db->begin();
  65              foreach ( $deleteIDArray as $deleteID )
  66              {
  67  
  68                  $objectList = eZPersistentObject::fetchObjectList( eZContentObject::definition(),
  69                                                                     null,
  70                                                                     array( 'id' => $deleteID ),
  71                                                                     null,
  72                                                                     null,
  73                                                                     true );
  74                  eZDebug::writeNotice( $deleteID, "deleteID" );
  75                  foreach ( array_keys( $objectList ) as $key )
  76                  {
  77                      $object =& $objectList[$key];
  78                      $object->purge();
  79                  }
  80              }
  81              $db->commit();
  82          }
  83          else
  84          {
  85              return $Module->handleError( EZ_ERROR_KERNEL_ACCESS_DENIED, 'kernel' );
  86          }
  87      }
  88  }
  89  else if ( $http->hasPostVariable( 'EmptyButton' )  )
  90  {
  91      $access = $user->hasAccessTo( 'content', 'cleantrash' );
  92      if ( $access['accessWord'] == 'yes' )
  93      {
  94          $objectList = eZPersistentObject::fetchObjectList( eZContentObject::definition(),
  95                                                             null,
  96                                                             array( 'status' => EZ_CONTENT_OBJECT_STATUS_ARCHIVED ),
  97                                                             null,
  98                                                             null,
  99                                                             true );
 100  
 101          $db =& eZDB::instance();
 102          $db->begin();
 103          foreach ( array_keys( $objectList ) as $key )
 104          {
 105              $object =& $objectList[$key];
 106              $object->purge();
 107          }
 108          $db->commit();
 109      }
 110      else
 111      {
 112          return $Module->handleError( EZ_ERROR_KERNEL_ACCESS_DENIED, 'kernel' );
 113      }
 114  }
 115  
 116  $tpl =& templateInit();
 117  $tpl->setVariable( 'view_parameters', $viewParameters );
 118  
 119  $Result = array();
 120  $Result['content'] =& $tpl->fetch( 'design:content/trash.tpl' );
 121  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/content', 'Trash' ),
 122                                  'url' => false ) );
 123  
 124  
 125  ?>


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