ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCDataTableGUI Class Reference

Class ilPCTableGUI. More...

+ Inheritance diagram for ilPCDataTableGUI:
+ Collaboration diagram for ilPCDataTableGUI:

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 editDataCl ()
 Edit data of table. More...
 
 update ($a_redirect=true)
 Update table data in dom and update page in db. More...
 
 updateJS ()
 Update via JavaScript. More...
 
 getNewTableObject ()
 Get new table object. More...
 
 afterCreation ()
 After creation processing. More...
 
 tableAction ()
 Perform operation on table (adding, moving, deleting rows/cols) More...
 
 setTabs ($data_tab_txt_key="")
 Set tabs. More...
 
- Public Member Functions inherited from ilPCTableGUI
 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 setBasicTableCellStyles ()
 Set basic table cell styles. More...
 
 executeCommand ()
 execute command More...
 
 setTabs ($data_tab_txt_key="")
 Set tabs. More...
 
 setCellPropertiesSubTabs ()
 Set tabs. More...
 
 getTemplateOptions ($a_type="")
 Get table templates. More...
 
 edit ()
 
 editProperties ()
 edit properties form More...
 
 initPropertiesForm ($a_mode="edit")
 Init properties form. More...
 
 getPropertiesFormValues ()
 Get properties form. More...
 
 renderTable ($a_mode="table_edit", $a_submode="")
 Render the table. More...
 
 editCellStyle ()
 Edit cell styles. More...
 
 editCellWidth ()
 Edit cell widths. More...
 
 editCellSpan ()
 Edit cell spans. More...
 
 setStyles ()
 Set cell styles and. More...
 
 setWidths ()
 Set cell widths. More...
 
 setSpans ()
 Set cell spans. More...
 
 setProperties ()
 Set properties from input form. More...
 
 saveProperties ()
 save table properties in db and return to page edit screen More...
 
 rightAlign ()
 align table to right More...
 
 leftAlign ()
 align table to left More...
 
 centerAlign ()
 align table to left More...
 
 leftFloatAlign ()
 align table to left float More...
 
 rightFloatAlign ()
 align table to left More...
 
 insert ()
 insert new table form More...
 
 getNewTableObject ()
 Get new table object. More...
 
 create ()
 create new table in dom and update page in db More...
 
 afterCreation ()
 After creation processing. More...
 
 editCellAlignment ()
 Edit cell styles. More...
 
 setAlignment ()
 Set cell alignments. More...
 
 editData ()
 Edit data of table. More...
 
 getEditDataTable ($initial=false)
 
- Public Member Functions inherited from ilPageContentGUI
 __construct ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 display validation errors More...
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions ($a_type)
 Get table templates. More...
 

Protected Member Functions

 getCellContent (int $i, int $j)
 
- Protected Member Functions inherited from ilPCTableGUI
 setEditorToolContext ()
 Set editor tool context. More...
 
 getCellContent (int $i, int $j)
 
 renderCell ( $content, $unmask=true, $page_object=null)
 Static render table function. More...
 
 getColumnCaption (int $nr)
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 

Protected Attributes

 $tabs
 
 $main_tpl
 
- Protected Attributes inherited from ilPCTableGUI
 $tabs
 
 $user
 
 $tool_context
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPCTableGUI
static _renderTable ( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true, $page_object=null)
 Static render table function. More...
 
static _addStyleCheckboxes ($a_output, $a_table)
 Add style checkboxes in edit mode. More...
 
static _addAlignmentCheckboxes ($a_output, $a_table)
 Add alignment checkboxes in edit mode. More...
 
static _addWidthInputs ($a_output, $a_table)
 Add width inputs. More...
 
static _addSpanInputs ($a_output, $a_table)
 Add span inputs. More...
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static $common_bb_buttons
 

Detailed Description

Class ilPCTableGUI.

User Interface for Data Table Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 18 of file class.ilPCDataTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPCDataTableGUI::__construct ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

Definition at line 36 of file class.ilPCDataTableGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ilPageContentGUI\setCharacteristics().

37  {
38  global $DIC;
39 
40  $this->main_tpl = $DIC->ui()->mainTemplate();
41  $this->lng = $DIC->language();
42  $this->ctrl = $DIC->ctrl();
43  $this->tabs = $DIC->tabs();
44  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
45  $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
46  $this->tool_context = $DIC->globalScreen()->tool()->context();
47  }
setCharacteristics($a_chars)
Set Characteristics.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ afterCreation()

ilPCDataTableGUI::afterCreation ( )

After creation processing.

Definition at line 393 of file class.ilPCDataTableGUI.php.

References ilPageContentGUI\$ctrl.

394  {
395  $ilCtrl = $this->ctrl;
396 
397  $this->pg_obj->stripHierIDs();
398  $this->pg_obj->addHierIDs();
399  $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
400  $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
401  $ilCtrl->redirect($this, "editData");
402  }

