Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| None | |
0.00% |
0 / 15 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| getDefaultValue | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| setDefaultValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRule | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| toQTI | |
0.00% |
0 / 7 |
|
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\response\interactionResponseProcessing; |
| 24 | |
| 25 | use oat\taoQtiItem\model\qti\response\interactionResponseProcessing\None; |
| 26 | use oat\taoQtiItem\model\qti\response\interactionResponseProcessing\InteractionResponseProcessing; |
| 27 | |
| 28 | /** |
| 29 | * no response processing |
| 30 | * |
| 31 | * @access public |
| 32 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 33 | * @package taoQTI |
| 34 | |
| 35 | */ |
| 36 | class None extends InteractionResponseProcessing |
| 37 | { |
| 38 | // --- ASSOCIATIONS --- |
| 39 | |
| 40 | |
| 41 | // --- ATTRIBUTES --- |
| 42 | |
| 43 | /** |
| 44 | * Short description of attribute CLASS_ID |
| 45 | * |
| 46 | * @access public |
| 47 | * @var string |
| 48 | */ |
| 49 | public const CLASS_ID = 'none'; |
| 50 | |
| 51 | /** |
| 52 | * Short description of attribute default |
| 53 | * |
| 54 | * @access protected |
| 55 | * @var string |
| 56 | */ |
| 57 | protected $default = ''; |
| 58 | |
| 59 | // --- OPERATIONS --- |
| 60 | |
| 61 | /** |
| 62 | * Short description of method getDefaultValue |
| 63 | * |
| 64 | * @access public |
| 65 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 66 | * @return string |
| 67 | */ |
| 68 | public function getDefaultValue() |
| 69 | { |
| 70 | $returnValue = (string) ''; |
| 71 | |
| 72 | |
| 73 | return $this->default; |
| 74 | |
| 75 | |
| 76 | return (string) $returnValue; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Short description of method setDefaultValue |
| 81 | * |
| 82 | * @access public |
| 83 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 84 | * @param string value |
| 85 | * @return mixed |
| 86 | */ |
| 87 | public function setDefaultValue($value) |
| 88 | { |
| 89 | |
| 90 | $this->default = $value; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Short description of method getRule |
| 95 | * |
| 96 | * @access public |
| 97 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 98 | * @return string |
| 99 | */ |
| 100 | public function getRule() |
| 101 | { |
| 102 | $returnValue = (string) ''; |
| 103 | |
| 104 | |
| 105 | $returnValue = 'if(isNull(null, getResponse("' . $this->getResponse()->getIdentifier() . '"))) { ' . |
| 106 | 'setOutcomeValue("' . $this->getOutcome()->getIdentifier() . '", ' . $this->getDefaultValue() . '); };'; |
| 107 | |
| 108 | |
| 109 | return (string) $returnValue; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * although no ResponseRules are nescessary to have no responseProcessing, |
| 114 | * add some rules to associate the interaction response with a sepcific |
| 115 | * |
| 116 | * @access public |
| 117 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 118 | * @return string |
| 119 | */ |
| 120 | public function toQTI() |
| 121 | { |
| 122 | $returnValue = (string) ''; |
| 123 | |
| 124 | |
| 125 | $returnValue = '<responseCondition> |
| 126 | <responseIf> |
| 127 | <isNull> |
| 128 | <variable identifier="' . $this->getResponse()->getIdentifier() . '" /> |
| 129 | </isNull> |
| 130 | <setOutcomeValue identifier="' . $this->getOutcome()->getIdentifier() . '"> |
| 131 | <baseValue baseType="' . $this->getOutcome()->getAttributeValue('baseType') . '">0</baseValue> |
| 132 | </setOutcomeValue> |
| 133 | </responseIf> |
| 134 | </responseCondition>'; |
| 135 | |
| 136 | |
| 137 | return (string) $returnValue; |
| 138 | } |
| 139 | } |