24 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
25 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
26 require_once(
"./Services/COPage/classes/class.ilWysiwygUtil.php");
58 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
80 $this->enablewikilinks = $a_enablewikilinks;
90 return $this->enablewikilinks;
96 function edit($a_insert =
false)
101 $tpl =
new ilTemplate(
"tpl.paragraph_edit.html",
true,
true,
"Services/COPage");
109 $tpl->setCurrentBlock(
"commands");
110 $tpl->setVariable(
"BTN_NAME",
"create_par");
111 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
112 $tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
113 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
114 $tpl->parseCurrentBlock();
115 $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_par"));
119 $tpl->setCurrentBlock(
"commands");
120 $tpl->setVariable(
"BTN_NAME",
"update");
121 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
122 $tpl->setVariable(
"BTN_CANCEL",
"cancelUpdate");
123 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
124 $tpl->parseCurrentBlock();
125 $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_par"));
127 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
129 $tpl->setVariable(
"PAR_TA_NAME",
"par_content");
131 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_0/editor.js");
132 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
140 if (key($_POST[
"cmd"]) ==
"update")
142 $s_lang = $_POST[
"par_language"];
143 $s_char = $_POST[
"par_characteristic"];
147 $s_lang = $this->content_obj->getLanguage();
148 $s_char = $this->content_obj->getCharacteristic();
153 if (key($_POST[
"cmd"]) ==
"create_par")
155 $s_lang = $_POST[
"par_language"];
156 $s_char = $_POST[
"par_characteristic"];
162 $s_lang =
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
166 $s_lang = $ilUser->getLanguage();
170 $cont_obj =& $this->pg_obj->getContentObject($this->
getHierId());
171 if (is_object($cont_obj))
173 if ($cont_obj->getType() ==
"li" ||
174 ($cont_obj->getType() ==
"par" && $cont_obj->getCharacteristic() ==
"List"))
179 if ($cont_obj->getType() ==
"td" ||
180 ($cont_obj->getType() ==
"par" && $cont_obj->getCharacteristic() ==
"TableContent"))
182 $s_char =
"TableContent";
189 $tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
190 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
193 $tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
196 $char = array(
"" => $this->lng->txt(
"none"),
197 "Headline1" => $this->lng->txt(
"cont_Headline1"),
198 "Headline2" => $this->lng->txt(
"cont_Headline2"),
199 "Headline3" => $this->lng->txt(
"cont_Headline3"),
200 "Example" => $this->lng->txt(
"cont_Example"),
201 "Citation" => $this->lng->txt(
"cont_Citation"),
202 "Mnemonic" => $this->lng->txt(
"cont_Mnemonic"),
203 "Additional" => $this->lng->txt(
"cont_Additional"),
204 "List" => $this->lng->txt(
"cont_List"),
205 "Remark" => $this->lng->txt(
"cont_Remark"),
206 "TableContent" => $this->lng->txt(
"cont_TableContent")
208 $tpl->setVariable(
"TXT_CHARACTERISTIC", $this->lng->txt(
"cont_characteristic"));
210 "par_characteristic",$char,
false,
true);
211 $tpl->setVariable(
"SELECT_CHARACTERISTIC", $select_char);
213 if (key($_POST[
"cmd"]) ==
"update" || key($_POST[
"cmd"]) ==
"create_par")
217 $s_text = str_replace(
"{",
"{", $s_text);
218 $s_text = str_replace(
"}",
"}", $s_text);
222 $s_text = $this->content_obj->xml2output($this->content_obj->getText());
225 $tpl->setVariable(
"PAR_TA_CONTENT", $s_text);
227 $tpl->parseCurrentBlock();
229 $this->tpl->setContent(
$tpl->get());
238 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
240 if ($this->pg_obj->getParentType() ==
"gdf" ||
241 $this->pg_obj->getParentType() ==
"lm" ||
242 $this->pg_obj->getParentType() ==
"dbk")
244 if ($this->pg_obj->getParentType() !=
"gdf")
265 return $this->
edit(
true);
275 $ilBench->start(
"Editor",
"Paragraph_update");
277 $this->content_obj->setLanguage($_POST[
"par_language"]);
278 $this->content_obj->setCharacteristic($_POST[
"par_characteristic"]);
288 $this->updated = $this->content_obj->setText(
289 $this->content_obj->input2xml($_POST[
"par_content"],
290 $_POST[
"usedwsiwygeditor"]),
true);
292 if ($this->updated !==
true)
294 $ilBench->stop(
"Editor",
"Paragraph_update");
299 $this->updated = $this->pg_obj->update();
302 $ilBench->stop(
"Editor",
"Paragraph_update");
304 if ($this->updated ===
true)
306 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
322 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
323 $this->content_obj->setLanguage($_POST[
"par_language"]);
324 $_SESSION[
"il_text_lang_".$_GET[
"ref_id"]] = $_POST[
"par_language"];
325 $this->content_obj->setCharacteristic($_POST[
"par_characteristic"]);
327 $this->updated = $this->content_obj->setText(
328 $this->content_obj->input2xml($_POST[
"par_content"],
329 $_POST[
"usedwsiwygeditor"]),
true);
331 if ($this->updated !==
true)
336 $this->updated = $this->pg_obj->update();
338 if ($this->updated ===
true)
340 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
355 $a_tpl->setCurrentBlock(
"help_item");
356 $a_tpl->setVariable(
"TXT_HELP",
"<b>".$lng->txt(
"cont_syntax_help").
"</b>");
357 $a_tpl->parseCurrentBlock();
358 $a_tpl->setCurrentBlock(
"help_item");
359 $a_tpl->setVariable(
"TXT_HELP",
"* ".$lng->txt(
"cont_bullet_list"));
360 $a_tpl->parseCurrentBlock();
361 $a_tpl->setCurrentBlock(
"help_item");
362 $a_tpl->setVariable(
"TXT_HELP",
"# ".$lng->txt(
"cont_numbered_list"));
363 $a_tpl->parseCurrentBlock();
364 $a_tpl->setCurrentBlock(
"help_item");
365 $a_tpl->setVariable(
"TXT_HELP",
"=".$lng->txt(
"cont_Headline1").
"=<br />".
366 "==".$lng->txt(
"cont_Headline2").
"==<br />".
367 "===".$lng->txt(
"cont_Headline3").
"===");
368 $a_tpl->parseCurrentBlock();
372 $a_tpl->setCurrentBlock(
"help_item");
373 $a_tpl->setVariable(
"TXT_HELP",
"[[".$lng->txt(
"cont_wiki_page_link").
"]]");
374 $a_tpl->parseCurrentBlock();
377 $a_tpl->setCurrentBlock(
"help");
378 $a_tpl->parseCurrentBlock();