ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 @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
 ilPageContentGUI ($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 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
 
- 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.

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/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
static _getStandardCharacteristics()
Get standard characteristics.
$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 _getCharacteristics(), and ilPCParagraphGUI().

+ Here is the caller graph for this function:

◆ cancel()

ilPCParagraphGUI::cancel ( )

Cancel.

Reimplemented from ilPageContentGUI.

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

446 {
447 $this->log->debug("ilPCParagraphGUI, cancel(): return to parent: jump".$this->hier_id);
448 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
449 }

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

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 }
$_SESSION["AccountId"]
insert()
insert paragraph form
createJS()
Create paragraph per JS.
Class ilPCParagraph.
$_POST['username']
Definition: cron.php:12

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

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 }
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
exit
Definition: login.php:54
global $ilUser
Definition: imgupload.php:15

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

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 }
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 119 of file class.ilPCParagraphGUI.php.

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("{", "{", $s_text);
227 $s_text = str_replace("}", "}", $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 }
$_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.

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().

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

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 }
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.

References ilPageContentGUI\$ilias, $ilUser, 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 322 of file class.ilPCParagraphGUI.php.

323 {
324 global $ilUser, $ilias;
325
326 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
327 exit;
328 }

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

◆ executeCommand()

& ilPCParagraphGUI::executeCommand ( )

execute command

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

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 }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$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 
)
static

Get character style selector.

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

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 }
User interface class for advanced drop-down selection lists.
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, ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, ilPageEditorSettings\lookupSettingByParentType(), and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_NOP.

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

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);
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 }

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:

◆ ilPCParagraphGUI()

ilPCParagraphGUI::ilPCParagraphGUI (   $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::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
26
27 // characteristics (should be flexible in the future)
29 }
setCharacteristics($a_chars)
Set Characteristics.

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

+ Here is the call graph for this function:

◆ insert()

ilPCParagraphGUI::insert ( )

insert paragraph form

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

651 {
652 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value ".$this->updated);
653 return $this->edit(true);
654 }
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 454 of file class.ilPCParagraphGUI.php.

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 }
getCharacteristics()
Get characteristics.

References ilPageContentGUI\getCharacteristics().

+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

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 }
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 493 of file class.ilPCParagraphGUI.php.

494 {
495 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector($a_selected,
496 $this->getCharacteristics()));
497 }

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

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 }

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

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 }

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

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 }
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
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 659 of file class.ilPCParagraphGUI.php.

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 }

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

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 }
static _getCommonBBButtons()
Get common bb buttons.

References ilPageContentGUI\_getCommonBBButtons().

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: