ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCParagraphGUI Class Reference

Class ilPCParagraphGUI. More...

+ Inheritance diagram for ilPCParagraphGUI:
+ Collaboration diagram for ilPCParagraphGUI:

Public Member Functions

 ilPCParagraphGUI ($a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 edit ($a_insert=false)
 edit paragraph form More...
 
 determineCharacteristic ($a_insert=false)
 Determine current characteristic. More...
 
 editJS ()
 Edit paragraph (Ajax mode, sends the content of the paragraph) More...
 
 editMultipleJS ()
 Edit multiple paragraphs (Ajax mode, sends the content of the paragraphs) More...
 
 saveJS ()
 Save paragraph by JS call. More...
 
 outputError ($a_err)
 Output error. More...
 
 cancel ()
 Cancel. More...
 
 insertCharacteristicTable ($a_tpl, $a_seleted_value)
 Insert characteristic table. More...
 
 insertStyleSelectionList ($a_tpl, $a_selected)
 Insert style selection list. More...
 
 insert ()
 insert paragraph form More...
 
 update ()
 update paragraph in dom and update page in db More...
 
 create ()
 create new paragraph in dom and update page in db More...
 
 createJS ()
 Create paragraph per JS. More...
 
 insertHelp ($a_tpl)
 Insert Help. More...
 
- Public Member Functions inherited from ilPageContentGUI
 ilPageContentGUI ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 display validation errors More...
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions ($a_type)
 Get table templates. More...
 

Static Public Member Functions

static _getStandardCharacteristics ()
 Get standard characteristics. More...
 
static _getCharacteristics ($a_style_id)
 Get characteristics. More...
 
static xml2outputJS ($s_text, $char, $a_pc_id)
 Prepare content for js output. More...
 
static getStyleSelector ($a_selected, $a_chars, $a_use_callback=false)
 Get style selector. More...
 
static getCharStyleSelector ($a_par_type, $a_use_callback=true)
 Get character style selector. More...
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 

Private Member Functions

 setStyle ()
 Set Style. More...
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCParagraphGUI.

User Interface for Paragraph Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilPCParagraphGUI.php.

Member Function Documentation

◆ _getCharacteristics()

static ilPCParagraphGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

Definition at line 55 of file class.ilPCParagraphGUI.php.

References $t, _getStandardCharacteristics(), and ilObject\_lookupType().

Referenced by ilPageObjectGUI\getTinyMenu(), and ilPageEditorGUI\initCharacteristicForm().

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  }
static _getStandardCharacteristics()
Get standard characteristics.
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjStyleSheet.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getStandardCharacteristics()

static ilPCParagraphGUI::_getStandardCharacteristics ( )
static

Get standard characteristics.

Definition at line 34 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\$lng.

Referenced by _getCharacteristics(), and ilPCParagraphGUI().

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  }
+ Here is the caller graph for this function:

◆ cancel()

ilPCParagraphGUI::cancel ( )

Cancel.

Definition at line 424 of file class.ilPCParagraphGUI.php.

425  {
426  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
427  }

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

Definition at line 683 of file class.ilPCParagraphGUI.php.

References $_POST, $_SESSION, createJS(), ilPageContentGUI\getPage(), and insert().

