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

Generated on Fri Dec 13 2013 08:00:16 for ILIAS Release_3_3_x_branch .rev 46803 by  doxygen 1.7.1