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

Modules/LearningModule/classes/class.ilObjDlBookGUI.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 
00036 include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
00037 include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
00038 
00039 class ilObjDlBookGUI extends ilObjContentObjectGUI
00040 {
00046         function ilObjDlBookGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00047         {
00048         $this->type = "dbk";
00049                 parent::ilObjContentObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00050                 # BETTER DO IT HERE THAN IN PARENT CLASS ( PROBLEMS FOR import, create)
00051                 $this->assignObject();
00052                 
00053                 // SAME REASON
00054                 if($a_id != 0)
00055                 {
00056                         $this->lm_tree =& $this->object->getLMTree();
00057                 }
00058         }
00059 
00060         function assignObject()
00061         {
00062                 include_once("./Modules/LearningModule/classes/class.ilObjDlBook.php");
00063 
00064                 $this->link_params = "ref_id=".$this->ref_id;
00065                 $this->object =& new ilObjDlBook($this->id, true);
00066         }
00067 
00068 
00069         function showCitation($page_xml)
00070         {
00071                 // content style
00072                 $this->tpl->setCurrentBlock("ContentStyle");
00073                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00074                         ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
00075                 $this->tpl->parseCurrentBlock();
00076 
00077                 // syntax style
00078                 $this->tpl->setCurrentBlock("SyntaxStyle");
00079                 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00080                         ilObjStyleSheet::getSyntaxStylePath());
00081                 $this->tpl->parseCurrentBlock();
00082 
00083                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00084 
00085                 $parsed_post = $this->__parseCitationPost();
00086                 if(!count($parsed_post))
00087                 {
00088                         $_SESSION["citation_error"] = 1;
00089 
00090                         $this->ctrl->setParameterByClass('illmpresentationgui','frame','maincontent');
00091                         $this->ctrl->setParameterByClass('illmpresentationgui','obj_id',(int) $_GET['obj_id']);
00092                         $this->ctrl->redirectByClass('illmpresentationgui','layout');
00093                 }
00094                 $tmp_tpl = new ilTemplate("tpl.citation.xsl",true,true,"Modules/LearningModule");
00095                 $tmp_tpl->setVariable("CITATIONS",$this->lng->txt("cont_citations"));
00096 
00097                 foreach($parsed_post as $key => $data)
00098                 {
00099                         $tmp_tpl->setCurrentBlock("citation_row");
00100                         $tmp_tpl->setVariable("CITATION",$this->__applyCitationText($page_xml,$data["start"],$data["end"]));
00101                         $tmp_tpl->setVariable("PAGES_ROW",$data["text"]);
00102                         $tmp_tpl->parseCurrentBlock();
00103                 }
00104                 $xsl = $tmp_tpl->get();
00105 
00106                 $this->object->initBibItemObject();
00107                 $xml = $this->object->bib_obj->getXML();
00108                 if(empty($xml))
00109                 {
00110                         return true;
00111                 }
00112                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00113                 $xh = xslt_create();
00114                 $params = array ('target_id' => $_SESSION["bib_id"]);
00115 
00116                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00117 
00118                 $this->tpl->setCurrentBlock("ilPage");
00119                 $this->tpl->setVariable("PAGE_CONTENT",$output);
00120                 $this->tpl->parseCurrentBlock();
00121                 
00122                 return true;
00123         }
00124 
00128         function showAbstract($a_target_id)
00129         {
00130                 if(count($_POST["tr_id"]) > 1)
00131                 {
00132                         $message = true;
00133                         $message_text = $this->lng->txt("cont_select_one_translation_warning");
00134                         $show_full = false;
00135                 }
00136                 else if(!$a_target_id and ($_POST["action"] == "show" or $_POST["action"] == "details"))
00137                 {
00138                         $message = true;
00139                         $message_text = $this->lng->txt("cont_select_one_edition");
00140                         $show_full = false;
00141                 }                       
00142                 else if(is_array($a_target_id) and count($a_target_id) > 1)
00143                 {
00144                         $message = true;
00145                         $message_text = $this->lng->txt("cont_msg_multiple_editions");
00146                         $show_full = false;
00147                 }
00148                 else if(is_array($a_target_id))
00149                 {
00150                         $a_target_id = $a_target_id[0];
00151                         $show_full = true;
00152                 }
00153                 else
00154                 {
00155                         $a_target_id = 0;
00156                         $show_full = false;
00157                 }
00158 
00159                 $this->object->initBibItemObject();
00160 
00161                 // content style
00162                 $this->tpl->setCurrentBlock("ContentStyle");
00163                 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00164                         ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
00165                 $this->tpl->parseCurrentBlock();
00166 
00167                 // syntax style
00168                 $this->tpl->setCurrentBlock("SyntaxStyle");
00169                 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00170                         ilObjStyleSheet::getSyntaxStylePath());
00171                 $this->tpl->parseCurrentBlock();
00172 
00173                 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00174                 $this->tpl->setCurrentBlock("ilPage");
00175 
00176                 $tmp_tpl = new ilTemplate("tpl.bibliography.xsl",true,true,"Modules/LearningModule");
00177                 $tmp_tpl->setVariable("TITLE",$this->lng->txt("title"));
00178                 $tmp_tpl->setVariable("EDITION",$this->lng->txt("cont_edition"));
00179                 $tmp_tpl->setVariable("AUTHORS",$this->lng->txt("authors"));
00180 
00181                 if($show_full)
00182                 {
00183                         $this->ctrl->setParameterByClass("illmpresentationgui", "frame", "maincontent");
00184                         $action = $this->ctrl->getLinkTargetByClass("illmpresentationgui", "layout");
00185                         $params = array ('mode'                 => "view_full",
00186                                                          'action'               => $action,
00187                                                          'target_id'    => "$a_target_id");
00188 
00189                         $tmp_tpl->setVariable("BOOKTITLE",$this->lng->txt("cont_booktitle"));
00190                         $tmp_tpl->setVariable("CROSS_REFERENCE",$this->lng->txt("cont_cross_reference"));
00191                         $tmp_tpl->setVariable("DETAILS",$this->lng->txt("cont_details"));
00192                         $tmp_tpl->setVariable("EDITOR",$this->lng->txt("editor"));
00193                         $tmp_tpl->setVariable("HOW_PUBLISHED",$this->lng->txt("cont_how_published"));
00194                         $tmp_tpl->setVariable("WHERE_PUBLISHED",$this->lng->txt("cont_where_published"));
00195                         $tmp_tpl->setVariable("INSTITUTION",$this->lng->txt("institution"));
00196                         $tmp_tpl->setVariable("JOURNAL",$this->lng->txt("cont_journal"));
00197                         $tmp_tpl->setVariable("KEYWORD",$this->lng->txt("cont_keyword"));
00198                         $tmp_tpl->setVariable("PAGES",$this->lng->txt("cont_pages"));
00199                         $tmp_tpl->setVariable("SCHOOL",$this->lng->txt("cont_school"));
00200                         $tmp_tpl->setVariable("MONTH",$this->lng->txt("cont_month"));
00201                         $tmp_tpl->setVariable("PUBLISHER",$this->lng->txt("cont_publisher"));
00202                         $tmp_tpl->setVariable("SERIES",$this->lng->txt("cont_series"));
00203                         $tmp_tpl->setVariable("SERIES_TITLE",$this->lng->txt("cont_series_title"));
00204                         $tmp_tpl->setVariable("SERIES_EDITOR",$this->lng->txt("cont_series_editor"));
00205                         $tmp_tpl->setVariable("SERIES_VOLUME",$this->lng->txt("cont_series_volume"));
00206                         $tmp_tpl->setVariable("YEAR",$this->lng->txt("cont_year"));
00207                         $tmp_tpl->setVariable("ISBN",$this->lng->txt("cont_isbn"));
00208                         $tmp_tpl->setVariable("URL",$this->lng->txt("cont_url"));
00209                 }
00210                 else
00211                 {
00212                         $this->ctrl->setParameterByClass("illmpresentationgui", "frame", "maincontent");
00213                         $action = $this->ctrl->getLinkTargetByClass("illmpresentationgui", "layout");
00214                         $params = array ('mode'                         => "view_simple",
00215                                                          'action'                       => $action);
00216                         $this->ctrl->clearParametersByClass("illmpresentationgui");
00217                         if($translations = $this->object->getTranslations())
00218                         {
00219                                 foreach($translations as $tr_id)
00220                                 {
00221                                         $tmp_obj = ilObjectFactory::getInstanceByRefId($tr_id);
00222 
00223                                         $tmp_tpl->setCurrentBlock("TRANSLATION_ROW");
00224                                         $tmp_tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
00225                                         $tmp_tpl->setVariable("ROW_ID",$tr_id);
00226                                         $tmp_tpl->parseCurrentBlock();
00227                                         unset($tmp_obj);
00228                                 }
00229                                 $tmp_tpl->setCurrentBlock("TRANSLATION");
00230                                 $tmp_tpl->setVariable("TRANSLATION_HEADER",$this->lng->txt("cont_translations"));
00231                                 $tmp_tpl->parseCurrentBlock();
00232                         }
00233                         $tmp_tpl->setVariable("DETAILS",$this->lng->txt("cont_details"));
00234                         $tmp_tpl->setVariable("SHOW",$this->lng->txt("cont_show"));
00235                         $tmp_tpl->setVariable("SHOW_CITATION",$this->lng->txt("cont_show_citation"));
00236                         $tmp_tpl->setVariable("GO",$this->lng->txt("go"));
00237                 }
00238                 
00239                 // SHOW MESSAGE
00240                 if($message)
00241                 {
00242                         ilUtil::sendInfo($message_text);
00243                 }
00244                 $xsl = $tmp_tpl->get();
00245                 $xml = $this->object->bib_obj->getXML();
00246                 
00247                 if(empty($xml))
00248                 {
00249                         return true;
00250                 }
00251                 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
00252                 $xh = xslt_create();
00253 
00254 
00255                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00256                 $this->tpl->setVariable("PAGE_CONTENT",$output);
00257                 
00258                 return $output;
00259         }
00260         
00264         function export() 
00265         {
00266                 // BASE CLASS objectGUI IS INSTATIATING $this->object
00267                 #$this->object =& new ilObjDlBook($this->id, true);
00268                 $this->object->export($_GET["ref_id"]);
00269         }
00270 
00278         function offlineexportform() 
00279         {
00280                 
00281                 //$tpl_offline =& new ilTemplate("tpl.");
00282                 //vd($this->tpl);
00283                 $this->tpl->addBlockfile("CONTENT", "offline_content", "tpl.offline_export.html", "Modules/LearningModule");
00284                 $this->tpl->touchBlock("offline_content");
00285                 
00286                 $this->tpl->setVariable("TXT_TYPE","Export-Type");
00287 
00288                 if ($_GET["print"]==1) 
00289                 {
00290                         $this->tpl->setVariable("TXT_ACTION","Digilib-Book - print");
00291                         $this->tpl->setVariable("TXT_PRINTEXPORT",$this->lng->txt("Print") );
00292                         $this->tpl->setVariable("PRINT_CHECKED","checked");
00293                         $this->tpl->setVariable("EXPORT_TARGET","_blank");
00294                 } 
00295                 else 
00296                 {
00297                         $this->tpl->setVariable("TXT_ACTION","Digilib-Book - download");
00298                         $this->tpl->setVariable("TXT_HTMLEXPORT",$this->lng->txt("HTML export") );
00299                         $this->tpl->setVariable("TXT_PDFEXPORT",$this->lng->txt("PDF export") );
00300             $this->tpl->setVariable("TXT_XMLEXPORT",$this->lng->txt("XML export (only complete book)") );
00301                         $this->tpl->setVariable("OFFLINE_CHECKED","checked");
00302                 }
00303                 
00304                 $this->tpl->setVariable("TXT_PAGES",$this->lng->txt("Pages") );
00305                 $this->tpl->setVariable("TXT_PAGESALL",$this->lng->txt("all"));
00306                 $this->tpl->setVariable("TXT_PAGESCHAPTER",$this->lng->txt("chapter") );
00307                 if ($_GET["obj_id"] != "") $this->tpl->setVariable("TXT_PAGESPAGE",$this->lng->txt("this page"));
00308                 $this->tpl->setVariable("TXT_PAGESFROM",$this->lng->txt("pages from") );
00309                 $this->tpl->setVariable("TXT_PAGESTO",$this->lng->txt("to") );
00310                 
00311                 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("start export") );
00312         $this->tpl->setVariable("BTN_C_VALUE",$this->lng->txt("cancel") );
00313                 
00314                 $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
00315                 $this->tpl->setVariable("EXPORT_ACTION",
00316                         $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexport"));
00317                 $this->ctrl->clearParametersByClass("illmpresentationgui");
00318                 $this->tpl->show();
00319                 
00320         }
00321         function setilCitationMenu()
00322         {
00323                 include_once("./classes/class.ilTemplate.php");
00324 
00325                 $tpl_menu =& new ilTemplate("tpl.buttons.html",true,true);
00326 
00327                 $tpl_menu->setCurrentBlock("btn_cell");
00328 
00329                 #$tpl_menu->setVariable("BTN_LINK","./ilias.php?frame=maincontent&ref_id=".$_GET["ref_id"].
00330                 #"&obj_id=".$_GET["obj_id"]);
00331                 $this->ctrl->setParameterByClass('illmpresentationgui','frame','maincontent');
00332                 $this->ctrl->setParameterByClass('illmpresentationgui','obj_id',(int) $_GET['obj_id']);
00333                 $tpl_menu->setVariable('BTN_LINK',$this->ctrl->getLinkTargetByClass('illmpresentationgui','layout'));
00334                 $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("back"));
00335                 $tpl_menu->parseCurrentBlock();
00336 
00337                 $tpl_menu->setCurrentBlock("btn_row");
00338                 $tpl_menu->parseCurrentBlock();
00339 
00340                 return $tpl_menu->get();
00341         }
00342 
00346         // ok
00347     function setilLMMenu()
00348         {
00349                 include_once("./classes/class.ilTemplate.php");
00350 
00351                 $tpl_menu =& new ilTemplate("tpl.lm_menu.html", true, true, "Modules/LearningModule");
00352 
00353                 $tpl_menu->setCurrentBlock("lm_menu_btn");
00354 
00355                 // menu for abstract page
00356                 if ($_POST["action"]=="details" && count($_POST["target"])==1)
00357                 {
00358                         $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
00359                         $tpl_menu->setVariable("BTN_LINK",
00360                                 $this->ctrl->getLinkTargetByClass("illmpresentationgui", "exportbibinfo"));
00361                         $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("download"));
00362                         $tpl_menu->parseCurrentBlock();
00363 
00364                         $this->ctrl->setParameterByClass("illmpresentationgui", "print", "1");
00365                         $tpl_menu->setVariable("BTN_LINK",
00366                                 $this->ctrl->getLinkTargetByClass("illmpresentationgui", "exportbibinfo"));
00367                         $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("print"));
00368                         $tpl_menu->parseCurrentBlock();
00369                         $this->ctrl->clearParametersByClass("illmpresentationgui");
00370                 }
00371                 else
00372                 {
00373                         // menu for normal pages
00374                         $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
00375                         $tpl_menu->setVariable("BTN_LINK",
00376                                 $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexportform"));
00377                         $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("download"));
00378                         $tpl_menu->parseCurrentBlock();
00379 
00380                         $this->ctrl->setParameterByClass("illmpresentationgui", "print", "1");
00381                         $tpl_menu->setVariable("BTN_LINK",
00382                                 $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexportform"));
00383                         $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("print") );
00384                         $tpl_menu->parseCurrentBlock();
00385                         
00386                         $this->ctrl->clearParametersByClass("illmpresentationgui");
00387                 }
00388                 $tpl_menu->setCurrentBlock("btn_row");
00389                 $tpl_menu->parseCurrentBlock();
00390 
00391                 return $tpl_menu->get();
00392 
00393         }
00394 
00395         function properties()
00396         {
00397                 // OVERWRITTEN METHOD, TO ADD TRANSLATIONS
00398                 parent::properties();
00399 
00400                 // BUTTONS
00401                 $this->tpl->setVariable("BTN1_NAME","addTranslation");
00402                 $this->tpl->setVariable("BTN1_TEXT",$this->lng->txt("cont_new_assignment"));
00403                 
00404                 if($trs = $this->object->getTranslations())
00405                 {
00406                         include_once "./classes/class.ilObjectFactory.php";
00407                         foreach($trs as $tr)
00408                         {
00409                                 $tmp_obj = ilObjectFactory::getInstanceByRefId($tr);
00410                                 $this->tpl->setCurrentBlock("TRANSLATION_ROW");
00411                                 $this->tpl->setVariable("ROW_ID",$tr);
00412                                 $this->tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
00413                                 $this->tpl->parseCurrentBlock();
00414                                 
00415                                 unset($tmp_obj);
00416                         }
00417                         $this->tpl->setVariable("BTN2_NAME","deleteTranslation");
00418                         $this->tpl->setVariable("BTN2_TEXT",$this->lng->txt("cont_del_assignment"));
00419                 }
00420                 $this->tpl->setCurrentBlock("TRANSLATION");
00421                 $this->tpl->setVariable("TRANSLATION_HEADER",$this->lng->txt("cont_translations"));
00422                 $this->tpl->parseCurrentBlock();
00423         }
00424 
00425         function addTranslation()
00426         {
00427                 $this->setTabs();
00428                 
00429                 // SEARCH CANCELED
00430                 if(isset($_POST["cancel"]))
00431                 {
00432                         $this->ctrl->redirect($this, "properties");
00433                         exit;
00434                 }
00435                 if(isset($_POST["select"]))
00436                 {
00437                         if(is_array($_POST["id"]))
00438                         {
00439                                 foreach($_POST["id"] as $id)
00440                                 {
00441                                         if($id != $this->object->getRefId())
00442                                         {
00443                                                 $this->object->addTranslation($id);
00444                                         }
00445                                 }
00446                                 ilUtil::sendInfo($this->lng->txt("cont_translations_assigned"),true);
00447                                 $this->ctrl->redirect($this, "properties");
00448                                 exit;
00449                         }
00450                 }
00451                 $show_search = true;
00452 
00453                 $this->tpl->addBlockfile("ADM_CONTENT","adm_content","tpl.dbk_search_translation.html","Modules/LearningModule");
00454                 $this->tpl->setVariable("F_ACTION",
00455                         $this->ctrl->getLinkTarget($this, "addTranslation"));
00456 
00457                 if($_POST["search_str"])
00458                 {
00459                         $result = $this->searchTranslation($_POST["search_str"]);
00460 
00461                         switch(count($result["meta"]))
00462                         {
00463                                 case 0:
00464                                         ilUtil::sendInfo($this->lng->txt("cont_no_object_found"));
00465                                         break;
00466                                 case 1:
00467                                         if($result["meta"][0]["id"] == $this->object->getRefId())
00468                                         {
00469                                                 ilUtil::sendInfo($this->lng->txt("cont_no_assign_itself"));
00470                                                 break;
00471                                         }
00472                                 default:
00473                                         $this->showTranslationSelect($result);
00474                                         $show_search = false;
00475                                         break;
00476                         }
00477                 }
00478                 if($show_search)
00479                 {
00480                         $this->lng->loadLanguageModule("search");
00481 
00482                         $this->tpl->setVariable("SEARCH_TXT",$this->lng->txt("cont_insert_search"));
00483                         $this->tpl->setVariable("SEARCH_ASSIGN_TR",$this->lng->txt("cont_assign_translation"));
00484                         $this->tpl->setVariable("SEARCH_SEARCH_TERM",$this->lng->txt("search_search_term"));
00485                         $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
00486                         $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
00487                 }
00488                 
00489         }
00490 
00491         function deleteTranslation()
00492         {
00493                 if(!$_POST["id"])
00494                 {
00495                         ilUtil::sendInfo($this->lng->txt("cont_select_one_translation"));
00496                         $this->ctrl->redirect($this, "properties");
00497                         exit;
00498                 }
00499                 $this->object->deleteTranslations($_POST["id"]);
00500                 ilUtil::sendInfo($this->lng->txt("cont_assignments_deleted"));
00501                 $this->ctrl->redirect($this, "properties");
00502                 exit;
00503         }
00504         // PRIVATE METHODS
00505         function showTranslationSelect($a_result)
00506         {
00507                 include_once "./classes/class.ilObjectFactory.php";
00508 
00509                 foreach($a_result["meta"] as $book)
00510                 {
00511                         if(!($path = $this->getContextPath($book["id"])))
00512                         {
00513                                 continue;
00514                         }
00515                         $tmp_obj = ilObjectFactory::getInstanceByRefId($book["id"]);
00516                         
00517                         $this->tpl->setCurrentBlock("TR_SELECT_ROW");
00518                         $this->tpl->setVariable("ROW_ID",$book["id"]);
00519                         $this->tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
00520                         $this->tpl->setVariable("ROW_DESCRIPTION",$tmp_obj->getDescription());
00521                         $this->tpl->setVariable("ROW_KONTEXT",$path);
00522                         $this->tpl->parseCurrentBlock();
00523                                         
00524                         unset($tmp_obj);
00525                 }
00526                 $this->tpl->setCurrentBlock("TR_SELECT");
00527                 $this->tpl->setVariable("SELECT_TXT",$this->lng->txt("cont_select_translation"));
00528                 $this->tpl->setVariable("SELECT_TITLE",$this->lng->txt("title"));
00529                 $this->tpl->setVariable("SELECT_DESCRIPTION",$this->lng->txt("description"));
00530                 $this->tpl->setVariable("SELECT_KONTEXT",$this->lng->txt("context"));
00531 
00532                 $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("assign"));
00533                 $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
00534                 $this->tpl->parseCurrentBlock();
00535 
00536         }
00537                 
00538         function searchTranslation($a_search_str)
00539         {
00540                 include_once("./classes/class.ilSearch.php");
00541 
00542                 $search =& new ilSearch($_SESSION["AccountId"]);
00543                 $search->setPerformUpdate(false);
00544                 $search->setSearchString($_POST["search_str"]);
00545                 $search->setCombination("and");
00546                 $search->setSearchFor(array(0 => 'dbk'));
00547                 $search->setSearchIn(array('dbk' => 'meta'));
00548                 $search->setSearchType('new');
00549 
00550                 if($search->validate($message))
00551                 {
00552                         $search->performSearch();
00553                 }
00554                 else
00555                 {
00556                         ilUtil::sendInfo($message,true);
00557                         $this->ctrl->redirect($this, "addTranslation");
00558                         exit;
00559                 }
00560                 return $search->getResultByType('dbk');
00561         }               
00562 
00563         function getContextPath($a_endnode_id, $a_startnode_id = 1)
00564         {
00565                 $path = "";
00566 
00567                 include_once("./Services/Tree/classes/class.ilTree.php");
00568                 
00569                 $tree = new ilTree(1);
00570 
00571                 if(!$tree->isInTree($a_startnode_id) or !$tree->isInTree($a_endnode_id))
00572                 {
00573                         return '';
00574                 }
00575                 $tmpPath = $tree->getPathFull($a_endnode_id, $a_startnode_id);
00576 
00577                 // count -1, to exclude the learning module itself
00578                 for ($i = 1; $i < (count($tmpPath) - 1); $i++)
00579                 {
00580                         if ($path != "")
00581                         {
00582                                 $path .= " > ";
00583                         }
00584 
00585                         $path .= $tmpPath[$i]["title"];
00586                 }
00587                 return $path;
00588         }
00589 
00590         function __checkCitationPost(&$message)
00591         {
00592                 if(!$_POST["pgt_id"])
00593                 {
00594                         $message = "SELECT ONE<br />";
00595                         return false;
00596                 }
00597                 return true;
00598         }
00599 
00600         function __parseCitationPost()
00601         {
00602                 if(!is_array($_POST["pgt_id"]))
00603                 {
00604                         return array();
00605                 }
00606                 foreach($_POST["pgt_id"] as $key => $id)
00607                 {
00608                         switch($_POST["ct_option"][$key])
00609                         {
00610                                 case "single":
00611                                         $output[] = array("text"        => $id,
00612                                                                           "start"       => $key,
00613                                                                           "end"         => $key);
00614                                         break;
00615                                 case "f":
00616                                         $output[] = array("text"        => $id."f",
00617                                                                           "start"       => $key,
00618                                                                           "end"         => $key);
00619                                         break;
00620                                 case "ff":
00621                                         $output[] = array("text"        => $id."ff",
00622                                                                           "start"       => $key,
00623                                                                           "end"         => $key);
00624                                         break;
00625                                 case "from":
00626                                         $start = $id."-";
00627                                         $start_v = $key;
00628                                         break;
00629                                 case "to":
00630                                         if($start)
00631                                         {
00632                                                 $output[] = array("text"                => $start."".$id,
00633                                                                                   "start"               => $start_v,
00634                                                                                   "end"                 => $key);
00635                                         }
00636                                         unset($start);
00637                                         unset($start_v);
00638                                         break;
00639                         }
00640                 }
00641                 return $output ? $output : array();
00642         }
00643 
00644         function __applyCitationText($page_xml,$a_start,$a_end)
00645         {
00646                 global $tpl;
00647 
00648                 return true;
00649 
00650                 $xsl = file_get_contents($tpl->tplPath."/tpl.citation_paragraph.xsl");
00651                 $args = array( '/_xml' => $page_xml, '/_xsl' => $xsl );
00652                 $xh = xslt_create();
00653                 $params = array ('start_id' => $a_start,
00654                                                  'end_id'       => $a_end);
00655 
00656                 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
00657                 
00658                 return $output;
00659         }
00660 }
00661         
00662 ?>

Generated on Fri Dec 13 2013 17:56:52 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1