$organization = $identifier;
$scoes = scorm_get_manifest($block['children'],$scoes);
-
+
array_pop($parents);
break;
case 'ITEM':
array_push($parents, $parent);
$scoes = scorm_get_manifest($block['children'],$scoes);
-
+
array_pop($parents);
break;
case 'TITLE':
foreach ($adlnav['children'] as $adlnavInterface) {
if ($adlnavInterface['name'] == 'ADLNAV:HIDELMSUI') {
if ($adlnavInterface['tagData'] == 'continue') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidecontinue = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidecontinue = 1;
}
if ($adlnavInterface['tagData'] == 'previous') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideprevious = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideprevious = 1;
}
if ($adlnavInterface['tagData'] == 'exit') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexit = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexit = 1;
}
if ($adlnavInterface['tagData'] == 'exitAll') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexitall = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexitall = 1;
}
if ($adlnavInterface['tagData'] == 'abandon') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandon = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandon = 1;
}
if ($adlnavInterface['tagData'] == 'abandonAll') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandonall = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandonall = 1;
}
if ($adlnavInterface['tagData'] == 'suspendAll') {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidesuspendall = 1;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidesuspendall = 1;
}
}
}
}
if ($sequencing['name']=='IMSSS:LIMITCONDITIONS') {
if (isset($sequencing['attrs']['ATTEMPTLIMIT'])) {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptLimit = $sequencing['attrs']['ATTEMPTLIMIT'];
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptLimit = $sequencing['attrs']['ATTEMPTLIMIT'];
}
if (isset($sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'])) {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptAbsoluteDurationLimit = $sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'];
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptAbsoluteDurationLimit = $sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'];
}
}
if ($sequencing['name']=='IMSSS:ROLLUPRULES') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rollupobjectivesatisfied = $sequencing['attrs']['ROLLUPOBJECTIVESATISFIED'] == 'true'?1:0;;
}
if (isset($sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'])) {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->rollupprogresscompletion = $sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'] == 'true'?1:0;
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->rollupprogresscompletion = $sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'] == 'true'?1:0;
}
if (isset($sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'])) {
- $scoes->elements[$manifest][$parent->organization][$parent->identifier]->objectivemeasureweight = $sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'];
+ $scoes->elements[$manifest][$parent->organization][$parent->identifier]->objectivemeasureweight = $sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'];
}
-
+
if (!empty($sequencing['children'])){
$rolluprules = array();
foreach ($sequencing['children'] as $sequencingrolluprule) {
if (isset($rolluprulecondition['attrs']['OPERATOR'])) {
$condition->operator = $rolluprulecondition['attrs']['OPERATOR'];
}
- array_push($conditions,$condition);
+ array_push($conditions,$condition);
}
}
$rolluprule->conditions = $conditions;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rolluprules = $rolluprules;
}
}
-
+
if ($sequencing['name']=='IMSSS:SEQUENCINGRULES') {
if (!empty($sequencing['children'])) {
$sequencingrules = array();
$condition->referencedobjective = '';
if (isset($rulecondition['attrs']['REFERENCEDOBJECTIVE'])) {
$condition->referencedobjective = $rulecondition['attrs']['REFERENCEDOBJECTIVE'];
- }
+ }
array_push($ruleconditions,$condition);
}
}
}
$sequencingrule->type = $conditiontype;
}
- array_push($sequencingrules,$sequencingrule);
+ array_push($sequencingrules,$sequencingrule);
}
}
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->sequencingrules = $sequencingrules;
require_once "$CFG->libdir/filelib.php";
$xmltext = download_file_content($manifest);
}
-
+
$launch = 0;
$pattern = '/&(?!\w{2,6};)/';
$objXML = new xml2Array();
$manifests = $objXML->parse($xmltext);
-//print_object($manifests);
+//print_object($manifests);
$scoes = new stdClass();
$scoes->version = '';
$scoes = scorm_get_manifest($manifests,$scoes);
foreach ($organizations as $organization => $items) {
foreach ($items as $identifier => $item) {
// This new db mngt will support all SCORM future extensions
- $newitem = new stdClass();
+ $newitem = new stdClass();
$newitem->scorm = $scorm->id;
$newitem->manifest = $manifest;
$newitem->organization = $organization;
$newitem->$standarddata = $item->$standarddata;
}
}
-
+
// Insert the new SCO, and retain the link between the old and new for later adjustment
$id = $DB->insert_record('scorm_scoes',$newitem);
if (!empty($olditems) && ($olditemid = scorm_array_search('identifier',$newitem->identifier,$olditems))) {
$olditems[$olditemid]->newid = $id;
}
-
+
if ($optionaldatas = scorm_optionals_data($item,$standarddatas)) {
$data = new stdClass();
$data->scoid = $id;
$rulecondid = $DB->insert_record('scorm_seq_rulecond',$rulecond);
}
}
- }
+ }
}
-
+
if (isset($item->rolluprules)) {
foreach($item->rolluprules as $rolluprule) {
$rollup = new stdClass();
$conditionid = $DB->insert_record('scorm_seq_rolluprulecond',$cond);
}
}
- }
+ }
}
if (isset($item->objectives)) {
$obj->primaryobj = $objective->primaryobj;
$obj->satisfiedbumeasure = $objective->satisfiedbymeasure;
$obj->objectiveid = $objective->objectiveid;
- $obj->minnormalizedmeasure = $objective->minnormalizedmeasure;
+ $obj->minnormalizedmeasure = $objective->minnormalizedmeasure;
$objectiveid = $DB->insert_record('scorm_seq_objective',$obj);
if (isset($objective->mapinfos)) {
//print_object($objective->mapinfos);
$DB->delete_records('scorm_seq_rolluprulecond', array('scoid'=>$olditem->id));
}
}
+ if (empty($scoes->version)) {
+ $scoes->version = 'SCORM_1.2';
+ }
+ set_field('scorm','version',$scoes->version,'id',$scormid);
$scorm->version = $scoes->version;
}
-
+
$scorm->launch = $launch;
return true;
function scorm_get_parent($sco) {
global $DB;
-
+
if ($sco->parent != '/') {
if ($parent = $DB->get_record('scorm_scoes', array('scorm'=>$sco->scorm,'identifier'=>$sco->parent))) {
return scorm_get_sco($parent->id);
}
function scorm_find_common_ancestor($ancestors, $sco) {
- $pos = scorm_array_search('identifier',$sco->parent,$ancestors);
+ $pos = scorm_array_search('identifier',$sco->parent,$ancestors);
if ($sco->parent != '/') {
if ($pos === false) {
return scorm_find_common_ancestor($ancestors,scorm_get_parent($sco));
$objXML = new xml2Array();
$arrOutput = $objXML->parse($strYourXML);
print_r($arrOutput); //print it out, or do whatever!
-
+
*/
class xml2Array {
-
+
var $arrOutput = array();
var $resParser;
var $strXmlData;
-
+
/**
* Convert a utf-8 string to html entities
*
$this->resParser = xml_parser_create ('UTF-8');
xml_set_object($this->resParser,$this);
xml_set_element_handler($this->resParser, "tagOpen", "tagClosed");
-
+
xml_set_character_data_handler($this->resParser, "tagData");
-
+
$this->strXmlData = xml_parse($this->resParser,$strInputXML );
if(!$this->strXmlData) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->resParser)),
xml_get_current_line_number($this->resParser)));
}
-
+
xml_parser_free($this->resParser);
-
+
return $this->arrOutput;
}
-
+
function tagOpen($parser, $name, $attrs) {
- $tag=array("name"=>$name,"attrs"=>$attrs);
+ $tag=array("name"=>$name,"attrs"=>$attrs);
array_push($this->arrOutput,$tag);
}
-
+
function tagData($parser, $tagData) {
if(trim($tagData)) {
if(isset($this->arrOutput[count($this->arrOutput)-1]['tagData'])) {
}
}
}
-
+
function tagClosed($parser, $name) {
$this->arrOutput[count($this->arrOutput)-2]['children'][] = $this->arrOutput[count($this->arrOutput)-1];
array_pop($this->arrOutput);