• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/class.ilGlossaryPresentationGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // Todo: check lm id
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                 // catch feedback message
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                 // load template for table
00158 //              $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
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                 // search form
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                 // glossary menu
00177                 if ($this->glossary->isActiveGlossaryMenu())
00178                 {
00179                         // download links
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                 // load template for table
00194                 $this->tpl->addBlockfile("TERM_TABLE", "term_table", "tpl.table.html");
00195                 // load template for table content data
00196                 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_tbl_pres_row.html", true);
00197 
00198                 $num = 2;
00199 
00200                 // create table
00201                 $tbl = new ilTableGUI();
00202 
00203                 // title & header columns
00204                 $tbl->setTitle($this->lng->txt("cont_terms").(($filter=="")?"":"*"));
00205                 $tbl->disable("sort");
00206                 //$tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00207 
00208                 // display additional column 'glossary' for meta glossaries
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                 // control
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                 //$this->tpl->setVariable("COLUMN_COUNTS", 4);
00253 
00254                 // footer
00255                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00256 
00257 //              $term_list = $this->glossary->getTermList();
00258                 $tbl->setMaxCount(count($term_list));
00259 
00260                 // sorting array
00261                 //$term_list = ilUtil::sortArray($term_list, $_GET["sort_by"], $_GET["sort_order"]);
00262 
00263                 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00264                 // render table
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                                         //$short_str = str_replace("<", "&lt;", $short_str);
00289                                         //$short_str = str_replace(">", "&gt;", $short_str);
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                                 // display additional column 'glossary' for meta glossaries
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                 } //if is_array
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                 //$this->setLocator();
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                 // content style
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                 // syntax style
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                 // load template for table
00399                 $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", true);
00400                 //$this->tpl->addBlockfile("STATUSLINE", "statusline", "tpl.statusline.html");
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                         // internal links
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                 // display possible backlinks
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 //echo "<br>glo_pres_return";
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                 //$int_links = $page_object->getInternalLinks();
00504                 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
00505 
00506                 // later
00507                 //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
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                 // todo: we get always the first alias now (problem if mob is used multiple
00516                 // times in page)
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                 // unmask user html
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                 //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
00562                 /*
00563                 $this->tpl->setCurrentBlock("ContentStyle");
00564                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css");
00565                 $this->tpl->parseCurrentBlock();
00566 
00567                 $this->tpl->setVariable("PAGETITLE", " - ".$this->glossary->getTitle());
00568                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());*/
00569                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glo_download_list.html", true);
00570 
00571                 // set title header
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                 // create table
00578                 require_once("classes/class.ilTableGUI.php");
00579                 $tbl = new ilTableGUI();
00580 
00581                 // load files templates
00582                 $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
00583 
00584                 // load template for table content data
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                 // control
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                 // footer
00632                 //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
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                 } //if is_array
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                 //$this->tpl->show();
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                 //$this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
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                 //$gloss_loc->setDefinition($this->definition);
00716                 $gloss_loc->display();
00717                 return;
00718 
00719 
00720                 // ### AA 03.11.10 added new locator GUI class ###
00721                 $i = 1;
00722 
00723                 //$this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
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                 // TODO: SCRIPT NAME HAS TO BE VARIABLE!!!
00733                 $this->tpl->setVariable("LINK_ITEM", "glossary_presentation.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
00734                 $this->tpl->parseCurrentBlock();
00735 
00736                 // ### AA 03.11.10 added new locator GUI class ###
00737                 // navigate locator
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                 //$this->tpl->touchBlock("locator_separator");
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                 // catch feedback message
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 //echo "<br>+".$int_link["Type"]."+".$int_link["TargetFrame"]."+".$int_link["Target"]."+";
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                                                 //$ltarget = "ilContObj".$lm_id;
00831                                                 break;
00832 
00833                                         case "GlossaryItem":
00834                                                 if (ilGlossaryTerm::_lookGlossaryID($target_id) == $this->glossary->getId())
00835                                                 {
00836                                                         $href = "glossary_presentation.php?cmd=listDefinitions&amp;ref_id=".$_GET["ref_id"].
00837                                                                 "&amp;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&amp;cmd=media&amp;ref_id=".$_GET["ref_id"].
00847                                                         "&amp;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                 // handle online links
00882                 if (!$this->offlineMode())
00883                 {
00884                         $link = $script."?ref_id=".$a_ref_id;
00885                         switch ($a_cmd)
00886                         {
00887                                 case "fullscreen":
00888                                         $link.= "&amp;cmd=fullscreen&amp;def_id=".$a_def_id;
00889                                         break;
00890                                 
00891                                 default:
00892                                         $link.= "&amp;cmd=".$a_cmd;
00893                                         if ($a_frame != "")
00894                                         {
00895                                                 $link.= "&amp;frame=".$a_frame;
00896                                         }
00897                                         if ($a_obj_id != "")
00898                                         {
00899                                                 switch ($a_type)
00900                                                 {
00901                                                         case "MediaObject":
00902                                                                 $link.= "&amp;mob_id=".$a_obj_id;
00903                                                                 break;
00904                                                                 
00905                                                         default:
00906                                                                 $link.= "&amp;def_id=".$a_def_id;
00907                                                                 break;
00908                                                 }
00909                                         }
00910                                         if ($a_type != "")
00911                                         {
00912                                                 $link.= "&amp;obj_type=".$a_type;
00913                                         }
00914                                         break;
00915                         }
00916                 }
00917                 else    // handle offline links
00918                 {
00919                         switch ($a_cmd)
00920                         {
00921                                 case "downloadFile":
00922                                         break;
00923                                         
00924                                 case "fullscreen":
00925                                         $link = "fullscreen.html";              // id is handled by xslt
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                 // back to upper context
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 ?>

Generated on Fri Dec 13 2013 11:57:56 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1