ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 _getStandardTextCharacteristics ()
 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...
 

Protected Attributes

 $user
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Private Member Functions

 setStyle ()
 Set Style. More...
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

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

29 {
30 global $DIC;
31
32 $this->user = $DIC->user();
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
36
37 // characteristics (should be flexible in the future)
39 }
user()
Definition: user.php:4
static _getStandardCharacteristics()
Get standard characteristics.
setCharacteristics($a_chars)
Set Characteristics.
global $DIC
Definition: saml.php:7

References $DIC, _getStandardCharacteristics(), ilPageContentGUI\setCharacteristics(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getCharacteristics()

static ilPCParagraphGUI::_getCharacteristics (   $a_style_id)
static

Get characteristics.

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

89 {
92
93 if ($a_style_id > 0 &&
94 ilObject::_lookupType($a_style_id) == "sty") {
95 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
96 $style = new ilObjStyleSheet($a_style_id);
97 $types = array("text_block", "heading1", "heading2", "heading3");
98 $chars = array();
99 foreach ($types as $t) {
100 $chars = array_merge($chars, $style->getCharacteristics($t));
101 }
102 $new_chars = array();
103 foreach ($chars as $char) {
104 if ($st_chars[$char] != "") { // keep lang vars for standard chars
105 $new_chars[$char] = $st_chars[$char];
106 } else {
107 $new_chars[$char] = $char;
108 }
109 asort($new_chars);
110 }
111 $chars = $new_chars;
112 }
113
114 return $chars;
115 }
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 44 of file class.ilPCParagraphGUI.php.

45 {
46 global $DIC;
47
48 $lng = $DIC->language();
49
50 return array("Standard" => $lng->txt("cont_standard"),
51 "Headline1" => $lng->txt("cont_Headline1"),
52 "Headline2" => $lng->txt("cont_Headline2"),
53 "Headline3" => $lng->txt("cont_Headline3"),
54 "Citation" => $lng->txt("cont_Citation"),
55 "Mnemonic" => $lng->txt("cont_Mnemonic"),
56 "Example" => $lng->txt("cont_Example"),
57 "Additional" => $lng->txt("cont_Additional"),
58 "Attention" => $lng->txt("cont_Attention"),
59 "Confirmation" => $lng->txt("cont_Confirmation"),
60 "Information" => $lng->txt("cont_Information"),
61 "Link" => $lng->txt("cont_Link"),
62 "Literature" => $lng->txt("cont_Literature"),
63 "Separator" => $lng->txt("cont_Separator"),
64 "StandardCenter" => $lng->txt("cont_StandardCenter"),
65 "Remark" => $lng->txt("cont_Remark"),
66 "List" => $lng->txt("cont_List"),
67 "TableContent" => $lng->txt("cont_TableContent")
68 );
69 }

References $DIC, and ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

+ Here is the caller graph for this function:

◆ _getStandardTextCharacteristics()

static ilPCParagraphGUI::_getStandardTextCharacteristics ( )
static

Get standard characteristics.

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

75 {
76 global $DIC;
77
78 $lng = $DIC->language();
79 return ["Mnemonic", "Attention"];
80 return array("Mnemonic" => $lng->txt("cont_Mnemonic"),
81 "Attention" => $lng->txt("cont_Attention")
82 );
83 }

References $DIC, and ilPageContentGUI\$lng.

Referenced by _getTextCharacteristics().

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

125 {
126 $chars = array();
127
128 if ($a_style_id > 0 &&
129 ilObject::_lookupType($a_style_id) == "sty") {
130 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
131 $style = new ilObjStyleSheet($a_style_id);
132 $types = array("text_inline");
133 foreach ($types as $t) {
134 $chars = array_merge($chars, $style->getCharacteristics($t, false, $a_include_core));
135 }
136 } else {
138 }
139
140 return $chars;
141 }
static _getStandardTextCharacteristics()
Get standard characteristics.

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

Referenced by ilPCDataTableGUI\editData(), 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 507 of file class.ilPCParagraphGUI.php.

508 {
509 $this->log->debug("ilPCParagraphGUI, cancel(): return to parent: jump" . $this->hier_id);
510 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
511 }

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

795 {
796 $this->log->debug("ilPCParagraphGUI, create(): start.");
797
798 if ($_POST["ajaxform_hier_id"] != "") {
799 return $this->createJS();
800 }
801
802 $this->content_obj = new ilPCParagraph($this->getPage());
803 //echo "+".$this->pc_id."+";
804 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
805
806 $this->content_obj->setLanguage($_POST["par_language"]);
807 $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["par_language"];
808 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
809
810 $this->updated = $this->content_obj->setText(
811 $this->content_obj->input2xml(
812 $_POST["par_content"],
813 $_POST["usedwsiwygeditor"]
814 ),
815 true
816 );
817
818 if ($this->updated !== true) {
819 $this->insert();
820 return;
821 }
822 $this->updated = $this->content_obj->updatePage($this->pg_obj);
823
824 if ($this->updated === true) {
825 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
826 } else {
827 $this->insert();
828 }
829 }
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
insert()
insert paragraph form
createJS()
Create paragraph per JS.
Class ilPCParagraph.

References $_GET, $_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 834 of file class.ilPCParagraphGUI.php.

835 {
838
839 $this->log->debug("ilPCParagraphGUI, createJS(): start");
840
841 $this->content_obj = new ilPCParagraph($this->getPage());
842 $this->updated = $this->content_obj->saveJS(
843 $this->pg_obj,
844 $_POST["ajaxform_content"],
845 ilUtil::stripSlashes($_POST["ajaxform_char"]),
846 ilUtil::stripSlashes($_POST["pc_id_str"]),
847 $_POST["insert_at_id"]
848 );
849 if ($_POST["quick_save"]) {
850 if ($this->updated) {
851 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
852 echo $a_pc_id_str;
853 $this->log->debug("ilPCParagraphGUI, createJS(): echo pc id and exit: " . $a_pc_id_str);
854 exit;
855 }
856 }
857
858 if ($this->updated !== true && is_array($this->updated)) {
859 $this->outputError($this->updated);
860 }
861
862 // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
863 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
864 $ilCtrl->setParameterByClass(
865 $ilCtrl->getReturnClass($this),
866 "updated_pc_id_str",
867 urlencode($a_pc_id_str)
868 );
869 $this->log->debug("ilPCParagraphGUI, createJS(): return to edit cmd of " . $ilCtrl->getReturnClass($this));
870
871 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
872 }
exit
Definition: backend.php:16
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, ilPageContentGUI\$ctrl, $ilCtrl, $ilUser, $user, 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 284 of file class.ilPCParagraphGUI.php.

285 {
286 // language and characteristic selection
287 if (!$a_insert) {
288 if (key($_POST["cmd"]) == "update") {
289 $s_char = $_POST["par_characteristic"];
290 } else {
291 $s_char = $this->content_obj->getCharacteristic();
292 if ($s_char == "") {
293 $s_char = "Standard";
294 }
295 }
296 } else {
297 if (key($_POST["cmd"]) == "create_par") {
298 $s_char = $_POST["par_characteristic"];
299 } else {
300 $s_char = "Standard";
301
302 // set characteristic of new paragraphs in list items to "List"
303 $cont_obj = $this->pg_obj->getContentObject($this->getHierId());
304 if (is_object($cont_obj)) {
305 if ($cont_obj->getType() == "li" ||
306 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List")) {
307 $s_char = "List";
308 }
309
310 if ($cont_obj->getType() == "td" ||
311 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent")) {
312 $s_char = "TableContent";
313 }
314 }
315 }
316 }
317 return $s_char;
318 }
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 173 of file class.ilPCParagraphGUI.php.

174 {
176
177 // add paragraph edit template
178 $tpl = new ilTemplate("tpl.paragraph_edit.html", true, true, "Services/COPage");
179
180 // help text
181 $this->insertHelp($tpl);
182
183 // operations
184 if ($a_insert) {
185 $tpl->setCurrentBlock("commands");
186 $tpl->setVariable("BTN_NAME", "create_par");
187 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
188 $tpl->setVariable("BTN_CANCEL", "cancelCreate");
189 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
190 $tpl->parseCurrentBlock();
191 /*$tpl->setCurrentBlock("commands2");
192 $tpl->setVariable("BTN_NAME", "create_par");
193 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
194 $tpl->setVariable("BTN_CANCEL", "cancelCreate");
195 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
196 $tpl->parseCurrentBlock();*/
197 $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_insert_par"));
198 } else {
199 $tpl->setCurrentBlock("commands");
200 $tpl->setVariable("BTN_NAME", "update");
201 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
202 $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
203 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
204 $tpl->parseCurrentBlock();
205 /*$tpl->setCurrentBlock("commands2");
206 $tpl->setVariable("BTN_NAME", "update");
207 $tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
208 $tpl->setVariable("BTN_CANCEL", "cancelUpdate");
209 $tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
210 $tpl->parseCurrentBlock();*/
211 $tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_par"));
212 }
213
214 // language and characteristic selection
215 $s_char = $this->determineCharacteristic($a_insert);
216 if (!$a_insert) {
217 if (key($_POST["cmd"]) == "update") {
218 $s_lang = $_POST["par_language"];
219 } else {
220 $s_lang = $this->content_obj->getLanguage();
221 }
222 } else {
223 if (key($_POST["cmd"]) == "create_par") {
224 $s_lang = $_POST["par_language"];
225 } else {
226 if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
227 $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
228 } else {
229 $s_lang = $ilUser->getLanguage();
230 }
231 }
232 }
233
234 $this->insertStyleSelectionList($tpl, $s_char);
235 // $this->insertCharacteristicTable($tpl, $s_char);
236
237
238 $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
239
240 $tpl->setVariable("PAR_TA_NAME", "par_content");
241 $tpl->setVariable("BB_MENU", $this->getBBMenu());
242 $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
243 $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
244 $this->setStyle();
245
246 $this->displayValidationError();
247
248 $tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
249 $tpl->setVariable("TXT_ANCHOR", $this->lng->txt("cont_anchor"));
250
251 require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
253 $select_lang = ilUtil::formSelect($s_lang, "par_language", $lang, false, true);
254 $tpl->setVariable("SELECT_LANGUAGE", $select_lang);
255
256 $tpl->setVariable("TXT_CHARACTERISTIC", $this->lng->txt("cont_characteristic"));
257 // $select_char = ilUtil::formSelect ($s_char,
258 // "par_characteristic",$this->chars,false,true);
259 // $tpl->setVariable("SELECT_CHARACTERISTIC", $select_char);
260
261 if (key($_POST["cmd"]) == "update" || key($_POST["cmd"]) == "create_par") {
262 $s_text = ilUtil::stripSlashes($_POST["par_content"], false);
263 // prevent curly brackets from being swallowed up by template engine
264 $s_text = str_replace("{", "{", $s_text);
265 $s_text = str_replace("}", "}", $s_text);
266 } elseif (!$a_insert) {
267 $s_text = $this->content_obj->xml2output($this->content_obj->getText());
268 }
269
270 $tpl->setVariable("PAR_TA_CONTENT", $s_text);
271
272 $tpl->parseCurrentBlock();
273
274 $this->tpl->setContent($tpl->get());
275 return $tpl->get();
276 }
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, $user, 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 323 of file class.ilPCParagraphGUI.php.

324 {
325 $s_text = $this->content_obj->getText();
326 $this->log->debug("step 1: " . substr($s_text, 0, 1000));
327
328 //echo "\n<br><br>".htmlentities($s_text);
329 $s_text = $this->content_obj->xml2output($s_text, true, false);
330 $this->log->debug("step 2: " . substr($s_text, 0, 1000));
331
332 //echo "\n<br><br>".htmlentities($s_text);
333 $char = $this->determineCharacteristic(false);
334 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
335 $this->log->debug("step 3: " . substr($s_text, 0, 1000));
336
337 //echo "\n<br><br>".htmlentities($s_text);
338 $ids = "###" . $this->content_obj->readHierId() . ":" . $this->content_obj->readPCId() . "###" .
339 $char . "###";
340 echo $ids . $s_text;
341 $this->log->debug("step 4: " . substr($ids . $s_text, 0, 1000));
342 exit;
343 }
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 348 of file class.ilPCParagraphGUI.php.

349 {
350 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
351 exit;
352 }

References exit.

◆ executeCommand()

ilPCParagraphGUI::executeCommand ( )

execute command

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

148 {
149 // get next class that processes or forwards current command
150 $next_class = $this->ctrl->getNextClass($this);
151
153 array("text_block", "heading1", "heading2", "heading3")
154 ); // scorm-2004
155
156 // get current command
157 $cmd = $this->ctrl->getCmd();
158
159 $this->log->debug("ilPCParagraphGUI: executeCommand " . $cmd);
160
161 switch ($next_class) {
162 default:
163 $ret = $this->$cmd();
164 break;
165 }
166
167 return $ret;
168 }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$ret
Definition: parser.php:6

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

