ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSCORM13Package.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
11 require_once "./Modules/Scorm2004/classes/ilSCORM13Package.php";
12 require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php";
13 require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php";
14 require_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
15 require_once "./Modules/Scorm2004/classes/adlparser/SeqTreeBuilder.php";
16 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
17 
19 {
20  const DB_ENCODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13.xsl';
21  const CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl';
22  const DB_DECODE_XSL = './Modules/Scorm2004/templates/xsl/op/op-scorm13-revert.xsl';
23  const VALIDATE_XSD = './libs/ilias/Scorm2004/xsd/op/op-scorm13.xsd';
24 
25  const WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm';
26  const WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js';
27 
28 
29  private $packageFile;
30  private $packageFolder;
31  private $packagesFolder;
32  private $packageData;
33  private $slm;
34  private $slm_tree;
35 
36  public $imsmanifest;
37  public $manifest;
38  public $diagnostic;
39  public $status;
40  public $packageId;
41  public $packageName;
42  public $packageHash;
43  public $userId;
44 
45  private $idmap = array();
46  private $progress = 0.0;
47 
48  private static $elements = array(
49  'cp' => array(
50  'manifest',
51  'organization',
52  'item',
53  'hideLMSUI',
54  'resource',
55  'file',
56  'dependency',
57  'sequencing',
58  'rule',
59  'auxilaryResource',
60  'condition',
61  'mapinfo',
62  'objective',
63  ),
64  'cmi' => array(
65  'comment',
66  'correct_response',
67  'interaction',
68  'node',
69  'objective',
70  ),
71  );
72 
73  public function __construct($packageId = null)
74  {
75  $this->packagesFolder = ''; // #25372
76  $this->load($packageId);
77  $this->userId = $GLOBALS['USER']['usr_id'];
78  }
79 
80  public function load($packageId)
81  {
82  global $ilDB;
83 
84  if (!is_numeric($packageId)) {
85  return false;
86  }
87 
88  $lm_set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s', array('integer'), array($packageId));
89  $lm_data = $ilDB->fetchAssoc($lm_set);
90  $pg_set = $ilDB->queryF('SELECT * FROM cp_package WHERE obj_id = %s', array('integer'), array($packageId));
91  $pg_data = $ilDB->fetchAssoc($lm_set);
92 
93  $this->packageData = array_merge($lm_data, $pg_data);
94  $this->packageId = $packageId;
95  $this->packageFolder = $this->packagesFolder . '/' . $packageId;
96  $this->packageFile = $this->packageFolder . '.zip';
97  $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
98  return true;
99  }
100 
101  public function rollback()
102  {
103  $this->setProgress(0, 'Rolling back...');
104  $this->dbRemoveAll();
105  if (is_dir($this->packageFolder)) {
106  dir_delete($this->packageFolder);
107  }
108  if (is_file($this->packageFile)) {
109  @unlink($this->packageFile);
110  }
111  $this->setProgress(0, 'Roll back finished: Ok. ');
112  }
113 
114 
118  public function exportXML()
119  {
120  global $ilDB;
121 
122  header('content-type: text/xml');
123  header('content-disposition: attachment; filename="manifest.xml"');
124 
125  $res = $ilDB->queryF(
126  'SELECT xmldata FROM cp_package WHERE obj_id = %s',
127  array('integer'),
128  array($this->packageId)
129  );
130  $row = $ilDB->fetchAssoc($res);
131 
132  print($row['xmldata']);
133  }
134 
135 
142  public function il_import($packageFolder, $packageId, $ilias, $validate, $reimport=false)
143  {
144  global $ilDB, $ilLog, $ilErr;
145 
146  $title = "";
147 
148  if ($reimport === true) {
149  $this->packageId = $packageId;
150  $this->dbRemoveAll();
151  }
152 
153  $this->packageFolder=$packageFolder;
154  $this->packageId=$packageId;
155  $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
156  //step 1 - parse Manifest-File and validate
157  $this->imsmanifest = new DOMDocument;
158  $this->imsmanifest->async = false;
159  if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
160  $this->diagnostic[] = 'XML not wellformed';
161  return false;
162  }
163 
164  //step 2 tranform
165  $this->manifest = $this->transform($this->imsmanifest, self::DB_ENCODE_XSL);
166 
167  if (!$this->manifest) {
168  $this->diagnostic[] = 'Cannot transform into normalized manifest';
169  return false;
170  }
171  //setp 2.5 if only a single item, make sure the scormType of it's linked resource is SCO
172  $path = new DOMXpath($this->manifest);
173  $path->registerNamespace("scorm", "http://www.openpalms.net/scorm/scorm13");
174  $items = $path->query("//scorm:item");
175  if ($items->length == 1) {
176  $n = $items->item(0);
177  $resource = $path->query("//scorm:resource");//[&id='"+$n->getAttribute("resourceId")+"']");
178  foreach ($resource as $res) {
179  if ($res->getAttribute('id') == $n->getAttribute("resourceId")) {
180  $res->setAttribute('scormType', 'sco');
181  }
182  }
183  }
184  //$this->manifest->save("C:\Users\gratat\after.xml");
185  //step 3 validation -just for normalized XML
186  if ($validate=="y") {
187  if (!$this->validate($this->manifest, self::VALIDATE_XSD)) {
188  $ilErr->raiseError(
189  "<b>The uploaded SCORM 1.2 / SCORM 2004 is not valid. You can try to import the package without the validation option checked on your own risk. </b><br><br>Validation Error(s):</b><br> Normalized XML is not conform to " . self::VALIDATE_XSD,
190  $ilErr->MESSAGE
191  );
192  }
193  }
194  $this->dbImport($this->manifest);
195 
196  if (file_exists($this->packageFolder . '/' . 'index.xml')) {
197  $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
198  $l = $doc->xpath("/ContentObject/MetaData");
199  if ($l[0]) {
200  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
202  $mdxml->startParsing();
203  $mdxml->getMDObject()->update();
204  }
205  } else {
206  include_once("./Modules/Scorm2004/classes/class.ilSCORM13MDImporter.php");
207  $importer = new ilSCORM13MDImporter($this->imsmanifest, $packageId);
208  $importer->import();
209  $title = $importer->getTitle();
210  $description = $importer->getDescription();
211  if ($description != "") {
213  }
214  }
215 
216  //step 5
217  $x = simplexml_load_string($this->manifest->saveXML());
218  $x['persistPreviousAttempts'] = $this->packageData['persistprevattempts'];
219  $x['online'] = $this->packageData['c_online'];
220 
221  $x['defaultLessonMode'] = $this->packageData['default_lesson_mode'];
222  $x['credit'] = $this->packageData['credit'];
223  $x['autoReview'] = $this->packageData['auto_review'];
224  $j = array();
225  // first read resources into flat array to resolve item/identifierref later
226  $r = array();
227  foreach ($x->resource as $xe) {
228  $r[strval($xe['id'])] = $xe;
229  unset($xe);
230  }
231  // iterate through items and set href and scoType as activity attributes
232  foreach ($x->xpath('//*[local-name()="item"]') as $xe) {
233  // get reference to resource and set href accordingly
234  if ($b = $r[strval($xe['resourceId'])]) {
235  $xe['href'] = strval($b['base']) . strval($b['href']);
236  unset($xe['resourceId']);
237  if (strval($b['scormType'])=='sco') {
238  $xe['sco'] = true;
239  }
240  }
241  }
242  // iterate recursivly through activities and build up simple php object
243  // with items and associated sequencings
244  // top node is the default organization which is handled as an item
245  self::jsonNode($x->organization, $j['item']);
246  foreach ($x->sequencing as $s) {
247  self::jsonNode($s, $j['sequencing'][]);
248  }
249  // combined manifest+resources xml:base is set as organization base
250  $j['item']['base'] = strval($x['base']);
251  // package folder is base to whole playing process
252  $j['base'] = $packageFolder . '/';
253  $j['foreignId'] = floatval($x['foreignId']); // manifest cp_node_id for associating global (package wide) objectives
254  $j['id'] = strval($x['id']); // manifest id for associating global (package wide) objectives
255 
256 
257  //last step - build ADL Activity tree
258  $act = new SeqTreeBuilder();
259  $adl_tree = $act->buildNodeSeqTree($this->imsmanifestFile);
260  $ilDB->update(
261  'cp_package',
262  array(
263  'xmldata' => array('clob', $x->asXML()),
264  'jsdata' => array('clob', json_encode($j)),
265  'activitytree' => array('clob', json_encode($adl_tree['tree'])),
266  'global_to_system' => array('integer', (int) $adl_tree['global']),
267  'shared_data_global_to_system' => array('integer', (int) $adl_tree['dataglobal'])
268  ),
269  array(
270  'obj_id' => array('integer', (int) $this->packageId)
271  )
272  );
273 
274  // title retrieved by importer
275  if ($title != "") {
276  return $title;
277  }
278 
279  return $j['item']['title'];
280  }
281 
282 
289  public function il_importSco($packageId, $sco_id, $packageFolder)
290  {
291  global $ilDB, $ilLog;
292 
293  $this->packageFolder=$packageFolder;
294  $this->packageId=$packageId;
295  $this->imsmanifestFile = $this->packageFolder . '/' . 'index.xml';
296  $this->imsmanifest = new DOMDocument;
297  $this->imsmanifest->async = false;
298 
299  if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
300  $this->diagnostic[] = 'XML not wellformed';
301  return false;
302  }
303 
305  $sco = new ilSCORM2004Sco($slm, $sco_id);
306  $this->dbImportSco($slm, $sco);
307 
308  // import sco.xml
309  $sco_xml_file = $this->packageFolder . '/sco.xml';
310  if (is_file($sco_xml_file)) {
311  $scodoc = new DOMDocument;
312  $scodoc->async = false;
313  if (!@$scodoc->load($sco_xml_file)) {
314  $this->diagnostic[] = 'XML of sco.xml not wellformed';
315  return false;
316  }
317  //$doc = new SimpleXMLElement($scodoc->saveXml());
318  //$l = $doc->xpath("/sco/objective");
319  $xpath = new DOMXPath($scodoc);
320  $nodes = $xpath->query("/sco/objective");
321  foreach ($nodes as $node) {
322  $t_node = $node->firstChild;
323  if (is_object($t_node)) {
324  $objective_text = $t_node->textContent;
325  if (trim($objective_text) != "") {
326  $objs = $sco->getObjectives();
327  foreach ($objs as $o) {
328  $mappings = $o->getMappings();
329  if ($mappings == null) {
330  $ob = new ilScorm2004Objective($sco->getId(), $o->getId());
331  $ob->setObjectiveID($objective_text);
332  $ob->updateObjective();
333  }
334  }
335  }
336  }
337  }
338  }
339  return "";
340  }
341 
348  public function il_importAss($packageId, $sco_id, $packageFolder)
349  {
350  global $ilDB, $ilLog;
351 
352  $this->packageFolder=$packageFolder;
353  $this->packageId=$packageId;
354  $this->imsmanifestFile = $this->packageFolder . '/' . 'index.xml';
355  $this->imsmanifest = new DOMDocument;
356  $this->imsmanifest->async = false;
357 
358  if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
359  $this->diagnostic[] = 'XML not wellformed';
360  return false;
361  }
362 
364  $sco = new ilSCORM2004Asset($slm, $sco_id);
365  $this->dbImportSco($slm, $sco, true);
366 
367  // import sco.xml
368  /*
369  $sco_xml_file = $this->packageFolder . '/sco.xml';
370  if (is_file($sco_xml_file))
371  {
372  $scodoc = new DOMDocument;
373  $scodoc->async = false;
374  if (!@$scodoc->load($sco_xml_file))
375  {
376  $this->diagnostic[] = 'XML of sco.xml not wellformed';
377  return false;
378  }
379  //$doc = new SimpleXMLElement($scodoc->saveXml());
380  //$l = $doc->xpath("/sco/objective");
381  $xpath = new DOMXPath($scodoc);
382  $nodes = $xpath->query("/sco/objective");
383  foreach($nodes as $node)
384  {
385  $t_node = $node->firstChild;
386  if (is_object($t_node))
387  {
388  $objective_text = $t_node->textContent;
389  if (trim($objective_text) != "")
390  {
391  $objs = $sco->getObjectives();
392  foreach ($objs as $o)
393  {
394  $mappings = $o->getMappings();
395  if ($mappings == null)
396  {
397  $ob = new ilScorm2004Objective($sco->getId(), $o->getId());
398  $ob->setObjectiveID($objective_text);
399  $ob->updateObjective();
400  }
401  }
402  }
403  }
404  }
405  }
406  */
407  return "";
408  }
409 
410  public function il_importLM($slm, $packageFolder, $a_import_sequencing = false)
411  {
412  global $ilDB, $ilLog;
413 
414  $this->packageFolder=$packageFolder;
415  $this->packageId=$slm->getId();
416  $this->imsmanifestFile = $this->packageFolder . '/' . 'imsmanifest.xml';
417  $this->imsmanifest = new DOMDocument;
418  $this->imsmanifest->async = false;
419  $this->imsmanifest->formatOutput = false;
420  $this->imsmanifest->preserveWhiteSpace = false;
421  $this->slm = $slm;
422  if (!@$this->imsmanifest->load($this->imsmanifestFile)) {
423  $this->diagnostic[] = 'XML not wellformed';
424  return false;
425  }
426 
427  $this->mani_xpath = new DOMXPath($this->imsmanifest);
428  $this->mani_xpath->registerNamespace("d", "http://www.imsproject.org/xsd/imscp_rootv1p1p2");
429  $this->mani_xpath->registerNamespace("imscp", "http://www.imsglobal.org/xsd/imscp_v1p1");
430  $this->mani_xpath->registerNamespace("imsss", "http://www.imsglobal.org/xsd/imsss");
431 
432 
433  $this->dbImportLM(
434  simplexml_import_dom($this->imsmanifest->documentElement),
435  "",
436  $a_import_sequencing
437  );
438 
439  if (is_dir($packageFolder . "/glossary")) {
440  $this->importGlossary($slm, $packageFolder . "/glossary");
441  }
442  //die($slm->title);
443 
444  return $slm->title;
445  }
446 
448  {
449  // create and insert object in objecttree
450  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
451  $newObj = new ilObjGlossary();
452  $newObj->setType('glo');
453  $newObj->setTitle('');
454  $newObj->create(true);
455  $newObj->createReference();
456  $newObj->putInTree($_GET["ref_id"]);
457  $newObj->setPermissions($_GET["ref_id"]);
458 
459  $xml_file = $packageFolder . "/glossary.xml";
460 
461  // check whether xml file exists within zip file
462  if (!is_file($xml_file)) {
463  return;
464  }
465 
466  include_once("./Modules/LearningModule/classes/class.ilContObjParser.php");
467  $contParser = new ilContObjParser($newObj, $xml_file, $packageFolder);
468  $contParser->startParsing();
469  $newObj->update();
470  //ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
471  $slm->setAssignedGlossary($newObj->getId());
472  $slm->update();
473  }
474 
475  public function dbImportLM($node, $parent_id = "", $a_import_sequencing = false)
476  {
477  switch ($node->getName()) {
478  case "manifest":
479  $this->slm_tree = new ilTree($this->slm->getId());
480  $this->slm_tree->setTreeTablePK("slm_id");
481  $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
482  $this->slm_tree->addTree($this->slm->getId(), 1);
483 
484  //add seqinfo for rootNode
485  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
486  $seq_info = new ilSCORM2004Sequencing($this->slm->getId(), true);
487 
488  // get original sequencing information
489  $r = $this->mani_xpath->query("/d:manifest/d:organizations/d:organization/imsss:sequencing");
490  $this->imsmanifest->formatOutput = false;
491  if ($r) {
492  $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing);
493  if ($a_import_sequencing) {
494  $seq_info->initDom();
495  }
496  }
497  $seq_info->insert();
498 
499  if (file_exists($this->packageFolder . '/' . 'index.xml')) {
500  $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
501  $l = $doc->xpath("/ContentObject/MetaData");
502  if ($l[0]) {
503  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
504  $mdxml = new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $this->slm->getId(), $this->slm->getType());
505  $mdxml->startParsing();
506  $mdxml->getMDObject()->update();
507  }
508  }
509  break;
510  case "organization":
511  $this->slm->title=$node->title;
512  break;
513  case "item":
514  $a = $node->attributes();
515  if (preg_match("/il_\d+_chap_\d+/", $a['identifier'])) {
516  $chap= new ilSCORM2004Chapter($this->slm);
517  $chap->setTitle($node->title);
518  $chap->setSLMId($this->slm->getId());
519  $chap->create(true);
520 
521  // save sequencing information
522  $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
523  if ($r) {
524  $seq_info = new ilSCORM2004Sequencing($chap->getId());
525  $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing);
526  $seq_info->initDom();
527  $seq_info->insert();
528  }
529 
530  ilSCORM2004Node::putInTree($chap, $parent_id, "");
531  $parent_id = $chap->getId();
532  $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml');
533  $l = $doc->xpath("/ContentObject/StructureObject/MetaData[General/Identifier/@Entry='" . $a['identifier'] . "']");
534  if ($l[0]) {
535  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
536  $mdxml = new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $chap->getId(), $chap->getType());
537  $mdxml->startParsing();
538  $mdxml->getMDObject()->update();
539  }
540  }
541  if (preg_match("/il_\d+_sco_(\d+)/", $a['identifier'], $match)) {
542  $sco = new ilSCORM2004Sco($this->slm);
543  $sco->setTitle($node->title);
544  $sco->setSLMId($this->slm->getId());
545  $sco->create(true);
546 
547  // save sequencing information
548  $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
549  if ($r) {
550  $seq_info = new ilSCORM2004Sequencing($sco->getId());
551  $this->setSequencingInfo(
552  $r->item(0),
553  $seq_info,
554  $a_import_sequencing,
555  "local_obj_" . $sco->getID() . "_0"
556  );
557  $seq_info->initDom();
558  $seq_info->insert();
559  }
560 
561  ilSCORM2004Node::putInTree($sco, $parent_id, "");
562  $newPack = new ilSCORM13Package();
563  $newPack->il_importSco($this->slm->getId(), $sco->getId(), $this->packageFolder . "/" . $match[1]);
564  $parent_id = $sco->getId();
565  }
566  if (preg_match("/il_\d+_ass_(\d+)/", $a['identifier'], $match)) {
567  $ass = new ilSCORM2004Asset($this->slm);
568  $ass->setTitle($node->title);
569  $ass->setSLMId($this->slm->getId());
570  $ass->create(true);
571 
572  // save sequencing information
573  $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing");
574  if ($r) {
575  $seq_info = new ilSCORM2004Sequencing($ass->getId());
576  $this->setSequencingInfo(
577  $r->item(0),
578  $seq_info,
579  $a_import_sequencing,
580  "local_obj_" . $ass->getID() . "_0"
581  );
582  $seq_info->initDom();
583  $seq_info->insert();
584  }
585 
586  ilSCORM2004Node::putInTree($ass, $parent_id, "");
587  $newPack = new ilSCORM13Package();
588  $newPack->il_importAss($this->slm->getId(), $ass->getId(), $this->packageFolder . "/" . $match[1]);
589  $parent_id = $ass->getId();
590  }
591 
592  break;
593  }
594  //if($node->nodeType==XML_ELEMENT_NODE)
595  {
596  foreach ($node->children() as $child) {
597  $this->dbImportLM($child, $parent_id, $a_import_sequencing);
598  }
599  }
600  }
601 
608  public function setSequencingInfo($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id = "")
609  {
610  $seq_xml = trim(str_replace("imsss:", "", $this->imsmanifest->saveXML($a_node)));
611  if ($seq_xml != "") {
612  $a_seq_info->setImportSeqXml('<?xml version="1.0"?>' . $seq_xml);
613  }
614  if ($a_import_sequencing) {
615  if ($a_fix_obj_id != "") {
616  $seq_xml = preg_replace("/local_obj_[0-9]*_0/", $a_fix_obj_id, $seq_xml);
617  }
618  $a_seq_info->setSeqXml('<?xml version="1.0"?>' . $seq_xml);
619  }
620  }
621 
622 
623  private function setProgress($progress, $msg = '')
624  {
625  $this->progress = $progress;
626  $this->diagnostic[] = $msg;
627  }
628 
637  public function jsonNode($node, &$sink)
638  {
639  foreach ($node->attributes() as $k => $v) {
640  // cast to boolean and number if possible
641  $v = strval($v);
642  if ($v==="true") {
643  $v = true;
644  } elseif ($v==="false") {
645  $v = false;
646  } elseif (is_numeric($v)) {
647  $v = (float) $v;
648  }
649  $sink[$k] = $v;
650  }
651  foreach ($node->children() as $name => $child) {
652  self::jsonNode($child, $sink[$name][]); // RECURSION
653  }
654  }
655 
656  public function dbImportSco($slm, $sco, $asset = false)
657  {
658  $qtis = array();
659  $d = ilUtil::getDir($this->packageFolder);
660  foreach ($d as $f) {
661  //continue;
662  if ($f [type] == 'file' && substr($f [entry], 0, 4) == 'qti_') {
663  include_once "./Services/QTI/classes/class.ilQTIParser.php";
664  include_once "./Modules/Test/classes/class.ilObjTest.php";
665 
666 
667  $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f [entry], IL_MO_VERIFY_QTI, 0, "");
668  $result = $qtiParser->startParsing();
669  $founditems = &$qtiParser->getFoundItems();
670  // die(print_r($founditems));
671  foreach ($founditems as $qp) {
672  $newObj = new ilObjTest(0, true);
673 
674  // This creates a lot of invalid repository objects for each question
675  // question are not repository objects (see e.g. table object_data), alex 29 Sep 2009
676 
677  // $newObj->setType ( $qp ['type'] );
678  // $newObj->setTitle ( $qp ['title'] );
679  // $newObj->create ( true );
680  // $newObj->createReference ();
681  // $newObj->putInTree ($_GET ["ref_id"]);
682  // $newObj->setPermissions ( $sco->getId ());
683  // $newObj->notify ("new", $_GET["ref_id"], $sco->getId (), $_GET["ref_id"], $newObj->getRefId () );
684  // $newObj->mark_schema->flush ();
685  $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f [entry], IL_MO_PARSE_QTI, 0, "");
686  $qtiParser->setTestObject($newObj);
687  $result = $qtiParser->startParsing();
688  // $newObj->saveToDb ();
689  $qtis = array_merge($qtis, $qtiParser->getImportMapping());
690  }
691  }
692  }
693  //exit;
694  include_once 'Modules/Scorm2004/classes/class.ilSCORM2004Page.php';
695  $doc = new SimpleXMLElement($this->imsmanifest->saveXml());
696  $l = $doc->xpath("/ContentObject/MetaData");
697  if ($l[0]) {
698  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
699  $mdxml = new ilMDXMLCopier($l[0]->asXML(), $slm->getId(), $sco->getId(), $sco->getType());
700  $mdxml->startParsing();
701  $mdxml->getMDObject()->update();
702  }
703  $l = $doc->xpath("/ContentObject/PageObject");
704  foreach ($l as $page_xml) {
705  $tnode = $page_xml->xpath('MetaData/General/Title');
706  $page = new ilSCORM2004PageNode($slm);
707  $page->setTitle($tnode [0]);
708  $page->setSLMId($slm->getId());
709  $page->create(true);
710  ilSCORM2004Node::putInTree($page, $sco->getId(), $target);
711  $pmd = $page_xml->xpath("MetaData");
712  if ($pmd[0]) {
713  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
714  $mdxml = new ilMDXMLCopier($pmd[0]->asXML(), $slm->getId(), $page->getId(), $page->getType());
715  $mdxml->startParsing();
716  $mdxml->getMDObject()->update();
717  }
718  $tnode = $page_xml->xpath("//MediaObject/MediaAlias | //InteractiveImage/MediaAlias");
719  foreach ($tnode as $ttnode) {
720  include_once './Services/MediaObjects/classes/class.ilObjMediaObject.php';
721  $OriginId = $ttnode[OriginId];
722  $medianodes = $doc->xpath("//MediaObject[MetaData/General/Identifier/@Entry='" . $OriginId . "']");
723  $medianode = $medianodes[0];
724  if ($medianode) {
725  $media_object = new ilObjMediaObject();
726  $media_object->setTitle($medianode->MetaData->General->Title);
727  $media_object->setDescription($medianode->MetaData->General->Description);
728  $media_object->create(false);
729  $mmd = $medianode->xpath("MetaData");
730  if ($mmd[0]) {
731  include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
732  $mdxml = new ilMDXMLCopier($mmd[0]->asXML(), 0, $media_object->getId(), $media_object->getType());
733  $mdxml->startParsing();
734  $mdxml->getMDObject()->update();
735  }
736  // determine and create mob directory, move uploaded file to directory
737  $media_object->createDirectory();
738  $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
739  foreach ($medianode->MediaItem as $xMediaItem) {
740  $media_item = new ilMediaItem();
741  $media_object->addMediaItem($media_item);
742  $media_item->setPurpose($xMediaItem[Purpose]);
743  $media_item->setFormat($xMediaItem->Format);
744  $media_item->setLocation($xMediaItem->Location);
745  $media_item->setLocationType($xMediaItem->Location[Type]);
746  $media_item->setWidth($xMediaItem->Layout[Width]);
747  $media_item->setHeight($xMediaItem->Layout[Height]);
748  $media_item->setHAlign($xMediaItem->Layout[HorizontalAlign]);
749  $media_item->setCaption($xMediaItem->Caption);
750  $media_item->setTextRepresentation($xMediaItem->TextRepresentation);
751  $nr = 0;
752 
753  // add map areas (external links only)
754  foreach ($xMediaItem->MapArea as $n => $v) {
755  if ($v->ExtLink[Href] != "") {
756  include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
757  $ma = new ilMapArea();
758 
759  $map_area = new ilMapArea();
760  $map_area->setShape($v[Shape]);
761  $map_area->setCoords($v[Coords]);
762  $map_area->setLinkType(IL_EXT_LINK);
763  $map_area->setTitle($v->ExtLink);
764  $map_area->setHref($v->ExtLink[Href]);
765 
766  $media_item->addMapArea($map_area);
767  }
768  }
769 
770  if ($media_item->getLocationType()=="LocalFile") {
771  // $tmp_name = $this->packageFolder."/objects/".$OriginId."/".$xMediaItem->Location;
772 // copy($tmp_name, $mob_dir."/".$xMediaItem->Location);
773  }
774  }
775 
776  // copy whole directory
777  ilUtil::rCopy($this->packageFolder . "/objects/" . $OriginId, $mob_dir);
778 
779 
780  // alex: fixed media import: these lines have been
781  // behind the next curly bracket which makes it fail
782  // when no medianode is given. (id=0 -> fatal error)
783  ilUtil::renameExecutables($mob_dir);
784  $media_object->update(true);
785  $ttnode [OriginId] = "il__mob_" . $media_object->getId();
786  }
787  }
788  include_once("./Modules/File/classes/class.ilObjFile.php");
789  include_once("./Services/Utilities/classes/class.ilFileUtils.php");
790  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
791 
792  $intlinks = $page_xml->xpath("//IntLink");
793  //die($intlinks);
794  //if($intlinks )
795  {
796  foreach ($intlinks as $intlink) {
797  if ($intlink[Type]!="File") {
798  continue;
799  }
800  $path = $this->packageFolder . "/objects/" . str_replace('dfile', 'file', $intlink[Target]);
801  if (!is_dir($path)) {
802  continue;
803  }
804  $ffiles = array();
806  $filename = $ffiles[file][0];
807  $fileObj = new ilObjFile();
808  $fileObj->setType("file");
811 
812  // better use this, mime_content_type is deprecated
813  $fileObj->setFileType(ilObjMediaObject::getMimeType($path . "/" . $filename));
814 
815  $fileObj->setFileSize(filesize($path . "/" . $filename));
816  $fileObj->create();
817  $fileObj->createReference();
818  //$fileObj->putInTree($_GET["ref_id"]);
819  //$fileObj->setPermissions($slm->getId ());
820  $fileObj->createDirectory();
821  $fileObj->storeUnzipedFile($path . "/" . $filename, ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
822  $intlink[Target]="il__dfile_" . $fileObj->getId();
823  }
824  }
825  $fileitems = $page_xml->xpath("//FileItem/Identifier");
826  //if($intlinks )
827  {
828  foreach ($fileitems as $fileitem) {
829  $path = $this->packageFolder . "/objects/" . $fileitem[Entry];
830  if (!is_dir($path)) {
831  continue;
832  }
833  $ffiles = array();
835  $filename = $ffiles[file][0];
836  $fileObj = new ilObjFile();
837  $fileObj->setType("file");
840 
841  // better use this, mime_content_type is deprecated
842  $fileObj->setFileType(ilObjMediaObject::getMimeType($path . "/" . $filename));
843 
844  $fileObj->setFileSize(filesize($path . "/" . $filename));
845  $fileObj->create();
846  $fileObj->createReference();
847  //$fileObj->putInTree($_GET["ref_id"]);
848  //$fileObj->setPermissions($slm->getId ());
849  $fileObj->createDirectory();
850  $fileObj->storeUnzipedFile($path . "/" . $filename, ilFileUtils::utf8_encode(ilUtil::stripSlashes($filename)));
851  $fileitem[Entry]="il__file_" . $fileObj->getId();
852  }
853  }
854  $pagex = new ilSCORM2004Page($page->getId());
855 
856  $ddoc = new DOMDocument();
857  $ddoc->async = false;
858  $ddoc->preserveWhiteSpace = false;
859  $ddoc->formatOutput = false;
860  $ddoc->loadXML($page_xml->asXML());
861  $xpath = new DOMXPath($ddoc);
862  $tnode = $xpath->query('PageContent');
863  $t = "<PageObject>";
864  foreach ($tnode as $ttnode) {
865  $t .= str_replace("&amp;", "&", $ddoc->saveXML($ttnode));
866  }
867  $t .="</PageObject>";
868  foreach ($qtis as $old=>$q) {
869  $t = str_replace($old, 'il__qst_' . $q['pool'], $t);
870  }
871  $pagex->setXMLContent($t);
872  $pagex->updateFromXML();
873  }
874  }
875 
876  public function dbImport($node, &$lft=1, $depth=1, $parent=0)
877  {
878  global $ilDB;
879 
880  switch ($node->nodeType) {
881  case XML_DOCUMENT_NODE:
882 
883  // insert into cp_package
884 
885  $res = $ilDB->queryF(
886  'SELECT * FROM cp_package WHERE obj_id = %s AND c_identifier = %s',
887  array('integer', 'text'),
888  array($this->packageId, $this->packageName)
889  );
890  if ($num_rows = $ilDB->numRows($res)) {
891  $query = 'UPDATE cp_package '
892  . 'SET persistprevattempts = %s, c_settings = %s '
893  . 'WHERE obj_id = %s AND c_identifier= %s';
894  $ilDB->manipulateF(
895  $query,
896  array('integer', 'text', 'integer', 'text'),
897  array(0, null, $this->packageId, $this->packageName)
898  );
899  } else {
900  $query = 'INSERT INTO cp_package (obj_id, c_identifier, persistprevattempts, c_settings) '
901  . 'VALUES (%s, %s, %s, %s)';
902  $ilDB->manipulateF(
903  $query,
904  array('integer','text','integer', 'text'),
905  array($this->packageId, $this->packageName, 0, null)
906  );
907  }
908 
909  // run sub nodes
910  $this->dbImport($node->documentElement); // RECURSION
911  break;
912 
913  case XML_ELEMENT_NODE:
914  if ($node->nodeName==='manifest') {
915  if ($node->getAttribute('uri')=="") {
916  // default URI is md5 hash of zip file, i.e. packageHash
917  $node->setAttribute('uri', 'md5:' . $this->packageHash);
918  }
919  }
920 
921  $cp_node_id = $ilDB->nextId('cp_node');
922 
923  $query = 'INSERT INTO cp_node (cp_node_id, slm_id, nodename) '
924  . 'VALUES (%s, %s, %s)';
925  $ilDB->manipulateF(
926  $query,
927  array('integer', 'integer', 'text'),
928  array($cp_node_id, $this->packageId, $node->nodeName)
929  );
930 
931  $query = 'INSERT INTO cp_tree (child, depth, lft, obj_id, parent, rgt) '
932  . 'VALUES (%s, %s, %s, %s, %s, %s)';
933  $ilDB->manipulateF(
934  $query,
935  array('integer', 'integer', 'integer', 'integer', 'integer', 'integer'),
936  array($cp_node_id, $depth, $lft++, $this->packageId, $parent, 0)
937  );
938 
939  // insert into cp_*
940  //$a = array('cp_node_id' => $cp_node_id);
941  $names = array('cp_node_id');
942  $values = array($cp_node_id);
943  $types = array('integer');
944 
945  foreach ($node->attributes as $attr) {
946  switch (strtolower($attr->name)) {
947  case 'completionsetbycontent': $names[] = 'completionbycontent';break;
948  case 'objectivesetbycontent': $names[] = 'objectivebycontent';break;
949  case 'type': $names[] = 'c_type';break;
950  case 'mode': $names[] = 'c_mode';break;
951  case 'language': $names[] = 'c_language';break;
952  case 'condition': $names[] = 'c_condition';break;
953  case 'operator': $names[] = 'c_operator';break;
954  case 'condition': $names[] = 'c_condition';break;
955  case 'readnormalizedmeasure': $names[] = 'readnormalmeasure';break;
956  case 'writenormalizedmeasure': $names[] = 'writenormalmeasure';break;
957  case 'minnormalizedmeasure': $names[] = 'minnormalmeasure';break;
958  case 'primary': $names[] = 'c_primary';break;
959  case 'minnormalizedmeasure': $names[] = 'minnormalmeasure';break;
960  case 'persistpreviousattempts': $names[] = 'persistprevattempts';break;
961  case 'identifier': $names[] = 'c_identifier';break;
962  case 'settings': $names[] = 'c_settings';break;
963  case 'activityabsolutedurationlimit': $names[] = 'activityabsdurlimit';break;
964  case 'activityexperienceddurationlimit': $names[] = 'activityexpdurlimit';break;
965  case 'attemptabsolutedurationlimit': $names[] = 'attemptabsdurlimit';break;
966  case 'measuresatisfactionifactive': $names[] = 'measuresatisfactive';break;
967  case 'objectivemeasureweight': $names[] = 'objectivemeasweight';break;
968  case 'requiredforcompleted': $names[] = 'requiredcompleted';break;
969  case 'requiredforincomplete': $names[] = 'requiredincomplete';break;
970  case 'requiredfornotsatisfied': $names[] = 'requirednotsatisfied';break;
971  case 'rollupobjectivesatisfied': $names[] = 'rollupobjectivesatis';break;
972  case 'rollupprogresscompletion': $names[] = 'rollupprogcompletion';break;
973  case 'usecurrentattemptobjectiveinfo': $names[] = 'usecurattemptobjinfo';break;
974  case 'usecurrentattemptprogressinfo': $names[] = 'usecurattemptproginfo';break;
975  default: $names[] = strtolower($attr->name);break;
976  }
977 
978  if (in_array(
979  $names[count($names) - 1],
980  array('flow', 'completionbycontent',
981  'objectivebycontent', 'rollupobjectivesatis',
982  'tracked', 'choice',
983  'choiceexit', 'satisfiedbymeasure',
984  'c_primary', 'constrainchoice',
985  'forwardonly', 'global_to_system',
986  'writenormalmeasure', 'writesatisfiedstatus',
987  'readnormalmeasure', 'readsatisfiedstatus',
988  'preventactivation', 'measuresatisfactive',
989  'reorderchildren', 'usecurattemptproginfo',
990  'usecurattemptobjinfo', 'rollupprogcompletion',
991  'read_shared_data', 'write_shared_data',
992  'shared_data_global_to_system', 'completedbymeasure')
993  )) {
994  if ($attr->value == 'true') {
995  $values[] = 1;
996  } elseif ($attr->value == 'false') {
997  $values[] = 0;
998  } else {
999  $values[] = (int) $attr->value;
1000  }
1001  } else {
1002  $values[] = $attr->value;
1003  }
1004 
1005  if (in_array(
1006  $names[count($names) - 1],
1007  array('objectivesglobtosys', 'attemptlimit',
1008  'flow', 'completionbycontent',
1009  'objectivebycontent', 'rollupobjectivesatis',
1010  'tracked', 'choice',
1011  'choiceexit', 'satisfiedbymeasure',
1012  'c_primary', 'constrainchoice',
1013  'forwardonly', 'global_to_system',
1014  'writenormalmeasure', 'writesatisfiedstatus',
1015  'readnormalmeasure', 'readsatisfiedstatus',
1016  'preventactivation', 'measuresatisfactive',
1017  'reorderchildren', 'usecurattemptproginfo',
1018  'usecurattemptobjinfo', 'rollupprogcompletion',
1019  'read_shared_data', 'write_shared_data',
1020  'shared_data_global_to_system')
1021  )) {
1022  $types[] = 'integer';
1023  } elseif (in_array(
1024  $names[count($names) - 1],
1025  array('jsdata', 'xmldata', 'activitytree', 'data')
1026  )) {
1027  $types[] = 'clob';
1028  } elseif (in_array(
1029  $names[count($names) - 1],
1030  array('objectivemeasweight')
1031  )) {
1032  $types[] = 'float';
1033  } else {
1034  $types[] = 'text';
1035  }
1036  }
1037 
1038  if ($node->nodeName==='datamap') {
1039  $names[] = 'slm_id';
1040  $values[] = $this->packageId;
1041  $types[] = 'integer';
1042 
1043  $names[] = 'sco_node_id';
1044  $values[] = $parent;
1045  $types[] = 'integer';
1046  }
1047 
1048  // we have to change the insert method because of clob fields ($ilDB->manipulate does not work here)
1049  $insert_data = array();
1050  foreach ($names as $key => $db_field) {
1051  $insert_data[$db_field] = array($types[$key], trim($values[$key]));
1052  }
1053  $ilDB->insert('cp_' . strtolower($node->nodeName), $insert_data);
1054 
1055  $node->setAttribute('foreignId', $cp_node_id);
1056  $this->idmap[$node->getAttribute('id')] = $cp_node_id;
1057 
1058  // run sub nodes
1059  foreach ($node->childNodes as $child) {
1060  $this->dbImport($child, $lft, $depth + 1, $cp_node_id); // RECURSION
1061  }
1062 
1063  // update cp_tree (rgt value for pre order walk in sql tree)
1064  $query = 'UPDATE cp_tree SET rgt = %s WHERE child = %s';
1065  $ilDB->manipulateF(
1066  $query,
1067  array('integer', 'integer'),
1068  array($lft++, $cp_node_id)
1069  );
1070 
1071  break;
1072  }
1073  }
1074 
1078  public function dbAddNew()
1079  {
1080  global $ilDB;
1081 
1082  $ilDB->insert('cp_package', array(
1083  'obj_id' => array('integer', $this->packageId),
1084  'xmldata' => array('clob', $x->asXML()),
1085  'jsdata' => array('clob', json_encode($j))
1086  ));
1087 
1088  return true;
1089  }
1090 
1091 
1092  public function removeCMIData()
1093  {
1094  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1096 
1097  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1098  ilLPStatusWrapper::_refreshStatus($this->packageId);
1099  }
1100 
1101  public function removeCPData()
1102  {
1103  global $ilDB, $ilLog;
1104 
1105  //get relevant nodes
1106  $cp_nodes = array();
1107 
1108  $res = $ilDB->queryF(
1109  'SELECT cp_node.cp_node_id FROM cp_node WHERE cp_node.slm_id = %s',
1110  array('integer'),
1111  array($this->packageId)
1112  );
1113  while ($data = $ilDB->fetchAssoc($res)) {
1114  $cp_nodes[] = $data['cp_node_id'];
1115  }
1116 
1117  //remove package data
1118  foreach (self::$elements['cp'] as $t) {
1119  $t = 'cp_' . $t;
1120 
1121  $in = $ilDB->in(strtolower($t) . '.cp_node_id', $cp_nodes, false, 'integer');
1122  $ilDB->manipulate('DELETE FROM ' . strtolower($t) . ' WHERE ' . $in);
1123  }
1124 
1125  // remove CP structure entries in tree and node
1126  $ilDB->manipulateF(
1127  'DELETE FROM cp_tree WHERE cp_tree.obj_id = %s',
1128  array('integer'),
1129  array($this->packageId)
1130  );
1131 
1132  $ilDB->manipulateF(
1133  'DELETE FROM cp_node WHERE cp_node.slm_id = %s',
1134  array('integer'),
1135  array($this->packageId)
1136  );
1137 
1138  // remove general package entry
1139  $ilDB->manipulateF(
1140  'DELETE FROM cp_package WHERE cp_package.obj_id = %s',
1141  array('integer'),
1142  array($this->packageId)
1143  );
1144  }
1145 
1146  public function dbRemoveAll()
1147  {
1148  //dont change order of calls
1149  $this->removeCMIData();
1150  $this->removeCPData();
1151  }
1152 
1153  public function transform($inputdoc, $xslfile, $outputpath = null)
1154  {
1155  $xsl = new DOMDocument;
1156  $xsl->async = false;
1157  if (!@$xsl->load($xslfile)) {
1158  die('ERROR: load StyleSheet ' . $xslfile);
1159  }
1160  $prc = new XSLTProcessor;
1161  $prc->registerPHPFunctions();
1162  $r = @$prc->importStyleSheet($xsl);
1163  if (false===@$prc->importStyleSheet($xsl)) {
1164  die('ERROR: importStyleSheet ' . $xslfile);
1165  }
1166  if ($outputpath) {
1167  file_put_contents($outputpath, $prc->transformToXML($inputdoc));
1168  } else {
1169  return $prc->transformToDoc($inputdoc);
1170  }
1171  }
1172 
1173  public function validate($doc, $schema)
1174  {
1175  libxml_use_internal_errors(true);
1176  $return = @$doc->schemaValidate($schema);
1177  if (!$return) {
1178  $levels = array(
1179  LIBXML_ERR_ERROR => 'Error',
1180  LIBXML_ERR_FATAL => 'Fatal Error'
1181  );
1182  foreach (libxml_get_errors() as $error) {
1183  $level = $levels[$error->level];
1184  if (isset($level)) {
1185  $message = trim($error->message);
1186  $this->diagnostic[] = "XSLT $level (Line $error->line) $message";
1187  }
1188  }
1189  libxml_clear_errors();
1190  }
1191  libxml_use_internal_errors(false);
1192  return $return;
1193  }
1194 
1195  //to be called from IlObjUser
1196  public static function _removeTrackingDataForUser($user_id)
1197  {
1198  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1200  //missing updatestatus
1201  }
1202 }
global $ilErr
Definition: raiseError.php:16
Class ilSCORM2004PageNode.
dbImportSco($slm, $sco, $asset=false)
Content Object Parser.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static getMimeType($a_file, $a_external=null)
get mime type for file
Class ilSCORM2004Sco.
dbImportLM($node, $parent_id="", $a_import_sequencing=false)
$result
transform($inputdoc, $xslfile, $outputpath=null)
jsonNode($node, &$sink)
Helper for UploadAndImport Recursively copies values from XML into PHP array for export as json Eleme...
dbImport($node, &$lft=1, $depth=1, $parent=0)
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
$x
Definition: example_009.php:98
startParsing()
stores xml data in array
$_GET["client_id"]
Class ilObjGlossary.
il_import($packageFolder, $packageId, $ilias, $validate, $reimport=false)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
SCORM 13 Metadata importer.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
Class ilSCORM2004Chapter.
$s
Definition: pwgen.php:45
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
dbAddNew()
add new sahs and package record
static _getDirectory($a_mob_id)
get directory for files of media object (static)
setSequencingInfo($a_node, $a_seq_info, $a_import_sequencing, $a_fix_obj_id="")
Save sequencing ingo.
$error
Definition: Error.php:17
if($format !==null) $name
Definition: metadata.php:146
$r
Definition: example_031.php:79
catch(Exception $e) $message
exportXML()
Export as internal XML.
foreach($_POST as $key=> $value) $res
il_importAss($packageId, $sco_id, $packageFolder)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
const IL_MO_PARSE_QTI
Class ilSCORM2004Page.
setProgress($progress, $msg='')
Class ilMediaItem.
Reload workbook from saved file
Class ilObjMediaObject.
static _removeTrackingDataForUser($user_id)
$query
Add a drawing to the header
Definition: 04printing.php:69
$n
Definition: RandomTest.php:85
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$old
il_importLM($slm, $packageFolder, $a_import_sequencing=false)
Class ilSCORM2004Sequencing.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
setTreeTablePK($a_column_name)
set column containing primary key in tree table public
static _writeDescription($a_obj_id, $a_desc)
write description to db (static)
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
const IL_EXT_LINK
static utf8_encode($string)
utf8-encodes string if it is not a valid utf8-string.
Class ilMapArea.
validate($doc, $schema)
$lm_set
global $l
Definition: afr.php:30
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Class ilObjSCORM2004LearningModule.
__construct($packageId=null)
global $ilDB
Class ilSCORM2004Asset.
il_importSco($packageId, $sco_id, $packageFolder)
Imports an extracted SCORM 2004 module from ilias-data dir into database.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
const IL_MO_VERIFY_QTI
static removeCMIDataForPackage($packageId)
$key
Definition: croninfo.php:18
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
importGlossary($slm, $packageFolder)