4require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
 
    5require_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
 
    6require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
   30    public function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id = 
"")
 
   34        $this->lng = 
$DIC->language();
 
   35        $this->ctrl = 
$DIC->ctrl();
 
   36        $this->tabs = 
$DIC->tabs();
 
   37        parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
 
   38        $this->
setCharacteristics(array(
"StandardTable" => $this->lng->txt(
"cont_StandardTable")));
 
   49        $next_class = $this->ctrl->getNextClass($this);
 
   52        $cmd = $this->ctrl->getCmd();
 
   54        switch ($next_class) {
 
   82        include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
   84        $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.tabledata.html", 
"Services/COPage");
 
   87        $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"tableAction"));
 
   88        $dtpl->setVariable(
"BB_MENU", $this->
getBBMenu(
"cell_0_0"));
 
   93        $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
 
   94        $this->tpl->addJavascript(
"./Services/COPage/js/page_editing.js");
 
   95        $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
 
  103        for (
$i = 0; 
$i < count(
$res->nodeset); 
$i++) {
 
  105            $path2 = 
"//PageContent[@HierId='" . $this->
getHierId() . 
"']" .
 
  106                "/Table/TableRow[$i+1]/TableData";
 
  111                for ($j = 0; $j < count($res2->nodeset); $j++) {
 
  113                        $dtpl->touchBlock(
"empty_td");
 
  117                        if (count($res2->nodeset) == 1) {
 
  120                            $move_type = 
"forward";
 
  122                    } elseif ($j == (count($res2->nodeset) - 1)) {
 
  123                        $move_type = 
"backward";
 
  127                    $dtpl->setCurrentBlock(
"col_icon");
 
  128                    $dtpl->setVariable(
"COL_ICON_ALT", 
$lng->txt(
"content_column"));
 
  130                    $dtpl->setVariable(
"COL_ONCLICK", 
"COL_" . $move_type);
 
  131                    $dtpl->setVariable(
"NR", $j);
 
  132                    $dtpl->parseCurrentBlock();
 
  134                $dtpl->setCurrentBlock(
"row");
 
  135                $dtpl->parseCurrentBlock();
 
  139            for ($j = 0; $j < count($res2->nodeset); $j++) {
 
  143                        if (count(
$res->nodeset) == 1) {
 
  146                            $move_type = 
"forward";
 
  148                    } elseif (
$i == (count(
$res->nodeset) - 1)) {
 
  149                        $move_type = 
"backward";
 
  153                    $dtpl->setCurrentBlock(
"row_icon");
 
  154                    $dtpl->setVariable(
"ROW_ICON_ALT", 
$lng->txt(
"content_row"));
 
  156                    $dtpl->setVariable(
"ROW_ONCLICK", 
"ROW_" . $move_type);
 
  157                    $dtpl->setVariable(
"NR", 
$i);
 
  158                    $dtpl->parseCurrentBlock();
 
  162                if ($res2->nodeset[$j]->get_attribute(
"Hidden") != 
"Y") {
 
  163                    $dtpl->setCurrentBlock(
"cell");
 
  165                    if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) == 
"update") {
 
  171                    $dtpl->setVariable(
"PAR_TA_NAME", 
"cell[" . 
$i . 
"][" . $j . 
"]");
 
  172                    $dtpl->setVariable(
"PAR_TA_ID", 
"cell_" . 
$i . 
"_" . $j);
 
  173                    $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  175                    $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
 
  176                    $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
 
  180                        $dtpl->setVariable(
"COLSPAN", 
'colspan="' . $cs . 
'"');
 
  181                        $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
 
  184                        $dtpl->setVariable(
"ROWSPAN", 
'rowspan="' . $rs . 
'"');
 
  185                        $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
 
  187                    $dtpl->parseCurrentBlock();
 
  190            $dtpl->setCurrentBlock(
"row");
 
  191            $dtpl->parseCurrentBlock();
 
  195        $types = array(
"row", 
"col");
 
  196        $moves = array(
"none", 
"backward", 
"both", 
"forward");
 
  198            "row" => array(     
"newRowAfter" => 
"cont_ed_new_row_after",
 
  199                            "newRowBefore" => 
"cont_ed_new_row_before",
 
  200                            "moveRowUp" => 
"cont_ed_row_up",
 
  201                            "moveRowDown" => 
"cont_ed_row_down",
 
  202                            "deleteRow" => 
"cont_ed_delete_row"),
 
  203            "col" => array(     
"newColAfter" => 
"cont_ed_new_col_after",
 
  204                            "newColBefore" => 
"cont_ed_new_col_before",
 
  205                            "moveColLeft" => 
"cont_ed_col_left",
 
  206                            "moveColRight" => 
"cont_ed_col_right",
 
  207                            "deleteCol" => 
"cont_ed_delete_col")
 
  209        foreach ($types as 
$type) {
 
  210            foreach ($moves as $move) {
 
  211                foreach ($commands[
$type] as $command => $lang_var) {
 
  212                    if ($move == 
"none" && (substr($command, 0, 4) == 
"move" || substr($command, 0, 6) == 
"delete")) {
 
  215                    if (($move == 
"backward" && (in_array($command, array(
"movedown", 
"moveright")))) ||
 
  216                        ($move == 
"forward" && (in_array($command, array(
"moveup", 
"moveleft"))))) {
 
  219                    $this->tpl->setCurrentBlock(
"menu_item");
 
  220                    $this->tpl->setVariable(
"MENU_ITEM_TITLE", 
$lng->txt($lang_var));
 
  221                    $this->tpl->setVariable(
"CMD", $command);
 
  222                    $this->tpl->setVariable(
"TYPE", 
$type);
 
  223                    $this->tpl->parseCurrentBlock();
 
  225                $this->tpl->setCurrentBlock(
"menu");
 
  226                $this->tpl->setVariable(
"TYPE", 
$type);
 
  227                $this->tpl->setVariable(
"MOVE", $move);
 
  228                $this->tpl->parseCurrentBlock();
 
  233        $this->tpl->setCurrentBlock(
"commands");
 
  234        $this->tpl->setVariable(
"BTN_NAME", 
"update");
 
  235        $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  236        $this->tpl->parseCurrentBlock();
 
  238        $this->tpl->setVariable(
 
  240            $ilCtrl->getFormAction($this, 
"tableAction")
 
  242        $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
 
  248    public function update($a_redirect = 
true)
 
  253        include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
  257        if (is_array(
$_POST[
"cell"])) {
 
  259                if (is_array(
$row)) {
 
  260                    foreach (
$row as $j => $cell) {
 
  264                                $this->content_obj->getLanguage()
 
  271        $this->updated = $this->content_obj->setData(
$data);
 
  273        if ($this->updated !== 
true) {
 
  278        $this->updated = $this->pg_obj->update();
 
  281            ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"), 
true);
 
  282            $this->ctrl->redirect($this, 
"editData");
 
  294        if (
$_POST[
"cancel_update"]) {
 
  296            $this->ctrl->returnToParent($this, 
"jump" . $this->hier_id);
 
  300        include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
  301        include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
 
  303        foreach (
$_POST as $k => $content) {
 
  304            if (substr($k, 0, 5) != 
"cell_") {
 
  310            $p1 = strpos($div, 
'>');
 
  311            $div = substr($div, $p1 + 1);
 
  312            $div = 
"<div class='ilc_text_block_TableContent'>" . $div;
 
  314            if (
$text === 
false) {
 
  315                $ilCtrl->returnToParent($this, 
"jump" . $this->hier_id);
 
  321                $this->content_obj->getLanguage(),
 
  328            $id = explode(
"_", $k);
 
  333        $this->updated = $this->content_obj->setData(
$data);
 
  335        if ($this->updated !== 
true) {
 
  340        $this->updated = $this->pg_obj->update();
 
  345        $this->pg_obj->addHierIDs();
 
  347        if (
$_POST[
"tab_cmd"] != 
"") {
 
  348            $cell_hier_id = (
$_POST[
"tab_cmd_type"] == 
"col")
 
  349                ? $this->hier_id . 
"_1_" . (
$_POST[
"tab_cmd_id"] + 1)
 
  350                : $this->hier_id . 
"_" . (
$_POST[
"tab_cmd_id"] + 1) . 
"_1";
 
  351            $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
 
  352            if (is_object($cell_obj)) {
 
  353                $tab_cmd = 
$_POST[
"tab_cmd"];
 
  354                $cell_obj->$tab_cmd();
 
  355                $ret = $this->pg_obj->update();
 
  364            ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"), 
true);
 
  366        if (
$_POST[
"save_return"]) {
 
  367            $this->ctrl->returnToParent($this, 
"jump" . $this->hier_id);
 
  369            $this->ctrl->redirect($this, 
"editData");
 
  389        $this->pg_obj->stripHierIDs();
 
  390        $this->pg_obj->addHierIDs();
 
  391        $ilCtrl->setParameter($this, 
"hier_id", $this->content_obj->readHierId());
 
  392        $ilCtrl->setParameter($this, 
"pc_id", $this->content_obj->readPCId());
 
  393        $this->content_obj->setHierId($this->content_obj->readHierId());
 
  394        $this->
setHierId($this->content_obj->readHierId());
 
  395        $this->content_obj->setPCId($this->content_obj->readPCId());
 
  407        $this->pg_obj->addHierIDs();
 
  409        $cell_hier_id = (
$_POST[
"type"] == 
"col")
 
  410            ? $this->hier_id . 
"_1_" . (
$_POST[
"id"] + 1)
 
  411            : $this->hier_id . 
"_" . (
$_POST[
"id"] + 1) . 
"_1";
 
  412        $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
 
  413        if (is_object($cell_obj)) {
 
  415            $cell_obj->$action();
 
  416            $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
 
  418        $ilCtrl->redirect($this, 
"editData");
 
  433            $ilCtrl->getLinkTarget($this, 
"editData"),
 
  465        include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
  469        $dtpl = 
new ilTemplate(
"tpl.tabledata2.html", 
true, 
true, 
"Services/COPage");
 
  470        $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"tableAction"));
 
  475            $ilCtrl->getFormAction($this, 
"updateJS")
 
  484        for (
$i = 0; 
$i < count(
$res->nodeset); 
$i++) {
 
  486            $path2 = 
"//PageContent[@HierId='" . $this->
getHierId() . 
"']" .
 
  487                "/Table/TableRow[$i+1]/TableData";
 
  492                for ($j = 0; $j < count($res2->nodeset); $j++) {
 
  494                        $dtpl->touchBlock(
"empty_td");
 
  498                        if (count($res2->nodeset) == 1) {
 
  501                            $move_type = 
"forward";
 
  503                    } elseif ($j == (count($res2->nodeset) - 1)) {
 
  504                        $move_type = 
"backward";
 
  508                    $dtpl->setCurrentBlock(
"col_icon");
 
  509                    $dtpl->setVariable(
"COL_ICON_ALT", 
$lng->txt(
"content_column"));
 
  511                    $dtpl->setVariable(
"COL_ONCLICK", 
"COL_" . $move_type);
 
  512                    $dtpl->setVariable(
"NR", $j);
 
  513                    $dtpl->parseCurrentBlock();
 
  515                $dtpl->setCurrentBlock(
"row");
 
  516                $dtpl->parseCurrentBlock();
 
  520            for ($j = 0; $j < count($res2->nodeset); $j++) {
 
  524                        if (count(
$res->nodeset) == 1) {
 
  527                            $move_type = 
"forward";
 
  529                    } elseif (
$i == (count(
$res->nodeset) - 1)) {
 
  530                        $move_type = 
"backward";
 
  534                    $dtpl->setCurrentBlock(
"row_icon");
 
  535                    $dtpl->setVariable(
"ROW_ICON_ALT", 
$lng->txt(
"content_row"));
 
  537                    $dtpl->setVariable(
"ROW_ONCLICK", 
"ROW_" . $move_type);
 
  538                    $dtpl->setVariable(
"NR", 
$i);
 
  539                    $dtpl->parseCurrentBlock();
 
  543                if ($res2->nodeset[$j]->get_attribute(
"Hidden") != 
"Y") {
 
  544                    $dtpl->setCurrentBlock(
"cell");
 
  546                    if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) == 
"update") {
 
  550                            $this->content_obj->getCellText(
$i, $j),
 
  554                        include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
 
  558                            $this->content_obj->readPCId() . 
"_" . 
$i . 
"_" . $j
 
  563                    $s_text = str_replace(
"{", 
"{", $s_text);
 
  564                    $s_text = str_replace(
"}", 
"}", $s_text);
 
  566                    $dtpl->setVariable(
"PAR_TA_NAME", 
"cell[" . 
$i . 
"][" . $j . 
"]");
 
  567                    $dtpl->setVariable(
"PAR_TA_ID", 
"cell_" . 
$i . 
"_" . $j);
 
  569                    $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  571                    $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
 
  572                    $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
 
  573                    $dtpl->setVariable(
"WIDTH", 
"140");
 
  574                    $dtpl->setVariable(
"HEIGHT", 
"80");
 
  576                        $dtpl->setVariable(
"COLSPAN", 
'colspan="' . $cs . 
'"');
 
  577                        $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
 
  580                        $dtpl->setVariable(
"ROWSPAN", 
'rowspan="' . $rs . 
'"');
 
  581                        $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
 
  583                    $dtpl->parseCurrentBlock();
 
  586            $dtpl->setCurrentBlock(
"row");
 
  587            $dtpl->parseCurrentBlock();
 
  591        $types = array(
"row", 
"col");
 
  592        $moves = array(
"none", 
"backward", 
"both", 
"forward");
 
  594            "row" => array(     
"newRowAfter" => 
"cont_ed_new_row_after",
 
  595                            "newRowBefore" => 
"cont_ed_new_row_before",
 
  596                            "moveRowUp" => 
"cont_ed_row_up",
 
  597                            "moveRowDown" => 
"cont_ed_row_down",
 
  598                            "deleteRow" => 
"cont_ed_delete_row"),
 
  599            "col" => array(     
"newColAfter" => 
"cont_ed_new_col_after",
 
  600                            "newColBefore" => 
"cont_ed_new_col_before",
 
  601                            "moveColLeft" => 
"cont_ed_col_left",
 
  602                            "moveColRight" => 
"cont_ed_col_right",
 
  603                            "deleteCol" => 
"cont_ed_delete_col")
 
  606        foreach ($types as 
$type) {
 
  607            foreach ($moves as $move) {
 
  608                foreach ($commands[
$type] as $command => $lang_var) {
 
  609                    if ($move == 
"none" && (substr($command, 0, 4) == 
"move" || substr($command, 0, 6) == 
"delete")) {
 
  612                    if (($move == 
"backward" && (in_array($command, array(
"movedown", 
"moveright")))) ||
 
  613                        ($move == 
"forward" && (in_array($command, array(
"moveup", 
"moveleft"))))) {
 
  616                    $dtpl->setCurrentBlock(
"menu_item");
 
  617                    $dtpl->setVariable(
"MENU_ITEM_TITLE", 
$lng->txt($lang_var));
 
  618                    $dtpl->setVariable(
"CMD", $command);
 
  619                    $dtpl->setVariable(
"TYPE", 
$type);
 
  620                    $dtpl->parseCurrentBlock();
 
  622                $dtpl->setCurrentBlock(
"menu");
 
  623                $dtpl->setVariable(
"TYPE", 
$type);
 
  624                $dtpl->setVariable(
"MOVE", $move);
 
  625                $dtpl->parseCurrentBlock();
 
  632            $ilCtrl->getFormAction($this, 
"tableAction")
 
  634        $dtpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
 
  637        include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
 
  642        $GLOBALS[
"tpl"]->addJavascript(
"./libs/bower/bower_components/tinymce/tinymce.min.js");
 
  643        $GLOBALS[
"tpl"]->addJavaScript(
"./Services/COPage/js/ilcopagecallback.js");
 
  644        $GLOBALS[
"tpl"]->addJavascript(
"Services/COPage/js/page_editing.js");
 
  646        $GLOBALS[
"tpl"]->addOnloadCode(
"var preloader = new Image(); 
  647                        preloader.src = './templates/default/images/loader.svg'; 
  648                        ilCOPage.setContentCss('" .
 
  651                        ilCOPage.editTD('cell_0_0'); 
  654            $GLOBALS[
"tpl"]->addOnloadCode(
"ilCOPage.addTextFormat('" . 
$c . 
"');");
 
  662                $this->pg_obj->getParentType(),
 
  663                $cfg->getEnableInternalLinks(),
 
  664                $cfg->getEnableWikiLinks(),
 
  665                $cfg->getEnableKeywords(),
 
  669                $cfg->getEnableAnchors(),
 
  675        if (
$cfg->getEnableInternalLinks() || 
$cfg->getEnableWikiLinks()) {
 
  676            include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
 
  677            $dtpl->setCurrentBlock(
"int_link_prep");
 
  680                    array(
"ilpageeditorgui", 
"ilinternallinkgui"),
 
  689        $this->tpl->setContent($dtpl->get());
 
An exception for terminatinating execution or to throw for unit testing.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
getNewTableObject()
Get new table object.
update($a_redirect=true)
Update table data in dom and update page in db.
afterCreation()
After creation processing.
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor @access public.
tableAction()
Perform operation on table (adding, moving, deleting rows/cols)
editDataCl()
Edit data of table.
editData()
Edit data of table.
updateJS()
Update via JavaScript.
executeCommand()
execute command
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
static _getTextCharacteristics($a_style_id, $a_include_core=false)
Get text characteristics.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
static handleAjaxContent($a_content)
Handle ajax content.
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
getHierId()
get hierarchical id in dom object
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
getPageConfig()
Get Page Config.
displayValidationError()
display validation errors
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
setCharacteristics($a_chars)
Set Characteristics.
setHierId($a_hier_id)
get hierarchical id in dom object
getStyleId()
Get Style Id.
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
static getTinyMenu( $a_par_type, $a_int_links=false, $a_wiki_links=false, $a_keywords=false, $a_style_id=0, $a_paragraph_styles=true, $a_save_return=true, $a_anchors=false, $a_save_new=true, $a_user_links=false)
Get Tiny Menu.
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initDragDrop()
Init YUI Drag and Drop.
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
if(!array_key_exists('StateId', $_REQUEST)) $id
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
foreach($_POST as $key=> $value) $res
catch(Exception $e) if(isset( $_POST[ 'cancel'])) if(isset($_POST['continue'])) $cfg