Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| HottextInteraction | |
0.00% |
0 / 23 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| getUsedAttributes | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| getChoices | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| addChoice | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| createChoice | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| removeChoice | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTemplateQtiVariables | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\qti\interaction; |
| 24 | |
| 25 | use oat\taoQtiItem\model\qti\interaction\HottextInteraction; |
| 26 | use oat\taoQtiItem\model\qti\interaction\ContainerInteraction; |
| 27 | use oat\taoQtiItem\model\qti\choice\Choice; |
| 28 | use oat\taoQtiItem\model\qti\exception\QtiModelException; |
| 29 | |
| 30 | /** |
| 31 | * QTI Hottext Interaction |
| 32 | * |
| 33 | * @access public |
| 34 | * @author Sam, <sam@taotesting.com> |
| 35 | * @package taoQTI |
| 36 | |
| 37 | */ |
| 38 | class HottextInteraction extends ContainerInteraction |
| 39 | { |
| 40 | /** |
| 41 | * the QTI tag name as defined in QTI standard |
| 42 | * |
| 43 | * @access protected |
| 44 | * @var string |
| 45 | */ |
| 46 | protected static $qtiTagName = 'hottextInteraction'; |
| 47 | protected static $choiceClass = 'oat\\taoQtiItem\\model\\qti\\choice\\Hottext'; |
| 48 | protected static $containerType = 'oat\\taoQtiItem\\model\\qti\\container\\ContainerHottext'; |
| 49 | protected static $baseType = 'identifier'; |
| 50 | |
| 51 | protected function getUsedAttributes() |
| 52 | { |
| 53 | return array_merge( |
| 54 | parent::getUsedAttributes(), |
| 55 | [ |
| 56 | 'oat\\taoQtiItem\\model\\qti\\attribute\\MaxChoices', |
| 57 | 'oat\\taoQtiItem\\model\\qti\\attribute\\MinChoices' |
| 58 | ] |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | public function getChoices($matchSet = null) |
| 63 | { |
| 64 | return $this->getBody()->getElements(static::$choiceClass); |
| 65 | } |
| 66 | |
| 67 | public function addChoice(Choice $choice, $matchSet = null) |
| 68 | { |
| 69 | throw new QtiModelException( |
| 70 | 'For Hottext Interaction, the choices are in the container, please use Container::setElement() instead' |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | public function createChoice($choiceAttributes = [], $choiceValue = null, $matchSet = null) |
| 75 | { |
| 76 | throw new QtiModelException( |
| 77 | 'For Hottext Interaction, the choices are in the container, please use Container::setElement() instead' |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | public function removeChoice(Choice $choice, $matchSet = null) |
| 82 | { |
| 83 | return $this->body->removeElement($choice); |
| 84 | } |
| 85 | |
| 86 | protected function getTemplateQtiVariables() |
| 87 | { |
| 88 | $variables = parent::getTemplateQtiVariables(); |
| 89 | unset($variables['choices']); //hottexts are contained in the container already |
| 90 | return $variables; |
| 91 | } |
| 92 | |
| 93 | public function toArray($filterVariableContent = false, &$filtered = []) |
| 94 | { |
| 95 | $data = parent::toArray($filterVariableContent, $filtered); |
| 96 | unset($data['choices']); |
| 97 | return $data; |
| 98 | } |
| 99 | } |