[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/kernel/infocollector/ -> overview.php (source)

   1  <?php
   2  //
   3  // Created on: <13-Feb-2005 03:13:00 bh>
   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/ezpreferences.php' );
  29  include_once ( 'kernel/classes/ezinformationcollection.php' );
  30  
  31  $http =& eZHTTPTool::instance();
  32  $module =& $Params['Module'];
  33  $offset = $Params['Offset'];
  34  
  35  if( !is_numeric( $offset ) )
  36  {
  37      $offset = 0;
  38  }
  39  
  40  
  41  if( $module->isCurrentAction( 'RemoveObjectCollection' ) && $http->hasPostVariable( 'ObjectIDArray' ) )
  42  {
  43      $objectIDArray = $http->postVariable( 'ObjectIDArray' );
  44      $http->setSessionVariable( 'ObjectIDArray', $objectIDArray );
  45  
  46      $collections = 0;
  47  
  48      foreach( $objectIDArray as $objectID )
  49      {
  50          $collections += eZInformationCollection::fetchCollectionCountForObject( $objectID );
  51      }
  52  
  53      $tpl =& templateInit();
  54      $tpl->setVariable( 'module', $module );
  55      $tpl->setVariable( 'collections', $collections );
  56      $tpl->setVariable( 'remove_type', 'objects' );
  57  
  58      $Result = array();
  59      $Result['content'] =& $tpl->fetch( 'design:infocollector/confirmremoval.tpl' );
  60      $Result['path'] = array( array( 'url' => false,
  61                                      'text' => ezi18n( 'kernel/infocollector', 'Collected information' ) ) );
  62      return;
  63  }
  64  
  65  
  66  if( $module->isCurrentAction( 'ConfirmRemoval' ) )
  67  {
  68  
  69      $objectIDArray =& $http->sessionVariable( 'ObjectIDArray' );
  70  
  71      if( is_array( $objectIDArray) )
  72      {
  73          foreach( $objectIDArray as $objectID )
  74          {
  75              eZInformationCollection::removeContentObject( $objectID );
  76          }
  77      }
  78  }
  79  
  80  
  81  if( eZPreferences::value( 'admin_infocollector_list_limit' ) )
  82  {
  83      switch( eZPreferences::value( 'admin_infocollector_list_limit' ) )
  84      {
  85          case '2': { $limit = 25; } break;
  86          case '3': { $limit = 50; } break;
  87          default:  { $limit = 10; } break;
  88      }
  89  }
  90  else
  91  {
  92      $limit = 10;
  93  }
  94  
  95  
  96  $db =& eZDB::instance();
  97  $objects = $db->arrayQuery( 'SELECT DISTINCT ezinfocollection.contentobject_id,
  98                                      ezcontentobject.name,
  99                                      ezcontentobject_tree.main_node_id,
 100                                      ezcontentclass.*,
 101                                      ezcontentclass.identifier AS class_identifier
 102                               FROM   ezinfocollection,
 103                                      ezcontentobject,
 104                                      ezcontentobject_tree,
 105                                      ezcontentclass
 106                               WHERE  ezinfocollection.contentobject_id=ezcontentobject.id
 107                                      AND ezcontentobject.contentclass_id=ezcontentclass.id
 108                                      AND ezinfocollection.contentobject_id=ezcontentobject_tree.contentobject_id',
 109                               array( 'limit'  => (int)$limit,
 110                                      'offset' => (int)$offset ) );
 111  
 112  $infoCollectorObjectsQuery = $db->arrayQuery( 'SELECT COUNT( DISTINCT ezinfocollection.contentobject_id ) as count
 113                                                 FROM ezinfocollection,
 114                                                      ezcontentobject,
 115                                                      ezcontentobject_tree
 116                                                 WHERE
 117                                                      ezinfocollection.contentobject_id=ezcontentobject.id
 118                                                      AND ezinfocollection.contentobject_id=ezcontentobject_tree.contentobject_id' );
 119  $numberOfInfoCollectorObjects = 0;
 120  
 121  if ( $infoCollectorObjectsQuery )
 122  {
 123      $numberOfInfoCollectorObjects = $infoCollectorObjectsQuery[0]['count'];
 124  }
 125  
 126  foreach ( array_keys( $objects ) as $i )
 127  {
 128      $collections = eZInformationCollection::fetchCollectionsList( (int)$objects[$i]['contentobject_id'], /* object id */
 129                                                                    false, /* creator id */
 130                                                                    false, /* user identifier */
 131                                                                    false, /* limitArray */
 132                                                                    false, /* sortArray */
 133                                                                    false  /* asObject */
 134                                                                   );
 135  
 136      $objects[$i]['class_name'] = eZContentClassNameList::nameFromSerializedString( $objects[$i]['serialized_name_list'] );
 137      $first = $collections[0]['created'];
 138      $last  = $first;
 139  
 140      for($j=0; $j<count( $collections ); $j++ )
 141      {
 142          $current = $collections[$j]['created'];
 143  
 144          if( $current < $first )
 145              $first = $current;
 146  
 147          if( $current > $last )
 148              $last = $current;
 149      }
 150  
 151      $objects[$i]['first_collection'] = $first;
 152      $objects[$i]['last_collection'] = $last;
 153      $objects[$i]['collections']= count( $collections );
 154  }
 155  
 156  $viewParameters = array( 'offset' => $offset );
 157  
 158  $tpl =& templateInit();
 159  $tpl->setVariable( 'module', $module );
 160  $tpl->setVariable( 'limit', $limit );
 161  $tpl->setVariable( 'view_parameters', $viewParameters );
 162  $tpl->setVariable( 'object_array', $objects );
 163  $tpl->setVariable( 'object_count', $numberOfInfoCollectorObjects );
 164  
 165  $Result = array();
 166  $Result['content'] =& $tpl->fetch( 'design:infocollector/overview.tpl' );
 167  $Result['path'] = array( array( 'url' => false,
 168                                  'text' => ezi18n( 'kernel/infocollector', 'Collected information' ) ) );
 169  
 170  ?>


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