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