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