Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
7.69% |
1 / 13 |
|
25.00% |
1 / 4 |
CRAP | |
0.00% |
0 / 1 |
| QTIPackedItem22Exporter | |
7.69% |
1 / 13 |
|
25.00% |
1 / 4 |
16.58 | |
0.00% |
0 / 1 |
| renderManifest | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| itemContentPostProcessing | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getQTIVersion | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getQti22PostProcessor | |
0.00% |
0 / 1 |
|
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) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung |
| 19 | * (under the project TAO-TRANSFER); |
| 20 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 21 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 22 | * 2013-2016 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 23 | */ |
| 24 | |
| 25 | namespace oat\taoQtiItem\model\Export; |
| 26 | |
| 27 | use DOMDocument; |
| 28 | |
| 29 | class QTIPackedItem22Exporter extends QTIPackedItemExporter |
| 30 | { |
| 31 | protected function renderManifest(array $options, array $qtiItemData) |
| 32 | { |
| 33 | $dir = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getDir(); |
| 34 | $tpl = $dir . 'model/qti/templates/imsmanifestQti22.tpl.php'; |
| 35 | |
| 36 | $templateRenderer = new \taoItems_models_classes_TemplateRenderer($tpl, [ |
| 37 | 'qtiItems' => [$qtiItemData], |
| 38 | 'manifestIdentifier' => 'MANIFEST-' . \tao_helpers_Display::textCleaner(uniqid('tao', true), '-') |
| 39 | ]); |
| 40 | |
| 41 | $renderedManifest = $templateRenderer->render(); |
| 42 | $newManifest = new \DOMDocument('1.0', TAO_DEFAULT_ENCODING); |
| 43 | $newManifest->loadXML($renderedManifest); |
| 44 | |
| 45 | return $newManifest; |
| 46 | } |
| 47 | |
| 48 | protected function itemContentPostProcessing($content): string |
| 49 | { |
| 50 | return $this->getQti22PostProcessor()->itemContentPostProcessing($content); |
| 51 | } |
| 52 | |
| 53 | protected function getQTIVersion(): string |
| 54 | { |
| 55 | return '2p2'; |
| 56 | } |
| 57 | |
| 58 | private function getQti22PostProcessor(): Qti22PostProcessorService |
| 59 | { |
| 60 | return $this->getServiceManager()->getContainer()->get(Qti22PostProcessorService::class); |
| 61 | } |
| 62 | } |