src/UI/HTML/Tree/FolderCheckView.php
protected function buildRecursive( $path, $level = 0, $pathRoot = NULL )
	{
		if( !$pathRoot )
			$pathRoot	= $path;
		$list	= array();																			//  empty Array for current Level Items
		$lister	= new FS_Folder_Lister( $path );														//  create Lister for Folder Contents
		$lister->showFolders( $this->showFolders );													//  switch Folders Visibility
		$lister->showFiles( $this->showFiles );														//  switch Files Visibility
		$index	= $lister->getList();																//  get Iterator
		foreach( $index as $item )																	//  iterate current Path
		{
			$ignore		= FALSE;
			$path		= str_replace( "\\", "/", $item->getPathname() );							//  correct Slashes on Windows
			$path		= substr( $path, strlen( $this->path ) );									//  remove Tree Root Path
			foreach( $this->ignorePatterns as $pattern )
				if( preg_match( '@^'.$pattern.'$@', $path ) )
					$ignore	= TRUE;
			if( $ignore	)
				continue;
			$label		= $item->getFilename();
			$sublist	= "";																		//  empty Sublist
			if( $item->isDir() )																	//  current Path has Folders
				$sublist	= $this->buildRecursive( $item->getPathname(), $level + 1, $pathRoot );	//  call Method for nested Folder
			$state		= $this->selected ? in_array( $path, $this->selected ) : TRUE;				//  current Item is set to be selected or no presets at all 
			$check		= UI_HTML_FormElements::CheckBox( $this->inputName.'[]', $path, $state );				//  build Checkbox
			$span		= UI_HTML_Tag::create( 'span', $check.$label );				//  build Label
			$item		= UI_HTML_Elements::ListItem( $span.$sublist, $level );						//  build List Item
			$list[$label]		= $item;																	//  append to List
		}
		ksort( $list );
		$list	= $list ? UI_HTML_Elements::unorderedList( $list, $level ) : "";					//  build List
		return $list;																				//  return List of this Level
	}
protected function buildRecursive( $path, $level = 0, $pathRoot = NULL )
	{
		if( !$pathRoot )
			$pathRoot	= $path;
		$list	= array();																			//  empty Array for current Level Items
		$lister	= new FS_Folder_Lister( $path );														//  create Lister for Folder Contents
		$lister->showFolders( $this->showFolders );													//  switch Folders Visibility
		$lister->showFiles( $this->showFiles );														//  switch Files Visibility
		$index	= $lister->getList();																//  get Iterator
		foreach( $index as $item )																	//  iterate current Path
		{
			$ignore		= FALSE;
			$path		= str_replace( "\\", "/", $item->getPathname() );							//  correct Slashes on Windows
			$path		= substr( $path, strlen( $this->path ) );									//  remove Tree Root Path
			foreach( $this->ignorePatterns as $pattern )
				if( preg_match( '@^'.$pattern.'$@', $path ) )
					$ignore	= TRUE;
			if( $ignore	)
				continue;
			$label		= $item->getFilename();
			$sublist	= "";																		//  empty Sublist
			if( $item->isDir() )																	//  current Path has Folders
				$sublist	= $this->buildRecursive( $item->getPathname(), $level + 1, $pathRoot );	//  call Method for nested Folder
			$state		= $this->selected ? in_array( $path, $this->selected ) : TRUE;				//  current Item is set to be selected or no presets at all 
			$check		= UI_HTML_FormElements::CheckBox( $this->inputName.'[]', $path, $state );				//  build Checkbox
			$span		= UI_HTML_Tag::create( 'span', $check.$label );				//  build Label
			$item		= UI_HTML_Elements::ListItem( $span.$sublist, $level );						//  build List Item
			$list[$label]		= $item;																	//  append to List
		}
		ksort( $list );
		$list	= $list ? UI_HTML_Elements::unorderedList( $list, $level ) : "";					//  build List
		return $list;																				//  return List of this Level
	}
protected function buildRecursive ( $ path , $ level = 0 , $ pathRoot = NULL ) { if ( ! $ pathRoot ) $ pathRoot = $ path ; $ list = array ( ) ; //  empty Array for current Level Items $ lister = new FS_Folder_Lister ( $ path ) ; //  create Lister for Folder Contents $ lister -> showFolders ( $ this -> showFolders ) ; //  switch Folders Visibility $ lister -> showFiles ( $ this -> showFiles ) ; //  switch Files Visibility $ index = $ lister -> getList ( ) ; //  get Iterator foreach ( $ index as $ item ) //  iterate current Path { $ ignore = FALSE ; $ path = str_replace ( "\\" , "/" , $ item -> getPathname ( ) ) ; //  correct Slashes on Windows $ path = substr ( $ path , strlen ( $ this -> path ) ) ; //  remove Tree Root Path foreach ( $ this -> ignorePatterns as $ pattern ) if ( preg_match ( '@^' . $ pattern . '$@' , $ path ) ) $ ignore = TRUE ; if ( $ ignore ) continue ; $ label = $ item -> getFilename ( ) ; $ sublist = "" ; //  empty Sublist if ( $ item -> isDir ( ) ) //  current Path has Folders $ sublist = $ this -> buildRecursive ( $ item -> getPathname ( ) , $ level + 1 , $ pathRoot ) ; //  call Method for nested Folder $ state = $ this -> selected ? in_array ( $ path , $ this -> selected ) : TRUE ; //  current Item is set to be selected or no presets at all  $ check = UI_HTML_FormElements :: CheckBox ( $ this -> inputName . '[]' , $ path , $ state ) ; //  build Checkbox $ span = UI_HTML_Tag :: create ( 'span' , $ check . $ label ) ; //  build Label $ item = UI_HTML_Elements :: ListItem ( $ span . $ sublist , $ level ) ; //  build List Item $ list [ $ label ] = $ item ; //  append to List } ksort ( $ list ) ; $ list = $ list ? UI_HTML_Elements :: unorderedList ( $ list , $ level ) : "" ; //  build List return $ list ; //  return List of this Level }
Builds recursively nested HTML Lists and Items from Folder Structure.
@access		public
@param		string		$path			URI (local only) of Folder to list
@param		int			$level			Current nesting depth
@return		string
Builds recursively nested HTML Lists and Items from Folder Structure .