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];
475 include_once(
"./Services/COPage/classes/class.ilCOPageHTMLExport.php");
477 $this->co_page_html_export->createDirectories();
481 $style_name = $ilias->account->prefs[
"style"].
".css";
482 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
485 $cont_stylesheet =
"Services/COPage/css/content.css";
486 copy($cont_stylesheet, $a_target_dir.
"/content.css");
490 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
493 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
494 $_GET[
"cmd"] =
"nop";
496 $glo_gui->setOfflineMode(
true);
497 $glo_gui->setOfflineDirectory($a_target_dir);
507 foreach ($this->offline_mobs as $mob)
509 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
511 $_GET[
"obj_type"] =
"MediaObject";
512 $_GET[
"obj_id"] = $a_mob_id;
516 foreach ($this->offline_files as
$file)
522 $image_dir = $a_target_dir.
"/images";
526 $image_dir.
"/enlarge.gif");
528 $image_dir.
"/browser/plus.gif");
530 $image_dir.
"/browser/minus.gif");
532 $image_dir.
"/browser/blank.gif");
534 $image_dir.
"/icon_st.gif");
536 $image_dir.
"/icon_pg.gif");
538 $image_dir.
"/nav_arr_L.gif");
540 $image_dir.
"/nav_arr_R.gif");
543 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
544 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
545 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
569 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
570 $style_name = $ilUser->prefs[
"style"].
".css";;
571 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
572 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
573 $a_glo_gui->tpl->setTitle($this->
getTitle());
575 $content = $a_glo_gui->listTerms();
576 $file = $a_target_dir.
"/index.html";
579 if (!($fp = @fopen(
$file,
"w+")))
581 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
582 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
585 fwrite($fp, $content);
590 $this->offline_mobs = array();
591 $this->offline_files = array();
593 foreach($terms as $term)
595 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
599 $style_name = $ilUser->prefs[
"style"].
".css";;
600 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
602 $_GET[
"term_id"] = $term[
"id"];
603 $_GET[
"frame"] =
"_blank";
604 $content =& $a_glo_gui->listDefinitions();
605 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
608 if (!($fp = @fopen(
$file,
"w+")))
610 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
611 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
614 fwrite($fp, $content);
618 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
620 foreach($defs as $def)
623 foreach($def_mobs as $def_mob)
625 $this->offline_mobs[$def_mob] = $def_mob;
629 include_once(
"./Modules/File/classes/class.ilObjFile.php");
631 $this->offline_files = array_merge($this->offline_files, $def_files);
644 $mob_dir = $a_target_dir.
"/mobs";
647 if (@is_dir($source_dir))
653 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
654 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
655 $_GET[
"obj_type"] =
"MediaObject";
656 $_GET[
"mob_id"] = $a_mob_id;
658 $content =& $a_glo_gui->media();
659 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
662 if (!($fp = @fopen(
$file,
"w+")))
664 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
665 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
668 fwrite($fp, $content);
672 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
674 if ($mob_obj->hasFullscreenItem())
676 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
677 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
678 $_GET[
"mob_id"] = $a_mob_id;
679 $_GET[
"cmd"] =
"fullscreen";
680 $content = $a_glo_gui->fullscreen();
681 $file = $a_target_dir.
"/fullscreen_".$a_mob_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);
700 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
702 include_once(
"./Modules/File/classes/class.ilObjFile.php");
703 $file_obj =
new ilObjFile($a_file_id,
false);
704 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
705 if (!is_file($source_file))
707 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
709 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
719 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
725 $attrs[
"Type"] =
"Glossary";
726 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
733 $this->mob_ids = array();
734 $this->file_ids = array();
735 foreach ($terms as $term)
737 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
741 foreach($defs as $def)
744 $def[
"id"], $this->halt_on_error);
745 $this->page_object->buildDom();
746 $this->page_object->insertInstIntoIDs(IL_INST_ID);
747 $mob_ids = $this->page_object->collectMediaObjects(
false);
748 $file_ids = $this->page_object->collectFileItems();
749 foreach($mob_ids as $mob_id)
751 $this->mob_ids[$mob_id] = $mob_id;
753 foreach($file_ids as $file_id)
755 $this->file_ids[$file_id] = $file_id;
761 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
762 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
764 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
765 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
768 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
769 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
771 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
772 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
775 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
776 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
778 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
779 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
781 $a_xml_writer->xmlEndTag(
"ContentObject");
795 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
804 foreach ($terms as $term)
806 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
807 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
810 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
812 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
813 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
814 $glo_term->exportXML($a_xml_writer, $a_inst);
815 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
830 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
833 $a_xml_writer->xmlEndTag(
"Glossary");
844 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
846 $md2xml->setExportMode(
true);
847 $md2xml->startExport();
848 $a_xml_writer->appendXML($md2xml->getXML());
859 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
861 foreach ($this->mob_ids as $mob_id)
863 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
865 $media_obj->exportXML($a_xml_writer, $a_inst);
866 $media_obj->exportFiles($a_target_dir);
877 include_once(
"./Modules/File/classes/class.ilObjFile.php");
879 foreach ($this->file_ids as $file_id)
881 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
882 $file_obj =
new ilObjFile($file_id,
false);
883 $file_obj->export($a_target_dir);
895 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
897 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
921 if (!parent::delete())
930 foreach ($terms as $term)
938 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
962 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1002 if ($a_node_id==
$_GET[
"ref_id"])
1004 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1005 $parent_type = $parent_obj->getType();
1006 if($parent_type == $this->
getType())
1008 $a_node_id = (int) $tree->getParentId($a_node_id);
1012 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1021 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
1023 return $glo_exp->buildExportFile();
1035 include_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
1037 foreach ($sms as $sm)
1039 $lng->loadLanguageModule(
"content");
1040 $dep[$sm] = $lng->txt(
"glo_used_in_scorm");