684  {
685  if ($_POST["ajaxform_hier_id"] != "")
686  {
687  return $this->createJS();
688  }
689 
690  $this->content_obj = new ilPCParagraph($this->getPage());
691 //echo "+".$this->pc_id."+";
692  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
693 
694  $this->content_obj->setLanguage($_POST["par_language"]);
695  $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
696  $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
697 
698  $this->updated = $this->content_obj->setText(
699  $this->content_obj->input2xml($_POST["par_content"],
700  $_POST["usedwsiwygeditor"]), true);
701 
702  if ($this->updated !== true)
703  {
704  $this->insert();
705  return;
706  }
707  $this->updated = $this->content_obj->updatePage($this->pg_obj);
708 
709  if ($this->updated === true)
710  {
711  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
712  }
713  else
714  {
715  $this->insert();
716  }
717  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
Class ilPCParagraph.
insert()
insert paragraph form
createJS()
Create paragraph per JS.
+ Here is the call graph for this function:

◆ createJS()

ilPCParagraphGUI::createJS ( )

Create paragraph per JS.

Definition at line 722 of file class.ilPCParagraphGUI.php.

References $_POST, $ilCtrl, $ilUser, exit, ilPageContentGUI\getPage(), outputError(), and ilUtil\stripSlashes().

Referenced by create().

723  {
724  global $ilUser, $ilCtrl;
725 
726  $this->content_obj = new ilPCParagraph($this->getPage());
727  $this->updated = $this->content_obj->saveJS($this->pg_obj,
728  $_POST["ajaxform_content"],
729  ilUtil::stripSlashes($_POST["ajaxform_char"]),
730  ilUtil::stripSlashes($_POST["pc_id_str"]),
731  $_POST["insert_at_id"]);
732  if ($_POST["quick_save"])
733  {
734  if ($this->updated)
735  {
736  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
737  echo $a_pc_id_str;
738  exit;
739  }
740  }
741 
742  if ($this->updated !== true && is_array($this->updated))
743  {
744  $this->outputError($this->updated);
745  }
746 
747  // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
748  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
749  $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
750  urlencode($a_pc_id_str));
751  $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
752  }
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
Class ilPCParagraph.
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilUser
Definition: imgupload.php:15
outputError($a_err)
Output error.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineCharacteristic()

ilPCParagraphGUI::determineCharacteristic (   $a_insert = false)

Determine current characteristic.

Parameters

Definition at line 246 of file class.ilPCParagraphGUI.php.

References $_POST, and ilPageContentGUI\getHierId().

Referenced by edit(), and editJS().

