ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCParagraphGUI Class Reference

Class ilPCParagraphGUI. More...

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

Public Member Functions

 __construct ($a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor @access 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
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor @access 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 _getTextCharacteristics ($a_style_id, $a_include_core=false)
 Get text 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, $a_style_id=0)
 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
 
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- 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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

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

24 {
25 parent::__construct($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.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getCharacteristics()

static ilPCParagraphGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

56 {
59
60 if ($a_style_id > 0 &&
61 ilObject::_lookupType($a_style_id) == "sty")
62 {
63 include_once("./Services/Style/Content/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 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type
$style
Definition: example_012.php:70

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

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

+ 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.

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 }

References ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

+ Here is the caller graph for this function:

◆ _getTextCharacteristics()

static ilPCParagraphGUI::_getTextCharacteristics (   $a_style_id,
  $a_include_core = false 
)
static

Get text characteristics.

Parameters
int$a_style_id
bool$a_include_coreinclude core styles
Returns
string[]

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

98 {
99 $chars = array();
100
101 if ($a_style_id > 0 &&
102 ilObject::_lookupType($a_style_id) == "sty")
103 {
104 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
105 $style = new ilObjStyleSheet($a_style_id);
106 $types = array("text_inline");
107 foreach ($types as $t)
108 {
109 $chars = array_merge($chars, $style->getCharacteristics($t, false, $a_include_core));
110 }
111 }
112
113 return $chars;
114 }

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

Referenced by getCharStyleSelector(), and ilPageObjectGUI\showPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilPCParagraphGUI::cancel ( )

Cancel.

Reimplemented from ilPageContentGUI.

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

494 {
495 $this->log->debug("ilPCParagraphGUI, cancel(): return to parent: jump".$this->hier_id);
496 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
497 }

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

755 {
756 $this->log->debug("ilPCParagraphGUI, create(): start.");
757
758 if ($_POST["ajaxform_hier_id"] != "")
759 {
760 return $this->createJS();
761 }
762
763 $this->content_obj = new ilPCParagraph($this->getPage());
764//echo "+".$this->pc_id."+";
765 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
766
767 $this->content_obj->setLanguage($_POST["par_language"]);
768 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
769 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
770
771 $this->updated = $this->content_obj->setText(
772 $this->content_obj->input2xml($_POST["par_content"],
773 $_POST["usedwsiwygeditor"]), true);
774
775 if ($this->updated !== true)
776 {
777 $this->insert();
778 return;
779 }
780 $this->updated = $this->content_obj->updatePage($this->pg_obj);
781
782 if ($this->updated === true)
783 {
784 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
785 }
786 else
787 {
788 $this->insert();
789 }
790 }
$_POST["username"]
$_SESSION["AccountId"]
insert()
insert paragraph form
createJS()
Create paragraph per JS.
Class ilPCParagraph.

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

+ Here is the call graph for this function:

◆ createJS()

ilPCParagraphGUI::createJS ( )

Create paragraph per JS.

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

796 {
797 global $ilUser, $ilCtrl;
798
799 $this->log->debug("ilPCParagraphGUI, createJS(): start");
800
801 $this->content_obj = new ilPCParagraph($this->getPage());
802 $this->updated = $this->content_obj->saveJS($this->pg_obj,
803 $_POST["ajaxform_content"],
804 ilUtil::stripSlashes($_POST["ajaxform_char"]),
805 ilUtil::stripSlashes($_POST["pc_id_str"]),
806 $_POST["insert_at_id"]);
807 if ($_POST["quick_save"])
808 {
809 if ($this->updated)
810 {
811 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
812 echo $a_pc_id_str;
813 $this->log->debug("ilPCParagraphGUI, createJS(): echo pc id and exit: ".$a_pc_id_str);
814 exit;
815 }
816 }
817
818 if ($this->updated !== true && is_array($this->updated))
819 {
820 $this->outputError($this->updated);
821 }
822
823 // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
824 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
825 $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
826 urlencode($a_pc_id_str));
827 $this->log->debug("ilPCParagraphGUI, createJS(): return to edit cmd of ".$ilCtrl->getReturnClass($this));
828
829 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
830 }
outputError($a_err)
Output error.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

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

Referenced by create().

+ 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

return

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

276 {
277 // language and characteristic selection
278 if (!$a_insert)
279 {
280 if (key($_POST["cmd"]) == "update")
281 {
282 $s_char = $_POST["par_characteristic"];
283 }
284 else
285 {
286 $s_char = $this->content_obj->getCharacteristic();
287 if ($s_char == "")
288 {
289 $s_char = "Standard";
290 }
291 }
292 }
293 else
294 {
295 if (key($_POST["cmd"]) == "create_par")
296 {
297 $s_char = $_POST["par_characteristic"];
298 }
299 else
300 {
301 $s_char = "Standard";
302
303 // set characteristic of new paragraphs in list items to "List"
304 $cont_obj = $this->pg_obj->getContentObject($this->getHierId());
305 if (is_object($cont_obj))
306 {
307 if ($cont_obj->getType() == "li" ||
308 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List"))
309 {
310 $s_char = "List";
311 }
312
313 if ($cont_obj->getType() == "td" ||
314 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent"))
315 {
316 $s_char = "TableContent";
317 }
318
319 }
320 }
321 }
322 return $s_char;
323 }
getHierId()
get hierarchical id in dom object

References $_POST, and ilPageContentGUI\getHierId().

Referenced by edit(), and editJS().

+ 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 146 of file class.ilPCParagraphGUI.php.

147 {
148 global $ilUser;
149
150 // add paragraph edit template
151 $tpl = new ilTemplate("tpl.paragraph_edit.html", true, true, "Services/COPage");
152
153 // help text
154 $this->insertHelp($tpl);
155
156 // operations
157 if ($a_insert)
158 {
159 $tpl->setCurrentBlock("commands");
160 $tpl->setVariable("BTN_NAME", "create_par");
161 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
162 $tpl->setVariable("BTN_CANCEL", "cancelCreate");
163 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
164 $tpl->parseCurrentBlock();
165 /*$tpl->setCurrentBlock("commands2");
166 $tpl->setVariable("BTN_NAME", "create_par");
167 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
168 $tpl->setVariable("BTN_CANCEL", "cancelCreate");
169 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
170 $tpl->parseCurrentBlock();*/
171 $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
172 }
173 else
174 {
175 $tpl->setCurrentBlock("commands");
176 $tpl->setVariable("BTN_NAME", "update");
177 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
178 $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
179 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
180 $tpl->parseCurrentBlock();
181 /*$tpl->setCurrentBlock("commands2");
182 $tpl->setVariable("BTN_NAME", "update");
183 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
184 $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
185 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
186 $tpl->parseCurrentBlock();*/
187 $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
188 }
189
190 // language and characteristic selection
191 $s_char = $this->determineCharacteristic($a_insert);
192 if (!$a_insert)
193 {
194 if (key($_POST["cmd"]) == "update")
195 {
196 $s_lang = $_POST["par_language"];
197 }
198 else
199 {
200 $s_lang = $this->content_obj->getLanguage();
201 }
202 }
203 else
204 {
205 if (key($_POST["cmd"]) == "create_par")
206 {
207 $s_lang = $_POST["par_language"];
208 }
209 else
210 {
211 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
212 {
213 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
214 }
215 else
216 {
217 $s_lang = $ilUser->getLanguage();
218 }
219 }
220 }
221
222 $this->insertStyleSelectionList($tpl, $s_char);
223// $this->insertCharacteristicTable($tpl, $s_char);
224
225
226 $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
227
228 $tpl->setVariable("PAR_TA_NAME", "par_content");
229 $tpl->setVariable("BB_MENU", $this->getBBMenu());
230 $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
231 $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
232 $this->setStyle();
233
234 $this->displayValidationError();
235
236 $tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
237 $tpl->setVariable("TXT_ANCHOR", $this->lng->txt("cont_anchor"));
238
239 require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
241 $select_lang = ilUtil::formSelect ($s_lang,"par_language",$lang,false,true);
242 $tpl->setVariable("SELECT_LANGUAGE", $select_lang);
243
244 $tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
245// $select_char = ilUtil::formSelect ($s_char,
246// "par_characteristic",$this->chars,false,true);
247// $tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
248
249 if (key($_POST["cmd"]) == "update" || key($_POST["cmd"]) == "create_par")
250 {
251 $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
252 // prevent curly brackets from being swallowed up by template engine
253 $s_text = str_replace("{", "{", $s_text);
254 $s_text = str_replace("}", "}", $s_text);
255 }
256 else if (!$a_insert)
257 {
258 $s_text = $this->content_obj->xml2output($this->content_obj->getText());
259 }
260
261 $tpl->setVariable("PAR_TA_CONTENT", $s_text);
262
263 $tpl->parseCurrentBlock();
264
265 $this->tpl->setContent($tpl->get());
266 return $tpl->get();
267 }
$_GET["client_id"]
determineCharacteristic($a_insert=false)
Determine current characteristic.
insertHelp($a_tpl)
Insert Help.
insertStyleSelectionList($a_tpl, $a_selected)
Insert style selection list.
displayValidationError()
display validation errors
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
special template class to simplify handling of ITX/PEAR
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.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349

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

Referenced by insert(), and update().

+ 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 328 of file class.ilPCParagraphGUI.php.

329 {
330 $s_text = $this->content_obj->getText();
331 $this->log->debug("step 1: ".substr($s_text, 0, 1000));
332
333//echo "\n<br><br>".htmlentities($s_text);
334 $s_text = $this->content_obj->xml2output($s_text, true, false);
335 $this->log->debug("step 2: ".substr($s_text, 0, 1000));
336
337//echo "\n<br><br>".htmlentities($s_text);
338 $char = $this->determineCharacteristic(false);
339 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
340 $this->log->debug("step 3: ".substr($s_text, 0, 1000));
341
342//echo "\n<br><br>".htmlentities($s_text);
343 $ids = "###".$this->content_obj->readHierId().":".$this->content_obj->readPCId()."###".
344 $char."###";
345 echo $ids.$s_text;
346 $this->log->debug("step 4: ".substr($ids.$s_text, 0, 1000));
347 exit;
348 }
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.

References determineCharacteristic(), exit, and xml2outputJS().

+ 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 353 of file class.ilPCParagraphGUI.php.

354 {
355 global $ilUser, $ilias;
356
357 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
358 exit;
359 }

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

◆ executeCommand()

ilPCParagraphGUI::executeCommand ( )

execute command

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

121 {
122 // get next class that processes or forwards current command
123 $next_class = $this->ctrl->getNextClass($this);
124
126 array("text_block", "heading1", "heading2", "heading3")); // scorm-2004
127
128 // get current command
129 $cmd = $this->ctrl->getCmd();
130
131 $this->log->debug("ilPCParagraphGUI: executeCommand ".$cmd);
132
133 switch($next_class)
134 {
135 default:
136 $ret = $this->$cmd();
137 break;
138 }
139
140 return $ret;
141 }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ getCharStyleSelector()

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

Get character style selector.

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

602 {
603 global $lng;
604
605 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
606 $selection = new ilAdvancedSelectionListGUI();
607 $selection->setPullRight(false);
608 $selection->setFormSelectMode("char_characteristic", "", false,
609 "", "", "",
610 "", "", "", "");
611 $selection->setId("char_style_selection");
612 $selection->setSelectionHeaderClass("ilEditSubmit");
613 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
614 //$selection->setSelectedValue($a_selected);
615 $selection->setUseImages(false);
616 $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP);
617 if ($a_use_callback)
618 {
619 $selection->setSelectCallback("ilCOPage.setCharacterClass");
620 }
621
622 //$chars = $a_chars;
623 //$title_char = ($chars[$a_selected] != "")
624 // ? $chars[$a_selected]
625 // : $a_selected;
626 $selection->setListTitle("&nbsp;<i>A</i>");
627
628 /*if ($chars[$a_seleted] == "" && ($a_seleted != ""))
629 {
630 $chars = array_merge(array($a_seleted => $a_seleted),
631 $chars);
632 }*/
633
634 $chars = array(
635 "Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")),
636 "Quotation" => array("code" => "quot", "txt" =>$lng->txt("cont_char_style_quot")),
637 "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")),
638 "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))
639 );
640
641 if ($a_style_id > 0 )
642 {
643 foreach (ilPCParagraphGUI::_getTextCharacteristics($a_style_id) as $c)
644 {
645 if (!isset($chars[$c]))
646 {
647 $chars[$c] = array("code" => "", "txt" => $c);
648 }
649 }
650 }
651
652 foreach ($chars as $key => $char)
653 {
655 $a_par_type, "active_".$char["code"], true))
656 {
657 $t = "text_inline";
658 $tag = "span";
659 switch($key)
660 {
661 case "Code": $tag = "code"; break;
662 }
663 $html = '<'.$tag.' class="ilc_'.$t.'_'.$key.'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">'.$char["txt"]."</".$tag.">";
664
665 // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the
666 // advanced selection list. But it is impossible to prevent the tr-event from removing the focus
667 // on tiny withouth the following line, that receives the click event before and stops the faulty default
668 // bevaviour of IE, see bug report #8723
669 $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">'.$html."</a>";
670 $selection->addItem($char["txt"], $key, "",
671 "", $key, "", $html);
672 }
673 }
674 return $selection->getHTML();
675 }
User interface class for advanced drop-down selection lists.
static _getTextCharacteristics($a_style_id, $a_include_core=false)
Get text characteristics.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
$html
Definition: example_001.php:87

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

