4require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
    5require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
   25                parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
 
   38                return array(
"Standard" => 
$lng->txt(
"cont_standard"),
 
   39                        "Headline1" => 
$lng->txt(
"cont_Headline1"),
 
   40                        "Headline2" => 
$lng->txt(
"cont_Headline2"),
 
   41                        "Headline3" => 
$lng->txt(
"cont_Headline3"),
 
   42                        "Citation" => 
$lng->txt(
"cont_Citation"),
 
   43                        "Mnemonic" => 
$lng->txt(
"cont_Mnemonic"),
 
   44                        "Example" => 
$lng->txt(
"cont_Example"),
 
   45                        "Additional" => 
$lng->txt(
"cont_Additional"),
 
   46                        "Remark" => 
$lng->txt(
"cont_Remark"),
 
   47                        "List" => 
$lng->txt(
"cont_List"),
 
   48                        "TableContent" => 
$lng->txt(
"cont_TableContent")
 
   60                if ($a_style_id > 0 &&
 
   63                        include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
   65                        $types = array(
"text_block", 
"heading1", 
"heading2", 
"heading3");
 
   67                        foreach ($types as 
$t)
 
   69                                $chars = array_merge($chars, $style->getCharacteristics(
$t));
 
   72                        foreach ($chars as $char)
 
   74                                if ($st_chars[$char] != 
"")     
 
   76                                        $new_chars[$char] = $st_chars[$char];
 
   80                                        $new_chars[$char] = $char;
 
   96                $next_class = $this->ctrl->getNextClass($this);
 
   99                        array(
"text_block", 
"heading1", 
"heading2", 
"heading3"));       
 
  102                $cmd = $this->ctrl->getCmd();
 
  117        function edit($a_insert = 
false)
 
  122                $tpl = 
new ilTemplate(
"tpl.paragraph_edit.html", 
true, 
true, 
"Services/COPage");
 
  130                        $tpl->setCurrentBlock(
"commands");
 
  131                        $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  132                        $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  133                        $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  134                        $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  135                        $tpl->parseCurrentBlock();
 
  136                        $tpl->setCurrentBlock(
"commands2");
 
  137                        $tpl->setVariable(
"BTN_NAME", 
"create_par");
 
  138                        $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  139                        $tpl->setVariable(
"BTN_CANCEL", 
"cancelCreate");
 
  140                        $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  141                        $tpl->parseCurrentBlock();
 
  142                        $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_par"));
 
  146                        $tpl->setCurrentBlock(
"commands");
 
  147                        $tpl->setVariable(
"BTN_NAME", 
"update");
 
  148                        $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  149                        $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  150                        $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  151                        $tpl->parseCurrentBlock();
 
  152                        $tpl->setCurrentBlock(
"commands2");
 
  153                        $tpl->setVariable(
"BTN_NAME", 
"update");
 
  154                        $tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  155                        $tpl->setVariable(
"BTN_CANCEL", 
"cancelUpdate");
 
  156                        $tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
 
  157                        $tpl->parseCurrentBlock();
 
  158                        $tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_par"));
 
  165                        if (key(
$_POST[
"cmd"]) == 
"update")
 
  167                                $s_lang = 
$_POST[
"par_language"];
 
  171                                $s_lang = $this->content_obj->getLanguage();
 
  176                        if (key(
$_POST[
"cmd"]) == 
"create_par")
 
  178                                $s_lang = 
$_POST[
"par_language"];
 
  184                                        $s_lang = 
$_SESSION[
"il_text_lang_".$_GET[
"ref_id"]];
 
  188                                        $s_lang = 
$ilUser->getLanguage();
 
  197                $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  199                $tpl->setVariable(
"PAR_TA_NAME", 
"par_content");
 
  201                $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
 
  202                $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
 
  207                $tpl->setVariable(
"TXT_LANGUAGE", $this->lng->txt(
"language"));
 
  208                $tpl->setVariable(
"TXT_ANCHOR", $this->lng->txt(
"cont_anchor"));
 
  210                require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
 
  213                $tpl->setVariable(
"SELECT_LANGUAGE", $select_lang);
 
  215                $tpl->setVariable(
"TXT_CHARACTERISTIC", $this->lng->txt(
"cont_characteristic"));
 
  220                if (key(
$_POST[
"cmd"]) == 
"update" || key(
$_POST[
"cmd"]) == 
"create_par")
 
  224                        $s_text = str_replace(
"{", 
"{", $s_text);
 
  225                        $s_text = str_replace(
"}", 
"}", $s_text);
 
  229                        $s_text = $this->content_obj->xml2output($this->content_obj->getText());
 
  232                $tpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  234                $tpl->parseCurrentBlock();
 
  236                $this->tpl->setContent(
$tpl->get());
 
  251                        if (key(
$_POST[
"cmd"]) == 
"update")
 
  253                                $s_char = 
$_POST[
"par_characteristic"];
 
  257                                $s_char = $this->content_obj->getCharacteristic();
 
  260                                        $s_char = 
"Standard";
 
  266                        if (key(
$_POST[
"cmd"]) == 
"create_par")
 
  268                                $s_char = 
$_POST[
"par_characteristic"];
 
  272                                $s_char = 
"Standard";
 
  275                                $cont_obj = $this->pg_obj->getContentObject($this->
getHierId());
 
  276                                if (is_object($cont_obj))
 
  278                                        if ($cont_obj->getType() == 
"li" ||
 
  279                                                ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"List"))
 
  284                                        if ($cont_obj->getType() == 
"td" ||
 
  285                                                ($cont_obj->getType() == 
"par" && $cont_obj->getCharacteristic() == 
"TableContent"))
 
  287                                                $s_char = 
"TableContent";
 
  303                $s_text = $this->content_obj->getText();
 
  305                $s_text = $this->content_obj->xml2output($s_text, 
true, 
false);
 
  310                $ids = 
"###".$this->content_obj->readHierId().
":".$this->content_obj->readPCId().
"###".
 
  323                echo $this->content_obj->getParagraphSequenceContent($this->pg_obj);
 
  335                $s_text = str_replace(array(
"<SimpleBulletList>", 
"</SimpleBulletList>"),
 
  336                        array(
"<ul class='ilc_list_u_BulletedList'>", 
"</ul>"),
 
  338                $s_text = str_replace(array(
"<SimpleNumberedList>", 
"</SimpleNumberedList>"),
 
  339                        array(
"<ol class='ilc_list_o_NumberedList'>", 
"</ol>"), $s_text);
 
  340                $s_text = str_replace(array(
"<SimpleListItem>", 
"</SimpleListItem>"),
 
  341                        array(
"<li class='ilc_list_item_StandardListItem'>", 
"</li>"), $s_text);
 
  342                $s_text = str_replace(array(
"<SimpleListItem/>"),
 
  343                        array(
"<li class='ilc_list_item_StandardListItem'></li>"), $s_text);
 
  350                include_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
  353                        if (!in_array($bb, array(
"code", 
"tex", 
"fn", 
"xln")))
 
  355                                $s_text = str_replace(
"[".$bb.
"]",
 
  356                                        '<span class="ilc_text_inline_'.$cl.
'">', $s_text);
 
  357                                $s_text = str_replace(
"[/".$bb.
"]",
 
  363                $s_text = str_replace(array(
"[code]", 
"[/code]"),
 
  364                        array(
"<code>", 
"</code>"), $s_text);
 
  380                $this->updated = $this->content_obj->saveJS($this->pg_obj,
 
  381                        $_POST[
"ajaxform_content"],
 
  386                        if ($this->updated === 
true)
 
  388                                $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  394                if ($this->updated !== 
true && is_array($this->updated))
 
  399                $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  401                $ilCtrl->setParameterByClass(
$ilCtrl->getReturnClass($this), 
"updated_pc_id_str",
 
  402                        urlencode($a_pc_id_str));
 
  403                $ilCtrl->redirectByClass(
$ilCtrl->getReturnClass($this), 
"edit", 
"", 
true);
 
  413                foreach ($a_err as $err)
 
  415                        echo $err[1].
"<br />";
 
  426                $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  438                if ($chars[$a_seleted_value] == 
"" && ($a_seleted_value != 
""))
 
  440                        $chars = array_merge(array($a_seleted_value => $a_seleted_value),
 
  444                foreach ($chars as $char => $char_lang)
 
  446                        $a_tpl->setCurrentBlock(
"characteristic_cell");
 
  447                        $a_tpl->setVariable(
"CHAR_HTML",
 
  448                                '<div class="ilc_text_block_'.$char.
'" style="margin-top:2px; margin-bottom:2px; position:static;">'.$char_lang.
"</div>");
 
  449                        $a_tpl->setVariable(
"CHAR_VALUE", $char);
 
  450                        if ($char == $a_seleted_value)
 
  452                                $a_tpl->setVariable(
"SELECTED",
 
  453                                        ' checked="checked" ');
 
  455                        $a_tpl->parseCurrentBlock();
 
  456                        if ((($i+1) % 3) == 0)  
 
  458                                $a_tpl->touchBlock(
"characteristic_row");
 
  462                $a_tpl->touchBlock(
"characteristic_table");
 
  473                $a_tpl->setVariable(
"ADV_SEL_STYLE", self::getStyleSelector($a_selected,
 
  482                include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
 
  484                $selection->setPullRight(
false);
 
  485                $selection->setFormSelectMode(
"par_characteristic", 
"", 
false,
 
  488                $selection->setId(
"style_selection");
 
  489                $selection->setSelectionHeaderClass(
"ilEditSubmit ilTinyMenuDropDown");
 
  491                $selection->setSelectedValue($a_selected);
 
  492                $selection->setUseImages(
false);
 
  496                        $selection->setSelectCallback(
"ilCOPage.setParagraphClass");
 
  500                $title_char = ($chars[$a_selected] != 
"")
 
  501                        ? $chars[$a_selected]
 
  503                $selection->setListTitle($title_char);
 
  505                if ($chars[$a_seleted] == 
"" && ($a_seleted != 
""))
 
  507                        $chars = array_merge(array($a_seleted => $a_seleted),
 
  511                foreach ($chars as $char => $char_lang)
 
  517                                case "Headline1": 
$t = 
"heading1"; $tag = 
"h1"; 
break;
 
  518                                case "Headline2": 
$t = 
"heading2"; $tag = 
"h2"; 
break;
 
  519                                case "Headline3": 
$t = 
"heading3"; $tag = 
"h3"; 
break; 
 
  521                        $html = 
'<div class="ilCOPgEditStyleSelectionItem"><'.$tag.
' class="ilc_'.
$t.
'_'.$char.
'" style="'.self::$style_selector_reset.
'">'.$char_lang.
"</".$tag.
"></div>";
 
  522                        $selection->addItem($char_lang, $char, 
"",
 
  523                                "", $char, 
"", $html);
 
  525                return $selection->getHTML();
 
  535                include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
 
  537                $selection->setPullRight(
false);
 
  538                $selection->setFormSelectMode(
"char_characteristic", 
"", 
false,
 
  541                $selection->setId(
"char_style_selection");
 
  542                $selection->setSelectionHeaderClass(
"ilEditSubmit");
 
  545                $selection->setUseImages(
false);
 
  549                        $selection->setSelectCallback(
"ilCOPage.setCharacterClass");
 
  556                $selection->setListTitle(
" <i>A</i>");
 
  565                        "Comment" => array(
"code" => 
"com", 
"txt" => 
$lng->txt(
"cont_char_style_com")),
 
  566                        "Quotation" => array(
"code" => 
"quot", 
"txt" =>
$lng->txt(
"cont_char_style_quot")),
 
  567                        "Accent" => array(
"code" => 
"acc", 
"txt" => 
$lng->txt(
"cont_char_style_acc")),
 
  568                        "Code" => array(
"code" => 
"code", 
"txt" => 
$lng->txt(
"cont_char_style_code"))
 
  570                foreach ($chars as $key => $char)
 
  573                                $a_par_type, 
"active_".$char[
"code"], 
true))
 
  579                                        case "Code": $tag = 
"code"; 
break;
 
  581                                $html = 
'<'.$tag.
' class="ilc_'.
$t.
'_'.$key.
'" style="font-size:90%; margin-top:2px; margin-bottom:2px; position:static;">'.$char[
"txt"].
"</".$tag.
">";
 
  587                                $html = 
'<a class="nostyle" style="display:block;" href="#" onclick="return false;">'.$html.
"</a>";
 
  588                                $selection->addItem($char[
"txt"], $key, 
"",
 
  589                                        "", $key, 
"", $html);
 
  592                return $selection->getHTML();
 
  600                include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
 
  602                if ($this->pg_obj->getParentType() == 
"gdf" ||
 
  603                        $this->pg_obj->getParentType() == 
"lm" ||
 
  604                        $this->pg_obj->getParentType() == 
"dbk")
 
  606                        if ($this->pg_obj->getParentType() != 
"gdf")
 
  618                        if ($this->pg_obj->getParentType() != 
"sahs")
 
  630                return $this->
edit(
true);
 
  640                $ilBench->start(
"Editor",
"Paragraph_update");
 
  642                $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  643                $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  654                $this->updated = $this->content_obj->setText(
 
  655                        $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  656                                $_POST[
"usedwsiwygeditor"]), 
true);
 
  658                if ($this->updated !== 
true)
 
  660                        $ilBench->stop(
"Editor",
"Paragraph_update");
 
  665                $this->updated = $this->content_obj->updatePage($this->pg_obj);
 
  669                $ilBench->stop(
"Editor",
"Paragraph_update");
 
  671                if ($this->updated === 
true)
 
  673                        $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  687                if (
$_POST[
"ajaxform_hier_id"] != 
"")
 
  694                $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
 
  696                $this->content_obj->setLanguage(
$_POST[
"par_language"]);
 
  698                $this->content_obj->setCharacteristic(
$_POST[
"par_characteristic"]);
 
  700                $this->updated = $this->content_obj->setText(
 
  701                        $this->content_obj->input2xml(
$_POST[
"par_content"],
 
  702                                $_POST[
"usedwsiwygeditor"]), 
true);
 
  704                if ($this->updated !== 
true)
 
  709                $this->updated = $this->content_obj->updatePage($this->pg_obj);
 
  711                if ($this->updated === 
true)
 
  713                        $this->ctrl->returnToParent($this, 
"jump".$this->hier_id);
 
  729                $this->updated = $this->content_obj->saveJS($this->pg_obj,
 
  730                        $_POST[
"ajaxform_content"],
 
  738                                $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  744                if ($this->updated !== 
true && is_array($this->updated))
 
  750                $a_pc_id_str = $this->content_obj->getLastSavedPcId($this->pg_obj, 
true);
 
  751                $ilCtrl->setParameterByClass(
$ilCtrl->getReturnClass($this), 
"updated_pc_id_str",
 
  752                        urlencode($a_pc_id_str));
 
  753                $ilCtrl->redirectByClass(
$ilCtrl->getReturnClass($this), 
"edit", 
"", 
true);
 
  763                $a_tpl->setCurrentBlock(
"help_item");
 
  764                $a_tpl->setVariable(
"TXT_HELP", 
"<b>".
$lng->txt(
"cont_syntax_help").
"</b>");
 
  765                $a_tpl->parseCurrentBlock();
 
  766                $a_tpl->setCurrentBlock(
"help_item");
 
  767                $a_tpl->setVariable(
"TXT_HELP", 
"* ".
$lng->txt(
"cont_bullet_list"));
 
  768                $a_tpl->parseCurrentBlock();
 
  769                $a_tpl->setCurrentBlock(
"help_item");
 
  770                $a_tpl->setVariable(
"TXT_HELP", 
"# ".
$lng->txt(
"cont_numbered_list"));
 
  771                $a_tpl->parseCurrentBlock();
 
  772                $a_tpl->setCurrentBlock(
"help_item");
 
  773                $a_tpl->setVariable(
"TXT_HELP", 
"=".
$lng->txt(
"cont_Headline1").
"=<br />".
 
  774                        "==".$lng->txt(
"cont_Headline2").
"==<br />".
 
  775                        "===".$lng->txt(
"cont_Headline3").
"===");
 
  776                $a_tpl->parseCurrentBlock();
 
  780                        $a_tpl->setCurrentBlock(
"help_item");
 
  781                        $a_tpl->setVariable(
"TXT_HELP", 
"[[".
$lng->txt(
"cont_wiki_page_link").
"]]");
 
  782                        $a_tpl->parseCurrentBlock();
 
  785                $a_tpl->setCurrentBlock(
"help");
 
  786                $a_tpl->parseCurrentBlock();
 
User interface class for advanced drop-down selection lists.
const ON_ITEM_CLICK_FORM_SELECT
_lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
getContentStylePath($a_style_id)
get content style path
static _lookupType($a_id, $a_reference=false)
lookup object type
saveJS()
Save paragraph by JS call.
insert()
insert paragraph form
insertCharacteristicTable($a_tpl, $a_seleted_value)
Insert characteristic table.
determineCharacteristic($a_insert=false)
Determine current characteristic.
outputError($a_err)
Output error.
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
& executeCommand()
execute command
createJS()
Create paragraph per JS.
editJS()
Edit paragraph (Ajax mode, sends the content of the paragraph)
create()
create new paragraph in dom and update page in db
static _getCharacteristics($a_style_id)
Get characteristics.
static getCharStyleSelector($a_par_type, $a_use_callback=true)
Get character style selector.
static getStyleSelector($a_selected, $a_chars, $a_use_callback=false)
Get style selector.
edit($a_insert=false)
edit paragraph form
insertHelp($a_tpl)
Insert Help.
insertStyleSelectionList($a_tpl, $a_selected)
Insert style selection list.
static _getStandardCharacteristics()
Get standard characteristics.
update()
update paragraph in dom and update page in db
ilPCParagraphGUI($a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
editMultipleJS()
Edit multiple paragraphs (Ajax mode, sends the content of the paragraphs)
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getHierId()
get hierarchical id in dom object
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
getPageConfig()
Get Page Config.
displayValidationError()
display validation errors
static _getCommonBBButtons()
Get common bb buttons.
getCharacteristics()
Get characteristics.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
setCharacteristics($a_chars)
Set Characteristics.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
special template class to simplify handling of ITX/PEAR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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.