You are here

function dirtree3 in TinyBrowser 7

1 call to dirtree3()
tinybrowser.php in tinybrowser/tinybrowser.php

File

tinybrowser/fns_tinybrowser.php, line 510

Code

function dirtree3($types, $root = '', $tree = '', $branch = '', $level = 0) {

  // construct folder tree list
  $out = '';
  $dirtree = array();
  dirtree2($dirtree, $types, $root, $tree, $branch, $level);
  $prev_level = -1;
  for ($i = 0; $i < count($dirtree); $i++) {
    $cur_level = $dirtree[$i][6];
    if ($prev_level == -1) {
    }
    else {
      if ($prev_level == $cur_level) {
        $out .= "</li>\n";
      }
      else {
        if ($prev_level < $cur_level) {
          $out .= "\n<ul>\n";
        }
        else {
          if ($prev_level > $cur_level) {
            for ($j = 0; $j < $prev_level - $cur_level; $j++) {
              $out .= "</li>\n</ul>\n</li>\n";
            }
          }
        }
      }
    }
    $out .= '<li class="icon" id="moveto_' . $dirtree[$i][0] . '"><span class="icon folder"></span>' . $dirtree[$i][1];
    $prev_level = $cur_level;
  }
  $out .= "</li>\n";
  for ($i = $cur_level; $i > 0; $i--) {
    $out .= "</ul>\n</li>\n";
  }
  return $out;
}