247  {
248  // language and characteristic selection
249  if (!$a_insert)
250  {
251  if (key($_POST["cmd"]) == "update")
252  {
253  $s_char = $_POST["par_characteristic"];
254  }
255  else
256  {
257  $s_char = $this->content_obj->getCharacteristic();
258  if ($s_char == "")
259  {
260  $s_char = "Standard";
261  }
262  }
263  }
264  else
265  {
266  if (key($_POST["cmd"]) == "create_par")
267  {
268  $s_char = $_POST["par_characteristic"];
269  }
270  else
271  {
272  $s_char = "Standard";
273 
274  // set characteristic of new paragraphs in list items to "List"
275  $cont_obj = $this->pg_obj->getContentObject($this->getHierId());
276  if (is_object($cont_obj))
277  {
278  if ($cont_obj->getType() == "li" ||
279  ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List"))
280  {
281  $s_char = "List";
282  }
283 
284  if ($cont_obj->getType() == "td" ||
285  ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent"))
286  {
287  $s_char = "TableContent";
288  }
289 
290  }
291  }
292  }
293  return $s_char;
294  }
$_POST['username']
Definition: cron.php:12
getHierId()
get hierarchical id in dom object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit()

ilPCParagraphGUI::edit (   $a_insert = false)

edit paragraph form

Definition at line 117 of file class.ilPCParagraphGUI.php.

References $_GET, $_POST, $_SESSION, ilPageContentGUI\$ilias, $ilUser, $lang, ilPageContentGUI\$tpl, ilMDLanguageItem\_getLanguages(), determineCharacteristic(), ilPageContentGUI\displayValidationError(), ilUtil\formSelect(), ilPageContentGUI\getBBMenu(), insertHelp(), insertStyleSelectionList(), setStyle(), and ilUtil\stripSlashes().

Referenced by insert(), and update().

118  {
119  global $ilUser, $ilias;
120 
121  // add paragraph edit template
122  $tpl = new ilTemplate("tpl.paragraph_edit.html", true, true, "Services/COPage");
123 
124  // help text
125  $this->insertHelp($tpl);
126 
127  // operations
128  if ($a_insert)
129  {
130  $tpl->setCurrentBlock("commands");
131  $tpl->setVariable("BTN_NAME", "create_par");
132  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
133  $tpl->setVariable("BTN_CANCEL", "cancelCreate");
134  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
135  $tpl->parseCurrentBlock();
136  $tpl->setCurrentBlock("commands2");
137  $tpl->setVariable("BTN_NAME", "create_par");
138  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
139  $tpl->setVariable("BTN_CANCEL", "cancelCreate");
140  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
141  $tpl->parseCurrentBlock();
142  $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
143  }
144  else
145  {
146  $tpl->setCurrentBlock("commands");
147  $tpl->setVariable("BTN_NAME", "update");
148  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
149  $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
150  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
151  $tpl->parseCurrentBlock();
152  $tpl->setCurrentBlock("commands2");
153  $tpl->setVariable("BTN_NAME", "update");
154  $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
155  $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
156  $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
157  $tpl->parseCurrentBlock();
158  $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
159  }
160 
161  // language and characteristic selection
162  $s_char = $this->determineCharacteristic($a_insert);
163  if (!$a_insert)
164  {
165  if (key($_POST["cmd"]) == "update")
166  {
167  $s_lang = $_POST["par_language"];
168  }
169  else
170  {
171  $s_lang = $this->content_obj->getLanguage();
172  }
173  }
174  else
175  {
176  if (key($_POST["cmd"]) == "create_par")
177  {
178  $s_lang = $_POST["par_language"];
179  }
180  else
181  {
182  if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
183  {
184  $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
185  }
186  else
187  {
188  $s_lang = $ilUser->getLanguage();
189  }
190  }
191  }
192 
193  $this->insertStyleSelectionList($tpl, $s_char);
194 // $this->insertCharacteristicTable($tpl, $s_char);
195 
196 
197  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
198 
199  $tpl->setVariable("PAR_TA_NAME", "par_content");
200  $tpl->setVariable("BB_MENU", $this->getBBMenu());
201  $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
202  $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
203  $this->setStyle();
204 
205  $this->displayValidationError();
206 
207  $tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
208  $tpl->setVariable("TXT_ANCHOR", $this->lng->txt("cont_anchor"));
209 
210  require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
212  $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
213  $tpl->setVariable("SELECT_LANGUAGE", $select_lang);
214 
215  $tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
216 // $select_char = ilUtil::formSelect ($s_char,
217 // "par_characteristic",$this->chars,false,true);
218 // $tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
219 
220  if (key($_POST["cmd"]) == "update" || key($_POST["cmd"]) == "create_par")
221  {
222  $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
223  // prevent curly brackets from being swallowed up by template engine
224  $s_text = str_replace("{", "&#123;", $s_text);
225  $s_text = str_replace("}", "&#125;", $s_text);
226  }
227  else if (!$a_insert)
228  {
229  $s_text = $this->content_obj->xml2output($this->content_obj->getText());
230  }
231 
232  $tpl->setVariable("PAR_TA_CONTENT", $s_text);
233 
234  $tpl->parseCurrentBlock();
235 
236  $this->tpl->setContent($tpl->get());
237  return $tpl->get();
238  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
insertStyleSelectionList($a_tpl, $a_selected)
Insert style selection list.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
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
global $ilUser
Definition: imgupload.php:15
determineCharacteristic($a_insert=false)
Determine current characteristic.
insertHelp($a_tpl)
Insert Help.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editJS()

ilPCParagraphGUI::editJS ( )

Edit paragraph (Ajax mode, sends the content of the paragraph)

Definition at line 299 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\$ilias, $ilUser, determineCharacteristic(), exit, and xml2outputJS().

300  {
301  global $ilUser, $ilias;
302 
303  $s_text = $this->content_obj->getText();
304 //echo "\n<br><br>".htmlentities($s_text);
305  $s_text = $this->content_obj->xml2output($s_text, true, false);
306 //echo "\n<br><br>".htmlentities($s_text);
307  $char = $this->determineCharacteristic(false);
308  $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
309 //echo "\n<br><br>".htmlentities($s_text);
310  $ids = "###".$this->content_obj->readHierId().":".$this->content_obj->readPCId()."###".
311  $char."###";
312  echo $ids.$s_text;
313  exit;
314  }
exit
Definition: login.php:54
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
global $ilUser
Definition: imgupload.php:15
determineCharacteristic($a_insert=false)
Determine current characteristic.
+ Here is the call graph for this function:

◆ editMultipleJS()

ilPCParagraphGUI::editMultipleJS ( )

Edit multiple paragraphs (Ajax mode, sends the content of the paragraphs)

Definition at line 319 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\$ilias, $ilUser, and exit.

320  {
321  global $ilUser, $ilias;
322 
323  echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
324  exit;
325  }
exit
Definition: login.php:54
global $ilUser
Definition: imgupload.php:15

◆ executeCommand()

& ilPCParagraphGUI::executeCommand ( )

execute command

Definition at line 93 of file class.ilPCParagraphGUI.php.

References $cmd, $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

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  switch($next_class)
105  {
106  default:
107  $ret =& $this->$cmd();
108  break;
109  }
110 
111  return $ret;
112  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getCharStyleSelector()

static ilPCParagraphGUI::getCharStyleSelector (   $a_par_type,
  $a_use_callback = true 
)
static

Get character style selector.

Definition at line 530 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\$lng, $t, ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, ilPageEditorSettings\lookupSettingByParentType(), and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_NOP.

Referenced by ilPageObjectGUI\getTinyMenu().

531  {
532  global $lng;
533 
534  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
535  $selection = new ilAdvancedSelectionListGUI();
536  $selection->setFormSelectMode("char_characteristic", "", false,
537  "", "", "",
538  "", "", "", "");
539  $selection->setId("char_style_selection");
540  $selection->setSelectionHeaderClass("ilEditSubmit");
541  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
542  //$selection->setSelectedValue($a_selected);
543  $selection->setUseImages(false);
544  $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP);
545  if ($a_use_callback)
546  {
547  $selection->setSelectCallback("ilCOPage.setCharacterClass");
548  }
549 
550  //$chars = $a_chars;
551  //$title_char = ($chars[$a_selected] != "")
552  // ? $chars[$a_selected]
553  // : $a_selected;
554  $selection->setListTitle("&nbsp;<i>A</i>");
555 
556  /*if ($chars[$a_seleted] == "" && ($a_seleted != ""))
557  {
558  $chars = array_merge(array($a_seleted => $a_seleted),
559  $chars);
560  }*/
561 
562  $chars = array(
563  "Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")),
564  "Quotation" => array("code" => "quot", "txt" =>$lng->txt("cont_char_style_quot")),
565  "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")),
566  "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))
567  );
568  foreach ($chars as $key => $char)
569  {
571  $a_par_type, "active_".$char["code"], true))
572  {
573  $t = "text_inline";
574  $tag = "span";
575  switch($key)
576  {
577  case "Code": $tag = "code"; break;
578  }
579  $html = '<'.$tag.' class="ilc_'.$t.'_'.$key.'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">'.$char["txt"]."</".$tag.">";
580 
581  // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the
582  // advanced selection list. But it is impossible to prevent the tr-event from removing the focus
583  // on tiny withouth the following line, that receives the click event before and stops the faulty default
584  // bevaviour of IE, see bug report #8723
585  $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">'.$html."</a>";
586  $selection->addItem($char["txt"], $key, "",
587  "", $key, "", $html);
588  }
589  }
590  return $selection->getHTML();
591  }
User interface class for advanced drop-down selection lists.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleSelector()

