5 require_once(
"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").
68 # echo "Glossary<br>\n";
70 $q =
"SELECT * FROM glossary WHERE id = ".
71 $ilDB->quote($this->
getId(),
"integer");
72 $gl_set = $ilDB->query($q);
73 $gl_rec = $ilDB->fetchAssoc($gl_set);
113 $this->virtual_mode = $a_mode;
114 $this->
virtual =
true;
118 $this->virtual_mode =
"none";
119 $this->
virtual =
false;
129 return $this->virtual_mode;
137 return $this->virtual;
166 $this->pres_mode = $a_val;
176 return $this->pres_mode;
186 $this->snippet_length = $a_val;
196 return $this->snippet_length;
201 $this->online = $a_online;
206 return $this->online;
216 $q =
"SELECT is_online FROM glossary WHERE id = ".
217 $ilDB->quote($a_id,
"integer");
218 $lm_set = $ilDB->query($q);
219 $lm_rec = $ilDB->fetchAssoc($lm_set);
230 static protected function lookup($a_id, $a_property)
234 $set = $ilDB->query(
"SELECT $a_property FROM glossary WHERE id = ".
235 $ilDB->quote($a_id,
"integer"));
236 $rec = $ilDB->fetchAssoc($set);
238 return $rec[$a_property];
255 $this->glo_menu_active = $a_act_glo_menu;
260 return $this->glo_menu_active;
265 $this->downloads_active = $a_down;
270 return $this->downloads_active;
282 $ilDB->manipulate(
"UPDATE glossary SET ".
283 " is_online = ".$ilDB->quote(
ilUtil::tf2yn($this->getOnline()),
"text").
",".
290 " snippet_length = ".$ilDB->quote($this->
getSnippetLength(),
"integer").
" ".
291 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer"));
300 function getTermList($searchterm =
"", $a_letter =
"", $a_def =
"")
315 return $first_letters;
334 switch ($virtual_mode)
337 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),
"glo");
339 foreach ($glo_arr as $glo)
342 $glo_ids[] = $glo[
'obj_id'];
348 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
350 foreach ($subtree_nodes as $node)
352 if ($node[
'type'] ==
'glo')
354 $glo_ids[] = $node[
'obj_id'];
361 $glo_ids[] = $this->
getId();
367 $glo_ids = $this->
getId();
382 if(!is_writable($glo_data_dir))
384 $this->ilias->raiseError(
"Glossary Data Directory (".$glo_data_dir
385 .
") not writeable.",$this->ilias->error_obj->FATAL);
389 $glo_dir = $glo_data_dir.
"/glo_".$this->
getId();
391 if(!@is_dir($glo_dir))
393 $this->ilias->raiseError(
"Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
396 $import_dir = $glo_dir.
"/import";
398 if(!@is_dir($import_dir))
400 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
419 include_once(
"./Services/Export/classes/class.ilExport.php");
428 include_once(
"./Services/Export/classes/class.ilExport.php");
437 include_once(
"./Services/Export/classes/class.ilExport.php");
449 $this->public_export_file[$a_type] = $a_file;
461 return $this->public_export_file[$a_type];
474 $mob_dir = $a_target_dir.
"/mobs";
476 $file_dir = $a_target_dir.
"/files";
478 $tex_dir = $a_target_dir.
"/teximg";
483 $style_name = $ilias->account->prefs[
"style"].
".css";
484 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
487 $cont_stylesheet =
"Services/COPage/css/content.css";
488 copy($cont_stylesheet, $a_target_dir.
"/content.css");
492 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
495 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
496 $_GET[
"cmd"] =
"nop";
498 $glo_gui->setOfflineMode(
true);
499 $glo_gui->setOfflineDirectory($a_target_dir);
509 foreach ($this->offline_mobs as $mob)
511 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
513 $_GET[
"obj_type"] =
"MediaObject";
514 $_GET[
"obj_id"] = $a_mob_id;
518 foreach ($this->offline_files as
$file)
524 $image_dir = $a_target_dir.
"/images";
528 $image_dir.
"/enlarge.gif");
530 $image_dir.
"/browser/plus.gif");
532 $image_dir.
"/browser/minus.gif");
534 $image_dir.
"/browser/blank.gif");
536 $image_dir.
"/icon_st.gif");
538 $image_dir.
"/icon_pg.gif");
540 $image_dir.
"/nav_arr_L.gif");
542 $image_dir.
"/nav_arr_R.gif");
545 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
546 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
547 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
571 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
572 $style_name = $ilUser->prefs[
"style"].
".css";;
573 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
574 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
575 $a_glo_gui->tpl->setVariable(
"HEADER", $this->
getTitle());
577 $content = $a_glo_gui->listTerms();
578 $file = $a_target_dir.
"/index.html";
581 if (!($fp = @fopen(
$file,
"w+")))
583 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
584 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
587 fwrite($fp, $content);
592 $this->offline_mobs = array();
593 $this->offline_files = array();
595 foreach($terms as $term)
597 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
601 $style_name = $ilUser->prefs[
"style"].
".css";;
602 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
604 $_GET[
"term_id"] = $term[
"id"];
605 $_GET[
"frame"] =
"_blank";
606 $content =& $a_glo_gui->listDefinitions();
607 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
610 if (!($fp = @fopen(
$file,
"w+")))
612 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
613 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
616 fwrite($fp, $content);
620 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
622 foreach($defs as $def)
625 foreach($def_mobs as $def_mob)
627 $this->offline_mobs[$def_mob] = $def_mob;
631 include_once(
"./Modules/File/classes/class.ilObjFile.php");
633 $this->offline_files = array_merge($this->offline_files, $def_files);
646 $mob_dir = $a_target_dir.
"/mobs";
649 if (@is_dir($source_dir))
655 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
656 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
657 $_GET[
"obj_type"] =
"MediaObject";
658 $_GET[
"mob_id"] = $a_mob_id;
660 $content =& $a_glo_gui->media();
661 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
664 if (!($fp = @fopen(
$file,
"w+")))
666 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
667 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
670 fwrite($fp, $content);
674 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
676 if ($mob_obj->hasFullscreenItem())
678 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
679 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
680 $_GET[
"mob_id"] = $a_mob_id;
681 $_GET[
"cmd"] =
"fullscreen";
682 $content = $a_glo_gui->fullscreen();
683 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
686 if (!($fp = @fopen(
$file,
"w+")))
688 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
689 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
692 fwrite($fp, $content);
702 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
704 include_once(
"./Modules/File/classes/class.ilObjFile.php");
705 $file_obj =
new ilObjFile($a_file_id,
false);
706 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
707 if (!is_file($source_file))
709 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
711 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
721 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
727 $attrs[
"Type"] =
"Glossary";
728 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
735 $this->mob_ids = array();
736 $this->file_ids = array();
737 foreach ($terms as $term)
739 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
743 foreach($defs as $def)
746 $def[
"id"], $this->halt_on_error);
747 $this->page_object->buildDom();
748 $this->page_object->insertInstIntoIDs(IL_INST_ID);
749 $mob_ids = $this->page_object->collectMediaObjects(
false);
750 $file_ids = $this->page_object->collectFileItems();
751 foreach($mob_ids as $mob_id)
753 $this->mob_ids[$mob_id] = $mob_id;
755 foreach($file_ids as $file_id)
757 $this->file_ids[$file_id] = $file_id;
763 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
764 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
766 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
767 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
770 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
771 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
773 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
774 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
777 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
778 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
780 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
781 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
783 $a_xml_writer->xmlEndTag(
"ContentObject");
797 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
806 foreach ($terms as $term)
808 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
809 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
812 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
814 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
815 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
816 $glo_term->exportXML($a_xml_writer, $a_inst);
817 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
832 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
835 $a_xml_writer->xmlEndTag(
"Glossary");
846 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
848 $md2xml->setExportMode(
true);
849 $md2xml->startExport();
850 $a_xml_writer->appendXML($md2xml->getXML());
861 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
863 foreach ($this->mob_ids as $mob_id)
865 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
867 $media_obj->exportXML($a_xml_writer, $a_inst);
868 $media_obj->exportFiles($a_target_dir);
879 include_once(
"./Modules/File/classes/class.ilObjFile.php");
881 foreach ($this->file_ids as $file_id)
883 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
884 $file_obj =
new ilObjFile($file_id,
false);
885 $file_obj->export($a_target_dir);
897 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
899 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
923 if (!parent::delete())
932 foreach ($terms as $term)
940 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
964 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1004 if ($a_node_id==
$_GET[
"ref_id"])
1006 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1007 $parent_type = $parent_obj->getType();
1008 if($parent_type == $this->
getType())
1010 $a_node_id = (int) $tree->getParentId($a_node_id);
1014 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1023 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
1025 return $glo_exp->buildExportFile();
1037 include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
1039 foreach ($sms as $sm)
1041 $lng->loadLanguageModule(
"content");
1042 $dep[$sm] = $lng->txt(
"glo_used_in_scorm");