634 {
635 global $DIC;
636
637 $lng = $DIC->language();
638
639 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
640 $selection = new ilAdvancedSelectionListGUI();
641 $selection->setPullRight(false);
642 $selection->setFormSelectMode(
643 "char_characteristic",
644 "",
645 false,
646 "",
647 "",
648 "",
649 "",
650 "",
651 "",
652 ""
653 );
654 $selection->setId("char_style_selection");
655 $selection->setSelectionHeaderClass("ilEditSubmit");
656 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
657 //$selection->setSelectedValue($a_selected);
658 $selection->setUseImages(false);
659 $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP);
660 if (is_string($a_use_callback)) {
661 $selection->setSelectCallback($a_use_callback);
662 } elseif ($a_use_callback === true) {
663 $selection->setSelectCallback("ilCOPage.setCharacterClass");
664 }
665
666 //$chars = $a_chars;
667 //$title_char = ($chars[$a_selected] != "")
668 // ? $chars[$a_selected]
669 // : $a_selected;
670 $selection->setListTitle("&nbsp;<i>A</i>");
671
672 /*if ($chars[$a_seleted] == "" && ($a_seleted != ""))
673 {
674 $chars = array_merge(array($a_seleted => $a_seleted),
675 $chars);
676 }*/
677
678 $chars = array(
679 "Comment" => array("code" => "com", "txt" => $lng->txt("cont_char_style_com")),
680 "Quotation" => array("code" => "quot", "txt" => $lng->txt("cont_char_style_quot")),
681 "Accent" => array("code" => "acc", "txt" => $lng->txt("cont_char_style_acc")),
682 "Code" => array("code" => "code", "txt" => $lng->txt("cont_char_style_code"))
683 );
684
685 foreach (ilPCParagraphGUI::_getTextCharacteristics($a_style_id) as $c) {
686 if (!isset($chars[$c])) {
687 $chars[$c] = array("code" => "", "txt" => $c);
688 }
689 }
690
691 foreach ($chars as $key => $char) {
693 $a_par_type,
694 "active_" . $char["code"],
695 true
696 )) {
697 $t = "text_inline";
698 $tag = "span";
699 switch ($key) {
700 case "Code": $tag = "code"; break;
701 }
702 $html = '<' . $tag . ' class="ilc_' . $t . '_' . $key . '" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">' . $char["txt"] . "</" . $tag . ">";
703
704 // this next line is very important for IE. The real onclick event is on the surrounding <tr> of the
705 // advanced selection list. But it is impossible to prevent the tr-event from removing the focus
706 // on tiny withouth the following line, that receives the click event before and stops the faulty default
707 // bevaviour of IE, see bug report #8723
708 $html = '<a class="nostyle" style="display:block;" href="#" onclick="return false;">' . $html . "</a>";
709 $selection->addItem(
710 $char["txt"],
711 $key,
712 "",
713 "",
714 $key,
715 "",
716 $html
717 );
718 }
719 }
720 return $selection->getHTML();
721 }
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.
$key
Definition: croninfo.php:18
$html
Definition: example_001.php:87
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

