tao-test/app/taoQtiItem/model/qti/templates/qti.responseDeclaration.tpl.php

58 lines
2.5 KiB
PHP
Raw Normal View History

2022-08-29 20:14:13 +02:00
<?php
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2013-2018 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
*
*
*/
$correctResponses = get_data('correctResponses');
$defaultValues = get_data('defaultValue');
$mapping = get_data('mapping');
$areaMapping = get_data('areaMapping');
?>
<responseDeclaration <?=get_data('attributes')?><?php if(!$correctResponses && !$mapping && !$areaMapping && !$defaultValues):?>/>
<?php else:?>>
<?php if(is_array($defaultValues) && count($defaultValues) > 0):?>
<defaultValue>
<?php foreach($defaultValues as $value):?>
<value<?php foreach($value->getAttributeValues() as $attrName => $attrValue):?> <?=$attrName?>="<?=$attrValue?>"<?php endforeach;?>><![CDATA[<?= $value ?>]]></value>
<?php endforeach?>
</defaultValue>
<?php endif?>
<?php if(is_array($correctResponses) && count($correctResponses) > 0):?>
<correctResponse>
<?php foreach($correctResponses as $value):?>
<value<?php foreach($value->getAttributeValues() as $attrName => $attrValue):?> <?=$attrName?>="<?=$attrValue?>"<?php endforeach;?>><![CDATA[<?= $value ?>]]></value>
<?php endforeach?>
</correctResponse>
<?php endif?>
<?php if(!is_null($mapping) && count($mapping) > 0):?>
<mapping <?=get_data('mappingAttributes')?>>
<?php foreach($mapping as $key => $value):?>
<mapEntry mapKey="<?=$key?>" mappedValue="<?=$value?>"/>
<?php endforeach?>
</mapping>
<?php endif?>
<?php if(!is_null($areaMapping) && count($areaMapping) > 0):?>
<areaMapping <?=get_data('mappingAttributes')?>>
<?php foreach($areaMapping as $areaMapEntry):?>
<areaMapEntry <?php foreach($areaMapEntry as $key => $value):?><?=$key?>="<?=$value?>" <?php endforeach;?> />
<?php endforeach?>
</areaMapping>
<?php endif?>
</responseDeclaration>
<?php endif?>