5 require_once(
"./Services/Object/classes/class.ilObject.php");
6 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
29 $this->
ilObject($a_id,$a_call_by_reference);
48 $ilDB->manipulate(
"INSERT INTO glossary (id, is_online, virtual, pres_mode, snippet_length) VALUES (".
49 $ilDB->quote($this->getId(),
"integer").
",".
50 $ilDB->quote(
"n",
"text").
",".
52 $ilDB->quote(
"table",
"text").
",".
53 $ilDB->quote(200,
"integer").
60 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
74 # echo "Glossary<br>\n";
76 $q =
"SELECT * FROM glossary WHERE id = ".
77 $ilDB->quote($this->
getId(),
"integer");
78 $gl_set = $ilDB->query($q);
79 $gl_rec = $ilDB->fetchAssoc($gl_set);
90 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
124 $this->virtual_mode = $a_mode;
125 $this->
virtual =
true;
129 $this->virtual_mode =
"none";
130 $this->
virtual =
false;
140 return $this->virtual_mode;
148 return $this->virtual;
177 $this->pres_mode = $a_val;
187 return $this->pres_mode;
197 $this->snippet_length = $a_val;
207 return $this->snippet_length;
212 $this->online = $a_online;
217 return $this->online;
227 $q =
"SELECT is_online FROM glossary WHERE id = ".
228 $ilDB->quote($a_id,
"integer");
229 $lm_set = $ilDB->query($q);
230 $lm_rec = $ilDB->fetchAssoc($lm_set);
241 static protected function lookup($a_id, $a_property)
245 $set = $ilDB->query(
"SELECT $a_property FROM glossary WHERE id = ".
246 $ilDB->quote($a_id,
"integer"));
247 $rec = $ilDB->fetchAssoc($set);
249 return $rec[$a_property];
266 $this->glo_menu_active = $a_act_glo_menu;
271 return $this->glo_menu_active;
276 $this->downloads_active = $a_down;
281 return $this->downloads_active;
289 return $this->style_id;
297 $this->style_id = $a_style_id;
308 $this->show_tax = $a_val;
318 return $this->show_tax;
330 $ilDB->manipulate(
"UPDATE glossary SET ".
331 " is_online = ".$ilDB->quote(
ilUtil::tf2yn($this->getOnline()),
"text").
",".
338 " show_tax = ".$ilDB->quote((
int) $this->
getShowTaxonomy(),
"integer").
", ".
339 " snippet_length = ".$ilDB->quote($this->
getSnippetLength(),
"integer").
" ".
340 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer"));
342 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
352 function getTermList($searchterm =
"", $a_letter =
"", $a_def =
"", $a_tax_node = 0, $a_include_offline_childs =
false,
353 $a_add_amet_fields =
false, $a_amet_filter =
"")
357 $a_add_amet_fields, $a_amet_filter);
368 return $first_letters;
386 switch ($virtual_mode)
389 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),
"glo");
390 $glo_ids[] = $this->
getId();
391 foreach ($glo_arr as $glo)
394 $glo_ids[] = $glo[
'obj_id'];
397 if (!$a_include_offline_childs)
404 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
406 foreach ($subtree_nodes as $node)
408 if ($node[
'type'] ==
'glo')
410 $glo_ids[] = $node[
'obj_id'];
413 if (!$a_include_offline_childs)
421 $glo_ids[] = $this->
getId();
427 $glo_ids = $this->
getId();
442 if(!is_writable($glo_data_dir))
444 $this->ilias->raiseError(
"Glossary Data Directory (".$glo_data_dir
445 .
") not writeable.",$this->ilias->error_obj->FATAL);
449 $glo_dir = $glo_data_dir.
"/glo_".$this->
getId();
451 if(!@is_dir($glo_dir))
453 $this->ilias->raiseError(
"Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
456 $import_dir = $glo_dir.
"/import";
458 if(!@is_dir($import_dir))
460 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
479 include_once(
"./Services/Export/classes/class.ilExport.php");
488 include_once(
"./Services/Export/classes/class.ilExport.php");
497 include_once(
"./Services/Export/classes/class.ilExport.php");
509 $this->public_export_file[$a_type] = $a_file;
521 return $this->public_export_file[$a_type];
535 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
537 $this->co_page_html_export->createDirectories();
541 $style_name = $ilias->account->prefs[
"style"].
".css";
542 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
547 $cont_stylesheet =
"Services/COPage/css/content.css";
548 copy($cont_stylesheet, $a_target_dir.
"/content.css");
552 $content_style_img_dir = $a_target_dir.
"/images";
555 $style->writeCSSFile($a_target_dir.
"/content.css",
"images");
556 $style->copyImagesToDir($content_style_img_dir);
561 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
564 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
565 $_GET[
"cmd"] =
"nop";
567 $glo_gui->setOfflineMode(
true);
568 $glo_gui->setOfflineDirectory($a_target_dir);
578 foreach ($this->offline_mobs as $mob)
580 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
582 $_GET[
"obj_type"] =
"MediaObject";
583 $_GET[
"obj_id"] = $a_mob_id;
587 foreach ($this->offline_files as
$file)
593 $image_dir = $a_target_dir.
"/images";
597 $image_dir.
"/enlarge.png");
599 $image_dir.
"/browser/plus.png");
601 $image_dir.
"/browser/minus.png");
603 $image_dir.
"/browser/blank.png");
605 $image_dir.
"/icon_st.png");
607 $image_dir.
"/icon_pg.png");
609 $image_dir.
"/nav_arr_L.png");
611 $image_dir.
"/nav_arr_R.png");
614 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
615 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
616 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
639 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
641 $copage_export->exportSupportScripts();
644 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
645 $style_name = $ilUser->prefs[
"style"].
".css";;
646 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
647 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
648 $a_glo_gui->tpl->setTitle($this->
getTitle());
650 $content = $a_glo_gui->listTerms();
651 $file = $a_target_dir.
"/index.html";
654 if (!($fp = @fopen(
$file,
"w+")))
656 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
657 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
660 fwrite($fp, $content);
665 $this->offline_mobs = array();
666 $this->offline_files = array();
668 foreach($terms as $term)
670 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
671 $a_glo_gui->tpl = $copage_export->getPreparedMainTemplate();
675 $style_name = $ilUser->prefs[
"style"].
".css";;
676 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
678 $_GET[
"term_id"] = $term[
"id"];
679 $_GET[
"frame"] =
"_blank";
680 $content =& $a_glo_gui->listDefinitions(
$_GET[
"ref_id"],$term[
"id"],
false);
681 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
684 if (!($fp = @fopen(
$file,
"w+")))
686 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
687 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
690 fwrite($fp, $content);
694 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
696 foreach($defs as $def)
699 foreach($def_mobs as $def_mob)
701 $this->offline_mobs[$def_mob] = $def_mob;
705 include_once(
"./Modules/File/classes/class.ilObjFile.php");
707 $this->offline_files = array_merge($this->offline_files, $def_files);
720 $mob_dir = $a_target_dir.
"/mobs";
723 if (@is_dir($source_dir))
729 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
730 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
731 $_GET[
"obj_type"] =
"MediaObject";
732 $_GET[
"mob_id"] = $a_mob_id;
734 $content =& $a_glo_gui->media();
735 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
738 if (!($fp = @fopen(
$file,
"w+")))
740 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
741 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
744 fwrite($fp, $content);
748 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
750 if ($mob_obj->hasFullscreenItem())
752 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
753 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
754 $_GET[
"mob_id"] = $a_mob_id;
755 $_GET[
"cmd"] =
"fullscreen";
756 $content = $a_glo_gui->fullscreen();
757 $file = $a_target_dir.
"/fullscreen_".$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);
776 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
778 include_once(
"./Modules/File/classes/class.ilObjFile.php");
779 $file_obj =
new ilObjFile($a_file_id,
false);
780 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
781 if (!is_file($source_file))
783 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
785 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
795 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
801 $attrs[
"Type"] =
"Glossary";
802 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
809 $this->mob_ids = array();
810 $this->file_ids = array();
811 foreach ($terms as $term)
813 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
817 foreach($defs as $def)
820 $this->page_object->buildDom();
821 $this->page_object->insertInstIntoIDs(IL_INST_ID);
822 $mob_ids = $this->page_object->collectMediaObjects(
false);
823 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
825 foreach($mob_ids as $mob_id)
827 $this->mob_ids[$mob_id] = $mob_id;
829 foreach($file_ids as $file_id)
831 $this->file_ids[$file_id] = $file_id;
837 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
838 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
840 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
841 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
844 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
845 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
847 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
848 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
851 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
852 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
854 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
855 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
857 $a_xml_writer->xmlEndTag(
"ContentObject");
871 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
880 foreach ($terms as $term)
882 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
883 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
886 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
888 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
889 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
890 $glo_term->exportXML($a_xml_writer, $a_inst);
891 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
895 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
898 $a_xml_writer->xmlEndTag(
"Glossary");
909 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
911 $md2xml->setExportMode(
true);
912 $md2xml->startExport();
913 $a_xml_writer->appendXML($md2xml->getXML());
924 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
926 foreach ($this->mob_ids as $mob_id)
928 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
930 $media_obj->exportXML($a_xml_writer, $a_inst);
931 $media_obj->exportFiles($a_target_dir);
942 include_once(
"./Modules/File/classes/class.ilObjFile.php");
944 foreach ($this->file_ids as $file_id)
946 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
947 $file_obj =
new ilObjFile($file_id,
false);
948 $file_obj->export($a_target_dir);
960 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
962 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
986 if (!parent::delete())
995 foreach ($terms as $term)
1003 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
1027 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1067 if ($a_node_id==
$_GET[
"ref_id"])
1069 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1070 $parent_type = $parent_obj->getType();
1071 if($parent_type == $this->
getType())
1073 $a_node_id = (int) $tree->getParentId($a_node_id);
1077 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1086 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
1088 return $glo_exp->buildExportFile();
1100 include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
1102 foreach ($sms as $sm)
1104 $lng->loadLanguageModule(
"content");
1105 $dep[$sm] = $lng->txt(
"glo_used_in_scorm");
1119 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1121 if (count($tax_ids) > 0)
1143 $new_obj->setTitle($this->
getTitle());
1151 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1155 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1156 $new_id = $style_obj->ilClone();
1157 $new_obj->setStyleSheetId($new_id);
1165 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1167 $new_tax = $tax->cloneObject(0,0,
true);
1168 $map = $tax->getNodeMapping();
1178 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
1182 $new_tax_ass =
new ilTaxNodeAssignment(
"glo", $new_obj->getId(),
"term", $new_tax->getId());
1193 $assignmts = $tax_ass->getAssignmentsOfItem($term[
"id"]);
1194 foreach ($assignmts as $a)
1196 if ($map[$a[
"node_id"]] > 0)
1198 $new_tax_ass->addAssignment($map[$a[
"node_id"]] ,$new_term_id);
1217 $set = $ilDB->query(
"SELECT id FROM glossary ".
1218 " WHERE ".$ilDB->in(
"id", $a_glo_ids,
false,
"integer").
1219 " AND is_online = ".$ilDB->quote(
"y",
"text")
1222 while ($rec = $ilDB->fetchAssoc($set))
1224 $glo_ids[] = $rec[
"id"];