Referenced by ilPageContentGUI\getBBMenu(), and ilPageObjectGUI\getTinyMenu().

+ 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 550 of file class.ilPCParagraphGUI.php.

551 {
552 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
553 $selection = new ilAdvancedSelectionListGUI();
554 $selection->setPullRight(false);
555 $selection->setFormSelectMode("par_characteristic", "", false,
556 "", "", "",
557 "", "", "", "");
558 $selection->setId("style_selection");
559 $selection->setSelectionHeaderClass("ilEditSubmit ilTinyMenuDropDown");
560 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
561 $selection->setSelectedValue($a_selected);
562 $selection->setUseImages(false);
564 if ($a_use_callback)
565 {
566 $selection->setSelectCallback("ilCOPage.setParagraphClass");
567 }
568
569 $chars = $a_chars;
570 $title_char = ($chars[$a_selected] != "")
571 ? $chars[$a_selected]
572 : $a_selected;
573 $selection->setListTitle($title_char);
574
575 if ($chars[$a_seleted] == "" && ($a_seleted != ""))
576 {
577 $chars = array_merge(array($a_seleted => $a_seleted),
578 $chars);
579 }
580
581 foreach ($chars as $char => $char_lang)
582 {
583 $t = "text_block";
584 $tag = "div";
585 switch($char)
586 {
587 case "Headline1": $t = "heading1"; $tag = "h1"; break;
588 case "Headline2": $t = "heading2"; $tag = "h2"; break;
589 case "Headline3": $t = "heading3"; $tag = "h3"; break;
590 }
591 $html = '<div class="ilCOPgEditStyleSelectionItem"><'.$tag.' class="ilc_'.$t.'_'.$char.'" style="'.self::$style_selector_reset.'">'.$char_lang."</".$tag."></div>";
592 $selection->addItem($char_lang, $char, "",
593 "", $char, "", $html);
594 }
595 return $selection->getHTML();
596 }

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

