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)
367 return $first_letters;
385 switch ($virtual_mode)
388 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),
"glo");
389 $glo_ids[] = $this->
getId();
390 foreach ($glo_arr as $glo)
393 $glo_ids[] = $glo[
'obj_id'];
396 if (!$a_include_offline_childs)
403 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
405 foreach ($subtree_nodes as $node)
407 if ($node[
'type'] ==
'glo')
409 $glo_ids[] = $node[
'obj_id'];
412 if (!$a_include_offline_childs)
420 $glo_ids[] = $this->
getId();
426 $glo_ids = $this->
getId();
441 if(!is_writable($glo_data_dir))
443 $this->ilias->raiseError(
"Glossary Data Directory (".$glo_data_dir
444 .
") not writeable.",$this->ilias->error_obj->FATAL);
448 $glo_dir = $glo_data_dir.
"/glo_".$this->
getId();
450 if(!@is_dir($glo_dir))
452 $this->ilias->raiseError(
"Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
455 $import_dir = $glo_dir.
"/import";
457 if(!@is_dir($import_dir))
459 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
478 include_once(
"./Services/Export/classes/class.ilExport.php");
487 include_once(
"./Services/Export/classes/class.ilExport.php");
496 include_once(
"./Services/Export/classes/class.ilExport.php");
508 $this->public_export_file[$a_type] = $a_file;
520 return $this->public_export_file[$a_type];
534 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
536 $this->co_page_html_export->createDirectories();
540 $style_name = $ilias->account->prefs[
"style"].
".css";
541 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
546 $cont_stylesheet =
"Services/COPage/css/content.css";
547 copy($cont_stylesheet, $a_target_dir.
"/content.css");
551 $content_style_img_dir = $a_target_dir.
"/images";
554 $style->writeCSSFile($a_target_dir.
"/content.css",
"images");
555 $style->copyImagesToDir($content_style_img_dir);
560 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
563 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
564 $_GET[
"cmd"] =
"nop";
566 $glo_gui->setOfflineMode(
true);
567 $glo_gui->setOfflineDirectory($a_target_dir);
577 foreach ($this->offline_mobs as $mob)
579 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
581 $_GET[
"obj_type"] =
"MediaObject";
582 $_GET[
"obj_id"] = $a_mob_id;
586 foreach ($this->offline_files as
$file)
592 $image_dir = $a_target_dir.
"/images";
596 $image_dir.
"/enlarge.png");
598 $image_dir.
"/browser/plus.png");
600 $image_dir.
"/browser/minus.png");
602 $image_dir.
"/browser/blank.png");
604 $image_dir.
"/icon_st.png");
606 $image_dir.
"/icon_pg.png");
608 $image_dir.
"/nav_arr_L.png");
610 $image_dir.
"/nav_arr_R.png");
613 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
614 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
615 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
638 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
640 $copage_export->exportSupportScripts();
643 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
644 $style_name = $ilUser->prefs[
"style"].
".css";;
645 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
646 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
647 $a_glo_gui->tpl->setTitle($this->
getTitle());
649 $content = $a_glo_gui->listTerms();
650 $file = $a_target_dir.
"/index.html";
653 if (!($fp = @fopen(
$file,
"w+")))
655 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
656 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
659 fwrite($fp, $content);
664 $this->offline_mobs = array();
665 $this->offline_files = array();
667 foreach($terms as $term)
669 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
670 $a_glo_gui->tpl = $copage_export->getPreparedMainTemplate();
674 $style_name = $ilUser->prefs[
"style"].
".css";;
675 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
677 $_GET[
"term_id"] = $term[
"id"];
678 $_GET[
"frame"] =
"_blank";
679 $content =& $a_glo_gui->listDefinitions(
$_GET[
"ref_id"],$term[
"id"],
false);
680 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
683 if (!($fp = @fopen(
$file,
"w+")))
685 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
686 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
689 fwrite($fp, $content);
693 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
695 foreach($defs as $def)
698 foreach($def_mobs as $def_mob)
700 $this->offline_mobs[$def_mob] = $def_mob;
704 include_once(
"./Modules/File/classes/class.ilObjFile.php");
706 $this->offline_files = array_merge($this->offline_files, $def_files);
719 $mob_dir = $a_target_dir.
"/mobs";
722 if (@is_dir($source_dir))
728 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
729 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
730 $_GET[
"obj_type"] =
"MediaObject";
731 $_GET[
"mob_id"] = $a_mob_id;
733 $content =& $a_glo_gui->media();
734 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
737 if (!($fp = @fopen(
$file,
"w+")))
739 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
740 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
743 fwrite($fp, $content);
747 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
749 if ($mob_obj->hasFullscreenItem())
751 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
752 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
753 $_GET[
"mob_id"] = $a_mob_id;
754 $_GET[
"cmd"] =
"fullscreen";
755 $content = $a_glo_gui->fullscreen();
756 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
759 if (!($fp = @fopen(
$file,
"w+")))
761 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
762 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
765 fwrite($fp, $content);
775 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
777 include_once(
"./Modules/File/classes/class.ilObjFile.php");
778 $file_obj =
new ilObjFile($a_file_id,
false);
779 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
780 if (!is_file($source_file))
782 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
784 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
794 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
800 $attrs[
"Type"] =
"Glossary";
801 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
808 $this->mob_ids = array();
809 $this->file_ids = array();
810 foreach ($terms as $term)
812 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
816 foreach($defs as $def)
819 $def[
"id"], $this->halt_on_error);
820 $this->page_object->buildDom();
821 $this->page_object->insertInstIntoIDs(IL_INST_ID);
822 $mob_ids = $this->page_object->collectMediaObjects(
false);
823 $file_ids = $this->page_object->collectFileItems();
824 foreach($mob_ids as $mob_id)
826 $this->mob_ids[$mob_id] = $mob_id;
828 foreach($file_ids as $file_id)
830 $this->file_ids[$file_id] = $file_id;
836 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
837 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
839 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
840 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
843 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
844 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
846 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
847 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
850 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
851 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
853 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
854 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
856 $a_xml_writer->xmlEndTag(
"ContentObject");
870 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
879 foreach ($terms as $term)
881 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
882 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
885 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
887 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
888 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
889 $glo_term->exportXML($a_xml_writer, $a_inst);
890 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
905 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
908 $a_xml_writer->xmlEndTag(
"Glossary");
919 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
921 $md2xml->setExportMode(
true);
922 $md2xml->startExport();
923 $a_xml_writer->appendXML($md2xml->getXML());
934 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
936 foreach ($this->mob_ids as $mob_id)
938 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
940 $media_obj->exportXML($a_xml_writer, $a_inst);
941 $media_obj->exportFiles($a_target_dir);
952 include_once(
"./Modules/File/classes/class.ilObjFile.php");
954 foreach ($this->file_ids as $file_id)
956 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
957 $file_obj =
new ilObjFile($file_id,
false);
958 $file_obj->export($a_target_dir);
970 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
972 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
996 if (!parent::delete())
1005 foreach ($terms as $term)
1008 $term_obj->delete();
1013 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
1037 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1077 if ($a_node_id==
$_GET[
"ref_id"])
1079 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1080 $parent_type = $parent_obj->getType();
1081 if($parent_type == $this->
getType())
1083 $a_node_id = (int) $tree->getParentId($a_node_id);
1087 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1096 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
1098 return $glo_exp->buildExportFile();
1110 include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
1112 foreach ($sms as $sm)
1114 $lng->loadLanguageModule(
"content");
1115 $dep[$sm] = $lng->txt(
"glo_used_in_scorm");
1129 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1131 if (count($tax_ids) > 0)
1153 $new_obj->setTitle($this->
getTitle());
1161 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
1165 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1166 $new_id = $style_obj->ilClone();
1167 $new_obj->setStyleSheetId($new_id);
1175 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1177 $new_tax = $tax->cloneObject(0,0,
true);
1178 $map = $tax->getNodeMapping();
1188 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
1203 $assignmts = $tax_ass->getAssignmentsOfItem($term[
"id"]);
1204 foreach ($assignmts as $a)
1206 if ($map[$a[
"node_id"]] > 0)
1208 $new_tax_ass->addAssignment($map[$a[
"node_id"]] ,$new_term_id);
1227 $set = $ilDB->query(
"SELECT id FROM glossary ".
1228 " WHERE ".$ilDB->in(
"id", $a_glo_ids,
false,
"integer").
1229 " AND is_online = ".$ilDB->quote(
"y",
"text")
1232 while ($rec = $ilDB->fetchAssoc($set))
1234 $glo_ids[] = $rec[
"id"];