4 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
 
    5 require_once(
"./Services/COPage/classes/class.ilPCTableGUI.php");
 
    6 require_once(
"./Services/COPage/classes/class.ilPageContentGUI.php");
 
   28                 $this->
setCharacteristics(array(
"StandardTable" => $this->lng->txt(
"cont_StandardTable")));
 
   39                 $next_class = $this->ctrl->getNextClass($this);
 
   42                 $cmd = $this->ctrl->getCmd();
 
   68                 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
   70                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.tabledata.html", 
"Services/COPage");
 
   73                 $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"tableAction"));
 
   74                 $dtpl->setVariable(
"BB_MENU", $this->
getBBMenu(
"cell_0_0"));
 
   76                 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
 
   77                 $this->tpl->addJavascript(
"./Services/COPage/js/page_editing.js");
 
   81                 $path = 
"//PageContent[@HierId='".$this->getHierId().
"']".
 
   85                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
   89                         $path2 = 
"//PageContent[@HierId='".$this->getHierId().
"']".
 
   90                                 "/Table/TableRow[$i+1]/TableData";
 
   96                                 for($j = 0; $j < count($res2->nodeset); $j++)
 
  100                                                 $dtpl->touchBlock(
"empty_td");
 
  105                                                 if (count($res2->nodeset) == 1)
 
  111                                                         $move_type = 
"forward";
 
  114                                         else if ($j == (count($res2->nodeset) - 1))
 
  116                                                 $move_type = 
"backward";
 
  122                                         $dtpl->setCurrentBlock(
"col_icon");
 
  123                                         $dtpl->setVariable(
"COL_ICON_ALT", $lng->txt(
"content_column"));
 
  125                                         $dtpl->setVariable(
"COL_ONCLICK", 
"COL_".$move_type);
 
  126                                         $dtpl->setVariable(
"NR", $j);
 
  127                                         $dtpl->parseCurrentBlock();
 
  129                                 $dtpl->setCurrentBlock(
"row");
 
  130                                 $dtpl->parseCurrentBlock();
 
  134                         for($j = 0; $j < count($res2->nodeset); $j++)
 
  141                                                 if (count(
$res->nodeset) == 1)
 
  147                                                         $move_type = 
"forward";
 
  150                                         else if ($i == (count(
$res->nodeset) - 1))
 
  152                                                 $move_type = 
"backward";
 
  158                                         $dtpl->setCurrentBlock(
"row_icon");
 
  159                                         $dtpl->setVariable(
"ROW_ICON_ALT", $lng->txt(
"content_row"));
 
  161                                         $dtpl->setVariable(
"ROW_ONCLICK", 
"ROW_".$move_type);
 
  162                                         $dtpl->setVariable(
"NR", $i);
 
  163                                         $dtpl->parseCurrentBlock();
 
  167                                 if ($res2->nodeset[$j]->get_attribute(
"Hidden") != 
"Y")
 
  169                                         $dtpl->setCurrentBlock(
"cell");
 
  171                                         if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) == 
