public function movePage() { ipRequest()->mustBePost(); $data = ipRequest()->getPost(); if (!isset($data['pageId'])) { throw new \Ip\Exception("Page id is not set"); } $pageId = (int) $data['pageId']; if (!empty($data['destinationParentId'])) { $destinationParentId = $data['destinationParentId']; } else { if (!isset($data['languageId'])) { throw new \Ip\Exception("Missing required parameters"); } throw new \Ip\Exception\NotImplemented(); } if (!isset($data['destinationPosition'])) { throw new \Ip\Exception("Destination position is not set"); } $destinationPosition = $data['destinationPosition']; try { Model::movePage($pageId, $destinationParentId, $destinationPosition); } catch (\Ip\Exception $e) { $answer = array('status' => 'error', 'error' => $e->getMessage()); return new \Ip\Response\Json($answer); } $answer = array('status' => 'success'); return new \Ip\Response\Json($answer); }
/** * Move page * * @param int $pageId * @param int $destinationParentId * @param int $destinationPosition */ public static function movePage($pageId, $destinationParentId, $destinationPosition) { Model::movePage($pageId, $destinationParentId, $destinationPosition); }