static ilPCParagraphGUI::getStyleSelector (   $a_selected,
  $a_chars,
  $a_use_callback = false 
)
static

Get style selector.

Definition at line 480 of file class.ilPCParagraphGUI.php.

References $t, ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_FORM_SELECT.

Referenced by ilPageObjectGUI\getTinyMenu().

481  {
482  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
483  $selection = new ilAdvancedSelectionListGUI();
484  $selection->setFormSelectMode("par_characteristic", "", false,
485  "", "", "",
486  "", "", "", "");
487  $selection->setId("style_selection");
488  $selection->setSelectionHeaderClass("ilEditSubmit ilTinyMenuDropDown");
489  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
490  $selection->setSelectedValue($a_selected);
491  $selection->setUseImages(false);
492  $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT);
493  if ($a_use_callback)
494  {
495  $selection->setSelectCallback("ilCOPage.setParagraphClass");
496  }
497 
498  $chars = $a_chars;
499  $title_char = ($chars[$a_selected] != "")
500  ? $chars[$a_selected]
501  : $a_selected;
502  $selection->setListTitle($title_char);
503 
504  if ($chars[$a_seleted] == "" && ($a_seleted != ""))
505  {
506  $chars = array_merge(array($a_seleted => $a_seleted),
507  $chars);
508  }
509 
510  foreach ($chars as $char => $char_lang)
511  {
512  $t = "text_block";
513  $tag = "div";
514  switch($char)
515  {
516  case "Headline1": $t = "heading1"; $tag = "h1"; break;
517  case "Headline2": $t = "heading2"; $tag = "h2"; break;
518  case "Headline3": $t = "heading3"; $tag = "h3"; break;
519  }
520  $html = '<'.$tag.' class="ilc_'.$t.'_'.$char.'" style="margin-top:2px; margin-bottom:2px; text-indent:0px; position:static;">'.$char_lang."</".$tag.">";
521  $selection->addItem($char_lang, $char, "",
522  "", $char, "", $html);
523  }
524  return $selection->getHTML();
525  }
User interface class for advanced drop-down selection lists.
+ Here is the caller graph for this function:

