|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Created on: <21-Jan-05 16:00:52 kk> 00004 // 00005 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00006 // SOFTWARE NAME: eZ Publish 00007 // SOFTWARE RELEASE: 4.0.x 00008 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00009 // SOFTWARE LICENSE: GNU General Public License v2.0 00010 // NOTICE: > 00011 // This program is free software; you can redistribute it and/or 00012 // modify it under the terms of version 2.0 of the GNU General 00013 // Public License as published by the Free Software Foundation. 00014 // 00015 // This program is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU General Public License for more details. 00019 // 00020 // You should have received a copy of version 2.0 of the GNU General 00021 // Public License along with this program; if not, write to the Free 00022 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00023 // MA 02110-1301, USA. 00024 // 00025 // 00026 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00027 // 00028 00029 /*! \file hide.php 00030 */ 00031 00032 //include_once( "kernel/classes/ezcontentobjecttreenode.php" ); 00033 //include_once( "lib/ezutils/classes/ezini.php" ); 00034 00035 $ini = eZINI::instance( 'content.ini' ); 00036 $rootNodeIDList = $ini->variable( 'HideSettings','RootNodeList' ); 00037 $hideAttributeArray = $ini->variable( 'HideSettings', 'HideDateAttributeList' ); 00038 $hideClasses = array_keys( $hideAttributeArray ); 00039 00040 $currrentDate = time(); 00041 00042 $offset = 0; 00043 $limit = 20; 00044 00045 foreach( $rootNodeIDList as $nodeID ) 00046 { 00047 $rootNode = eZContentObjectTreeNode::fetch( $nodeID ); 00048 00049 while( true ) 00050 { 00051 $nodeArray = $rootNode->subTree( array( 'ClassFilterType' => 'include', 00052 'ClassFilterArray' => $hideClasses, 00053 'Offset' => $offset, 00054 'Limit' => $limit ) ); 00055 if ( !$nodeArray || 00056 count( $nodeArray ) == 0 ) 00057 { 00058 break; 00059 } 00060 00061 $offset += $limit; 00062 00063 foreach ( $nodeArray as $node ) 00064 { 00065 $dataMap = $node->attribute( 'data_map' ); 00066 00067 $dateAttributeName = $hideAttributeArray[$node->attribute( 'class_identifier' )]; 00068 00069 if ( !$dateAttributeName ) 00070 { 00071 continue; 00072 } 00073 00074 $dateAttribute = $dataMap[$dateAttributeName]; 00075 00076 if ( is_null( $dateAttribute ) || !$dateAttribute->hasContent() ) 00077 { 00078 continue; 00079 } 00080 00081 $date = $dateAttribute->content(); 00082 $retractDate = $date->attribute( 'timestamp' ); 00083 if ( $retractDate > 0 && $retractDate < $currrentDate && !$node->attribute( 'is_hidden' ) ) 00084 { 00085 eZContentObjectTreeNode::hideSubTree( $node ); 00086 if ( !$isQuiet ) 00087 { 00088 $cli->output( 'Hiding node : ' . $node->attribute( 'node_id' ) ); 00089 } 00090 } 00091 } 00092 } 00093 } 00094 00095 00096 ?>