public function actionPoll() { $message_name = "poll"; if ($this->request->poll) { $poll_voter_db = new PollVoterDB(); $poll_data = PollDataDB::getAllOnPollID($this->request->id); $already_poll = PollVoterDB::isAlreadyPoll(array_keys($poll_data)); $checks = array(array($already_poll, false, "ERROR_ALREADY_POLL")); $this->fp->process($message_name, $poll_voter_db, array("poll_data_id"), $checks, "SUCCESS_POLL"); $this->redirect(URL::current()); } $poll_db = new PollDB(); $poll_db->load($this->request->id); if (!$poll_db->isSaved()) { $this->notFound(); } $this->title = "Результаты голосования: " . $poll_db->title; $this->meta_desc = "Результаты голосования: " . $poll_db->title . "."; $this->meta_key = "результаты голосования, " . mb_strtolower($poll_db->title); $poll_data = PollDataDB::getAllDataOnPollID($poll_db->id); $hornav = $this->getHornav(); $hornav->addData($poll_db->title); $poll_result = new PollResult(); $poll_result->hornav = $hornav; $poll_result->message = $this->fp->getSessionMessage($message_name); $poll_result->title = $poll_db->title; $poll_result->data = $poll_data; $this->render($poll_result); }
protected function getLeft() { $items = MenuDB::getMainMenu(); $mainmenu = new MainMenu(); $mainmenu->uri = $this->url_active; $mainmenu->items = $items; if ($this->auth_user) { $user_panel = new UserPanel(); $user_panel->user = $this->auth_user; $user_panel->uri = $this->url_active; $user_panel->addItem("Редактировать профиль", URL::get("editprofile", "user")); $user_panel->addItem("Выход", URL::get("logout")); } else { $user_panel = ""; } $poll_db = new PollDB(); $poll_db->loadRandom(); if ($poll_db->isSaved()) { $poll = new Poll(); $poll->action = URL::get("poll", "", array("id" => $poll_db->id)); $poll->title = $poll_db->title; $poll->data = PollDataDB::getAllOnPollID($poll_db->id); } else { $poll = ""; } return $user_panel . $mainmenu . $poll; }