ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. 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)
 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
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 
- 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.

Reimplemented from ilPageContentGUI.

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: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), _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 79 of file class.ilPCParagraphGUI.php.

80 {
83
84
85 if ($a_style_id > 0 &&
86 ilObject::_lookupType($a_style_id) == "sty") {
87 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
88 $style = new ilObjStyleSheet($a_style_id);
89 $types = array("heading1", "heading2", "heading3", "text_block");
90 $chars = array();
91 foreach ($types as $t) {
92 $chars = array_merge($chars, $style->getCharacteristics($t));
93 }
94 $new_chars = array();
95 foreach ($chars as $char) {
96 if ($st_chars[$char] != "") { // keep lang vars for standard chars
97 $new_chars[$char] = $st_chars[$char];
98 } else {
99 $new_chars[$char] = $char;
100 }
101// asort($new_chars);
102 }
103 $chars = $new_chars;
104 }
105
106 return $chars;
107 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type

References _getStandardCharacteristics(), and ilObject\_lookupType().

Referenced by ILIAS\COPage\Editor\Components\Paragraph\ParagraphStyleSelector\getStyleSelector(), 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 "Book" => $lng->txt("cont_Book"),
55 "Numbers" => $lng->txt("cont_Numbers"),
56 "Verse" => $lng->txt("cont_Verse"),
57 "List" => $lng->txt("cont_List"),
58 "TableContent" => $lng->txt("cont_TableContent")
59 );
60 }

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

66 {
67 global $DIC;
68
69 $lng = $DIC->language();
70 return ["Mnemonic", "Attention"];
71 return array("Mnemonic" => $lng->txt("cont_Mnemonic"),
72 "Attention" => $lng->txt("cont_Attention")
73 );
74 }

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

117 {
118 $chars = array();
119
120 if ($a_style_id > 0 &&
121 ilObject::_lookupType($a_style_id) == "sty") {
122 $style = new ilObjStyleSheet($a_style_id);
123 $types = array("text_inline");
124 foreach ($types as $t) {
125 $chars = array_merge($chars, $style->getCharacteristics($t, false, $a_include_core));
126 }
127 } else {
129 }
130
131 return $chars;
132 }
static _getStandardTextCharacteristics()
Get standard characteristics.

References _getStandardTextCharacteristics(), and ilObject\_lookupType().

Referenced by getCharStyleSelector(), ILIAS\COPage\Editor\Components\Page\PageQueryActionHandler\getConfig(), and ilPageObjectGUI\getTinyMenu().

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

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

◆ create()

ilPCParagraphGUI::create ( )

create new paragraph in dom and update page in db

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

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

824 {
826 $ilCtrl = $this->ctrl;
827
828 $this->log->debug("ilPCParagraphGUI, createJS(): start");
829
830 $this->content_obj = new ilPCParagraph($this->getPage());
831 $this->updated = $this->content_obj->saveJS(
832 $this->pg_obj,
833 $_POST["ajaxform_content"],
834 ilUtil::stripSlashes($_POST["ajaxform_char"]),
835 ilUtil::stripSlashes($_POST["pc_id_str"]),
836 $_POST["insert_at_id"]
837 );
838 if ($_POST["quick_save"]) {
839 if ($this->updated) {
840 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
841 echo $a_pc_id_str;
842 $this->log->debug("ilPCParagraphGUI, createJS(): echo pc id and exit: " . $a_pc_id_str);
843 exit;
844 }
845 }
846
847 if ($this->updated !== true && is_array($this->updated)) {
848 $this->outputError($this->updated);
849 }
850
851 // e.g. e.g. ###3:110dad8bad6df8620071a0a693a2d328###
852 $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, true);
853 $ilCtrl->setParameterByClass(
854 $ilCtrl->getReturnClass($this),
855 "updated_pc_id_str",
856 urlencode($a_pc_id_str)
857 );
858 $this->log->debug("ilPCParagraphGUI, createJS(): return to edit cmd of " . $ilCtrl->getReturnClass($this));
859
860 $ilCtrl->redirectByClass($ilCtrl->getReturnClass($this), "edit", "", true);
861 }
outputError($a_err)
Output error.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$ilUser
Definition: imgupload.php:18
exit
Definition: login.php:29

References $_POST, ilPageContentGUI\$ctrl, $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 275 of file class.ilPCParagraphGUI.php.

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

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

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

315 {
316 $s_text = $this->content_obj->getText();
317 $this->log->debug("step 1: " . substr($s_text, 0, 1000));
318
319 //echo "\n<br><br>".htmlentities($s_text);
320 $s_text = $this->content_obj->xml2output($s_text, true, false);
321 $this->log->debug("step 2: " . substr($s_text, 0, 1000));
322
323 //echo "\n<br><br>".htmlentities($s_text);
324 $char = $this->determineCharacteristic(false);
325 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, $char, $this->content_obj->readPCId());
326 $this->log->debug("step 3: " . substr($s_text, 0, 1000));
327
328 //echo "\n<br><br>".htmlentities($s_text);
329 $ids = "###" . $this->content_obj->readHierId() . ":" . $this->content_obj->readPCId() . "###" .
330 $char . "###";
331 echo $ids . $s_text;
332 $this->log->debug("step 4: " . substr($ids . $s_text, 0, 1000));
333 exit;
334 }
static xml2outputJS($s_text)
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 339 of file class.ilPCParagraphGUI.php.