Referenced by ilPageObjectGUI\getTinyMenu().

+ Here is the caller graph for this function:

◆ insert()

ilPCParagraphGUI::insert ( )

insert paragraph form

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

710 {
711 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value ".$this->updated);
712 return $this->edit(true);
713 }
edit($a_insert=false)
edit paragraph form

References edit().

Referenced by create().

+ 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 502 of file class.ilPCParagraphGUI.php.

503 {
504 $i = 0;
505
506 $chars = $this->getCharacteristics();
507
508 if ($chars[$a_seleted_value] == "" && ($a_seleted_value != ""))
509 {
510 $chars = array_merge(array($a_seleted_value => $a_seleted_value),
511 $chars);
512 }
513
514 foreach ($chars as $char => $char_lang)
515 {
516 $a_tpl->setCurrentBlock("characteristic_cell");
517 $a_tpl->setVariable("CHAR_HTML",
518 '<div class="ilc_text_block_'.$char.'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang."</div>");
519 $a_tpl->setVariable("CHAR_VALUE", $char);
520 if ($char == $a_seleted_value)
521 {
522 $a_tpl->setVariable("SELECTED",
523 ' checked="checked" ');
524 }
525 $a_tpl->parseCurrentBlock();
526 if ((($i+1) % 3) == 0) //
527 {
528 $a_tpl->touchBlock("characteristic_row");
529 }
530 $i++;
531 }
532 $a_tpl->touchBlock("characteristic_table");
533 }
getCharacteristics()
Get characteristics.

References ilPageContentGUI\getCharacteristics().

+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

836 {
837 global $lng;
838
839 $a_tpl->setCurrentBlock("help_item");
840 $a_tpl->setVariable("TXT_HELP", "<b>".$lng->txt("cont_syntax_help")."</b>");
841 $a_tpl->parseCurrentBlock();
842 $a_tpl->setCurrentBlock("help_item");
843 $a_tpl->setVariable("TXT_HELP", "* ".$lng->txt("cont_bullet_list"));
844 $a_tpl->parseCurrentBlock();
845 $a_tpl->setCurrentBlock("help_item");
846 $a_tpl->setVariable("TXT_HELP", "# ".$lng->txt("cont_numbered_list"));
847 $a_tpl->parseCurrentBlock();
848 $a_tpl->setCurrentBlock("help_item");
849 $a_tpl->setVariable("TXT_HELP", "=".$lng->txt("cont_Headline1")."=<br />".
850 "==".$lng->txt("cont_Headline2")."==<br />".
851 "===".$lng->txt("cont_Headline3")."===");
852 $a_tpl->parseCurrentBlock();
853
854 if ($this->getPageConfig()->getEnableWikiLinks())
855 {
856 $a_tpl->setCurrentBlock("help_item");
857 $a_tpl->setVariable("TXT_HELP", "[[".$lng->txt("cont_wiki_page_link")."]]");
858 $a_tpl->parseCurrentBlock();
859 }
860
861 $a_tpl->setCurrentBlock("help");
862 $a_tpl->parseCurrentBlock();
863 }
getPageConfig()
Get Page Config.

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

Referenced by edit().

+ 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 541 of file class.ilPCParagraphGUI.php.

542 {
543 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector($a_selected,
544 $this->getCharacteristics()));
545 }

