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.ilObjectGUI.php");
00025 require_once("classes/class.ilMetaDataGUI.php");
00026 require_once("content/classes/class.ilObjGlossary.php");
00027 require_once("content/classes/class.ilGlossaryTermGUI.php");
00028 require_once("content/classes/class.ilGlossaryDefinition.php");
00029 require_once("content/classes/class.ilTermDefinitionEditorGUI.php");
00030 require_once("content/classes/Pages/class.ilPCParagraph.php");
00031
00044 class ilGlossaryPresentationGUI
00045 {
00046 var $admin_tabs;
00047 var $glossary;
00048 var $ilias;
00049 var $tpl;
00050 var $lng;
00051
00056 function ilGlossaryPresentationGUI()
00057 {
00058 global $lng, $ilias, $tpl, $ilCtrl;
00059
00060 $this->tpl =& $tpl;
00061 $this->lng =& $lng;
00062 $this->ilias =& $ilias;
00063 $this->ctrl =& $ilCtrl;
00064 $this->offline = false;
00065 $this->ctrl->saveParameter($this, array("ref_id"));
00066
00067
00068 include_once("content/classes/class.ilObjGlossaryGUI.php");
00069 $this->glossary_gui =& new ilObjGlossaryGUI("", $_GET["ref_id"], true, "");
00070 $this->glossary =& $this->glossary_gui->object;
00071
00072 }
00073
00074
00078 function setOfflineMode($a_offline = true)
00079 {
00080 $this->offline = $a_offline;
00081 }
00082
00083
00087 function offlineMode()
00088 {
00089 return $this->offline;
00090 }
00091
00095 function setOfflineDirectory($a_dir)
00096 {
00097 $this->offline_dir = $a_dir;
00098 }
00099
00100
00104 function getOfflineDirectory()
00105 {
00106 return $this->offline_dir;
00107 }
00108
00109
00113 function &executeCommand()
00114 {
00115 global $lng, $ilAccess, $ilias;
00116
00117 $lng->loadLanguageModule("content");
00118
00119 $next_class = $this->ctrl->getNextClass($this);
00120 $cmd = $this->ctrl->getCmd("listTerms");
00121
00122
00123 if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) &&
00124 !($ilAccess->checkAccess("visible", "", $_GET["ref_id"]) &&
00125 ($cmd == "infoScreen" || strtolower($next_class) == "ilinfoscreengui")))
00126 {
00127 $ilias->raiseError($lng->txt("permission_denied"),$ilias->error_obj->MESSAGE);
00128 }
00129
00130 if ($cmd != "listDefinitions")
00131 {
00132 $this->prepareOutput();
00133 }
00134
00135 switch($next_class)
00136 {
00137 case "ilnotegui":
00138 $this->setTabs();
00139 $ret =& $this->listDefinitions();
00140 break;
00141
00142 case "ilinfoscreengui":
00143 $ret =& $this->outputInfoScreen();
00144 break;
00145
00146 default:
00147 $ret =& $this->$cmd();
00148 break;
00149 }
00150
00151 $this->tpl->show();
00152 }
00153
00154 function prepareOutput()
00155 {
00156 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00157 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00158 $title = $this->glossary->getTitle();
00159
00160
00161 sendInfo();
00162
00163 $this->tpl->setTitle($title);
00164 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo_b.gif"));
00165
00166 $this->setLocator();
00167 }
00168
00169 function clearTerms()
00170 {
00171 $_REQUEST["term"] = "";
00172 $_GET["offset"] = $_GET["oldoffset"];
00173 $this->searchTerms();
00174 }
00175
00176 function searchTerms ()
00177 {
00178 $term_list = $this->glossary->getTermList($_REQUEST["term"]);
00179 $this->listTermByGiven($term_list, $_REQUEST["term"]);
00180 }
00181
00182
00183 function listTerms()
00184 {
00185 $term_list = $this->glossary->getTermList();
00186
00187 return $this->listTermByGiven($term_list);
00188 }
00189
00193 function listTermByGiven($term_list, $filter ="")
00194 {
00195 global $ilCtrl;
00196
00197 $this->lng->loadLanguageModule("meta");
00198 include_once "./classes/class.ilTableGUI.php";
00199
00200 $this->setTabs();
00201
00202
00203
00204
00205 $oldoffset = (is_numeric ($_GET["oldoffset"]))?$_GET["oldoffset"]:$_GET["offset"];
00206
00207 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.glossary_presentation.html", true);
00208
00209
00210 if (!$this->offlineMode())
00211 {
00212 $this->tpl->setCurrentBlock("search_form");
00213 $this->ctrl->setParameter($this, "offset", 0);
00214 $this->ctrl->setParameter($this, "oldoffset", $oldoffset);
00215 $this->tpl->setVariable("FORMACTION1",
00216 $this->ctrl->getFormAction($this));
00217 $this->tpl->setVariable("TXT_TERM", $this->lng->txt("cont_term"));
00218 $this->tpl->setVariable("TXT_SEARCH", $this->lng->txt("search"));
00219 $this->tpl->setVariable("TXT_CLEAR", $this->lng->txt("clear"));
00220 $this->tpl->setVariable("TERM", $filter);
00221 $this->tpl->parseCurrentBlock();
00222 }
00223
00224
00225
00226 $this->tpl->addBlockfile("TERM_TABLE", "term_table", "tpl.table.html");
00227
00228 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_tbl_pres_row.html", true);
00229
00230 $num = 2;
00231
00232
00233 $tbl = new ilTableGUI();
00234
00235
00236 $tbl->setTitle($this->lng->txt("cont_terms").(($filter=="")?"":"*"));
00237 $tbl->disable("sort");
00238
00239
00240
00241 if ($this->glossary->isVirtual())
00242 {
00243 $tbl->setHeaderNames(array($this->lng->txt("cont_term"),
00244 $this->lng->txt("cont_definitions"),$this->lng->txt("obj_glo")));
00245
00246 $cols = array("term", "definitions", "glossary");
00247
00248 $tbl->setColumnWidth(array("30%", "35%", "35%"));
00249 }
00250 else
00251 {
00252 $tbl->setHeaderNames(array($this->lng->txt("cont_term"),
00253 $this->lng->txt("cont_definitions")));
00254
00255 $cols = array("term", "definitions");
00256
00257 $tbl->setColumnWidth(array("30%", "70%"));
00258 }
00259
00260 if (!$this->offlineMode())
00261 {
00262 $header_params = $this->ctrl->getParameterArrayByClass("ilglossarypresentationgui", "listTerms");
00263 }
00264
00265
00266 if (!empty ($filter)) {
00267 $header_params ["cmd"] = "searchTerms";
00268 $header_params ["term"] = $filter;
00269 $header_params ["oldoffset"] = $_GET["oldoffset"];
00270 }
00271
00272 $tbl->setHeaderVars($cols, $header_params);
00273
00274
00275 $tbl->setOrderColumn($_GET["sort_by"]);
00276 $tbl->setOrderDirection($_GET["sort_order"]);
00277 if ($this->offlineMode())
00278 {
00279 $_GET["limit"] = 99999;
00280 $_GET["offset"] = 0;
00281 $tbl->disable("sort");
00282 $tbl->disable("footer");
00283 }
00284 $tbl->setOffset($_GET["offset"]);
00285 $tbl->setLimit($_GET["limit"]);
00286
00287
00288 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00289
00290
00291 $tbl->setMaxCount(count($term_list));
00292
00293
00294
00295
00296 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00297
00298 $tbl->render();
00299
00300 if (count($term_list) > 0)
00301 {
00302 $i=1;
00303 foreach($term_list as $key => $term)
00304 {
00305 $css_row = ilUtil::switchColor($i++,"tblrow1","tblrow2");
00306 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00307
00308 for($j=0; $j<count($defs); $j++)
00309 {
00310 $def = $defs[$j];
00311 if (count($defs) > 1)
00312 {
00313 $this->tpl->setCurrentBlock("definition");
00314 $this->tpl->setVariable("DEF_TEXT", $this->lng->txt("cont_definition")." ".($j + 1));
00315 $this->tpl->parseCurrentBlock();
00316 }
00317
00318
00319 $this->tpl->setCurrentBlock("definition");
00320 $short_str = ilPCParagraph::xml2output($def["short_text"]);
00321
00322
00323
00324 $ltexs = strrpos($short_str, "[tex]");
00325 $ltexe = strrpos($short_str, "[/tex]");
00326 if ($ltexs > $ltexe)
00327 {
00328 $page =& new ilPageObject("gdf", $def["id"]);
00329 $page->buildDom();
00330 $short_str = $page->getFirstParagraphText();
00331 $short_str = strip_tags($short_str, "<br>");
00332 $ltexe = strpos($short_str, "[/tex]", $ltexs);
00333 $short_str = ilUtil::shortenText($short_str, $ltexe+6, true);
00334 }
00335 if (!$this->offlineMode())
00336 {
00337 $short_str = ilUtil::insertLatexImages($short_str);
00338 }
00339 else
00340 {
00341 $short_str = ilUtil::buildLatexImages($short_str,
00342 $this->getOfflineDirectory());
00343 }
00344
00345 $this->tpl->setVariable("DEF_SHORT", $short_str);
00346 $this->tpl->parseCurrentBlock();
00347
00348 $this->tpl->setCurrentBlock("definition_row");
00349 $this->tpl->parseCurrentBlock();
00350 }
00351
00352
00353 if ($this->glossary->isVirtual())
00354 {
00355 $this->tpl->setCurrentBlock("glossary_row");
00356 $glo_title = ilObject::_lookupTitle($term["glo_id"]);
00357 $this->tpl->setVariable("GLO_TITLE", $glo_title);
00358 $this->tpl->parseCurrentBlock();
00359 }
00360
00361 $this->tpl->setCurrentBlock("view_term");
00362 $this->tpl->setVariable("TEXT_TERM", $term["term"]);
00363 if (!$this->offlineMode())
00364 {
00365 if (!empty ($filter))
00366 {
00367 $this->ctrl->setParameter($this, "term", $filter);
00368 $this->ctrl->setParameter($this, "oldoffset", $_GET["oldoffset"]);
00369 }
00370 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00371 $this->ctrl->setParameter($this, "offset", $_GET["offset"]);
00372 $this->tpl->setVariable("LINK_VIEW_TERM",
00373 $this->ctrl->getLinkTarget($this, "listDefinitions"));
00374 $this->ctrl->clearParameters($this);
00375 }
00376 else
00377 {
00378 $this->tpl->setVariable("LINK_VIEW_TERM", "term_".$term["id"].".html");
00379 }
00380 $this->tpl->setVariable("ANCHOR_TERM", "term_".$term["id"]);
00381 $this->tpl->parseCurrentBlock();
00382
00383 $this->tpl->setVariable("CSS_ROW", $css_row);
00384 $this->tpl->setVariable("TEXT_LANGUAGE", $this->lng->txt("meta_l_".$term["language"]));
00385 $this->tpl->setCurrentBlock("tbl_content");
00386 $this->tpl->parseCurrentBlock();
00387
00388 $this->ctrl->clearParameters($this);
00389 }
00390 }
00391 else
00392 {
00393 $this->tpl->setCurrentBlock("notfound");
00394 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00395 $this->tpl->setVariable("NUM_COLS", $num);
00396 $this->tpl->parseCurrentBlock();
00397 }
00398
00399 if ($this->offlineMode())
00400 {
00401 return $this->tpl->get();
00402 }
00403 }
00404
00408 function listDefinitions()
00409 {
00410 global $ilUser;
00411
00412 require_once("content/classes/Pages/class.ilPageObjectGUI.php");
00413 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00414 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00415
00416 $this->setTabs();
00417
00418 if ($this->offlineMode())
00419 {
00420 $style_name = $ilUser->prefs["style"].".css";;
00421 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00422 }
00423 else
00424 {
00425 $this->setLocator();
00426 }
00427
00428
00429 $this->tpl->setCurrentBlock("ContentStyle");
00430 if (!$this->offlineMode())
00431 {
00432 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00433 ilObjStyleSheet::getContentStylePath(0));
00434 }
00435 else
00436 {
00437 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET","content.css");
00438 }
00439 $this->tpl->parseCurrentBlock();
00440
00441
00442 $this->tpl->setCurrentBlock("SyntaxStyle");
00443 if (!$this->offlineMode())
00444 {
00445 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00446 ilObjStyleSheet::getSyntaxStylePath());
00447 }
00448 else
00449 {
00450 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00451 "syntaxhighlight.css");
00452 }
00453 $this->tpl->parseCurrentBlock();
00454
00455 $term =& new ilGlossaryTerm($_GET["term_id"]);
00456 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_term_b.gif"));
00457 $this->tpl->setTitle($this->lng->txt("cont_term").": ".$term->getTerm());
00458
00459
00460 $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", true);
00461
00462
00463 $defs = ilGlossaryDefinition::getDefinitionList($_GET["term_id"]);
00464
00465 $this->tpl->setVariable("TXT_TERM", $term->getTerm());
00466 $this->mobs = array();
00467
00468 for($j=0; $j<count($defs); $j++)
00469 {
00470 $def = $defs[$j];
00471 $page =& new ilPageObject("gdf", $def["id"]);
00472 $page_gui =& new ilPageObjectGUI($page);
00473
00474
00475 $page->buildDom();
00476 $int_links = $page->getInternalLinks();
00477 $link_xml = $this->getLinkXML($int_links);
00478 $page_gui->setLinkXML($link_xml);
00479
00480 if ($this->offlineMode())
00481 {
00482 $page_gui->setOutputMode("offline");
00483 $page_gui->setOfflineDirectory($this->getOfflineDirectory());
00484 }
00485 $page_gui->setSourcecodeDownloadScript($this->getLink($_GET["ref_id"]));
00486 $page_gui->setFullscreenLink($this->getLink($_GET["ref_id"], "fullscreen", $_GET["term_id"], $def["id"]));
00487
00488 $page_gui->setTemplateOutput(false);
00489 $page_gui->setFileDownloadLink($this->getLink($_GET["ref_id"], "downloadFile"));
00490 if (!$this->offlineMode())
00491 {
00492 $output = $page_gui->preview();
00493 }
00494 else
00495 {
00496 $output = $page_gui->presentation($page_gui->getOutputMode());
00497 }
00498
00499 if (count($defs) > 1)
00500 {
00501 $this->tpl->setCurrentBlock("definition_header");
00502 $this->tpl->setVariable("TXT_DEFINITION",
00503 $this->lng->txt("cont_definition")." ".($j+1));
00504 $this->tpl->parseCurrentBlock();
00505 }
00506
00507 $this->tpl->setCurrentBlock("definition");
00508 $this->tpl->setVariable("PAGE_CONTENT", $output);
00509 $this->tpl->parseCurrentBlock();
00510 }
00511
00512
00513 $sources = ilInternalLink::_getSourcesOfTarget('git',$_GET['term_id'],0);
00514
00515 if ($sources)
00516 {
00517 $this->tpl->setVariable("BACKLINK_TITLE",$this->lng->txt('glo_term_used_in'));
00518
00519 foreach ($sources as $src)
00520 {
00521 $type = explode(':',$src['type']);
00522
00523 if ($type[0] == 'lm')
00524 {
00525 if ($type[1] == 'pg')
00526 {
00527 $title = ilLMPageObject::_getPresentationTitle($src['id']);
00528 $lm_id = ilLMObject::_lookupContObjID($src['id']);
00529 $lm_title = ilObject::_lookupTitle($lm_id);
00530 $this->tpl->setCurrentBlock('backlink_item');
00531 $this->tpl->setVariable("BACKLINK_LINK",ILIAS_HTTP_PATH."/goto.php?target=".$type[1]."_".$src['id']);
00532 $this->tpl->setVariable("BACKLINK_ITEM",$lm_title.": ".$title);
00533 $this->tpl->parseCurrentBlock();
00534 }
00535 }
00536 }
00537 }
00538
00539 $this->tpl->setCurrentBlock("perma_link");
00540 $this->tpl->setVariable("PERMA_LINK", ILIAS_HTTP_PATH.
00541 "/goto.php?target=".
00542 "git".
00543 "_".$_GET["term_id"]."_".$_GET["ref_id"]."&client_id=".CLIENT_ID);
00544 $this->tpl->setVariable("TXT_PERMA_LINK", $this->lng->txt("perma_link"));
00545 $this->tpl->setVariable("PERMA_TARGET", "_top");
00546 $this->tpl->parseCurrentBlock();
00547
00548 if ($this->offlineMode())
00549 {
00550
00551 return $this->tpl->get();
00552 }
00553 }
00554
00555
00559 function fullscreen()
00560 {
00561 $html = $this->media("fullscreen");
00562 return $html;
00563 }
00564
00568 function media($a_mode = "media")
00569 {
00570 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00571 include_once("classes/class.ilObjStyleSheet.php");
00572 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00573 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00574 ilObjStyleSheet::getContentStylePath(0));
00575
00576
00577 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00578
00579
00580
00581
00582 $link_xlm = "";
00583
00584 require_once("content/classes/Media/class.ilObjMediaObject.php");
00585 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00586
00587 $xml = "<dummy>";
00588
00589
00590 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00591 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00592 $xml.= $link_xml;
00593 $xml.="</dummy>";
00594 $xsl = file_get_contents("./content/page.xsl");
00595 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00596 $xh = xslt_create();
00597
00598 if (!$this->offlineMode())
00599 {
00600 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00601 $wb_path = ilUtil::getWebspaceDir("output");
00602 }
00603 else
00604 {
00605 $enlarge_path = "images/enlarge.gif";
00606 $wb_path = ".";
00607 }
00608
00609 $mode = $a_mode;
00610
00611 $this->ctrl->setParameter($this, "obj_type", "MediaObject");
00612 $fullscreen_link =
00613 $this->getLink($_GET["ref_id"], "fullscreen");
00614 $this->ctrl->clearParameters($this);
00615
00616 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00617 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00618 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00619 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00620 echo xslt_error($xh);
00621 xslt_free($xh);
00622
00623
00624 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00625
00626 $this->tpl->parseCurrentBlock();
00627 if ($this->offlineMode())
00628 {
00629 $html = $this->tpl->get();
00630 return $html;
00631 }
00632
00633 }
00634
00638 function showDownloadList()
00639 {
00640 global $ilBench;
00641
00642 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glo_download_list.html", true);
00643
00644 $this->setTabs();
00645
00646
00647 $this->tpl->setTitle($this->glossary->getTitle());
00648
00649 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo_b.gif"));
00650
00651
00652 require_once("classes/class.ilTableGUI.php");
00653 $tbl = new ilTableGUI();
00654
00655
00656 $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
00657
00658
00659 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", true);
00660
00661 $export_files = array();
00662 $types = array("xml", "html");
00663 foreach($types as $type)
00664 {
00665 if ($this->glossary->getPublicExportFile($type) != "")
00666 {
00667 $dir = $this->glossary->getExportDirectory($type);
00668 if (is_file($this->glossary->getExportDirectory($type)."/".
00669 $this->glossary->getPublicExportFile($type)))
00670 {
00671 $size = filesize($this->glossary->getExportDirectory($type)."/".
00672 $this->glossary->getPublicExportFile($type));
00673 $export_files[] = array("type" => $type,
00674 "file" => $this->glossary->getPublicExportFile($type),
00675 "size" => $size);
00676 }
00677 }
00678 }
00679
00680 $num = 0;
00681
00682 $tbl->setTitle($this->lng->txt("download"));
00683
00684 $tbl->setHeaderNames(array($this->lng->txt("cont_format"),
00685 $this->lng->txt("cont_file"),
00686 $this->lng->txt("size"), $this->lng->txt("date"),
00687 ""));
00688
00689 $cols = array("format", "file", "size", "date", "download");
00690 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
00691 "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
00692 $tbl->setHeaderVars($cols, $header_params);
00693 $tbl->setColumnWidth(array("10%", "30%", "20%", "20%","20%"));
00694 $tbl->disable("sort");
00695
00696
00697 $tbl->setOrderColumn($_GET["sort_by"]);
00698 $tbl->setOrderDirection($_GET["sort_order"]);
00699 $tbl->setLimit($_GET["limit"]);
00700 $tbl->setOffset($_GET["offset"]);
00701 $tbl->setMaxCount($this->maxcount);
00702
00703 $this->tpl->setVariable("COLUMN_COUNTS", 5);
00704
00705
00706
00707 $tbl->disable("footer");
00708
00709 $tbl->setMaxCount(count($export_files));
00710 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
00711
00712 $tbl->render();
00713 if(count($export_files) > 0)
00714 {
00715 $i=0;
00716 foreach($export_files as $exp_file)
00717 {
00718 $this->tpl->setCurrentBlock("tbl_content");
00719 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
00720
00721 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00722 $this->tpl->setVariable("CSS_ROW", $css_row);
00723
00724 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
00725 $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
00726 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
00727
00728 $file_arr = explode("__", $exp_file["file"]);
00729 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
00730
00731 $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
00732 $this->ctrl->setParameter($this, "type", $exp_file["type"]);
00733 $this->tpl->setVariable("LINK_DOWNLOAD",
00734 $this->ctrl->getLinkTarget($this, "downloadExportFile"));
00735
00736 $this->tpl->parseCurrentBlock();
00737 }
00738 }
00739 else
00740 {
00741 $this->tpl->setCurrentBlock("notfound");
00742 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00743 $this->tpl->setVariable("NUM_COLS", 5);
00744 $this->tpl->parseCurrentBlock();
00745 }
00746
00747
00748 }
00749
00753 function downloadExportFile()
00754 {
00755 $file = $this->glossary->getPublicExportFile($_GET["type"]);
00756 if ($this->glossary->getPublicExportFile($_GET["type"]) != "")
00757 {
00758 $dir = $this->glossary->getExportDirectory($_GET["type"]);
00759 if (is_file($dir."/".$file))
00760 {
00761 ilUtil::deliverFile($dir."/".$file, $file);
00762 exit;
00763 }
00764 }
00765 $this->ilias->raiseError($this->lng->txt("file_not_found"),$this->ilias->error_obj->MESSAGE);
00766 }
00767
00775 function setLocator($a_tree = "", $a_id = "")
00776 {
00777 global $ilias_locator;
00778
00779
00780 require_once ("content/classes/class.ilGlossaryLocatorGUI.php");
00781 $gloss_loc =& new ilGlossaryLocatorGUI();
00782 $gloss_loc->setMode("presentation");
00783 if (!empty($_GET["term_id"]))
00784 {
00785 $term =& new ilGlossaryTerm($_GET["term_id"]);
00786 $gloss_loc->setTerm($term);
00787 }
00788 $gloss_loc->setGlossary($this->glossary);
00789
00790 $gloss_loc->display();
00791 }
00792
00796 function downloadFile()
00797 {
00798 $file = explode("_", $_GET["file_id"]);
00799 include_once("classes/class.ilObjFile.php");
00800 $fileObj =& new ilObjFile($file[count($file) - 1], false);
00801 $fileObj->sendFile();
00802 exit;
00803 }
00804
00808 function setTabs()
00809 {
00810 global $ilTabs;
00811
00812 #include_once("classes/class.ilTabsGUI.php");
00813 #$tabs_gui =& new ilTabsGUI();
00814 $this->getTabs($ilTabs);
00815
00816 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00817
00818 }
00819
00823 function getLinkXML($a_int_links)
00824 {
00825
00826 if ($a_layoutframes == "")
00827 {
00828 $a_layoutframes = array();
00829 }
00830 $link_info = "<IntLinkInfos>";
00831 foreach ($a_int_links as $int_link)
00832 {
00833
00834 $target = $int_link["Target"];
00835 if (substr($target, 0, 4) == "il__")
00836 {
00837 $target_arr = explode("_", $target);
00838 $target_id = $target_arr[count($target_arr) - 1];
00839 $type = $int_link["Type"];
00840 $targetframe = ($int_link["TargetFrame"] != "")
00841 ? $int_link["TargetFrame"]
00842 : "None";
00843
00844 if ($targetframe == "New")
00845 {
00846 $ltarget = "_blank";
00847 }
00848 else
00849 {
00850 $ltarget = "";
00851 }
00852
00853 switch($type)
00854 {
00855 case "PageObject":
00856 case "StructureObject":
00857 $lm_id = ilLMObject::_lookupContObjID($target_id);
00858 $cont_obj =& $this->content_object;
00859 if ($type == "PageObject")
00860 {
00861 $href = "./goto.php?target=pg_".$target_id;
00862 }
00863 else
00864 {
00865 $href = "./goto.php?target=st_".$target_id;
00866 }
00867
00868 break;
00869
00870 case "GlossaryItem":
00871 if (ilGlossaryTerm::_lookGlossaryID($target_id) == $this->glossary->getId())
00872 {
00873 if ($this->offlineMode())
00874 {
00875 $href = "term_".$target_id.".html";
00876 }
00877 else
00878 {
00879 $this->ctrl->setParameter($this, "term_id", $target_id);
00880 $href = $this->ctrl->getLinkTarget($this, "listDefinitions");
00881 $href = str_replace("&", "&", $href);
00882 }
00883 }
00884 else
00885 {
00886 $href = "./goto.php?target=git_".$target_id;
00887 }
00888 break;
00889
00890 case "MediaObject":
00891 if ($this->offlineMode())
00892 {
00893 $href = "media_".$target_id.".html";
00894 }
00895 else
00896 {
00897 $this->ctrl->setParameter($this, "obj_type", $type);
00898 $this->ctrl->setParameter($this, "mob_id", $target_id);
00899 $href = $this->ctrl->getLinkTarget($this, "media");
00900 $href = str_replace("&", "&", $href);
00901 }
00902 break;
00903
00904 case "RepositoryItem":
00905 $obj_type = ilObject::_lookupType($target_id, true);
00906 $obj_id = ilObject::_lookupObjId($target_id);
00907 $href = "./goto.php?target=".$obj_type."_".$target_id;
00908 $t_frame = ilFrameTargetInfo::_getFrame("MainContent", $obj_type);
00909 $ltarget = $t_frame;
00910 break;
00911
00912 }
00913 $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".
00914 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
00915
00916 $this->ctrl->clearParameters($this);
00917 }
00918 }
00919 $link_info.= "</IntLinkInfos>";
00920
00921 return $link_info;
00922 }
00923
00924
00928 function getLink($a_ref_id, $a_cmd = "", $a_term_id = "", $a_def_id = "",
00929 $a_frame = "", $a_type = "")
00930 {
00931 if ($a_cmd == "")
00932 {
00933 $a_cmd = "layout";
00934 }
00935
00936
00937
00938 if (!$this->offlineMode())
00939 {
00940
00941 switch ($a_cmd)
00942 {
00943 case "fullscreen":
00944 $this->ctrl->setParameter($this, "def_id", $a_def_id);
00945 $link = $this->ctrl->getLinkTarget($this, "fullscreen");
00946 $link = str_replace("&", "&", $link);
00947 break;
00948
00949 default:
00950 $link.= "&cmd=".$a_cmd;
00951 if ($a_frame != "")
00952 {
00953 $this->ctrl->setParameter($this, "frame", $a_frame);
00954 }
00955 if ($a_obj_id != "")
00956 {
00957 switch ($a_type)
00958 {
00959 case "MediaObject":
00960 $this->ctrl->setParameter($this, "mob_id", $a_obj_id);
00961 break;
00962
00963 default:
00964 $this->ctrl->setParameter($this, "def_id", $a_def_id);
00965 break;
00966 }
00967 }
00968 if ($a_type != "")
00969 {
00970 $this->ctrl->setParameter($this, "obj_type", $a_type);
00971 }
00972 $link = $this->ctrl->getLinkTarget($this, $a_cmd);
00973 $link = str_replace("&", "&", $link);
00974 break;
00975 }
00976 }
00977 else
00978 {
00979 switch ($a_cmd)
00980 {
00981 case "downloadFile":
00982 break;
00983
00984 case "fullscreen":
00985 $link = "fullscreen.html";
00986 break;
00987
00988 case "layout":
00989 break;
00990
00991 case "glossary":
00992 $link = "term_".$a_obj_id.".html";
00993 break;
00994
00995 case "media":
00996 $link = "media_".$a_obj_id.".html";
00997 break;
00998
00999 default:
01000 break;
01001 }
01002 }
01003 $this->ctrl->clearParameters($this);
01004 return $link;
01005 }
01006
01007
01011 function getTabs(&$tabs_gui)
01012 {
01013 global $ilAccess;
01014
01015 $oldoffset = (is_numeric ($_GET["oldoffset"]))?$_GET["oldoffset"]:$_GET["offset"];
01016
01017 if (!$this->offlineMode())
01018 {
01019 if ($this->ctrl->getCmd() != "listDefinitions")
01020 {
01021 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
01022 {
01023 $tabs_gui->addTarget("cont_terms",
01024 $this->ctrl->getLinkTarget($this, "listTerms"),
01025 array("listTerms", "searchTerms", "clearTerms", ""),
01026 "");
01027 }
01028
01029 $force_active = false;
01030 if ($this->ctrl->getCmd() == "showSummary" ||
01031 strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui")
01032 {
01033 $force_active = true;
01034 }
01035 $tabs_gui->addTarget("information_abbr",
01036 $this->ctrl->getLinkTarget($this, "infoScreen"), array("infoScreen"),
01037 "ilInfoScreenGUI", "", $force_active);
01038
01039
01040 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
01041 {
01042 if ($this->glossary->isActiveGlossaryMenu())
01043 {
01044
01045 if ($this->glossary->isActiveDownloads())
01046 {
01047 $tabs_gui->addTarget("download",
01048 $this->ctrl->getLinkTarget($this, "showDownloadList"), "showDownloadList",
01049 "");
01050 }
01051 }
01052 }
01053 }
01054 else
01055 {
01056 $this->ctrl->setParameter($this, "offset", $_GET["offset"]);
01057 if (!empty ($_REQUEST["term"]))
01058 {
01059 $this->ctrl->setParameter($this, "term", $_REQUEST["term"]);
01060 $this->ctrl->setParameter($this, "oldoffset", $_GET["oldoffset"]);
01061 $back = $this->ctrl->getLinkTarget($this, "searchTerms");
01062 }
01063 else
01064 {
01065 $back = $this->ctrl->getLinkTarget($this, "listTerms");
01066 }
01067 $tabs_gui->setBackTarget($this->lng->txt("obj_glo"),
01068 $back, "", "");
01069 }
01070
01071 }
01072 else
01073 {
01074 $tabs_gui->addTarget("cont_back",
01075 "index.html#term_".$_GET["term_id"], "",
01076 "");
01077 }
01078 }
01079
01080 function download_paragraph () {
01081 include_once("content/classes/Pages/class.ilPageObject.php");
01082 $pg_obj =& new ilPageObject("gdf", $_GET["pg_id"]);
01083 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
01084 }
01085
01086
01092 function infoScreen()
01093 {
01094 $this->ctrl->setCmd("showSummary");
01095 $this->ctrl->setCmdClass("ilinfoscreengui");
01096 $this->outputInfoScreen();
01097 }
01098
01102
01103
01104
01105
01106
01107
01111 function outputInfoScreen()
01112 {
01113 global $ilBench, $ilAccess;
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145 $this->setTabs();
01146 $this->lng->loadLanguageModule("meta");
01147
01148 include_once("classes/class.ilInfoScreenGUI.php");
01149
01150 $info = new ilInfoScreenGUI($this->glossary_gui);
01151 $info->enablePrivateNotes();
01152
01153
01154
01155 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
01156 {
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169 }
01170
01171
01172 $info->addMetaDataSections($this->glossary->getId(),0, $this->glossary->getType());
01173
01174 if ($this->offlineMode())
01175 {
01176 $this->tpl->setContent($info->getHTML());
01177 return $this->tpl->get();
01178 }
01179 else
01180 {
01181
01182 $this->ctrl->forwardCommand($info);
01183
01184
01185 }
01186 }
01187
01188 }
01189
01190 ?>