/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/SponsorsController.php (3647B)
paginate($this->Sponsors); $this->set(compact('sponsors')); } /** * View method */ public function view($id = null) { $sponsor = $this->Sponsors->get($id, [ 'contain' => ['SponsorsActivities'] ]); $this->set(compact('sponsor')); } /** * Add method */ public function add() { $sponsor = $this->Sponsors->newEmptyEntity(); if ($this->request->is('post')) { $data = $this->request->getData(); $image = $data['image']; $name = $image->getClientFilename(); $image->moveTo(WWW_ROOT . 'img' . DS . $name); $data['image'] = $name; $sponsor = $this->Sponsors->patchEntity($sponsor, $data); if ($this->Sponsors->save($sponsor)) { $this->Flash->success(__('The sponsor has been saved.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Sponsors', 'action' => 'index']); } $this->Flash->error(__('The sponsor could not be saved. Please, try again.')); } $this->set(compact('sponsor')); } /** * Edit method */ public function edit($id = null) { if (!empty($id) && is_numeric($id)) { $sponsor = $this->Sponsors->get($id, [ 'contain' => ['SponsorsActivities'], ]); if ($this->request->is(['patch', 'post', 'put'])) { $data = $this->request->getData(); $image = $data['image']; if ($image->getError() == 0) { $data = $this->request->getData(); $image = $data['image']; $name = $image->getClientFilename(); $image->moveTo(WWW_ROOT . 'img' . DS . $name); $data['image'] = $name; } else { unset($data['image']); } $sponsor = $this->Sponsors->patchEntity($sponsor, $data); if ($this->Sponsors->save($sponsor)) { $this->Flash->success(__('The sponsor has been saved.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Sponsors', 'action' => 'index']); } $this->Flash->error(__('The sponsor could not be saved. Please, try again.')); } } else { $this->Flash->error(__('Oops. Please, try again.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Sponsors', 'action' => 'index']); } $this->set(compact('sponsor')); } /** * Delete method */ public function delete($id = null) { if (!empty($id) && is_numeric($id)) { $this->request->allowMethod(['post', 'delete']); $sponsor = $this->Sponsors->get($id); if ($this->Sponsors->delete($sponsor)) { $this->Flash->success(__('The sponsor has been deleted.')); } else { $this->Flash->error(__('The sponsor could not be deleted. Please, try again.')); } } else { $this->Flash->error(__('Oops. Please, try again.')); } return $this->redirect(['prefix' => 'Admin', 'controller' => 'Sponsors', 'action' => 'index']); } }