Example #1
0
 public function folder($action = 'load')
 {
     $path = $_POST['path'];
     if (isset($_POST['folder'])) {
         $tree = $_POST['folder'];
     } else {
         $tree = 0;
     }
     $this->root = dirname(ROOT) . DS;
     $arr = array();
     if ($action == 'load') {
         include_once ROOT . DS . 'includes' . DS . 'file.php';
         $file = new File();
         $folders = $file->folders($this->root . $path);
         $arr['folder'] = $folders;
         if ($tree != 1) {
             $files = $file->files($this->root . $path);
             $arr['files'] = $files;
         }
     }
     echo json_encode($arr);
 }