Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 32
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/*
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; under version 2
6 * of the License (non-upgradable).
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16 *
17 * Copyright (c) 2013-2018 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
18 *
19 *
20 */
21$correctResponses = get_data('correctResponses');
22$defaultValues = get_data('defaultValue');
23$mapping = get_data('mapping');
24$areaMapping = get_data('areaMapping');
25?>
26<responseDeclaration <?=get_data('attributes')?><?php if(!$correctResponses && !$mapping && !$areaMapping && !$defaultValues):?>/>
27<?php else:?>>
28    <?php if(is_array($defaultValues) && count($defaultValues) > 0):?>
29    <defaultValue>
30        <?php foreach($defaultValues as $value):?>
31            <value<?php foreach($value->getAttributeValues() as $attrName => $attrValue):?> <?=$attrName?>="<?=$attrValue?>"<?php endforeach;?>><![CDATA[<?= $value ?>]]></value>
32        <?php endforeach?>
33    </defaultValue>
34    <?php endif?>
35    <?php if(is_array($correctResponses) && count($correctResponses) > 0):?>
36    <correctResponse>
37        <?php foreach($correctResponses as $value):?>
38            <value<?php foreach($value->getAttributeValues() as $attrName => $attrValue):?> <?=$attrName?>="<?=$attrValue?>"<?php endforeach;?>><![CDATA[<?= $value ?>]]></value>
39        <?php endforeach?>
40    </correctResponse>
41    <?php endif?>
42    <?php if(!is_null($mapping) && count($mapping) > 0):?>
43    <mapping <?=get_data('mappingAttributes')?>>
44        <?php foreach($mapping as $key => $value):?>
45            <mapEntry mapKey="<?=$key?>" mappedValue="<?=$value?>"/>
46        <?php endforeach?>
47    </mapping>
48    <?php endif?>
49    <?php if(!is_null($areaMapping) && count($areaMapping) > 0):?>
50    <areaMapping <?=get_data('mappingAttributes')?>>
51        <?php foreach($areaMapping as $areaMapEntry):?>
52            <areaMapEntry <?php foreach($areaMapEntry as $key => $value):?><?=$key?>="<?=$value?><?php endforeach;?> />
53        <?php endforeach?>
54    </areaMapping>
55    <?php endif?>
56</responseDeclaration>
57<?php endif?>