/** * menu * @return ViewModel */ public function topAction() { $user_info = $this->auth()->getUserInfo(); $this->layout()->setVariables($user_info); $page = new PageEntity(); if (!$this->auth()->get('admin')) { $rows = $page->db()->getMenuList($this->auth()->get('user_no'), IS_SP); } else { $rows = $page->db()->getAllMenu(IS_SP); } $values = array('rows' => $rows); $view = new ViewModel($values); $view->setTemplate('/' . VIEW_DIR . '/menu/top.phtml'); return $view; }
/** * 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 PageEntity(); // 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; }