Skip to content

Commit

Permalink
Merge pull request #639 from oat-sa/release-5.38.1
Browse files Browse the repository at this point in the history
Release 5.38.1
  • Loading branch information
ssipasseuth authored Nov 18, 2016
2 parents b944d04 + bd9b76b commit 96d16fb
Show file tree
Hide file tree
Showing 44 changed files with 3,076 additions and 324 deletions.
9 changes: 7 additions & 2 deletions actions/class.Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,15 @@ public function submitItem()

$itemRef = $this->getRequestParameter('itemDefinition');
$itemDuration = $this->getRequestParameter('itemDuration');
$consumedExtraTime = $this->getRequestParameter('consumedExtraTime');

$data = \taoQtiCommon_helpers_Utils::readJsonPayload();
if (isset($data['itemDuration'])) {
$itemDuration = $data['itemDuration'];
}
if (isset($data['consumedExtraTime'])) {
$consumedExtraTime = $data['consumedExtraTime'];
}

$state = isset($data['itemState']) ? $data['itemState'] : new stdClass();
$itemResponse = isset($data['itemResponse']) ? $data['itemResponse'] : [];
Expand All @@ -449,7 +453,7 @@ public function submitItem()
$serviceContext = $this->getServiceContext(false);

if (!$this->runnerService->isTerminated($serviceContext)) {
$this->runnerService->endTimer($serviceContext, $itemDuration);
$this->runnerService->endTimer($serviceContext, $itemDuration, $consumedExtraTime);
$successState = $this->runnerService->setItemState($serviceContext, $this->getStateId(), $state);
} else {
$successState = false;
Expand Down Expand Up @@ -552,10 +556,11 @@ public function skip()
$ref = $this->getRequestParameter('ref');
$scope = $this->getRequestParameter('scope');
$itemDuration = $this->getRequestParameter('itemDuration');
$consumedExtraTime = $this->getRequestParameter('consumedExtraTime');

try {
$serviceContext = $this->getServiceContext();
$this->runnerService->endTimer($serviceContext, $itemDuration);
$this->runnerService->endTimer($serviceContext, $itemDuration, $consumedExtraTime);

$result = $this->runnerService->skip($serviceContext, $scope, $ref);

Expand Down
2 changes: 2 additions & 0 deletions config/default/testRunner.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@
],
'itemThemeSwitcher' => [
'toggle' => 'T',
'loop' => 'Y',
'select' => 'U'
],
'review' => [
'toggle' => 'R',
Expand Down
16 changes: 9 additions & 7 deletions locales/it-IT/messages.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
$GLOBALS['__l10n']["Add the source file"]="Aggiungi il file sorgente";
$GLOBALS['__l10n']["Advanced Mode"]="Modalità Avanzata";
$GLOBALS['__l10n']["After you complete the section it would be impossible to return to this section to make changes. Are you sure you want to end the section?"]="Dopo aver completato la sezione non è più possibile tornare a questa sezione per apportare modifiche. Sei sicuro di voler terminare la sezione?";
$GLOBALS['__l10n']["All"]="Tutto";
$GLOBALS['__l10n']["all"]="tutto";
$GLOBALS['__l10n']["All"]="Tutto";
$GLOBALS['__l10n']["All data will be removed in %s"]="Tutti i dati saranno rimossi in %s";
$GLOBALS['__l10n']["All fields are required"]="Tutti i campi sono richiesti";
$GLOBALS['__l10n']["All rights reserved."]="Tutti i diritti riservati";
Expand Down Expand Up @@ -90,6 +90,7 @@
$GLOBALS['__l10n']["Browse"]="Sfoglia";
$GLOBALS['__l10n']["Browse folders:"]="Sfoglia le cartelle";
$GLOBALS['__l10n']["Browse..."]="Sfoglia...";
$GLOBALS['__l10n']["Calculator"]="Calcolatrice";
$GLOBALS['__l10n']["Calendar"]="Calendario";
$GLOBALS['__l10n']["Cancel"]="Cancella";
$GLOBALS['__l10n']["cancel"]="annulla";
Expand Down Expand Up @@ -130,8 +131,8 @@
$GLOBALS['__l10n']["Data imported successfully"]="Dati importati con successo";
$GLOBALS['__l10n']["Data imported. Some records are invalid."]="Dati importati. Alcuni record non sono validi.";
$GLOBALS['__l10n']["Data Lang."]="Dati di lingua";
$GLOBALS['__l10n']["Data language"]="Dati di lingua";
$GLOBALS['__l10n']["Data Language"]="Dati di lingua.";
$GLOBALS['__l10n']["Data language"]="Dati di lingua";
$GLOBALS['__l10n']["Data not imported. All records are invalid."]="Dati non importati. Nessun record è valido.";
$GLOBALS['__l10n']["Date"]="Data";
$GLOBALS['__l10n']["Default search"]="Ricerca di default";
Expand Down Expand Up @@ -162,8 +163,8 @@
$GLOBALS['__l10n']["Element deleted."]="Elemento eliminato";
$GLOBALS['__l10n']["Email"]="Email";
$GLOBALS['__l10n']["Enable selection"]="Abilita selezione";
$GLOBALS['__l10n']["End test"]="Fine test";
$GLOBALS['__l10n']["End Test"]="Fine test";
$GLOBALS['__l10n']["End test"]="Fine test";
$GLOBALS['__l10n']["Enter"]="Invio";
$GLOBALS['__l10n']["Enter a category"]="Inserisci una categoria";
$GLOBALS['__l10n']["Error"]="Errore";
Expand Down Expand Up @@ -240,8 +241,8 @@
$GLOBALS['__l10n']["Installed Extensions"]="Estensioni istallate";
$GLOBALS['__l10n']["Installing extension %s..."]="Installazione delle estensioni %s";
$GLOBALS['__l10n']["Instance saved"]="Istanza salvata";
$GLOBALS['__l10n']["Interface Language"]="Lingua di interfaccia";
$GLOBALS['__l10n']["Interface language"]="Lingua di interfaccia";
$GLOBALS['__l10n']["Interface Language"]="Lingua di interfaccia";
$GLOBALS['__l10n']["Invalid date range (must be after or the same as: %s)"]="Intervallo data non valido (deve essere successivo o lo stesso di: %s)";
$GLOBALS['__l10n']["Invalid date range (must be after: %s)"]="Intervallo data non valido (deve essere successivo: %s)";
$GLOBALS['__l10n']["Invalid date range (must be before or the same as: %s)"]="Intervallo data non valido (deve essere precedente o lo stesso di: %s)";
Expand Down Expand Up @@ -350,8 +351,8 @@
$GLOBALS['__l10n']["No files"]="Nessun file";
$GLOBALS['__l10n']["no label"]="nessuna etichetta";
$GLOBALS['__l10n']["No more attempts allowed for item \"%s\"."]="Nessun altro tentativo consentito per item \"% s\"";
$GLOBALS['__l10n']["No preview available"]="Nessuna anteprima disponibile";
$GLOBALS['__l10n']["No Preview available"]="Nessuna anteprima disponibile";
$GLOBALS['__l10n']["No preview available"]="Nessuna anteprima disponibile";
$GLOBALS['__l10n']["No reference to any IMS QTI Item found."]="Nessun riferimento trovato per qualsiasi item IMS QTI.";
$GLOBALS['__l10n']["No results found"]="Nessun risultato trovato";
$GLOBALS['__l10n']["Non Linear"]="Non lineare";
Expand All @@ -362,13 +363,14 @@
$GLOBALS['__l10n']["Nothing to list!"]="Niente da elencare";
$GLOBALS['__l10n']["Number of elements"]="Numero di elementi";
$GLOBALS['__l10n']["of"]="di";
$GLOBALS['__l10n']["OK"]="OK";
$GLOBALS['__l10n']["Ok"]="Ok";
$GLOBALS['__l10n']["OK"]="OK";
$GLOBALS['__l10n']["OK & End test"]="OK & Fine test";
$GLOBALS['__l10n']["Old Password"]="Vecchia password";
$GLOBALS['__l10n']["One or more dependent IMS QTI Items could not be imported."]="Uno o più item dipendenti IMS QTI non potevano essere importati";
$GLOBALS['__l10n']["Only display the items marked for review"]="Visualizza solo gli item contrassegnati per la revisione";
$GLOBALS['__l10n']["Only display the unanswered items"]="Visualizzare solo gli item senza risposta";
$GLOBALS['__l10n']["Open Calculator"]="Calcolatrice";
$GLOBALS['__l10n']["Option instanceUri is not an option !!"]="Optione";
$GLOBALS['__l10n']["Option ownerUri is not an option !!"]="L'opzione ownerUri non è un opzione !!";
$GLOBALS['__l10n']["Option propertyUri is not an option !!"]="L'opzione propertyUri non è un opzione!!";
Expand Down Expand Up @@ -451,8 +453,8 @@
$GLOBALS['__l10n']["seconds"]="secondi";
$GLOBALS['__l10n']["Section level category enables configuring the categories of its composing items all at once. A category in gray means that all items have that category. A category in white means that only a few items have that category."]="La sezione livello categoria consente la configurazione delle categorie degli item che la compongono tutti in una volta. Una categoria in grigio significa che tutti gli item hanno quella categoria. Una categoria in bianco significa che solo pochi item hanno quella categoria.";
$GLOBALS['__l10n']["Section Properties"]="Proprietà della sezione";
$GLOBALS['__l10n']["Select"]="Seleziona";
$GLOBALS['__l10n']["select"]="seleziona";
$GLOBALS['__l10n']["Select"]="Seleziona";
$GLOBALS['__l10n']["Select a language"]="Scegli una lingua";
$GLOBALS['__l10n']["Select Items"]="Seleziona gli item";
$GLOBALS['__l10n']["Select the element destination"]="Scegli l'elemento di destinazione";
Expand Down
4 changes: 2 additions & 2 deletions locales/it-IT/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ msgid "Auxiliary file not found at location \"%s\"."
msgstr "File ausiliario non trovato nella posizione \"% s\""

msgid "Calculator"
msgstr ""
msgstr "Calcolatrice"

msgid "Cancel"
msgstr "Cancella"
Expand Down Expand Up @@ -437,7 +437,7 @@ msgid "Only display the unanswered items"
msgstr "Visualizzare solo gli item senza risposta"

msgid "Open Calculator"
msgstr ""
msgstr "Calcolatrice"

msgid "Ordering"
msgstr "Ordinamento"
Expand Down
2 changes: 1 addition & 1 deletion locales/it-IT/messages_po.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
'label' => 'QTI test model',
'description' => 'TAO QTI test implementation',
'license' => 'GPL-2.0',
'version' => '5.34.0',
'version' => '5.38.1',
'author' => 'Open Assessment Technologies',
'requires' => array(
'taoTests' => '>=3.4.0',
'taoTests' => '>=3.7.0',
'taoQtiItem' => '>=5.14.0',
'tao' => '>=7.21.0'
'tao' => '>=7.27.0'
),
'models' => array(
'http://www.tao.lu/Ontologies/TAOTest.rdf'
Expand Down
137 changes: 128 additions & 9 deletions models/classes/export/metadata/TestExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,150 @@
namespace oat\taoQtiTest\models\export\metadata;

use oat\generis\model\OntologyAwareTrait;
use oat\oatbox\filesystem\File;
use oat\oatbox\service\ConfigurableService;
use oat\taoQtiItem\model\flyExporter\simpleExporter\ItemExporter;
use oat\taoQtiItem\model\flyExporter\extractor\ExtractorException;
use oat\taoQtiItem\model\flyExporter\simpleExporter\SimpleExporter;
use qtism\data\AssessmentItemRef;
use qtism\data\AssessmentSection;
use qtism\data\TestPart;

/**
*
* Class TestExporter
*/
class TestExporter extends ConfigurableService implements TestMetadataExporter
{
use OntologyAwareTrait;

const TEST_PART = 'testPart';
const TEST_SECTION = 'section';
const TEST_ITEM = 'assessmentItemRef';
const ITEM_SHUFFLE = 'shuffle';
const ITEM_ORDER = 'section-order';

/**
* Item exporter to handle each items
*
* @var SimpleExporter
*/
protected $itemExporter;

/**
* Uri of assessment to export
*
* @var string
*/
protected $assessmentUri;

/**
* Item data extracted from assessment
*
* @var array
*/
protected $assessmentItemData = [];

/**
* Main action to launch export
*
* @param string $uri
* @return mixed
* @return File
*/
public function export($uri)
{
/** @var ItemExporter $itemExporter */
$itemExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
return $itemExporter->export(
\taoQtiTest_models_classes_QtiTestService::singleton()->getItems($this->getResource($uri)),
true
);
$this->assessmentUri = $uri;

$items = \taoQtiTest_models_classes_QtiTestService::singleton()->getItems($this->getResource($uri));

$data = [];
/** @var \core_kernel_classes_Resource $item */
foreach ($items as $item) {
try {
$itemData = $this->getItemExporter()->getDataByItem($item);
foreach ($itemData as &$column) {
$column = array_merge($column, $this->getAdditionalData($item));
}
$data[] = $itemData;
} catch (ExtractorException $e) {
\common_Logger::e('ERROR on item ' . $item->getUri() . ' : ' . $e->getMessage());
}
}
$headers = array_merge($this->getItemExporter()->getHeaders(), $this->getHeaders());

return $this->getItemExporter()->save($headers, $data, true);
}

/**
* Get assessment data for an item
*
* @param \core_kernel_classes_Resource $item
* @return array
*/
protected function getAdditionalData(\core_kernel_classes_Resource $item)
{
$data = $this->getAssessmentData();
$identifier = $item->getUri();

if (isset($data[$identifier])) {
return $data[$identifier];
} else {
return [];
}
}

/**
* Fetch assessment item data
*
* @return array
*/
protected function getAssessmentData()
{
if (empty($this->assessmentItemData)) {
$xml = \taoQtiTest_models_classes_QtiTestService::singleton()->getDoc($this->getResource($this->assessmentUri));
$testPartCollection = $xml->getDocumentComponent()->getComponentsByClassName(self::TEST_PART);

/** @var TestPart $testPart */
foreach ($testPartCollection as $testPart) {
$sectionCollection = $testPart->getAssessmentSections();
/** @var AssessmentSection $section */
foreach ($sectionCollection as $section) {
$itemCollection = $section->getComponentsByClassName(self::TEST_ITEM);
$order = 1;
/** @var AssessmentItemRef $item */
foreach ($itemCollection as $item) {
$this->assessmentItemData[$item->getHref()] = [
self::TEST_PART => $testPart->getIdentifier(),
self::TEST_SECTION => $section->getIdentifier(),
self::ITEM_SHUFFLE => is_null($section->getOrdering()) ? 0 : (int) $section->getOrdering()->getShuffle(),
self::ITEM_ORDER => $order,
];
$order++;
}
}
}
}
return $this->assessmentItemData;
}

/**
* Get headers of additional data for assessment items
*
* @return array
*/
protected function getHeaders()
{
return [self::TEST_PART, self::TEST_SECTION, self::ITEM_SHUFFLE, self::ITEM_ORDER];
}

/**
* Get item exporter service
*
* @return SimpleExporter
*/
protected function getItemExporter()
{
if (! $this->itemExporter) {
$this->itemExporter = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
}
return $this->itemExporter;
}
}
Loading

0 comments on commit 96d16fb

Please sign in to comment.