HTML and CSS Reference
In-Depth Information
if (isset($_COOKIE[$cookie]) && $_COOKIE[$cookie]==1) {
$view->voted_class = 'voted';
} else {
$view->voted_class = NULL;
$view->vote_link = $this->output_vote_form(
// TODO: Load the answer form for presenters, but not attendees
$view->answer_link = '';
// Returns the output of render() instead of printing it
$output .= $view->render(FALSE);
return $output;
* Generates the voting form for attendees
* @param $question_id int The ID of the question
* @param $answered int 1 if answered, 0 if unanswered
* @return mixed Markup if attendee, NULL if presenter
protected function output_vote_form( $room_id, $question_id, $answered )
$view = new View('question-vote');
$view->room_id = $room_id;
$view->question_id = $question_id;
$view->form_action = APP_URI . 'question/vote';
$view->nonce = $this->generate_nonce();
$view->disabled = $answered==1 ? 'disabled' : NULL;
return $view->render(FALSE);
The output_vote_form() method accepts three parameters: the ID of the current room, the ID of the current
question, and whether or not that question has been answered.
It then loads a new view— question-vote —and sets up variables for output. The room ID, question ID, form
action, and nonce are stored, as well as $disabled , which prevents the form from being submitted if the question
is already marked as answered.
This method returns its output to be stored in the $vote_link variable, where it becomes part of the
question view.
Search WWH ::

Custom Search