/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/CategoriesController.php (4498B)
paginate = [ 'limit' => ADMIN_PAGE_LIMIT, 'contain' => ['ParentCategories'], 'order' => ['Categories.lft' => 'ASC'] ]; $categories = $this->paginate($this->Categories); $this->set(compact('categories')); } /** * View method */ public function view($id = null) { if (!empty($id)) { $category = $this->Categories->get($id, [ 'contain' => [], ]); } $this->set(compact('category')); } /** * Add method */ public function add() { $category = $this->Categories->newEmptyEntity(); $categories = $this->Categories->find('list') ->where(['Categories.parent_id IS' => null]); if ($this->request->is('post')) { $category = $this->Categories->patchEntity($category, $this->request->getData()); if ($this->Categories->save($category)) { $this->Flash->success(__('The category has been saved.')); return $this->redirect(['action' => 'edit', $category->id]); } $this->Flash->error(__('The category could not be saved. Please, try again.')); } $this->set(compact('category', 'categories')); } /** * Edit method */ public function edit($id = null) { if (!empty($id) && is_numeric($id)) { $category = $this->Categories->get($id, [ 'contain' => [], ]); $categories = $this->Categories->find('list') ->where(['Categories.parent_id IS' => null]); if ($this->request->is(['patch', 'post', 'put'])) { $category = $this->Categories->patchEntity($category, $this->request->getData()); if ($this->Categories->save($category)) { $this->Flash->success(__('The category has been saved.')); return $this->redirect($this->referer()); } $this->Flash->error(__('The category could not be saved. Please, try again.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Categories', 'action' => 'index']); } } else { $this->Flash->error(__('Oops. Please, try again.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Categories', 'action' => 'index']); } $this->set(compact('category', 'categories')); } public function changePosition($move, $id) { $this->autoRender = false; if (!empty($id && is_numeric($id))) { $categories = $this->Categories; $node = $categories->get($id); switch ($move) { case 'moveup': $categories->moveUp($node); break; case 'movedown': $categories->moveDown($node); break; default: break; } $this->Flash->success(__('The position has been changed.')); } else { $this->Flash->error(__('Oops. Please, try again.')); } return $this->redirect($this->referer()); } public function recover() { $this->Categories->recover(); $this->Flash->success(__('Categories are recovered.')); return $this->redirect(['prefix' => 'Admin', 'controller' => 'Categories', 'action' => 'index']); } /** * Delete method */ public function delete($id = null) { if (!empty($id) && is_numeric($id)) { $this->request->allowMethod(['post', 'delete']); $category = $this->Categories->get($id); if ($this->Categories->delete($category)) { $this->Flash->success(__('The category has been deleted.')); } else { $this->Flash->error(__('The category could not be deleted. Please, try again.')); } } else { $this->Flash->error(__('Oops. Please, try again.')); } return $this->redirect(['prefix' => 'Admin', 'controller' => 'Categories', 'action' => 'index']); } }