340 {
341 echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
342 exit;
343 }

References exit.

◆ executeCommand()

ilPCParagraphGUI::executeCommand ( )

execute command

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

139 {
140 // get next class that processes or forwards current command
141 $next_class = $this->ctrl->getNextClass($this);
142
144 array("text_block", "heading1", "heading2", "heading3")
145 ); // scorm-2004
146
147 // get current command
148 $cmd = $this->ctrl->getCmd();
149
150 $this->log->debug("ilPCParagraphGUI: executeCommand " . $cmd);
151
152 switch ($next_class) {
153 default:
154 $ret = $this->$cmd();
155 break;
156 }
157
158 return $ret;
159 }
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 622 of file class.ilPCParagraphGUI.php.

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

References $c, $DIC, ilPageContentGUI\$lng, _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 557 of file class.ilPCParagraphGUI.php.

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

References ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_FORM_SELECT.

◆ insert()

ilPCParagraphGUI::insert ( )

insert paragraph form

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

739 {
740 $this->log->debug("ilPCParagraphGUI, saveJS: got updated value " . $this->updated);
741 return $this->edit(true);
742 }
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 505 of file class.ilPCParagraphGUI.php.

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

References $i, and ilPageContentGUI\getCharacteristics().

+ Here is the call graph for this function:

◆ insertHelp()

ilPCParagraphGUI::insertHelp (   $a_tpl)

Insert Help.

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

867 {
869
870 $a_tpl->setCurrentBlock("help_item");
871 $a_tpl->setVariable("TXT_HELP", "<b>" . $lng->txt("cont_syntax_help") . "</b>");
872 $a_tpl->parseCurrentBlock();
873 $a_tpl->setCurrentBlock("help_item");
874 $a_tpl->setVariable("TXT_HELP", "* " . $lng->txt("cont_bullet_list"));
875 $a_tpl->parseCurrentBlock();
876 $a_tpl->setCurrentBlock("help_item");
877 $a_tpl->setVariable("TXT_HELP", "# " . $lng->txt("cont_numbered_list"));
878 $a_tpl->parseCurrentBlock();
879 $a_tpl->setCurrentBlock("help_item");
880 $a_tpl->setVariable("TXT_HELP", "=" . $lng->txt("cont_Headline1") . "=<br />" .
881 "==" . $lng->txt("cont_Headline2") . "==<br />" .
882 "===" . $lng->txt("cont_Headline3") . "===");
883 $a_tpl->parseCurrentBlock();
884
885 if ($this->getPageConfig()->getEnableWikiLinks()) {
886 $a_tpl->setCurrentBlock("help_item");
887 $a_tpl->setVariable("TXT_HELP", "[[" . $lng->txt("cont_wiki_page_link") . "]]");
888 $a_tpl->parseCurrentBlock();
889 }
890
891 $a_tpl->setCurrentBlock("help");
892 $a_tpl->parseCurrentBlock();
893 }
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 546 of file class.ilPCParagraphGUI.php.

547 {
548 $a_tpl->setVariable("ADV_SEL_STYLE", self::getStyleSelector(
549 $a_selected,
550 $this->getCharacteristics()
551 ));
552 }

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

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

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

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

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

+ Here is the call graph for this function:

◆ setStyle()

ilPCParagraphGUI::setStyle ( )
private

Set Style.

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

716 {
717 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
718
719 if ($this->pg_obj->getParentType() == "gdf" ||
720 $this->pg_obj->getParentType() == "lm") {
721 if ($this->pg_obj->getParentType() != "gdf") {
722 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(
723 ilObjContentObject::_lookupStyleSheetId($this->pg_obj->getParentId())
724 ));
725 } else {
726 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
727 }
728 } else {
729 if ($this->pg_obj->getParentType() != "sahs") {
730 // $this->tpl->setContentStylesheet(ilObjStyleSheet::getContentStylePath(0));
731 }
732 }
733 }
static _lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
static getContentStylePath($a_style_id, $add_random=true, $add_token=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 747 of file class.ilPCParagraphGUI.php.

748 {
749 $this->log->debug("ilPCParagraphGUI, update(): start");
750
751 // set language and characteristic
752 $this->content_obj->setLanguage($_POST["par_language"]);
753 $this->content_obj->setCharacteristic($_POST["par_characteristic"]);
754
755 $this->updated = $this->content_obj->setText(
756 $this->content_obj->input2xml(
757 $_POST["par_content"],
758 $_POST["usedwsiwygeditor"]
759 ),
760 true
761 );
762 if ($this->updated !== true) {
763 $this->edit();
764 return;
765 }
766
767 $this->updated = $this->content_obj->updatePage($this->pg_obj);
768
769
770 if ($this->updated === true) {
771 $this->log->debug("ilPCParagraphGUI, update(): return to parent: jump" . $this->hier_id);
772 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
773 } else {
774 $this->log->debug("ilPCParagraphGUI, update(): call edit.");
775 $this->edit();
776 }
777 }

References $_POST, and edit().

+ Here is the call graph for this function:

◆ xml2outputJS()

static ilPCParagraphGUI::xml2outputJS (   $s_text)
static

Prepare content for js output.

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

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