◆ editDataCl()

ilPCDataTableGUI::editDataCl ( )

Edit data of table.

(classic version)

Definition at line 79 of file class.ilPCDataTableGUI.php.

References $_POST, ilPageContentGUI\$ctrl, $i, ilPageContentGUI\$lng, $res, ilPageContentGUI\$tpl, $type, ilPageContentGUI\displayValidationError(), ilPageContentGUI\getBBMenu(), ilPageContentGUI\getHierId(), ilUtil\getImagePath(), ilYuiUtil\initConnection(), ilYuiUtil\initDragDrop(), ilYuiUtil\initPanel(), setTabs(), ilUtil\stripSlashes(), ilPCParagraph\xml2output(), xpath_eval(), and xpath_new_context().

80  {
81  $lng = $this->lng;
82  $ilCtrl = $this->ctrl;
83  //var_dump($_GET);
84  //var_dump($_POST);
85 
86  $this->setTabs();
87 
88  $this->displayValidationError();
89 
90  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
91 
92  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata.html", "Services/COPage");
93  $dtpl = $this->tpl;
94  //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
95  $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
96  $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
97 
100  ilYuiUtil::initPanel(false);
101  $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
102  //$this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
103  $this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
104 
105  // get all rows
106  $xpc = xpath_new_context($this->dom);
107  $path = "//PageContent[@HierId='" . $this->getHierId() . "']" .
108  "/Table/TableRow";
109  $res = xpath_eval($xpc, $path);
110 
111  for ($i = 0; $i < count($res->nodeset); $i++) {
112  $xpc2 = xpath_new_context($this->dom);
113  $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" .
114  "/Table/TableRow[$i+1]/TableData";
115  $res2 = xpath_eval($xpc2, $path2);
116 
117  // if this is the first row -> col icons
118  if ($i == 0) {
119  for ($j = 0; $j < count($res2->nodeset); $j++) {
120  if ($j == 0) {
121  $dtpl->touchBlock("empty_td");
122  }
123 
124  if ($j == 0) {
125  if (count($res2->nodeset) == 1) {
126  $move_type = "none";
127  } else {
128  $move_type = "forward";
129  }
130  } elseif ($j == (count($res2->nodeset) - 1)) {
131  $move_type = "backward";
132  } else {
133  $move_type = "both";
134  }
135  $dtpl->setCurrentBlock("col_icon");
136  $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
137  $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
138  $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type);
139  $dtpl->setVariable("NR", $j);
140  $dtpl->parseCurrentBlock();
141  }
142  $dtpl->setCurrentBlock("row");
143  $dtpl->parseCurrentBlock();
144  }
145 
146 
147  for ($j = 0; $j < count($res2->nodeset); $j++) {
148  // first col: row icons
149  if ($j == 0) {
150  if ($i == 0) {
151  if (count($res->nodeset) == 1) {
152  $move_type = "none";
153  } else {
154  $move_type = "forward";
155  }
156  } elseif ($i == (count($res->nodeset) - 1)) {
157  $move_type = "backward";
158  } else {
159  $move_type = "both";
160  }
161  $dtpl->setCurrentBlock("row_icon");
162  $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
163  $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
164  $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type);
165  $dtpl->setVariable("NR", $i);
166  $dtpl->parseCurrentBlock();
167  }
168 
169  // cell
170  if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
171  $dtpl->setCurrentBlock("cell");
172 
173  if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
174  $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
175  } else {
176  $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j));
177  }
178 
179  $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
180  $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
181  $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
182 
183  $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
184  $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
185  // $dtpl->setVariable("WIDTH", "140");
186  // $dtpl->setVariable("HEIGHT", "80");
187  if ($cs > 1) {
188  $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
189  $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
190  }
191  if ($rs > 1) {
192  $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
193  $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
194  }
195  $dtpl->parseCurrentBlock();
196  }
197  }
198  $dtpl->setCurrentBlock("row");
199  $dtpl->parseCurrentBlock();
200  }
201 
202  // init menues
203  $types = array("row", "col");
204  $moves = array("none", "backward", "both", "forward");
205  $commands = array(
206  "row" => array( "newRowAfter" => "cont_ed_new_row_after",
207  "newRowBefore" => "cont_ed_new_row_before",
208  "moveRowUp" => "cont_ed_row_up",
209  "moveRowDown" => "cont_ed_row_down",
210  "deleteRow" => "cont_ed_delete_row"),
211  "col" => array( "newColAfter" => "cont_ed_new_col_after",
212  "newColBefore" => "cont_ed_new_col_before",
213  "moveColLeft" => "cont_ed_col_left",
214  "moveColRight" => "cont_ed_col_right",
215  "deleteCol" => "cont_ed_delete_col")
216  );
217  foreach ($types as $type) {
218  foreach ($moves as $move) {
219  foreach ($commands[$type] as $command => $lang_var) {
220  if ($move == "none" && (substr($command, 0, 4) == "move" || substr($command, 0, 6) == "delete")) {
221  continue;
222  }
223  if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
224  ($move == "forward" && (in_array($command, array("moveup", "moveleft"))))) {
225  continue;
226  }
227  $this->tpl->setCurrentBlock("menu_item");
228  $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
229  $this->tpl->setVariable("CMD", $command);
230  $this->tpl->setVariable("TYPE", $type);
231  $this->tpl->parseCurrentBlock();
232  }
233  $this->tpl->setCurrentBlock("menu");
234  $this->tpl->setVariable("TYPE", $type);
235  $this->tpl->setVariable("MOVE", $move);
236  $this->tpl->parseCurrentBlock();
237  }
238  }
239 
240  // update/cancel
241  $this->tpl->setCurrentBlock("commands");
242  $this->tpl->setVariable("BTN_NAME", "update");
243  $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
244  $this->tpl->parseCurrentBlock();
245 
246  $this->tpl->setVariable(
247  "FORMACTION2",
248  $ilCtrl->getFormAction($this, "tableAction")
249  );
250  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
251  }
xpath_new_context($dom_document)
$type
setTabs($data_tab_txt_key="")
Set tabs.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
getHierId()
get hierarchical id in dom object
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
foreach($_POST as $key=> $value) $res
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
displayValidationError()
display validation errors
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static initDragDrop(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop.
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ executeCommand()

ilPCDataTableGUI::executeCommand ( )

execute command

Definition at line 52 of file class.ilPCDataTableGUI.php.

References $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

53  {
54  $this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
55 
56  // get next class that processes or forwards current command
57  $next_class = $this->ctrl->getNextClass($this);
58 
59  // get current command
60  $cmd = $this->ctrl->getCmd();
61 
62  switch ($next_class) {
63  default:
64  $ret = $this->$cmd();
65  break;
66  }
67 
68  return $ret;
69  }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ getCellContent()

ilPCDataTableGUI::getCellContent ( int  $i,
int  $j 
)
protected

Definition at line 437 of file class.ilPCDataTableGUI.php.

References $_POST, ilUtil\stripSlashes(), ilPCParagraph\xml2output(), and ilPCParagraphGUI\xml2outputJS().

437  : string
438  {
439  if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
440  $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
441  } else {
442  $s_text = ilPCParagraph::xml2output(
443  $this->content_obj->getCellText($i, $j),
444  true,
445  false
446  );
447  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
449  $s_text,
450  "TableContent",
451  $this->content_obj->readPCId() . "_" . $i . "_" . $j
452  );
453  }
454 
455  // #20628
456  $s_text = str_replace("{", "&#123;", $s_text);
457  $s_text = str_replace("}", "&#125;", $s_text);
458  return $s_text;
459  }
static xml2outputJS($s_text)
Prepare content for js output.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ getNewTableObject()

ilPCDataTableGUI::getNewTableObject ( )

Get new table object.

Definition at line 385 of file class.ilPCDataTableGUI.php.

References ilPageContentGUI\getPage().

386  {
387  return new ilPCDataTable($this->getPage());
388  }
Class ilPCDataTable.
+ Here is the call graph for this function:

◆ setTabs()

ilPCDataTableGUI::setTabs (   $data_tab_txt_key = "")

Set tabs.

Definition at line 429 of file class.ilPCDataTableGUI.php.

References ilPageContentGUI\$ctrl, and $tabs.

Referenced by editDataCl().

430  {
431  $ilCtrl = $this->ctrl;
432  $ilTabs = $this->tabs;
433 
434  parent::setTabs("cont_ed_edit_data");
435  }
+ Here is the caller graph for this function:

◆ tableAction()

ilPCDataTableGUI::tableAction ( )

Perform operation on table (adding, moving, deleting rows/cols)

Definition at line 407 of file class.ilPCDataTableGUI.php.

References $_POST, $_SESSION, ilPageContentGUI\$ctrl, and update().

408  {
409  $ilCtrl = $this->ctrl;
410 
411  $this->update(false);
412  $this->pg_obj->addHierIDs();
413 
414  $cell_hier_id = ($_POST["type"] == "col")
415  ? $this->hier_id . "_1_" . ($_POST["id"] + 1)
416  : $this->hier_id . "_" . ($_POST["id"] + 1) . "_1";
417  $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
418  if (is_object($cell_obj)) {
419  $action = (string) ($_POST["action"]);
420  $cell_obj->$action();
421  $_SESSION["il_pg_error"] = $this->pg_obj->update();
422  }
423  $ilCtrl->redirect($this, "editData");
424  }
$_SESSION["AccountId"]
update($a_redirect=true)
Update table data in dom and update page in db.
$_POST["username"]
+ Here is the call graph for this function:

