ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjSCORM2004LearningModule.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
5require_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
6
16{
20 protected $user;
21
25 protected $tabs;
26
27 public $validator;
28 // var $meta_data;
29
30 const CONVERT_XSL = './Modules/Scorm2004/templates/xsl/op/scorm12To2004.xsl';
31 const WRAPPER_HTML = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/GenericRunTimeWrapper.htm';
32 const WRAPPER_JS = './Modules/Scorm2004/scripts/converter/GenericRunTimeWrapper1.0_aadlc/SCOPlayerWrapper.js';
33
40 public function __construct($a_id = 0, $a_call_by_reference = true)
41 {
42 global $DIC;
43
44 $this->lng = $DIC->language();
45 $this->error = $DIC["ilErr"];
46 $this->db = $DIC->database();
47 $this->log = $DIC["ilLog"];
48 $this->user = $DIC->user();
49 $this->tabs = $DIC->tabs();
50 $this->type = "sahs";
51 parent::__construct($a_id, $a_call_by_reference);
52 }
53
59 public function setImportSequencing($a_val)
60 {
61 $this->import_sequencing = $a_val;
62 }
63
69 public function getImportSequencing()
70 {
71 return $this->import_sequencing;
72 }
73
80 public function validate($directory)
81 {
82 //$this->validator = new ilObjSCORMValidator($directory);
83 //$returnValue = $this->validator->validate();
84 return true;
85 }
86
91 public function readObject()
92 {
95
96 //check for json_encode,json_decode
97 if (!function_exists('json_encode') || !function_exists('json_decode')) {
98 $ilErr->raiseError($lng->txt('scplayer_phpmysqlcheck'), $ilErr->WARNING);
99 }
100
101 $needs_convert = false;
102
103 // convert imsmanifest.xml file in iso to utf8 if needed
104
105 $manifest_file = $this->getDataDirectory() . "/imsmanifest.xml";
106
107 // check if manifestfile exists and space left on device...
108 $check_for_manifest_file = is_file($manifest_file);
109
110
111
112 // if no manifestfile
113 if (!$check_for_manifest_file) {
114 $ilErr->raiseError($this->lng->txt("Manifestfile $manifest_file not found!"), $ilErr->MESSAGE);
115 return;
116 }
117
118
119 if ($check_for_manifest_file) {
120 $manifest_file_array = file($manifest_file);
121
122 foreach ($manifest_file_array as $mfa) {
123 // if (seems_not_utf8($mfa))
124 if (@iconv('UTF-8', 'UTF-8', $mfa) != $mfa) {
125 $needs_convert = true;
126 break;
127 }
128 }
129
130
131
132 // to copy the file we need some extraspace, counted in bytes *2 ... we need 2 copies....
133 $estimated_manifest_filesize = filesize($manifest_file) * 2;
134
135 // i deactivated this, because it seems to fail on some windows systems (see bug #1795)
136 //$check_disc_free = disk_free_space($this->getDataDirectory()) - $estimated_manifest_filesize;
137 $check_disc_free = 2;
138 }
139
140
141 // if $manifest_file needs to be converted to UTF8
142 if ($needs_convert) {
143 // if file exists and enough space left on device
144 if ($check_for_manifest_file && ($check_disc_free > 1)) {
145
146 // create backup from original
147 if (!copy($manifest_file, $manifest_file . ".old")) {
148 echo "Failed to copy $manifest_file...<br>\n";
149 }
150
151 // read backupfile, convert each line to utf8, write line to new file
152 // php < 4.3 style
153 $f_write_handler = fopen($manifest_file . ".new", "w");
154 $f_read_handler = fopen($manifest_file . ".old", "r");
155 while (!feof($f_read_handler)) {
156 $zeile = fgets($f_read_handler);
157 //echo mb_detect_encoding($zeile);
158 fputs($f_write_handler, utf8_encode($zeile));
159 }
160 fclose($f_read_handler);
161 fclose($f_write_handler);
162
163 // copy new utf8-file to imsmanifest.xml
164 if (!copy($manifest_file . ".new", $manifest_file)) {
165 echo "Failed to copy $manifest_file...<br>\n";
166 }
167
168 if (!@is_file($manifest_file)) {
169 $ilErr->raiseError($this->lng->txt("cont_no_manifest"), $ilErr->WARNING);
170 }
171 } else {
172 // gives out the specific error
173
174 if (!($check_disc_free > 1)) {
175 $ilErr->raiseError($this->lng->txt("Not enough space left on device!"), $ilErr->MESSAGE);
176 }
177 return;
178 }
179 } else {
180 // check whether file starts with BOM (that confuses some sax parsers, see bug #1795)
181 $hmani = fopen($manifest_file, "r");
182 $start = fread($hmani, 3);
183 if (strtolower(bin2hex($start)) == "efbbbf") {
184 $f_write_handler = fopen($manifest_file . ".new", "w");
185 while (!feof($hmani)) {
186 $n = fread($hmani, 900);
187 fputs($f_write_handler, $n);
188 }
189 fclose($f_write_handler);
190 fclose($hmani);
191
192 // copy new utf8-file to imsmanifest.xml
193 if (!copy($manifest_file . ".new", $manifest_file)) {
194 echo "Failed to copy $manifest_file...<br>\n";
195 }
196 } else {
197 fclose($hmani);
198 }
199 }
200
201 //validate the XML-Files in the SCORM-Package
202 if ($_POST["validate"] == "y") {
203 if (!$this->validate($this->getDataDirectory())) {
204 $ilErr->raiseError(
205 "<b>Validation Error(s):</b><br>" . $this->getValidationSummary(),
206 $ilErr->WARNING
207 );
208 }
209 }
210
211
212 //check for SCORM 1.2
213 $this->convert_1_2_to_2004($manifest_file);
214
215 // start SCORM 2004 package parser/importer
216 include_once("./Modules/Scorm2004/classes/ilSCORM13Package.php");
217 $newPack = new ilSCORM13Package();
218 if ($this->getEditable()) {
219 return $newPack->il_importLM(
220 $this,
221 $this->getDataDirectory(),
222 $this->getImportSequencing()
223 );
224 } else {
225 return $newPack->il_import($this->getDataDirectory(), $this->getId(), $DIC["ilias"], $_POST["validate"]);
226 }
227 }
228
229
230 public function fixReload()
231 {
232 $out = file_get_contents($this->imsmanifestFile);
233 $check ='/xmlns="http:\/\/www.imsglobal.org\/xsd\/imscp_v1p1"/';
234 $replace="xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"";
235 $out=preg_replace($check, $replace, $out);
236 file_put_contents($this->imsmanifestFile, $out);
237 }
238
239
240 public function convert_1_2_to_2004($manifest)
241 {
244
245 ##check manifest-file for version. Check for schemaversion as this is a required element for SCORM 2004
246 ##accept 2004 3rd Edition an CAM 1.3 as valid schemas
247
248 //set variables
249 $this->packageFolder=$this->getDataDirectory();
250 $this->imsmanifestFile=$manifest;
251 $doc = new DomDocument();
252
253 //fix reload errors before loading
254 $this->fixReload();
255 $doc->load($this->imsmanifestFile);
256 $elements = $doc->getElementsByTagName("schemaversion");
257 $schema=$elements->item(0)->nodeValue;
258 if (strtolower(trim($schema))=="cam 1.3" || strtolower(trim($schema))=="2004 3rd edition" || strtolower(trim($schema))=="2004 4th edition") {
259 //no conversion
260 $this->converted=false;
261 return true;
262 } else {
263 $this->converted=true;
264 //convert to SCORM 2004
265
266 //check for broken SCORM 1.2 manifest file (missing organization default-common error in a lot of manifest files)
267 $organizations = $doc->getElementsByTagName("organizations");
268 //first check if organizations is in manifest
269 if ($organizations->item(0)==null) {
270 die("organizations missing in manifest");
271 }
272 $default=$organizations->item(0)->getAttribute("default");
273 if ($default=="" || $default==null) {
274 //lookup identifier
275 $organization = $doc->getElementsByTagName("organization");
276 $ident=$organization->item(0)->getAttribute("identifier");
277 $organizations->item(0)->setAttribute("default", $ident);
278 }
279
280 //validate the fixed mainfest. If it's still not valid, don't transform an throw error
281
282
283 //first copy wrappers
284 $wrapperdir=$this->packageFolder . "/GenericRunTimeWrapper1.0_aadlc";
285 mkdir($wrapperdir);
286 copy(self::WRAPPER_HTML, $wrapperdir . "/GenericRunTimeWrapper.htm");
287 copy(self::WRAPPER_JS, $wrapperdir . "/SCOPlayerWrapper.js");
288
289 //backup manifestfile
290 $this->backupManifest=$this->packageFolder . "/imsmanifest.xml.back";
291 $ret=copy($this->imsmanifestFile, $this->backupManifest);
292
293 //transform manifest file
294 $this->totransform = $doc;
295 $ilLog->write("SCORM: about to transform to SCORM 2004");
296
297 $xsl = new DOMDocument;
298 $xsl->async = false;
299 $xsl->load(self::CONVERT_XSL);
300 $prc = new XSLTProcessor;
301 $r = @$prc->importStyleSheet($xsl);
302
303 file_put_contents($this->imsmanifestFile, $prc->transformToXML($this->totransform));
304
305 $ilLog->write("SCORM: Transformation completed");
306 return true;
307 }
308 }
309
317 public static function _lookupLastAccess($a_obj_id, $a_usr_id)
318 {
319 global $DIC;
320
321 $ilDB = $DIC->database();
322
323 $result = $ilDB->queryF(
324 '
325 SELECT MAX(c_timestamp) last_access
326 FROM cmi_node, cp_node
327 WHERE cmi_node.cp_node_id = cp_node.cp_node_id
328 AND cp_node.slm_id = %s
329 AND user_id = %s
330 GROUP BY c_timestamp',
331 array('integer', 'integer'),
332 array($a_obj_id, $a_usr_id)
333 );
334 if ($ilDB->numRows($result)) {
335 $row = $ilDB->fetchAssoc($result);
336 return $row["last_access"];
337 }
338
339 return "";
340 }
341
345 // function getTrackedUsers($a_search)
346 // {
347 // global $ilUser, $ilDB, $ilUser;
348
349 // $sco_set = $ilDB->queryF('
350 // SELECT DISTINCT user_id,MAX(c_timestamp) last_access
351 // FROM cmi_node, cp_node
352 // WHERE cmi_node.cp_node_id = cp_node.cp_node_id
353 // AND cp_node.slm_id = %s
354 // GROUP BY user_id',
355 // array('integer'),
356 // array($this->getId()));
357
358 // $items = array();
359 // $temp = array();
360
361 // while($sco_rec = $ilDB->fetchAssoc($sco_set))
362 // {
363 // $name = ilObjUser::_lookupName($sco_rec["user_id"]);
364 // if ($sco_rec['last_access'] != 0) {
365 // // $sco_rec['last_access'] = $sco_rec['last_access'];
366 // } else {
367 // $sco_rec['last_access'] = "";
368 // }
369 // if (ilObject::_exists($sco_rec['user_id']) && ilObject::_lookUpType($sco_rec['user_id'])=="usr" ) {
370 // $user = new ilObjUser($sco_rec['user_id']);
371 // $temp = array("user_full_name" => $name["lastname"].", ".
372 // $name["firstname"]." [".ilObjUser::_lookupLogin($sco_rec["user_id"])."]",
373 // "user_id" => $sco_rec["user_id"],"last_access" => $sco_rec['last_access'],
374 // "version"=> $this->getModuleVersionForUser($sco_rec["user_id"]),
375 // "attempts" => $this->getAttemptsForUser($sco_rec["user_id"]),
376 // "username" => $user->getLastname().", ".$user->getFirstname()
377 // );
378 // if ($a_search != "" && (strpos(strtolower($user->getLastname()), strtolower($a_search)) !== false || strpos(strtolower($user->getFirstname()), strtolower($a_search)) !== false ) ) {
379 // $items[] = $temp;
380 // } else if ($a_search == "") {
381 // $items[] = $temp;
382 // }
383 // }
384 // }
385
386 // return $items;
387 // }
388
389 public function deleteTrackingDataOfUsers($a_users)
390 {
392 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
393 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
394 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
396
397 foreach ($a_users as $user) {
400 }
401 }
402
403
407 public function getTrackedItems()
408 {
412
413 $sco_set = $ilDB->queryF(
414 '
415 SELECT DISTINCT cmi_node.cp_node_id id
416 FROM cp_node, cmi_node
417 WHERE slm_id = %s
418 AND cp_node.cp_node_id = cmi_node.cp_node_id
419 ORDER BY cmi_node.cp_node_id ',
420 array('integer'),
421 array($this->getId())
422 );
423
424 $items = array();
425
426 while ($sco_rec = $ilDB->fetchAssoc($sco_set)) {
427 $item['id']=$sco_rec["id"];
428 $item['title']=self::_lookupItemTitle($sco_rec["id"]);
429 $items[count($items)] =$item;
430 }
431 return $items;
432 }
433
434
435 public function getTrackingDataAgg($a_user_id, $raw = false)
436 {
438
439 $scos = array();
440 $data = array();
441 //get all SCO's of this object
442
443 $val_set = $ilDB->queryF(
444 'SELECT cp_node_id FROM cp_node
445 WHERE nodename = %s
446 AND cp_node.slm_id = %s',
447 array('text', 'integer'),
448 array('item',$this->getId())
449 );
450 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
451 array_push($scos, $val_rec['cp_node_id']);
452 }
453
454 foreach ($scos as $sco) {
455 $data_set = $ilDB->queryF(
456 '
457 SELECT c_timestamp last_access, total_time, success_status, completion_status,
458 c_raw, scaled, cp_node_id
459 FROM cmi_node
460 WHERE cp_node_id = %s
461 AND user_id = %s',
462 array('integer','integer'),
463 array($sco,$a_user_id)
464 );
465
466 while ($data_rec = $ilDB->fetchAssoc($data_set)) {
467 if ($data_rec["success_status"]!="" && $data_rec["success_status"]!="unknown") {
468 $status = $data_rec["success_status"];
469 } else {
470 if ($data_rec["completion_status"]=="") {
471 $status="unknown";
472 } else {
473 $status = $data_rec["completion_status"];
474 }
475 }
476 if (!$raw) {
477 $time = ilDatePresentation::secondsToString(self::_ISODurationToCentisec($data_rec["total_time"])/100);
478 $score = "";
479 if ($data_rec["c_raw"] != null) {
480 $score = $data_rec["c_raw"];
481 if ($data_rec["scaled"] != null) {
482 $score .= " = ";
483 }
484 }
485 if ($data_rec["scaled"] != null) {
486 $score .= ($data_rec["scaled"]*100) . "%";
487 }
488 $title = self::_lookupItemTitle($data_rec["cp_node_id"]);
489 $last_access=ilDatePresentation::formatDate(new ilDateTime($data_rec['last_access'], IL_CAL_DATETIME));
490 $data[] = array("sco_id"=>$data_rec["cp_node_id"],
491 "score" => $score, "time" => $time, "status" => $status,"last_access"=>$last_access,"title"=>$title);
492 } else {
493 $data_rec["total_time"] = self::_ISODurationToCentisec($data_rec["total_time"])/100;
494 $data[$data_rec["cp_node_id"]] = $data_rec;
495 }
496 }
497 }
498
499
500 return $data;
501 }
502
506 public function getAttemptsForUser($a_user_id)
507 {
509 $val_set = $ilDB->queryF(
510 'SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
511 array('integer','integer'),
512 array($a_user_id, $this->getId())
513 );
514
515 $val_rec = $ilDB->fetchAssoc($val_set);
516
517 if ($val_rec["package_attempts"] == null) {
518 $val_rec["package_attempts"]="";
519 }
520
521 return $val_rec["package_attempts"];
522 }
523
524
528 public function getModuleVersionForUser($a_user_id)
529 {
531 $val_set = $ilDB->queryF(
532 'SELECT module_version FROM sahs_user WHERE user_id = %s AND obj_id = %s',
533 array('integer','integer'),
534 array($a_user_id, $this->getId())
535 );
536
537 $val_rec = $ilDB->fetchAssoc($val_set);
538
539 if ($val_rec["module_version"] == null) {
540 $val_rec["module_version"]="";
541 }
542 return $val_rec["module_version"];
543 }
544
545
546 // function exportSelected($a_exportall = 0, $a_user = array())
547 // {
548 // include_once("./Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsExport.php");
549 // ilSCORM2004TrackingItemsExport::exportSelected($a_exportall = 0, $a_user = array());
550 // }
551
552
553
554 public function importSuccess($a_file)
555 {
558 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
559 $scos = array();
560 //get all SCO's of this object ONLY RELEVANT!
561 include_once './Services/Object/classes/class.ilObjectLP.php';
562 $olp = ilObjectLP::getInstance($this->getId());
563 $collection = $olp->getCollectionInstance();
564 if ($collection) {
565 $scos = $collection->getItems();
566 }
567
568 $fhandle = fopen($a_file, "r");
569
570 $obj_id = $this->getID();
571 $users = array();
572 $usersToDelete = array();
573 $fields = fgetcsv($fhandle, 4096, ';');
574 while (($csv_rows = fgetcsv($fhandle, 4096, ";")) !== false) {
575 $data = array_combine($fields, $csv_rows);
576 //no check the format - sufficient to import users
577 if ($data["Login"]) {
578 $user_id = $this->get_user_id($data["Login"]);
579 }
580 if ($data["login"]) {
581 $user_id = $this->get_user_id($data["login"]);
582 }
583 //add mail in future
584 if ($data["user"] && is_numeric($data["user"])) {
585 $user_id = $data["user"];
586 }
587 if ($user_id>0) {
588 $last_access = ilUtil::now();
589 if ($data['Date']) {
590 $date_ex = explode('.', $data['Date']);
591 $last_access = implode('-', array($date_ex[2], $date_ex[1], $date_ex[0]));
592 }
593 if ($data['LastAccess']) {
594 $last_access = $data['LastAccess'];
595 }
596
598
599 if ($data["Status"]) {
600 if (is_numeric($data["Status"])) {
601 $status = $data["Status"];
602 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_NOT_ATTEMPTED) {
604 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_IN_PROGRESS) {
606 } elseif ($data["Status"] == ilLPStatus::LP_STATUS_FAILED) {
608 }
609 }
610 $attempts = null;
611 if ($data["Attempts"]) {
612 $attempts = $data["Attempts"];
613 }
614
615 $percentage_completed = 0;
617 $percentage_completed = 100;
618 } elseif ($data['percentageCompletedSCOs']) {
619 $percentage_completed = $data['percentageCompletedSCOs'];
620 }
621
622 $sco_total_time_sec = null;
623 if ($data['SumTotal_timeSeconds']) {
624 $sco_total_time_sec = $data['SumTotal_timeSeconds'];
625 }
626
628 $usersToDelete[] = $user_id;
629 } else {
630 $this->importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
631 $users[] = $user_id;
632 }
633
635 foreach ($scos as $sco_id) {
636 $res = $ilDB->queryF(
637 '
638 SELECT completion_status, success_status, user_id FROM cmi_node WHERE cp_node_id = %s AND user_id = %s',
639 array('integer','integer'),
640 array($sco_id,$user_id)
641 );
642
643 if (!$ilDB->numRows($res)) {
644 $nextId = $ilDB->nextId('cmi_node');
645 $val_set = $ilDB->manipulateF(
646 'INSERT INTO cmi_node
647 (cp_node_id,user_id,completion_status,c_timestamp,cmi_node_id)
648 VALUES(%s,%s,%s,%s,%s)',
649 array('integer','integer','text','timestamp','integer'),
650 array($sco_id,$user_id,'completed',$last_access,$nextId)
651 );
652 } else {
653 $doUpdate = false;
654 while ($row = $ilDB->fetchAssoc($res)) {
655 if (($row["completion_status"] == "completed" && $row["success_status"] != "failed") || $row["success_status"] == "passed") {
656 if ($doUpdate != true) {
657 $doUpdate = false;
658 } //note for issue if there are 2 entries for same sco_id
659 } else {
660 $doUpdate = true;
661 }
662 }
663 if ($doUpdate == true) {
664 $ilDB->update(
665 'cmi_node',
666 array(
667 'completion_status' => array('text', 'completed'),
668 'success_status' => array('text', ''),
669 'suspend_data' => array('text', ''),
670 'c_timestamp' => array('timestamp', $last_access)
671 ),
672 array(
673 'user_id' => array('integer', $user_id),
674 'cp_node_id' => array('integer', $sco_id)
675 )
676 );
677 }
678 }
679 }
680 }
681 } else {
682 //echo "Warning! User $csv_rows[0] does not exist in ILIAS. Data for this user was skipped.\n";
683 }
684 }
685
686 if (count($usersToDelete)>0) {
687 // include_once("./Services/Tracking/classes/class.ilLPMarks.php");
688 // ilLPMarks::_deleteForUsers($this->getId(), $usersToDelete);
689 $this->deleteTrackingDataOfUsers($usersToDelete);
690 }
691 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
693
694 return 0;
695 }
696
703 public static function _ISODurationToCentisec($str)
704 {
705 $aV = array(0, 0, 0, 0, 0, 0);
706 $bErr = false;
707 $bTFound = false;
708 if (strpos($str, "P") != 0) {
709 $bErr = true;
710 }
711 if (!$bErr) {
712 $aT = array("Y", "M", "D", "H", "M", "S");
713 $p = 0;
714 $i = 0;
715 $str = substr($str, 1);
716 for ($i = 0; $i < count($aT); $i++) {
717 if (strpos($str, "T")===0) {
718 $str = substr($str, 1);
719 $i = max($i, 3);
720 $bTFound = true;
721 }
722 $p = strpos($str, $aT[$i]);
723
724 if ($p > -1) {
725 if ($i == 1 && strpos($str, "T") > -1 && strpos($str, "T") < $p) {
726 continue;
727 }
728 if ($aT[$i] == "S") {
729 $aV[$i] = substr($str, 0, $p);
730 } else {
731 $aV[$i] = intval(substr($str, 0, $p));
732 }
733 if (!is_numeric($aV[$i])) {
734 $bErr = true;
735 break;
736 } elseif ($i > 2 && !$bTFound) {
737 $bErr = true;
738 break;
739 }
740 $str = substr($str, $p + 1);
741 }
742 }
743 if (!$bErr && strlen($str) != 0) {
744 $bErr = true;
745 }
746 }
747
748 if ($bErr) {
749 return;
750 }
751 return $aV[0] * 3155760000 + $aV[1] * 262980000 + $aV[2] * 8640000 + $aV[3] * 360000 + $aV[4] * 6000 + round($aV[5] * 100);
752 }
753
754 public function getCourseCompletionForUser($a_user)
755 {
758
759 $scos = array();
760 //get all SCO's of this object
761
762 $val_set = $ilDB->queryF(
763 '
764 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
765 WHERE cp_item.cp_node_id = cp_node.cp_node_id
766 AND cp_item.resourceid = cp_resource.id
767 AND scormtype = %s
768 AND nodename = %s
769 AND cp_node.slm_id = %s ',
770 array('text','text','integer'),
771 array('sco','item',$this->getId())
772 );
773
774 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
775 array_push($scos, $val_rec['cp_node_id']);
776 }
777
778
779 $scos_c = $scos;
780 //copy SCO_array
781 //check if all SCO's are completed
782 for ($i=0;$i<count($scos);$i++) {
783 $val_set = $ilDB->queryF(
784 '
785 SELECT * FROM cmi_node
786 WHERE (user_id= %s
787 AND cp_node_id= %s
788 AND (completion_status=%s OR success_status=%s))',
789 array('integer','integer','text', 'text'),
790 array($a_user,$scos[$i],'completed','passed')
791 );
792
793 if ($ilDB->numRows($val_set) > 0) {
794 //delete from array
795 $key = array_search($scos[$i], $scos_c);
796 unset($scos_c[$key]);
797 }
798 }
799 //check for completion
800 if (count($scos_c) == 0) {
801 $completion = true;
802 } else {
803 $completion = false;
804 }
805 return $completion;
806 }
807
814 public static function _getCourseCompletionForUser($a_id, $a_user)
815 {
816 global $DIC;
817
818 $ilDB = $DIC->database();
819 $ilUser = $DIC->user();
820 $scos = array();
821 //get all SCO's of the object
822
823 $val_set = $ilDB->queryF(
824 '
825 SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item
826 WHERE cp_item.cp_node_id = cp_node.cp_node_id
827 AND cp_item.resourceid = cp_resource.id
828 AND scormtype = %s
829 AND nodename = %s
830 AND cp_node.slm_id = %s',
831 array('text','text','integer'),
832 array('sco' ,'item',$a_id)
833 );
834 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
835 array_push($scos, $val_rec['cp_node_id']);
836 }
837
838 $scos_c = $scos;
839 //copy SCO_array
840 //check if all SCO's are completed
841 for ($i=0;$i<count($scos);$i++) {
842 $val_set = $ilDB->queryF(
843 '
844 SELECT * FROM cmi_node
845 WHERE (user_id= %s
846 AND cp_node_id= %s
847 AND (completion_status = %s OR success_status = %s))',
848 array('integer','integer','text','text'),
849 array($a_user,$scos[$i],'completed','passed')
850 );
851
852 if ($ilDB->numRows($val_set) > 0) {
853 //delete from array
854 $key = array_search($scos[$i], $scos_c);
855 unset($scos_c[$key]);
856 }
857 }
858 //check for completion
859 if (count($scos_c) == 0) {
860 $completion = true;
861 } else {
862 $completion = false;
863 }
864 return $completion;
865 }
866
874 public static function _getUniqueScaledScoreForUser($a_id, $a_user)
875 {
876 global $DIC;
877
878 $ilDB = $DIC->database();
879 $ilUser = $DIC->user();
880 $scos = array();
881
882 $val_set = $ilDB->queryF(
883 "SELECT cp_node.cp_node_id FROM cp_node,cp_resource,cp_item WHERE" .
884 " cp_item.cp_node_id=cp_node.cp_node_id AND cp_item.resourceId = cp_resource.id AND scormType='sco' AND nodeName='item' AND cp_node.slm_id = %s GROUP BY cp_node.cp_node_id",
885 array('integer'),
886 array($a_id)
887 );
888 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
889 array_push($scos, $val_rec['cp_node_id']);
890 }
891 $set = 0; //numbers of SCO that set cmi.score.scaled
892 $scaled = null;
893 for ($i=0;$i<count($scos);$i++) {
894 $val_set = $ilDB->queryF(
895 "SELECT scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
896 array('integer', 'integer'),
897 array($a_user, $scos[$i])
898 );
899 if ($val_set->numRows()>0) {
900 $val_rec = $ilDB->fetchAssoc($val_set);
901 if ($val_rec['scaled']!=null) {
902 $set++;
903 $scaled = $val_rec['scaled'];
904 }
905 }
906 }
907 $retVal = ($set == 1) ? $scaled : null ;
908 return $retVal;
909 }
910
916 public static function _getTrackingItems($a_obj_id)
917 {
918 global $DIC;
919
920 $ilDB = $DIC->database();
921
922
923 $item_set = $ilDB->queryF(
924 '
925 SELECT cp_item.* FROM cp_node, cp_item WHERE slm_id = %s
926 AND cp_node.cp_node_id = cp_item.cp_node_id
927 ORDER BY cp_node.cp_node_id ',
928 array('integer'),
929 array($a_obj_id)
930 );
931
932 $items = array();
933 while ($item_rec = $ilDB->fetchAssoc($item_set)) {
934 $s2 = $ilDB->queryF(
935 '
936 SELECT cp_resource.* FROM cp_node, cp_resource
937 WHERE slm_id = %s
938 AND cp_node.cp_node_id = cp_resource.cp_node_id
939 AND cp_resource.id = %s ',
940 array('integer','text'),
941 array($a_obj_id,$item_rec["resourceid"])
942 );
943
944
945 if ($res = $ilDB->fetchAssoc($s2)) {
946 if ($res["scormtype"] == "sco") {
947 $items[] = array("id" => $item_rec["cp_node_id"],
948 "title" => $item_rec["title"]);
949 }
950 }
951 }
952
953 return $items;
954 }
955
956 public static function _getStatus($a_obj_id, $a_user_id)
957 {
958 global $DIC;
959
960 $ilDB = $DIC->database();
961
962 $status_set = $ilDB->queryF(
963 '
964 SELECT * FROM cmi_gobjective
965 WHERE scope_id = %s
966 AND objective_id = %s
967 AND user_id = %s',
968 array('integer','text','integer'),
969 array($a_obj_id,'-course_overall_status-',$a_user_id)
970 );
971
972 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
973 return $status_rec["status"];
974 }
975
976 return false;
977 }
978
979 public static function _getSatisfied($a_obj_id, $a_user_id)
980 {
981 global $DIC;
982
983 $ilDB = $DIC->database();
984
985
986 $status_set = $ilDB->queryF(
987 '
988 SELECT * FROM cmi_gobjective
989 WHERE scope_id = %s
990 AND objective_id = %s
991 AND user_id = %s',
992 array('integer','text','integer'),
993 array($a_obj_id,'-course_overall_status-',$a_user_id)
994 );
995
996 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
997 return $status_rec["satisfied"];
998 }
999
1000 return false;
1001 }
1002
1003 public static function _getMeasure($a_obj_id, $a_user_id)
1004 {
1005 global $DIC;
1006
1007 $ilDB = $DIC->database();
1008
1009 $status_set = $ilDB->queryF(
1010 '
1011 SELECT * FROM cmi_gobjective
1012 WHERE scope_id = %s
1013 AND objective_id = %s
1014 AND user_id = %s',
1015 array('integer','text','integer'),
1016 array($a_obj_id,'-course_overall_status-',$a_user_id)
1017 );
1018
1019 if ($status_rec = $ilDB->fetchAssoc($status_set)) {
1020 return $status_rec["measure"];
1021 }
1022
1023 return false;
1024 }
1025
1026 public static function _lookupItemTitle($a_node_id)
1027 {
1028 global $DIC;
1029
1030 $ilDB = $DIC->database();
1031
1032 $r = $ilDB->queryF(
1033 '
1034 SELECT * FROM cp_item
1035 WHERE cp_node_id = %s',
1036 array('integer'),
1037 array($a_node_id)
1038 );
1039
1040 if ($i = $ilDB->fetchAssoc($r)) {
1041 return $i["title"];
1042 }
1043 return "";
1044 }
1045
1049 public function createScorm2004Tree()
1050 {
1051 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
1052 $this->slm_tree = new ilSCORM2004Tree($this->getId());
1053
1054 //$this->slm_tree = new ilTree($this->getId());
1055 //$this->slm_tree->setTreeTablePK("slm_id");
1056 //$this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1057 $this->slm_tree->addTree($this->getId(), 1);
1058
1059 //add seqinfo for rootNode
1060 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1061 $seq_info = new ilSCORM2004Sequencing($this->getId(), true);
1062 $seq_info->insert();
1063 }
1064
1065 public function getTree()
1066 {
1067 $this->slm_tree = new ilTree($this->getId());
1068 $this->slm_tree->setTreeTablePK("slm_id");
1069 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1070 return $this->slm_tree;
1071 }
1072
1073 public function getSequencingSettings()
1074 {
1075 $ilTabs = $this->tabs;
1076 $ilTabs->setTabActive("sequencing");
1077
1078 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1079 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1080
1081 return $control_settings;
1082 }
1083
1085 {
1086 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php");
1087
1088 $control_settings = new ilSCORM2004Sequencing($this->getId(), true);
1089 $control_settings->setChoice(ilUtil::yn2tf($_POST["choice"]));
1090 $control_settings->setFlow(ilUtil::yn2tf($_POST["flow"]));
1091 $control_settings->setForwardOnly(ilUtil::yn2tf($_POST["forwardonly"]));
1092 $control_settings->insert();
1093
1094 return true;
1095 }
1096
1105 public function executeDragDrop($source_id, $target_id, $first_child, $as_subitem = false, $movecopy = "move")
1106 {
1107 $this->slm_tree = new ilTree($this->getId());
1108 $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1109 $this->slm_tree->setTreeTablePK("slm_id");
1110
1111 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
1112
1113 $source_obj = ilSCORM2004NodeFactory::getInstance($this, $source_id, true);
1114 //$source_obj->setLMId($this->getId());
1115
1116 if (!$first_child) {
1117 $target_obj = ilSCORM2004NodeFactory::getInstance($this, $target_id, true);
1118 //$target_obj->setLMId($this->getId());
1119 $target_parent = $this->slm_tree->getParentId($target_id);
1120 }
1121 //echo "-".$source_obj->getType()."-";
1122 // handle pages
1123 if ($source_obj->getType() == "page") {
1124 if ($this->slm_tree->isInTree($source_obj->getId())) {
1125 $node_data = $this->slm_tree->getNodeData($source_obj->getId());
1126
1127 // cut on move
1128 if ($movecopy == "move") {
1129 $parent_id = $this->slm_tree->getParentId($source_obj->getId());
1130 $this->slm_tree->deleteTree($node_data);
1131
1132 // write history entry
1133/* require_once("./Services/History/classes/class.ilHistory.php");
1134 ilHistory::_createEntry($source_obj->getId(), "cut",
1135 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
1136 $this->getType().":pg");
1137 ilHistory::_createEntry($parent_id, "cut_page",
1138 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1139 $this->getType().":st");
1140*/
1141 }
1142 /* else // this is not implemented here
1143 {
1144 // copy page
1145 $new_page =& $source_obj->copy();
1146 $source_id = $new_page->getId();
1147 $source_obj =& $new_page;
1148 }
1149 */
1150
1151 // paste page
1152 if (!$this->slm_tree->isInTree($source_obj->getId())) {
1153 if ($first_child) { // as first child
1154 $target_pos = IL_FIRST_NODE;
1155 $parent = $target_id;
1156 } elseif ($as_subitem) { // as last child
1157 $parent = $target_id;
1158 $target_pos = IL_FIRST_NODE;
1159 $pg_childs = $this->slm_tree->getChildsByType($parent, "page");
1160 if (count($pg_childs) != 0) {
1161 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1162 }
1163 } else { // at position
1164 $target_pos = $target_id;
1165 $parent = $target_parent;
1166 }
1167
1168 // insert page into tree
1169 $this->slm_tree->insertNode(
1170 $source_obj->getId(),
1171 $parent,
1172 $target_pos
1173 );
1174
1175 // write history entry
1176/* if ($movecopy == "move")
1177 {
1178 // write history comments
1179 include_once("./Services/History/classes/class.ilHistory.php");
1180 ilHistory::_createEntry($source_obj->getId(), "paste",
1181 array(ilLMObject::_lookupTitle($parent), $parent),
1182 $this->getType().":pg");
1183 ilHistory::_createEntry($parent, "paste_page",
1184 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
1185 $this->getType().":st");
1186 }
1187*/
1188 }
1189 }
1190 }
1191
1192 // handle scos
1193 if ($source_obj->getType() == "sco" || $source_obj->getType() == "ass") {
1194 //echo "2";
1195 $source_node = $this->slm_tree->getNodeData($source_id);
1196 $subnodes = $this->slm_tree->getSubtree($source_node);
1197
1198 // check, if target is within subtree
1199 foreach ($subnodes as $subnode) {
1200 if ($subnode["obj_id"] == $target_id) {
1201 return;
1202 }
1203 }
1204
1205 $target_pos = $target_id;
1206
1207 if ($first_child) { // as first sco
1208 $target_pos = IL_FIRST_NODE;
1209 $target_parent = $target_id;
1210
1211 $pg_childs = $this->slm_tree->getChildsByType($target_parent, "page");
1212 if (count($pg_childs) != 0) {
1213 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
1214 }
1215 } elseif ($as_subitem) { // as last sco
1216 $target_parent = $target_id;
1217 $target_pos = IL_FIRST_NODE;
1218 $childs = $this->slm_tree->getChilds($target_parent);
1219 if (count($childs) != 0) {
1220 $target_pos = $childs[count($childs) - 1]["obj_id"];
1221 }
1222 }
1223
1224 // delete source tree
1225 if ($movecopy == "move") {
1226 $this->slm_tree->deleteTree($source_node);
1227 }
1228 /* else
1229 {
1230 // copy chapter (incl. subcontents)
1231 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1232 }
1233 */
1234
1235 if (!$this->slm_tree->isInTree($source_id)) {
1236 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1237
1238 // insert moved tree
1239 if ($movecopy == "move") {
1240 foreach ($subnodes as $node) {
1241 if ($node["obj_id"] != $source_id) {
1242 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1243 }
1244 }
1245 }
1246 }
1247
1248 // check the tree
1249// $this->checkTree();
1250 }
1251
1252 // handle chapters
1253 if ($source_obj->getType() == "chap") {
1254 //echo "2";
1255 $source_node = $this->slm_tree->getNodeData($source_id);
1256 $subnodes = $this->slm_tree->getSubtree($source_node);
1257
1258 // check, if target is within subtree
1259 foreach ($subnodes as $subnode) {
1260 if ($subnode["obj_id"] == $target_id) {
1261 return;
1262 }
1263 }
1264
1265 $target_pos = $target_id;
1266
1267 if ($first_child) { // as first chapter
1268 $target_pos = IL_FIRST_NODE;
1269 $target_parent = $target_id;
1270
1271 //$sco_childs = $this->slm_tree->getChildsByType($target_parent, "sco");
1272 //if (count($sco_childs) != 0)
1273 //{
1274 // $target_pos = $sco_childs[count($sco_childs) - 1]["obj_id"];
1275 //}
1276 } elseif ($as_subitem) { // as last chapter
1277 $target_parent = $target_id;
1278 $target_pos = IL_FIRST_NODE;
1279 $childs = $this->slm_tree->getChilds($target_parent);
1280 if (count($childs) != 0) {
1281 $target_pos = $childs[count($childs) - 1]["obj_id"];
1282 }
1283 }
1284
1285 // delete source tree
1286 if ($movecopy == "move") {
1287 $this->slm_tree->deleteTree($source_node);
1288 }
1289 /* else
1290 {
1291 // copy chapter (incl. subcontents)
1292 $new_chapter =& $source_obj->copy($this->slm_tree, $target_parent, $target_pos);
1293 }
1294 */
1295
1296 if (!$this->slm_tree->isInTree($source_id)) {
1297 $this->slm_tree->insertNode($source_id, $target_parent, $target_pos);
1298
1299 // insert moved tree
1300 if ($movecopy == "move") {
1301 foreach ($subnodes as $node) {
1302 if ($node["obj_id"] != $source_id) {
1303 $this->slm_tree->insertNode($node["obj_id"], $node["parent"]);
1304 }
1305 }
1306 }
1307 }
1308
1309 // check the tree
1310// $this->checkTree();
1311 }
1312
1313 // $this->checkTree();
1314 }
1315
1316 public function getExportFiles()
1317 {
1318 $file = array();
1319
1320 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
1321
1322 $export = new ilSCORM2004Export($this);
1323 foreach ($export->getSupportedExportTypes() as $type) {
1324 $dir = $export->getExportDirectoryForType($type);
1325 // quit if import dir not available
1326 if (!@is_dir($dir) or !is_writeable($dir)) {
1327 continue;
1328 }
1329 // open directory
1330 $cdir = dir($dir);
1331
1332 // get files and save the in the array
1333 while ($entry = $cdir->read()) {
1334 if ($entry != "." and
1335 $entry != ".." and
1336 (
1337 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.zip\$~", $entry) or
1338 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.pdf\$~", $entry) or
1339 preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)*[0-9]+\.iso\$~", $entry)
1340 )) {
1341 $file[$entry . $type] = array("type" => $type, "file" => $entry,
1342 "size" => filesize($dir . "/" . $entry));
1343 }
1344 }
1345
1346 // close import directory
1347 $cdir->close();
1348 }
1349
1350 // sort files
1351 ksort($file);
1352 reset($file);
1353 return $file;
1354 }
1355
1359 public function exportScorm($a_inst, $a_target_dir, $ver, &$expLog)
1360 {
1361 $a_xml_writer = new ilXmlWriter;
1362
1363 // export metadata
1364 $this->exportXMLMetaData($a_xml_writer);
1365 $metadata_xml = $a_xml_writer->xmlDumpMem(false);
1366 $a_xml_writer->_XmlWriter;
1367
1368 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
1369 $args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
1370 $xh = xslt_create();
1371 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
1372 xslt_free($xh);
1373 file_put_contents($a_target_dir . '/indexMD.xml', $output);
1374
1375 // export glossary
1376 if ($this->getAssignedGlossary()!=0) {
1377 ilUtil::makeDir($a_target_dir . "/glossary");
1378 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1379 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1380 $glo_xml_writer = new ilXmlWriter();
1381
1382 $glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1383 // set xml header
1384 $glo_xml_writer->xmlHeader();
1385 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1386 //$glos->exportHTML($a_target_dir."/glossary", $expLog);
1387 $glos_export = new ilGlossaryExport($glos, "xml");
1388 $glos->exportXML($glo_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
1389 $glo_xml_writer->xmlDumpFile($a_target_dir . "/glossary/glossary.xml");
1390 $glo_xml_writer->_XmlWriter;
1391 }
1392
1393 $a_xml_writer = new ilXmlWriter;
1394 // set dtd definition
1395 $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1396
1397 // set generated comment
1398 $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . ".");
1399
1400 // set xml header
1401 $a_xml_writer->xmlHeader();
1402
1403 $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
1404
1405 // MetaData
1406 $this->exportXMLMetaData($a_xml_writer);
1407
1408 $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
1409
1410 // SCO Objects
1411 $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Sco Objects");
1412 $this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog);
1413 $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Sco Objects");
1414
1415 $a_xml_writer->xmlEndTag("ContentObject");
1416 $a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false);
1417
1418 if ($ver == "2004 4th") {
1419 $revision ="4th";
1420 $ver = "2004";
1421 }
1422
1423 if ($ver == "2004 3rd") {
1424 $revision ="3rd";
1425 $ver = "2004";
1426 }
1427
1428 // add content css (note: this is also done per item)
1429 $css_dir = $a_target_dir . "/ilias_css_4_2";
1430 ilUtil::makeDir($css_dir);
1431 include_once("./Modules/Scorm2004/classes/class.ilScormExportUtil.php");
1432 ilScormExportUtil::exportContentCSS($this, $css_dir);
1433
1434 // add manifest
1435 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1436 $manifestBuilder = new ilContObjectManifestBuilder($this);
1437 $manifestBuilder->buildManifest($ver, $revision);
1438 $manifestBuilder->dump($a_target_dir);
1439
1440 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1441 $args = array( '/_xml' => file_get_contents($a_target_dir . "/imsmanifest.xml"), '/_xsl' => $xsl );
1442 $xh = xslt_create();
1443 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
1444 xslt_free($xh);
1445 fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
1446 // copy xsd files to target
1447 switch ($ver) {
1448 case "2004":
1449 if ($revision == "3rd") {
1450 ilUtil::rCopy('./libs/ilias/Scorm2004/xsd/adlcp_130_export_2004', $a_target_dir, false);
1451 }
1452
1453 if ($revision == "4th") {
1454 ilUtil::rCopy('./libs/ilias/Scorm2004/xsd/adlcp_130_export_2004_4th', $a_target_dir, false);
1455 }
1456 break;
1457 case "12":
1458 ilUtil::rCopy('./libs/ilias/Scorm2004/xsd/adlcp_120_export_12', $a_target_dir, false);
1459 break;
1460 }
1461
1462 $a_xml_writer->_XmlWriter;
1463 }
1464
1465
1466 public function exportHTML4PDF($a_inst, $a_target_dir, &$expLog)
1467 {
1468 $tree = new ilTree($this->getId());
1469 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1470 $tree->setTreeTablePK("slm_id");
1471 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1472 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1473 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1474 ilUtil::makeDir($sco_folder);
1475 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1476 $node->exportHTML4PDF($a_inst, $sco_folder, $expLog);
1477 }
1478 }
1479
1480 public function exportPDF($a_inst, $a_target_dir, &$expLog)
1481 {
1482 $a_xml_writer = new ilXmlWriter;
1483 $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
1484 $this->exportXMLMetaData($a_xml_writer);
1485 $tree = new ilTree($this->getId());
1486 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1487 $tree->setTreeTablePK("slm_id");
1488 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1489 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1490 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1491 ilUtil::makeDir($sco_folder);
1492 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1493 $node->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
1494 }
1495 if ($this->getAssignedGlossary()!=0) {
1496 ilUtil::makeDir($a_target_dir . "/glossary");
1497 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1498 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1499 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1500 $glos_export = new ilGlossaryExport($glos, "xml");
1501 $glos->exportXML($a_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
1502 }
1503 $a_xml_writer->xmlEndTag("ContentObject");
1504 include_once 'Services/Transformation/classes/class.ilXML2FO.php';
1505 $xml2FO = new ilXML2FO();
1506 $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
1507 $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
1508 $xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
1509 $xml2FO->transform();
1510 $fo_string = $xml2FO->getFOString();
1511 $fo_xml = simplexml_load_string($fo_string);
1512 $fo_ext = $fo_xml->xpath("//fo:declarations");
1513 $fo_ext = $fo_ext[0];
1514 $results = array();
1515 include_once "./Services/Utilities/classes/class.ilFileUtils.php";
1516 ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
1517 if (is_array($results["file"])) {
1518 foreach ($results["file"] as $key => $value) {
1519 $e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
1520 $e->addAttribute("src", $results[path][$key] . $value);
1521 $e->addAttribute("name", $value);
1522 $e->addAttribute("desc", "");
1523 }
1524 }
1525 $fo_string = $fo_xml->asXML();
1526 $a_xml_writer->_XmlWriter;
1527 return $fo_string;
1528 }
1529
1530 public function exportHTMLOne($a_inst, $a_target_dir, &$expLog)
1531 {
1532 $one_file = fopen($a_target_dir . '/index.html', 'w+');
1533 $this->exportHTML($a_inst, $a_target_dir, $expLog, $one_file);
1534 fclose($one_file);
1535 }
1536
1540 public function exportHTML($a_inst, $a_target_dir, &$expLog, $a_one_file = "")
1541 {
1542 // $a_xml_writer = new ilXmlWriter;
1543 // set dtd definition
1544 // $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
1545
1546 // set generated comment
1547 // $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
1548
1549 // set xml header
1550 // $a_xml_writer->xmlHeader();
1551
1552
1553 // $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004LearningModule"));
1554
1555 // $expLog->write(date("[y-m-d H:i:s] ")."Start Export Sco Objects");
1556 $this->exportHTMLScoObjects($a_inst, $a_target_dir, $expLog, $a_one_file);
1557 // $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Sco Objects");
1558
1559 // $a_xml_writer->xmlEndTag("ContentObject");
1560
1561
1562 /*$toc_tpl = new ilTemplate("tpl.main.html", true, true, false);
1563 $style_name = $ilUser->prefs["style"].".css";
1564 $tpl->setCurrentBlock("css_file");
1565 $tpl->setVariable("CSS_FILE", $style_name);
1566 $tpl->parseCurrentBlock();*/
1567
1568 if ($a_one_file == "") {
1569 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1570 $manifestBuilder = new ilContObjectManifestBuilder($this);
1571 $manifestBuilder->buildManifest('12');
1572
1573 include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
1574 $fs_gui = new ilFramesetGUI();
1575 $fs_gui->setFramesetTitle($this->getTitle());
1576 $fs_gui->setMainFrameSource("");
1577 $fs_gui->setSideFrameSource("toc.html");
1578 $fs_gui->setMainFrameName("content");
1579 $fs_gui->setSideFrameName("toc");
1580 $output = $fs_gui->get();
1581 fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
1582
1583 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1584 $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1585 $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1586 $xh = xslt_create();
1587 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
1588 xslt_free($xh);
1589 fputs(fopen($a_target_dir . '/toc.html', 'w+'), $output);
1590 }
1591 // $a_xml_writer->_XmlWriter;
1592 }
1593
1600 public function exportXMLMetaData(&$a_xml_writer)
1601 {
1602 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1603 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1604 $md2xml->setExportMode(true);
1605 $md2xml->startExport();
1606 $a_xml_writer->appendXML($md2xml->getXML());
1607 }
1608
1615 public function exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog)
1616 {
1617 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1618 $tree = new ilTree($this->getId());
1619 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1620 $tree->setTreeTablePK("slm_id");
1621 $a_xml_writer->xmlStartTag("StructureObject");
1622 foreach ($tree->getFilteredSubTree($tree->getRootId(), array('page')) as $obj) {
1623 if ($obj['type']=='') {
1624 continue;
1625 }
1626
1627 //$md2xml = new ilMD2XML($obj['obj_id'], 0, $obj['type']);
1628 $md2xml = new ilMD2XML($this->getId(), $obj['obj_id'], $obj['type']);
1629 $md2xml->setExportMode(true);
1630 $md2xml->startExport();
1631 $a_xml_writer->appendXML($md2xml->getXML());
1632 }
1633 $a_xml_writer->xmlEndTag("StructureObject");
1634 }
1635
1636
1643 public function exportXMLScoObjects($a_inst, $a_target_dir, $ver, &$expLog)
1644 {
1645 $tree = new ilTree($this->getId());
1646 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1647 $tree->setTreeTablePK("slm_id");
1648 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, array('sco','ass')) as $sco) {
1649 if ($sco['type'] == "sco") {
1650 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1651 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1652 ilUtil::makeDir($sco_folder);
1653 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1654 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1655 }
1656 if ($sco['type'] == "ass") {
1657 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1658 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1659 ilUtil::makeDir($sco_folder);
1660 $node = new ilSCORM2004Asset($this, $sco['obj_id']);
1661 $node->exportScorm($a_inst, $sco_folder, $ver, $expLog);
1662 }
1663 }
1664 }
1665
1666 /* export page objects to xml (see ilias_co.dtd)
1667 *
1668 * @param object $a_xml_writer ilXmlWriter object that receives the
1669 * xml data
1670 */
1671 public function exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file = "")
1672 {
1673 $tree = new ilTree($this->getId());
1674 $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1675 $tree->setTreeTablePK("slm_id");
1676
1677 // copy all necessary files now
1678 if ($a_one_file != "") {
1679 $this->prepareHTMLExporter($a_target_dir);
1680
1681 // put header into file
1682 $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
1683 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1684 $page_html_export = new ilCOPageHTMLExport($a_target_dir);
1685 $sco_tpl = $page_html_export->getPreparedMainTemplate($sco_tpl);
1686
1687 $sco_tpl->setCurrentBlock("js_file");
1688 $sco_tpl->setVariable("JS_FILE", "./js/pure.js");
1689 $sco_tpl->parseCurrentBlock();
1690 $sco_tpl->setCurrentBlock("js_file");
1691 $sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
1692 $sco_tpl->parseCurrentBlock();
1693
1694
1695 $sco_tpl->setCurrentBlock("head");
1696 $sco_tpl->parseCurrentBlock();
1697 fputs($a_one_file, $sco_tpl->get("head"));
1698
1699 // toc
1700 include_once("./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php");
1701 $manifestBuilder = new ilContObjectManifestBuilder($this);
1702 $manifestBuilder->buildManifest('12');
1703 $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
1704 $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
1705 $args = array( '/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl );
1706 $xh = xslt_create();
1707 $params = array("one_page" => "y");
1708 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1709 xslt_free($xh);
1710 fputs($a_one_file, $output);
1711 }
1712
1713 foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
1714 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1715 $sco_folder = $a_target_dir . "/" . $sco['obj_id'];
1716 ilUtil::makeDir($sco_folder);
1717 $node = new ilSCORM2004Sco($this, $sco['obj_id']);
1718
1719 if ($a_one_file == "") {
1720 $node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
1721 } else {
1722 $node->exportHTMLPageObjects(
1723 $a_inst,
1724 $a_target_dir,
1725 $expLog,
1726 'full',
1727 "sco",
1728 $a_one_file,
1729 $sco_tpl
1730 );
1731 }
1732 if ($this->getAssignedGlossary()!=0) {
1733 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
1734 $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
1735 //$glos->exportHTML($sco_folder."/glossary", $expLog);
1736 }
1737 }
1738
1739 // copy all necessary files now
1740 if ($a_one_file != "") {
1741 // put tail into file
1742 fputs($a_one_file, $sco_tpl->get("tail"));
1743 }
1744 }
1745
1752 public function prepareHTMLExporter($a_target_dir)
1753 {
1754 // system style html exporter
1755 include_once("./Services/Style/System/classes/class.ilSystemStyleHTMLExport.php");
1756 $this->sys_style_html_export = new ilSystemStyleHTMLExport($a_target_dir);
1757 $this->sys_style_html_export->export();
1758
1759 // init co page html exporter
1760 include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
1761 $this->co_page_html_export = new ilCOPageHTMLExport($a_target_dir);
1762 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1763 $this->co_page_html_export->setContentStyleId(
1765 );
1766 $this->co_page_html_export->createDirectories();
1767 $this->co_page_html_export->exportStyles();
1768 $this->co_page_html_export->exportSupportScripts();
1769
1770 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1771 $this->flv_dir = $a_target_dir . "/" . ilPlayerUtil::getFlashVideoPlayerDirectory();
1772
1773 ilUtil::makeDir($a_target_dir . '/css/yahoo');
1774 ilUtil::makeDir($a_target_dir . '/objects');
1775 ilUtil::makeDir($a_target_dir . '/players');
1776 ilUtil::makeDir($this->flv_dir);
1777
1778 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1779 // copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
1780 // $a_target_dir.'/js/'.ilPlayerUtil::getFlashVideoPlayerFilename());
1782
1783 copy('./Modules/Scorm2004/scripts/scorm_2004.js', $a_target_dir . '/js/scorm.js');
1784 copy('./Modules/Scorm2004/scripts/pager.js', $a_target_dir . '/js/pager.js');
1785 copy('./Modules/Scorm2004/scripts/questions/pure.js', $a_target_dir . '/js/pure.js');
1786 copy(
1787 './Modules/Scorm2004/scripts/questions/question_handling.js',
1788 $a_target_dir . '/js/question_handling.js'
1789 );
1790 }
1791
1800 {
1801 return $this->public_export_file[$a_type];
1802 }
1803
1808 public function exportFileItems($a_target_dir, &$expLog)
1809 {
1810 include_once("./Modules/File/classes/class.ilObjFile.php");
1811
1812 foreach ($this->file_ids as $file_id) {
1813 $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
1814 $file_obj = new ilObjFile($file_id, false);
1815 $file_obj->export($a_target_dir);
1816 unset($file_obj);
1817 }
1818 }
1819
1823 public function setPublicExportFile($a_type, $a_file)
1824 {
1825 $this->public_export_file[$a_type] = $a_file;
1826 }
1827
1838 public static function _getMaxScoreForUser($a_id, $a_user)
1839 {
1840 global $DIC;
1841
1842 $ilDB = $DIC->database();
1843
1844 $scos = array();
1845
1846 $result = $ilDB->query(
1847 'SELECT cp_node.cp_node_id '
1848 . 'FROM cp_node, cp_resource, cp_item '
1849 . 'WHERE cp_item.cp_node_id = cp_node.cp_node_id '
1850 . 'AND cp_item.resourceId = cp_resource.id '
1851 . 'AND scormType = ' . $ilDB->quote('sco', 'text') . ' '
1852 . 'AND nodeName = ' . $ilDB->quote('item', 'text') . ' '
1853 . 'AND cp_node.slm_id = ' . $ilDB->quote($a_id, 'integer') . ' '
1854 . 'GROUP BY cp_node.cp_node_id'
1855 );
1856
1857 while ($row = $ilDB->fetchAssoc($result)) {
1858 array_push($scos, $row['cp_node_id']);
1859 }
1860
1861 $set = 0; //numbers of SCO that set cmi.score.scaled
1862 $max = null;
1863 for ($i = 0; $i < count($scos); $i++) {
1864 $res = $ilDB->queryF(
1865 'SELECT c_max FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)',
1866 array('integer', 'integer'),
1867 array($a_user, $scos[$i])
1868 );
1869
1870 if ($ilDB->numRows($res) > 0) {
1871 $row = $ilDB->fetchAssoc($res);
1872 if ($row['c_max'] != null) {
1873 $set++;
1874 $max = $row['c_max'];
1875 }
1876 }
1877 }
1878 $retVal = ($set == 1) ? $max : null;
1879
1880 return $retVal;
1881 }
1882
1883 public static function _getScores2004ForUser($a_cp_node_id, $a_user)
1884 {
1885 global $DIC;
1886
1887 $ilDB = $DIC->database();
1888 $retAr = array("raw" => null, "max" => null, "scaled" => null);
1889 $val_set = $ilDB->queryF(
1890 "SELECT c_raw, c_max, scaled FROM cmi_node WHERE (user_id = %s AND cp_node_id = %s)",
1891 array('integer', 'integer'),
1892 array($a_user, $a_cp_node_id)
1893 );
1894 if ($val_set->numRows()>0) {
1895 $val_rec = $ilDB->fetchAssoc($val_set);
1896 $retAr["raw"] = $val_rec['c_raw'];
1897 $retAr["max"] = $val_rec['c_max'];
1898 $retAr["scaled"] = $val_rec['scaled'];
1899 if ($val_rec['scaled']==null && $val_rec['c_raw']!=null && $val_rec['c_max']!=null) {
1900 $retAr["scaled"] = ($val_rec['c_raw'] / $val_rec['c_max']);
1901 }
1902 }
1903 return $retAr;
1904 }
1905
1912 public function copyAuthoredContent($a_new_obj)
1913 {
1914 // set/copy stylesheet
1915 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1916 $style_id = $this->getStyleSheetId();
1917 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
1918 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
1919 $new_id = $style_obj->ilClone();
1920 $a_new_obj->setStyleSheetId($new_id);
1921 $a_new_obj->update();
1922 }
1923
1924 $a_new_obj->createScorm2004Tree();
1925 $source_tree = $this->getTree();
1926 $target_tree_root_id = $a_new_obj->getTree()->readRootId();
1927 $childs = $source_tree->getChilds($source_tree->readRootId());
1928 $a_copied_nodes = array();
1929 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1930 foreach ($childs as $c) {
1932 $a_new_obj,
1933 $c["child"],
1934 $target_tree_root_id,
1936 "",
1937 $a_copied_nodes,
1938 true,
1939 false
1940 );
1941 }
1942 }
1943}
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$result
user()
Definition: user.php:4
$n
Definition: RandomTest.php:85
$users
Definition: authpage.php:44
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
error($a_errmsg)
set error message @access public
const IL_LAST_NODE
Definition: class.ilTree.php:4
const IL_FIRST_NODE
Definition: class.ilTree.php:5
HTML export class for pages.
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
Scorm 2004 Content Object Manifest export class.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
Class ilFramesetGUI.
Export class for content objects.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_FAILED
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
Class ilObjFile.
Class ilObjGlossary.
getAssignedGlossary()
get assigned glossary
getStyleSheetId()
get ID of assigned style sheet object
getDataDirectory($mode="filesystem")
get data directory of lm
Class ilObjSCORM2004LearningModule.
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog)
export structure objects to xml (see ilias_co.dtd)
deleteTrackingDataOfUsers($a_users)
get all tracked items of current user
validate($directory)
Validate all XML-Files in a SCOM-Directory.
setImportSequencing($a_val)
Set import sequencing.
exportXMLScoObjects($a_inst, $a_target_dir, $ver, &$expLog)
export page objects to xml (see ilias_co.dtd)
static _ISODurationToCentisec($str)
convert ISO 8601 Timeperiods to centiseconds ta
exportPDF($a_inst, $a_target_dir, &$expLog)
exportHTML($a_inst, $a_target_dir, &$expLog, $a_one_file="")
Export SCORM package to HTML.
static _getTrackingItems($a_obj_id)
get all tracking items of scorm object
copyAuthoredContent($a_new_obj)
Copy authored content (everything done with the editor.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
executeDragDrop($source_id, $target_id, $first_child, $as_subitem=false, $movecopy="move")
Execute Drag Drop Action.
static _getMaxScoreForUser($a_id, $a_user)
Returns score.max for the learning module, refered to the last sco where score.max is set.
exportHTML4PDF($a_inst, $a_target_dir, &$expLog)
exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file="")
getAttemptsForUser($a_user_id)
get number of atttempts for a certain user and package
static _getUniqueScaledScoreForUser($a_id, $a_user)
Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score....
exportHTMLOne($a_inst, $a_target_dir, &$expLog)
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
getTrackedItems()
get all tracked items of current user
readObject()
read manifest file @access public
getPublicExportFile($a_type)
get public export file
createScorm2004Tree()
Create Scorm 2004 Tree used by Editor.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
getModuleVersionForUser($a_user_id)
get module version that tracking data for a user was recorded on
static _getScores2004ForUser($a_cp_node_id, $a_user)
prepareHTMLExporter($a_target_dir)
Prepare HTML exporter.
exportScorm($a_inst, $a_target_dir, $ver, &$expLog)
Export (authoring) scorm package.
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
Class ilObjSCORMLearningModule.
importSuccessForSahsUser($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
static _lookupStandard($a_id)
Lookup standard flag.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance($a_obj_id)
getType()
get object type @access public
getId()
get object id @access public
getTitle()
get object title @access public
static getFlashVideoPlayerDirectory()
Get flash video player directory.
static copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
Class ilSCORM2004Asset.
static removeCMIDataForUserAndPackage($user_id, $packageId)
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static pasteTree( $a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_from_clipboard=true, $a_source_parent_type="")
Paste item (tree) from clipboard or other learning module to target scorm learning module.
Class ilSCORM2004Sco.
Class ilSCORM2004Sequencing.
SCORM 2004 Editing tree.
static exportContentCSS($a_slm_object, $a_target_dir)
Export lm content css to a directory.
HTML export class for system styles.
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static now()
Return current timestamp in Y-m-d H:i:s format.
static yn2tf($a_yn)
convert "y"/"n" to true/false
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
XML writer class.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
$r
Definition: example_031.php:79
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$target_id
Definition: goto.php:49
xslt_free(&$proc)
xslt_create()
$time
Definition: cron.php:21
$xml
Definition: metadata.php:240
if($source===NULL) $organizations
$ret
Definition: parser.php:6
global $ilErr
Definition: raiseError.php:16
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
$results
Definition: svg-scanner.php:47
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$params
Definition: disable.php:11