4 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
5 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
6 require_once(
"./Services/COPage/classes/class.ilWysiwygUtil.php");
40 return array(
"" => $lng->txt(
"none"),
41 "Headline1" => $lng->txt(
"cont_Headline1"),
42 "Headline2" => $lng->txt(
"cont_Headline2"),
43 "Headline3" => $lng->txt(
"cont_Headline3"),
44 "Citation" => $lng->txt(
"cont_Citation"),
45 "Mnemonic" => $lng->txt(
"cont_Mnemonic"),
46 "Example" => $lng->txt(
"cont_Example"),
47 "Additional" => $lng->txt(
"cont_Additional"),
48 "Remark" => $lng->txt(
"cont_Remark"),
49 "List" => $lng->txt(
"cont_List"),
50 "TableContent" => $lng->txt(
"cont_TableContent")
61 if ($a_style_id > 0 &&
64 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
66 $types = array(
"text_block",
"heading1",
"heading2",
"heading3");
68 foreach ($types as
$t)
70 $chars = array_merge($chars, $style->getCharacteristics($t));
73 foreach ($chars as $char)
75 if ($chars[$char] !=
"")
77 $new_chars[$char] = $chars[$char];
81 $new_chars[$char] = $char;
96 $next_class = $this->ctrl->getNextClass($this);
99 array(
"text_block",
"heading1",
"heading2",
"heading3"));
102 $cmd = $this->ctrl->getCmd();
121 $this->enablewikilinks = $a_enablewikilinks;
131 return $this->enablewikilinks;
137 function edit($a_insert =
false)
142 $tpl =
new ilTemplate(
"tpl.paragraph_edit.html",
true,
true,
"Services/COPage");
150 $tpl->setCurrentBlock(
"commands");
151 $tpl->setVariable(
"BTN_NAME",
"create_par");
152 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
153 $tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
154 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
155 $tpl->parseCurrentBlock();
156 $tpl->setCurrentBlock(
"commands2");
157 $tpl->setVariable(
"BTN_NAME",
"create_par");
158 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
159 $tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
160 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
161 $tpl->parseCurrentBlock();
162 $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_par"));
166 $tpl->setCurrentBlock(
"commands");
167 $tpl->setVariable(
"BTN_NAME",
"update");
168 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
169 $tpl->setVariable(
"BTN_CANCEL",
"cancelUpdate");
170 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
171 $tpl->parseCurrentBlock();
172 $tpl->setCurrentBlock(
"commands2");
173 $tpl->setVariable(
"BTN_NAME",
"update");
174 $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
175 $tpl->setVariable(
"BTN_CANCEL",
"cancelUpdate");
176 $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
177 $tpl->parseCurrentBlock();
178 $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_par"));
184 if (key(
$_POST[
"cmd"]) ==
"update")
186 $s_lang =
$_POST[
"par_language"];
187 $s_char =
$_POST[
"par_characteristic"];
191 $s_lang = $this->content_obj->getLanguage();
192 $s_char = $this->content_obj->getCharacteristic();
195 $s_char =
"Standard";
201 if (key(
$_POST[
"cmd"]) ==
"create_par")
203 $s_lang =
$_POST[
"par_language"];
204 $s_char =
$_POST[
"par_characteristic"];
208 $s_char =
"Standard";
211 $s_lang =
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
215 $s_lang = $ilUser->getLanguage();
219 $cont_obj =& $this->pg_obj->getContentObject($this->
getHierId());
220 if (is_object($cont_obj))
222 if ($cont_obj->getType() ==
"li" ||
223 ($cont_obj->getType() ==
"par" && $cont_obj->getCharacteristic() ==
"List"))
228 if ($cont_obj->getType() ==
"td" ||
229 ($cont_obj->getType() ==
"par" && $cont_obj->getCharacteristic() ==
"TableContent"))
231 $s_char =
"TableContent";
242 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
244 $tpl->setVariable(
"PAR_TA_NAME",
"par_content");
246 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
247 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
252 $tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
253 $tpl->setVariable(
"TXT_ANCHOR", $this->lng->txt(
"cont_anchor"));
255 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
258 $tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
260 $tpl->setVariable(
"TXT_CHARACTERISTIC", $this->lng->txt(
"cont_characteristic"));
265 if (key(
$_POST[
"cmd"]) ==
"update" || key(
$_POST[
"cmd"]) ==
"create_par")
269 $s_text = str_replace(
"{",
"{", $s_text);
270 $s_text = str_replace(
"}",
"}", $s_text);
274 $s_text = $this->content_obj->xml2output($this->content_obj->getText());
277 $tpl->setVariable(
"PAR_TA_CONTENT", $s_text);
279 $tpl->parseCurrentBlock();
281 $this->tpl->setContent(
$tpl->get());
294 if ($chars[$a_seleted_value] ==
"" && ($a_seleted_value !=
""))
296 $chars = array_merge(array($a_seleted_value => $a_seleted_value),
300 foreach ($chars as $char => $char_lang)
302 $a_tpl->setCurrentBlock(
"characteristic_cell");
303 $a_tpl->setVariable(
"CHAR_HTML",
304 '<div class="ilc_text_block_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</div>");
305 $a_tpl->setVariable(
"CHAR_VALUE", $char);
306 if ($char == $a_seleted_value)
308 $a_tpl->setVariable(
"SELECTED",
309 ' checked="checked" ');
311 $a_tpl->parseCurrentBlock();
312 if ((($i+1) % 3) == 0)
314 $a_tpl->touchBlock(
"characteristic_row");
318 $a_tpl->touchBlock(
"characteristic_table");
323 include_once(
"./Services/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
325 $selection->setFormSelectMode(
"par_characteristic",
"",
false,
328 $selection->setId(
"style_selection");
331 $selection->setSelectedValue($a_s_char);
333 $selection->setUseImages(
false);
337 $title_char = $chars[$a_s_char] !=
""
340 $selection->setListTitle($title_char);
342 if ($chars[$a_seleted_value] ==
"" && ($a_seleted_value !=
""))
344 $chars = array_merge(array($a_seleted_value => $a_seleted_value),
348 foreach ($chars as $char => $char_lang)
355 case "Headline1":
$t =
"heading1"; $tag =
"h1";
break;
356 case "Headline2":
$t =
"heading2"; $tag =
"h2";
break;
357 case "Headline3":
$t =
"heading3"; $tag =
"h3";
break;
359 $html =
'<'.$tag.
' class="ilc_'.
$t.
'_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</".$tag.
">";
360 $selection->addItem($char_lang, $char,
"",
361 "", $char,
"", $html);
363 $a_tpl->setVariable(
"ADV_SEL_STYLE", $selection->getHTML());
371 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
373 if ($this->pg_obj->getParentType() ==
"gdf" ||
374 $this->pg_obj->getParentType() ==
"lm" ||
375 $this->pg_obj->getParentType() ==
"dbk")
377 if ($this->pg_obj->getParentType() !=
"gdf")
389 if ($this->pg_obj->getParentType() !=
"sahs")
401 return $this->
edit(
true);
411 $ilBench->start(
"Editor",
"Paragraph_update");
413 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
414 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
425 $this->updated = $this->content_obj->setText(
426 $this->content_obj->input2xml(
$_POST[
"par_content"],
427 $_POST[
"usedwsiwygeditor"]),
true);
429 if ($this->updated !==
true)
431 $ilBench->stop(
"Editor",
"Paragraph_update");
436 $this->updated = $this->pg_obj->update();
439 $ilBench->stop(
"Editor",
"Paragraph_update");
441 if ($this->updated ===
true)
443 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
459 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
460 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
462 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
464 $this->updated = $this->content_obj->setText(
465 $this->content_obj->input2xml(
$_POST[
"par_content"],
466 $_POST[
"usedwsiwygeditor"]),
true);
468 if ($this->updated !==
true)
473 $this->updated = $this->pg_obj->update();
475 if ($this->updated ===
true)
477 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
492 $a_tpl->setCurrentBlock(
"help_item");
493 $a_tpl->setVariable(
"TXT_HELP",
"<b>".$lng->txt(
"cont_syntax_help").
"</b>");
494 $a_tpl->parseCurrentBlock();
495 $a_tpl->setCurrentBlock(
"help_item");
496 $a_tpl->setVariable(
"TXT_HELP",
"* ".$lng->txt(
"cont_bullet_list"));
497 $a_tpl->parseCurrentBlock();
498 $a_tpl->setCurrentBlock(
"help_item");
499 $a_tpl->setVariable(
"TXT_HELP",
"# ".$lng->txt(
"cont_numbered_list"));
500 $a_tpl->parseCurrentBlock();
501 $a_tpl->setCurrentBlock(
"help_item");
502 $a_tpl->setVariable(
"TXT_HELP",
"=".$lng->txt(
"cont_Headline1").
"=<br />".
503 "==".$lng->txt(
"cont_Headline2").
"==<br />".
504 "===".$lng->txt(
"cont_Headline3").
"===");
505 $a_tpl->parseCurrentBlock();
509 $a_tpl->setCurrentBlock(
"help_item");
510 $a_tpl->setVariable(
"TXT_HELP",
"[[".$lng->txt(
"cont_wiki_page_link").
"]]");
511 $a_tpl->parseCurrentBlock();
514 $a_tpl->setCurrentBlock(
"help");
515 $a_tpl->parseCurrentBlock();