ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCParagraphGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Services/COPage/classes/class.ilPCParagraph.php");
5 require_once("./Services/COPage/classes/class.ilPageContentGUI.php");
6 
18 {
23  function ilPCParagraphGUI($a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id = "")
24  {
25  parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
26 
27  // characteristics (should be flexible in the future)
29  }
30 
34  static function _getStandardCharacteristics()
35  {
36  global $lng;
37 
38  return array("Standard" => $lng->txt("cont_standard"),
39  "Headline1" => $lng->txt("cont_Headline1"),
40  "Headline2" => $lng->txt("cont_Headline2"),
41  "Headline3" => $lng->txt("cont_Headline3"),
42  "Citation" => $lng->txt("cont_Citation"),
43  "Mnemonic" => $lng->txt("cont_Mnemonic"),
44  "Example" => $lng->txt("cont_Example"),
45  "Additional" => $lng->txt("cont_Additional"),
46  "Remark" => $lng->txt("cont_Remark"),
47  "List" => $lng->txt("cont_List"),
48  "TableContent" => $lng->txt("cont_TableContent")
49  );
50  }
51 
55  static function _getCharacteristics($a_style_id)
56  {
59 
60  if ($a_style_id > 0 &&
61  ilObject::_lookupType($a_style_id) == "sty")
62  {
63  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
64  $style = new ilObjStyleSheet($a_style_id);
65  $types = array("text_block", "heading1", "heading2", "heading3");
66  $chars = array();
67  foreach ($types as $t)
68  {
69  $chars = array_merge($chars, $style->getCharacteristics($t));
70  }
71  $new_chars = array();
72  foreach ($chars as $char)
73  {
74  if ($st_chars[$char] != "") // keep lang vars for standard chars
75  {
76  $new_chars[$char] = $st_chars[$char];
77  }
78  else
79  {
80  $new_chars[$char] = $char;
81  }
82  asort($new_chars);
83  }
84  $chars = $new_chars;
85  }
86 
87  return $chars;
88  }
89 
93  function &executeCommand()
94  {
95  // get next class that processes or forwards current command
96  $next_class = $this->ctrl->getNextClass($this);
97 
99  array("text_block", "heading1", "heading2", "heading3")); // scorm-2004
100 
101  // get current command
102  $cmd = $this->ctrl->getCmd();
103 
104  $this->log->debug("ilPCParagraphGUI: executeCommand ".$cmd);
105 
106  switch($next_class)
107  {
108  default:
109  $ret =& $this->$cmd();
110  break;
111  }
112 
113  return $ret;
114  }
115 
119  function edit($a_insert = false)
120  {
121  global $ilUser, $ilias;
122 
123  // add paragraph edit template
124  $tpl = new ilTemplate("tpl.paragraph_edit.html", true, true, "Services/COPage");
125 
126  // help text
127  $this->insertHelp($tpl);
128 
129  // operations
130  if ($a_insert)
131  {
132  $tpl->setCurrentBlock("commands");
133  $tpl->setVariable("BTN_NAME", "create_par");
134  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
135  $tpl->setVariable("BTN_CANCEL", "cancelCreate");
136  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
137  $tpl->parseCurrentBlock();
138  $tpl->setCurrentBlock("commands2");
139  $tpl->setVariable("BTN_NAME", "create_par");
140  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
141  $tpl->setVariable("BTN_CANCEL", "cancelCreate");
142  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
143  $tpl->parseCurrentBlock();
144  $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
145  }
146  else
147  {
148  $tpl->setCurrentBlock("commands");
149  $tpl->setVariable("BTN_NAME", "update");
150  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
151  $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
152  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
153  $tpl->parseCurrentBlock();
154  $tpl->setCurrentBlock("commands2");
155  $tpl->setVariable("BTN_NAME", "update");
156  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
157  $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
158  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
159  $tpl->parseCurrentBlock();
160  $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
161  }
162 
163  // language and characteristic selection
164  $s_char = $this->determineCharacteristic($a_insert);
165  if (!$a_insert)
166  {
167  if (key($_POST["cmd"]) == "update")
168  {
169  $s_lang = $_POST["par_language"];
170  }
171  else
172  {
173  $s_lang = $this->content_obj->getLanguage();
174  }
175  }
176  else
177  {
178  if (key($_POST["cmd"]) == "create_par")
179  {
180  $s_lang = $_POST["par_language"];
181  }
182  else
183  {
184  if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
185  {
186  $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
187  }
188  else
189  {
190  $s_lang = $ilUser->getLanguage();
191  }
192  }
193  }
194 
195  $this->insertStyleSelectionList($tpl, $s_char);
196 // $this->insertCharacteristicTable($tpl, $s_char);
197 
198 
199  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
200 
201  $tpl->setVariable("PAR_TA_NAME", "par_content");
202  $tpl->setVariable("BB_MENU", $this->getBBMenu());
203  $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
204  $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
205  $this->setStyle();
206 
207  $this->displayValidationError();
208 
209  $tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
210  $tpl->setVariable("TXT_ANCHOR", $this->lng->txt("cont_anchor"));
211 
212  require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
214  $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
215  $tpl->setVariable("SELECT_LANGUAGE", $select_lang);
216 
217  $tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
218 // $select_char = ilUtil::formSelect ($s_char,
219 // "par_characteristic",$this->chars,false,true);
220 // $tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
221 
222  if (key($_POST["cmd"]) == "update" || key($_POST["cmd"]) == "create_par")
223  {
224  $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
225  // prevent curly brackets from being swallowed up by template engine
226  $s_text = str_replace("{", "&#123;", $s_text);
227  $s_text = str_replace("}", "&#125;", $s_text);
228  }
229  else if (!$a_insert)
230  {
231  $s_text = $this->content_obj->xml2output($this->content_obj->getText());
232  }
233 
234  $tpl->setVariable("PAR_TA_CONTENT", $s_text);
235 
236  $tpl->parseCurrentBlock();
237 
238  $this->tpl->setContent($tpl->get());
239  return $tpl->get();
240  }
241 
248  function determineCharacteristic($a_insert = false)
249  {
250  // language and characteristic selection
251  if (!$a_insert)
252  {
253  if (key($_POST["cmd"]) == "update")
254  {
255  $s_char = $_POST["par_characteristic"];
256  }
257  else
258  {
259  $s_char = $this->content_obj->getCharacteristic();
260  if ($s_char == "")
261  {
262  $s_char = "Standard";
263  }
264  }
265  }
266  else
267  {
268  if (key($_POST["cmd"]) == "create_par")
269  {
270  $s_char = $_POST["par_characteristic"];
271  }
272  else
273  {
274  $s_char = "Standard";
275 
276  // set characteristic of new paragraphs in list items to "List"
277  $cont_obj = $this->pg_obj->getContentObject($this->getHierId());
278  if (is_object($cont_obj))
279  {
280  if ($cont_obj->getType() == "li" ||
281  ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List"))
282  {
283  $s_char = "List";
284  }
285 
286  if ($cont_obj->getType() == "td" ||
287  ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent"))
288  {
289  $s_char = "TableContent";
290  }
291 
292  }
293  }
294  }
295  return $s_char;
296  }
297 
301  function editJS()
302  {
303  global $ilUser, $ilias;
304 
305  $s_text = $this->content_obj->getText();
306 //echo "\n<br><br>".htmlentities($s_text);
307  $s_text = $this->content_obj->xml2output($s_text, true, false);
308 //echo "\n<br><br>".htmlentities($s_text);
309  $char = $this->determineCharacteristic(false);
310  $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
311 //echo "\n<br><br>".htmlentities($s_text);
312  $ids = "###".$this->content_obj->readHierId().":".$this->content_obj->readPCId()."###".
313  $char."###";
314  echo $ids.$s_text;
315  $this->log->debug("ilPCParagraphGUI, editJS(): echo paragraph and exit: ".substr($ids.$s_text, 0, 100));
316  exit;
317  }
318 
322  function editMultipleJS()
323  {
324  global $ilUser, $ilias;
325 
326  echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
327  exit;
328  }
329 
333  static function xml2outputJS($s_text, $char, $a_pc_id)
334  {
335 // $s_text = "<div class='ilc_text_block_".$char."' id='$a_pc_id'>".$s_text."</div>";
336  $s_text = $s_text;
337  // lists
338  $s_text = str_replace(array("<SimpleBulletList>", "</SimpleBulletList>"),
339  array("<ul class='ilc_list_u_BulletedList'>", "</ul>"),
340  $s_text);
341  $s_text = str_replace(array("<SimpleNumberedList>", "</SimpleNumberedList>"),
342  array("<ol class='ilc_list_o_NumberedList'>", "</ol>"), $s_text);
343  $s_text = str_replace(array("<SimpleListItem>", "</SimpleListItem>"),
344  array("<li class='ilc_list_item_StandardListItem'>", "</li>"), $s_text);
345  $s_text = str_replace(array("<SimpleListItem/>"),
346  array("<li class='ilc_list_item_StandardListItem'></li>"), $s_text);
347  //$s_text = str_replace("<SimpleBulletList><br />", "<SimpleBulletList>", $s_text);
348  //$s_text = str_replace("<SimpleNumberedList><br />", "<SimpleNumberedList>", $s_text);
349  //$s_text = str_replace("</SimpleListItem><br />", "</SimpleListItem>", $s_text);
350 
351 
352  // spans
353  include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
354  foreach (ilPageContentGUI::_getCommonBBButtons() as $bb => $cl)
355  {
356  if (!in_array($bb, array("code", "tex", "fn", "xln", "sub", "sup")))
357  {
358  $s_text = str_replace("[".$bb."]",
359  '<span class="ilc_text_inline_'.$cl.'">', $s_text);
360  $s_text = str_replace("[/".$bb."]",
361  '</span>', $s_text);
362  }
363  }
364 
365  // code
366  $s_text = str_replace(array("[code]", "[/code]"),
367  array("<code>", "</code>"), $s_text);
368 
369  // sup
370  $s_text = str_replace(array("[sup]", "[/sup]"),
371  array('<sup class="ilc_sup_Sup">', "</sup>"), $s_text);
372 
373  // sub
374  $s_text = str_replace(array("[sub]", "[/sub]"),
375  array('<sub class="ilc_sub_Sub">', "</sub>"), $s_text);
376 
377  return $s_text;
378  }
379 
380 
387  function saveJS()
388  {
389  global $ilCtrl;
390 
391  $this->log->debug("start");
392 
393  $this->updated = $this->content_obj->saveJS($this->pg_obj,
394  $_POST["ajaxform_content"],
395  ilUtil::stripSlashes($_POST["ajaxform_char"]),
396  ilUtil::stripSlashes($_POST["pc_id_str"]));
397 
398  $this->log->debug("ilPCParagraphGUI, saveJS: got updated value ".$this->updated);
399 
400  if ($_POST["quick_save"])
401  {
402  if ($this->updated === true)
403  {
404  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
405  $this->log->debug("ilPCParagraphGUI, saveJS: echoing pc_id_str ".$a_pc_id_str." (and exit)");
406  echo $a_pc_id_str;
407  exit;
408  }
409  }
410 
411  if ($this->updated !== true && is_array($this->updated))
412  {
413  $this->outputError($this->updated);
414  }
415 
416  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
417 
418  $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
419  urlencode($a_pc_id_str));
420  $this->log->debug("ilPCParagraphGUI, saveJS: redirecting to edit command of ".$ilCtrl->getReturnClass($this).".");
421  $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
422  }
423 
429  function outputError($a_err)
430  {
431  $err_str = "";
432  foreach ($a_err as $err)
433  {
434  $err_str.= $err[1]."<br />";
435  }
436  echo $err_str;
437  $this->log->debug("ilPCParagraphGUI, outputError() and exit: ".substr($err_str, 0, 100));
438  exit;
439  }
440 
441 
445  function cancel()
446  {
447  $this->log->debug("ilPCParagraphGUI, cancel(): return to parent: jump".$this->hier_id);
448  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
449  }
450 
454  function insertCharacteristicTable($a_tpl, $a_seleted_value)
455  {
456  $i = 0;
457 
458  $chars = $this->getCharacteristics();
459 
460  if ($chars[$a_seleted_value] == "" && ($a_seleted_value != ""))
461  {
462  $chars = array_merge(array($a_seleted_value => $a_seleted_value),
463  $chars);
464  }
465 
466  foreach ($chars as $char => $char_lang)
467  {
468  $a_tpl->setCurrentBlock("characteristic_cell");
469  $a_tpl->setVariable("CHAR_HTML",
470  '<div class="ilc_text_block_'.$char.'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang."</div>");
471  $a_tpl->setVariable("CHAR_VALUE", $char);
472  if ($char == $a_seleted_value)
473  {
474  $a_tpl->setVariable("SELECTED",
475  ' checked="checked" ');
476  }
477  $a_tpl->parseCurrentBlock();
478  if ((($i+1) % 3) == 0) //
479  {
480  $a_tpl->touchBlock("characteristic_row");
481  }
482  $i++;
483  }
484  $a_tpl->touchBlock("characteristic_table");
485  }
486 
493  function insertStyleSelectionList($a_tpl, $a_selected)
494  {
495  $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector($a_selected,
496  $this->getCharacteristics()));
497  }
498 
502  static function getStyleSelector($a_selected, $a_chars, $a_use_callback = false)
503  {
504  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
505  $selection = new ilAdvancedSelectionListGUI();
506  $selection->setPullRight(false);
507  $selection->setFormSelectMode("par_characteristic", "", false,
508  "", "", "",
509  "", "", "", "");
510  $selection->setId("style_selection");
511  $selection->setSelectionHeaderClass("ilEditSubmit ilTinyMenuDropDown");
512  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
513  $selection->setSelectedValue($a_selected);
514  $selection->setUseImages(false);
515  $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT);
516  if ($a_use_callback)
517  {
518  $selection->setSelectCallback("ilCOPage.setParagraphClass");
519  }
520 
521  $chars = $a_chars;
522  $title_char = ($chars[$a_selected] != "")
523  ? $chars[$a_selected]
524  : $a_selected;
525  $selection->setListTitle($title_char);
526 
527  if ($chars[$a_seleted] == "" && ($a_seleted != ""))
528  {
529  $chars = array_merge(array($a_seleted => $a_seleted),
530  $chars);
531  }
532 
533  foreach ($chars as $char => $char_lang)
534  {
535  $t = "text_block";
536  $tag = "div";
537  switch($char)
538  {
539  case "Headline1": $t = "heading1"; $tag = "h1"; break;
540  case "Headline2": $t = "heading2"; $tag = "h2"; break;
541  case "Headline3": $t = "heading3"; $tag = "h3"; break;
542  }
543  $html = '<div class="ilCOPgEditStyleSelectionItem"><'.$tag.' class="ilc_'.$t.'_'.$char.'" style="'.self::$style_selector_reset.'">'.$char_lang."</".$tag."></div>";
544  $selection->addItem($char_lang, $char, "",
545  "", $char, "", $html);
546  }
547  return $selection->getHTML();
548  }
549 
553  static function getCharStyleSelector($a_par_type, $a_use_callback = true)
554  {
555  global $lng;
556 
557  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
558  $selection = new ilAdvancedSelectionListGUI();
559  $selection->setPullRight(false);
560  $selection->setFormSelectMode("char_characteristic", "", false,
561  "", "", "",
562  "", "", "", "");
563  $selection->setId("char_style_selection");
564  $selection->setSelectionHeaderClass("ilEditSubmit");
565  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
566  //$selection->setSelectedValue($a_selected);
567  $selection->setUseImages(false);
568  $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP);
569  if ($a_use_callback)
570  {
571  $selection->setSelectCallback("ilCOPage.setCharacterClass");
572  }
573 
574  //$chars = $a_chars;
575  //$title_char = ($chars[$a_selected] != "")
576  // ? $chars[$a_selected]
577  // : $a_selected;
578  $selection->setListTitle("&nbsp;<i>A</i>");
579 
580  /*if ($chars[$a_seleted] == "" && ($a_seleted != ""))
581  {
582  $chars = array_merge(array($a_seleted => $a_seleted),
583  $chars);
584  }*/
585 
586  $chars = array(
587  "Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")),
588  "Quotation" => array("code" => "quot", "txt" =>$lng->txt("cont_char_style_quot")),
589  "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")),
590  "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))
591  );
592  foreach ($chars as $key => $char)
593  {
595  $a_par_type, "active_".$char["code"], true))
596  {
597  $t = "text_inline";
598  $tag = "span";
599  switch($key)
600  {
601  case "Code": $tag = "code"; break;
602  }
603  $html = '<'.$tag.' class="ilc_'.$t.'_'.$key.'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">'.$char["txt"]."</".$tag.">";
604 
605  // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the
606  // advanced selection list. But it is impossible to prevent the tr-event from removing the focus
607  // on tiny withouth the following line, that receives the click event before and stops the faulty default
608  // bevaviour of IE, see bug report #8723
609  $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">'.$html."</a>";
610  $selection->addItem($char["txt"], $key, "",
611  "", $key, "", $html);
612  }
613  }
614  return $selection->getHTML();
615  }
616 
620  private function setStyle()
621  {
622  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
623 
624  if ($this->pg_obj->getParentType() == "gdf" ||
625  $this->pg_obj->getParentType() == "lm" ||
626  $this->pg_obj->getParentType() == "dbk")
627  {
628  if ($this->pg_obj->getParentType() != "gdf")
629  {
630  $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
631  ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
632  }
633  else
634  {
635  $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
636  }
637  }
638  else
639  {
640  if ($this->pg_obj->getParentType() != "sahs")
641  {
642 // $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
643  }
644  }
645  }
646 
650  function insert()
651  {
652  $this->log->debug("ilPCParagraphGUI, saveJS: got updated value ".$this->updated);
653  return $this->edit(true);
654  }
655 
659  function update()
660  {
661  $this->log->debug("ilPCParagraphGUI, update(): start");
662 
663  // set language and characteristic
664  $this->content_obj->setLanguage($_POST["par_language"]);
665  $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
666 
667  $this->updated = $this->content_obj->setText(
668  $this->content_obj->input2xml($_POST["par_content"],
669  $_POST["usedwsiwygeditor"]), true);
670  if ($this->updated !== true)
671  {
672  $this->edit();
673  return;
674  }
675 
676  $this->updated = $this->content_obj->updatePage($this->pg_obj);
677 
678 
679  if ($this->updated === true)
680  {
681  $this->log->debug("ilPCParagraphGUI, update(): return to parent: jump".$this->hier_id);
682  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
683  }
684  else
685  {
686  $this->log->debug("ilPCParagraphGUI, update(): call edit.");
687  $this->edit();
688  }
689  }
690 
691 
695  function create()
696  {
697  $this->log->debug("ilPCParagraphGUI, create(): start.");
698 
699  if ($_POST["ajaxform_hier_id"] != "")
700  {
701  return $this->createJS();
702  }
703 
704  $this->content_obj = new ilPCParagraph($this->getPage());
705 //echo "+".$this->pc_id."+";
706  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
707 
708  $this->content_obj->setLanguage($_POST["par_language"]);
709  $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
710  $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
711 
712  $this->updated = $this->content_obj->setText(
713  $this->content_obj->input2xml($_POST["par_content"],
714  $_POST["usedwsiwygeditor"]), true);
715 
716  if ($this->updated !== true)
717  {
718  $this->insert();
719  return;
720  }
721  $this->updated = $this->content_obj->updatePage($this->pg_obj);
722 
723  if ($this->updated === true)
724  {
725  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
726  }
727  else
728  {
729  $this->insert();
730  }
731  }
732 
736  function createJS()
737  {
738  global $ilUser, $ilCtrl;
739 
740  $this->log->debug("ilPCParagraphGUI, createJS(): start");
741 
742  $this->content_obj = new ilPCParagraph($this->getPage());
743  $this->updated = $this->content_obj->saveJS($this->pg_obj,
744  $_POST["ajaxform_content"],
745  ilUtil::stripSlashes($_POST["ajaxform_char"]),
746  ilUtil::stripSlashes($_POST["pc_id_str"]),
747  $_POST["insert_at_id"]);
748  if ($_POST["quick_save"])
749  {
750  if ($this->updated)
751  {
752  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
753  echo $a_pc_id_str;
754  $this->log->debug("ilPCParagraphGUI, createJS(): echo pc id and exit: ".$a_pc_id_str);
755  exit;
756  }
757  }
758 
759  if ($this->updated !== true && is_array($this->updated))
760  {
761  $this->outputError($this->updated);
762  }
763 
764  // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
765  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
766  $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
767  urlencode($a_pc_id_str));
768  $this->log->debug("ilPCParagraphGUI, createJS(): return to edit cmd of ".$ilCtrl->getReturnClass($this));
769 
770  $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
771  }
772 
776  function insertHelp($a_tpl)
777  {
778  global $lng;
779 
780  $a_tpl->setCurrentBlock("help_item");
781  $a_tpl->setVariable("TXT_HELP", "<b>".$lng->txt("cont_syntax_help")."</b>");
782  $a_tpl->parseCurrentBlock();
783  $a_tpl->setCurrentBlock("help_item");
784  $a_tpl->setVariable("TXT_HELP", "* ".$lng->txt("cont_bullet_list"));
785  $a_tpl->parseCurrentBlock();
786  $a_tpl->setCurrentBlock("help_item");
787  $a_tpl->setVariable("TXT_HELP", "# ".$lng->txt("cont_numbered_list"));
788  $a_tpl->parseCurrentBlock();
789  $a_tpl->setCurrentBlock("help_item");
790  $a_tpl->setVariable("TXT_HELP", "=".$lng->txt("cont_Headline1")."=<br />".
791  "==".$lng->txt("cont_Headline2")."==<br />".
792  "===".$lng->txt("cont_Headline3")."===");
793  $a_tpl->parseCurrentBlock();
794 
795  if ($this->getPageConfig()->getEnableWikiLinks())
796  {
797  $a_tpl->setCurrentBlock("help_item");
798  $a_tpl->setVariable("TXT_HELP", "[[".$lng->txt("cont_wiki_page_link")."]]");
799  $a_tpl->parseCurrentBlock();
800  }
801 
802  $a_tpl->setCurrentBlock("help");
803  $a_tpl->parseCurrentBlock();
804  }
805 
806 }
807 ?>
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$style
Definition: example_012.php:70
exit
Definition: login.php:54
update()
update paragraph in dom and update page in db
$_POST['username']
Definition: cron.php:12
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
edit($a_insert=false)
edit paragraph form
$_SESSION["AccountId"]
ilPCParagraphGUI($a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
getHierId()
get hierarchical id in dom object
static _getCharacteristics($a_style_id)
Get characteristics.
Class ilPCParagraph.
insertStyleSelectionList($a_tpl, $a_selected)
Insert style selection list.
static _getStandardCharacteristics()
Get standard characteristics.
static getStyleSelector($a_selected, $a_chars, $a_use_callback=false)
Get style selector.
getPageConfig()
Get Page Config.
insert()
insert paragraph form
saveJS()
Save paragraph by JS call.
global $ilCtrl
Definition: ilias.php:18
create()
create new paragraph in dom and update page in db
setCharacteristics($a_chars)
Set Characteristics.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
editJS()
Edit paragraph (Ajax mode, sends the content of the paragraph)
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
special template class to simplify handling of ITX/PEAR
displayValidationError()
display validation errors
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getCharacteristics()
Get characteristics.
static getCharStyleSelector($a_par_type, $a_use_callback=true)
Get character style selector.
static _lookupType($a_id, $a_reference=false)
lookup object type
editMultipleJS()
Edit multiple paragraphs (Ajax mode, sends the content of the paragraphs)
User interface class for advanced drop-down selection lists.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
global $ilUser
Definition: imgupload.php:15
determineCharacteristic($a_insert=false)
Determine current characteristic.
getContentStylePath($a_style_id)
get content style path
static _getCommonBBButtons()
Get common bb buttons.
Class ilObjStyleSheet.
outputError($a_err)
Output error.
& executeCommand()
execute command
insertCharacteristicTable($a_tpl, $a_seleted_value)
Insert characteristic table.
$html
Definition: example_001.php:87
insertHelp($a_tpl)
Insert Help.
createJS()
Create paragraph per JS.
Class ilPCParagraphGUI.