Source for file FileSelect.class.php
Documentation is available at FileSelect.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/FilesystemToolkit.class.php" );
require_once( CLASSPATH. "forms/items/HTMLSelect.class.php" );
* A class to generate select fields to choose a file on the filesystem.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (C) 2004 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 integer $outputKind
* @author Daniel Plücken <daniel@debakel.net>
* @param string $name Name of the select.
* @param string $dir The directory to read.
* @param string $selectedFile The selected file in the read directory.
* @param string $onChangeOrder The javascript order that should execute
* if the value of the select changes.
* @param integer $outputKind The defined integer code to manipulate
* the behaviour of the select, in the kind
* that only files will be show, only
* folder will be show or both, files
* and folder, will be display. See the uses
* part for more information.
$outputKind = FILEORFOLDER
$this->SOKH( $outputKind );
echo "<b>'". $this->dir. "' is no directory.</b>\r\n";
// echo "You are here ".."\r\n";
$this->selectedValue = basename( $selectedFile );
# Save folder and files each in separate arrays
while( $file = readdir( $folder ) )
if( count( $tempDirArr ) > 1 )
for( $i = 0; $i < count( $tempDirArr ); $i++ )
$valueAndLabelArr[] = $tempDirArr[$i];
if( count( $tempFileArr ) > 1 )
for( $i = 0; $i < count( $tempFileArr ); $i++ )
$valueAndLabelArr[] = $tempFileArr[$i];
* Returns a clone of this object.
* @author Daniel Plücken <daniel@debakel.net>
* Returns the directory which content should be display by this select.
* @author Daniel Plücken <daniel@debakel.net>
* Returns the value of the kind of output ( FILE, FOLDER, FILEORFOLDER ).
* @author Daniel Plücken <daniel@debakel.net>
* Sets the directory which content should be display by this select.
* @author Daniel Plücken <daniel@debakel.net>
* Sets the value of the kind of output ( FILE, FOLDER, FILEORFOLDER ).
* @author Daniel Plücken <daniel@debakel.net>
* This method is importantly only for private use of the class, otherwise
* there it can cause side effects, because the object attributes will not
* @author Daniel Plücken <daniel@debakel.net>
if( $int >= 0 && $int <= 2 )
* This method refreshes the new entries.
* @author Daniel Plücken <daniel@debakel.net>
} // End of class FileSelect
|