public static function getAllDataOnPollID() { $poll_data = self::getAllOnPollID($poll_id); foreach ($poll_data as $pd) { $pd->voters = PollVoterDB::getCountOnPollDataID($pd->id); } uasort($poll_data, array(__CLASS__, "compare")); return $poll_data; }
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); }