"update")
 
  180                                         $dtpl->setVariable(
"PAR_TA_NAME", 
"cell[".$i.
"][".$j.
"]");
 
  181                                         $dtpl->setVariable(
"PAR_TA_ID", 
"cell_".$i.
"_".$j);
 
  182                                         $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
 
  184                                         $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
 
  185                                         $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
 
  186                                         $dtpl->setVariable(
"WIDTH", 
"140");
 
  187                                         $dtpl->setVariable(
"HEIGHT", 
"80");
 
  190                                                 $dtpl->setVariable(
"COLSPAN", 
'colspan="'.$cs.
'"');
 
  191                                                 $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
 
  195                                                 $dtpl->setVariable(
"ROWSPAN", 
'rowspan="'.$rs.
'"');
 
  196                                                 $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
 
  198                                         $dtpl->parseCurrentBlock();
 
  201                         $dtpl->setCurrentBlock(
"row");
 
  202                         $dtpl->parseCurrentBlock();
 
  206                 $types = array(
"row", 
"col");
 
  207                 $moves = array(
"none", 
"backward", 
"both", 
"forward");
 
  209                         "row" => array( 
"newRowAfter" => 
"cont_ed_new_row_after",
 
  210                                                         "newRowBefore" => 
"cont_ed_new_row_before",
 
  211                                                         "moveRowUp" => 
"cont_ed_row_up",
 
  212                                                         "moveRowDown" => 
"cont_ed_row_down",
 
  213                                                         "deleteRow" => 
"cont_ed_delete_row"),
 
  214                         "col" => array( 
"newColAfter" => 
"cont_ed_new_col_after",
 
  215                                                         "newColBefore" => 
"cont_ed_new_col_before",
 
  216                                                         "moveColLeft" => 
"cont_ed_col_left",
 
  217                                                         "moveColRight" => 
"cont_ed_col_right",
 
  218                                                         "deleteCol" => 
"cont_ed_delete_col")
 
  221                 foreach($types as $type)
 
  223                         foreach($moves as $move)
 
  225                                 foreach($commands[$type] as 
$command => $lang_var)
 
  227                                         if ($move == 
"none" && (substr(
$command, 0, 4) == 
"move"))
 
  231                                         if (($move == 
"backward" && (in_array(
$command, array(
"movedown", 
"moveright")))) ||
 
  232                                                 ($move == 
"forward" && (in_array(
$command, array(
"moveup", 
"moveleft")))))
 
  236                                         $this->tpl->setCurrentBlock(
"menu_item");
 
  237                                         $this->tpl->setVariable(
"MENU_ITEM_TITLE", $lng->txt($lang_var));
 
  238                                         $this->tpl->setVariable(
"CMD", 
$command);
 
  239                                         $this->tpl->setVariable(
"TYPE", $type);
 
  240                                         $this->tpl->parseCurrentBlock();
 
  242                                 $this->tpl->setCurrentBlock(
"menu");
 
  243                                 $this->tpl->setVariable(
"TYPE", $type);
 
  244                                 $this->tpl->setVariable(
"MOVE", $move);
 
  245                                 $this->tpl->parseCurrentBlock();
 
  250                 $this->tpl->setCurrentBlock(
"commands");
 
  251                 $this->tpl->setVariable(
"BTN_NAME", 
"update");
 
  252                 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
 
  253                 $this->tpl->parseCurrentBlock();
 
  255                 $this->tpl->setVariable(
"FORMACTION2",
 
  256                         $ilCtrl->getFormAction($this, 
"tableAction"));
 
  257                 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
 
  268                 $ilBench->start(
"Editor",
"Data_Table_update");
 
  271                 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
  275                 if (is_array(
$_POST[
"cell"]))
 
  281                                         foreach (
$row as $j => $cell)
 
  285                                                                 $this->content_obj->getLanguage());
 
  291                 $this->updated = $this->content_obj->setData(
$data);
 
  293                 if ($this->updated !== 
true)
 
  295                         $ilBench->stop(
"Editor",
"Data_Table_update");
 
  300                 $this->updated = $this->pg_obj->update();
 
  301                 $ilBench->stop(
"Editor",
"Data_Table_update");
 
  306                         $this->ctrl->redirect($this, 
"editData");
 
  325                 $this->pg_obj->stripHierIDs();
 
  326                 $this->pg_obj->addHierIDs();
 
  327                 $ilCtrl->setParameter($this, 
"hier_id", $this->content_obj->readHierId());
 
  328                 $ilCtrl->setParameter($this, 
"pc_id", $this->content_obj->readPCId());
 
  329                 $this->content_obj->setHierId($this->content_obj->readHierId());
 
  330                 $this->
setHierId($this->content_obj->readHierId());
 
  331                 $this->content_obj->setPCId($this->content_obj->readPCId());
 
  343                 $this->pg_obj->addHierIDs();
 
  345                 $cell_hier_id = (
$_POST[
"type"] == 
"col")
 
  346                         ? $this->hier_id.
"_1_".(
$_POST[
"id"] + 1)
 
  347                         : $this->hier_id.
"_".(
$_POST[
"id"] + 1).
"_1";
 
  348                 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
 
  349                 if (is_object($cell_obj))
 
  351                         $cell_obj->$_POST[
"action"]();
 
  352                         $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
 
  354                 $ilCtrl->redirect($this, 
"editData");
 
  366                 $ilTabs->addTarget(
"cont_ed_edit_data",
 
  367                         $ilCtrl->getLinkTarget($this, 
"editData"), 
"editData",