5 require_once(
"./Services/Object/classes/class.ilObject.php");
6 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
7 include_once(
"./Services/AdvancedMetaData/interfaces/interface.ilAdvancedMetaDataSubItems.php");
30 $this->
ilObject($a_id,$a_call_by_reference);
49 $ilDB->manipulate(
"INSERT INTO glossary (id, is_online, virtual, pres_mode, snippet_length) VALUES (".
50 $ilDB->quote($this->getId(),
"integer").
",".
51 $ilDB->quote(
"n",
"text").
",".
53 $ilDB->quote(
"table",
"text").
",".
54 $ilDB->quote(200,
"integer").
61 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
75 # echo "Glossary<br>\n";
77 $q =
"SELECT * FROM glossary WHERE id = ".
78 $ilDB->quote($this->
getId(),
"integer");
79 $gl_set = $ilDB->query($q);
80 $gl_rec = $ilDB->fetchAssoc($gl_set);
91 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
125 $this->virtual_mode = $a_mode;
126 $this->
virtual =
true;
130 $this->virtual_mode =
"none";
131 $this->
virtual =
false;
141 return $this->virtual_mode;
149 return $this->virtual;
178 $this->pres_mode = $a_val;
188 return $this->pres_mode;
198 $this->snippet_length = $a_val;
208 return ($this->snippet_length > 0)
209 ? $this->snippet_length
215 $this->online = $a_online;
220 return $this->online;
230 $q =
"SELECT is_online FROM glossary WHERE id = ".
231 $ilDB->quote($a_id,
"integer");
233 $lm_rec = $ilDB->fetchAssoc(
$lm_set);
244 static protected function lookup($a_id, $a_property)
248 $set = $ilDB->query(
"SELECT $a_property FROM glossary WHERE id = ".
249 $ilDB->quote($a_id,
"integer"));
250 $rec = $ilDB->fetchAssoc($set);
252 return $rec[$a_property];
269 $this->glo_menu_active = $a_act_glo_menu;
274 return $this->glo_menu_active;
279 $this->downloads_active = $a_down;
284 return $this->downloads_active;
292 return $this->style_id;
300 $this->style_id = $a_style_id;
311 $this->show_tax = $a_val;
321 return $this->show_tax;
333 $ilDB->manipulate(
"UPDATE glossary SET ".
334 " is_online = ".$ilDB->quote(
ilUtil::tf2yn($this->getOnline()),
"text").
",".
341 " show_tax = ".$ilDB->quote((
int) $this->
getShowTaxonomy(),
"integer").
", ".
342 " snippet_length = ".$ilDB->quote((
int)$this->
getSnippetLength(),
"integer").
" ".
343 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer"));
345 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
355 function getTermList($searchterm =
"", $a_letter =
"", $a_def =
"", $a_tax_node = 0, $a_include_offline_childs =
false,
356 $a_add_amet_fields =
false, array $a_amet_filter = null, $a_omit_virtual =
false)
360 $glo_ids[] = $this->
getId();
367 $a_add_amet_fields, $a_amet_filter);
378 return $first_letters;
396 switch ($virtual_mode)
399 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),
"glo");
400 $glo_ids[] = $this->
getId();
401 foreach ($glo_arr as $glo)
404 $glo_ids[] = $glo[
'obj_id'];
407 if (!$a_include_offline_childs)
413 if (!in_array($this->
getId(), $glo_ids))
415 $glo_ids[] = $this->
getId();
420 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
422 foreach ($subtree_nodes as $node)
424 if ($node[
'type'] ==
'glo')
426 $glo_ids[] = $node[
'obj_id'];
429 if (!$a_include_offline_childs)
435 if (!in_array($this->
getId(), $glo_ids))
437 $glo_ids[] = $this->
getId();
443 $glo_ids[] = $this->
getId();
449 $glo_ids = $this->
getId();
464 if(!is_writable($glo_data_dir))
466 $this->ilias->raiseError(
"Glossary Data Directory (".$glo_data_dir
467 .
") not writeable.",$this->ilias->error_obj->FATAL);
471 $glo_dir = $glo_data_dir.
"/glo_".$this->
getId();
473 if(!@is_dir($glo_dir))
475 $this->ilias->raiseError(
"Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
478 $import_dir = $glo_dir.
"/import";
480 if(!@is_dir($import_dir))
482 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
501 include_once(
"./Services/Export/classes/class.ilExport.php");
510 include_once(
"./Services/Export/classes/class.ilExport.php");
519 include_once(
"./Services/Export/classes/class.ilExport.php");
531 $this->public_export_file[$a_type] = $a_file;
543 return $this->public_export_file[$a_type];
557 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
559 $this->co_page_html_export->createDirectories();
563 $style_name = $ilias->account->prefs[
"style"].
".css";
564 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
569 $cont_stylesheet =
"Services/COPage/css/content.css";
570 copy($cont_stylesheet, $a_target_dir.
"/content.css");
574 $content_style_img_dir = $a_target_dir.
"/images";
577 $style->writeCSSFile($a_target_dir.
"/content.css",
"images");
578 $style->copyImagesToDir($content_style_img_dir);
583 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
586 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
587 $_GET[
"cmd"] =
"nop";
589 $glo_gui->setOfflineMode(
true);
590 $glo_gui->setOfflineDirectory($a_target_dir);
600 foreach ($this->offline_mobs as $mob)
602 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
604 $_GET[
"obj_type"] =
"MediaObject";
605 $_GET[
"obj_id"] = $a_mob_id;
609 foreach ($this->offline_files as
$file)
615 $image_dir = $a_target_dir.
"/images";
619 $image_dir.
"/enlarge.svg");
621 $image_dir.
"/browser/plus.png");
623 $image_dir.
"/browser/minus.png");
625 $image_dir.
"/browser/blank.png");
627 $image_dir.
"/icon_st.svg");
629 $image_dir.
"/icon_pg.svg");
631 $image_dir.
"/nav_arr_L.png");
633 $image_dir.
"/nav_arr_R.png");
636 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
637 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
638 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
661 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
663 $copage_export->exportSupportScripts();
666 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
667 $style_name = $ilUser->prefs[
"style"].
".css";;
668 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
669 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
670 $a_glo_gui->tpl->setTitle($this->
getTitle());
672 $content = $a_glo_gui->listTerms();
673 $file = $a_target_dir.
"/index.html";
676 if (!($fp = @fopen(
$file,
"w+")))
678 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
679 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
682 fwrite($fp, $content);
687 $this->offline_mobs = array();
688 $this->offline_files = array();
690 foreach($terms as $term)
692 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
693 $a_glo_gui->tpl = $copage_export->getPreparedMainTemplate();
697 $style_name = $ilUser->prefs[
"style"].
".css";;
698 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
700 $_GET[
"term_id"] = $term[
"id"];
701 $_GET[
"frame"] =
"_blank";
702 $content =& $a_glo_gui->listDefinitions(
$_GET[
"ref_id"],$term[
"id"],
false);
703 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
706 if (!($fp = @fopen(
$file,
"w+")))
708 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
709 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
712 fwrite($fp, $content);
716 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
718 foreach($defs as $def)
721 foreach($def_mobs as $def_mob)
723 $this->offline_mobs[$def_mob] = $def_mob;
727 include_once(
"./Modules/File/classes/class.ilObjFile.php");
729 $this->offline_files = array_merge($this->offline_files, $def_files);
742 $mob_dir = $a_target_dir.
"/mobs";
745 if (@is_dir($source_dir))
751 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
752 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
753 $_GET[
"obj_type"] =
"MediaObject";
754 $_GET[
"mob_id"] = $a_mob_id;
756 $content =& $a_glo_gui->media();
757 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
760 if (!($fp = @fopen(
$file,
"w+")))
762 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
763 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
766 fwrite($fp, $content);
770 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
772 if ($mob_obj->hasFullscreenItem())
774 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
775 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
776 $_GET[
"mob_id"] = $a_mob_id;
777 $_GET[
"cmd"] =
"fullscreen";
778 $content = $a_glo_gui->fullscreen();
779 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
782 if (!($fp = @fopen(
$file,
"w+")))
784 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
785 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
788 fwrite($fp, $content);
798 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
800 include_once(
"./Modules/File/classes/class.ilObjFile.php");
801 $file_obj =
new ilObjFile($a_file_id,
false);
802 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
803 if (!is_file($source_file))
805 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
807 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
817 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
823 $attrs[
"Type"] =
"Glossary";
824 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
831 $this->mob_ids = array();
832 $this->file_ids = array();
833 foreach ($terms as $term)
835 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
839 foreach($defs as $def)
842 $this->page_object->buildDom();
843 $this->page_object->insertInstIntoIDs(IL_INST_ID);
844 $mob_ids = $this->page_object->collectMediaObjects(
false);
845 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
847 foreach($mob_ids as $mob_id)
849 $this->mob_ids[$mob_id] = $mob_id;
851 foreach($file_ids as $file_id)
853 $this->file_ids[$file_id] = $file_id;
859 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
860 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
862 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
863 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
866 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
867 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
869 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
870 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
873 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
874 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
876 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
877 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
879 $a_xml_writer->xmlEndTag(
"ContentObject");
893 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
902 foreach ($terms as $term)
904 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
905 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
908 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
910 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
911 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
912 $glo_term->exportXML($a_xml_writer, $a_inst);
913 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
917 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
920 $a_xml_writer->xmlEndTag(
"Glossary");
931 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
933 $md2xml->setExportMode(
true);
934 $md2xml->startExport();
935 $a_xml_writer->appendXML($md2xml->getXML());
946 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
948 foreach ($this->mob_ids as $mob_id)
950 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
952 $media_obj->exportXML($a_xml_writer, $a_inst);
953 $media_obj->exportFiles($a_target_dir);
964 include_once(
"./Modules/File/classes/class.ilObjFile.php");
966 foreach ($this->file_ids as $file_id)
968 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
969 $file_obj =
new ilObjFile($file_id,
false);
970 $file_obj->export($a_target_dir);
982 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
984 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
1008 if (!parent::delete())
1017 foreach ($terms as $term)
1020 $term_obj->delete();
1025 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
1049 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1089 if ($a_node_id==
$_GET[
"ref_id"])
1091 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1092 $parent_type = $parent_obj->getType();
1093 if($parent_type == $this->
getType())
1095 $a_node_id = (int) $tree->getParentId($a_node_id);
1099 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1108 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
1110 return $glo_exp->buildExportFile();
1122 include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
1124 foreach ($sms as $sm)
1126 $lng->loadLanguageModule(
"content");
1127 $dep[$sm] = $lng->txt(
"glo_used_in_scorm");
1141 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1143 if (count($tax_ids) > 0)
1168 if(!$cp_options->isRootNode($this->getRefId()))
1170 $new_obj->setOnline($this->
getOnline());
1181 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1185 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1186 $new_id = $style_obj->ilClone();
1187 $new_obj->setStyleSheetId($new_id);
1195 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1197 $new_tax = $tax->cloneObject(0,0,
true);
1198 $map = $tax->getNodeMapping();
1208 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
1212 $new_tax_ass =
new ilTaxNodeAssignment(
"glo", $new_obj->getId(),
"term", $new_tax->getId());
1223 $assignmts = $tax_ass->getAssignmentsOfItem($term[
"id"]);
1224 foreach ($assignmts as $a)
1226 if ($map[$a[
"node_id"]] > 0)
1228 $new_tax_ass->addAssignment($map[$a[
"node_id"]] ,$new_term_id);
1247 $set = $ilDB->query(
"SELECT id FROM glossary ".
1248 " WHERE ".$ilDB->in(
"id", $a_glo_ids,
false,
"integer").
1249 " AND is_online = ".$ilDB->quote(
"y",
"text")
1252 while ($rec = $ilDB->fetchAssoc($set))
1254 $glo_ids[] = $rec[
"id"];
1263 if($a_sub_type ==
"term")
1265 $lng->loadLanguageModule(
"glo");
1267 include_once
"Modules/Glossary/classes/class.ilGlossaryTerm.php";