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
00042 class ilGlossaryPresentationGUI
00043 {
00044 var $admin_tabs;
00045 var $glossary;
00046 var $ilias;
00047 var $tpl;
00048 var $lng;
00049
00054 function ilGlossaryPresentationGUI()
00055 {
00056 global $lng, $ilias, $tpl;
00057
00058 $this->tpl =& $tpl;
00059 $this->lng =& $lng;
00060 $this->ilias =& $ilias;
00061 $this->offline = false;
00062
00063
00064 $this->glossary =& $this->ilias->obj_factory->getInstanceByRefId($_GET["ref_id"]);
00065
00066 }
00067
00068
00072 function setOfflineMode($a_offline = true)
00073 {
00074 $this->offline = $a_offline;
00075 }
00076
00077
00081 function offlineMode()
00082 {
00083 return $this->offline;
00084 }
00085
00086
00087
00091 function executeCommand()
00092 {
00093 $cmd = $_GET["cmd"];
00094 if ($cmd != "listDefinitions")
00095 {
00096 $this->prepareOutput();
00097 }
00098 if($cmd == "")
00099 {
00100 $cmd = "listTerms";
00101 }
00102
00103 $this->$cmd();
00104
00105 $this->tpl->show();
00106 }
00107
00108 function prepareOutput()
00109 {
00110 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00111 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00112 $title = $this->glossary->getTitle();
00113
00114
00115 sendInfo();
00116
00117 if (!empty($title))
00118 {
00119 $this->tpl->setVariable("HEADER", $title);
00120 }
00121
00122 $this->setLocator();
00123 }
00124
00125 function searchTerms () {
00126 if (isset ($_POST["clear"]))
00127 {
00128 $searchterm ="";
00129 $_GET["offset"] = $_GET["oldoffset"];
00130 } else
00131 {
00132 $searchterm = $_REQUEST ["term"];
00133 }
00134 $term_list = $this->glossary->getTermList($searchterm);
00135 $this->listTermByGiven($term_list, $searchterm);
00136
00137 }
00138
00139
00140 function listTerms()
00141 {
00142 $term_list = $this->glossary->getTermList();
00143
00144 return $this->listTermByGiven($term_list);
00145 }
00146
00150 function listTermByGiven($term_list, $filter ="")
00151 {
00152 global $ilCtrl;
00153
00154 $this->lng->loadLanguageModule("meta");
00155 include_once "./classes/class.ilTableGUI.php";
00156
00157
00158
00159
00160 $oldoffset = (is_numeric ($_GET["oldoffset"]))?$_GET["oldoffset"]:$_GET["offset"];
00161
00162 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.glossary_presentation.html", true);
00163
00164
00165 if (!$this->offlineMode())
00166 {
00167 $this->tpl->setCurrentBlock("search_form");
00168 $this->tpl->setVariable("FORMACTION1", "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&cmd=searchTerms&offset=0&oldoffset=$oldoffset");
00169 $this->tpl->setVariable("TXT_TERM", $this->lng->txt("cont_term"));
00170 $this->tpl->setVariable("TXT_SEARCH", $this->lng->txt("search"));
00171 $this->tpl->setVariable("TXT_CLEAR", $this->lng->txt("clear"));
00172 $this->tpl->setVariable("TERM", $filter);
00173 $this->tpl->parseCurrentBlock();
00174 }
00175
00176
00177 if ($this->glossary->isActiveGlossaryMenu())
00178 {
00179
00180 if (!$this->offlineMode() && $this->glossary->isActiveDownloads())
00181 {
00182 $this->tpl->setCurrentBlock("glo_menu_btn");
00183 $this->tpl->setVariable("BTN_LINK",
00184 "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&cmd=showDownloadList&offset=0&oldoffset=$oldoffset");
00185 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("download"));
00186 $this->tpl->parseCurrentBlock();
00187 }
00188
00189 $this->tpl->setCurrentBlock("glo_menu");
00190 $this->tpl->parseCurrentBlock();
00191 }
00192
00193
00194 $this->tpl->addBlockfile("TERM_TABLE", "term_table", "tpl.table.html");
00195
00196 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_tbl_pres_row.html", true);
00197
00198 $num = 2;
00199
00200
00201 $tbl = new ilTableGUI();
00202
00203
00204 $tbl->setTitle($this->lng->txt("cont_terms").(($filter=="")?"":"*"));
00205 $tbl->disable("sort");
00206
00207
00208
00209 if ($this->glossary->isVirtual())
00210 {
00211 $tbl->setHeaderNames(array($this->lng->txt("cont_term"),
00212 $this->lng->txt("cont_definitions"),$this->lng->txt("obj_glo")));
00213
00214 $cols = array("term", "definitions", "glossary");
00215
00216 $tbl->setColumnWidth(array("30%", "35%", "35%"));
00217 }
00218 else
00219 {
00220 $tbl->setHeaderNames(array($this->lng->txt("cont_term"),
00221 $this->lng->txt("cont_definitions")));
00222
00223 $cols = array("term", "definitions");
00224
00225 $tbl->setColumnWidth(array("30%", "70%"));
00226 }
00227
00228 $header_params = array("ref_id" => $_GET["ref_id"], "cmd" => "listTerms");
00229
00230 if (!empty ($filter)) {
00231 $header_params ["cmd"] = "searchTerms";
00232 $header_params ["term"] = $filter;
00233 $header_params ["oldoffset"] = $_GET["oldoffset"];
00234 }
00235
00236 $tbl->setHeaderVars($cols, $header_params);
00237
00238
00239 $tbl->setOrderColumn($_GET["sort_by"]);
00240 $tbl->setOrderDirection($_GET["sort_order"]);
00241 if ($this->offlineMode())
00242 {
00243 $_GET["limit"] = 99999;
00244 $_GET["offset"] = 0;
00245 $tbl->disable("sort");
00246 $tbl->disable("footer");
00247 }
00248 $tbl->setOffset($_GET["offset"]);
00249 $tbl->setLimit($_GET["limit"]);
00250 $tbl->setMaxCount($this->maxcount);
00251
00252
00253
00254
00255 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00256
00257
00258 $tbl->setMaxCount(count($term_list));
00259
00260
00261
00262
00263 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00264
00265 $tbl->render();
00266
00267 if (count($term_list) > 0)
00268 {
00269 $i=1;
00270 foreach($term_list as $key => $term)
00271 {
00272 $css_row = ilUtil::switchColor($i++,"tblrow1","tblrow2");
00273 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00274
00275 for($j=0; $j<count($defs); $j++)
00276 {
00277 $def = $defs[$j];
00278 if (count($defs) > 1)
00279 {
00280 $this->tpl->setCurrentBlock("definition");
00281 $this->tpl->setVariable("DEF_TEXT", $this->lng->txt("cont_definition")." ".($j + 1));
00282 $this->tpl->parseCurrentBlock();
00283 }
00284
00285
00286 $this->tpl->setCurrentBlock("definition");
00287 $short_str = ilPCParagraph::xml2output($def["short_text"]);
00288
00289
00290 $this->tpl->setVariable("DEF_SHORT", $short_str);
00291 $this->tpl->parseCurrentBlock();
00292
00293 $this->tpl->setCurrentBlock("definition_row");
00294 $this->tpl->parseCurrentBlock();
00295 }
00296
00297
00298 if ($this->glossary->isVirtual())
00299 {
00300 $this->tpl->setCurrentBlock("glossary_row");
00301 $glo_title = ilObject::_lookupTitle($term["glo_id"]);
00302 $this->tpl->setVariable("GLO_TITLE", $glo_title);
00303 $this->tpl->parseCurrentBlock();
00304 }
00305
00306 $this->tpl->setCurrentBlock("view_term");
00307 $this->tpl->setVariable("TEXT_TERM", $term["term"]);
00308 if (!empty ($filter)) {
00309 $append = "&term=$filter&oldoffset=".$_GET["oldoffset"];
00310 }
00311 if (!$this->offlineMode())
00312 {
00313 $this->tpl->setVariable("LINK_VIEW_TERM", "glossary_presentation.php?ref_id=".
00314 $_GET["ref_id"]."&cmd=listDefinitions&term_id=".$term["id"]."&offset=".$_GET["offset"].$append);
00315 }
00316 else
00317 {
00318 $this->tpl->setVariable("LINK_VIEW_TERM", "term_".$term["id"].".html");
00319 }
00320 $this->tpl->setVariable("ANCHOR_TERM", "term_".$term["id"]);
00321 $this->tpl->parseCurrentBlock();
00322
00323 $this->tpl->setVariable("CSS_ROW", $css_row);
00324 $this->tpl->setVariable("TEXT_LANGUAGE", $this->lng->txt("meta_l_".$term["language"]));
00325 $this->tpl->setCurrentBlock("tbl_content");
00326 $this->tpl->parseCurrentBlock();
00327 }
00328 }
00329 else
00330 {
00331 $this->tpl->setCurrentBlock("notfound");
00332 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00333 $this->tpl->setVariable("NUM_COLS", $num);
00334 $this->tpl->parseCurrentBlock();
00335 }
00336
00337 if ($this->offlineMode())
00338 {
00339 return $this->tpl->get();
00340 }
00341 }
00342
00346 function listDefinitions()
00347 {
00348 global $ilUser;
00349
00350 require_once("content/classes/Pages/class.ilPageObjectGUI.php");
00351 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
00352 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00353
00354 $this->setTabs();
00355
00356 if ($this->offlineMode())
00357 {
00358 $style_name = $ilUser->prefs["style"].".css";;
00359 $this->tpl->setVariable("LOCATION_STYLESHEET","./".$style_name);
00360 }
00361 else
00362 {
00363 $this->setLocator();
00364 }
00365
00366
00367 $this->tpl->setCurrentBlock("ContentStyle");
00368 if (!$this->offlineMode())
00369 {
00370 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00371 ilObjStyleSheet::getContentStylePath(0));
00372 }
00373 else
00374 {
00375 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET","content.css");
00376 }
00377 $this->tpl->parseCurrentBlock();
00378
00379
00380 $this->tpl->setCurrentBlock("SyntaxStyle");
00381 if (!$this->offlineMode())
00382 {
00383 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00384 ilObjStyleSheet::getSyntaxStylePath());
00385 }
00386 else
00387 {
00388 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00389 "syntaxhighlight.css");
00390 }
00391 $this->tpl->parseCurrentBlock();
00392
00393 $term =& new ilGlossaryTerm($_GET["term_id"]);
00394 $this->tpl->setVariable("HEADER",
00395 $this->lng->txt("cont_term").": ".$term->getTerm());
00396
00397
00398
00399 $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", true);
00400
00401
00402 $defs = ilGlossaryDefinition::getDefinitionList($_GET["term_id"]);
00403
00404 $this->tpl->setVariable("TXT_TERM", $term->getTerm());
00405 $this->mobs = array();
00406
00407 for($j=0; $j<count($defs); $j++)
00408 {
00409 $def = $defs[$j];
00410 $page =& new ilPageObject("gdf", $def["id"]);
00411 $page_gui =& new ilPageObjectGUI($page);
00412
00413
00414 $page->buildDom();
00415 $int_links = $page->getInternalLinks();
00416 $link_xml = $this->getLinkXML($int_links);
00417 $page_gui->setLinkXML($link_xml);
00418
00419 if ($this->offlineMode())
00420 {
00421 $page_gui->setOutputMode("offline");
00422 }
00423 $page_gui->setSourcecodeDownloadScript($this->getLink($_GET["ref_id"]));
00424 $page_gui->setFullscreenLink($this->getLink($_GET["ref_id"], "fullscreen", $_GET["term_id"], $def["id"]));
00425
00426 $page_gui->setTemplateOutput(false);
00427 $page_gui->setFileDownloadLink($this->getLink($_GET["ref_id"], "downloadFile"));
00428 if (!$this->offlineMode())
00429 {
00430 $output = $page_gui->preview();
00431 }
00432 else
00433 {
00434 $output = $page_gui->presentation($page_gui->getOutputMode());
00435 }
00436
00437 if (count($defs) > 1)
00438 {
00439 $this->tpl->setCurrentBlock("definition_header");
00440 $this->tpl->setVariable("TXT_DEFINITION",
00441 $this->lng->txt("cont_definition")." ".($j+1));
00442 $this->tpl->parseCurrentBlock();
00443 }
00444
00445 $this->tpl->setCurrentBlock("definition");
00446 $this->tpl->setVariable("PAGE_CONTENT", $output);
00447 $this->tpl->parseCurrentBlock();
00448 }
00449
00450
00451 $sources = ilInternalLink::_getSourcesOfTarget('git',$_GET['term_id'],0);
00452
00453 if ($sources)
00454 {
00455 $this->tpl->setVariable("BACKLINK_TITLE",$this->lng->txt('glo_term_used_in'));
00456
00457 foreach ($sources as $src)
00458 {
00459 $type = explode(':',$src['type']);
00460
00461 if ($type[0] == 'lm')
00462 {
00463 if ($type[1] == 'pg')
00464 {
00465 $title = ilLMPageObject::_getPresentationTitle($src['id']);
00466 $lm_id = ilLMObject::_lookupContObjID($src['id']);
00467 $lm_title = ilObject::_lookupTitle($lm_id);
00468 $this->tpl->setCurrentBlock('backlink_item');
00469 $this->tpl->setVariable("BACKLINK_LINK",ILIAS_HTTP_PATH."/goto.php?target=".$type[1]."_".$src['id']);
00470 $this->tpl->setVariable("BACKLINK_ITEM",$lm_title.": ".$title);
00471 $this->tpl->parseCurrentBlock();
00472 }
00473 }
00474 }
00475 }
00476 if ($this->offlineMode())
00477 {
00478
00479 return $this->tpl->get();
00480 }
00481 }
00482
00483
00487 function fullscreen()
00488 {
00489 $this->media("fullscreen");
00490 }
00491
00495 function media($a_mode = "media")
00496 {
00497 $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "content");
00498 include_once("classes/class.ilObjStyleSheet.php");
00499 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00500 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00501 ilObjStyleSheet::getContentStylePath(0));
00502
00503
00504 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00505
00506
00507
00508
00509 $link_xlm = "";
00510
00511 require_once("content/classes/Media/class.ilObjMediaObject.php");
00512 $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
00513
00514 $xml = "<dummy>";
00515
00516
00517 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
00518 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
00519 $xml.= $link_xml;
00520 $xml.="</dummy>";
00521
00522 $xsl = file_get_contents("./content/page.xsl");
00523 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00524 $xh = xslt_create();
00525
00526 $wb_path = ilUtil::getWebspaceDir("output");
00527
00528 $mode = $a_mode;
00529 $enlarge_path = ilUtil::getImagePath("enlarge.gif", false, "output");
00530 $fullscreen_link = "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&obj_type=MediaObject&cmd=fullscreen"
00531 ;
00532 $params = array ('mode' => $mode, 'enlarge_path' => $enlarge_path,
00533 'link_params' => "ref_id=".$_GET["ref_id"],'fullscreen_link' => $fullscreen_link,
00534 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
00535 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00536 echo xslt_error($xh);
00537 xslt_free($xh);
00538
00539
00540 $this->tpl->setVariable("MEDIA_CONTENT", $output);
00541
00542 $this->tpl->parseCurrentBlock();
00543 if (!$this->offlineMode())
00544 {
00545 $this->tpl->show();
00546 }
00547 else
00548 {
00549 return $this->tpl->get();
00550 }
00551
00552 }
00553
00557 function showDownloadList()
00558 {
00559 global $ilBench;
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glo_download_list.html", true);
00570
00571
00572 $this->tpl->setVariable("HEADER", $this->glossary->getTitle());
00573 $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
00574 $this->tpl->setVariable("LINK_BACK",
00575 "glossary_presentation.php?ref_id=".$_GET["ref_id"]);
00576
00577
00578 require_once("classes/class.ilTableGUI.php");
00579 $tbl = new ilTableGUI();
00580
00581
00582 $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
00583
00584
00585 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", true);
00586
00587 $export_files = array();
00588 $types = array("xml", "html");
00589 foreach($types as $type)
00590 {
00591 if ($this->glossary->getPublicExportFile($type) != "")
00592 {
00593 $dir = $this->glossary->getExportDirectory($type);
00594 if (is_file($this->glossary->getExportDirectory($type)."/".
00595 $this->glossary->getPublicExportFile($type)))
00596 {
00597 $size = filesize($this->glossary->getExportDirectory($type)."/".
00598 $this->glossary->getPublicExportFile($type));
00599 $export_files[] = array("type" => $type,
00600 "file" => $this->glossary->getPublicExportFile($type),
00601 "size" => $size);
00602 }
00603 }
00604 }
00605
00606 $num = 0;
00607
00608 $tbl->setTitle($this->lng->txt("download"));
00609
00610 $tbl->setHeaderNames(array($this->lng->txt("cont_format"),
00611 $this->lng->txt("cont_file"),
00612 $this->lng->txt("size"), $this->lng->txt("date"),
00613 ""));
00614
00615 $cols = array("format", "file", "size", "date", "download");
00616 $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
00617 "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
00618 $tbl->setHeaderVars($cols, $header_params);
00619 $tbl->setColumnWidth(array("10%", "30%", "20%", "20%","20%"));
00620 $tbl->disable("sort");
00621
00622
00623 $tbl->setOrderColumn($_GET["sort_by"]);
00624 $tbl->setOrderDirection($_GET["sort_order"]);
00625 $tbl->setLimit($_GET["limit"]);
00626 $tbl->setOffset($_GET["offset"]);
00627 $tbl->setMaxCount($this->maxcount);
00628
00629 $this->tpl->setVariable("COLUMN_COUNTS", 5);
00630
00631
00632
00633 $tbl->disable("footer");
00634
00635 $tbl->setMaxCount(count($export_files));
00636 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
00637
00638 $tbl->render();
00639 if(count($export_files) > 0)
00640 {
00641 $i=0;
00642 foreach($export_files as $exp_file)
00643 {
00644 $this->tpl->setCurrentBlock("tbl_content");
00645 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
00646
00647 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00648 $this->tpl->setVariable("CSS_ROW", $css_row);
00649
00650 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
00651 $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
00652 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
00653
00654 $file_arr = explode("__", $exp_file["file"]);
00655 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
00656
00657 $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
00658 $this->tpl->setVariable("LINK_DOWNLOAD",
00659 "glossary_presentation.php?cmd=downloadExportFile&type=".
00660 $exp_file["type"]."&ref_id=".$_GET["ref_id"]);
00661
00662 $this->tpl->parseCurrentBlock();
00663 }
00664 }
00665 else
00666 {
00667 $this->tpl->setCurrentBlock("notfound");
00668 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00669 $this->tpl->setVariable("NUM_COLS", 5);
00670 $this->tpl->parseCurrentBlock();
00671 }
00672
00673
00674 }
00675
00679 function downloadExportFile()
00680 {
00681 $file = $this->glossary->getPublicExportFile($_GET["type"]);
00682 if ($this->glossary->getPublicExportFile($_GET["type"]) != "")
00683 {
00684 $dir = $this->glossary->getExportDirectory($_GET["type"]);
00685 if (is_file($dir."/".$file))
00686 {
00687 ilUtil::deliverFile($dir."/".$file, $file);
00688 exit;
00689 }
00690 }
00691 $this->ilias->raiseError($this->lng->txt("file_not_found"),$this->ilias->error_obj->MESSAGE);
00692 }
00693
00701 function setLocator($a_tree = "", $a_id = "")
00702 {
00703 global $ilias_locator;
00704
00705
00706 require_once ("content/classes/class.ilGlossaryLocatorGUI.php");
00707 $gloss_loc =& new ilGlossaryLocatorGUI();
00708 $gloss_loc->setMode("presentation");
00709 if (!empty($_GET["term_id"]))
00710 {
00711 $term =& new ilGlossaryTerm($_GET["term_id"]);
00712 $gloss_loc->setTerm($term);
00713 }
00714 $gloss_loc->setGlossary($this->glossary);
00715
00716 $gloss_loc->display();
00717 return;
00718
00719
00720
00721 $i = 1;
00722
00723
00724
00725 if (!empty($_GET["term_id"]))
00726 {
00727 $this->tpl->touchBlock("locator_separator");
00728 }
00729
00730 $this->tpl->setCurrentBlock("locator_item");
00731 $this->tpl->setVariable("ITEM", $this->glossary->getTitle());
00732
00733 $this->tpl->setVariable("LINK_ITEM", "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
00734 $this->tpl->parseCurrentBlock();
00735
00736
00737
00738 $ilias_locator->navigate($i++,$this->glossary->getTitle(),"glossary_presentation.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms"."&offset=".$_GET["offset"],"bottom");
00739
00740 if (!empty($_GET["term_id"]))
00741 {
00742 $term =& new ilGlossaryTerm($_GET["term_id"]);
00743 $this->tpl->setCurrentBlock("locator_item");
00744 $this->tpl->setVariable("ITEM", $term->getTerm());
00745 $this->tpl->setVariable("LINK_ITEM", "glossary_presentation.php?ref_id=".$_GET["ref_id"].
00746 "&cmd=listDefinitions&term_id=".$term->getId()."&offset=".$_GET["offset"]);
00747 $this->tpl->parseCurrentBlock();
00748 }
00749
00750
00751
00752 $this->tpl->setCurrentBlock("locator");
00753 $this->tpl->setVariable("TXT_LOCATOR",$debug.$this->lng->txt("locator"));
00754 $this->tpl->parseCurrentBlock();
00755
00756 }
00757
00761 function downloadFile()
00762 {
00763 $file = explode("_", $_GET["file_id"]);
00764 include_once("classes/class.ilObjFile.php");
00765 $fileObj =& new ilObjFile($file[count($file) - 1], false);
00766 $fileObj->sendFile();
00767 exit;
00768 }
00769
00773 function setTabs()
00774 {
00775 global $ilTabs;
00776
00777 #include_once("classes/class.ilTabsGUI.php");
00778 #$tabs_gui =& new ilTabsGUI();
00779 $this->getTabs($ilTabs);
00780
00781 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
00782
00783 }
00784
00788 function getLinkXML($a_int_links)
00789 {
00790 if ($a_layoutframes == "")
00791 {
00792 $a_layoutframes = array();
00793 }
00794 $link_info = "<IntLinkInfos>";
00795 foreach ($a_int_links as $int_link)
00796 {
00797
00798 $target = $int_link["Target"];
00799 if (substr($target, 0, 4) == "il__")
00800 {
00801 $target_arr = explode("_", $target);
00802 $target_id = $target_arr[count($target_arr) - 1];
00803 $type = $int_link["Type"];
00804 $targetframe = ($int_link["TargetFrame"] != "")
00805 ? $int_link["TargetFrame"]
00806 : "None";
00807
00808 if ($targetframe == "New")
00809 {
00810 $ltarget = "_new";
00811 }
00812 else
00813 {
00814 $ltarget = "";
00815 }
00816 switch($type)
00817 {
00818 case "PageObject":
00819 case "StructureObject":
00820 $lm_id = ilLMObject::_lookupContObjID($target_id);
00821 $cont_obj =& $this->content_object;
00822 if ($type == "PageObject")
00823 {
00824 $href = "../goto.php?target=pg_".$target_id;
00825 }
00826 else
00827 {
00828 $href = "../goto.php?target=st_".$target_id;
00829 }
00830
00831 break;
00832
00833 case "GlossaryItem":
00834 if (ilGlossaryTerm::_lookGlossaryID($target_id) == $this->glossary->getId())
00835 {
00836 $href = "glossary_presentation.php?cmd=listDefinitions&ref_id=".$_GET["ref_id"].
00837 "&term_id=".$target_id;
00838 }
00839 else
00840 {
00841 $href = "../goto.php?target=git_".$target_id;
00842 }
00843 break;
00844
00845 case "MediaObject":
00846 $href = "glossary_presentation.php?obj_type=$type&cmd=media&ref_id=".$_GET["ref_id"].
00847 "&mob_id=".$target_id;
00848 break;
00849
00850 case "RepositoryItem":
00851 $obj_type = ilObject::_lookupType($target_id, true);
00852 $obj_id = ilObject::_lookupObjId($target_id);
00853 $href = "../goto.php?target=".$obj_type."_".$target_id;
00854 $t_frame = ilFrameTargetInfo::_getFrame("MainContent", $obj_type);
00855 $ltarget = $t_frame;
00856 break;
00857
00858 }
00859 $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".
00860 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
00861 }
00862 }
00863 $link_info.= "</IntLinkInfos>";
00864
00865 return $link_info;
00866 }
00867
00868
00872 function getLink($a_ref_id, $a_cmd = "", $a_term_id = "", $a_def_id = "",
00873 $a_frame = "", $a_type = "")
00874 {
00875 if ($a_cmd == "")
00876 {
00877 $a_cmd = "layout";
00878 }
00879 $script = "glossary_presentation.php";
00880
00881
00882 if (!$this->offlineMode())
00883 {
00884 $link = $script."?ref_id=".$a_ref_id;
00885 switch ($a_cmd)
00886 {
00887 case "fullscreen":
00888 $link.= "&cmd=fullscreen&def_id=".$a_def_id;
00889 break;
00890
00891 default:
00892 $link.= "&cmd=".$a_cmd;
00893 if ($a_frame != "")
00894 {
00895 $link.= "&frame=".$a_frame;
00896 }
00897 if ($a_obj_id != "")
00898 {
00899 switch ($a_type)
00900 {
00901 case "MediaObject":
00902 $link.= "&mob_id=".$a_obj_id;
00903 break;
00904
00905 default:
00906 $link.= "&def_id=".$a_def_id;
00907 break;
00908 }
00909 }
00910 if ($a_type != "")
00911 {
00912 $link.= "&obj_type=".$a_type;
00913 }
00914 break;
00915 }
00916 }
00917 else
00918 {
00919 switch ($a_cmd)
00920 {
00921 case "downloadFile":
00922 break;
00923
00924 case "fullscreen":
00925 $link = "fullscreen.html";
00926 break;
00927
00928 case "layout":
00929 break;
00930
00931 case "glossary":
00932 $link = "term_".$a_obj_id.".html";
00933 break;
00934
00935 case "media":
00936 $link = "media_".$a_obj_id.".html";
00937 break;
00938
00939 default:
00940 break;
00941 }
00942 }
00943
00944 return $link;
00945 }
00946
00947
00951 function getTabs(&$tabs_gui)
00952 {
00953
00954 if (!empty ($_REQUEST["term"])) {
00955 $append = "&cmd=searchTerms&term=".$_REQUEST["term"]."&oldoffset=".$_GET["oldoffset"];
00956 }
00957
00958 if (!$this->offlineMode())
00959 {
00960 $tabs_gui->addTarget("cont_back",
00961 "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&offset=".$_GET["offset"].$append, "",
00962 "");
00963 }
00964 else
00965 {
00966 $tabs_gui->addTarget("cont_back",
00967 "index.html#term_".$_GET["term_id"], "",
00968 "");
00969 }
00970 }
00971
00972 function download_paragraph () {
00973 include_once("content/classes/Pages/class.ilPageObject.php");
00974 $pg_obj =& new ilPageObject("gdf", $_GET["pg_id"]);
00975 $pg_obj->send_paragraph ($_GET["par_id"], $_GET["downloadtitle"]);
00976 }
00977
00978
00979 }
00980
00981 ?>