Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ObjectInteraction | |
0.00% |
0 / 12 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| setObject | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getObject | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getTemplateQtiVariables | |
0.00% |
0 / 3 |
|
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 | namespace oat\taoQtiItem\model\qti\interaction; |
| 23 | |
| 24 | use oat\taoQtiItem\model\qti\interaction\ObjectInteraction; |
| 25 | use oat\taoQtiItem\model\qti\interaction\BlockInteraction; |
| 26 | use oat\taoQtiItem\model\qti\Item; |
| 27 | use oat\taoQtiItem\model\qti\QtiObject; |
| 28 | |
| 29 | /** |
| 30 | * The QTI object interaction is a subclass of the QTI block interaction |
| 31 | * that primarily has a QTI Object as his content |
| 32 | * It is not specifically described in the QTI standard as such, |
| 33 | * but is simply a way to group interactions that have the same content type |
| 34 | * |
| 35 | * @access public |
| 36 | * @author Sam, <sam@taotesting.com> |
| 37 | * @package taoQTI |
| 38 | |
| 39 | */ |
| 40 | abstract class ObjectInteraction extends BlockInteraction |
| 41 | { |
| 42 | /** |
| 43 | * The main content of an ObjectInteraction is a QTI object |
| 44 | * |
| 45 | * @var oat\taoQtiItem\model\qti\QtiObject |
| 46 | */ |
| 47 | protected $object = null; |
| 48 | |
| 49 | public function __construct($attributes = [], Item $relatedItem = null, $serial = '') |
| 50 | { |
| 51 | parent::__construct($attributes, $relatedItem, $serial); |
| 52 | $this->object = new QtiObject(); |
| 53 | } |
| 54 | |
| 55 | public function setObject(QtiObject $object) |
| 56 | { |
| 57 | $this->object = $object; |
| 58 | } |
| 59 | |
| 60 | public function getObject() |
| 61 | { |
| 62 | return $this->object; |
| 63 | } |
| 64 | |
| 65 | public function toArray($filterVariableContent = false, &$filtered = []) |
| 66 | { |
| 67 | $returnValue = parent::toArray($filterVariableContent, $filtered); |
| 68 | $returnValue['object'] = $this->object->toArray($filterVariableContent, $filtered); |
| 69 | return $returnValue; |
| 70 | } |
| 71 | |
| 72 | protected function getTemplateQtiVariables() |
| 73 | { |
| 74 | $variables = parent::getTemplateQtiVariables(); |
| 75 | $variables['object'] = $this->object->toQTI(); |
| 76 | return $variables; |
| 77 | } |
| 78 | } |