HTML and CSS Reference
In-Depth Information
This method simply calls a method from the Question_Model class, which has not yet been defined. Once the
model is built, this method will return all the questions for a given room ID.
Adding the Ask a Question Form
In addition to the vote up and answer forms, there is one additional form that needs to be added to the Question
class: the form for asking new questions.
Adding the Ask a Question Method
In the Question class, add the new method using the following bold code:
protected function output_answer_form( $room_id, $question_id )
$view = new View('question-answer');
$view->room_id = $room_id;
$view->question_id = $question_id;
$view->form_action = APP_URI . 'question/answer';
$view->nonce = $this->generate_nonce();
return $view->render(FALSE);
* Generates the form to ask a new question
* @param $is_active bool Whether or not the room is active
* @param $email string The email address of the presenter
* @return string The markup to display the form
public function output_ask_form( $is_active, $email )
if ($is_active) {
$view = new View('ask-form');
$view->room_id = $this->room_id;
$view->form_action = APP_URI . 'question/ask';
$view->nonce = $this->generate_nonce();
return $view->render(FALSE);
} else {
$view = new View('room-closed');
$view->email = $email;
return $view->render(FALSE);
This method is very similar to the other two form methods, but there's one important difference: there are two
views that can be returned from this method depending on whether the room is active or not.
Search WWH ::

Custom Search