◆ ilPCParagraphGUI()

ilPCParagraphGUI::ilPCParagraphGUI (   $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

Definition at line 23 of file class.ilPCParagraphGUI.php.

References _getStandardCharacteristics(), and ilPageContentGUI\setCharacteristics().

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  }
static _getStandardCharacteristics()
Get standard characteristics.
setCharacteristics($a_chars)
Set Characteristics.
+ Here is the call graph for this function:

◆ insert()

ilPCParagraphGUI::insert ( )

insert paragraph form

Definition at line 626 of file class.ilPCParagraphGUI.php.

References edit().

Referenced by create().

627  {
628  return $this->edit(true);
629  }
edit($a_insert=false)
edit paragraph form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertCharacteristicTable()

ilPCParagraphGUI::insertCharacteristicTable (   $a_tpl,
  $a_seleted_value 
)

Insert characteristic table.

Definition at line 432 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\getCharacteristics().

433  {
434  $i = 0;
435 
436  $chars = $this->getCharacteristics();
437 
438  if ($chars[$a_seleted_value] == "" && ($a_seleted_value != ""))
439  {
440  $chars = array_merge(array($a_seleted_value => $a_seleted_value),
441  $chars);
442  }
443 
444  foreach ($chars as $char => $char_lang)
445  {
446  $a_tpl->setCurrentBlock("characteristic_cell");
447  $a_tpl->setVariable("CHAR_HTML",
448  '<div class="ilc_text_block_'.$char.'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang."</div>");
449  $a_tpl->setVariable("CHAR_VALUE", $char);
450  if ($char == $a_seleted_value)
451  {
452  $a_tpl->setVariable("SELECTED",
453  ' checked="checked" ');
454  }
455  $a_tpl->parseCurrentBlock();
456  if ((($i+1) % 3) == 0) //
457  {
458  $a_tpl->touchBlock("characteristic_row");
459  }
460  $i++;
461  }
462  $a_tpl->touchBlock("characteristic_table");
463  }
getCharacteristics()
Get characteristics.
+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

Definition at line 757 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\$lng, and ilPageContentGUI\getPageConfig().

Referenced by edit().

758  {
759  global $lng;
760 
761  $a_tpl->setCurrentBlock("help_item");
762  $a_tpl->setVariable("TXT_HELP", "<b>".$lng->txt("cont_syntax_help")."</b>");
763  $a_tpl->parseCurrentBlock();
764  $a_tpl->setCurrentBlock("help_item");
765  $a_tpl->setVariable("TXT_HELP", "* ".$lng->txt("cont_bullet_list"));
766  $a_tpl->parseCurrentBlock();
767  $a_tpl->setCurrentBlock("help_item");
768  $a_tpl->setVariable("TXT_HELP", "# ".$lng->txt("cont_numbered_list"));
769  $a_tpl->parseCurrentBlock();
770  $a_tpl->setCurrentBlock("help_item");
771  $a_tpl->setVariable("TXT_HELP", "=".$lng->txt("cont_Headline1")."=<br />".
772  "==".$lng->txt("cont_Headline2")."==<br />".
773  "===".$lng->txt("cont_Headline3")."===");
774  $a_tpl->parseCurrentBlock();
775 
776  if ($this->getPageConfig()->getEnableWikiLinks())
777  {
778  $a_tpl->setCurrentBlock("help_item");
779  $a_tpl->setVariable("TXT_HELP", "[[".$lng->txt("cont_wiki_page_link")."]]");
780  $a_tpl->parseCurrentBlock();
781  }
782 
783  $a_tpl->setCurrentBlock("help");
784  $a_tpl->parseCurrentBlock();
785  }
getPageConfig()
Get Page Config.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertStyleSelectionList()

ilPCParagraphGUI::insertStyleSelectionList (   $a_tpl,
  $a_selected 
)

Insert style selection list.

Parameters
object$a_tpl
string$a_selected

Definition at line 471 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\getCharacteristics().

Referenced by edit().

472  {
473  $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector($a_selected,
474  $this->getCharacteristics()));
475  }
getCharacteristics()
Get characteristics.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outputError()

