src/UI/HTML/Tree/FolderView.php
protected function readRecursive( $path, $currentId, &$nodes, $linkNodes, $classNode = "folder", $classLeaf = "file" ) 
	{
		$files	= array();
		$index	= new DirectoryIterator( $path );
		foreach( $index as $file )
		{
			if( $file->isDot() )
				continue;
			if( preg_match( "@^\.\w@", $file->getFilename() ) )
				continue;
			if( $file->isDir() )
			{
				$children	= array();
				$this->readRecursive( $file->getPathname(), $currentId, $children, $linkNodes, $classNode, $classLeaf );
				$dir	= array(
					'label'		=> basename( $file->getPathname() ),
					'type'		=> "node",
					'class'		=> $classNode,
					'linked'	=> $linkNodes,
					'children'	=> $children,
				);
				$nodes[]	= $dir;
			}
			else
			{
				$classes	= array();
				$info		= pathinfo( $file->getFilename() );
				if( $classLeaf )
					$classes[]	= $classLeaf;
				if( isset( $info['extension'] ) )
					$classes[]	= "file-".strtolower( $info['extension'] );
				$classes	= implode( " ", $classes );
				$files[]	= array(
					'label'		=> $file->getFilename(),
					'type'		=> "leaf",
					'class'		=> $classes,
					'linked'	=> TRUE,
				);
			}
		}
		foreach( $files as $file )
			$nodes[]	= $file;
	}
protected function readRecursive( $path, $currentId, &$nodes, $linkNodes, $classNode = "folder", $classLeaf = "file" ) 
	{
		$files	= array();
		$index	= new DirectoryIterator( $path );
		foreach( $index as $file )
		{
			if( $file->isDot() )
				continue;
			if( preg_match( "@^\.\w@", $file->getFilename() ) )
				continue;
			if( $file->isDir() )
			{
				$children	= array();
				$this->readRecursive( $file->getPathname(), $currentId, $children, $linkNodes, $classNode, $classLeaf );
				$dir	= array(
					'label'		=> basename( $file->getPathname() ),
					'type'		=> "node",
					'class'		=> $classNode,
					'linked'	=> $linkNodes,
					'children'	=> $children,
				);
				$nodes[]	= $dir;
			}
			else
			{
				$classes	= array();
				$info		= pathinfo( $file->getFilename() );
				if( $classLeaf )
					$classes[]	= $classLeaf;
				if( isset( $info['extension'] ) )
					$classes[]	= "file-".strtolower( $info['extension'] );
				$classes	= implode( " ", $classes );
				$files[]	= array(
					'label'		=> $file->getFilename(),
					'type'		=> "leaf",
					'class'		=> $classes,
					'linked'	=> TRUE,
				);
			}
		}
		foreach( $files as $file )
			$nodes[]	= $file;
	}
protected function readRecursive ( $ path , $ currentId , & $ nodes , $ linkNodes , $ classNode = "folder" , $ classLeaf = "file" ) { $ files = array ( ) ; $ index = new DirectoryIterator ( $ path ) ; foreach ( $ index as $ file ) { if ( $ file -> isDot ( ) ) continue ; if ( preg_match ( "@^\.\w@" , $ file -> getFilename ( ) ) ) continue ; if ( $ file -> isDir ( ) ) { $ children = array ( ) ; $ this -> readRecursive ( $ file -> getPathname ( ) , $ currentId , $ children , $ linkNodes , $ classNode , $ classLeaf ) ; $ dir = array ( 'label' => basename ( $ file -> getPathname ( ) ) , 'type' => "node" , 'class' => $ classNode , 'linked' => $ linkNodes , 'children' => $ children , ) ; $ nodes [ ] = $ dir ; } else { $ classes = array ( ) ; $ info = pathinfo ( $ file -> getFilename ( ) ) ; if ( $ classLeaf ) $ classes [ ] = $ classLeaf ; if ( isset ( $ info [ 'extension' ] ) ) $ classes [ ] = "file-" . strtolower ( $ info [ 'extension' ] ) ; $ classes = implode ( " " , $ classes ) ; $ files [ ] = array ( 'label' => $ file -> getFilename ( ) , 'type' => "leaf" , 'class' => $ classes , 'linked' => TRUE , ) ; } } foreach ( $ files as $ file ) $ nodes [ ] = $ file ; }
Reads Folder recursive.
@access		protected
@param		string		$path				Path to Folder to index
@param		string		$currentId			ID current selected in Tree
@param		ArrayObject	$nodes				Array Object of Folders and Files
@param		string		$linkNodes			Link Nodes (no Icons possible)
@param		string		$classNode			CSS Class of Nodes / Folders
@param		string		$classLeaf			CSS Class of Leafes / Files
@return		void
Reads Folder recursive .