◆ update()

ilPCDataTableGUI::update (   $a_redirect = true)

Update table data in dom and update page in db.

Definition at line 256 of file class.ilPCDataTableGUI.php.

References $_POST, $data, $i, ilPageContentGUI\$lng, ilPCParagraph\_input2xml(), and ilPCTableGUI\editData().

Referenced by tableAction().

257  {
258  $lng = $this->lng;
259 
260  // handle input data
261  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
262  $data = array();
263  //var_dump($_POST["cell"]);
264  //var_dump($_GET);
265  if (is_array($_POST["cell"])) {
266  foreach ($_POST["cell"] as $i => $row) {
267  if (is_array($row)) {
268  foreach ($row as $j => $cell) {
269  $data[$i][$j] =
271  $cell,
272  $this->content_obj->getLanguage()
273  );
274  }
275  }
276  }
277  }
278 
279  $this->updated = $this->content_obj->setData($data);
280 
281  if ($this->updated !== true) {
282  $this->editData();
283  return;
284  }
285 
286  $this->updated = $this->pg_obj->update();
287 
288  if ($a_redirect) {
289  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
290  $this->ctrl->redirect($this, "editData");
291  }
292  }
editData()
Edit data of table.
$data
Definition: storeScorm.php:23
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateJS()

ilPCDataTableGUI::updateJS ( )

Update via JavaScript.

Definition at line 297 of file class.ilPCDataTableGUI.php.

References $_POST, ilPageContentGUI\$ctrl, $data, $failed, ilPageContentGUI\$lng, $ret, ilPCParagraph\_input2xml(), ilPCTableGUI\editData(), ilPCParagraph\handleAjaxContent(), ilPCParagraph\handleAjaxContentPost(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

298  {
299  $lng = $this->lng;
300  $ilCtrl = $this->ctrl;
301 
302  if ($_POST["cancel_update"]) {
303  // $this->ctrl->redirect($this, "editData");
304  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
305  }
306 
307  // handle input data
308  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
309  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
310  $data = array();
311  foreach ($_POST as $k => $content) {
312  if (substr($k, 0, 5) != "cell_") {
313  continue;
314  }
315 
316  // determine cell content
317  $div = ilUtil::stripSlashes($content, false);
318  $p1 = strpos($div, '>');
319  $div = substr($div, $p1 + 1);
320  $div = "<div class='ilc_text_block_TableContent'>" . $div;
321  $text = ilPCParagraph::handleAjaxContent($div);
322  if ($text === false) {
323  $ilCtrl->returnToParent($this, "jump" . $this->hier_id);
324  }
325  $text = $text["text"];
326 
328  $text,
329  $this->content_obj->getLanguage(),
330  true,
331  false
332  );
334 
335  // set content in data array
336  $id = explode("_", $k);
337  $data[(int) $id[1]][(int) $id[2]] = $text;
338  }
339 
340  // update data
341  $this->updated = $this->content_obj->setData($data);
342 
343  if ($this->updated !== true) {
344  $this->editData();
345  return;
346  }
347 
348  $this->updated = $this->pg_obj->update();
349 
350 
351  // perform table action? (move...?)
352  //$this->update(false);
353  $this->pg_obj->addHierIDs();
354  $failed = false;
355  if ($_POST["tab_cmd"] != "") {
356  $cell_hier_id = ($_POST["tab_cmd_type"] == "col")
357  ? $this->hier_id . "_1_" . ($_POST["tab_cmd_id"] + 1)
358  : $this->hier_id . "_" . ($_POST["tab_cmd_id"] + 1) . "_1";
359  $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
360  if (is_object($cell_obj)) {
361  $tab_cmd = $_POST["tab_cmd"];
362  $cell_obj->$tab_cmd();
363  $ret = $this->pg_obj->update();
364  if ($ret !== true) {
365  ilUtil::sendFailure($ret[0][1], true);
366  $failed = true;
367  }
368  }
369  }
370 
371  if (!$failed) {
372  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
373  }
374  if ($_POST["save_return"]) {
375  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
376  } else {
377  $this->ctrl->redirect($this, "editData");
378  }
379  }
editData()
Edit data of table.
$data
Definition: storeScorm.php:23
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
static handleAjaxContent($a_content)
Handle ajax content.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$failed
Definition: Utf8Test.php:85
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
$ret
Definition: parser.php:6
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $main_tpl

ilPCDataTableGUI::$main_tpl
protected

Definition at line 29 of file class.ilPCDataTableGUI.php.

◆ $tabs

ilPCDataTableGUI::$tabs
protected

Definition at line 23 of file class.ilPCDataTableGUI.php.

Referenced by setTabs().


The documentation for this class was generated from the following file: