private function showIndexPage($schedule) { $master = new Master(); $info_message = $master->get_info(); $is_able_to_register = $schedule->is_in_time('regist', $this->current_time); $is_able_to_post_impression = $schedule->is_in_time('impre', $this->current_time); $bms_info = new BmsInfo(); $bms_data = $bms_info->get_data(); $this->view->assign('info_message', $info_message); $this->view->assign('bms_data', $bms_data); $this->view->assign('is_able_to_register', $is_able_to_register); $this->view->assign('is_able_to_post_impression', $is_able_to_post_impression); $this->view->assign('root_url', ROOT_URL); $this->view->display('index.tpl'); }
public function reviseAction() { try { if (!$this->request->getPost()) { throw new Exception('こらっ'); } if ($this->request->getPost('password') == null) { throw new Exception('パスワードを入れてください。'); } $bms_info = new BmsInfo(); $bms_data = $bms_info->get_data($this->request->getPost('bms_no')); if (!(crypt($this->request->getPost('password'), $bms_data['password']) === $bms_data['password'])) { throw new Exception('パスワードが一致しません'); } $bms_info->revise($this->request->getPost(), $this->current_time, $this->ip, $this->host); header("Location: " . ROOT_URL . "/revise/thanks/"); } catch (Exception $e) { $this->displayErrorView($e->getMessage()); } }
public function postAction() { try { if (!$this->request->getPost()) { throw new Exception('こらっ'); } $schedule = new Schedule(); $is_able_to_post_impression = $schedule->is_in_time('impre', $this->current_time); if ($is_able_to_post_impression) { $bms_no = $this->request->getPost('bms_no'); $impression = new Impression($bms_no); $impression->post($this->request->getPost(), $this->current_time, $this->ip, $this->host); $bms_info = new BmsInfo(); $bms_info->update_by_impression($bms_no, $this->request->getPost('point'), $this->current_time); header("Location: " . ROOT_URL . "/detail/thanks/{$bms_no}/"); } else { throw new Exception('作品評価期間ではありません'); } } catch (Exception $e) { $this->displayErrorView($e->getMessage()); } }
public function registerAction() { try { if (!$this->request->getPost()) { throw new Exception('こらっ'); } $schedule = new Schedule(); $is_able_to_register = $schedule->is_in_time('regist', $this->current_time); if ($is_able_to_register) { // BMSデータを登録 $bms_info = new BmsInfo(); $bms_info->register($this->request->getPost(), $this->current_time, $this->ip, $this->host); // インプレッション用のDBを新規作成 $lastid = $bms_info->get_last_id(); $impression = new Impression($lastid); $impression->create(); header("Location: " . ROOT_URL . "/registration/thanks/"); } else { throw new Exception('作品登録期間ではありません'); } } catch (Exception $e) { $this->displayErrorView($e->getMessage()); } }
public function viewresultAction() { $this->checkLogin(); function cmp($a, $b) { if ($a['point'] == $b['point']) { return $a['imp'] < $b['imp'] ? -1 : 1; } return $a['point'] > $b['point'] ? -1 : 1; } try { $bms_info = new BmsInfo(); $bms_data = $bms_info->get_data(); usort($bms_data, 'cmp'); } catch (Exception $e) { $this->displayErrorView($e->getMessage()); } $this->view->assign('bms_data', $bms_data); $this->view->assign('root_url', ROOT_URL); $this->view->display('admin/admin_result.tpl'); }