ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPCParagraphGUI Class Reference

Class ilPCParagraphGUI. More...

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

Public Member Functions

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

Static Public Member Functions

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

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

68 {
71
72 if ($a_style_id > 0 &&
73 ilObject::_lookupType($a_style_id) == "sty") {
74 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
75 $style = new ilObjStyleSheet($a_style_id);
76 $types = array("text_block", "heading1", "heading2", "heading3");
77 $chars = array();
78 foreach ($types as $t) {
79 $chars = array_merge($chars, $style->getCharacteristics($t));
80 }
81 $new_chars = array();
82 foreach ($chars as $char) {
83 if ($st_chars[$char] != "") { // keep lang vars for standard chars
84 $new_chars[$char] = $st_chars[$char];
85 } else {
86 $new_chars[$char] = $char;
87 }
88 asort($new_chars);
89 }
90 $chars = $new_chars;
91 }
92
93 return $chars;
94 }
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 "Remark" => $lng->txt("cont_Remark"),
59 "List" => $lng->txt("cont_List"),
60 "TableContent" => $lng->txt("cont_TableContent")
61 );
62 }

References $DIC, and ilPageContentGUI\$lng.

Referenced by __construct(), and _getCharacteristics().

+ Here is the caller graph for this function:

◆ _getTextCharacteristics()

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

Get text characteristics.

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

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

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

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

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

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

◆ cancel()

ilPCParagraphGUI::cancel ( )

Cancel.

Reimplemented from ilPageContentGUI.

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

485 {
486 $this->log->debug("ilPCParagraphGUI, cancel(): return to parent: jump" . $this->hier_id);
487 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
488 }

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

774 {
775 $this->log->debug("ilPCParagraphGUI, create(): start.");
776
777 if ($_POST["ajaxform_hier_id"] != "") {
778 return $this->createJS();
779 }
780
781 $this->content_obj = new ilPCParagraph($this->getPage());
782 //echo "+".$this->pc_id."+";
783 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
784
785 $this->content_obj->setLanguage($_POST["par_language"]);
786 $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["par_language"];
787 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
788
789 $this->updated = $this->content_obj->setText(
790 $this->content_obj->input2xml(
791 $_POST["par_content"],
792 $_POST["usedwsiwygeditor"]
793 ),
794 true
795 );
796
797 if ($this->updated !== true) {
798 $this->insert();
799 return;
800 }
801 $this->updated = $this->content_obj->updatePage($this->pg_obj);
802
803 if ($this->updated === true) {
804 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
805 } else {
806 $this->insert();
807 }
808 }
$_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 813 of file class.ilPCParagraphGUI.php.

814 {
817
818 $this->log->debug("ilPCParagraphGUI, createJS(): start");
819
820 $this->content_obj = new ilPCParagraph($this->getPage());
821 $this->updated = $this->content_obj->saveJS(
822 $this->pg_obj,
823 $_POST["ajaxform_content"],
824 ilUtil::stripSlashes($_POST["ajaxform_char"]),
825 ilUtil::stripSlashes($_POST["pc_id_str"]),
826 $_POST["insert_at_id"]
827 );
828 if ($_POST["quick_save"]) {
829 if ($this->updated) {
830 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
831 echo $a_pc_id_str;
832 $this->log->debug("ilPCParagraphGUI, createJS(): echo pc id and exit: " . $a_pc_id_str);
833 exit;
834 }
835 }
836
837 if ($this->updated !== true && is_array($this->updated)) {
838 $this->outputError($this->updated);
839 }
840
841 // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
842 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
843 $ilCtrl->setParameterByClass(
844 $ilCtrl->getReturnClass($this),
845 "updated_pc_id_str",
846 urlencode($a_pc_id_str)
847 );
848 $this->log->debug("ilPCParagraphGUI, createJS(): return to edit cmd of " . $ilCtrl->getReturnClass($this));
849
850 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
851 }
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 261 of file class.ilPCParagraphGUI.php.

262 {
263 // language and characteristic selection
264 if (!$a_insert) {
265 if (key($_POST["cmd"]) == "update") {
266 $s_char = $_POST["par_characteristic"];
267 } else {
268 $s_char = $this->content_obj->getCharacteristic();
269 if ($s_char == "") {
270 $s_char = "Standard";
271 }
272 }
273 } else {
274 if (key($_POST["cmd"]) == "create_par") {
275 $s_char = $_POST["par_characteristic"];
276 } else {
277 $s_char = "Standard";
278
279 // set characteristic of new paragraphs in list items to "List"
280 $cont_obj = $this->pg_obj->getContentObject($this->getHierId());
281 if (is_object($cont_obj)) {
282 if ($cont_obj->getType() == "li" ||
283 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "List")) {
284 $s_char = "List";
285 }
286
287 if ($cont_obj->getType() == "td" ||
288 ($cont_obj->getType() == "par" && $cont_obj->getCharacteristic() == "TableContent")) {
289 $s_char = "TableContent";
290 }
291 }
292 }
293 }
294 return $s_char;
295 }
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 150 of file class.ilPCParagraphGUI.php.

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

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

