ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
- 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.

References $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 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 685 of file class.ilPCParagraphGUI.php.

686 {
687 if ($_POST["ajaxform_hier_id"] != "")
688 {
689 return $this->createJS();
690 }
691
692 $this->content_obj = new ilPCParagraph($this->getPage());
693//echo "+".$this->pc_id."+";
694 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
695
696 $this->content_obj->setLanguage($_POST["par_language"]);
697 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["par_language"];
698 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
699
700 $this->updated = $this->content_obj->setText(
701 $this->content_obj->input2xml($_POST["par_content"],
702 $_POST["usedwsiwygeditor"]), true);
703
704 if ($this->updated !== true)
705 {
706 $this->insert();
707 return;
708 }
709 $this->updated = $this->content_obj->updatePage($this->pg_obj);
710
711 if ($this->updated === true)
712 {
713 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
714 }
715 else
716 {
717 $this->insert();
718 }
719 }
insert()
insert paragraph form
createJS()
Create paragraph per JS.
Class ilPCParagraph.
$_POST['username']
Definition: cron.php:12
< 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']

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

725 {
726 global $ilUser, $ilCtrl;
727
728 $this->content_obj = new ilPCParagraph($this->getPage());
729 $this->updated = $this->content_obj->saveJS($this->pg_obj,
730 $_POST["ajaxform_content"],
731 ilUtil::stripSlashes($_POST["ajaxform_char"]),
732 ilUtil::stripSlashes($_POST["pc_id_str"]),
733 $_POST["insert_at_id"]);
734 if ($_POST["quick_save"])
735 {
736 if ($this->updated)
737 {
738 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
739 echo $a_pc_id_str;
740 exit;
741 }
742 }
743
744 if ($this->updated !== true && is_array($this->updated))
745 {
746 $this->outputError($this->updated);
747 }
748
749 // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
750 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
751 $ilCtrl->setParameterByClass($ilCtrl->getReturnClass($this), "updated_pc_id_str",
752 urlencode($a_pc_id_str));
753 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
754 }
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 246 of file class.ilPCParagraphGUI.php.

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

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 }
$_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 299 of file class.ilPCParagraphGUI.php.

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

320 {
321 global $ilUser, $ilias;
322
323 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
324 exit;
325 }

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

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

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

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

481 {
482 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
483 $selection = new ilAdvancedSelectionListGUI();
484 $selection->setPullRight(false);
485 $selection->setFormSelectMode("par_characteristic", "", false,
486 "", "", "",
487 "", "", "", "");
488 $selection->setId("style_selection");
489 $selection->setSelectionHeaderClass("ilEditSubmit ilTinyMenuDropDown");
490 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
491 $selection->setSelectedValue($a_selected);
492 $selection->setUseImages(false);
494 if ($a_use_callback)
495 {
496 $selection->setSelectCallback("ilCOPage.setParagraphClass");
497 }
498
499 $chars = $a_chars;
500 $title_char = ($chars[$a_selected] != "")
501 ? $chars[$a_selected]
502 : $a_selected;
503 $selection->setListTitle($title_char);
504
505 if ($chars[$a_seleted] == "" && ($a_seleted != ""))
506 {
507 $chars = array_merge(array($a_seleted => $a_seleted),
508 $chars);
509 }
510
511 foreach ($chars as $char => $char_lang)
512 {
513 $t = "text_block";
514 $tag = "div";
515 switch($char)
516 {
517 case "Headline1": $t = "heading1"; $tag = "h1"; break;
518 case "Headline2": $t = "heading2"; $tag = "h2"; break;
519 case "Headline3": $t = "heading3"; $tag = "h3"; break;
520 }
521 $html = '<div class="ilCOPgEditStyleSelectionItem"><'.$tag.' class="ilc_'.$t.'_'.$char.'" style="'.self::$style_selector_reset.'">'.$char_lang."</".$tag."></div>";
522 $selection->addItem($char_lang, $char, "",
523 "", $char, "", $html);
524 }
525 return $selection->getHTML();
526 }

References $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 628 of file class.ilPCParagraphGUI.php.

629 {
630 return $this->edit(true);
631 }
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 432 of file class.ilPCParagraphGUI.php.

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.

References ilPageContentGUI\getCharacteristics().

+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

760 {
761 global $lng;
762
763 $a_tpl->setCurrentBlock("help_item");
764 $a_tpl->setVariable("TXT_HELP", "<b>".$lng->txt("cont_syntax_help")."</b>");
765 $a_tpl->parseCurrentBlock();
766 $a_tpl->setCurrentBlock("help_item");
767 $a_tpl->setVariable("TXT_HELP", "* ".$lng->txt("cont_bullet_list"));
768 $a_tpl->parseCurrentBlock();
769 $a_tpl->setCurrentBlock("help_item");
770 $a_tpl->setVariable("TXT_HELP", "# ".$lng->txt("cont_numbered_list"));
771 $a_tpl->parseCurrentBlock();
772 $a_tpl->setCurrentBlock("help_item");
773 $a_tpl->setVariable("TXT_HELP", "=".$lng->txt("cont_Headline1")."=<br />".
774 "==".$lng->txt("cont_Headline2")."==<br />".
775 "===".$lng->txt("cont_Headline3")."===");
776 $a_tpl->parseCurrentBlock();
777
778 if ($this->getPageConfig()->getEnableWikiLinks())
779 {
780 $a_tpl->setCurrentBlock("help_item");
781 $a_tpl->setVariable("TXT_HELP", "[[".$lng->txt("cont_wiki_page_link")."]]");
782 $a_tpl->parseCurrentBlock();
783 }
784
785 $a_tpl->setCurrentBlock("help");
786 $a_tpl->parseCurrentBlock();
787 }
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 471 of file class.ilPCParagraphGUI.php.

472 {
473 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector($a_selected,
474 $this->getCharacteristics()));
475 }

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

412 {
413 foreach ($a_err as $err)
414 {
415 echo $err[1]."<br />";
416 }
417 exit;
418 }

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

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 }

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

599 {
600 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
601
602 if ($this->pg_obj->getParentType() == "gdf" ||
603 $this->pg_obj->getParentType() == "lm" ||
604 $this->pg_obj->getParentType() == "dbk")
605 {
606 if ($this->pg_obj->getParentType() != "gdf")
607 {
608 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
609 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())));
610 }
611 else
612 {
613 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
614 }
615 }
616 else
617 {
618 if ($this->pg_obj->getParentType() != "sahs")
619 {
620// $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
621 }
622 }
623 }
_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 636 of file class.ilPCParagraphGUI.php.

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

References $_POST, $ilBench, 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 330 of file class.ilPCParagraphGUI.php.

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.

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: