HTML and CSS Reference
In-Depth Information
Adding the Room View
Using the room markup from Chapter 7, create the room view by adding the following code to a new file located
at
system/views/room.inc.php
:
<section>
<header>
<h2>
<?php echo $room_name; ?>
</h2>
<p>
Presented by
<?php echo $presenter; ?>
(<a href="mailto:
<?php echo $email; ?>
">email</a>)
</p>
<?php echo $controls; ?>
</header>
<?php echo $ask_form; ?>
<ul id="questions" class="
<?php echo $questions_class; ?>
">
<?php echo $questions; ?>
</ul><!--/#questions-->
</section>
This markup generates everything needed to show a room and its questions for both attendees and presenters.
Showing the Ask Form
The ask form requires a new view, which will be loaded by a new method in the
Room
class. If you remember, the ask
form generation was already handled by the
Question
controller, so the new method will simply invoke the
output_ask_form()
method on the
Question
controller.
Add the following bold code to the
Room
controller:
$view->controls = $this->output_presenter_controls();
$view->questions = $this->output_questions();
$view->render();
}
/**
* Shows the "ask a question" form or a notice that the room has ended
*
* @param $email string The presenter's email address
* @return string Markup for the form or notice
*/
protected function output_ask_form( )
{
$controller = new Question(array($this->room_id));
return $controller->output_ask_form(
$this->is_active,
$this->room->email
);
}
Search WWH ::
Custom Search