References ilPageContentGUI\getCharacteristics().

Referenced by edit().

+ 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 477 of file class.ilPCParagraphGUI.php.

478 {
479 $err_str = "";
480 foreach ($a_err as $err)
481 {
482 $err_str.= $err[1]."<br />";
483 }
484 echo $err_str;
485 $this->log->debug("ilPCParagraphGUI, outputError() and exit: ".substr($err_str, 0, 100));
486 exit;
487 }

References exit.

Referenced by createJS(), and saveJS().

+ Here is the caller graph for this function:

◆ saveJS()

ilPCParagraphGUI::saveJS ( )

Save paragraph by JS call.

Parameters

return

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

436 {
437 global $ilCtrl;
438
439 $this->log->debug("start");
440
441 $this->updated = $this->content_obj->saveJS($this->pg_obj,
442 $_POST["ajaxform_content"],
443 ilUtil::stripSlashes($_POST["ajaxform_char"]),
444 ilUtil::stripSlashes($_POST["pc_id_str"]));
445
446 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value ".$this->updated);
447
448 if ($_POST["quick_save"])
449 {
450 if ($this->updated === true)
451 {
452 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
453 $this->log->debug("ilPCParagraphGUI, saveJS: echoing pc_id_str ".$a_pc_id_str." (and exit)");
454 echo $a_pc_id_str;
455 exit;
456 }
457 }
458
459 if ($this->updated !== true && is_array($this->updated))
460 {
461 $this->outputError($this->updated);
462 }
463
464 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
465
466 $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
467 urlencode($a_pc_id_str));
468 $this->log->debug("ilPCParagraphGUI, saveJS: redirecting to edit command of ".$ilCtrl->getReturnClass($this).".");
469 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
470 }

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

+ Here is the call graph for this function:

◆ setStyle()

ilPCParagraphGUI::setStyle ( )
private

Set Style.

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

681 {
682 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
683
684 if ($this->pg_obj->getParentType() == "gdf" ||
685 $this->pg_obj->getParentType() == "lm")
686 {
687 if ($this->pg_obj->getParentType() != "gdf")
688 {
689 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
690 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
691 }
692 else
693 {
694 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
695 }
696 }
697 else
698 {
699 if ($this->pg_obj->getParentType() != "sahs")
700 {
701// $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
702 }
703 }
704 }
static _lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
static getContentStylePath($a_style_id)
get content style path

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

Referenced by edit().

+ 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 718 of file class.ilPCParagraphGUI.php.

719 {
720 $this->log->debug("ilPCParagraphGUI, update(): start");
721
722 // set language and characteristic
723 $this->content_obj->setLanguage($_POST["par_language"]);
724 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
725
726 $this->updated = $this->content_obj->setText(
727 $this->content_obj->input2xml($_POST["par_content"],
728 $_POST["usedwsiwygeditor"]), true);
729 if ($this->updated !== true)
730 {
731 $this->edit();
732 return;
733 }
734
735 $this->updated = $this->content_obj->updatePage($this->pg_obj);
736
737
738 if ($this->updated === true)
739 {
740 $this->log->debug("ilPCParagraphGUI, update(): return to parent: jump".$this->hier_id);
741 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
742 }
743 else
744 {
745 $this->log->debug("ilPCParagraphGUI, update(): call edit.");
746 $this->edit();
747 }
748 }

