[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/cronjobs/ -> hide.php (source)

   1  <?php
   2  //
   3  // Created on: <21-Jan-05 16:00:52 kk>
   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  /*! \file hide.php
  28  */
  29  
  30  include_once ( "kernel/classes/ezcontentobjecttreenode.php" );
  31  include_once ( "lib/ezutils/classes/ezini.php" );
  32  
  33  $ini =& eZINI::instance( 'content.ini' );
  34  $rootNodeIDList = $ini->variable( 'HideSettings','RootNodeList' );
  35  $hideAttributeArray = $ini->variable( 'HideSettings', 'HideDateAttributeList' );
  36  $hideClasses = array_keys( $hideAttributeArray );
  37  
  38  $currrentDate = time();
  39  
  40  $offset = 0;
  41  $limit = 20;
  42  
  43  foreach( $rootNodeIDList as $nodeID )
  44  {
  45      $rootNode = eZContentObjectTreeNode::fetch( $nodeID );
  46  
  47      while( true )
  48      {
  49          $nodeArray =& $rootNode->subTree( array( 'ClassFilterType' => 'include',
  50                                                   'ClassFilterArray' => $hideClasses,
  51                                                   'Offset' => $offset,
  52                                                   'Limit' => $limit ) );
  53          if ( !$nodeArray ||
  54               count( $nodeArray ) == 0 )
  55          {
  56              break;
  57          }
  58  
  59          $offset += $limit;
  60  
  61          foreach ( array_keys( $nodeArray ) as $key )
  62          {
  63              $node =& $nodeArray[$key];
  64              $dataMap =& $node->attribute( 'data_map' );
  65  
  66              $dateAttributeName = $hideAttributeArray[$node->attribute( 'class_identifier' )];
  67  
  68              if ( !$dateAttributeName )
  69              {
  70                  continue;
  71              }
  72  
  73              $dateAttribute =& $dataMap[$dateAttributeName];
  74  
  75              if ( is_null( $dateAttribute ) || !$dateAttribute->hasContent() )
  76              {
  77                  continue;
  78              }
  79  
  80              $date = $dateAttribute->content();
  81              $retractDate = $date->attribute( 'timestamp' );
  82              if ( $retractDate > 0 && $retractDate < $currrentDate && !$node->attribute( 'is_hidden' ) )
  83              {
  84                  eZContentObjectTreeNode::hideSubTree( $node );
  85                  if ( !$isQuiet )
  86                  {
  87                      $cli->output( 'Hiding node : ' . $node->attribute( 'node_id' ) );
  88                  }
  89              }
  90          }
  91      }
  92  }
  93  
  94  
  95  ?>


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