301 {
302 $s_text = $this->content_obj->getText();
303 $this->log->debug("step 1: " . substr($s_text, 0, 1000));
304
305 //echo "\n<br><br>".htmlentities($s_text);
306 $s_text = $this->content_obj->xml2output($s_text, true, false);
307 $this->log->debug("step 2: " . substr($s_text, 0, 1000));
308
309 //echo "\n<br><br>".htmlentities($s_text);
310 $char = $this->determineCharacteristic(false);
311 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
312 $this->log->debug("step 3: " . substr($s_text, 0, 1000));
313
314 //echo "\n<br><br>".htmlentities($s_text);
315 $ids = "###" . $this->content_obj->readHierId() . ":" . $this->content_obj->readPCId() . "###" .
316 $char . "###";
317 echo $ids . $s_text;
318 $this->log->debug("step 4: " . substr($ids . $s_text, 0, 1000));
319 exit;
320 }
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 325 of file class.ilPCParagraphGUI.php.

326 {
327 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
328 exit;
329 }

References exit.

◆ executeCommand()

ilPCParagraphGUI::executeCommand ( )

execute command

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

125 {
126 // get next class that processes or forwards current command
127 $next_class = $this->ctrl->getNextClass($this);
128
130 array("text_block", "heading1", "heading2", "heading3")
131 ); // scorm-2004
132
133 // get current command
134 $cmd = $this->ctrl->getCmd();
135
136 $this->log->debug("ilPCParagraphGUI: executeCommand " . $cmd);
137
138 switch ($next_class) {
139 default:
140 $ret = $this->$cmd();
141 break;
142 }
143
144 return $ret;
145 }
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 610 of file class.ilPCParagraphGUI.php.

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

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

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

729 {
730 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value " . $this->updated);
731 return $this->edit(true);
732 }
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 493 of file class.ilPCParagraphGUI.php.

494 {
495 $i = 0;
496
497 $chars = $this->getCharacteristics();
498
499 if ($chars[$a_seleted_value] == "" && ($a_seleted_value != "")) {
500 $chars = array_merge(
501 array($a_seleted_value => $a_seleted_value),
502 $chars
503 );
504 }
505
506 foreach ($chars as $char => $char_lang) {
507 $a_tpl->setCurrentBlock("characteristic_cell");
508 $a_tpl->setVariable(
509 "CHAR_HTML",
510 '<div class="ilc_text_block_' . $char . '" style="margin-top:2px; margin-bottom:2px; position:static;">' . $char_lang . "</div>"
511 );
512 $a_tpl->setVariable("CHAR_VALUE", $char);
513 if ($char == $a_seleted_value) {
514 $a_tpl->setVariable(
515 "SELECTED",
516 ' checked="checked" '
517 );
518 }
519 $a_tpl->parseCurrentBlock();
520 if ((($i+1) % 3) == 0) { //
521 $a_tpl->touchBlock("characteristic_row");
522 }
523 $i++;
524 }
525 $a_tpl->touchBlock("characteristic_table");
526 }
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 856 of file class.ilPCParagraphGUI.php.

857 {
859
860 $a_tpl->setCurrentBlock("help_item");
861 $a_tpl->setVariable("TXT_HELP", "<b>" . $lng->txt("cont_syntax_help") . "</b>");
862 $a_tpl->parseCurrentBlock();
863 $a_tpl->setCurrentBlock("help_item");
864 $a_tpl->setVariable("TXT_HELP", "* " . $lng->txt("cont_bullet_list"));
865 $a_tpl->parseCurrentBlock();
866 $a_tpl->setCurrentBlock("help_item");
867 $a_tpl->setVariable("TXT_HELP", "# " . $lng->txt("cont_numbered_list"));
868 $a_tpl->parseCurrentBlock();
869 $a_tpl->setCurrentBlock("help_item");
870 $a_tpl->setVariable("TXT_HELP", "=" . $lng->txt("cont_Headline1") . "=<br />" .
871 "==" . $lng->txt("cont_Headline2") . "==<br />" .
872 "===" . $lng->txt("cont_Headline3") . "===");
873 $a_tpl->parseCurrentBlock();
874
875 if ($this->getPageConfig()->getEnableWikiLinks()) {
876 $a_tpl->setCurrentBlock("help_item");
877 $a_tpl->setVariable("TXT_HELP", "[[" . $lng->txt("cont_wiki_page_link") . "]]");
878 $a_tpl->parseCurrentBlock();
879 }
880
881 $a_tpl->setCurrentBlock("help");
882 $a_tpl->parseCurrentBlock();
883 }
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 534 of file class.ilPCParagraphGUI.php.

535 {
536 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector(
537 $a_selected,
538 $this->getCharacteristics()
539 ));
540 }

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