References $_POST, and edit().

+ 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 364 of file class.ilPCParagraphGUI.php.

365 {
366// $s_text = "<div class='ilc_text_block_".$char."' id='$a_pc_id'>".$s_text."</div>";
367 $s_text = $s_text;
368 // lists
369 $s_text = str_replace(array("<SimpleBulletList>", "</SimpleBulletList>"),
370 array("<ul class='ilc_list_u_BulletedList'>", "</ul>"),
371 $s_text);
372 $s_text = str_replace(array("<SimpleNumberedList>", "</SimpleNumberedList>"),
373 array("<ol class='ilc_list_o_NumberedList'>", "</ol>"), $s_text);
374 $s_text = str_replace(array("<SimpleListItem>", "</SimpleListItem>"),
375 array("<li class='ilc_list_item_StandardListItem'>", "</li>"), $s_text);
376 $s_text = str_replace(array("<SimpleListItem/>"),
377 array("<li class='ilc_list_item_StandardListItem'></li>"), $s_text);
378 //$s_text = str_replace("<SimpleBulletList><br />", "<SimpleBulletList>", $s_text);
379 //$s_text = str_replace("<SimpleNumberedList><br />", "<SimpleNumberedList>", $s_text);
380 //$s_text = str_replace("</SimpleListItem><br />", "</SimpleListItem>", $s_text);
381
382
383 // spans
384 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
385 foreach (ilPageContentGUI::_getCommonBBButtons() as $bb => $cl)
386 {
387 if (!in_array($bb, array("code", "tex", "fn", "xln", "sub", "sup")))
388 {
389 $s_text = str_replace("[".$bb."]",
390 '<span class="ilc_text_inline_'.$cl.'">', $s_text);
391 $s_text = str_replace("[/".$bb."]",
392 '</span>', $s_text);
393 }
394 }
395
396 // marked text spans
397 $ws= "[ \t\r\f\v\n]*";
398 while (preg_match("~\[(marked$ws(class$ws=$ws\"([^\"])*\")$ws)\]~i", $s_text, $found))
399 {
400 $attribs = ilUtil::attribsToArray($found[2]);
401 if (isset($attribs["class"]))
402 {
403 $s_text = str_replace("[".$found[1]."]", "<span class=\"ilc_text_inline_".$attribs["class"]."\">", $s_text);
404 }
405 else
406 {
407 $s_text = str_replace("[".$found[1]."]", "[error:marked".$found[1]."]",$s_text);
408 }
409 }
410 $s_text = preg_replace('~\[\/marked\]~i',"</span>",$s_text);
411
412
413 // code
414 $s_text = str_replace(array("[code]", "[/code]"),
415 array("<code>", "</code>"), $s_text);
416
417 // sup
418 $s_text = str_replace(array("[sup]", "[/sup]"),
419 array('<sup class="ilc_sup_Sup">', "</sup>"), $s_text);
420
421 // sub
422 $s_text = str_replace(array("[sub]", "[/sub]"),
423 array('<sub class="ilc_sub_Sub">', "</sub>"), $s_text);
424
425 return $s_text;
426 }
static _getCommonBBButtons()
Get common bb buttons.
static attribsToArray($a_str)
converts a string of format var1 = "val1" var2 = "val2" ... into an array

References ilPageContentGUI\_getCommonBBButtons(), and ilUtil\attribsToArray().

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

+ 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: