ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjContentObject.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObject.php";
5require_once "Services/MetaData/classes/class.ilMDLanguageItem.php";
6require_once("./Services/Xml/classes/class.ilNestedSetXML.php");
7
22{
29 protected $rating;
30 protected $rating_pages;
31 var $auto_glossaries = array();
32
33 private $import_dir = '';
34
41 function ilObjContentObject($a_id = 0,$a_call_by_reference = true)
42 {
43 // this also calls read() method! (if $a_id is set)
44 $this->ilObject($a_id,$a_call_by_reference);
45
46 $this->mob_ids = array();
47 $this->file_ids = array();
48 $this->q_ids = array();
49 }
50
54 function create($a_no_meta_data = false)
55 {
56 global $ilUser;
57
58 parent::create();
59
60 // meta data will be created by
61 // import parser
62 if (!$a_no_meta_data)
63 {
64 $this->createMetaData();
65 }
66
67 $this->createProperties();
68 $this->updateAutoGlossaries();
69 }
70
71
72
76 function read()
77 {
78 global $ilDB;
79
80 parent::read();
81# echo "Content<br>\n";
82
83 $this->lm_tree = new ilTree($this->getId());
84 $this->lm_tree->setTableNames('lm_tree','lm_data');
85 $this->lm_tree->setTreeTablePK("lm_id");
86
87 $this->readProperties();
88
89 // read auto glossaries
90 $set = $ilDB->query("SELECT * FROM lm_glossaries ".
91 " WHERE lm_id = ".$ilDB->quote($this->getId(), "integer")
92 );
93 $glos = array();
94 while ($rec = $ilDB->fetchAssoc($set))
95 {
96 $glos[] = $rec["glo_id"];
97 }
98 $this->setAutoGlossaries($glos);
99
100 //parent::read();
101 }
102
108 function getTitle()
109 {
110 return parent::getTitle();
111 }
112
116 function setTitle($a_title)
117 {
118 parent::setTitle($a_title);
119// $this->meta_data->setTitle($a_title);
120 }
121
127 function getDescription()
128 {
129 return parent::getDescription();
130 }
131
135 function setDescription($a_description)
136 {
137 parent::setDescription($a_description);
138// $this->meta_data->setDescription($a_description);
139 }
140
141
142 function getImportId()
143 {
144 return $this->import_id;
145 }
146
147 function setImportId($a_id)
148 {
149 $this->import_id = $a_id;
150 }
151
157 function setLayoutPerPage($a_val)
158 {
159 $this->layout_per_page = $a_val;
160 }
161
168 {
169 return $this->layout_per_page;
170 }
171
178 {
179 $this->disable_def_feedback = $a_val;
180 }
181
188 {
189 return $this->disable_def_feedback;
190 }
191
197 function setProgressIcons($a_val)
198 {
199 $this->progr_icons = $a_val;
200 }
201
208 {
209 return $this->progr_icons;
210 }
211
217 function setStoreTries($a_val)
218 {
219 $this->store_tries = $a_val;
220 }
221
227 function getStoreTries()
228 {
229 return $this->store_tries;
230 }
231
238 {
239 $this->restrict_forw_nav = $a_val;
240 }
241
248 {
249 return $this->restrict_forw_nav;
250 }
251
252
253 function &getTree()
254 {
255 return $this->lm_tree;
256 }
257
261 function update()
262 {
263 $this->updateMetaData();
264 parent::update();
265 $this->updateProperties();
266 $this->updateAutoGlossaries();
267 }
268
276 {
277 global $ilDB;
278
279 // update auto glossaries
280 $ilDB->manipulate("DELETE FROM lm_glossaries WHERE ".
281 " lm_id = ".$ilDB->quote($this->getId(), "integer")
282 );
283 foreach ($this->getAutoGlossaries() as $glo_id)
284 {
285 $ilDB->manipulate("INSERT INTO lm_glossaries ".
286 "(lm_id, glo_id) VALUES (".
287 $ilDB->quote($this->getId(), "integer").",".
288 $ilDB->quote($glo_id, "integer").
289 ")");
290 }
291 }
292
293
297 function import()
298 {
299 // nothing to do. just display the dialogue in Out
300 return;
301 }
302
303
308 function putInTree($a_parent)
309 {
310 global $tree;
311
312 // put this object in tree under $a_parent
313 parent::putInTree($a_parent);
314
315 // make new tree for this object
316 //$tree->addTree($this->getId());
317 }
318
319
325 function createLMTree()
326 {
327 $this->lm_tree =& new ilTree($this->getId());
328 $this->lm_tree->setTreeTablePK("lm_id");
329 $this->lm_tree->setTableNames('lm_tree','lm_data');
330 $this->lm_tree->addTree($this->getId(), 1);
331 }
332
338 function setAutoGlossaries($a_val)
339 {
340 $this->auto_glossaries = array();
341 if (is_array($a_val))
342 {
343 foreach ($a_val as $v)
344 {
345 $v = (int) $v;
346 if ($v > 0 && ilObject::_lookupType($v) == "glo" &&
347 !in_array($v, $this->auto_glossaries))
348 {
349 $this->auto_glossaries[] = $v;
350 }
351 }
352 }
353 }
354
361 {
363 }
364
371 function removeAutoGlossary($a_glo_id)
372 {
373 $glo_ids = array();
374 foreach($this->getAutoGlossaries() as $g)
375 {
376 if ($g != $a_glo_id)
377 {
378 $glo_ids[] = $g;
379 }
380 }
381 $this->setAutoGlossaries($glo_ids);
382 }
383
384
389 {
390 global $lng;
391
392 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
393 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
394 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
395
396 $root_id = $this->lm_tree->getRootId();
397
398 // chapter
399 $chap = new ilStructureObject($this);
400 $chap->setType("st");
401 $chap->setTitle($lng->txt("cont_new_chap"));
402 $chap->setLMId($this->getId());
403 $chap->create();
404 ilLMObject::putInTree($chap, $root_id, IL_FIRST_NODE);
405
406 // page
407 $page = new ilLMPageObject($this);
408 $page->setType("pg");
409 $page->setTitle($lng->txt("cont_new_page"));
410 $page->setLMId($this->getId());
411 $page->create();
412 ilLMObject::putInTree($page, $chap->getId(), IL_FIRST_NODE);
413 }
414
415
419 function &getLMTree()
420 {
421 return $this->lm_tree;
422 }
423
424
431 {
432 $lm_data_dir = ilUtil::getDataDir()."/lm_data";
433 if(!is_writable($lm_data_dir))
434 {
435 $this->ilias->raiseError("Content object Data Directory (".$lm_data_dir
436 .") not writeable.",$this->ilias->error_obj->FATAL);
437 }
438
439 // create learning module directory (data_dir/lm_data/lm_<id>)
440 $lm_dir = $lm_data_dir."/lm_".$this->getId();
441 ilUtil::makeDir($lm_dir);
442 if(!@is_dir($lm_dir))
443 {
444 $this->ilias->raiseError("Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
445 }
446
447 // create import subdirectory (data_dir/lm_data/lm_<id>/import)
448 $import_dir = $lm_dir."/import";
450 if(!@is_dir($import_dir))
451 {
452 $this->ilias->raiseError("Creation of Import Directory failed.",$this->ilias->error_obj->FATAL);
453 }
454 }
455
460 {
461 return ilUtil::getDataDir()."/lm_data".
462 "/lm_".$this->getId();
463 }
464
469 {
470 if(strlen($this->import_dir))
471 {
472 return $this->import_dir;
473 }
474
475 $import_dir = ilUtil::getDataDir()."/lm_data".
476 "/lm_".$this->getId()."/import";
477 if(@is_dir($import_dir))
478 {
479 return $import_dir;
480 }
481 else
482 {
483 return false;
484 }
485 }
486
493 public function setImportDirectory($a_import_dir)
494 {
495 $this->import_dir = $a_import_dir;
496 }
497
498
504 function createExportDirectory($a_type = "xml")
505 {
506 $lm_data_dir = ilUtil::getDataDir()."/lm_data";
507 if(!is_writable($lm_data_dir))
508 {
509 $this->ilias->raiseError("Content object Data Directory (".$lm_data_dir
510 .") not writeable.",$this->ilias->error_obj->FATAL);
511 }
512 // create learning module directory (data_dir/lm_data/lm_<id>)
513 $lm_dir = $lm_data_dir."/lm_".$this->getId();
514 ilUtil::makeDir($lm_dir);
515 if(!@is_dir($lm_dir))
516 {
517 $this->ilias->raiseError("Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
518 }
519 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
520 switch ($a_type)
521 {
522 // scorm
523 case "scorm":
524 $export_dir = $lm_dir."/export_scorm";
525 break;
526
527 default: // = xml
528 if (substr($a_type, 0, 4) == "html")
529 {
530 $export_dir = $lm_dir."/export_".$a_type;
531 }
532 else
533 {
534 $export_dir = $lm_dir."/export";
535 }
536 break;
537 }
538 ilUtil::makeDir($export_dir);
539
540 if(!@is_dir($export_dir))
541 {
542 $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
543 }
544 }
545
549 function getExportDirectory($a_type = "xml")
550 {
551 switch ($a_type)
552 {
553 case "scorm":
554 $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export_scorm";
555 break;
556
557 default: // = xml
558 if (substr($a_type, 0, 4) == "html")
559 {
560 $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export_".$a_type;
561 }
562 else
563 {
564 $export_dir = ilUtil::getDataDir()."/lm_data"."/lm_".$this->getId()."/export";
565 }
566 break;
567 }
568 return $export_dir;
569 }
570
571
582 function delete()
583 {
584 global $ilDB;
585
586 global $ilBench;
587
588 // always call parent delete function first!!
589 if (!parent::delete())
590 {
591 return false;
592 }
593
594 // delete lm object data
595 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
597
598 // delete meta data of content object
599 $this->deleteMetaData();
600
601 // delete bibitem data
602 $nested = new ilNestedSetXML();
603 $nested->init($this->getId(), "bib");
604 $nested->deleteAllDBData();
605
606
607 // delete learning module tree
608 $this->lm_tree->removeTree($this->lm_tree->getTreeId());
609
610 // delete data directory
612
613 // delete content object record
614 $q = "DELETE FROM content_object WHERE id = ".
615 $ilDB->quote($this->getId(), "integer");
616 $ilDB->manipulate($q);
617
618 // delete lm menu entries
619 $q = "DELETE FROM lm_menu WHERE lm_id = ".
620 $ilDB->quote($this->getId(), "integer");
621 $ilDB->manipulate($q);
622
623 // remove auto glossary entries
624 $ilDB->manipulate("DELETE FROM lm_glossaries WHERE ".
625 " lm_id = ".$ilDB->quote($this->getId(), "integer")
626 );
627
628
629 return true;
630 }
631
632
638 function getLayout()
639 {
640 return $this->layout;
641 }
642
648 function setLayout($a_layout)
649 {
650 $this->layout = $a_layout;
651 }
652
657 {
658 return $this->style_id;
659 }
660
664 function setStyleSheetId($a_style_id)
665 {
666 $this->style_id = $a_style_id;
667 }
668
672 function writeStyleSheetId($a_style_id)
673 {
674 global $ilDB;
675
676 $q = "UPDATE content_object SET ".
677 " stylesheet = ".$ilDB->quote((int) $a_style_id, "integer").
678 " WHERE id = ".$ilDB->quote($this->getId(), "integer");
679 $ilDB->manipulate($q);
680
681 $this->style_id = $a_style_id;
682 }
683
687 function _moveLMStyles($a_from_style, $a_to_style)
688 {
689 global $ilDB, $ilias;
690
691 if ($a_from_style < 0) // change / delete all individual styles
692 {
693 $q = "SELECT stylesheet FROM content_object, style_data ".
694 " WHERE content_object.stylesheet = style_data.id ".
695 " AND style_data.standard = ".$ilDB->quote(0, "integer").
696 " AND content_object.stylesheet > ".$ilDB->quote(0, "integer");
697 $style_set = $ilDB->query($q);
698 while($style_rec = $ilDB->fetchAssoc($style_set))
699 {
700 // assign learning modules to new style
701 $q = "UPDATE content_object SET ".
702 " stylesheet = ".$ilDB->quote((int) $a_to_style, "integer").
703 " WHERE stylesheet = ".$ilDB->quote($style_rec["stylesheet"], "integer");
704 $ilDB->manipulate($q);
705
706 // delete style
707 $style_obj =& $ilias->obj_factory->getInstanceByObjId($style_rec["stylesheet"]);
708 $style_obj->delete();
709 }
710 }
711 else
712 {
713 $q = "UPDATE content_object SET ".
714 " stylesheet = ".$ilDB->quote((int) $a_to_style, "integer").
715 " WHERE stylesheet = ".$ilDB->quote($a_from_style, "integer");
716 $ilDB->manipulate($q);
717 }
718 }
719
727 static protected function _lookup($a_obj_id, $a_field)
728 {
729 global $ilDB, $ilLog;
730
731 $q = "SELECT ".$a_field." FROM content_object ".
732 " WHERE id = ".$ilDB->quote($a_obj_id, "integer");
733
734 $res = $ilDB->query($q);
735 $rec = $ilDB->fetchAssoc($res);
736
737 return $rec[$a_field];
738 }
739
746 static function _lookupRestrictForwardNavigation($a_obj_id)
747 {
748 return self::_lookup($a_obj_id, "restrict_forw_nav");
749 }
750
754 function _lookupStyleSheetId($a_cont_obj_id)
755 {
756 global $ilDB;
757
758 $q = "SELECT stylesheet FROM content_object ".
759 " WHERE id = ".$ilDB->quote($a_cont_obj_id, "integer");
760 $res = $ilDB->query($q);
761 $sheet = $ilDB->fetchAssoc($res);
762
763 return $sheet["stylesheet"];
764 }
765
769 function _lookupContObjIdByStyleId($a_style_id)
770 {
771 global $ilDB;
772
773 $q = "SELECT id FROM content_object ".
774 " WHERE stylesheet = ".$ilDB->quote($a_style_id, "integer");
775 $res = $ilDB->query($q);
776 $obj_ids = array();
777 while($cont = $ilDB->fetchAssoc($res))
778 {
779 $obj_ids[] = $cont["id"];
780 }
781 return $obj_ids;
782 }
783
787 static function _lookupDisableDefaultFeedback($a_id)
788 {
789 global $ilDB;
790
791 $q = "SELECT disable_def_feedback FROM content_object ".
792 " WHERE id = ".$ilDB->quote($a_id, "integer");
793 $res = $ilDB->query($q);
794 $rec = $ilDB->fetchAssoc($res);
795
796 return $rec["disable_def_feedback"];
797 }
798
802 static function _lookupStoreTries($a_id)
803 {
804 global $ilDB;
805
806 $q = "SELECT store_tries FROM content_object ".
807 " WHERE id = ".$ilDB->quote($a_id, "integer");
808 $res = $ilDB->query($q);
809 $rec = $ilDB->fetchAssoc($res);
810
811 return $rec["store_tries"];
812 }
813
814
820 function _getNrOfAssignedLMs($a_style_id)
821 {
822 global $ilDB;
823
824 $q = "SELECT count(*) as cnt FROM content_object ".
825 " WHERE stylesheet = ".$ilDB->quote($a_style_id, "integer");
826 $cset = $ilDB->query($q);
827 $crow = $ilDB->fetchAssoc($cset);
828
829 return (int) $crow["cnt"];
830 }
831
832
837 {
838 global $ilDB;
839
840 // joining with style table (not perfectly nice)
841 $q = "SELECT count(*) as cnt FROM content_object, style_data ".
842 " WHERE stylesheet = style_data.id ".
843 " AND standard = ".$ilDB->quote(0, "integer");
844 $cset = $ilDB->query($q);
845 $crow = $ilDB->fetchAssoc($cset);
846
847 return (int) $crow["cnt"];
848 }
849
854 {
855 global $ilDB;
856
857 $q = "SELECT count(*) as cnt FROM content_object ".
858 " WHERE stylesheet = ".$ilDB->quote(0, "integer");
859 $cset = $ilDB->query($q);
860 $crow = $ilDB->fetchAssoc($cset);
861
862 return (int) $crow["cnt"];
863 }
864
870 function _deleteStyleAssignments($a_style_id)
871 {
872 global $ilDB;
873
874 $q = "UPDATE content_object SET ".
875 " stylesheet = ".$ilDB->quote(0, "integer").
876 " WHERE stylesheet = ".$ilDB->quote((int) $this->getId($a_style_id), "integer");
877
878 $ilDB->manipulate($q);
879 }
880
884 function getPageHeader()
885 {
886 return $this->pg_header;
887 }
888
894 function setPageHeader($a_pg_header = IL_CHAPTER_TITLE)
895 {
896 $this->pg_header = $a_pg_header;
897 }
898
902 function getTOCMode()
903 {
904 return $this->toc_mode;
905 }
906
911 {
912 return $this->public_access_mode;
913 }
914
920 function setTOCMode($a_toc_mode = "chapters")
921 {
922 $this->toc_mode = $a_toc_mode;
923 }
924
925 function setOnline($a_online)
926 {
927 $this->online = $a_online;
928 }
929
930 function getOnline()
931 {
932 return $this->online;
933 }
934
935 function setActiveLMMenu($a_act_lm_menu)
936 {
937 $this->lm_menu_active = $a_act_lm_menu;
938 }
939
940 function isActiveLMMenu()
941 {
942 return $this->lm_menu_active;
943 }
944
945 function setActiveTOC($a_toc)
946 {
947 $this->toc_active = $a_toc;
948 }
949
950 function isActiveTOC()
951 {
952 return $this->toc_active;
953 }
954
955 function setActiveNumbering($a_num)
956 {
957 $this->numbering = $a_num;
958 }
959
961 {
962 return $this->numbering;
963 }
964
965 function setActivePrintView($a_print)
966 {
967 $this->print_view_active = $a_print;
968 }
969
971 {
972 return $this->print_view_active;
973 }
974
976 {
977 $this->prevent_glossary_appendix_active = $a_print;
978 }
979
981 {
982 return $this->prevent_glossary_appendix_active;
983 }
984
991 {
992 $this->hide_header_footer_print = $a_val;
993 }
994
1001 {
1002 return $this->hide_header_footer_print;
1003 }
1004
1005 function setActiveDownloads($a_down)
1006 {
1007 $this->downloads_active = $a_down;
1008 }
1009
1011 {
1012 return $this->downloads_active;
1013 }
1014
1016 {
1017 $this->downloads_public_active = $a_down;
1018 }
1019
1021 {
1022 return $this->downloads_public_active;
1023 }
1024
1025 function setPublicNotes($a_pub_notes)
1026 {
1027 $this->pub_notes = $a_pub_notes;
1028 }
1029
1030 function publicNotes()
1031 {
1032 return $this->pub_notes;
1033 }
1034
1035 function setCleanFrames($a_clean)
1036 {
1037 $this->clean_frames = $a_clean;
1038 }
1039
1040 function cleanFrames()
1041 {
1042 return $this->clean_frames;
1043 }
1044
1045 function setHistoryUserComments($a_comm)
1046 {
1047 $this->user_comments = $a_comm;
1048 }
1049
1050 function setPublicAccessMode($a_mode)
1051 {
1052 $this->public_access_mode = $a_mode;
1053 }
1054
1056 {
1057 return $this->user_comments;
1058 }
1059
1060 function setHeaderPage($a_pg)
1061 {
1062 $this->header_page = $a_pg;
1063 }
1064
1065 function getHeaderPage()
1066 {
1067 return $this->header_page;
1068 }
1069
1070 function setFooterPage($a_pg)
1071 {
1072 $this->footer_page = $a_pg;
1073 }
1074
1075 function getFooterPage()
1076 {
1077 return $this->footer_page;
1078 }
1079
1084 {
1085 global $ilDB;
1086
1087 $q = "SELECT * FROM content_object WHERE id = ".
1088 $ilDB->quote($this->getId(), "integer");
1089 $lm_set = $ilDB->query($q);
1090 $lm_rec = $ilDB->fetchAssoc($lm_set);
1091 $this->setLayout($lm_rec["default_layout"]);
1092 $this->setStyleSheetId((int) $lm_rec["stylesheet"]);
1093 $this->setPageHeader($lm_rec["page_header"]);
1094 $this->setTOCMode($lm_rec["toc_mode"]);
1095 $this->setOnline(ilUtil::yn2tf($lm_rec["is_online"]));
1096 $this->setActiveTOC(ilUtil::yn2tf($lm_rec["toc_active"]));
1097 $this->setActiveNumbering(ilUtil::yn2tf($lm_rec["numbering"]));
1098 $this->setActivePrintView(ilUtil::yn2tf($lm_rec["print_view_active"]));
1099 $this->setActivePreventGlossaryAppendix(ilUtil::yn2tf($lm_rec["no_glo_appendix"]));
1100 $this->setHideHeaderFooterPrint($lm_rec["hide_head_foot_print"]);
1101 $this->setActiveDownloads(ilUtil::yn2tf($lm_rec["downloads_active"]));
1102 $this->setActiveDownloadsPublic(ilUtil::yn2tf($lm_rec["downloads_public_active"]));
1103 $this->setActiveLMMenu(ilUtil::yn2tf($lm_rec["lm_menu_active"]));
1104 $this->setCleanFrames(ilUtil::yn2tf($lm_rec["clean_frames"]));
1105 $this->setHeaderPage((int) $lm_rec["header_page"]);
1106 $this->setFooterPage((int) $lm_rec["footer_page"]);
1107 $this->setHistoryUserComments(ilUtil::yn2tf($lm_rec["hist_user_comments"]));
1108 $this->setPublicAccessMode($lm_rec["public_access_mode"]);
1109 $this->setPublicExportFile("xml", $lm_rec["public_xml_file"]);
1110 $this->setPublicExportFile("html", $lm_rec["public_html_file"]);
1111 $this->setPublicExportFile("scorm", $lm_rec["public_scorm_file"]);
1112 $this->setLayoutPerPage($lm_rec["layout_per_page"]);
1113 $this->setRating($lm_rec["rating"]);
1114 $this->setRatingPages($lm_rec["rating_pages"]);
1115 $this->setDisableDefaultFeedback($lm_rec["disable_def_feedback"]);
1116 $this->setProgressIcons($lm_rec["progr_icons"]);
1117 $this->setStoreTries($lm_rec["store_tries"]);
1118 $this->setRestrictForwardNavigation($lm_rec["restrict_forw_nav"]);
1119
1120 // #14661
1121 include_once("./Services/Notes/classes/class.ilNote.php");
1122 $this->setPublicNotes(ilNote::commentsActivated($this->getId(), 0, $this->getType()));
1123 }
1124
1129 {
1130 global $ilDB;
1131
1132 // force clean_frames to be set, if layout per page is activated
1133 if ($this->getLayoutPerPage())
1134 {
1135 $this->setCleanFrames(true);
1136 }
1137
1138 $q = "UPDATE content_object SET ".
1139 " default_layout = ".$ilDB->quote($this->getLayout(), "text").", ".
1140 " stylesheet = ".$ilDB->quote($this->getStyleSheetId(), "integer").",".
1141 " page_header = ".$ilDB->quote($this->getPageHeader(), "text").",".
1142 " toc_mode = ".$ilDB->quote($this->getTOCMode(), "text").",".
1143 " is_online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline()), "text").",".
1144 " toc_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveTOC()), "text").",".
1145 " numbering = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveNumbering()), "text").",".
1146 " print_view_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActivePrintView()), "text").",".
1147 " no_glo_appendix = ".$ilDB->quote(ilUtil::tf2yn($this->isActivePreventGlossaryAppendix()), "text").",".
1148 " hide_head_foot_print = ".$ilDB->quote($this->getHideHeaderFooterPrint(), "integer").",".
1149 " downloads_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveDownloads()), "text").",".
1150 " downloads_public_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveDownloadsPublic()), "text").",".
1151 " clean_frames = ".$ilDB->quote(ilUtil::tf2yn($this->cleanFrames()), "text").",".
1152 " hist_user_comments = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveHistoryUserComments()), "text").",".
1153 " public_access_mode = ".$ilDB->quote($this->getPublicAccessMode(), "text").",".
1154 " public_xml_file = ".$ilDB->quote($this->getPublicExportFile("xml"), "text").",".
1155 " public_html_file = ".$ilDB->quote($this->getPublicExportFile("html"), "text").",".
1156 " public_scorm_file = ".$ilDB->quote($this->getPublicExportFile("scorm"), "text").",".
1157 " header_page = ".$ilDB->quote($this->getHeaderPage(), "integer").",".
1158 " footer_page = ".$ilDB->quote($this->getFooterPage(), "integer").",".
1159 " lm_menu_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveLMMenu()), "text").", ".
1160 " layout_per_page = ".$ilDB->quote($this->getLayoutPerPage(), "integer").", ".
1161 " rating = ".$ilDB->quote($this->hasRating(), "integer").", ".
1162 " rating_pages = ".$ilDB->quote($this->hasRatingPages(), "integer").", ".
1163 " disable_def_feedback = ".$ilDB->quote($this->getDisableDefaultFeedback(), "integer").", ".
1164 " progr_icons = ".$ilDB->quote($this->getProgressIcons(), "integer").", ".
1165 " store_tries = ".$ilDB->quote($this->getStoreTries(), "integer").", ".
1166 " restrict_forw_nav = ".$ilDB->quote($this->getRestrictForwardNavigation(), "integer")." ".
1167 " WHERE id = ".$ilDB->quote($this->getId(), "integer");
1168 $ilDB->manipulate($q);
1169
1170 // #14661
1171 include_once("./Services/Notes/classes/class.ilNote.php");
1172 ilNote::activateComments($this->getId(), 0, $this->getType(), $this->publicNotes());
1173 }
1174
1179 {
1180 global $ilDB;
1181
1182 $q = "INSERT INTO content_object (id) VALUES (".$ilDB->quote($this->getId(), "integer").")";
1183 $ilDB->manipulate($q);
1184
1185 // #14661
1186 include_once("./Services/Notes/classes/class.ilNote.php");
1187 ilNote::activateComments($this->getId(), 0, $this->getType(), true);
1188
1189 $this->readProperties(); // to get db default values
1190 }
1191
1195 function _lookupOnline($a_id)
1196 {
1197 global $ilDB;
1198
1199//echo "class ilObjContentObject::_lookupOnline($a_id) called. Use Access class instead.";
1200
1201 $q = "SELECT is_online FROM content_object WHERE id = ".$ilDB->quote($a_id, "integer");
1202 $lm_set = $ilDB->query($q);
1203 $lm_rec = $ilDB->fetchAssoc($lm_set);
1204
1205 return ilUtil::yn2tf($lm_rec["is_online"]);
1206 }
1207
1214 {
1215 $dir = opendir("./Modules/LearningModule/layouts/lm");
1216
1217 $layouts = array();
1218
1219 while($file = readdir($dir))
1220 {
1221 if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn")
1222 {
1223 // directories
1224 if (@is_dir("./Modules/LearningModule/layouts/lm/".$file))
1225 {
1226 $layouts[$file] = $file;
1227 }
1228 }
1229 }
1230 asort($layouts);
1231
1232 // workaround: fix ordering
1233 $ret = array(
1234 'toc2win' => 'toc2win',
1235 'toc2windyn' => 'toc2windyn',
1236 '1window' => '1window',
1237 '2window' => '2window',
1238 '3window' => '3window',
1239 'presentation' => 'presentation',
1240 'fullscreen' => 'fullscreen'
1241 );
1242
1243 foreach ($layouts as $l)
1244 {
1245 if (!in_array($l, $ret))
1246 {
1247 $ret[$l] = $l;
1248 }
1249 }
1250
1251 return $ret;
1252 }
1253
1257 function _checkPreconditionsOfPage($cont_ref_id,$cont_obj_id, $page_id)
1258 {
1259 global $ilUser,$ilErr;
1260
1261 $lm_tree = new ilTree($cont_obj_id);
1262 $lm_tree->setTableNames('lm_tree','lm_data');
1263 $lm_tree->setTreeTablePK("lm_id");
1264
1265 if ($lm_tree->isInTree($page_id))
1266 {
1267 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1268 foreach ($path as $node)
1269 {
1270 if ($node["type"] == "st")
1271 {
1272 if (!ilConditionHandler::_checkAllConditionsOfTarget($cont_ref_id,$node["child"], "st"))
1273 {
1274 return false;
1275 }
1276 }
1277 }
1278 }
1279
1280 return true;
1281 }
1282
1286 function _getMissingPreconditionsOfPage($cont_ref_id,$cont_obj_id, $page_id)
1287 {
1288 $lm_tree = new ilTree($cont_obj_id);
1289 $lm_tree->setTableNames('lm_tree','lm_data');
1290 $lm_tree->setTreeTablePK("lm_id");
1291
1292 $conds = array();
1293 if ($lm_tree->isInTree($page_id))
1294 {
1295 // get full path of page
1296 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1297 foreach ($path as $node)
1298 {
1299 if ($node["type"] == "st")
1300 {
1301 // get all preconditions of upper chapters
1302 $tconds = ilConditionHandler::_getConditionsOfTarget($cont_ref_id,$node["child"], "st");
1303 foreach ($tconds as $tcond)
1304 {
1305 // store all missing preconditions
1306 if (!ilConditionHandler::_checkCondition($tcond["id"]))
1307 {
1308 $conds[] = $tcond;
1309 }
1310 }
1311 }
1312 }
1313 }
1314
1315 return $conds;
1316 }
1317
1321 function _getMissingPreconditionsTopChapter($cont_obj_ref_id,$cont_obj_id, $page_id)
1322 {
1323 $lm_tree = new ilTree($cont_obj_id);
1324 $lm_tree->setTableNames('lm_tree','lm_data');
1325 $lm_tree->setTreeTablePK("lm_id");
1326
1327 $conds = array();
1328 if ($lm_tree->isInTree($page_id))
1329 {
1330 // get full path of page
1331 $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId());
1332 foreach ($path as $node)
1333 {
1334 if ($node["type"] == "st")
1335 {
1336 // get all preconditions of upper chapters
1337 $tconds = ilConditionHandler::_getConditionsOfTarget($cont_obj_ref_id,$node["child"], "st");
1338 foreach ($tconds as $tcond)
1339 {
1340 // look for missing precondition
1341 if (!ilConditionHandler::_checkCondition($tcond["id"]))
1342 {
1343 return $node["child"];
1344 }
1345 }
1346 }
1347 }
1348 }
1349
1350 return "";
1351 }
1352
1363 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1364 {
1365 global $tree;
1366
1367 switch ($a_event)
1368 {
1369 case "link":
1370
1371 //var_dump("<pre>",$a_params,"</pre>");
1372 //echo "Content Object ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
1373 //exit;
1374 break;
1375
1376 case "cut":
1377
1378 //echo "Content Object ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
1379 //exit;
1380 break;
1381
1382 case "copy":
1383
1384 //var_dump("<pre>",$a_params,"</pre>");
1385 //echo "Content Object ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
1386 //exit;
1387 break;
1388
1389 case "paste":
1390
1391 //echo "Content Object ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
1392 //exit;
1393 break;
1394
1395 case "new":
1396
1397 //echo "Content Object ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
1398 //exit;
1399 break;
1400 }
1401
1402 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
1403 if ($a_node_id==$_GET["ref_id"])
1404 {
1405 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1406 $parent_type = $parent_obj->getType();
1407 if($parent_type == $this->getType())
1408 {
1409 $a_node_id = (int) $tree->getParentId($a_node_id);
1410 }
1411 }
1412
1413 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1414 }
1415
1416
1420 function hasSuccessorPage($a_cont_obj_id, $a_page_id)
1421 {
1422 $tree = new ilTree($a_cont_obj_id);
1423 $tree->setTableNames('lm_tree','lm_data');
1424 $tree->setTreeTablePK("lm_id");
1425 if ($tree->isInTree($a_page_id))
1426 {
1427 $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
1428 if ($succ > 0)
1429 {
1430 return true;
1431 }
1432 }
1433 return false;
1434 }
1435
1436
1437 function checkTree()
1438 {
1439 $tree = new ilTree($this->getId());
1440 $tree->setTableNames('lm_tree','lm_data');
1441 $tree->setTreeTablePK("lm_id");
1442 $tree->checkTree();
1443 $tree->checkTreeChilds();
1444//echo "checked";
1445 }
1446
1450 function fixTree()
1451 {
1452 global $ilDB;
1453
1454 $tree =& $this->getLMTree();
1455
1456 // check numbering, if errors, renumber
1457 // it is very important to keep this step before deleting subtrees
1458 // in the following steps
1459 $set = $ilDB->query("SELECT DISTINCT l1.lm_id".
1460 " FROM lm_tree l1".
1461 " JOIN lm_tree l2 ON ( l1.child = l2.parent".
1462 " AND l1.lm_id = l2.lm_id )".
1463 " JOIN lm_data ON ( l1.child = lm_data.obj_id )".
1464 " WHERE (l2.lft < l1.lft".
1465 " OR l2.rgt > l1.rgt OR l2.lft > l1.rgt OR l2.rgt < l1.lft)".
1466 " AND l1.lm_id = ".$ilDB->quote($this->getId(), "integer").
1467 " ORDER BY lm_data.create_date DESC"
1468 );
1469 if ($rec = $ilDB->fetchAssoc($set))
1470 {
1471 $tree->renumber();
1472 }
1473
1474 // delete subtrees that have no lm_data records
1475 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1476 foreach ($nodes as $node)
1477 {
1478 $q = "SELECT * FROM lm_data WHERE obj_id = ".
1479 $ilDB->quote($node["child"], "integer");
1480 $obj_set = $ilDB->query($q);
1481 $obj_rec = $ilDB->fetchAssoc($obj_set);
1482 if (!$obj_rec)
1483 {
1484 $node_data = $tree->getNodeData($node["child"]);
1485 $tree->deleteTree($node_data);
1486 }
1487 }
1488
1489 // delete subtrees that have pages as parent
1490 $nodes = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1491 foreach ($nodes as $node)
1492 {
1493 $q = "SELECT * FROM lm_data WHERE obj_id = ".
1494 $ilDB->quote($node["parent"], "integer");
1495 $obj_set = $ilDB->query($q);
1496 $obj_rec = $ilDB->fetchAssoc($obj_set);
1497 if ($obj_rec["type"] == "pg")
1498 {
1499 $node_data = $tree->getNodeData($node["child"]);
1500 if ($tree->isInTree($node["child"]))
1501 {
1502 $tree->deleteTree($node_data);
1503 }
1504 }
1505 }
1506
1507 // check for multi-references pages or chapters
1508 // if errors -> create copies of them here
1509 $set = $ilDB->query("SELECT DISTINCT l1.lm_id".
1510 " FROM lm_tree l1".
1511 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1512 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1513 " WHERE l1.child <> 1".
1514 " AND l1.lm_id <> lm_data.lm_id".
1515 " AND l1.lm_id = ".$ilDB->quote($this->getId(), "integer"));
1516 if ($rec = $ilDB->fetchAssoc($set))
1517 {
1518 $set = $ilDB->query("SELECT DISTINCT l1.child ".
1519 " FROM lm_tree l1".
1520 " JOIN lm_tree l2 ON ( l1.child = l2.child AND l1.lm_id <> l2.lm_id )".
1521 " JOIN lm_data ON (l1.child = lm_data.obj_id)".
1522 " WHERE l1.child <> 1".
1523 " AND l1.lm_id <> lm_data.lm_id".
1524 " AND l1.lm_id = ".$ilDB->quote($this->getId(), "integer"));
1525 include_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
1526 while ($rec = $ilDB->fetchAssoc($set))
1527 {
1528 $cobj = ilLMObjectFactory::getInstance($this, $rec["child"]);
1529
1530 if (is_object($cobj))
1531 {
1532 if ($cobj->getType() == "pg")
1533 {
1534 // make a copy of it
1535 $pg_copy = $cobj->copy($this);
1536
1537 // replace the child in the tree with the copy (id)
1538 $ilDB->manipulate("UPDATE lm_tree SET ".
1539 " child = ".$ilDB->quote($pg_copy->getId(), "integer").
1540 " WHERE child = ".$ilDB->quote($cobj->getId(), "integer").
1541 " AND lm_id = ".$ilDB->quote($this->getId(), "integer")
1542 );
1543 }
1544 else if ($cobj->getType() == "st")
1545 {
1546 // make a copy of it
1547 $st_copy = $cobj->copy($this);
1548
1549 // replace the child in the tree with the copy (id)
1550 $ilDB->manipulate("UPDATE lm_tree SET ".
1551 " child = ".$ilDB->quote($st_copy->getId(), "integer").
1552 " WHERE child = ".$ilDB->quote($cobj->getId(), "integer").
1553 " AND lm_id = ".$ilDB->quote($this->getId(), "integer")
1554 );
1555
1556 // make all childs refer to the copy now
1557 $ilDB->manipulate("UPDATE lm_tree SET ".
1558 " parent = ".$ilDB->quote($st_copy->getId(), "integer").
1559 " WHERE parent = ".$ilDB->quote($cobj->getId(), "integer").
1560 " AND lm_id = ".$ilDB->quote($this->getId(), "integer")
1561 );
1562 }
1563 }
1564 }
1565 }
1566 }
1567
1568
1575 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1576 {
1577 global $ilBench;
1578
1579 $attrs = array();
1580 switch($this->getType())
1581 {
1582 case "lm":
1583 $attrs["Type"] = "LearningModule";
1584 break;
1585
1586 case "dbk":
1587 $attrs["Type"] = "LibObject";
1588 break;
1589 }
1590 $a_xml_writer->xmlStartTag("ContentObject", $attrs);
1591
1592 // MetaData
1593 $this->exportXMLMetaData($a_xml_writer);
1594
1595 // StructureObjects
1596//echo "ContObj:".$a_inst.":<br>";
1597 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Structure Objects");
1598 $ilBench->start("ContentObjectExport", "exportStructureObjects");
1599 $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
1600 $ilBench->stop("ContentObjectExport", "exportStructureObjects");
1601 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Structure Objects");
1602
1603 // PageObjects
1604 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Page Objects");
1605 $ilBench->start("ContentObjectExport", "exportPageObjects");
1606 $this->exportXMLPageObjects($a_xml_writer, $a_inst, $expLog);
1607 $ilBench->stop("ContentObjectExport", "exportPageObjects");
1608 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Page Objects");
1609
1610 // MediaObjects
1611 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
1612 $ilBench->start("ContentObjectExport", "exportMediaObjects");
1613 $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
1614 $ilBench->stop("ContentObjectExport", "exportMediaObjects");
1615 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
1616
1617 // FileItems
1618 $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
1619 $ilBench->start("ContentObjectExport", "exportFileItems");
1620 $this->exportFileItems($a_target_dir, $expLog);
1621 $ilBench->stop("ContentObjectExport", "exportFileItems");
1622 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
1623
1624 // Questions
1625 if (count($this->q_ids) > 0)
1626 {
1627 $qti_file = fopen($a_target_dir."/qti.xml", "w");
1628 include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
1629 $pool = new ilObjQuestionPool();
1630 fwrite($qti_file, $pool->toXML($this->q_ids));
1631 fclose($qti_file);
1632 }
1633
1634 // To do: implement version selection/detection
1635 // Properties
1636 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Properties");
1637 $this->exportXMLProperties($a_xml_writer, $expLog);
1638 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Properties");
1639
1640 $a_xml_writer->xmlEndTag("ContentObject");
1641 }
1642
1649 function exportXMLMetaData(&$a_xml_writer)
1650 {
1651 include_once("Services/MetaData/classes/class.ilMD2XML.php");
1652 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
1653 $md2xml->setExportMode(true);
1654 $md2xml->startExport();
1655 $a_xml_writer->appendXML($md2xml->getXML());
1656 }
1657
1664 function exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog)
1665 {
1666 include_once './Modules/LearningModule/classes/class.ilStructureObject.php';
1667
1668 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
1669 foreach ($childs as $child)
1670 {
1671 if($child["type"] != "st")
1672 {
1673 continue;
1674 }
1675
1676 $structure_obj = new ilStructureObject($this, $child["obj_id"]);
1677 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
1678 unset($structure_obj);
1679 }
1680 }
1681
1682
1689 function exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
1690 {
1691 global $ilBench;
1692
1693 include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
1694 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
1695
1696 $pages = ilLMPageObject::getPageList($this->getId());
1697 foreach ($pages as $page)
1698 {
1699 if (ilLMPage::_exists($this->getType(), $page["obj_id"]))
1700 {
1701 $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);
1702
1703 // export xml to writer object
1704 $page_obj = new ilLMPageObject($this, $page["obj_id"]);
1705 $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
1706
1707 // collect media objects
1708 $mob_ids = $page_obj->getMediaObjectIDs();
1709 foreach($mob_ids as $mob_id)
1710 {
1711 $this->mob_ids[$mob_id] = $mob_id;
1712 }
1713
1714 // collect all file items
1715 $file_ids = $page_obj->getFileItemIds();
1716 foreach($file_ids as $file_id)
1717 {
1718 $this->file_ids[$file_id] = $file_id;
1719 }
1720
1721 // collect all questions
1722 $q_ids = $page_obj->getQuestionIds();
1723 foreach($q_ids as $q_id)
1724 {
1725 $this->q_ids[$q_id] = $q_id;
1726 }
1727
1728 unset($page_obj);
1729 }
1730 }
1731 }
1732
1739 function exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
1740 {
1741 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1742
1743 $linked_mobs = array();
1744
1745 // mobs directly embedded into pages
1746 foreach ($this->mob_ids as $mob_id)
1747 {
1748 if ($mob_id > 0 && ilObject::_lookupType($mob_id) == "mob")
1749 {
1750 $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
1751 $media_obj = new ilObjMediaObject($mob_id);
1752 $media_obj->exportXML($a_xml_writer, $a_inst);
1753 $media_obj->exportFiles($a_target_dir);
1754
1755 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
1756 $linked_mobs = array_merge($linked_mobs, $lmobs);
1757
1758 unset($media_obj);
1759 }
1760 }
1761
1762 // linked mobs (in map areas)
1763 foreach ($linked_mobs as $mob_id)
1764 {
1765 if ($mob_id > 0)
1766 {
1767 $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
1768 $media_obj = new ilObjMediaObject($mob_id);
1769 $media_obj->exportXML($a_xml_writer, $a_inst);
1770 $media_obj->exportFiles($a_target_dir);
1771 unset($media_obj);
1772 }
1773 }
1774
1775 }
1776
1781 function exportFileItems($a_target_dir, &$expLog)
1782 {
1783 include_once("./Modules/File/classes/class.ilObjFile.php");
1784
1785 foreach ($this->file_ids as $file_id)
1786 {
1787 $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
1788 $file_obj = new ilObjFile($file_id, false);
1789 $file_obj->export($a_target_dir);
1790 unset($file_obj);
1791 }
1792 }
1793
1798 function exportXMLProperties($a_xml_writer, &$expLog)
1799 {
1800 $attrs = array();
1801 $a_xml_writer->xmlStartTag("Properties", $attrs);
1802
1803 // Layout
1804 $attrs = array("Name" => "Layout", "Value" => $this->getLayout());
1805 $a_xml_writer->xmlElement("Property", $attrs);
1806
1807 // Page Header
1808 $attrs = array("Name" => "PageHeader", "Value" => $this->getPageHeader());
1809 $a_xml_writer->xmlElement("Property", $attrs);
1810
1811 // TOC Mode
1812 $attrs = array("Name" => "TOCMode", "Value" => $this->getTOCMode());
1813 $a_xml_writer->xmlElement("Property", $attrs);
1814
1815 // LM Menu Activation
1816 $attrs = array("Name" => "ActiveLMMenu", "Value" =>
1817 ilUtil::tf2yn($this->isActiveLMMenu()));
1818 $a_xml_writer->xmlElement("Property", $attrs);
1819
1820 // Numbering Activation
1821 $attrs = array("Name" => "ActiveNumbering", "Value" =>
1823 $a_xml_writer->xmlElement("Property", $attrs);
1824
1825 // Table of contents button activation
1826 $attrs = array("Name" => "ActiveTOC", "Value" =>
1827 ilUtil::tf2yn($this->isActiveTOC()));
1828 $a_xml_writer->xmlElement("Property", $attrs);
1829
1830 // Print view button activation
1831 $attrs = array("Name" => "ActivePrintView", "Value" =>
1833 $a_xml_writer->xmlElement("Property", $attrs);
1834
1835 // Note that download button is not saved, because
1836 // download files do not exist after import
1837
1838 // Clean frames
1839 $attrs = array("Name" => "CleanFrames", "Value" =>
1840 ilUtil::tf2yn($this->cleanFrames()));
1841 $a_xml_writer->xmlElement("Property", $attrs);
1842
1843 // Public notes activation
1844 $attrs = array("Name" => "PublicNotes", "Value" =>
1845 ilUtil::tf2yn($this->publicNotes()));
1846 $a_xml_writer->xmlElement("Property", $attrs);
1847
1848 // History comments for authors activation
1849 $attrs = array("Name" => "HistoryUserComments", "Value" =>
1851 $a_xml_writer->xmlElement("Property", $attrs);
1852
1853 // Rating
1854 $attrs = array("Name" => "Rating", "Value" =>
1855 ilUtil::tf2yn($this->hasRating()));
1856 $a_xml_writer->xmlElement("Property", $attrs);
1857 $attrs = array("Name" => "RatingPages", "Value" =>
1858 ilUtil::tf2yn($this->hasRatingPages()));
1859 $a_xml_writer->xmlElement("Property", $attrs);
1860
1861 // Header Page
1862 if ($this->getHeaderPage() > 0)
1863 {
1864 $attrs = array("Name" => "HeaderPage", "Value" =>
1865 "il_".IL_INST_ID."_pg_".$this->getHeaderPage());
1866 $a_xml_writer->xmlElement("Property", $attrs);
1867 }
1868
1869 // Footer Page
1870 if ($this->getFooterPage() > 0)
1871 {
1872 $attrs = array("Name" => "FooterPage", "Value" =>
1873 "il_".IL_INST_ID."_pg_".$this->getFooterPage());
1874 $a_xml_writer->xmlElement("Property", $attrs);
1875 }
1876
1877 // layout per page
1878 $attrs = array("Name" => "LayoutPerPage", "Value" =>
1879 $this->getLayoutPerPage());
1880 $a_xml_writer->xmlElement("Property", $attrs);
1881
1882 // progress icons
1883 $attrs = array("Name" => "ProgressIcons", "Value" =>
1884 $this->getProgressIcons());
1885 $a_xml_writer->xmlElement("Property", $attrs);
1886
1887 // store tries
1888 $attrs = array("Name" => "StoreTries", "Value" =>
1889 $this->getStoreTries());
1890 $a_xml_writer->xmlElement("Property", $attrs);
1891
1892 // restrict forward navigation
1893 $attrs = array("Name" => "RestrictForwardNavigation", "Value" =>
1895 $a_xml_writer->xmlElement("Property", $attrs);
1896
1897 // disable default feedback
1898 $attrs = array("Name" => "DisableDefaultFeedback", "Value" =>
1899 $this->getDisableDefaultFeedback());
1900 $a_xml_writer->xmlElement("Property", $attrs);
1901
1902 $a_xml_writer->xmlEndTag("Properties");
1903 }
1904
1909 {
1910 $file = array();
1911
1912 $types = array("xml", "html", "scorm");
1913
1914 foreach ($types as $type)
1915 {
1916 $dir = $this->getExportDirectory($type);
1917 // quit if import dir not available
1918 if (!@is_dir($dir) or
1919 !is_writeable($dir))
1920 {
1921 continue;
1922 }
1923
1924 // open directory
1925 $cdir = dir($dir);
1926
1927 // initialize array
1928
1929 // get files and save the in the array
1930 while ($entry = $cdir->read())
1931 {
1932 if ($entry != "." and
1933 $entry != ".." and
1934 substr($entry, -4) == ".zip" and
1935 ereg("^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.zip\$", $entry))
1936 {
1937 $file[$entry.$type] = array("type" => $type, "file" => $entry,
1938 "size" => filesize($dir."/".$entry));
1939 }
1940 }
1941
1942 // close import directory
1943 $cdir->close();
1944 }
1945
1946 // sort files
1947 ksort ($file);
1948 reset ($file);
1949 return $file;
1950 }
1951
1958 function setPublicExportFile($a_type, $a_file)
1959 {
1960 $this->public_export_file[$a_type] = $a_file;
1961 }
1962
1970 function getPublicExportFile($a_type)
1971 {
1972 return $this->public_export_file[$a_type];
1973 }
1974
1978 function getOfflineFiles($dir)
1979 {
1980 // quit if offline dir not available
1981 if (!@is_dir($dir) or
1982 !is_writeable($dir))
1983 {
1984 return array();
1985 }
1986
1987 // open directory
1988 $dir = dir($dir);
1989
1990 // initialize array
1991 $file = array();
1992
1993 // get files and save the in the array
1994 while ($entry = $dir->read())
1995 {
1996 if ($entry != "." and
1997 $entry != ".." and
1998 substr($entry, -4) == ".pdf" and
1999 ereg("^[0-9]{10}_{2}[0-9]+_{2}(lm_)*[0-9]+\.pdf\$", $entry))
2000 {
2001 $file[] = $entry;
2002 }
2003 }
2004
2005 // close import directory
2006 $dir->close();
2007
2008 // sort files
2009 sort ($file);
2010 reset ($file);
2011
2012 return $file;
2013 }
2014
2018 function exportSCORM($a_target_dir, $log)
2019 {
2020 ilUtil::delDir($a_target_dir);
2021 ilUtil::makeDir($a_target_dir);
2022 //ilUtil::makeDir($a_target_dir."/res");
2023
2024 // export everything to html
2025 $this->exportHTML($a_target_dir."/res", $log, false, "scorm");
2026
2027 // build manifest file
2028 include("./Modules/LearningModule/classes/class.ilContObjectManifestBuilder.php");
2029 $man_builder = new ilContObjectManifestBuilder($this);
2030 $man_builder->buildManifest();
2031 $man_builder->dump($a_target_dir);
2032
2033 // copy scorm 1.2 schema definitions
2034 copy("Modules/LearningModule/scorm_xsd/adlcp_rootv1p2.xsd", $a_target_dir."/adlcp_rootv1p2.xsd");
2035 copy("Modules/LearningModule/scorm_xsd/imscp_rootv1p1p2.xsd", $a_target_dir."/imscp_rootv1p1p2.xsd");
2036 copy("Modules/LearningModule/scorm_xsd/imsmd_rootv1p2p1.xsd", $a_target_dir."/imsmd_rootv1p2p1.xsd");
2037 copy("Modules/LearningModule/scorm_xsd/ims_xml.xsd", $a_target_dir."/ims_xml.xsd");
2038
2039 // zip it all
2040 $date = time();
2041 $zip_file = $a_target_dir."/".$date."__".IL_INST_ID."__".
2042 $this->getType()."_".$this->getId().".zip";
2043 //echo "zip-".$a_target_dir."-to-".$zip_file;
2044 ilUtil::zip(array($a_target_dir."/res",
2045 $a_target_dir."/imsmanifest.xml",
2046 $a_target_dir."/adlcp_rootv1p2.xsd",
2047 $a_target_dir."/imscp_rootv1p1p2.xsd",
2048 $a_target_dir."/ims_xml.xsd",
2049 $a_target_dir."/imsmd_rootv1p2p1.xsd")
2050 , $zip_file);
2051
2052 $dest_file = $this->getExportDirectory("scorm")."/".$date."__".IL_INST_ID."__".
2053 $this->getType()."_".$this->getId().".zip";
2054
2055 rename($zip_file, $dest_file);
2056 ilUtil::delDir($a_target_dir);
2057
2058 }
2059
2060
2064 function exportHTML($a_target_dir, $log, $a_zip_file = true, $a_export_format = "html", $a_lang = "")
2065 {
2066 global $tpl, $ilBench, $ilLocator, $ilUser, $ilObjDataCache, $ilias;
2067
2068 $user_lang = $ilUser->getLanguage();
2069 if ($a_lang != "")
2070 {
2071 $ilUser->setLanguage($a_lang);
2072 $ilUser->setCurrentLanguage($a_lang);
2073 $ilObjDataCache->deleteCachedEntry($this->getId());
2074 }
2075
2076 // initialize temporary target directory
2077 ilUtil::delDir($a_target_dir);
2078 ilUtil::makeDir($a_target_dir);
2079 $mob_dir = $a_target_dir."/mobs";
2080 ilUtil::makeDir($mob_dir);
2081 $file_dir = $a_target_dir."/files";
2082 ilUtil::makeDir($file_dir);
2083 $teximg_dir = $a_target_dir."/teximg";
2084 ilUtil::makeDir($teximg_dir);
2085 $style_dir = $a_target_dir."/style";
2086 ilUtil::makeDir($style_dir);
2087 $style_img_dir = $a_target_dir."/style/images";
2088 ilUtil::makeDir($style_img_dir);
2089 $content_style_dir = $a_target_dir."/content_style";
2090 ilUtil::makeDir($content_style_dir);
2091 $content_style_img_dir = $a_target_dir."/content_style/images";
2092 ilUtil::makeDir($content_style_img_dir);
2093 $GLOBALS["teximgcnt"] = 0;
2094
2095 // export system style sheet
2096 $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
2097 $style_name = $ilUser->prefs["style"].".css";
2098 copy($location_stylesheet, $style_dir."/".$style_name);
2099 $fh = fopen($location_stylesheet, "r");
2100 $css = fread($fh, filesize($location_stylesheet));
2101 preg_match_all("/url\‍(([^\‍)]*)\‍)/",$css,$files);
2102 foreach (array_unique($files[1]) as $fileref)
2103 {
2104 $css_fileref = str_replace(array("'", '"'), "", $fileref);
2105 $fileref = dirname($location_stylesheet)."/".$css_fileref;
2106 if (is_file($fileref))
2107 {
2108//echo "<br>make dir: ".dirname($style_dir."/".$css_fileref);
2109 ilUtil::makeDirParents(dirname($style_dir."/".$css_fileref));
2110//echo "<br>copy: ".$fileref." TO ".$style_dir."/".$css_fileref;
2111 copy($fileref, $style_dir."/".$css_fileref);
2112 }
2113 }
2114 fclose($fh);
2115 $location_stylesheet = ilUtil::getStyleSheetLocation();
2116
2117 // export content style sheet
2118 $ilBench->start("ExportHTML", "exportContentStyle");
2119 if ($this->getStyleSheetId() < 1)
2120 {
2121 $cont_stylesheet = "./Services/COPage/css/content.css";
2122
2123 $css = fread(fopen($cont_stylesheet,'r'),filesize($cont_stylesheet));
2124 preg_match_all("/url\‍(([^\‍)]*)\‍)/",$css,$files);
2125 foreach (array_unique($files[1]) as $fileref)
2126 {
2127 if (is_file(str_replace("..", ".", $fileref)))
2128 {
2129 copy(str_replace("..", ".", $fileref), $content_style_img_dir."/".basename($fileref));
2130 }
2131 $css = str_replace($fileref, "images/".basename($fileref),$css);
2132 }
2133 fwrite(fopen($content_style_dir."/content.css",'w'),$css);
2134 }
2135 else
2136 {
2137 $style = new ilObjStyleSheet($this->getStyleSheetId());
2138 $style->writeCSSFile($content_style_dir."/content.css", "images");
2139 $style->copyImagesToDir($content_style_img_dir);
2140 }
2141 $ilBench->stop("ExportHTML", "exportContentStyle");
2142
2143 // export syntax highlighting style
2144 $syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
2145 copy($syn_stylesheet, $a_target_dir."/syntaxhighlight.css");
2146
2147 // get learning module presentation gui class
2148 include_once("./Modules/LearningModule/classes/class.ilLMPresentationGUI.php");
2149 $_GET["cmd"] = "nop";
2150 $lm_gui =& new ilLMPresentationGUI();
2151 $lm_gui->setOfflineMode(true);
2152 $lm_gui->setOfflineDirectory($a_target_dir);
2153 $lm_gui->setExportFormat($a_export_format);
2155 if ($a_lang != "")
2156 {
2157 if ($a_lang == $ot->getMasterLanguage())
2158 {
2159 $lm_gui->lang = "";
2160 }
2161 else
2162 {
2163 $lm_gui->lang = $a_lang;
2164 }
2165 }
2166
2167 // export pages
2168 $ilBench->start("ExportHTML", "exportHTMLPages");
2169 $this->exportHTMLPages($lm_gui, $a_target_dir, $lm_gui->lang);
2170 $ilBench->stop("ExportHTML", "exportHTMLPages");
2171
2172 // export glossary terms
2173 $ilBench->start("ExportHTML", "exportHTMLGlossaryTerms");
2174 $this->exportHTMLGlossaryTerms($lm_gui, $a_target_dir);
2175 $ilBench->stop("ExportHTML", "exportHTMLGlossaryTerms");
2176
2177 // export all media objects
2178 $ilBench->start("ExportHTML", "exportHTMLMediaObjects");
2179 $linked_mobs = array();
2180 foreach ($this->offline_mobs as $mob)
2181 {
2182 if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob")
2183 {
2184 $this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs);
2185 }
2186 }
2187 $linked_mobs2 = array(); // mobs linked in link areas
2188 foreach ($linked_mobs as $mob)
2189 {
2190 if (ilObject::_exists($mob))
2191 {
2192 $this->exportHTMLMOB($a_target_dir, $lm_gui, $mob, "_blank", $linked_mobs2);
2193 }
2194 }
2195 $_GET["obj_type"] = "MediaObject";
2196 $_GET["obj_id"] = $a_mob_id;
2197 $_GET["cmd"] = "";
2198 $ilBench->stop("ExportHTML", "exportHTMLMediaObjects");
2199
2200 // export all file objects
2201 $ilBench->start("ExportHTML", "exportHTMLFileObjects");
2202 foreach ($this->offline_files as $file)
2203 {
2204 $this->exportHTMLFile($a_target_dir, $file);
2205 }
2206 $ilBench->stop("ExportHTML", "exportHTMLFileObjects");
2207
2208 // export questions (images)
2209 if (count($this->q_ids) > 0)
2210 {
2211 foreach ($this->q_ids as $q_id)
2212 {
2213 ilUtil::makeDirParents($a_target_dir."/assessment/0/".$q_id."/images");
2214 ilUtil::rCopy(ilUtil::getWebspaceDir()."/assessment/0/".$q_id."/images",
2215 $a_target_dir."/assessment/0/".$q_id."/images");
2216 }
2217 }
2218
2219 // export table of contents
2220 $ilBench->start("ExportHTML", "exportHTMLTOC");
2221 $ilLocator->clearItems();
2222 if ($this->isActiveTOC())
2223 {
2224 $tpl = new ilTemplate("tpl.main.html", true, true);
2225 //$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2226 $content =& $lm_gui->showTableOfContents();
2227 $file = $a_target_dir."/table_of_contents.html";
2228
2229 // open file
2230 if (!($fp = @fopen($file,"w+")))
2231 {
2232 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2233 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2234 }
2235 chmod($file, 0770);
2236 fwrite($fp, $content);
2237 fclose($fp);
2238 }
2239 $ilBench->stop("ExportHTML", "exportHTMLTOC");
2240
2241 // export images
2242 $ilBench->start("ExportHTML", "exportHTMLImages");
2243 $image_dir = $a_target_dir."/images";
2244 ilUtil::makeDir($image_dir);
2245 ilUtil::makeDir($image_dir."/browser");
2246 copy(ilUtil::getImagePath("enlarge.svg", false, "filesystem"),
2247 $image_dir."/enlarge.svg");
2248 copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"),
2249 $image_dir."/browser/plus.png");
2250 copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"),
2251 $image_dir."/browser/minus.png");
2252 copy(ilUtil::getImagePath("browser/blank.png", false, "filesystem"),
2253 $image_dir."/browser/blank.png");
2254 copy(ilUtil::getImagePath("spacer.png", false, "filesystem"),
2255 $image_dir."/spacer.png");
2256 copy(ilUtil::getImagePath("icon_st.svg", false, "filesystem"),
2257 $image_dir."/icon_st.svg");
2258 copy(ilUtil::getImagePath("icon_pg.svg", false, "filesystem"),
2259 $image_dir."/icon_pg.svg");
2260 copy(ilUtil::getImagePath("icon_lm.svg", false, "filesystem"),
2261 $image_dir."/icon_lm.svg");
2262 copy(ilUtil::getImagePath("nav_arr_L.png", false, "filesystem"),
2263 $image_dir."/nav_arr_L.png");
2264 copy(ilUtil::getImagePath("nav_arr_R.png", false, "filesystem"),
2265 $image_dir."/nav_arr_R.png");
2266
2267 $ilBench->stop("ExportHTML", "exportHTMLImages");
2268
2269 // export flv/mp3 player
2270 $services_dir = $a_target_dir."/Services";
2271 ilUtil::makeDir($services_dir);
2272 $media_service_dir = $services_dir."/MediaObjects";
2273 ilUtil::makeDir($media_service_dir);
2274 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2275 $flv_dir = $a_target_dir."/".ilPlayerUtil::getFlashVideoPlayerDirectory();
2276 ilUtil::makeDir($flv_dir);
2277 $mp3_dir = $media_service_dir."/flash_mp3_player";
2278 ilUtil::makeDir($mp3_dir);
2279// copy(ilPlayerUtil::getFlashVideoPlayerFilename(true),
2280// $flv_dir."/".ilPlayerUtil::getFlashVideoPlayerFilename());
2282 include_once("./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2285
2286 // js files
2287 ilUtil::makeDir($a_target_dir.'/js');
2288 ilUtil::makeDir($a_target_dir.'/js/yahoo');
2289 ilUtil::makeDir($a_target_dir.'/css');
2290 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
2291 foreach (self::getSupplyingExportFiles($a_target_dir) as $f)
2292 {
2293 if ($f["source"] != "")
2294 {
2295 copy($f["source"], $f["target"]);
2296 }
2297 }
2298
2299 // template workaround: reset of template
2300 $tpl = new ilTemplate("tpl.main.html", true, true);
2301 $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
2302 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2303
2304 if ($a_lang != "")
2305 {
2306 $ilUser->setLanguage($user_lang);
2307 $ilUser->setCurrentLanguage($user_lang);
2308 }
2309
2310 // zip everything
2311 if ($a_zip_file)
2312 {
2313 if ($a_lang == "")
2314 {
2315 $zip_target_dir = $this->getExportDirectory("html");
2316 }
2317 else
2318 {
2319 $zip_target_dir = $this->getExportDirectory("html_".$a_lang);
2320 ilUtil::makeDir($zip_target_dir);
2321 }
2322
2323 // zip it all
2324 $date = time();
2325 $zip_file = $zip_target_dir."/".$date."__".IL_INST_ID."__".
2326 $this->getType()."_".$this->getId().".zip";
2327//echo "-".$a_target_dir."-".$zip_file."-"; exit;
2328 ilUtil::zip($a_target_dir, $zip_file);
2329 ilUtil::delDir($a_target_dir);
2330 }
2331 }
2332
2339 static function getSupplyingExportFiles($a_target_dir = ".")
2340 {
2341 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
2342 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
2343 include_once("./Services/MediaObjects/classes/class.ilPlayerUtil.php");
2344 include_once("./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
2345 $scripts = array(
2346 array("source" => ilYuiUtil::getLocalPath('yahoo/yahoo-min.js'),
2347 "target" => $a_target_dir.'/js/yahoo/yahoo-min.js',
2348 "type" => "js"),
2349 array("source" => ilYuiUtil::getLocalPath('yahoo-dom-event/yahoo-dom-event.js'),
2350 "target" => $a_target_dir.'/js/yahoo/yahoo-dom-event.js',
2351 "type" => "js"),
2352 array("source" => ilYuiUtil::getLocalPath('animation/animation-min.js'),
2353 "target" => $a_target_dir.'/js/yahoo/animation-min.js',
2354 "type" => "js"),
2355 array("source" => './Services/JavaScript/js/Basic.js',
2356 "target" => $a_target_dir.'/js/Basic.js',
2357 "type" => "js"),
2358 array("source" => './Services/Accordion/js/accordion.js',
2359 "target" => $a_target_dir.'/js/accordion.js',
2360 "type" => "js"),
2361 array("source" => './Services/Accordion/css/accordion.css',
2362 "target" => $a_target_dir.'/css/accordion.css',
2363 "type" => "css"),
2364 array("source" => iljQueryUtil::getLocaljQueryPath(),
2365 "target" => $a_target_dir.'/js/jquery.js',
2366 "type" => "js"),
2367 array("source" => iljQueryUtil::getLocalMaphilightPath(),
2368 "target" => $a_target_dir.'/js/maphilight.js',
2369 "type" => "js"),
2370 array("source" => iljQueryUtil::getLocaljQueryUIPath(),
2371 "target" => $a_target_dir.'/js/jquery-ui-min.js',
2372 "type" => "js"),
2373 array("source" => './Services/COPage/js/ilCOPagePres.js',
2374 "target" => $a_target_dir.'/js/ilCOPagePres.js',
2375 "type" => "js"),
2376 array("source" => './Modules/Scorm2004/scripts/questions/pure.js',
2377 "target" => $a_target_dir.'/js/pure.js',
2378 "type" => "js"),
2379 array("source" => './Modules/Scorm2004/scripts/questions/question_handling.js',
2380 "target" => $a_target_dir.'/js/question_handling.js',
2381 "type" => "js"),
2382 array("source" => './Modules/TestQuestionPool/js/ilMatchingQuestion.js',
2383 "target" => $a_target_dir.'/js/ilMatchingQuestion.js',
2384 "type" => "js"),
2385 array("source" => './Modules/Scorm2004/templates/default/question_handling.css',
2386 "target" => $a_target_dir.'/css/question_handling.css',
2387 "type" => "css"),
2388 array("source" => './Modules/TestQuestionPool/templates/default/test_javascript.css',
2389 "target" => $a_target_dir.'/css/test_javascript.css',
2390 "type" => "css"),
2391 array("source" => ilPlayerUtil::getLocalMediaElementJsPath(),
2392 "target" => $a_target_dir."/".ilPlayerUtil::getLocalMediaElementJsPath(),
2393 "type" => "js"),
2395 "target" => $a_target_dir."/".ilPlayerUtil::getLocalMediaElementCssPath(),
2396 "type" => "css"),
2398 "target" => $a_target_dir."/".ilExplorerBaseGUI::getLocalExplorerJsPath(),
2399 "type" => "js"),
2400 array("source" => ilExplorerBaseGUI::getLocalJsTreeJsPath(),
2401 "target" => $a_target_dir."/".ilExplorerBaseGUI::getLocalJsTreeJsPath(),
2402 "type" => "js"),
2403 array("source" => './Modules/LearningModule/js/LearningModule.js',
2404 "target" => $a_target_dir.'/js/LearningModule.js',
2405 "type" => "js")
2406 );
2407
2408 $mathJaxSetting = new ilSetting("MathJax");
2409 $use_mathjax = $mathJaxSetting->get("enable");
2410 if ($use_mathjax)
2411 {
2412 $scripts[] = array("source" => "",
2413 "target" => $mathJaxSetting->get("path_to_mathjax"),
2414 "type" => "js");
2415 }
2416
2417 return $scripts;
2418
2419 }
2420
2424 function exportHTMLFile($a_target_dir, $a_file_id)
2425 {
2426 $file_dir = $a_target_dir."/files/file_".$a_file_id;
2427 ilUtil::makeDir($file_dir);
2428 include_once("./Modules/File/classes/class.ilObjFile.php");
2429 $file_obj = new ilObjFile($a_file_id, false);
2430 $source_file = $file_obj->getDirectory($file_obj->getVersion())."/".$file_obj->getFileName();
2431 if (!is_file($source_file))
2432 {
2433 $source_file = $file_obj->getDirectory()."/".$file_obj->getFileName();
2434 }
2435 if (is_file($source_file))
2436 {
2437 copy($source_file, $file_dir."/".$file_obj->getFileName());
2438 }
2439 }
2440
2444 function exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
2445 {
2446 global $tpl;
2447
2448 $mob_dir = $a_target_dir."/mobs";
2449
2450 $source_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
2451 if (@is_dir($source_dir))
2452 {
2453 ilUtil::makeDir($mob_dir."/mm_".$a_mob_id);
2454 ilUtil::rCopy($source_dir, $mob_dir."/mm_".$a_mob_id);
2455 }
2456
2457 $tpl = new ilTemplate("tpl.main.html", true, true);
2458 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2459 $_GET["obj_type"] = "MediaObject";
2460 $_GET["mob_id"] = $a_mob_id;
2461 $_GET["frame"] = $a_frame;
2462 $_GET["cmd"] = "";
2463 $content =& $a_lm_gui->media();
2464 $file = $a_target_dir."/media_".$a_mob_id.".html";
2465
2466 // open file
2467 if (!($fp = @fopen($file,"w+")))
2468 {
2469 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2470 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2471 }
2472 chmod($file, 0770);
2473 fwrite($fp, $content);
2474 fclose($fp);
2475
2476 // fullscreen
2477 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2478 $mob_obj = new ilObjMediaObject($a_mob_id);
2479 if ($mob_obj->hasFullscreenItem())
2480 {
2481 $tpl = new ilTemplate("tpl.main.html", true, true);
2482 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2483 $_GET["obj_type"] = "";
2484 $_GET["frame"] = "";
2485 $_GET["mob_id"] = $a_mob_id;
2486 $_GET["cmd"] = "fullscreen";
2487 $content =& $a_lm_gui->fullscreen();
2488 $file = $a_target_dir."/fullscreen_".$a_mob_id.".html";
2489
2490 // open file
2491 if (!($fp = @fopen($file,"w+")))
2492 {
2493 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2494 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2495 }
2496 chmod($file, 0770);
2497 fwrite($fp, $content);
2498 fclose($fp);
2499 }
2500 $linked_mobs = $mob_obj->getLinkedMediaObjects();
2501 $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
2502 }
2503
2507 function exportHTMLGlossaryTerms(&$a_lm_gui, $a_target_dir)
2508 {
2509 global $ilLocator;
2510
2511 foreach($this->offline_int_links as $int_link)
2512 {
2513 $ilLocator->clearItems();
2514 if ($int_link["type"] == "git")
2515 {
2516 $tpl = new ilTemplate("tpl.main.html", true, true);
2517 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2518
2519 $_GET["obj_id"] = $int_link["id"];
2520 $_GET["frame"] = "_blank";
2521 $content =& $a_lm_gui->glossary();
2522 $file = $a_target_dir."/term_".$int_link["id"].".html";
2523
2524 // open file
2525 if (!($fp = @fopen($file,"w+")))
2526 {
2527 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2528 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2529 }
2530 chmod($file, 0770);
2531 fwrite($fp, $content);
2532 fclose($fp);
2533
2534 // store linked/embedded media objects of glosssary term
2535 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
2536 $defs = ilGlossaryDefinition::getDefinitionList($int_link["id"]);
2537 foreach($defs as $def)
2538 {
2539 $def_mobs = ilObjMediaObject::_getMobsOfObject("gdf:pg", $def["id"]);
2540 foreach($def_mobs as $def_mob)
2541 {
2542 $this->offline_mobs[$def_mob] = $def_mob;
2543 }
2544
2545 // get all files of page
2546 $def_files = ilObjFile::_getFilesOfObject("gdf:pg", $page["obj_id"]);
2547 $this->offline_files = array_merge($this->offline_files, $def_files);
2548
2549 }
2550
2551 }
2552 }
2553 }
2554
2558 function exportHTMLPages(&$a_lm_gui, $a_target_dir, $a_lang = "")
2559 {
2560 global $tpl, $ilBench, $ilLocator;
2561
2562 $pages = ilLMPageObject::getPageList($this->getId());
2563
2564 $lm_tree =& $this->getLMTree();
2565 $first_page = $lm_tree->fetchSuccessorNode($lm_tree->getRootId(), "pg");
2566 $this->first_page_id = $first_page["child"];
2567
2568 // iterate all learning module pages
2569 $mobs = array();
2570 $int_links = array();
2571 $this->offline_files = array();
2572
2573 include_once("./Services/COPage/classes/class.ilPageContentUsage.php");
2574 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2575
2576 // get html export id mapping
2577 $lm_set = new ilSetting("lm");
2578 $exp_id_map = array();
2579
2580 if ($lm_set->get("html_export_ids"))
2581 {
2582 foreach ($pages as $page)
2583 {
2584 $exp_id = ilLMPageObject::getExportId($this->getId(), $page["obj_id"]);
2585 if (trim($exp_id) != "")
2586 {
2587 $exp_id_map[$page["obj_id"]] = trim($exp_id);
2588 }
2589 }
2590 }
2591//exit;
2592 if ($a_lang == "")
2593 {
2594 $a_lang = "-";
2595 }
2596
2597 reset($pages);
2598 foreach ($pages as $page)
2599 {
2600 if (ilLMPage::_exists($this->getType(), $page["obj_id"]))
2601 {
2602 $ilLocator->clearItems();
2603 $ilBench->start("ExportHTML", "exportHTMLPage");
2604 $ilBench->start("ExportHTML", "exportPageHTML");
2605 $this->exportPageHTML($a_lm_gui, $a_target_dir, $page["obj_id"],
2606 "", $exp_id_map);
2607 $ilBench->stop("ExportHTML", "exportPageHTML");
2608
2609 // get all snippets of page
2610 $pcs = ilPageContentUsage::getUsagesOfPage($page["obj_id"], $this->getType().":pg", 0, false, $a_lang);
2611 foreach ($pcs as $pc)
2612 {
2613 if ($pc["type"] == "incl")
2614 {
2615 $incl_mobs = ilObjMediaObject::_getMobsOfObject("mep:pg", $pc["id"]);
2616 foreach($incl_mobs as $incl_mob)
2617 {
2618 $mobs[$incl_mob] = $incl_mob;
2619 }
2620 }
2621 }
2622
2623 // get all media objects of page
2624 $pg_mobs = ilObjMediaObject::_getMobsOfObject($this->getType().":pg", $page["obj_id"], 0, $a_lang);
2625 foreach($pg_mobs as $pg_mob)
2626 {
2627 $mobs[$pg_mob] = $pg_mob;
2628 }
2629
2630 // get all internal links of page
2631 $pg_links = ilInternalLink::_getTargetsOfSource($this->getType().":pg", $page["obj_id"], $a_lang);
2632 $int_links = array_merge($int_links, $pg_links);
2633
2634 // get all files of page
2635 include_once("./Modules/File/classes/class.ilObjFile.php");
2636 $pg_files = ilObjFile::_getFilesOfObject($this->getType().":pg", $page["obj_id"], 0, $a_lang);
2637 $this->offline_files = array_merge($this->offline_files, $pg_files);
2638
2639 // collect all questions
2640 include_once("./Services/COPage/classes/class.ilPCQuestion.php");
2641 $q_ids = ilPCQuestion::_getQuestionIdsForPage($this->getType(), $page["obj_id"], $a_lang);
2642 foreach($q_ids as $q_id)
2643 {
2644 $this->q_ids[$q_id] = $q_id;
2645 }
2646
2647 $ilBench->stop("ExportHTML", "exportHTMLPage");
2648 }
2649 }
2650 $this->offline_mobs = $mobs;
2651 $this->offline_int_links = $int_links;
2652 }
2653
2654
2655
2659 function exportPageHTML(&$a_lm_gui, $a_target_dir, $a_lm_page_id, $a_frame = "",
2660 $a_exp_id_map = array())
2661 {
2662 global $tpl, $ilBench;
2663
2664//echo "<br>B: export Page HTML ($a_lm_page_id)"; flush();
2665 // template workaround: reset of template
2666 $tpl = new ilTemplate("tpl.main.html", true, true);
2667 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
2668
2669 include_once("./Services/COPage/classes/class.ilPCQuestion.php");
2671
2672 $_GET["obj_id"] = $a_lm_page_id;
2673 $_GET["frame"] = $a_frame;
2674
2675 if ($a_frame == "")
2676 {
2677 //if ($nid = ilLMObject::_lookupNID($a_lm_gui->lm->getId(), $a_lm_page_id, "pg"))
2678 if (is_array($a_exp_id_map) && isset($a_exp_id_map[$a_lm_page_id]))
2679 {
2680 $file = $a_target_dir."/lm_pg_".$a_exp_id_map[$a_lm_page_id].".html";
2681 }
2682 else
2683 {
2684 $file = $a_target_dir."/lm_pg_".$a_lm_page_id.".html";
2685 }
2686 }
2687 else
2688 {
2689 if ($a_frame != "toc")
2690 {
2691 $file = $a_target_dir."/frame_".$a_lm_page_id."_".$a_frame.".html";
2692 }
2693 else
2694 {
2695 $file = $a_target_dir."/frame_".$a_frame.".html";
2696 }
2697 }
2698
2699 // return if file is already existing
2700 if (@is_file($file))
2701 {
2702 return;
2703 }
2704
2705 $content =& $a_lm_gui->layout("main.xml", false);
2706
2707 // open file
2708 if (!($fp = @fopen($file,"w+")))
2709 {
2710 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2711 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2712 }
2713
2714 // set file permissions
2715 chmod($file, 0770);
2716
2717 // write xml data into the file
2718 fwrite($fp, $content);
2719
2720 // close file
2721 fclose($fp);
2722
2723 if ($this->first_page_id == $a_lm_page_id && $a_frame == "")
2724 {
2725 copy($file, $a_target_dir."/index.html");
2726 }
2727
2728 // write frames of frameset
2729 $frameset = $a_lm_gui->getCurrentFrameSet();
2730
2731 foreach ($frameset as $frame)
2732 {
2733 $this->exportPageHTML($a_lm_gui, $a_target_dir, $a_lm_page_id, $frame);
2734 }
2735
2736 }
2737
2744 function exportFO(&$a_xml_writer, $a_target_dir)
2745 {
2746 global $ilBench;
2747
2748 // fo:root (start)
2749 $attrs = array();
2750 $attrs["xmlns:fo"] = "http://www.w3.org/1999/XSL/Format";
2751 $a_xml_writer->xmlStartTag("fo:root", $attrs);
2752
2753 // fo:layout-master-set (start)
2754 $attrs = array();
2755 $a_xml_writer->xmlStartTag("fo:layout-master-set", $attrs);
2756
2757 // fo:simple-page-master (start)
2758 $attrs = array();
2759 $attrs["master-name"] = "DinA4";
2760 $attrs["page-height"] = "29.7cm";
2761 $attrs["page-width"] = "21cm";
2762 $attrs["margin-top"] = "4cm";
2763 $attrs["margin-bottom"] = "1cm";
2764 $attrs["margin-left"] = "2.8cm";
2765 $attrs["margin-right"] = "7.3cm";
2766 $a_xml_writer->xmlStartTag("fo:simple-page-master", $attrs);
2767
2768 // fo:region-body (complete)
2769 $attrs = array();
2770 $attrs["margin-top"] = "0cm";
2771 $attrs["margin-bottom"] = "1.25cm";
2772 $a_xml_writer->xmlElement("fo:region-body", $attrs);
2773
2774 // fo:region-before (complete)
2775 $attrs = array();
2776 $attrs["extent"] = "1cm";
2777 $a_xml_writer->xmlElement("fo:region-before", $attrs);
2778
2779 // fo:region-after (complete)
2780 $attrs = array();
2781 $attrs["extent"] = "1cm";
2782 $a_xml_writer->xmlElement("fo:region-after", $attrs);
2783
2784 // fo:simple-page-master (end)
2785 $a_xml_writer->xmlEndTag("fo:simple-page-master");
2786
2787 // fo:layout-master-set (end)
2788 $a_xml_writer->xmlEndTag("fo:layout-master-set");
2789
2790 // fo:page-sequence (start)
2791 $attrs = array();
2792 $attrs["master-reference"] = "DinA4";
2793 $a_xml_writer->xmlStartTag("fo:page-sequence", $attrs);
2794
2795 // fo:flow (start)
2796 $attrs = array();
2797 $attrs["flow-name"] = "xsl-region-body";
2798 $a_xml_writer->xmlStartTag("fo:flow", $attrs);
2799
2800
2801 // StructureObjects
2802 //$expLog->write(date("[y-m-d H:i:s] ")."Start Export Structure Objects");
2803 $ilBench->start("ContentObjectExport", "exportFOStructureObjects");
2804 $this->exportFOStructureObjects($a_xml_writer, $expLog);
2805 $ilBench->stop("ContentObjectExport", "exportFOStructureObjects");
2806 //$expLog->write(date("[y-m-d H:i:s] ")."Finished Export Structure Objects");*/
2807
2808 // fo:flow (end)
2809 $a_xml_writer->xmlEndTag("fo:flow");
2810
2811 // fo:page-sequence (end)
2812 $a_xml_writer->xmlEndTag("fo:page-sequence");
2813
2814 // fo:root (end)
2815 $a_xml_writer->xmlEndTag("fo:root");
2816 }
2817
2824 function exportFOStructureObjects(&$a_xml_writer)
2825 {
2826 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
2827 foreach ($childs as $child)
2828 {
2829 if($child["type"] != "st")
2830 {
2831 continue;
2832 }
2833
2834 $structure_obj = new ilStructureObject($this, $child["obj_id"]);
2835 $structure_obj->exportFO($a_xml_writer, $expLog);
2836 unset($structure_obj);
2837 }
2838 }
2839
2840 function getXMLZip()
2841 {
2842 include_once("./Modules/LearningModule/classes/class.ilContObjectExport.php");
2843
2844 $cont_exp = new ilContObjectExport($this,'xml');
2845
2846 $export_file = $cont_exp->buildExportFile();
2847 return $export_file;
2848 }
2849
2858 function executeDragDrop($source_id, $target_id, $first_child, $as_subitem = false, $movecopy = "move")
2859 {
2860 $lmtree = new ilTree($this->getId());
2861 $lmtree->setTableNames('lm_tree','lm_data');
2862 $lmtree->setTreeTablePK("lm_id");
2863//echo "-".$source_id."-".$target_id."-".$first_child."-".$as_subitem."-";
2864 $source_obj = ilLMObjectFactory::getInstance($this, $source_id, true);
2865 $source_obj->setLMId($this->getId());
2866
2867 if (!$first_child)
2868 {
2869 $target_obj = ilLMObjectFactory::getInstance($this, $target_id, true);
2870 $target_obj->setLMId($this->getId());
2871 $target_parent = $lmtree->getParentId($target_id);
2872 }
2873
2874 // handle pages
2875 if ($source_obj->getType() == "pg")
2876 {
2877//echo "1";
2878 if ($lmtree->isInTree($source_obj->getId()))
2879 {
2880 $node_data = $lmtree->getNodeData($source_obj->getId());
2881
2882 // cut on move
2883 if ($movecopy == "move")
2884 {
2885 $parent_id = $lmtree->getParentId($source_obj->getId());
2886 $lmtree->deleteTree($node_data);
2887
2888 // write history entry
2889 require_once("./Services/History/classes/class.ilHistory.php");
2890 ilHistory::_createEntry($source_obj->getId(), "cut",
2891 array(ilLMObject::_lookupTitle($parent_id), $parent_id),
2892 $this->getType().":pg");
2893 ilHistory::_createEntry($parent_id, "cut_page",
2894 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
2895 $this->getType().":st");
2896 }
2897 else
2898 {
2899 // copy page
2900 $new_page =& $source_obj->copy();
2901 $source_id = $new_page->getId();
2902 $source_obj =& $new_page;
2903 }
2904
2905 // paste page
2906 if(!$lmtree->isInTree($source_obj->getId()))
2907 {
2908 if ($first_child) // as first child
2909 {
2910 $target_pos = IL_FIRST_NODE;
2911 $parent = $target_id;
2912 }
2913 else if ($as_subitem) // as last child
2914 {
2915 $parent = $target_id;
2916 $target_pos = IL_FIRST_NODE;
2917 $pg_childs =& $lmtree->getChildsByType($parent, "pg");
2918 if (count($pg_childs) != 0)
2919 {
2920 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
2921 }
2922 }
2923 else // at position
2924 {
2925 $target_pos = $target_id;
2926 $parent = $target_parent;
2927 }
2928
2929 // insert page into tree
2930 $lmtree->insertNode($source_obj->getId(),
2931 $parent, $target_pos);
2932
2933 // write history entry
2934 if ($movecopy == "move")
2935 {
2936 // write history comments
2937 include_once("./Services/History/classes/class.ilHistory.php");
2938 ilHistory::_createEntry($source_obj->getId(), "paste",
2939 array(ilLMObject::_lookupTitle($parent), $parent),
2940 $this->getType().":pg");
2941 ilHistory::_createEntry($parent, "paste_page",
2942 array(ilLMObject::_lookupTitle($source_obj->getId()), $source_obj->getId()),
2943 $this->getType().":st");
2944 }
2945
2946 }
2947 }
2948 }
2949
2950 // handle chapters
2951 if ($source_obj->getType() == "st")
2952 {
2953//echo "2";
2954 $source_node = $lmtree->getNodeData($source_id);
2955 $subnodes = $lmtree->getSubtree($source_node);
2956
2957 // check, if target is within subtree
2958 foreach ($subnodes as $subnode)
2959 {
2960 if($subnode["obj_id"] == $target_id)
2961 {
2962 return;
2963 }
2964 }
2965
2966 $target_pos = $target_id;
2967
2968 if ($first_child) // as first subchapter
2969 {
2970 $target_pos = IL_FIRST_NODE;
2971 $target_parent = $target_id;
2972
2973 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
2974 if (count($pg_childs) != 0)
2975 {
2976 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
2977 }
2978 }
2979 else if ($as_subitem) // as last subchapter
2980 {
2981 $target_parent = $target_id;
2982 $target_pos = IL_FIRST_NODE;
2983 $childs =& $lmtree->getChilds($target_parent);
2984 if (count($childs) != 0)
2985 {
2986 $target_pos = $childs[count($childs) - 1]["obj_id"];
2987 }
2988 }
2989
2990 // insert into
2991/*
2992 if ($position == "into")
2993 {
2994 $target_parent = $target_id;
2995 $target_pos = IL_FIRST_NODE;
2996
2997 // if target_pos is still first node we must skip all pages
2998 if ($target_pos == IL_FIRST_NODE)
2999 {
3000 $pg_childs =& $lmtree->getChildsByType($target_parent, "pg");
3001 if (count($pg_childs) != 0)
3002 {
3003 $target_pos = $pg_childs[count($pg_childs) - 1]["obj_id"];
3004 }
3005 }
3006 }
3007*/
3008
3009
3010 // delete source tree
3011 if ($movecopy == "move")
3012 {
3013 $lmtree->deleteTree($source_node);
3014 }
3015 else
3016 {
3017 // copy chapter (incl. subcontents)
3018 $new_chapter =& $source_obj->copy($lmtree, $target_parent, $target_pos);
3019 }
3020
3021 if (!$lmtree->isInTree($source_id))
3022 {
3023 $lmtree->insertNode($source_id, $target_parent, $target_pos);
3024
3025 // insert moved tree
3026 if ($movecopy == "move")
3027 {
3028 foreach ($subnodes as $node)
3029 {
3030 if($node["obj_id"] != $source_id)
3031 {
3032 $lmtree->insertNode($node["obj_id"], $node["parent"]);
3033 }
3034 }
3035 }
3036 }
3037
3038 // check the tree
3039 $this->checkTree();
3040 }
3041
3042 $this->checkTree();
3043 }
3044
3048 function validatePages()
3049 {
3050 include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
3051 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
3052
3053 $mess = "";
3054
3055 $pages = ilLMPageObject::getPageList($this->getId());
3056 foreach ($pages as $page)
3057 {
3058 if (ilLMPage::_exists($this->getType(), $page["obj_id"]))
3059 {
3060 $cpage = new ilLMPage($page["obj_id"]);
3061 $cpage->buildDom();
3062 $error = @$cpage->validateDom();
3063
3064 if ($error != "")
3065 {
3066 $this->lng->loadLanguageModule("content");
3067 ilUtil::sendInfo($this->lng->txt("cont_import_validation_errors"));
3068 $title = ilLMObject::_lookupTitle($page["obj_id"]);
3069 $page_obj = new ilLMPageObject($this, $page["obj_id"]);
3070 $mess.= $this->lng->txt("obj_pg").": ".$title;
3071 $mess.= '<div class="small">';
3072 foreach ($error as $e)
3073 {
3074 $err_mess = implode($e, " - ");
3075 if (!is_int(strpos($err_mess, ":0:")))
3076 {
3077 $mess.= htmlentities($err_mess)."<br />";
3078 }
3079 }
3080 $mess.= '</div>';
3081 $mess.= "<br />";
3082 }
3083 }
3084 }
3085
3086 return $mess;
3087 }
3088
3095 function importFromZipFile($a_tmp_file, $a_filename, $a_validate = true,
3096 $a_import_into_help_module = 0)
3097 {
3098 global $lng;
3099
3100 // create import directory
3101 $this->createImportDirectory();
3102
3103 // copy uploaded file to import directory
3104 $file = pathinfo($a_filename);
3105 $full_path = $this->getImportDirectory()."/".$a_filename;
3106
3107 ilUtil::moveUploadedFile($a_tmp_file,
3108 $a_filename, $full_path);
3109
3110 // unzip file
3111 ilUtil::unzip($full_path);
3112
3113 $subdir = basename($file["basename"],".".$file["extension"]);
3114
3115 $mess = $this->importFromDirectory(
3116 $this->getImportDirectory()."/".$subdir, $a_validate);
3117
3118 // this should only be true for help modules
3119 if ($a_import_into_help_module > 0)
3120 {
3121 // search the zip file
3122 $dir = $this->getImportDirectory()."/".$subdir;
3123 $files = ilUtil::getDir($dir);
3124 foreach ($files as $file)
3125 {
3126 if (is_int(strpos($file["entry"], "__help_")) &&
3127 is_int(strpos($file["entry"], ".zip")))
3128 {
3129 include_once("./Services/Export/classes/class.ilImport.php");
3130 $imp = new ilImport();
3131 $imp->getMapping()->addMapping('Services/Help', 'help_module', 0, $a_import_into_help_module);
3132 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
3133 $chaps = ilLMObject::getObjectList($this->getId(), "st");
3134 foreach ($chaps as $chap)
3135 {
3136 $chap_arr = explode("_", $chap["import_id"]);
3137 $imp->getMapping()->addMapping('Services/Help', 'help_chap',
3138 $chap_arr[count($chap_arr) - 1], $chap["obj_id"]);
3139 }
3140 $imp->importEntity($dir."/".$file["entry"], $file["entry"],
3141 "help", "Services/Help", true);
3142 }
3143 }
3144 }
3145
3146 // delete import directory
3148
3149 return $mess;
3150 }
3151
3152
3159 function importFromDirectory($a_directory, $a_validate = true)
3160 {
3161 global $lng;
3162
3163 // determine filename of xml file
3164 $subdir = basename($a_directory);
3165 $xml_file = $a_directory."/".$subdir.".xml";
3166
3167 // check directory exists within zip file
3168 if (!is_dir($a_directory))
3169 {
3170 return sprintf($lng->txt("cont_no_subdir_in_zip"), $subdir);
3171 }
3172
3173 // check whether xml file exists within zip file
3174 if (!is_file($xml_file))
3175 {
3176 return sprintf($lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml");
3177 }
3178
3179 // import questions
3180 $qti_file = $a_directory."/qti.xml";
3181 $qtis = array();
3182 if (is_file($qti_file))
3183 {
3184 include_once "./Services/QTI/classes/class.ilQTIParser.php";
3185 include_once("./Modules/Test/classes/class.ilObjTest.php");
3186 $qtiParser = new ilQTIParser ($qti_file,
3187 IL_MO_VERIFY_QTI, 0, "");
3188 $result = $qtiParser->startParsing ();
3189 $founditems = & $qtiParser->getFoundItems ();
3190 $testObj = new ilObjTest(0, true);
3191 if (count($founditems) > 0)
3192 {
3193 $qtiParser = new ilQTIParser($qti_file, IL_MO_PARSE_QTI, 0, "");
3194 $qtiParser->setTestObject($testObj);
3195 $result = $qtiParser->startParsing();
3196 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
3197 }
3198 }
3199
3200 include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
3201 $contParser = new ilContObjParser($this, $xml_file, $subdir, $qmapping);
3202 $contParser->setQuestionMapping($qtis);
3203 $contParser->startParsing();
3204 ilObject::_writeImportId($this->getId(), $this->getImportId());
3205 $this->MDUpdateListener('General');
3206
3207 // import style
3208 $style_file = $a_directory."/style.xml";
3209 $style_zip_file = $a_directory."/style.zip";
3210 if (is_file($style_zip_file)) // try to import style.zip first
3211 {
3212 require_once("./Services/Style/classes/class.ilObjStyleSheet.php");
3213 $style = new ilObjStyleSheet();
3214 $style->import($style_zip_file);
3215 $this->writeStyleSheetId($style->getId());
3216 }
3217 else if (is_file($style_file)) // try to import style.xml
3218 {
3219 require_once("./Services/Style/classes/class.ilObjStyleSheet.php");
3220 $style = new ilObjStyleSheet();
3221 $style->import($style_file);
3222 $this->writeStyleSheetId($style->getId());
3223 }
3224
3225// // validate
3226 if ($a_validate)
3227 {
3228 $mess = $this->validatePages();
3229 }
3230
3231 if ($mess == "")
3232 {
3233 // handle internal links to this learning module
3234 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
3236 $this->getType(), $this->getRefId());
3237 }
3238
3239 return $mess;
3240 }
3241
3250 public function cloneObject($a_target_id,$a_copy_id = 0)
3251 {
3252 global $ilDB, $ilUser, $ilias;
3253
3254 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
3255 $this->cloneMetaData($new_obj);
3256 //$new_obj->createProperties();
3257
3258 //copy online status if object is not the root copy object
3259 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
3260
3261 if(!$cp_options->isRootNode($this->getRefId()))
3262 {
3263 $new_obj->setOnline($this->getOnline());
3264 }
3265
3266 $new_obj->setTitle($this->getTitle());
3267 $new_obj->setDescription($this->getDescription());
3268 $new_obj->setLayoutPerPage($this->getLayoutPerPage());
3269 $new_obj->setLayout($this->getLayout());
3270 $new_obj->setTOCMode($this->getTOCMode());
3271 $new_obj->setActiveLMMenu($this->isActiveLMMenu());
3272 $new_obj->setActiveTOC($this->isActiveTOC());
3273 $new_obj->setActiveNumbering($this->isActiveNumbering());
3274 $new_obj->setActivePrintView($this->isActivePrintView());
3275 $new_obj->setActivePreventGlossaryAppendix($this->isActivePreventGlossaryAppendix());
3276 $new_obj->setActiveDownloads($this->isActiveDownloads());
3277 $new_obj->setActiveDownloadsPublic($this->isActiveDownloadsPublic());
3278 $new_obj->setPublicNotes($this->publicNotes());
3279 $new_obj->setCleanFrames($this->cleanFrames());
3280 $new_obj->setHistoryUserComments($this->isActiveHistoryUserComments());
3281 $new_obj->setPublicAccessMode($this->getPublicAccessMode());
3282 $new_obj->setPageHeader($this->getPageHeader());
3283 $new_obj->setRating($this->hasRating());
3284 $new_obj->setRatingPages($this->hasRatingPages());
3285 $new_obj->setDisableDefaultFeedback($this->getDisableDefaultFeedback());
3286 $new_obj->setProgressIcons($this->getProgressIcons());
3287
3288 $new_obj->update();
3289
3290 $new_obj->createLMTree();
3291
3292 // copy style
3293 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
3294 $style_id = $this->getStyleSheetId();
3295 if ($style_id > 0 &&
3297 {
3298 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
3299 $new_id = $style_obj->ilClone();
3300 $new_obj->setStyleSheetId($new_id);
3301 $new_obj->update();
3302 }
3303
3304 // copy content
3305 $this->copyAllPagesAndChapters($new_obj, $a_copy_id);
3306
3307 // Copy learning progress settings
3308 include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
3309 $obj_settings = new ilLPObjSettings($this->getId());
3310 $obj_settings->cloneSettings($new_obj->getId());
3311 unset($obj_settings);
3312
3313 // copy (page) multilang settings
3314 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
3316 $ot->copy($new_obj->getId());
3317
3318 return $new_obj;
3319 }
3320
3326 function copyAllPagesAndChapters($a_target_obj, $a_copy_id = 0)
3327 {
3328 $parent_id = $a_target_obj->lm_tree->readRootId();
3329
3330 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
3331 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
3332
3333 // get all chapters of root lm
3334 $chapters = $this->lm_tree->getChildsByType($this->lm_tree->readRootId(), "st");
3335 $copied_nodes = array();
3336 //$time = time();
3337 foreach ($chapters as $chap)
3338 {
3339 $cid = ilLMObject::pasteTree($a_target_obj, $chap["child"], $parent_id,
3340 IL_LAST_NODE, $time, $copied_nodes, true, $this);
3341 $target = $cid;
3342 }
3343
3344 // copy free pages
3345 $pages = ilLMPageObject::getPageList($this->getId());
3346 foreach ($pages as $p)
3347 {
3348 if (!$this->lm_tree->isInTree($p["obj_id"]))
3349 {
3350 $item = new ilLMPageObject($this, $p["obj_id"]);
3351 $target_item = $item->copy($a_target_obj);
3352 $copied_nodes[$item->getId()] = $target_item->getId();
3353 }
3354 }
3355
3356 // Add mapping for pages and chapters
3357 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
3359 foreach($copied_nodes as $old_id => $new_id)
3360 {
3361 $options->appendMapping(
3362 $this->getRefId().'_'.$old_id,
3363 $a_target_obj->getRefId().'_'.$new_id
3364 );
3365 }
3366
3367 ilLMObject::updateInternalLinks($copied_nodes);
3368
3369 $a_target_obj->checkTree();
3370
3371 }
3372
3373
3380 function lookupAutoGlossaries($a_lm_id)
3381 {
3382 global $ilDB;
3383
3384 // read auto glossaries
3385 $set = $ilDB->query("SELECT * FROM lm_glossaries ".
3386 " WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer")
3387 );
3388 $glos = array();
3389 while ($rec = $ilDB->fetchAssoc($set))
3390 {
3391 $glos[] = $rec["glo_id"];
3392 }
3393 return $glos;
3394 }
3395
3402 function autoLinkGlossaryTerms($a_glo_id)
3403 {
3404 // get terms
3405 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
3406 $terms = ilGlossaryTerm::getTermList($a_glo_id);
3407
3408 // each get page: get content
3409 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
3410 $pages = ilLMPage::getAllPages($this->getType(), $this->getId());
3411
3412 // determine terms that occur in the page
3413 $found_pages = array();
3414 foreach ($pages as $p)
3415 {
3416 $pg = new ilLMPage($p["id"]);
3417 $c = $pg->getXMLContent();
3418 foreach ($terms as $t)
3419 {
3420 if (is_int(stripos($c, $t["term"])))
3421 {
3422 $found_pages[$p["id"]]["terms"][] = $t;
3423 if (!is_object($found_pages[$p["id"]]["page"]))
3424 {
3425 $found_pages[$p["id"]]["page"] = $pg;
3426 }
3427 }
3428 }
3429 reset($terms);
3430 }
3431
3432 // ilPCParagraph autoLinkGlossariesPage with page and terms
3433 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
3434 foreach ($found_pages as $id => $fp)
3435 {
3436 ilPCParagraph::autoLinkGlossariesPage($fp["page"], $fp["terms"]);
3437 }
3438
3439
3440 }
3441
3442
3446
3452 static function isOnlineHelpModule($a_id, $a_as_obj_id = false)
3453 {
3454 if (!$a_as_obj_id && $a_id > 0 && $a_id == OH_REF_ID)
3455 {
3456 return true;
3457 }
3458 if ($a_as_obj_id && $a_id > 0 && $a_id == ilObject::_lookupObjId(OH_REF_ID))
3459 {
3460 return true;
3461 }
3462 return false;
3463 }
3464
3465 public function setRating($a_value)
3466 {
3467 $this->rating = (bool)$a_value;
3468 }
3469
3470 public function hasRating()
3471 {
3472 return $this->rating;
3473 }
3474
3475 public function setRatingPages($a_value)
3476 {
3477 $this->rating_pages = (bool)$a_value;
3478 }
3479
3480 public function hasRatingPages()
3481 {
3482 return $this->rating_pages;
3483 }
3484
3485
3486}
3487?>
$result
print $file
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
const IL_CHAPTER_TITLE
const IL_MO_VERIFY_QTI
const IL_MO_PARSE_QTI
const IL_LAST_NODE
Definition: class.ilTree.php:4
const IL_FIRST_NODE
Definition: class.ilTree.php:5
_checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
_checkCondition($a_id, $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
Content Object Parser.
Export class for content objects.
Content Object (ILIAS native learning module / digilib book) Manifest export class.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static getLocalExplorerJsPath()
Get local path of explorer js.
static getLocalJsTreeJsPath()
Get local path of jsTree js.
static createHTMLExportDirs($a_target_dir)
Create html export directories.
static getTermList($a_glo_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null)
Get all terms for given set of glossary ids.
_createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
Import class.
getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static pasteTree($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
getObjectList($lm_id, $type="")
static
_deleteAllObjectData(&$a_cobj)
delete all objects of content object (digi book / learning module)
static _lookupTitle($a_obj_id)
Lookup title.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilLMPageObject.
getPageList($lm_id)
static
Extension of ilPageObject for learning modules.
Class ilLMPresentationGUI.
Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
Class ilObjContentObject.
_deleteStyleAssignments($a_style_id)
delete all style references to style
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
exportFO(&$a_xml_writer, $a_target_dir)
export object to fo
exportHTML($a_target_dir, $log, $a_zip_file=true, $a_export_format="html", $a_lang="")
export html package
exportPageHTML(&$a_lm_gui, $a_target_dir, $a_lm_page_id, $a_frame="", $a_exp_id_map=array())
export page html
exportHTMLGlossaryTerms(&$a_lm_gui, $a_target_dir)
export glossary terms
putInTree($a_parent)
put content object in main tree
updateProperties()
Update content object properties.
setAutoGlossaries($a_val)
Set auto glossaries.
getAvailableLayouts()
get all available lm layouts
setTitle($a_title)
set title of content object
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
getLayoutPerPage()
Get layout per page.
createProperties()
create new properties record
& getLMTree()
get content object tree
exportSCORM($a_target_dir, $log)
export scorm package
getRestrictForwardNavigation()
Get restrict forward navigation.
getDataDirectory()
get data directory
importFromZipFile($a_tmp_file, $a_filename, $a_validate=true, $a_import_into_help_module=0)
Import lm from zip file.
getHideHeaderFooterPrint()
Get hide header footer in print mode.
exportHTMLFile($a_target_dir, $a_file_id)
export file object
copyAllPagesAndChapters($a_target_obj, $a_copy_id=0)
Copy all pages and chapters.
update()
update complete object (meta data and properties)
getTOCMode()
get toc mode ("chapters" | "pages")
importFromDirectory($a_directory, $a_validate=true)
Import lm from directory.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
getExportDirectory($a_type="xml")
get export directory of lm
_getMissingPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
gets all missing preconditions of page
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
static _lookupRestrictForwardNavigation($a_obj_id)
Lookup forward restriction navigation.
setImportDirectory($a_import_dir)
Set import directory for further use in ilContObjParser.
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
_lookupOnline($a_id)
check wether content object is online
_moveLMStyles($a_from_style, $a_to_style)
move learning modules from one style to another
_getNrOfAssignedLMs($a_style_id)
gets the number of learning modules assigned to a content style
getTitle()
get title of content object
static _lookupStoreTries($a_id)
Lookup disable default feedback.
createImportDirectory()
creates data directory for import files (data_dir/lm_data/lm_<id>/import, depending on data directory...
create($a_no_meta_data=false)
create content object
getAutoGlossaries()
Get auto glossaries.
static getSupplyingExportFiles($a_target_dir=".")
Get supplying export files.
_lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
writeStyleSheetId($a_style_id)
write ID of assigned style sheet object to db
setPageHeader($a_pg_header=IL_CHAPTER_TITLE)
set page header mode
_checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
removeAutoGlossary($a_glo_id)
Remove auto glossary.
setProgressIcons($a_val)
Set progress icons.
setLayoutPerPage($a_val)
Set layout per page.
createLMTree()
create content object tree (that stores structure object hierarchie)
exportHTMLPages(&$a_lm_gui, $a_target_dir, $a_lang="")
export all pages of learning module to html file
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
getExportFiles()
get export files
getLayout()
get default page layout of content object (see directory layouts/)
getDescription()
get description of content object
exportHTMLMOB($a_target_dir, &$a_lm_gui, $a_mob_id, $a_frame, &$a_linked_mobs)
export media object to html
getPageHeader()
get page header mode (IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER)
exportXMLProperties($a_xml_writer, &$expLog)
export properties of content object
static _lookup($a_obj_id, $a_field)
Lookup property.
getPublicAccessMode()
get public access mode ("complete" | "selected")
setRestrictForwardNavigation($a_val)
Set restrict forward navigation.
getImportDirectory()
get import directory of lm
setDisableDefaultFeedback($a_val)
Set disable default feedback for questions.
addFirstChapterAndPage()
Add first chapter and page.
setImportId($a_id)
set import id
readProperties()
read content object properties
getStyleSheetId()
get ID of assigned style sheet object
setHideHeaderFooterPrint($a_val)
Set hide header footer in print mode.
exportXMLStructureObjects(&$a_xml_writer, $a_inst, &$expLog)
export structure objects to xml (see ilias_co.dtd)
hasSuccessorPage($a_cont_obj_id, $a_page_id)
checks if page has a successor page
setDescription($a_description)
set description of content object
executeDragDrop($source_id, $target_id, $first_child, $as_subitem=false, $movecopy="move")
Execute Drag Drop Action.
setPublicExportFile($a_type, $a_file)
specify public export file for type
validatePages()
Validate all pages.
ilObjContentObject($a_id=0, $a_call_by_reference=true)
Constructor @access public.
getStoreTries()
Get store tries.
read()
read data of content object
exportFOStructureObjects(&$a_xml_writer)
export structure objects to fo
updateAutoGlossaries()
Update auto glossaries.
createExportDirectory($a_type="xml")
creates data directory for export files (data_dir/lm_data/lm_<id>/export, depending on data directory...
setStoreTries($a_val)
Set store tries.
setTOCMode($a_toc_mode="chapters")
set toc mode
getProgressIcons()
Get progress icons.
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
static _lookupDisableDefaultFeedback($a_id)
Lookup disable default feedback.
_getNrLMsNoStyle()
get number of learning modules assigned no style
_getNrLMsIndividualStyles()
get number of learning modules with individual styles
exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export object to xml (see ilias_co.dtd)
lookupAutoGlossaries($a_lm_id)
Lookup auto glossaries.
setLayout($a_layout)
set default page layout
getOfflineFiles($dir)
get offline files
getDisableDefaultFeedback()
Get disable default feedback for questions.
getPublicExportFile($a_type)
get public export file
_getMissingPreconditionsTopChapter($cont_obj_ref_id, $cont_obj_id, $page_id)
get top chapter of page for that any precondition is missing
cloneObject($a_target_id, $a_copy_id=0)
Clone learning module.
autoLinkGlossaryTerms($a_glo_id)
Auto link glossary terms.
Class ilObjFile.
_getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
Class ilObjMediaObject.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
Class ilObjStyleSheet.
getSyntaxStylePath()
get syntax style path
_lookupStandard($a_id)
Lookup standard flag.
static getInstance($a_obj_id)
Get instance.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _lookupObjId($a_id)
MDUpdateListener($a_element)
Meta data update listener.
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
deleteMetaData()
delete meta data entry
updateMetaData()
update meta data entry
createMetaData()
create meta data entry
getRefId()
get reference id @access public
cloneMetaData($target_obj)
Copy meta data.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
_writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
static autoLinkGlossariesPage($a_page, $a_terms)
Auto link glossary of whole page.
static resetInitialState()
Reset initial state (for exports)
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
getUsagesOfPage($a_usage_id, $a_usage_type, $a_hist_nr=0, $a_all_hist_nrs=false, $a_lang="-")
Get page content usages for page.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
static _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
Change targest of repository links.
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
getLocalMediaElementCssPath()
Get local path of jQuery file.
static getFlashVideoPlayerDirectory()
Get flash video player directory.
getLocalMediaElementJsPath()
Get local path of jQuery file.
copyPlayerFilesToTargetDirectory($a_target_dir)
Copy css files to target dir.
ILIAS Setting Class.
Class ilStructreObject.
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 getDataDir()
get data directory (outside webspace)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static tf2yn($a_tf)
convert true/false to "y"/"n"
static getWebspaceDir($mode="filesystem")
get webspace directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static zip($a_dir, $a_file, $compress_content=false)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static yn2tf($a_yn)
convert "y"/"n" to true/false
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getLocalPath($a_name="")
Get local path of a YUI js file.
getLocalMaphilightPath()
Get local path of maphilight file.
getLocaljQueryPath()
Get local path of jQuery file.
getLocaljQueryUIPath()
Get local path of jQuery UI file.
$GLOBALS['ct_recipient']
$target_id
Definition: goto.php:88
global $ilBench
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
$path
Definition: index.php:22
global $ilDB
$lm_set
if(!is_array($argv)) $options
$mobs
global $ilUser
Definition: imgupload.php:15
if(strpos( $jquery_path, './')===0) else if(strpos($jquery_path, '.')===0) $mathJaxSetting
Definition: latex.php:34