/var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Admin
NameSizeModeActions
AdminController.php57720644editdlrm
BankAccountsController.php31440644editdlrm
BannersController.php45400644editdlrm
CategoriesController.php44980644editdlrm
CauseNewsController.php21450644editdlrm
CausesController.php87590644editdlrm
CronsController.php18000644editdlrm
DashboardController.php10620644editdlrm
DocumentsController.php36490644editdlrm
DonationsController.php5590644editdlrm
GalleryImagesController.php32460644editdlrm
OrdersController.php44760644editdlrm
ProductsController.php56420644editdlrm
ProposedCausesController.php33390644editdlrm
SettingsController.php31570644editdlrm
SponsorsActivitiesController.php40030644editdlrm
SponsorsController.php36470644editdlrm
TagsController.php26520644editdlrm
UsersController.php82440644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/Controller/Admin/DocumentsController.php (3649B)
paginate($this->Documents); $this->set(compact('documents')); } /** * downloadFile method */ public function viewFile($file_path) { $document = $this->loadModel('Documents')->find() ->where(['Documents.file_path' => $file_path]) ->first(); if (!empty($document)) { if (file_exists(ROOT . DS . $document->upload_dir)) { $ext = pathinfo($document->file_path, PATHINFO_EXTENSION); $response = $this->response->withFile(ROOT . DS . $document->upload_dir . $document->file_path, ['download' => false, 'name' => \Cake\Utility\Inflector::camelize($document->name) . '.' . $ext]); return $response; } else { $this->Flash->error(__('Acest document nu a fost găsit. #121532')); } } else { $this->Flash->error(__('Acest document nu a fost găsit. #121533')); } return $this->redirect($this->referer()); } /** * Add method */ public function upload($model, $foreignKey, $foreignUuid) { $this->autoRender = false; //$causeUuid = $this->Documents->Causes->get($foreignKey); $document = $this->Documents->newEmptyEntity(); if ($this->request->is('post')) { $document = $this->Documents->patchEntity($document, $this->request->getData()); $document->foreign_key = $foreignKey; $document->model = $model; $document->foreign_uuid = $foreignUuid; if ($this->Documents->save($document)) { // $this->Flash->success(__('The cause doc has been saved.')); // return $this->redirect(['prefix' => 'Admin', 'controller' => 'Causes', 'action' => 'editDocs', $causeUuid->uuid]); } // $this->Flash->error(__('The cause doc could not be saved. Please, try again.')); // return $this->redirect(['prefix' => 'Admin', 'controller' => 'Causes', 'action' => 'editDocs', $causeUuid->uuid]); } die; } // TODO /** * Edit method */ // public function edit($id = null) // { // $causeDoc = $this->CauseDocs->get($id, [ // 'contain' => [], // ]); // if ($this->request->is(['patch', 'post', 'put'])) { // $causeDoc = $this->CauseDocs->patchEntity($causeDoc, $this->request->getData()); // if ($this->CauseDocs->save($causeDoc)) { // $this->Flash->success(__('The cause doc has been saved.')); // return $this->redirect(['action' => 'index']); // } // $this->Flash->error(__('The cause doc could not be saved. Please, try again.')); // } // $this->set(compact('causeDoc')); // } /** * Delete method */ public function delete($id = null, $causeUuid = null) { $this->request->allowMethod(['post', 'delete']); $document = $this->Documents->get($id); if ($this->Documents->delete($document)) { $this->Flash->success(__('The document has been deleted.')); } else { $this->Flash->error(__('The document could not be deleted. Please, try again.')); } return $this->redirect(['prefix' => 'Admin', 'controller' => 'Causes', 'action' => 'editDocs', $causeUuid]); } }