public function getDirectoryTree($dir_files, $dir, $dir_path, $dirs = array())
    {
        foreach ($dir_files as $file) {
            $filepath = $this->getFileManager()->DirTrim($dir, $file, true);
            if ($file[0] != ".") {
                if (is_dir($filepath)) {
                    $new_dir_files = scandir($filepath);
                    $new_dir_path = $this->getFileManager()->DirTrim($dir_path, $file, true);
                    $new_dir = $this->getFileManager()->getUploadPath() . FileManager::DS . $this->getFileManager()->DirTrim($new_dir_path);
                    $fileType = "directory";
                    $tmp_array = array(
                        "mimetype" => $fileType,
                        "name"     => $file,
                        "path"     => $this->getFileManager()->DirTrim($new_dir_path),
                        "tree"     => $this->getDirectoryTree($new_dir_files, $new_dir, $new_dir_path, array()),
                    );
                    $dirs[] = $tmp_array;
                }
            }
        }
        return $dirs;
    }
public function getDirectoryTree($dir_files, $dir, $dir_path, $dirs = array())
    {
        foreach ($dir_files as $file) {
            $filepath = $this->getFileManager()->DirTrim($dir, $file, true);
            if ($file[0] != ".") {
                if (is_dir($filepath)) {
                    $new_dir_files = scandir($filepath);
                    $new_dir_path = $this->getFileManager()->DirTrim($dir_path, $file, true);
                    $new_dir = $this->getFileManager()->getUploadPath() . FileManager::DS . $this->getFileManager()->DirTrim($new_dir_path);
                    $fileType = "directory";
                    $tmp_array = array(
                        "mimetype" => $fileType,
                        "name"     => $file,
                        "path"     => $this->getFileManager()->DirTrim($new_dir_path),
                        "tree"     => $this->getDirectoryTree($new_dir_files, $new_dir, $new_dir_path, array()),
                    );
                    $dirs[] = $tmp_array;
                }
            }
        }
        return $dirs;
    }
public function getDirectoryTree ( $ dir_files , $ dir , $ dir_path , $ dirs = array ( ) ) { foreach ( $ dir_files as $ file ) { $ filepath = $ this -> getFileManager ( ) -> DirTrim ( $ dir , $ file , true ) ; if ( $ file [ 0 ] != "." ) { if ( is_dir ( $ filepath ) ) { $ new_dir_files = scandir ( $ filepath ) ; $ new_dir_path = $ this -> getFileManager ( ) -> DirTrim ( $ dir_path , $ file , true ) ; $ new_dir = $ this -> getFileManager ( ) -> getUploadPath ( ) . FileManager :: DS . $ this -> getFileManager ( ) -> DirTrim ( $ new_dir_path ) ; $ fileType = "directory" ; $ tmp_array = array ( "mimetype" => $ fileType , "name" => $ file , "path" => $ this -> getFileManager ( ) -> DirTrim ( $ new_dir_path ) , "tree" => $ this -> getDirectoryTree ( $ new_dir_files , $ new_dir , $ new_dir_path , array ( ) ) , ) ; $ dirs [ ] = $ tmp_array ; } } } return $ dirs ; }
Returns the directory tree of the given path. This will loop itself until it has all directories

@param array  $dir_files files in the directory
@param string $dir current directory
@param string $dir_path current directory path
@param array  $dirs directories
@return array|null
Returns the directory tree of the given path . This will loop itself until it has all directories