00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("classes/class.ilObject.php");
00025 require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
00026
00038 class ilObjGlossary extends ilObject
00039 {
00040
00045 function ilObjGlossary($a_id = 0,$a_call_by_reference = true)
00046 {
00047 $this->type = "glo";
00048 $this->ilObject($a_id,$a_call_by_reference);
00049 }
00050
00054 function create($a_upload = false)
00055 {
00056 global $ilDB;
00057
00058 parent::create();
00059
00060
00061
00062 if (!$a_upload)
00063 {
00064 $this->createMetaData();
00065 }
00066
00067 $q = "INSERT INTO glossary (id, online, virtual) VALUES ".
00068 " (".$ilDB->quote($this->getId()).",".$ilDB->quote("n").",".$ilDB->quote($this->getVirtualMode()).")";
00069 $ilDB->query($q);
00070
00071 }
00072
00076 function read()
00077 {
00078 global $ilDB;
00079
00080 parent::read();
00081 # echo "Glossary<br>\n";
00082
00083 $q = "SELECT * FROM glossary WHERE id = ".$ilDB->quote($this->getId());
00084 $gl_set = $this->ilias->db->query($q);
00085 $gl_rec = $gl_set->fetchRow(DB_FETCHMODE_ASSOC);
00086 $this->setOnline(ilUtil::yn2tf($gl_rec["online"]));
00087 $this->setVirtualMode($gl_rec["virtual"]);
00088 $this->setPublicExportFile("xml", $gl_rec["public_xml_file"]);
00089 $this->setPublicExportFile("html", $gl_rec["public_html_file"]);
00090 $this->setActiveGlossaryMenu(ilUtil::yn2tf($gl_rec["glo_menu_active"]));
00091 $this->setActiveDownloads(ilUtil::yn2tf($gl_rec["downloads_active"]));
00092 }
00093
00099 function getDescription()
00100 {
00101 return parent::getDescription();
00102 }
00103
00107 function setDescription($a_description)
00108 {
00109 parent::setDescription($a_description);
00110 }
00111
00112
00116 function setVirtualMode($a_mode)
00117 {
00118 switch ($a_mode)
00119 {
00120 case "level":
00121 case "subtree":
00122
00123 $this->virtual_mode = $a_mode;
00124 $this->virtual = true;
00125 break;
00126
00127 default:
00128 $this->virtual_mode = "none";
00129 $this->virtual = false;
00130 break;
00131 }
00132 }
00133
00137 function getVirtualMode()
00138 {
00139 return $this->virtual_mode;
00140 }
00141
00145 function isVirtual()
00146 {
00147 return $this->virtual;
00148 }
00149
00155 function getTitle()
00156 {
00157 return parent::getTitle();
00158 }
00159
00163 function setTitle($a_title)
00164 {
00165 parent::setTitle($a_title);
00166
00167 }
00168
00169 function setOnline($a_online)
00170 {
00171 $this->online = $a_online;
00172 }
00173
00174 function getOnline()
00175 {
00176 return $this->online;
00177 }
00178
00182 function _lookupOnline($a_id)
00183 {
00184 global $ilDB;
00185
00186 $q = "SELECT * FROM glossary WHERE id = ".$ilDB->quote($a_id);
00187 $lm_set = $ilDB->query($q);
00188 $lm_rec = $lm_set->fetchRow(DB_FETCHMODE_ASSOC);
00189
00190 return ilUtil::yn2tf($lm_rec["online"]);
00191 }
00192
00193 function setActiveGlossaryMenu($a_act_glo_menu)
00194 {
00195 $this->glo_menu_active = $a_act_glo_menu;
00196 }
00197
00198 function isActiveGlossaryMenu()
00199 {
00200 return $this->glo_menu_active;
00201 }
00202
00203 function setActiveDownloads($a_down)
00204 {
00205 $this->downloads_active = $a_down;
00206 }
00207
00208 function isActiveDownloads()
00209 {
00210 return $this->downloads_active;
00211 }
00212
00218
00219
00220
00221
00222
00223
00224
00230
00231
00232
00233
00234
00235
00236
00237
00241 function update()
00242 {
00243 global $ilDB;
00244
00245 $this->updateMetaData();
00246
00247 $q = "UPDATE glossary SET ".
00248 " online = ".$ilDB->quote(ilUtil::tf2yn($this->getOnline())).",".
00249 " virtual = ".$ilDB->quote($this->getVirtualMode()).",".
00250 " public_xml_file = ".$ilDB->quote($this->getPublicExportFile("xml")).",".
00251 " public_html_file = ".$ilDB->quote($this->getPublicExportFile("html")).",".
00252 " glo_menu_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveGlossaryMenu())).",".
00253 " downloads_active = ".$ilDB->quote(ilUtil::tf2yn($this->isActiveDownloads()))." ".
00254 " WHERE id = ".$ilDB->quote($this->getId());
00255
00256 $ilDB->query($q);
00257
00258 parent::update();
00259 }
00260
00261
00265 function getTermList($searchterm="")
00266 {
00267 if ($this->isVirtual())
00268 {
00269 global $tree;
00270
00271 $glo_ids = array();
00272
00273 switch ($this->getVirtualMode())
00274 {
00275 case "level":
00276 $glo_arr = $tree->getChildsByType($tree->getParentId($this->getRefId()),"glo");
00277
00278 foreach ($glo_arr as $glo)
00279 {
00280 {
00281 $glo_ids[] = $glo['obj_id'];
00282 }
00283 }
00284 break;
00285
00286 case "subtree":
00287 $subtree_nodes = $tree->getSubTree($tree->getNodeData($tree->getParentId($this->getRefId())));
00288
00289 foreach ($subtree_nodes as $node)
00290 {
00291 if ($node['type'] == 'glo')
00292 {
00293 $glo_ids[] = $node['obj_id'];
00294 }
00295 }
00296 break;
00297
00298
00299
00300
00301
00302
00303
00304 default:
00305 $glo_ids[] = $this->getId();
00306 break;
00307 }
00308 }
00309 else
00310 {
00311 $glo_ids = $this->getId();
00312 }
00313
00314 $list = ilGlossaryTerm::getTermList($glo_ids,$searchterm);
00315 return $list;
00316 }
00317
00323 function createImportDirectory()
00324 {
00325 $glo_data_dir = ilUtil::getDataDir()."/glo_data";
00326 ilUtil::makeDir($glo_data_dir);
00327 if(!is_writable($glo_data_dir))
00328 {
00329 $this->ilias->raiseError("Glossary Data Directory (".$glo_data_dir
00330 .") not writeable.",$this->ilias->error_obj->FATAL);
00331 }
00332
00333
00334 $glo_dir = $glo_data_dir."/glo_".$this->getId();
00335 ilUtil::makeDir($glo_dir);
00336 if(!@is_dir($glo_dir))
00337 {
00338 $this->ilias->raiseError("Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
00339 }
00340
00341 $import_dir = $glo_dir."/import";
00342 ilUtil::makeDir($import_dir);
00343 if(!@is_dir($import_dir))
00344 {
00345 $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
00346 }
00347 }
00348
00352 function getImportDirectory()
00353 {
00354 $export_dir = ilUtil::getDataDir()."/glo_data"."/glo_".$this->getId()."/import";
00355
00356 return $export_dir;
00357 }
00358
00364 function createExportDirectory($a_type = "xml")
00365 {
00366 $glo_data_dir = ilUtil::getDataDir()."/glo_data";
00367 ilUtil::makeDir($glo_data_dir);
00368 if(!is_writable($glo_data_dir))
00369 {
00370 $this->ilias->raiseError("Glossary Data Directory (".$glo_data_dir
00371 .") not writeable.",$this->ilias->error_obj->FATAL);
00372 }
00373
00374 $glo_dir = $glo_data_dir."/glo_".$this->getId();
00375 ilUtil::makeDir($glo_dir);
00376 if(!@is_dir($glo_dir))
00377 {
00378 $this->ilias->raiseError("Creation of Glossary Directory failed.",$this->ilias->error_obj->FATAL);
00379 }
00380
00381
00382 switch ($a_type)
00383 {
00384
00385 case "html":
00386 $export_dir = $glo_dir."/export_html";
00387 break;
00388
00389 default:
00390 $export_dir = $glo_dir."/export";
00391 break;
00392 }
00393 ilUtil::makeDir($export_dir);
00394
00395 if(!@is_dir($export_dir))
00396 {
00397 $this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
00398 }
00399 }
00400
00404 function getExportDirectory($a_type = "xml")
00405 {
00406 switch ($a_type)
00407 {
00408 case "html":
00409 $export_dir = ilUtil::getDataDir()."/glo_data"."/glo_".$this->getId()."/export_html";
00410 break;
00411
00412 default:
00413 $export_dir = ilUtil::getDataDir()."/glo_data"."/glo_".$this->getId()."/export";
00414 break;
00415 }
00416
00417 return $export_dir;
00418 }
00419
00423 function getExportFiles()
00424 {
00425
00426 $file = array();
00427
00428 $types = array("xml", "html");
00429
00430 foreach($types as $type)
00431 {
00432 $dir = $this->getExportDirectory($type);
00433
00434
00435 if (!@is_dir($dir) or
00436 !is_writeable($dir))
00437 {
00438 continue;
00439 }
00440
00441
00442 $h_dir = dir($dir);
00443
00444
00445 while ($entry = $h_dir->read())
00446 {
00447 if ($entry != "." and
00448 $entry != ".." and
00449 substr($entry, -4) == ".zip" and
00450 ereg("^[0-9]{10}_{2}[0-9]+_{2}(glo_)*[0-9]+\.zip\$", $entry))
00451 {
00452 $file[$entry.$type] = array("type" => $type, "file" => $entry,
00453 "size" => filesize($dir."/".$entry));
00454 }
00455 }
00456
00457
00458 $h_dir->close();
00459 }
00460
00461
00462 ksort ($file);
00463 reset ($file);
00464 return $file;
00465 }
00466
00473 function setPublicExportFile($a_type, $a_file)
00474 {
00475 $this->public_export_file[$a_type] = $a_file;
00476 }
00477
00485 function getPublicExportFile($a_type)
00486 {
00487 return $this->public_export_file[$a_type];
00488 }
00489
00493 function exportHTML($a_target_dir, $log)
00494 {
00495 global $ilias, $tpl;
00496
00497
00498 ilUtil::delDir($a_target_dir);
00499 ilUtil::makeDir($a_target_dir);
00500 $mob_dir = $a_target_dir."/mobs";
00501 ilUtil::makeDir($mob_dir);
00502 $file_dir = $a_target_dir."/files";
00503 ilUtil::makeDir($file_dir);
00504 $tex_dir = $a_target_dir."/teximg";
00505 ilUtil::makeDir($tex_dir);
00506
00507
00508 $location_stylesheet = ilUtil::getStyleSheetLocation("filesystem");
00509 $style_name = $ilias->account->prefs["style"].".css";
00510 copy($location_stylesheet, $a_target_dir."/".$style_name);
00511 $location_stylesheet = ilUtil::getStyleSheetLocation();
00512
00513 $cont_stylesheet = "Services/COPage/css/content.css";
00514 copy($cont_stylesheet, $a_target_dir."/content.css");
00515
00516
00517 $syn_stylesheet = ilObjStyleSheet::getSyntaxStylePath();
00518 copy($syn_stylesheet, $a_target_dir."/syntaxhighlight.css");
00519
00520
00521 include_once("./Modules/Glossary/classes/class.ilGlossaryPresentationGUI.php");
00522 $_GET["cmd"] = "nop";
00523 $glo_gui =& new ilGlossaryPresentationGUI();
00524 $glo_gui->setOfflineMode(true);
00525 $glo_gui->setOfflineDirectory($a_target_dir);
00526
00527
00528
00529
00530
00531
00532 $this->exportHTMLGlossaryTerms($glo_gui, $a_target_dir);
00533
00534
00535 foreach ($this->offline_mobs as $mob)
00536 {
00537 $this->exportHTMLMOB($a_target_dir, $glo_gui, $mob, "_blank");
00538 }
00539 $_GET["obj_type"] = "MediaObject";
00540 $_GET["obj_id"] = $a_mob_id;
00541 $_GET["cmd"] = "";
00542
00543
00544 foreach ($this->offline_files as $file)
00545 {
00546 $this->exportHTMLFile($a_target_dir, $file);
00547 }
00548
00549
00550 $image_dir = $a_target_dir."/images";
00551 ilUtil::makeDir($image_dir);
00552 ilUtil::makeDir($image_dir."/browser");
00553 copy(ilUtil::getImagePath("enlarge.gif", false, "filesystem"),
00554 $image_dir."/enlarge.gif");
00555 copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
00556 $image_dir."/browser/plus.gif");
00557 copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
00558 $image_dir."/browser/minus.gif");
00559 copy(ilUtil::getImagePath("browser/blank.gif", false, "filesystem"),
00560 $image_dir."/browser/blank.gif");
00561 copy(ilUtil::getImagePath("icon_st.gif", false, "filesystem"),
00562 $image_dir."/icon_st.gif");
00563 copy(ilUtil::getImagePath("icon_pg.gif", false, "filesystem"),
00564 $image_dir."/icon_pg.gif");
00565 copy(ilUtil::getImagePath("nav_arr_L.gif", false, "filesystem"),
00566 $image_dir."/nav_arr_L.gif");
00567 copy(ilUtil::getImagePath("nav_arr_R.gif", false, "filesystem"),
00568 $image_dir."/nav_arr_R.gif");
00569
00570
00571 $tpl = new ilTemplate("tpl.main.html", true, true);
00572 $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
00573 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00574
00575
00576 if (true)
00577 {
00578
00579 $date = time();
00580 $zip_file = $this->getExportDirectory("html")."/".$date."__".IL_INST_ID."__".
00581 $this->getType()."_".$this->getId().".zip";
00582
00583 ilUtil::zip($a_target_dir, $zip_file);
00584 ilUtil::delDir($a_target_dir);
00585 }
00586 }
00587
00588
00592 function exportHTMLGlossaryTerms(&$a_glo_gui, $a_target_dir)
00593 {
00594 global $ilUser;
00595
00596
00597 $a_glo_gui->tpl = new ilTemplate("tpl.main.html", true, true);
00598 $style_name = $ilUser->prefs["style"].".css";;
00599 $a_glo_gui->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00600 $a_glo_gui->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00601 $a_glo_gui->tpl->setVariable("HEADER", $this->getTitle());
00602
00603 $content = $a_glo_gui->listTerms();
00604 $file = $a_target_dir."/index.html";
00605
00606
00607 if (!($fp = @fopen($file,"w+")))
00608 {
00609 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
00610 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
00611 }
00612 chmod($file, 0770);
00613 fwrite($fp, $content);
00614 fclose($fp);
00615
00616 $terms = $this->getTermList();
00617
00618 $this->offline_mobs = array();
00619 $this->offline_files = array();
00620
00621 foreach($terms as $term)
00622 {
00623 $a_glo_gui->tpl = new ilTemplate("tpl.main.html", true, true);
00624
00625
00626
00627 $style_name = $ilUser->prefs["style"].".css";;
00628 $a_glo_gui->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00629
00630 $_GET["term_id"] = $term["id"];
00631 $_GET["frame"] = "_blank";
00632 $content =& $a_glo_gui->listDefinitions();
00633 $file = $a_target_dir."/term_".$term["id"].".html";
00634
00635
00636 if (!($fp = @fopen($file,"w+")))
00637 {
00638 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
00639 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
00640 }
00641 chmod($file, 0770);
00642 fwrite($fp, $content);
00643 fclose($fp);
00644
00645
00646 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
00647 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00648 foreach($defs as $def)
00649 {
00650 $def_mobs = ilObjMediaObject::_getMobsOfObject("gdf:pg", $def["id"]);
00651 foreach($def_mobs as $def_mob)
00652 {
00653 $this->offline_mobs[$def_mob] = $def_mob;
00654 }
00655
00656
00657 include_once("./Modules/File/classes/class.ilObjFile.php");
00658 $def_files = ilObjFile::_getFilesOfObject("gdf:pg", $def["id"]);
00659 $this->offline_files = array_merge($this->offline_files, $def_files);
00660
00661 }
00662 }
00663 }
00664
00668 function exportHTMLMOB($a_target_dir, &$a_glo_gui, $a_mob_id)
00669 {
00670 global $tpl;
00671
00672 $mob_dir = $a_target_dir."/mobs";
00673
00674 $source_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob_id;
00675 if (@is_dir($source_dir))
00676 {
00677 ilUtil::makeDir($mob_dir."/mm_".$a_mob_id);
00678 ilUtil::rCopy($source_dir, $mob_dir."/mm_".$a_mob_id);
00679 }
00680
00681 $tpl = new ilTemplate("tpl.main.html", true, true);
00682 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00683 $_GET["obj_type"] = "MediaObject";
00684 $_GET["mob_id"] = $a_mob_id;
00685 $_GET["cmd"] = "";
00686 $content =& $a_glo_gui->media();
00687 $file = $a_target_dir."/media_".$a_mob_id.".html";
00688
00689
00690 if (!($fp = @fopen($file,"w+")))
00691 {
00692 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
00693 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
00694 }
00695 chmod($file, 0770);
00696 fwrite($fp, $content);
00697 fclose($fp);
00698
00699
00700 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
00701 $mob_obj = new ilObjMediaObject($a_mob_id);
00702 if ($mob_obj->hasFullscreenItem())
00703 {
00704 $tpl = new ilTemplate("tpl.main.html", true, true);
00705 $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00706 $_GET["mob_id"] = $a_mob_id;
00707 $_GET["cmd"] = "fullscreen";
00708 $content = $a_glo_gui->fullscreen();
00709 $file = $a_target_dir."/fullscreen_".$a_mob_id.".html";
00710
00711
00712 if (!($fp = @fopen($file,"w+")))
00713 {
00714 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
00715 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
00716 }
00717 chmod($file, 0770);
00718 fwrite($fp, $content);
00719 fclose($fp);
00720 }
00721 }
00722
00726 function exportHTMLFile($a_target_dir, $a_file_id)
00727 {
00728 $file_dir = $a_target_dir."/files/file_".$a_file_id;
00729 ilUtil::makeDir($file_dir);
00730 include_once("./Modules/File/classes/class.ilObjFile.php");
00731 $file_obj = new ilObjFile($a_file_id, false);
00732 $source_file = $file_obj->getDirectory($file_obj->getVersion())."/".$file_obj->getFileName();
00733 if (!is_file($source_file))
00734 {
00735 $source_file = $file_obj->getDirectory()."/".$file_obj->getFileName();
00736 }
00737 copy($source_file, $file_dir."/".$file_obj->getFileName());
00738 }
00739
00740
00747 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
00748 {
00749 global $ilBench;
00750
00751
00752 $attrs = array();
00753 $attrs["Type"] = "Glossary";
00754 $a_xml_writer->xmlStartTag("ContentObject", $attrs);
00755
00756
00757 $this->exportXMLMetaData($a_xml_writer);
00758
00759
00760 $terms = $this->getTermList();
00761 $this->mob_ids = array();
00762 $this->file_ids = array();
00763 foreach ($terms as $term)
00764 {
00765 include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
00766
00767 $defs = ilGlossaryDefinition::getDefinitionList($term[id]);
00768
00769 foreach($defs as $def)
00770 {
00771 $this->page_object =& new ilPageObject("gdf",
00772 $def["id"], $this->halt_on_error);
00773 $this->page_object->buildDom();
00774 $this->page_object->insertInstIntoIDs(IL_INST_ID);
00775 $mob_ids = $this->page_object->collectMediaObjects(false);
00776 $file_ids = $this->page_object->collectFileItems();
00777 foreach($mob_ids as $mob_id)
00778 {
00779 $this->mob_ids[$mob_id] = $mob_id;
00780 }
00781 foreach($file_ids as $file_id)
00782 {
00783 $this->file_ids[$file_id] = $file_id;
00784 }
00785 }
00786 }
00787
00788
00789 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Media Objects");
00790 $ilBench->start("GlossaryExport", "exportMediaObjects");
00791 $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
00792 $ilBench->stop("GlossaryExport", "exportMediaObjects");
00793 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Media Objects");
00794
00795
00796 $expLog->write(date("[y-m-d H:i:s] ")."Start Export File Items");
00797 $ilBench->start("ContentObjectExport", "exportFileItems");
00798 $this->exportFileItems($a_target_dir, $expLog);
00799 $ilBench->stop("ContentObjectExport", "exportFileItems");
00800 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export File Items");
00801
00802
00803 $expLog->write(date("[y-m-d H:i:s] ")."Start Export Glossary Items");
00804 $ilBench->start("GlossaryExport", "exportGlossaryItems");
00805 $this->exportXMLGlossaryItems($a_xml_writer, $a_inst, $expLog);
00806 $ilBench->stop("GlossaryExport", "exportGlossaryItems");
00807 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export Glossary Items");
00808
00809 $a_xml_writer->xmlEndTag("ContentObject");
00810 }
00811
00818 function exportXMLGlossaryItems(&$a_xml_writer, $a_inst, &$expLog)
00819 {
00820 global $ilBench;
00821
00822 $attrs = array();
00823 $a_xml_writer->xmlStartTag("Glossary", $attrs);
00824
00825
00826 $this->exportXMLMetaData($a_xml_writer);
00827
00828 $terms = $this->getTermList();
00829
00830
00831 reset($terms);
00832 foreach ($terms as $term)
00833 {
00834 $ilBench->start("GlossaryExport", "exportGlossaryItem");
00835 $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);
00836
00837
00838 $ilBench->start("GlossaryExport", "exportGlossaryItem_getGlossaryTerm");
00839 $glo_term = new ilGlossaryTerm($term["id"]);
00840 $ilBench->stop("GlossaryExport", "exportGlossaryItem_getGlossaryTerm");
00841 $ilBench->start("GlossaryExport", "exportGlossaryItem_XML");
00842 $glo_term->exportXML($a_xml_writer, $a_inst);
00843 $ilBench->stop("GlossaryExport", "exportGlossaryItem_XML");
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856 unset($glo_term);
00857
00858 $ilBench->stop("GlossaryExport", "exportGlossaryItem");
00859 }
00860
00861 $a_xml_writer->xmlEndTag("Glossary");
00862 }
00863
00870 function exportXMLMetaData(&$a_xml_writer)
00871 {
00872 include_once("Services/MetaData/classes/class.ilMD2XML.php");
00873 $md2xml = new ilMD2XML($this->getId(), 0, $this->getType());
00874 $md2xml->setExportMode(true);
00875 $md2xml->startExport();
00876 $a_xml_writer->appendXML($md2xml->getXML());
00877 }
00878
00885 function exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
00886 {
00887 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
00888
00889 foreach ($this->mob_ids as $mob_id)
00890 {
00891 $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
00892 $media_obj = new ilObjMediaObject($mob_id);
00893 $media_obj->exportXML($a_xml_writer, $a_inst);
00894 $media_obj->exportFiles($a_target_dir);
00895 unset($media_obj);
00896 }
00897 }
00898
00903 function exportFileItems($a_target_dir, &$expLog)
00904 {
00905 include_once("./Modules/File/classes/class.ilObjFile.php");
00906
00907 foreach ($this->file_ids as $file_id)
00908 {
00909 $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
00910 $file_obj = new ilObjFile($file_id, false);
00911 $file_obj->export($a_target_dir);
00912 unset($file_obj);
00913 }
00914 }
00915
00916
00917
00921 function modifyExportIdentifier($a_tag, $a_param, $a_value)
00922 {
00923 if ($a_tag == "Identifier" && $a_param == "Entry")
00924 {
00925 $a_value = "il_".IL_INST_ID."_glo_".$this->getId();
00926 }
00927
00928 return $a_value;
00929 }
00930
00931
00932
00933
00944 function delete()
00945 {
00946 global $ilDB;
00947
00948
00949 if (!parent::delete())
00950 {
00951 return false;
00952 }
00953
00954
00955 if (!$this->isVirtual())
00956 {
00957 $terms = $this->getTermList();
00958 foreach ($terms as $term)
00959 {
00960 $term_obj =& new ilGlossaryTerm($term["id"]);
00961 $term_obj->delete();
00962 }
00963 }
00964
00965
00966 $q = "DELETE FROM glossary WHERE id = ".$ilDB->quote($this->getId());
00967 $ilDB->query($q);
00968
00969
00970 $this->deleteMetaData();
00971
00972
00973
00974
00975
00976
00977 return true;
00978 }
00979
00990 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00991 {
00992 global $tree;
00993
00994 switch ($a_event)
00995 {
00996 case "link":
00997
00998
00999
01000
01001 break;
01002
01003 case "cut":
01004
01005
01006
01007 break;
01008
01009 case "copy":
01010
01011
01012
01013
01014 break;
01015
01016 case "paste":
01017
01018
01019
01020 break;
01021
01022 case "new":
01023
01024
01025
01026 break;
01027 }
01028
01029
01030 if ($a_node_id==$_GET["ref_id"])
01031 {
01032 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
01033 $parent_type = $parent_obj->getType();
01034 if($parent_type == $this->getType())
01035 {
01036 $a_node_id = (int) $tree->getParentId($a_node_id);
01037 }
01038 }
01039
01040 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
01041 }
01042
01043
01044 function getXMLZip()
01045 {
01046 include_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
01047
01048 $glo_exp = new ilGlossaryExport($this);
01049
01050 return $glo_exp->buildExportFile();
01051 }
01052
01053
01054 }
01055
01056 ?>