/** * restore * @return ViewModel */ public function restoreAction() { $this->init(); $id = (int) $this->params()->fromRoute('id', 0); if (!$id) { $success = false; } else { $success = 4 == $this->ctrlLv ? true : false; } $db = new ControllerEntity(); // redirect to error page if ($success) { $success = $db->db()->restoreRecord($id, $this->auth()->get('user_no')); } $this->flashMessenger()->addMessage($success ? 'Restored' : 'Failed'); // ->addMessage($success ? '復帰しました。' : '処理失敗'); $view = new ViewModel(array('message' => $success ? 'success' : 'failed')); $view->setTemplate('/common/message.phtml'); $view->setTerminal(true); return $view; }
/** * get auth level * @param string $_ctrl_name : controller name * @return int|boolean */ public function getRoleLevel($_ctrl_name) { if (!$this->user_no) { return false; } else { if ($this->admin) { return 4; } } $ctrl = new ControllerEntity(); return $ctrl->getRoleLevel($this->user_no, $_ctrl_name); }