/** * Save the submitted sort order * of categories to database * * @throws \Exception */ public function saveSortOrder() { if (empty($_POST['cat']) && !is_array($_POST['cat'])) { throw new \Exception('Unable to sort the order. No "cat" element in POST '); } d('cat array: ' . print_r($_POST['cat'], 1)); try { $this->checkAccessPermission('edit_category'); $canEdit = true; } catch (\Exception $e) { $canEdit = false; } if ($canEdit) { $Editor = new \Lampcms\Category\Editor($this->Registry); $res = $Editor->saveOrder($_POST['cat']); d('saved ' . $res . ' categories'); } /** * @todo * Translate String */ Responder::sendJSON(array('alert' => '@@Sort order saved@@')); }
/** * Save the submitted sort order * of categories to database * * @throws \Exception */ public function saveSortOrder() { if (empty($_POST['cat']) && !is_array($_POST['cat'])) { throw new \Exception('Unable to sort the order. No "cat" element in POST '); } d('cat array: ' . print_r($_POST['cat'], 1)); $Editor = new \Lampcms\Category\Editor($this->Registry); $res = $Editor->saveOrder($_POST['cat']); d('saved ' . $res . ' categories'); /** * @todo * Translate String */ Responder::sendJSON(array('alert' => $this->_('Sort order saved'))); }