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