ilPCParagraphGUI::outputError (   $a_err)

Output error.

Parameters
array$a_errerror array

Definition at line 411 of file class.ilPCParagraphGUI.php.

References exit.

Referenced by createJS(), and saveJS().

412  {
413  foreach ($a_err as $err)
414  {
415  echo $err[1]."<br />";
416  }
417  exit;
418  }
exit
Definition: login.php:54
+ Here is the caller graph for this function:

◆ saveJS()

ilPCParagraphGUI::saveJS ( )

Save paragraph by JS call.

Parameters

Definition at line 376 of file class.ilPCParagraphGUI.php.

References $_POST, $ilCtrl, exit, outputError(), and ilUtil\stripSlashes().

377  {
378  global $ilCtrl;
379 
380  $this->updated = $this->content_obj->saveJS($this->pg_obj,
381  $_POST["ajaxform_content"],
382  ilUtil::stripSlashes($_POST["ajaxform_char"]),
383  ilUtil::stripSlashes($_POST["pc_id_str"]));
384  if ($_POST["quick_save"])
385  {
386  if ($this->updated === true)
387  {
388  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
389  echo $a_pc_id_str;
390  exit;
391  }
392  }
393 
394  if ($this->updated !== true && is_array($this->updated))
395  {
396  $this->outputError($this->updated);
397  }
398 
399  $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
400 
401  $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
402  urlencode($a_pc_id_str));
403  $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
404  }
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
outputError($a_err)
Output error.
+ Here is the call graph for this function:

◆ setStyle()

ilPCParagraphGUI::setStyle ( )
private

Set Style.

Definition at line 596 of file class.ilPCParagraphGUI.php.

References ilObjContentObject\_lookupStyleSheetId(), and ilObjStyleSheet\getContentStylePath().

Referenced by edit().

597  {
598  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
599 
600  if ($this->pg_obj->getParentType() == "gdf" ||
601  $this->pg_obj->getParentType() == "lm" ||
602  $this->pg_obj->getParentType() == "dbk")
603  {
604  if ($this->pg_obj->getParentType() != "gdf")
605  {
606  $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
607  ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
608  }
609  else
610  {
611  $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
612  }
613  }
614  else
615  {
616  if ($this->pg_obj->getParentType() != "sahs")
617  {
618 // $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
619  }
620  }
621  }
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
getContentStylePath($a_style_id)
get content style path
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCParagraphGUI::update ( )

update paragraph in dom and update page in db

Definition at line 634 of file class.ilPCParagraphGUI.php.

References $_POST, $ilBench, and edit().

