public static function display_tree($current_path, $cur_dir, $pathext, $ignore_children = false) { // open the cur_dir static $list_array; if (!isset($list_array)) { $list_array = explode(',', $_GET['list']); } if ($dir = opendir($current_path . $cur_dir)) { // recursively call output_dirs() for all directories in this directory while (false !== ($file = readdir($dir))) { //if the name is not a directory if ($file == '.' || $file == '..') { continue; } // if it is a directory call function if (is_dir($current_path . $cur_dir . $file)) { //$ldir = explode('/',$cur_dir.$file); //$count = count($ldir); //$label = $ldir[$count-1]; $check = ''; $here = ''; if ($cur_dir . $file == substr($pathext, 0, -1)) { $check = 'checked="checked"'; $here = ' ' . _AT('current_location'); } else { if ($cur_dir == $pathext && in_array($file, $list_array)) { $ignore_children = true; } } if ($ignore_children) { $check = 'disabled="disabled"'; $class = ' disabled'; } $dir_option .= '<ul><li class="folders' . $class . '">'; $dir_option .= '<label><input type="radio" name="dir_name" value="' . $cur_dir . $file . '" ' . $check . '/>' . $file . $here . '</label>'; $dir_option .= '' . FileUtility::display_tree($current_path, $cur_dir . $file . '/', $pathext, $ignore_children) . ''; $dir_option .= '</li></ul>'; if ($cur_dir == $pathext && in_array($file, $list_array)) { $ignore_children = false; $class = ''; } } } // end while closedir($dir); } return $dir_option; }
<div class="row"> <p><?php echo _AT('select_directory'); ?> </p> </div> <div class="row"> <ul> <li class="folders"><label><input type="radio" name="dir_name" value=""<?php if ($pathext == '') { echo ' checked="checked"'; $here = ' ' . _AT('current_location'); } echo '/>Home ' . $here . '</label>'; echo FileUtility::display_tree($current_path, '', $pathext); ?> </li> </ul> </div> <div class="row buttons"> <input type="submit" name="dir_chosen" value="<?php echo _AT('move'); ?> " accesskey="s" /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?> " /> </div>