Exemplo n.º 1
0
 public function getList()
 {
     $dbfolders = Folder::where('parent_id', 15)->get();
     $dbfolders->push(Folder::find(15));
     $result = [];
     foreach ($dbfolders as $folder) {
         $files = $folder->Files;
         foreach ($files as $file) {
             $file->destroy($file->id);
             $myFile = new MyFile();
             try {
                 $myFile->FileDelete($this->upload_path . $file->year . '-' . $file->month . '/', $file->name);
             } catch (exception $ex) {
             }
         }
         $folder->destroy($folder->id);
         Folder_File_Attached::where('folder_id', $folder->id)->delete();
     }
     return \Response::json($result);
 }
Exemplo n.º 2
0
 public function getIndex()
 {
     $folder = Folder::find(\Input::get('id'));
     $dbfiles = $folder->Files;
     $files = [];
     foreach ($dbfiles as $file) {
         $filename = $file->name;
         if (strlen($filename) > 20) {
             $filename = substr($filename, 0, 15) . '...';
         }
         array_push($files, array('id' => $file->id, 'name' => $filename, 'fullname' => $file->name, 'url' => asset('uploads') . '/' . $file->year . '/' . $file->month . '/' . $this->nameHandler($file->name, "180x130"), 'naturalSize' => asset('uploads') . '/' . $file->year . '/' . $file->month . '/' . $file->name, 'size' => $file->size));
     }
     $theme = "Admin";
     return $this->view->make("FileManager::file-template", compact("theme", 'files'));
 }