Skip to content

Commit

Permalink
Merge pull request #645 from oat-sa/feature/TAO-2522_add_responseIden…
Browse files Browse the repository at this point in the history
…tifier

Feature/tao 2522 add response identifier
  • Loading branch information
antoinerobin committed Apr 22, 2016
2 parents 84f2226 + fc1d7ac commit 9e419a1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config/default/simpleExporter.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
'callback' => 'getNumberOfChoices'
)
),
'responseIdentifier' => array (
'extractor' => 'QtiExtractor',
'parameters' => array (
'callback' => 'getResponseIdentifier',
)
),
'BR' => array (
'extractor' => 'QtiExtractor',
'parameters' => array (
Expand Down
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'label' => 'QTI item model',
'description' => 'TAO QTI item model',
'license' => 'GPL-2.0',
'version' => '2.22.0',
'version' => '2.23.0',
'author' => 'Open Assessment Technologies',
'requires' => array(
'taoItems' => '>=2.13',
Expand Down
11 changes: 11 additions & 0 deletions model/flyExporter/extractor/QtiExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,17 @@ public function getInteractionType($interaction)
}
}

/**
* Callback to retrieve interaction response identifier
*
* @param $interaction
* @return mixed
*/
public function getResponseIdentifier($interaction)
{
return $interaction['responseIdentifier'];
}

/**
* Get human readable declaration class
* @return string
Expand Down
21 changes: 21 additions & 0 deletions scripts/update/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace oat\taoQtiItem\scripts\update;

use oat\oatbox\service\ConfigurableService;
use oat\taoQtiItem\install\scripts\addValidationSettings;
use oat\taoQtiItem\install\scripts\createExportDirectory;
use oat\taoQtiItem\model\flyExporter\extractor\OntologyExtractor;
Expand Down Expand Up @@ -318,6 +319,26 @@ public function update($initialVersion){
}

$this->skip('2.20.0', '2.22.0');

if ($this->isVersion('2.22.0')) {
$simpleExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
$columns = $simpleExporter->getOption('columns');
$responseIdentifier['responseIdentifier'] = array (
'extractor' => 'QtiExtractor',
'parameters' => array (
'callback' => 'getResponseIdentifier',
)
);

$offset = array_search('BR', array_keys($columns));
$columns = array_slice($columns, 0, $offset, true) + $responseIdentifier + array_slice($columns, $offset, NULL, true);

$simpleExporter->setOption('columns', $columns);
$simpleExporter->setServiceManager($this->getServiceManager());
$this->getServiceManager()->register(SimpleExporter::SERVICE_ID, $simpleExporter);

$this->setVersion('2.23.0');
}
}

}

0 comments on commit 9e419a1

Please sign in to comment.