24 require_once(
"classes/class.ilObject.php");
25 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
48 $this->
ilObject($a_id,$a_call_by_reference);
67 $ilDB->manipulate(
"INSERT INTO glossary (id, is_online, virtual) VALUES (".
68 $ilDB->quote($this->getId(),
"integer").
",".
69 $ilDB->quote(
"n",
"text").
",".
82 # echo "Glossary<br>\n";
84 $q =
"SELECT * FROM glossary WHERE id = ".
85 $ilDB->quote($this->
getId(),
"integer");
86 $gl_set = $ilDB->query(
$q);
87 $gl_rec = $ilDB->fetchAssoc($gl_set);
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;
173 $this->online = $a_online;
178 return $this->online;
188 $q =
"SELECT * FROM glossary WHERE id = ".
189 $ilDB->quote($a_id,
"integer");
190 $lm_set = $ilDB->query(
$q);
191 $lm_rec = $ilDB->fetchAssoc($lm_set);
198 $this->glo_menu_active = $a_act_glo_menu;
203 return $this->glo_menu_active;
208 $this->downloads_active = $a_down;
213 return $this->downloads_active;
225 $ilDB->manipulate(
"UPDATE glossary SET ".
226 " is_online = ".$ilDB->quote(
ilUtil::tf2yn($this->getOnline()),
"text").
",".
232 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer"));
252 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),
"glo");
254 foreach ($glo_arr as $glo)
257 $glo_ids[] = $glo[
'obj_id'];
263 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
265 foreach ($subtree_nodes as $node)
267 if ($node[
'type'] ==
'glo')
269 $glo_ids[] = $node[
'obj_id'];
281 $glo_ids[] = $this->
getId();
287 $glo_ids = $this->
getId();
303 if(!is_writable($glo_data_dir))
305 $this->ilias->raiseError(
"Glossary Data Directory (".$glo_data_dir
306 .
") not writeable.",$this->ilias->error_obj->FATAL);
310 $glo_dir = $glo_data_dir.
"/glo_".$this->
getId();
312 if(!@is_dir($glo_dir))
314 $this->ilias->raiseError(
"Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
317 $import_dir = $glo_dir.
"/import";
319 if(!@is_dir($import_dir))
321 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
340 include_once(
"./Services/Export/classes/class.ilExport.php");
349 include_once(
"./Services/Export/classes/class.ilExport.php");
358 include_once(
"./Services/Export/classes/class.ilExport.php");
370 $this->public_export_file[$a_type] = $a_file;
382 return $this->public_export_file[$a_type];
395 $mob_dir = $a_target_dir.
"/mobs";
397 $file_dir = $a_target_dir.
"/files";
399 $tex_dir = $a_target_dir.
"/teximg";
404 $style_name = $ilias->account->prefs[
"style"].
".css";
405 copy($location_stylesheet, $a_target_dir.
"/".$style_name);
408 $cont_stylesheet =
"Services/COPage/css/content.css";
409 copy($cont_stylesheet, $a_target_dir.
"/content.css");
413 copy($syn_stylesheet, $a_target_dir.
"/syntaxhighlight.css");
416 include_once(
"./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
417 $_GET[
"cmd"] =
"nop";
419 $glo_gui->setOfflineMode(
true);
420 $glo_gui->setOfflineDirectory($a_target_dir);
430 foreach ($this->offline_mobs as $mob)
432 $this->
exportHTMLMOB($a_target_dir, $glo_gui, $mob,
"_blank");
434 $_GET[
"obj_type"] =
"MediaObject";
435 $_GET[
"obj_id"] = $a_mob_id;
439 foreach ($this->offline_files as
$file)
445 $image_dir = $a_target_dir.
"/images";
449 $image_dir.
"/enlarge.gif");
451 $image_dir.
"/browser/plus.gif");
453 $image_dir.
"/browser/minus.gif");
455 $image_dir.
"/browser/blank.gif");
457 $image_dir.
"/icon_st.gif");
459 $image_dir.
"/icon_pg.gif");
461 $image_dir.
"/nav_arr_L.gif");
463 $image_dir.
"/nav_arr_R.gif");
466 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
467 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
468 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
492 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
493 $style_name = $ilUser->prefs[
"style"].
".css";;
494 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
495 $a_glo_gui->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
496 $a_glo_gui->tpl->setVariable(
"HEADER", $this->
getTitle());
498 $content = $a_glo_gui->listTerms();
499 $file = $a_target_dir.
"/index.html";
502 if (!($fp = @fopen(
$file,
"w+")))
504 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
505 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
508 fwrite($fp, $content);
513 $this->offline_mobs = array();
514 $this->offline_files = array();
516 foreach($terms as $term)
518 $a_glo_gui->tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
522 $style_name = $ilUser->prefs[
"style"].
".css";;
523 $a_glo_gui->tpl->setVariable(
"LOCATION_STYLESHEET",
"./".$style_name);
525 $_GET[
"term_id"] = $term[
"id"];
526 $_GET[
"frame"] =
"_blank";
527 $content =& $a_glo_gui->listDefinitions();
528 $file = $a_target_dir.
"/term_".$term[
"id"].
".html";
531 if (!($fp = @fopen(
$file,
"w+")))
533 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
534 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
537 fwrite($fp, $content);
541 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
543 foreach($defs as $def)
546 foreach($def_mobs as $def_mob)
548 $this->offline_mobs[$def_mob] = $def_mob;
552 include_once(
"./Modules/File/classes/class.ilObjFile.php");
554 $this->offline_files = array_merge($this->offline_files, $def_files);
567 $mob_dir = $a_target_dir.
"/mobs";
570 if (@is_dir($source_dir))
576 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
577 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
578 $_GET[
"obj_type"] =
"MediaObject";
579 $_GET[
"mob_id"] = $a_mob_id;
581 $content =& $a_glo_gui->media();
582 $file = $a_target_dir.
"/media_".$a_mob_id.
".html";
585 if (!($fp = @fopen(
$file,
"w+")))
587 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
588 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
591 fwrite($fp, $content);
595 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
597 if ($mob_obj->hasFullscreenItem())
599 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
600 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
601 $_GET[
"mob_id"] = $a_mob_id;
602 $_GET[
"cmd"] =
"fullscreen";
603 $content = $a_glo_gui->fullscreen();
604 $file = $a_target_dir.
"/fullscreen_".$a_mob_id.
".html";
607 if (!($fp = @fopen(
$file,
"w+")))
609 die (
"<b>Error</b>: Could not open \"".
$file.
"\" for writing".
610 " in <b>".__FILE__.
"</b> on line <b>".__LINE__.
"</b><br />");
613 fwrite($fp, $content);
623 $file_dir = $a_target_dir.
"/files/file_".$a_file_id;
625 include_once(
"./Modules/File/classes/class.ilObjFile.php");
626 $file_obj =
new ilObjFile($a_file_id,
false);
627 $source_file = $file_obj->getDirectory($file_obj->getVersion()).
"/".$file_obj->getFileName();
628 if (!is_file($source_file))
630 $source_file = $file_obj->getDirectory().
"/".$file_obj->getFileName();
632 copy($source_file, $file_dir.
"/".$file_obj->getFileName());
642 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
648 $attrs[
"Type"] =
"Glossary";
649 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
656 $this->mob_ids = array();
657 $this->file_ids = array();
658 foreach ($terms as $term)
660 include_once
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
664 foreach($defs as $def)
667 $def[
"id"], $this->halt_on_error);
668 $this->page_object->buildDom();
669 $this->page_object->insertInstIntoIDs(IL_INST_ID);
670 $mob_ids = $this->page_object->collectMediaObjects(
false);
671 $file_ids = $this->page_object->collectFileItems();
672 foreach($mob_ids as $mob_id)
674 $this->mob_ids[$mob_id] = $mob_id;
676 foreach($file_ids as $file_id)
678 $this->file_ids[$file_id] = $file_id;
684 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
685 $ilBench->start(
"GlossaryExport",
"exportMediaObjects");
687 $ilBench->stop(
"GlossaryExport",
"exportMediaObjects");
688 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
691 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
692 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
694 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
695 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
698 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Glossary Items");
699 $ilBench->start(
"GlossaryExport",
"exportGlossaryItems");
701 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItems");
702 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Glossary Items");
704 $a_xml_writer->xmlEndTag(
"ContentObject");
718 $a_xml_writer->xmlStartTag(
"Glossary", $attrs);
727 foreach ($terms as $term)
729 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem");
730 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$page[
"obj_id"]);
733 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
735 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_getGlossaryTerm");
736 $ilBench->start(
"GlossaryExport",
"exportGlossaryItem_XML");
737 $glo_term->exportXML($a_xml_writer, $a_inst);
738 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem_XML");
753 $ilBench->stop(
"GlossaryExport",
"exportGlossaryItem");
756 $a_xml_writer->xmlEndTag(
"Glossary");
767 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
769 $md2xml->setExportMode(
true);
770 $md2xml->startExport();
771 $a_xml_writer->appendXML($md2xml->getXML());
782 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
784 foreach ($this->mob_ids as $mob_id)
786 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
788 $media_obj->exportXML($a_xml_writer, $a_inst);
789 $media_obj->exportFiles($a_target_dir);
800 include_once(
"./Modules/File/classes/class.ilObjFile.php");
802 foreach ($this->file_ids as $file_id)
804 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
805 $file_obj =
new ilObjFile($file_id,
false);
806 $file_obj->export($a_target_dir);
818 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
820 $a_value =
"il_".IL_INST_ID.
"_glo_".$this->
getId();
844 if (!parent::delete())
853 foreach ($terms as $term)
861 $q =
"DELETE FROM glossary WHERE id = ".$ilDB->quote($this->
getId());
885 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
925 if ($a_node_id==
$_GET[
"ref_id"])
927 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
928 $parent_type = $parent_obj->getType();
929 if($parent_type == $this->
getType())
931 $a_node_id = (int) $tree->getParentId($a_node_id);
935 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
944 include_once(
"./Modules/Glossary/classes/class.ilGlossaryExport.php");
946 return $glo_exp->buildExportFile();