References $c, $DIC, $html, $key, ilPageContentGUI\$lng, $t, $tag, _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 568 of file class.ilPCParagraphGUI.php.

569 {
570 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
571 $selection = new ilAdvancedSelectionListGUI();
572 $selection->setPullRight(false);
573 $selection->setFormSelectMode(
574 "par_characteristic",
575 "",
576 false,
577 "",
578 "",
579 "",
580 "",
581 "",
582 "",
583 ""
584 );
585 $selection->setId("style_selection");
586 $selection->setSelectionHeaderClass("ilEditSubmit ilTinyMenuDropDown");
587 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
588 $selection->setSelectedValue($a_selected);
589 $selection->setUseImages(false);
591 if ($a_use_callback) {
592 $selection->setSelectCallback("ilCOPage.setParagraphClass");
593 }
594
595 $chars = $a_chars;
596 $title_char = ($chars[$a_selected] != "")
597 ? $chars[$a_selected]
598 : $a_selected;
599 $selection->setListTitle($title_char);
600
601 if ($chars[$a_seleted] == "" && ($a_seleted != "")) {
602 $chars = array_merge(
603 array($a_seleted => $a_seleted),
604 $chars
605 );
606 }
607
608 foreach ($chars as $char => $char_lang) {
609 $t = "text_block";
610 $tag = "div";
611 switch ($char) {
612 case "Headline1": $t = "heading1"; $tag = "h1"; break;
613 case "Headline2": $t = "heading2"; $tag = "h2"; break;
614 case "Headline3": $t = "heading3"; $tag = "h3"; break;
615 }
616 $html = '<div class="ilCOPgEditStyleSelectionItem"><' . $tag . ' class="ilc_' . $t . '_' . $char . '" style="' . self::$style_selector_reset . '">' . $char_lang . "</" . $tag . "></div>";
617 $selection->addItem(
618 $char_lang,
619 $char,
620 "",
621 "",
622 $char,
623 "",
624 $html
625 );
626 }
627 return $selection->getHTML();
628 }

