Phundament-Components
[ class tree: Phundament-Components ] [ index: Phundament-Components ] [ all elements ]

Source for file LDirectoryDropDown.php

Documentation is available at LDirectoryDropDown.php

  1. <?php
  2. /**                        
  3.  * @package Phundament.Components
  4.  * @subpackage WebControls
  5.  */
  6.  
  7. /**
  8.  * class
  9.  *
  10.  * @package System.Web.UI.WebControls
  11.  * @subpackage Admin
  12.  */
  13.  
  14.  class LDirectoryDropDown extends TDropDownList
  15.  {
  16.      private $_s array();
  17.  
  18.     public function setDirectory($value)
  19.     {
  20.         $this->setViewState('Directory'$value);
  21.     }
  22.     public function getDirectory()
  23.     {
  24.         $this->getViewState('Directory');
  25.         return $this->getViewState('Directory');
  26.     }
  27.  
  28.      public function onPreRender($param)
  29.      {
  30.          parent::onPreRender($param);
  31.          $this->readDirectory($this->Directory);
  32.          $this->DataSource $this->_s;
  33.          $this->dataBind();
  34.      }
  35.  
  36.      private function readDirectory($dir)
  37.      {
  38.          static $level;
  39.          $level++;
  40.          if (!is_dir($dir)) return;
  41.          #if (empty($this->_s[$dir])) $this->_s[$dir] = ".";
  42.          $files scandir($dir);
  43.          foreach($files AS $file)
  44.          {
  45.              $fullPath $dir."/".$file;
  46.              $currentLevel $level;
  47.              if (is_dir($fullPath&& substr($file01!= ".")
  48.              {
  49.                  #echo "$level <------";
  50.                  // prepare for dropdown datasource
  51.                  $this->_s[$fullPathstr_repeat("&nbsp;&nbsp;",$level-1).$file;
  52.                  $this->readDirectory($fullPath);
  53.              }
  54.              $level $currentLevel;
  55.          }
  56.      }
  57.  
  58.  
  59.  }
  60. ?>

Documentation generated on Sun, 25 Feb 2007 16:10:20 +0100 by phpDocumentor 1.3.1