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")
 
   62                 if ($a_style_id > 0 &&
 
   65                         include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
   67                         $types = array(
"text_block", 
"heading1", 
"heading2", 
"heading3");
 
   69                         foreach ($types as 
$t)
 
   71                                 $chars = array_merge($chars, $style->getCharacteristics($t));
 
   74                         foreach ($chars as $char)
 
   76                                 if ($st_chars[$char] != 
"")     
 
   78                                         $new_chars[$char] = $st_chars[$char];
 
   82                                         $new_chars[$char] = $char;
 
   98                 $next_class = $this->ctrl->getNextClass($this);
 
  101                         array(
"text_block", 
"heading1", 
"heading2", 
"heading3"));       
 
  104                 $cmd = $this->ctrl->getCmd();
 
  123                 $this->enablewikilinks = $a_enablewikilinks;
 
  133                 return $this->enablewikilinks;
 
  139         function edit($a_insert = 
false)
 
  144                 $tpl = 
new ilTemplate(
"tpl.paragraph_edit.html", 
true, 
true, 
"Services/COPage");
 
  152                         $tpl->setCurrentBlock(
"commands");
 
  153                         $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  154                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  155                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  156                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  157                         $tpl->parseCurrentBlock();
 
  158                         $tpl->setCurrentBlock(
"commands2");
 
  159                         $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  160                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  161                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  162                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  163                         $tpl->parseCurrentBlock();
 
  164                         $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_par"));
 
  168                         $tpl->setCurrentBlock(
"commands");
 
  169                         $tpl->setVariable(
"BTN_NAME", 
"update");
 
  170                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  171                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  172                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  173                         $tpl->parseCurrentBlock();
 
  174                         $tpl->setCurrentBlock(
"commands2");
 
  175                         $tpl->setVariable(
"BTN_NAME", 
"update");
 
  176                         $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  177                         $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  178                         $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  179                         $tpl->parseCurrentBlock();
 
  180                         $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_par"));
 
  186                         if (key(
$_POST[
"cmd"]) == 
"update")
 
  188                                 $s_lang = 
$_POST[
"par_language"];
 
  189                                 $s_char = 
$_POST[
"par_characteristic"];
 
  193                                 $s_lang = $this->content_obj->getLanguage();
 
  194                                 $s_char = $this->content_obj->getCharacteristic();
 
  197                                         $s_char = 
"Standard";
 
  203                         if (key(
$_POST[
"cmd"]) == 
"create_par")
 
  205                                 $s_lang = 
$_POST[
"par_language"];
 
  206                                 $s_char = 
$_POST[
"par_characteristic"];
 
  210                                 $s_char = 
"Standard";
 
  213                                         $s_lang = 
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
 
  217                                         $s_lang = $ilUser->getLanguage();
 
  221                                 $cont_obj =& $this->pg_obj->getContentObject($this->
getHierId());
 
  222                                 if (is_object($cont_obj))
 
  224                                         if ($cont_obj->getType() == 
"li" ||
 
  225                                                 ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"List"))
 
  230                                         if ($cont_obj->getType() == 
"td" ||
 
  231                                                 ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"TableContent"))
 
  233                                                 $s_char = 
"TableContent";
 
  244                 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  246                 $tpl->setVariable(
"PAR_TA_NAME", 
"par_content");
 
  248                 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
 
  249                 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
 
  254                 $tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
 
  255                 $tpl->setVariable(
"TXT_ANCHOR", $this->lng->txt(
"cont_anchor"));
 
  257                 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
 
  260                 $tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
 
  262                 $tpl->setVariable(
"TXT_CHARACTERISTIC", $this->lng->txt(
"cont_characteristic"));
 
  267                 if (key(
$_POST[
"cmd"]) == 
"update" || key(
$_POST[
"cmd"]) == 
"create_par")
 
  271                         $s_text = str_replace(
"{", 
"{", $s_text);
 
  272                         $s_text = str_replace(
"}", 
"}", $s_text);
 
  276                         $s_text = $this->content_obj->xml2output($this->content_obj->getText());
 
  279                 $tpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  281                 $tpl->parseCurrentBlock();
 
  283                 $this->tpl->setContent(
$tpl->get());
 
  296                 if ($chars[$a_seleted_value] == 
"" && ($a_seleted_value != 
""))
 
  298                         $chars = array_merge(array($a_seleted_value => $a_seleted_value),
 
  302                 foreach ($chars as $char => $char_lang)
 
  304                         $a_tpl->setCurrentBlock(
"characteristic_cell");
 
  305                         $a_tpl->setVariable(
"CHAR_HTML",
 
  306                                 '<div class="ilc_text_block_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</div>");
 
  307                         $a_tpl->setVariable(
"CHAR_VALUE", $char);
 
  308                         if ($char == $a_seleted_value)
 
  310                                 $a_tpl->setVariable(
"SELECTED",
 
  311                                         ' checked="checked" ');
 
  313                         $a_tpl->parseCurrentBlock();
 
  314                         if ((($i+1) % 3) == 0)  
 
  316                                 $a_tpl->touchBlock(
"characteristic_row");
 
  320                 $a_tpl->touchBlock(
"characteristic_table");
 
  325                 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
 
  327                 $selection->setFormSelectMode(
"par_characteristic", 
"", 
false,
 
  330                 $selection->setId(
"style_selection");
 
  333                 $selection->setSelectedValue($a_s_char);
 
  335                 $selection->setUseImages(
false);
 
  339                 $title_char = $chars[$a_s_char] != 
"" 
  342                 $selection->setListTitle($title_char);
 
  344                 if ($chars[$a_seleted_value] == 
"" && ($a_seleted_value != 
""))
 
  346                         $chars = array_merge(array($a_seleted_value => $a_seleted_value),
 
  350                 foreach ($chars as $char => $char_lang)
 
  357                                 case "Headline1": 
$t = 
"heading1"; $tag = 
"h1"; 
break;
 
  358                                 case "Headline2": 
$t = 
"heading2"; $tag = 
"h2"; 
break;
 
  359                                 case "Headline3": 
$t = 
"heading3"; $tag = 
"h3"; 
break; 
 
  361                         $html = 
'<'.$tag.
' class="ilc_'.
$t.
'_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</".$tag.
">";
 
  362                         $selection->addItem($char_lang, $char, 
"",
 
  363                                 "", $char, 
"", $html);
 
  365                 $a_tpl->setVariable(
"ADV_SEL_STYLE", $selection->getHTML());
 
  373                 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
  375                 if ($this->pg_obj->getParentType() == 
"gdf" ||
 
  376                         $this->pg_obj->getParentType() == 
"lm" ||
 
  377                         $this->pg_obj->getParentType() == 
"dbk")
 
  379                         if ($this->pg_obj->getParentType() != 
"gdf")
 
  391                         if ($this->pg_obj->getParentType() != 
"sahs")
 
  403                 return $this->
edit(
true);
 
  413                 $ilBench->start(
"Editor",
"Paragraph_update");
 
  415                 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  416                 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  427                 $this->updated = $this->content_obj->setText(
 
  428                         $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  429                                 $_POST[
"usedwsiwygeditor"]), 
true);
 
  431                 if ($this->updated !== 
true)
 
  433                         $ilBench->stop(
"Editor",
"Paragraph_update");
 
  438                 $this->updated = $this->pg_obj->update();
 
  441                 $ilBench->stop(
"Editor",
"Paragraph_update");
 
  443                 if ($this->updated === 
true)
 
  445                         $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  461                 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  462                 $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  464                 $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  466                 $this->updated = $this->content_obj->setText(
 
  467                         $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  468                                 $_POST[
"usedwsiwygeditor"]), 
true);
 
  470                 if ($this->updated !== 
true)
 
  475                 $this->updated = $this->pg_obj->update();
 
  477                 if ($this->updated === 
true)
 
  479                         $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  494                 $a_tpl->setCurrentBlock(
"help_item");
 
  495                 $a_tpl->setVariable(
"TXT_HELP", 
"<b>".$lng->txt(
"cont_syntax_help").
"</b>");
 
  496                 $a_tpl->parseCurrentBlock();
 
  497                 $a_tpl->setCurrentBlock(
"help_item");
 
  498                 $a_tpl->setVariable(
"TXT_HELP", 
"* ".$lng->txt(
"cont_bullet_list"));
 
  499                 $a_tpl->parseCurrentBlock();
 
  500                 $a_tpl->setCurrentBlock(
"help_item");
 
  501                 $a_tpl->setVariable(
"TXT_HELP", 
"# ".$lng->txt(
"cont_numbered_list"));
 
  502                 $a_tpl->parseCurrentBlock();
 
  503                 $a_tpl->setCurrentBlock(
"help_item");
 
  504                 $a_tpl->setVariable(
"TXT_HELP", 
"=".$lng->txt(
"cont_Headline1").
"=<br />".
 
  505                         "==".$lng->txt(
"cont_Headline2").
"==<br />".
 
  506                         "===".$lng->txt(
"cont_Headline3").
"===");
 
  507                 $a_tpl->parseCurrentBlock();
 
  511                         $a_tpl->setCurrentBlock(
"help_item");
 
  512                         $a_tpl->setVariable(
"TXT_HELP", 
"[[".$lng->txt(
"cont_wiki_page_link").
"]]");
 
  513                         $a_tpl->parseCurrentBlock();
 
  516                 $a_tpl->setCurrentBlock(
"help");
 
  517                 $a_tpl->parseCurrentBlock();