ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjDlBookGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2009 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
37 include_once "./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php";
38 include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
39 
41 {
47  function ilObjDlBookGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
48  {
49  $this->type = "dbk";
50  parent::ilObjContentObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
51  # BETTER DO IT HERE THAN IN PARENT CLASS ( PROBLEMS FOR import, create)
52  $this->assignObject();
53 
54  // SAME REASON
55  if($a_id != 0)
56  {
57  $this->lm_tree =& $this->object->getLMTree();
58  }
59  }
60 
61  function assignObject()
62  {
63  include_once("./Modules/LearningModule/classes/class.ilObjDlBook.php");
64 
65  $this->link_params = "ref_id=".$this->ref_id;
66  $this->object =& new ilObjDlBook($this->id, true);
67  }
68 
69 
70  function showCitation($page_xml)
71  {
72  // content style
73  $this->tpl->setCurrentBlock("ContentStyle");
74  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
75  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
76  $this->tpl->parseCurrentBlock();
77 
78  // syntax style
79  $this->tpl->setCurrentBlock("SyntaxStyle");
80  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
82  $this->tpl->parseCurrentBlock();
83 
84  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
85 
86  $parsed_post = $this->__parseCitationPost();
87  if(!count($parsed_post))
88  {
89  $_SESSION["citation_error"] = 1;
90 
91  $this->ctrl->setParameterByClass('illmpresentationgui','frame','maincontent');
92  $this->ctrl->setParameterByClass('illmpresentationgui','obj_id',(int) $_GET['obj_id']);
93  $this->ctrl->redirectByClass('illmpresentationgui','layout');
94  }
95  $tmp_tpl = new ilTemplate("tpl.citation.xsl",true,true,"Modules/LearningModule");
96  $tmp_tpl->setVariable("CITATIONS",$this->lng->txt("cont_citations"));
97 
98  foreach($parsed_post as $key => $data)
99  {
100  $tmp_tpl->setCurrentBlock("citation_row");
101  $tmp_tpl->setVariable("CITATION",$this->__applyCitationText($page_xml,$data["start"],$data["end"]));
102  $tmp_tpl->setVariable("PAGES_ROW",$data["text"]);
103  $tmp_tpl->parseCurrentBlock();
104  }
105  $xsl = $tmp_tpl->get();
106 
107  $this->object->initBibItemObject();
108  $xml = $this->object->bib_obj->getXML();
109  if(empty($xml))
110  {
111  return true;
112  }
113  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
114  $xh = xslt_create();
115  $params = array ('target_id' => $_SESSION["bib_id"]);
116 
117  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
118 
119  $this->tpl->setCurrentBlock("ilPage");
120  $this->tpl->setVariable("PAGE_CONTENT",$output);
121  $this->tpl->parseCurrentBlock();
122 
123  return true;
124  }
125 
129  function showAbstract($a_target_id)
130  {
131  if(count($_POST["tr_id"]) > 1)
132  {
133  $message = true;
134  $message_text = $this->lng->txt("cont_select_one_translation_warning");
135  $show_full = false;
136  }
137  else if(!$a_target_id and ($_POST["action"] == "show" or $_POST["action"] == "details"))
138  {
139  $message = true;
140  $message_text = $this->lng->txt("cont_select_one_edition");
141  $show_full = false;
142  }
143  else if(is_array($a_target_id) and count($a_target_id) > 1)
144  {
145  $message = true;
146  $message_text = $this->lng->txt("cont_msg_multiple_editions");
147  $show_full = false;
148  }
149  else if(is_array($a_target_id))
150  {
151  $a_target_id = $a_target_id[0];
152  $show_full = true;
153  }
154  else
155  {
156  $a_target_id = 0;
157  $show_full = false;
158  }
159 
160  $this->object->initBibItemObject();
161 
162  // content style
163  $this->tpl->setCurrentBlock("ContentStyle");
164  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
165  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
166  $this->tpl->parseCurrentBlock();
167 
168  // syntax style
169  $this->tpl->setCurrentBlock("SyntaxStyle");
170  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
172  $this->tpl->parseCurrentBlock();
173 
174  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
175  $this->tpl->setCurrentBlock("ilPage");
176 
177  $tmp_tpl = new ilTemplate("tpl.bibliography.xsl",true,true,"Modules/LearningModule");
178  $tmp_tpl->setVariable("TITLE",$this->lng->txt("title"));
179  $tmp_tpl->setVariable("EDITION",$this->lng->txt("cont_edition"));
180  $tmp_tpl->setVariable("AUTHORS",$this->lng->txt("authors"));
181 
182  if($show_full)
183  {
184  $this->ctrl->setParameterByClass("illmpresentationgui", "frame", "maincontent");
185  $action = $this->ctrl->getLinkTargetByClass("illmpresentationgui", "layout");
186  $params = array ('mode' => "view_full",
187  'action' => $action,
188  'target_id' => "$a_target_id");
189 
190  $tmp_tpl->setVariable("BOOKTITLE",$this->lng->txt("cont_booktitle"));
191  $tmp_tpl->setVariable("CROSS_REFERENCE",$this->lng->txt("cont_cross_reference"));
192  $tmp_tpl->setVariable("DETAILS",$this->lng->txt("cont_details"));
193  $tmp_tpl->setVariable("EDITOR",$this->lng->txt("editor"));
194  $tmp_tpl->setVariable("HOW_PUBLISHED",$this->lng->txt("cont_how_published"));
195  $tmp_tpl->setVariable("WHERE_PUBLISHED",$this->lng->txt("cont_where_published"));
196  $tmp_tpl->setVariable("INSTITUTION",$this->lng->txt("institution"));
197  $tmp_tpl->setVariable("JOURNAL",$this->lng->txt("cont_journal"));
198  $tmp_tpl->setVariable("KEYWORD",$this->lng->txt("cont_keyword"));
199  $tmp_tpl->setVariable("PAGES",$this->lng->txt("cont_pages"));
200  $tmp_tpl->setVariable("SCHOOL",$this->lng->txt("cont_school"));
201  $tmp_tpl->setVariable("MONTH",$this->lng->txt("cont_month"));
202  $tmp_tpl->setVariable("PUBLISHER",$this->lng->txt("cont_publisher"));
203  $tmp_tpl->setVariable("SERIES",$this->lng->txt("cont_series"));
204  $tmp_tpl->setVariable("SERIES_TITLE",$this->lng->txt("cont_series_title"));
205  $tmp_tpl->setVariable("SERIES_EDITOR",$this->lng->txt("cont_series_editor"));
206  $tmp_tpl->setVariable("SERIES_VOLUME",$this->lng->txt("cont_series_volume"));
207  $tmp_tpl->setVariable("YEAR",$this->lng->txt("cont_year"));
208  $tmp_tpl->setVariable("ISBN",$this->lng->txt("cont_isbn"));
209  $tmp_tpl->setVariable("URL",$this->lng->txt("cont_url"));
210  }
211  else
212  {
213  $this->ctrl->setParameterByClass("illmpresentationgui", "frame", "maincontent");
214  $action = $this->ctrl->getLinkTargetByClass("illmpresentationgui", "layout");
215  $params = array ('mode' => "view_simple",
216  'action' => $action);
217  $this->ctrl->clearParametersByClass("illmpresentationgui");
218  if($translations = $this->object->getTranslations())
219  {
220  foreach($translations as $tr_id)
221  {
222  $tmp_obj = ilObjectFactory::getInstanceByRefId($tr_id);
223 
224  $tmp_tpl->setCurrentBlock("TRANSLATION_ROW");
225  $tmp_tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
226  $tmp_tpl->setVariable("ROW_ID",$tr_id);
227  $tmp_tpl->parseCurrentBlock();
228  unset($tmp_obj);
229  }
230  $tmp_tpl->setCurrentBlock("TRANSLATION");
231  $tmp_tpl->setVariable("TRANSLATION_HEADER",$this->lng->txt("cont_translations"));
232  $tmp_tpl->parseCurrentBlock();
233  }
234  $tmp_tpl->setVariable("DETAILS",$this->lng->txt("cont_details"));
235  $tmp_tpl->setVariable("SHOW",$this->lng->txt("cont_show"));
236  $tmp_tpl->setVariable("SHOW_CITATION",$this->lng->txt("cont_show_citation"));
237  $tmp_tpl->setVariable("GO",$this->lng->txt("go"));
238  }
239 
240  // SHOW MESSAGE
241  if($message)
242  {
243  ilUtil::sendInfo($message_text);
244  }
245  $xsl = $tmp_tpl->get();
246  $xml = $this->object->bib_obj->getXML();
247 
248  if(empty($xml))
249  {
250  return true;
251  }
252  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
253  $xh = xslt_create();
254 
255 
256  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
257  $this->tpl->setVariable("PAGE_CONTENT",$output);
258 
259  return $output;
260  }
261 
265  function export()
266  {
267  // BASE CLASS objectGUI IS INSTATIATING $this->object
268  #$this->object =& new ilObjDlBook($this->id, true);
269  $this->object->export($_GET["ref_id"]);
270  }
271 
279  function offlineexportform()
280  {
281 
282  //$tpl_offline =& new ilTemplate("tpl.");
283  //vd($this->tpl);
284  $this->tpl->addBlockfile("CONTENT", "offline_content", "tpl.offline_export.html", "Modules/LearningModule");
285  $this->tpl->touchBlock("offline_content");
286 
287  $this->tpl->setVariable("TXT_TYPE","Export-Type");
288 
289  if ($_GET["print"]==1)
290  {
291  $this->tpl->setVariable("TXT_ACTION","Digilib-Book - print");
292  $this->tpl->setVariable("TXT_PRINTEXPORT",$this->lng->txt("Print") );
293  $this->tpl->setVariable("PRINT_CHECKED","checked");
294  $this->tpl->setVariable("EXPORT_TARGET","_blank");
295  }
296  else
297  {
298  $this->tpl->setVariable("TXT_ACTION","Digilib-Book - download");
299  $this->tpl->setVariable("TXT_HTMLEXPORT",$this->lng->txt("HTML export") );
300  $this->tpl->setVariable("TXT_PDFEXPORT",$this->lng->txt("PDF export") );
301  $this->tpl->setVariable("TXT_XMLEXPORT",$this->lng->txt("XML export (only complete book)") );
302  $this->tpl->setVariable("OFFLINE_CHECKED","checked");
303  }
304 
305  $this->tpl->setVariable("TXT_PAGES",$this->lng->txt("Pages") );
306  $this->tpl->setVariable("TXT_PAGESALL",$this->lng->txt("all"));
307  $this->tpl->setVariable("TXT_PAGESCHAPTER",$this->lng->txt("chapter") );
308  if ($_GET["obj_id"] != "") $this->tpl->setVariable("TXT_PAGESPAGE",$this->lng->txt("this page"));
309  $this->tpl->setVariable("TXT_PAGESFROM",$this->lng->txt("pages from") );
310  $this->tpl->setVariable("TXT_PAGESTO",$this->lng->txt("to") );
311 
312  $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("start export") );
313  $this->tpl->setVariable("BTN_C_VALUE",$this->lng->txt("cancel") );
314 
315  $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
316  $this->tpl->setVariable("EXPORT_ACTION",
317  $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexport"));
318  $this->ctrl->clearParametersByClass("illmpresentationgui");
319  $this->tpl->show();
320 
321  }
322  function setilCitationMenu()
323  {
324  include_once("./classes/class.ilTemplate.php");
325 
326  $tpl_menu =& new ilTemplate("tpl.buttons.html",true,true);
327 
328  $tpl_menu->setCurrentBlock("btn_cell");
329 
330  #$tpl_menu->setVariable("BTN_LINK","./ilias.php?frame=maincontent&ref_id=".$_GET["ref_id"].
331  #"&obj_id=".$_GET["obj_id"]);
332  $this->ctrl->setParameterByClass('illmpresentationgui','frame','maincontent');
333  $this->ctrl->setParameterByClass('illmpresentationgui','obj_id',(int) $_GET['obj_id']);
334  $tpl_menu->setVariable('BTN_LINK',$this->ctrl->getLinkTargetByClass('illmpresentationgui','layout'));
335  $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("back"));
336  $tpl_menu->parseCurrentBlock();
337 
338  $tpl_menu->setCurrentBlock("btn_row");
339  $tpl_menu->parseCurrentBlock();
340 
341  return $tpl_menu->get();
342  }
343 
347  // ok
348  function setilLMMenu()
349  {
350  include_once("./classes/class.ilTemplate.php");
351 
352  $tpl_menu =& new ilTemplate("tpl.lm_menu.html", true, true, "Modules/LearningModule");
353 
354  $tpl_menu->setCurrentBlock("lm_menu_btn");
355 
356  // menu for abstract page
357  if ($_POST["action"]=="details" && count($_POST["target"])==1)
358  {
359  $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
360  $tpl_menu->setVariable("BTN_LINK",
361  $this->ctrl->getLinkTargetByClass("illmpresentationgui", "exportbibinfo"));
362  $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("download"));
363  $tpl_menu->parseCurrentBlock();
364 
365  $this->ctrl->setParameterByClass("illmpresentationgui", "print", "1");
366  $tpl_menu->setVariable("BTN_LINK",
367  $this->ctrl->getLinkTargetByClass("illmpresentationgui", "exportbibinfo"));
368  $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("print"));
369  $tpl_menu->parseCurrentBlock();
370  $this->ctrl->clearParametersByClass("illmpresentationgui");
371  }
372  else
373  {
374  // menu for normal pages
375  $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
376  $tpl_menu->setVariable("BTN_LINK",
377  $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexportform"));
378  $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("download"));
379  $tpl_menu->parseCurrentBlock();
380 
381  $this->ctrl->setParameterByClass("illmpresentationgui", "print", "1");
382  $tpl_menu->setVariable("BTN_LINK",
383  $this->ctrl->getLinkTargetByClass("illmpresentationgui", "offlineexportform"));
384  $tpl_menu->setVariable("BTN_TXT",$this->lng->txt("print") );
385  $tpl_menu->parseCurrentBlock();
386 
387  $this->ctrl->clearParametersByClass("illmpresentationgui");
388  }
389  $tpl_menu->setCurrentBlock("btn_row");
390  $tpl_menu->parseCurrentBlock();
391 
392  return $tpl_menu->get();
393 
394  }
395 
396  function properties()
397  {
398  // OVERWRITTEN METHOD, TO ADD TRANSLATIONS
400 
401  // BUTTONS
402  $this->tpl->setVariable("BTN1_NAME","addTranslation");
403  $this->tpl->setVariable("BTN1_TEXT",$this->lng->txt("cont_new_assignment"));
404 
405  if($trs = $this->object->getTranslations())
406  {
407  include_once "./classes/class.ilObjectFactory.php";
408  foreach($trs as $tr)
409  {
410  $tmp_obj = ilObjectFactory::getInstanceByRefId($tr);
411  $this->tpl->setCurrentBlock("TRANSLATION_ROW");
412  $this->tpl->setVariable("ROW_ID",$tr);
413  $this->tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
414  $this->tpl->parseCurrentBlock();
415 
416  unset($tmp_obj);
417  }
418  $this->tpl->setVariable("BTN2_NAME","deleteTranslation");
419  $this->tpl->setVariable("BTN2_TEXT",$this->lng->txt("cont_del_assignment"));
420  }
421  $this->tpl->setCurrentBlock("TRANSLATION");
422  $this->tpl->setVariable("TRANSLATION_HEADER",$this->lng->txt("cont_translations"));
423  $this->tpl->parseCurrentBlock();
424  }
425 
426  function addTranslation()
427  {
428  $this->setTabs();
429 
430  // SEARCH CANCELED
431  if(isset($_POST["cancel"]))
432  {
433  $this->ctrl->redirect($this, "properties");
434  exit;
435  }
436  if(isset($_POST["select"]))
437  {
438  if(is_array($_POST["id"]))
439  {
440  foreach($_POST["id"] as $id)
441  {
442  if($id != $this->object->getRefId())
443  {
444  $this->object->addTranslation($id);
445  }
446  }
447  ilUtil::sendSuccess($this->lng->txt("cont_translations_assigned"),true);
448  $this->ctrl->redirect($this, "properties");
449  exit;
450  }
451  }
452  $show_search = true;
453 
454  $this->tpl->addBlockfile("ADM_CONTENT","adm_content","tpl.dbk_search_translation.html","Modules/LearningModule");
455  $this->tpl->setVariable("F_ACTION",
456  $this->ctrl->getLinkTarget($this, "addTranslation"));
457 
458  if($_POST["search_str"])
459  {
460  $result = $this->searchTranslation($_POST["search_str"]);
461 
462  switch(count($result["meta"]))
463  {
464  case 0:
465  ilUtil::sendFailure($this->lng->txt("cont_no_object_found"));
466  break;
467  case 1:
468  if($result["meta"][0]["id"] == $this->object->getRefId())
469  {
470  ilUtil::sendFailure($this->lng->txt("cont_no_assign_itself"));
471  break;
472  }
473  default:
475  $show_search = false;
476  break;
477  }
478  }
479  if($show_search)
480  {
481  $this->lng->loadLanguageModule("search");
482 
483  $this->tpl->setVariable("SEARCH_TXT",$this->lng->txt("cont_insert_search"));
484  $this->tpl->setVariable("SEARCH_ASSIGN_TR",$this->lng->txt("cont_assign_translation"));
485  $this->tpl->setVariable("SEARCH_SEARCH_TERM",$this->lng->txt("search_search_term"));
486  $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
487  $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
488  }
489 
490  }
491 
492  function deleteTranslation()
493  {
494  if(!$_POST["id"])
495  {
496  ilUtil::sendFailure($this->lng->txt("cont_select_one_translation"));
497  $this->ctrl->redirect($this, "properties");
498  exit;
499  }
500  $this->object->deleteTranslations($_POST["id"]);
501  ilUtil::sendSuccess($this->lng->txt("cont_assignments_deleted"));
502  $this->ctrl->redirect($this, "properties");
503  exit;
504  }
505  // PRIVATE METHODS
506  function showTranslationSelect($a_result)
507  {
508  include_once "./classes/class.ilObjectFactory.php";
509 
510  foreach($a_result["meta"] as $book)
511  {
512  if(!($path = $this->getContextPath($book["id"])))
513  {
514  continue;
515  }
516  $tmp_obj = ilObjectFactory::getInstanceByRefId($book["id"]);
517 
518  $this->tpl->setCurrentBlock("TR_SELECT_ROW");
519  $this->tpl->setVariable("ROW_ID",$book["id"]);
520  $this->tpl->setVariable("ROW_TITLE",$tmp_obj->getTitle());
521  $this->tpl->setVariable("ROW_DESCRIPTION",$tmp_obj->getDescription());
522  $this->tpl->setVariable("ROW_KONTEXT",$path);
523  $this->tpl->parseCurrentBlock();
524 
525  unset($tmp_obj);
526  }
527  $this->tpl->setCurrentBlock("TR_SELECT");
528  $this->tpl->setVariable("SELECT_TXT",$this->lng->txt("cont_select_translation"));
529  $this->tpl->setVariable("SELECT_TITLE",$this->lng->txt("title"));
530  $this->tpl->setVariable("SELECT_DESCRIPTION",$this->lng->txt("description"));
531  $this->tpl->setVariable("SELECT_KONTEXT",$this->lng->txt("context"));
532 
533  $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("assign"));
534  $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
535  $this->tpl->parseCurrentBlock();
536 
537  }
538 
539  function searchTranslation($a_search_str)
540  {
541  include_once("./classes/class.ilSearch.php");
542 
543  $search =& new ilSearch($_SESSION["AccountId"]);
544  $search->setPerformUpdate(false);
545  $search->setSearchString($_POST["search_str"]);
546  $search->setCombination("and");
547  $search->setSearchFor(array(0 => 'dbk'));
548  $search->setSearchIn(array('dbk' => 'meta'));
549  $search->setSearchType('new');
550 
551  if($search->validate($message))
552  {
553  $search->performSearch();
554  }
555  else
556  {
557  ilUtil::sendInfo($message,true);
558  $this->ctrl->redirect($this, "addTranslation");
559  exit;
560  }
561  return $search->getResultByType('dbk');
562  }
563 
564  function getContextPath($a_endnode_id, $a_startnode_id = 1)
565  {
566  $path = "";
567 
568  include_once("./Services/Tree/classes/class.ilTree.php");
569 
570  $tree = new ilTree(1);
571 
572  if(!$tree->isInTree($a_startnode_id) or !$tree->isInTree($a_endnode_id))
573  {
574  return '';
575  }
576  $tmpPath = $tree->getPathFull($a_endnode_id, $a_startnode_id);
577 
578  // count -1, to exclude the learning module itself
579  for ($i = 1; $i < (count($tmpPath) - 1); $i++)
580  {
581  if ($path != "")
582  {
583  $path .= " > ";
584  }
585 
586  $path .= $tmpPath[$i]["title"];
587  }
588  return $path;
589  }
590 
591  function __checkCitationPost(&$message)
592  {
593  if(!$_POST["pgt_id"])
594  {
595  $message = "SELECT ONE<br />";
596  return false;
597  }
598  return true;
599  }
600 
602  {
603  if(!is_array($_POST["pgt_id"]))
604  {
605  return array();
606  }
607  foreach($_POST["pgt_id"] as $key => $id)
608  {
609  switch($_POST["ct_option"][$key])
610  {
611  case "single":
612  $output[] = array("text" => $id,
613  "start" => $key,
614  "end" => $key);
615  break;
616  case "f":
617  $output[] = array("text" => $id."f",
618  "start" => $key,
619  "end" => $key);
620  break;
621  case "ff":
622  $output[] = array("text" => $id."ff",
623  "start" => $key,
624  "end" => $key);
625  break;
626  case "from":
627  $start = $id."-";
628  $start_v = $key;
629  break;
630  case "to":
631  if($start)
632  {
633  $output[] = array("text" => $start."".$id,
634  "start" => $start_v,
635  "end" => $key);
636  }
637  unset($start);
638  unset($start_v);
639  break;
640  }
641  }
642  return $output ? $output : array();
643  }
644 
645  function __applyCitationText($page_xml,$a_start,$a_end)
646  {
647  global $tpl;
648 
649  return true;
650 
651  $xsl = file_get_contents($tpl->tplPath."/tpl.citation_paragraph.xsl");
652  $args = array( '/_xml' => $page_xml, '/_xsl' => $xsl );
653  $xh = xslt_create();
654  $params = array ('start_id' => $a_start,
655  'end_id' => $a_end);
656 
657  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
658 
659  return $output;
660  }
661 }
662 
663 ?>