Exemple #1
0
 public static function open($path)
 {
     $folderPath = \Yii::$app->getModule('burivuh')->filesPath . $path;
     $list = scandir($folderPath);
     $return = [];
     $folderList = [];
     $isDirMultisort = [];
     $filenameMultisort = [];
     foreach ($list as $key => $file) {
         if ($file == '..' || $file == '.') {
             continue;
         }
         $isDir = is_dir($folderPath . '/' . $file);
         $folderList[$key] = ['isDir' => $isDir, 'name' => $file];
         $filenameMultisort[$key] = $file;
         $isDirMultisort[$key] = $isDir;
     }
     array_multisort($isDirMultisort, SORT_DESC, SORT_NUMERIC, $filenameMultisort, SORT_ASC, SORT_STRING, $folderList);
     foreach ($folderList as $file) {
         if ($file['isDir']) {
             $return[] = Folder::read($path . '/' . $file['name']);
         } else {
             $return[] = Document::read($path . '/' . $file['name']);
         }
     }
     return $return;
 }
 public function actionDeleteFolder()
 {
     $model = Folder::read($this->path);
     $model->delete();
     $this->redirect(['index', 'path' => $model->folder]);
 }