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.
49 lines
1.3 KiB
49 lines
1.3 KiB
<?php
|
|
|
|
namespace BusinessClass;
|
|
|
|
class ListBoxQuestion extends BoxQuestion
|
|
{
|
|
/**
|
|
* @param array $possibleResponses
|
|
* @param string $content
|
|
* @param array $categories
|
|
* @param int $id
|
|
*/
|
|
public function __construct(array $possibleResponses, string $content, array $categories, int $id)
|
|
{
|
|
parent::__construct($possibleResponses, $content, $categories, $id);
|
|
}
|
|
|
|
public function responseStrategy()
|
|
{
|
|
// TODO: Implement responseStrategy() method.
|
|
}
|
|
|
|
public function printStrategy(): string
|
|
{
|
|
$id = $this->getId();
|
|
$content = $this->getContent();
|
|
$possibleResponses = $this->getPossibleResponses();
|
|
$categories = $this->getCategories();
|
|
|
|
$html = "\t\t\t<div class='question'>
|
|
<label>$content</label>
|
|
<select name='answers[]'>\n";
|
|
|
|
for($i = 0; $i < count($possibleResponses); $i++)
|
|
{
|
|
$categoriesSplit = $id."#".$possibleResponses[$i]."||";
|
|
foreach ($categories[$i] as $category)
|
|
{
|
|
$categoriesSplit.= $category."_";
|
|
}
|
|
$html.= "\t\t\t\t\t<option value='$categoriesSplit'>$possibleResponses[$i]</option>\n";
|
|
}
|
|
$html.= "\t\t\t\t</select>
|
|
</div>\n";
|
|
|
|
return $html;
|
|
}
|
|
}
|