function __get_folder_tree($path, $bCheckFolders = false)
 {
     static $io = false;
     if ($io === false) {
         $io = CBXVirtualIo::GetInstance();
     }
     $path = $io->CombinePath($path, '/');
     $arSection = array();
     $bCheckFolders = $bCheckFolders === true;
     $dir = $io->GetDirectory($path);
     if (!$dir->IsExists()) {
         return false;
     }
     $arChildren = $dir->GetChildren();
     foreach ($arChildren as $node) {
         if ($node->IsDirectory()) {
             if ($bCheckFolders) {
                 return true;
             }
             $filename = $node->GetName();
             if (preg_match("/^\\..*/", $filename)) {
                 continue;
             }
             $arSection[$filename] = array("NAME" => $filename, "HAS_DIR" => __get_folder_tree($node->GetPathWithName(), true));
         }
     }
     if ($bCheckFolders) {
         return false;
     }
     uasort($arSection, "__sort_array_folder");
     return $arSection;
 }
Exemple #2
0
 function __get_folder_tree($path, $path_chunc, $deep, &$arSection)
 {
     static $io = false;
     if ($io === false) {
         $io = CBXVirtualIo::GetInstance();
     }
     if (!is_array($arSection)) {
         $arSection = array();
     }
     if ($path === false) {
         return false;
     }
     if ($io->DirectoryExists($path)) {
         $oDir = $io->GetDirectory($path);
         $arChildren = $oDir->GetChildren();
         foreach ($arChildren as $node) {
             $deep++;
             $filename = $node->GetName();
             $tmp_path = $node->GetPathWithName();
             if ($io->DirectoryExists($tmp_path)) {
                 $filename = $this->MetaNamesReverse($filename);
                 $arSection[] = array("ID" => str_replace($path_chunc, "", $tmp_path), "DEPTH_LEVEL" => $deep, "NAME" => $filename);
                 __get_folder_tree($tmp_path, $path_chunc, $deep, $arSection);
             }
         }
     }
 }