You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
<?php
|
|
|
|
namespace BusinessClass;
|
|
|
|
class ListBoxQuestion extends BoxQuestion
|
|
{
|
|
/**
|
|
* @param array $possibleResponses
|
|
* @param string $content
|
|
* @param array $categories
|
|
*/
|
|
public function __construct(array $possibleResponses, string $content, array $categories)
|
|
{
|
|
parent::__construct($possibleResponses, $content, $categories);
|
|
}
|
|
|
|
public function responseStrategy()
|
|
{
|
|
// TODO: Implement responseStrategy() method.
|
|
}
|
|
|
|
public function printStrategy(): string
|
|
{
|
|
$content = $this->getContent();
|
|
$possibleResponses = $this->getPossibleResponses();
|
|
$categories = $this->getCategories();
|
|
|
|
$html = "<div id='question'>
|
|
<label>$content</label>
|
|
<select name='answers[]'>";
|
|
|
|
for($i = 0; $i < count($possibleResponses); $i++)
|
|
{
|
|
$html.= "<option value='$categories[$i]'>$possibleResponses[$i]</option>";
|
|
}
|
|
$html.= "</select>
|
|
</div>";
|
|
|
|
return $html;
|
|
}
|
|
} |