public function actionPageById($id) { $page = Page::findByPK($id); if (empty($page)) { throw new E404Exception(); } $this->data->page = $page; }
public function actionMoveAfter($id, $to) { try { $item = Page::findByPK($id); if (empty($item)) { throw new Exception('Source element does not exist'); } $destination = Page::findByPK($to); if (empty($destination)) { throw new Exception('Destination element does not exist'); } $item->insertAfter($destination); $this->data->result = true; } catch (Exception $e) { $this->data->result = false; $this->data->error = $e->getMessage(); } }