Source for file Folder.class.php
Documentation is available at Folder.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
require_once( CLASSPATH. "filesystem/Files.class.php" );
* A class to manage folder in a filesystemtree.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2003 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @var Folder $parentfolder
* @author Daniel Plücken <daniel@debakel.net>
function Folder( $name, $parent )
$this->path = $parent->path. "/". $name;
* Sets the parent folder of this folder object that there is a back reference
* up to the root of the filesystem tree,
* @author Daniel Plücken <daniel@debakel.net>
* @param Folder $objRef The reference to the folder object that
* Returns the names of folder that this folder contains by an array.
* @author Daniel Plücken <daniel@debakel.net>
$outputArr[] = $this->folder[$i]->getName();
* Returns the names of files that this folder contains by an array.
* @author Daniel Plücken <daniel@debakel.net>
$outputArr[] = $this->files[$i]->getName();
* Returns the path to the folder of this folder object including
* @author Daniel Plücken <daniel@debakel.net>
* Returns the foldername of this folder object.
* @author Daniel Plücken <daniel@debakel.net>
* Returns the file objects of this folder object in pre-order.
* @author Daniel Plücken <daniel@debakel.net>
foreach ( $this->files as $key => $value )
$out_arr[] = & $this->files[$key];
foreach ( $this->folder as $key => $value )
$tmp_arr = & $this->folder[$key]->getFilesArray();
// array_merge doesn't keep references alive!
foreach ( $tmp_arr as $key2 => $value2 )
$out_arr[] = & $tmp_arr[$key2];
* Prints out a dirty formatted list of all folder and files that this
* folder contains. All contents of containing folder will be printed too
* because of recursive invocation.
* @author Daniel Plücken <daniel@debakel.net>
echo $this->folder[$i]->getName(). "<br>\n";
$this->folder[$i]->echoNameQueque();
echo $this->files[$i]->getName(). "<br>\n";
|