References $html, $t, $tag, 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 749 of file class.ilPCParagraphGUI.php.

750 {
751 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value " . $this->updated);
752 return $this->edit(true);
753 }
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 516 of file class.ilPCParagraphGUI.php.

517 {
518 $i = 0;
519
520 $chars = $this->getCharacteristics();
521
522 if ($chars[$a_seleted_value] == "" && ($a_seleted_value != "")) {
523 $chars = array_merge(
524 array($a_seleted_value => $a_seleted_value),
525 $chars
526 );
527 }
528
529 foreach ($chars as $char => $char_lang) {
530 $a_tpl->setCurrentBlock("characteristic_cell");
531 $a_tpl->setVariable(
532 "CHAR_HTML",
533 '<div class="ilc_text_block_' . $char . '" style="margin-top:2px; margin-bottom:2px; position:static;">' . $char_lang . "</div>"
534 );
535 $a_tpl->setVariable("CHAR_VALUE", $char);
536 if ($char == $a_seleted_value) {
537 $a_tpl->setVariable(
538 "SELECTED",
539 ' checked="checked" '
540 );
541 }
542 $a_tpl->parseCurrentBlock();
543 if ((($i + 1) % 3) == 0) { //
544 $a_tpl->touchBlock("characteristic_row");
545 }
546 $i++;
547 }
548 $a_tpl->touchBlock("characteristic_table");
549 }
getCharacteristics()
Get characteristics.
$i
Definition: disco.tpl.php:19

References $i, and ilPageContentGUI\getCharacteristics().

+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

