HTML and CSS Reference
In-Depth Information
Add the following bold code to the Room controller:
protected function output_questions( )
{
$controller = new Question(array($this->room_id));
// Allows for different output for presenters vs. attendees
$controller->is_presenter = $this->is_presenter;
return $controller->output_view();
}
/**
* Checks if a room exists and redirects the user appropriately
*
* @return void
*/
protected function join_room( )
{
$room_id = $this->sanitize($_POST['room_id']);
// If the room exists, creates the URL; otherwise, sends to a 404
if ($this->model->room_exists($room_id)) {
$header = APP_URI . 'room/' . $room_id;
} else {
$header = APP_URI . 'no-room';
}
header("Location: " . $header);
exit;
}
/**
* Determines whether or not the current user is the presenter
*
* @return boolean TRUE if it's the presenter, otherwise FALSE
*/
protected function is_presenter( )
{
Creating New Rooms
To create a new room, the controller needs to sanitize the presenter's name, e-mail, and room name; store them using
the room model's create_room() method; and then check that the room was created successfully. It should also set
a cookie identifying the room's creator as the presenter.
In class.room.inc.php , add the following bold code:
if ($this->model->room_exists($room_id)) {
$header = APP_URI . 'room/' . $room_id;
} else {
 
Search WWH ::




Custom Search