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.
45 lines
1.2 KiB
45 lines
1.2 KiB
<?php
|
|
|
|
namespace BusinessClass;
|
|
|
|
class CheckBoxQuestion 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 = "\t\t\t<div class='question'>
|
|
<label>$content</label>\n";
|
|
|
|
for($i = 0; $i < count($possibleResponses); $i++)
|
|
{
|
|
$categoriesSplit = "_";
|
|
foreach ($categories[$i] as $category)
|
|
{
|
|
$categoriesSplit.= $category."_";
|
|
}
|
|
$html.= "\t\t\t\t<input type='checkbox' id='checkBoxQuestion' name='answers[]' value='$categoriesSplit' />
|
|
<label>$possibleResponses[$i]</label>\n";
|
|
}
|
|
$html.= "\t\t\t</div>\n";
|
|
|
|
return $html;
|
|
}
|
|
} |