635  {
636  global $ilBench;
637 
638  $ilBench->start("Editor","Paragraph_update");
639  // set language and characteristic
640  $this->content_obj->setLanguage($_POST["par_language"]);
641  $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
642  //$this->content_obj->setAnchor(ilUtil::stripSlashes($_POST["anchor"]));
643 
644 //echo "<br>PARupdate1:".$_POST["par_content"].":";
645 //echo "<br>PARupdate2:".htmlentities($_POST["par_content"]).":";
646 //echo "<br>PARupdate3:".htmlentities($this->content_obj->input2xml($_POST["par_content"])).":";
647 //echo "<br>PARupdate4:".$this->content_obj->input2xml($_POST["par_content"]).":";
648 
649  //$this->updated = $this->content_obj->setText(
650  // $this->content_obj->input2xml(stripslashes($_POST["par_content"]),
651  // $_POST["usedwsiwygeditor"]));
652  $this->updated = $this->content_obj->setText(
653  $this->content_obj->input2xml($_POST["par_content"],
654  $_POST["usedwsiwygeditor"]), true);
655 //echo "<br>PARupdate2";
656  if ($this->updated !== true)
657  {
658  $ilBench->stop("Editor","Paragraph_update");
659  $this->edit();
660  return;
661  }
662 
663  $this->updated = $this->content_obj->updatePage($this->pg_obj);
664 //echo "<br>PARupdate_after:".htmlentities($this->pg_obj->dom->dump_mem(0, "UTF-8")).":";
665 //debug_print_backtrace();
666 
667  $ilBench->stop("Editor","Paragraph_update");
668 
669  if ($this->updated === true)
670  {
671  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
672  }
673  else
674  {
675  $this->edit();
676  }
677  }
$_POST['username']
Definition: cron.php:12
edit($a_insert=false)
edit paragraph form
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ xml2outputJS()

static ilPCParagraphGUI::xml2outputJS (   $s_text,
  $char,
  $a_pc_id 
)
static

Prepare content for js output.

Definition at line 330 of file class.ilPCParagraphGUI.php.

References ilPageContentGUI\_getCommonBBButtons().

Referenced by ilPCDataTableGUI\editData(), editJS(), and ilPCParagraph\getParagraphSequenceContent().

331  {
332 // $s_text = "<div class='ilc_text_block_".$char."' id='$a_pc_id'>".$s_text."</div>";
333  $s_text = $s_text;
334  // lists
335  $s_text = str_replace(array("<SimpleBulletList>", "</SimpleBulletList>"),
336  array("<ul class='ilc_list_u_BulletedList'>", "</ul>"),
337  $s_text);
338  $s_text = str_replace(array("<SimpleNumberedList>", "</SimpleNumberedList>"),
339  array("<ol class='ilc_list_o_NumberedList'>", "</ol>"), $s_text);
340  $s_text = str_replace(array("<SimpleListItem>", "</SimpleListItem>"),
341  array("<li class='ilc_list_item_StandardListItem'>", "</li>"), $s_text);
342  $s_text = str_replace(array("<SimpleListItem/>"),
343  array("<li class='ilc_list_item_StandardListItem'></li>"), $s_text);
344  //$s_text = str_replace("<SimpleBulletList><br />", "<SimpleBulletList>", $s_text);
345  //$s_text = str_replace("<SimpleNumberedList><br />", "<SimpleNumberedList>", $s_text);
346  //$s_text = str_replace("</SimpleListItem><br />", "</SimpleListItem>", $s_text);
347 
348 
349  // spans
350  include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
351  foreach (ilPageContentGUI::_getCommonBBButtons() as $bb => $cl)
352  {
353  if (!in_array($bb, array("code", "tex", "fn", "xln")))
354  {
355  $s_text = str_replace("[".$bb."]",
356  '<span class="ilc_text_inline_'.$cl.'">', $s_text);
357  $s_text = str_replace("[/".$bb."]",
358  '</span>', $s_text);
359  }
360  }
361 
362  // code
363  $s_text = str_replace(array("[code]", "[/code]"),
364  array("<code>", "</code>"), $s_text);
365 
366  return $s_text;
367  }
static _getCommonBBButtons()
Get common bb buttons.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: