| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 0.00% | 0 / 13 |  | 0.00% | 0 / 2 | CRAP |  | 0.00% | 0 / 1 | 
| ContainerInteractive |  | 0.00% | 0 / 13 |  | 0.00% | 0 / 2 | 72 |  | 0.00% | 0 / 1 | 
| afterElementSet |  | 0.00% | 0 / 7 |  | 0.00% | 0 / 1 | 20 | |||
| afterElementRemove |  | 0.00% | 0 / 6 |  | 0.00% | 0 / 1 | 20 | |||
| 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\container; | 
| 24 | |
| 25 | use oat\taoQtiItem\model\qti\container\Container; | 
| 26 | use oat\taoQtiItem\model\qti\Element; | 
| 27 | use oat\taoQtiItem\model\qti\interaction\Interaction; | 
| 28 | |
| 29 | /** | 
| 30 | * The QTI_ContainerInteraction is a QTI Container that may contain interactions | 
| 31 | * | 
| 32 | * @access public | 
| 33 | * @author Sam, <sam@taotesting.com> | 
| 34 | * @package taoQTI | 
| 35 | |
| 36 | */ | 
| 37 | abstract class ContainerInteractive extends Container | 
| 38 | { | 
| 39 | public function afterElementSet(Element $qtiElement) | 
| 40 | { | 
| 41 | parent::afterElementSet($qtiElement); | 
| 42 | if ($qtiElement instanceof Interaction) { | 
| 43 | $item = $this->getRelatedItem(); | 
| 44 | if (isset($item)) { | 
| 45 | if (!is_null($item->getResponseProcessing())) { | 
| 46 | $item->getResponseProcessing()->takeNoticeOfAddedInteraction($qtiElement, $item); | 
| 47 | } | 
| 48 | $qtiElement->setRelatedItem($item); | 
| 49 | } | 
| 50 | } | 
| 51 | } | 
| 52 | |
| 53 | public function afterElementRemove(Element $qtiElement) | 
| 54 | { | 
| 55 | parent::afterElementRemove($qtiElement); | 
| 56 | if ($qtiElement instanceof Interaction) { | 
| 57 | $item = $this->getRelatedItem(); | 
| 58 | if (isset($item)) { | 
| 59 | if (!is_null($item->getResponseProcessing())) { | 
| 60 | //delete interaction response if set: | 
| 61 | $item->getResponseProcessing()->takeNoticeOfRemovedInteraction($qtiElement, $item); | 
| 62 | } | 
| 63 | } | 
| 64 | } | 
| 65 | } | 
| 66 | } |