878 {
880
881 $a_tpl->setCurrentBlock("help_item");
882 $a_tpl->setVariable("TXT_HELP", "<b>" . $lng->txt("cont_syntax_help") . "</b>");
883 $a_tpl->parseCurrentBlock();
884 $a_tpl->setCurrentBlock("help_item");
885 $a_tpl->setVariable("TXT_HELP", "* " . $lng->txt("cont_bullet_list"));
886 $a_tpl->parseCurrentBlock();
887 $a_tpl->setCurrentBlock("help_item");
888 $a_tpl->setVariable("TXT_HELP", "# " . $lng->txt("cont_numbered_list"));
889 $a_tpl->parseCurrentBlock();
890 $a_tpl->setCurrentBlock("help_item");
891 $a_tpl->setVariable("TXT_HELP", "=" . $lng->txt("cont_Headline1") . "=<br />" .
892 "==" . $lng->txt("cont_Headline2") . "==<br />" .
893 "===" . $lng->txt("cont_Headline3") . "===");
894 $a_tpl->parseCurrentBlock();
895
896 if ($this->getPageConfig()->getEnableWikiLinks()) {
897 $a_tpl->setCurrentBlock("help_item");
898 $a_tpl->setVariable("TXT_HELP", "[[" . $lng->txt("cont_wiki_page_link") . "]]");
899 $a_tpl->parseCurrentBlock();
900 }
901
902 $a_tpl->setCurrentBlock("help");
903 $a_tpl->parseCurrentBlock();
904 }
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 557 of file class.ilPCParagraphGUI.php.

558 {
559 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector(
560 $a_selected,
561 $this->getCharacteristics()
562 ));
563 }

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

493 {
494 $err_str = "";
495 foreach ($a_err as $err) {
496 $err_str .= $err[1] . "<br />";
497 }
498 echo $err_str;
499 $this->log->debug("ilPCParagraphGUI, outputError() and exit: " . substr($err_str, 0, 100));
500 exit;
501 }

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

449 {
451
452 $this->log->debug("start");
453
454 $this->updated = $this->content_obj->saveJS(
455 $this->pg_obj,
456 $_POST["ajaxform_content"],
457 ilUtil::stripSlashes($_POST["ajaxform_char"]),
458 ilUtil::stripSlashes($_POST["pc_id_str"])
459 );
460
461 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value " . $this->updated);
462
463 if ($_POST["quick_save"]) {
464 if ($this->updated === true) {
465 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
466 $this->log->debug("ilPCParagraphGUI, saveJS: echoing pc_id_str " . $a_pc_id_str . " (and exit)");
467 echo $a_pc_id_str;
468 exit;
469 }
470 }
471
472 if ($this->updated !== true && is_array($this->updated)) {
473 $this->outputError($this->updated);
474 }
475
476 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
477
478 $ilCtrl->setParameterByClass(
479 $ilCtrl->getReturnClass($this),
480 "updated_pc_id_str",
481 urlencode($a_pc_id_str)
482 );
483 $this->log->debug("ilPCParagraphGUI, saveJS: redirecting to edit command of " . $ilCtrl->getReturnClass($this) . ".");
484 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
485 }

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

+ Here is the call graph for this function:

◆ setStyle()

ilPCParagraphGUI::setStyle ( )
private

Set Style.

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

727 {
728 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
729
730 if ($this->pg_obj->getParentType() == "gdf" ||
731 $this->pg_obj->getParentType() == "lm") {
732 if ($this->pg_obj->getParentType() != "gdf") {
733 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
734 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())
735 ));
736 } else {
737 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
738 }
739 } else {
740 if ($this->pg_obj->getParentType() != "sahs") {
741 // $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
742 }
743 }
744 }
static _lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
static getContentStylePath($a_style_id, $add_random=true)
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 758 of file class.ilPCParagraphGUI.php.

