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.
40 lines
1.1 KiB
40 lines
1.1 KiB
<?php
|
|
|
|
namespace FORM_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 = "<div id='question'>
|
|
<label>$content</label>";
|
|
|
|
for($i = 0; $i < count($possibleResponses); $i++)
|
|
{
|
|
$html.= "<input type='checkbox' id='checkBoxQuestion' name='answers[]' value='$categories[$i]' />
|
|
<label>$possibleResponses[$i]</label>";
|
|
}
|
|
$html.= "</div>";
|
|
|
|
return $html;
|
|
}
|
|
} |