Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
stellalie committed Dec 8, 2015
1 parent 23d1299 commit 693f189
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,43 @@ var_dump($manifest);
```
use LearnosityQti\Converter;
$xmlString = '<assessmentItem ...> ... </assessmentItem>'
$xmlString = '<assessmentItem xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1...> ... </assessmentItem>'
list($item, $questions, $manifest) = Converter::convertQtiItemToLearnosity($xmlString);
var_dump($item);
var_dump($questions);
var_dump($manifest);
```


### Converting QTI Manifest XML string to Learnosity JSON

The result from this function is highly opiniated and might not be what you want.

The `$activity` is generated based on assessmentItem <resources>(s) with item references assumed to be the resource identifier and status set to be `published`. You might want to use the actual assessment item identifier or your custom identifier instead.
The `$activityTags` is generated based on manifest metadata and the `$itemsTags` is based on the corresponding `resource` metadata. It simply flatten the XML structure with dot notation which you may need to parse it a bit more to suits your preferred Learnosity tags structure, ie.

```
{
"educational": [
"intendedEndUserRole:source:IMSGLC_CC_Rolesv1p3",
"intendedEndUserRole:source:value:Learner"
],
"lifeCycle": [
"version:string:Published"
]
}
```

Example usage

```
use LearnosityQti\Converter;
$xmlString = '<?xml version="1.0" encoding="utf-8"?><manifest ...> ... </manifest>'
list($activity, $activityTags, $itemsTags) = Converter::convertQtiManifestToLearnosity($xmlString);
var_dump($activity);
var_dump($activityTags);
var_dump($itemsTags);
```

0 comments on commit 693f189

Please sign in to comment.