759 {
760 $this->log->debug("ilPCParagraphGUI, update(): start");
761
762 // set language and characteristic
763 $this->content_obj->setLanguage($_POST["par_language"]);
764 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
765
766 $this->updated = $this->content_obj->setText(
767 $this->content_obj->input2xml(
768 $_POST["par_content"],
769 $_POST["usedwsiwygeditor"]
770 ),
771 true
772 );
773 if ($this->updated !== true) {
774 $this->edit();
775 return;
776 }
777
778 $this->updated = $this->content_obj->updatePage($this->pg_obj);
779
780
781 if ($this->updated === true) {
782 $this->log->debug("ilPCParagraphGUI, update(): return to parent: jump" . $this->hier_id);
783 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
784 } else {
785 $this->log->debug("ilPCParagraphGUI, update(): call edit.");
786 $this->edit();
787 }
788 }

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

358 {
359 // $s_text = "<div class='ilc_text_block_".$char."' id='$a_pc_id'>".$s_text."</div>";
360 $s_text = $s_text;
361 // lists
362 $s_text = str_replace(
363 array("<SimpleBulletList>", "</SimpleBulletList>"),
364 array("<ul class='ilc_list_u_BulletedList'>", "</ul>"),
365 $s_text
366 );
367 $s_text = str_replace(
368 array("<SimpleNumberedList>", "</SimpleNumberedList>"),
369 array("<ol class='ilc_list_o_NumberedList'>", "</ol>"),
370 $s_text
371 );
372 $s_text = str_replace(
373 array("<SimpleListItem>", "</SimpleListItem>"),
374 array("<li class='ilc_list_item_StandardListItem'>", "</li>"),
375 $s_text
376 );
377 $s_text = str_replace(
378 array("<SimpleListItem/>"),
379 array("<li class='ilc_list_item_StandardListItem'></li>"),
380 $s_text
381 );
382 //$s_text = str_replace("<SimpleBulletList><br />", "<SimpleBulletList>", $s_text);
383 //$s_text = str_replace("<SimpleNumberedList><br />", "<SimpleNumberedList>", $s_text);
384 //$s_text = str_replace("</SimpleListItem><br />", "</SimpleListItem>", $s_text);
385
386
387 // spans
388 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
389 foreach (ilPageContentGUI::_getCommonBBButtons() as $bb => $cl) {
390 if (!in_array($bb, array("code", "tex", "fn", "xln", "sub", "sup"))) {
391 $s_text = str_replace(
392 "[" . $bb . "]",
393 '<span class="ilc_text_inline_' . $cl . '">',
394 $s_text
395 );
396 $s_text = str_replace(
397 "[/" . $bb . "]",
398 '</span>',
399 $s_text
400 );
401 }
402 }
403
404 // marked text spans
405 $ws = "[ \t\r\f\v\n]*";
406 while (preg_match("~\[(marked$ws(class$ws=$ws\"([^\"])*\")$ws)\]~i", $s_text, $found)) {
407 $attribs = ilUtil::attribsToArray($found[2]);
408 if (isset($attribs["class"])) {
409 $s_text = str_replace("[" . $found[1] . "]", "<span class=\"ilc_text_inline_" . $attribs["class"] . "\">", $s_text);
410 } else {
411 $s_text = str_replace("[" . $found[1] . "]", "[error:marked" . $found[1] . "]", $s_text);
412 }
413 }
414 $s_text = preg_replace('~\[\/marked\]~i', "</span>", $s_text);
415
416
417 // code
418 $s_text = str_replace(
419 array("[code]", "[/code]"),
420 array("<code>", "</code>"),
421 $s_text
422 );
423
424 // sup
425 $s_text = str_replace(
426 array("[sup]", "[/sup]"),
427 array('<sup class="ilc_sup_Sup">', "</sup>"),
428 $s_text
429 );
430
431 // sub
432 $s_text = str_replace(
433 array("[sub]", "[/sub]"),
434 array('<sub class="ilc_sub_Sub">', "</sub>"),
435 $s_text
436 );
437
438 return $s_text;
439 }
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:

Field Documentation

◆ $user

ilPCParagraphGUI::$user
protected

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

Referenced by createJS(), and edit().


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