470 {
471 $err_str = "";
472 foreach ($a_err as $err) {
473 $err_str.= $err[1] . "<br />";
474 }
475 echo $err_str;
476 $this->log->debug("ilPCParagraphGUI, outputError() and exit: " . substr($err_str, 0, 100));
477 exit;
478 }

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

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

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

706 {
707 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
708
709 if ($this->pg_obj->getParentType() == "gdf" ||
710 $this->pg_obj->getParentType() == "lm") {
711 if ($this->pg_obj->getParentType() != "gdf") {
712 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(
713 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())
714 ));
715 } else {
716 $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
717 }
718 } else {
719 if ($this->pg_obj->getParentType() != "sahs") {
720 // $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
721 }
722 }
723 }
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 737 of file class.ilPCParagraphGUI.php.

738 {
739 $this->log->debug("ilPCParagraphGUI, update(): start");
740
741 // set language and characteristic
742 $this->content_obj->setLanguage($_POST["par_language"]);
743 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
744
745 $this->updated = $this->content_obj->setText(
746 $this->content_obj->input2xml(
747 $_POST["par_content"],
748 $_POST["usedwsiwygeditor"]
749 ),
750 true
751 );
752 if ($this->updated !== true) {
753 $this->edit();
754 return;
755 }
756
757 $this->updated = $this->content_obj->updatePage($this->pg_obj);
758
759
760 if ($this->updated === true) {
761 $this->log->debug("ilPCParagraphGUI, update(): return to parent: jump" . $this->hier_id);
762 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
763 } else {
764 $this->log->debug("ilPCParagraphGUI, update(): call edit.");
765 $this->edit();
766 }
767 }

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

335 {
336 // $s_text = "<div class='ilc_text_block_".$char."' id='$a_pc_id'>".$s_text."</div>";
337 $s_text = $s_text;
338 // lists
339 $s_text = str_replace(
340 array("<SimpleBulletList>", "</SimpleBulletList>"),
341 array("<ul class='ilc_list_u_BulletedList'>", "</ul>"),
342 $s_text
343 );
344 $s_text = str_replace(
345 array("<SimpleNumberedList>", "</SimpleNumberedList>"),
346 array("<ol class='ilc_list_o_NumberedList'>", "</ol>"),
347 $s_text
348 );
349 $s_text = str_replace(
350 array("<SimpleListItem>", "</SimpleListItem>"),
351 array("<li class='ilc_list_item_StandardListItem'>", "</li>"),
352 $s_text
353 );
354 $s_text = str_replace(
355 array("<SimpleListItem/>"),
356 array("<li class='ilc_list_item_StandardListItem'></li>"),
357 $s_text
358 );
359 //$s_text = str_replace("<SimpleBulletList><br />", "<SimpleBulletList>", $s_text);
360 //$s_text = str_replace("<SimpleNumberedList><br />", "<SimpleNumberedList>", $s_text);
361 //$s_text = str_replace("</SimpleListItem><br />", "</SimpleListItem>", $s_text);
362
363
364 // spans
365 include_once("./Services/COPage/classes/class.ilPageContentGUI.php");
366 foreach (ilPageContentGUI::_getCommonBBButtons() as $bb => $cl) {
367 if (!in_array($bb, array("code", "tex", "fn", "xln", "sub", "sup"))) {
368 $s_text = str_replace(
369 "[" . $bb . "]",
370 '<span class="ilc_text_inline_' . $cl . '">',
371 $s_text
372 );
373 $s_text = str_replace(
374 "[/" . $bb . "]",
375 '</span>',
376 $s_text
377 );
378 }
379 }
380
381 // marked text spans
382 $ws= "[ \t\r\f\v\n]*";
383 while (preg_match("~\[(marked$ws(class$ws=$ws\"([^\"])*\")$ws)\]~i", $s_text, $found)) {
384 $attribs = ilUtil::attribsToArray($found[2]);
385 if (isset($attribs["class"])) {
386 $s_text = str_replace("[" . $found[1] . "]", "<span class=\"ilc_text_inline_" . $attribs["class"] . "\">", $s_text);
387 } else {
388 $s_text = str_replace("[" . $found[1] . "]", "[error:marked" . $found[1] . "]", $s_text);
389 }
390 }
391 $s_text = preg_replace('~\[\/marked\]~i', "</span>", $s_text);
392
393
394 // code
395 $s_text = str_replace(
396 array("[code]", "[/code]"),
397 array("<code>", "</code>"),
398 $s_text
399 );
400
401 // sup
402 $s_text = str_replace(
403 array("[sup]", "[/sup]"),
404 array('<sup class="ilc_sup_Sup">', "</sup>"),
405 $s_text
406 );
407
408 // sub
409 $s_text = str_replace(
410 array("[sub]", "[/sub]"),
411 array('<sub class="ilc_sub_Sub">', "</sub>"),
412 $s_text
413 );
414
415 return $s_text;
416 }
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: