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

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

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1