ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPCDataTableGUI Class Reference

Class ilPCTableGUI. More...

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

Public Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from ilPCTableGUI
static _renderTable ($content, $a_mode="table_edit", $a_submode="", $a_table_obj=null)
 Static render table function.
static _addStyleCheckboxes ($a_output, $a_table)
 Add style checkboxes in edit mode.
static _addAlignmentCheckboxes ($a_output, $a_table)
 Add alignment checkboxes in edit mode.
static _addWidthInputs ($a_output, $a_table)
 Add width inputs.
static _addSpanInputs ($a_output, $a_table)
 Add span inputs.
- Data Fields inherited from ilPageContentGUI
 $content_obj
 $ilias
 $tpl
 $lng
 $ctrl
 $pg_obj
 $hier_id
 $dom
 $updated
 $target_script
 $return_location
 $page_config = null
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style.
- 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.

Member Function Documentation

ilPCDataTableGUI::afterCreation ( )

After creation processing.

Reimplemented from ilPCTableGUI.

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

References $ilCtrl, editData(), and ilPageContentGUI\setHierId().

{
global $ilCtrl;
$this->pg_obj->stripHierIDs();
$this->pg_obj->addHierIDs();
$ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
$ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
$this->content_obj->setHierId($this->content_obj->readHierId());
$this->setHierId($this->content_obj->readHierId());
$this->content_obj->setPCId($this->content_obj->readPCId());
$this->editData();
}

+ Here is the call graph for this function:

ilPCDataTableGUI::editData ( )

Edit data of table.

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

References $_POST, $GLOBALS, $ilCtrl, ilPageContentGUI\$lng, $path, $res, ilPageContentGUI\$tpl, ilPageEditorGUI\_doJSEditing(), ilPageContentGUI\displayValidationError(), editDataCl(), ilObjStyleSheet\getContentStylePath(), ilUtil\getImagePath(), ilPageContentGUI\getStyleId(), ilUtil\getStyleSheetLocation(), ilPageObjectGUI\getTinyMenu(), ilYuiUtil\initConnection(), ilYuiUtil\initDragDrop(), ilYuiUtil\initPanel(), setTabs(), ilUtil\stripSlashes(), ilPCParagraph\xml2output(), ilPCParagraphGUI\xml2outputJS(), xpath_eval(), and xpath_new_context().

Referenced by afterCreation(), update(), and updateJS().

{
global $lng, $ilCtrl;
{
return $this->editDataCl();
}
//var_dump($_GET);
//var_dump($_POST);
$this->setTabs();
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
$dtpl = $this->tpl;
//$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
$dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
// $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
// $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
// $this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
$this->tpl->setVariable("WYSIWYG_ACTION",
$ilCtrl->getFormAction($this, "updateJS"));
// get all rows
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$xpc2 = xpath_new_context($this->dom);
$path2 = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow[$i+1]/TableData";
$res2 =& xpath_eval($xpc2, $path2);
// if this is the first row -> col icons
if ($i == 0)
{
for($j = 0; $j < count($res2->nodeset); $j++)
{
if ($j == 0)
{
$dtpl->touchBlock("empty_td");
}
if ($j == 0)
{
if (count($res2->nodeset) == 1)
{
$move_type = "none";
}
else
{
$move_type = "forward";
}
}
else if ($j == (count($res2->nodeset) - 1))
{
$move_type = "backward";
}
else
{
$move_type = "both";
}
$dtpl->setCurrentBlock("col_icon");
$dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
$dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
$dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
$dtpl->setVariable("NR", $j);
$dtpl->parseCurrentBlock();
}
$dtpl->setCurrentBlock("row");
$dtpl->parseCurrentBlock();
}
for($j = 0; $j < count($res2->nodeset); $j++)
{
// first col: row icons
if ($j == 0)
{
if ($i == 0)
{
if (count($res->nodeset) == 1)
{
$move_type = "none";
}
else
{
$move_type = "forward";
}
}
else if ($i == (count($res->nodeset) - 1))
{
$move_type = "backward";
}
else
{
$move_type = "both";
}
$dtpl->setCurrentBlock("row_icon");
$dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
$dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
$dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
$dtpl->setVariable("NR", $i);
$dtpl->parseCurrentBlock();
}
// cell
if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
{
$dtpl->setCurrentBlock("cell");
if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
{
$s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
}
else
{
$s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j),
true, false);
include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
$s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent",
$this->content_obj->readPCId()."_".$i."_".$j);
}
$dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
$dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
$dtpl->setVariable("PAR_TA_CONTENT", $s_text);
$cs = $res2->nodeset[$j]->get_attribute("ColSpan");
$rs = $res2->nodeset[$j]->get_attribute("RowSpan");
$dtpl->setVariable("WIDTH", "140");
$dtpl->setVariable("HEIGHT", "80");
if ($cs > 1)
{
$dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
$dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
}
if ($rs > 1)
{
$dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
$dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
}
$dtpl->parseCurrentBlock();
}
}
$dtpl->setCurrentBlock("row");
$dtpl->parseCurrentBlock();
}
// init menues
$types = array("row", "col");
$moves = array("none", "backward", "both", "forward");
$commands = array(
"row" => array( "newRowAfter" => "cont_ed_new_row_after",
"newRowBefore" => "cont_ed_new_row_before",
"moveRowUp" => "cont_ed_row_up",
"moveRowDown" => "cont_ed_row_down",
"deleteRow" => "cont_ed_delete_row"),
"col" => array( "newColAfter" => "cont_ed_new_col_after",
"newColBefore" => "cont_ed_new_col_before",
"moveColLeft" => "cont_ed_col_left",
"moveColRight" => "cont_ed_col_right",
"deleteCol" => "cont_ed_delete_col")
);
foreach($types as $type)
{
foreach($moves as $move)
{
foreach($commands[$type] as $command => $lang_var)
{
if ($move == "none" && (substr($command, 0, 4) == "move"))
{
continue;
}
if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
{
continue;
}
$this->tpl->setCurrentBlock("menu_item");
$this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
$this->tpl->setVariable("CMD", $command);
$this->tpl->setVariable("TYPE", $type);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("menu");
$this->tpl->setVariable("TYPE", $type);
$this->tpl->setVariable("MOVE", $move);
$this->tpl->parseCurrentBlock();
}
}
$this->tpl->setVariable("FORMACTION2",
$ilCtrl->getFormAction($this, "tableAction"));
$this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
// js editing preparation
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
//$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
$GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_0_12/tinymce.js");
$GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
//$GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
$GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing_4_0_12.js");
$GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
preloader.src = './templates/default/images/loader.gif';
ilCOPage.setContentCss('".
", ".ilUtil::getStyleSheetLocation().", ./Services/COPage/css/tiny_extra.css');
ilCOPage.editTD('cell_0_0');
");
$this->tpl->setVariable("IL_TINY_MENU",
$this->pg_obj->getParentType(),
false,
$this->pg_obj->getParentType() == "wpg",
false,
$this->getStyleId(),
false, true, false, false));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCDataTableGUI::editDataCl ( )

Edit data of table.

(classic version)

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

References $_POST, $ilCtrl, ilPageContentGUI\$lng, $path, $res, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ilPageContentGUI\getBBMenu(), ilUtil\getImagePath(), setTabs(), ilUtil\stripSlashes(), ilPCParagraph\xml2output(), xpath_eval(), and xpath_new_context().

Referenced by editData().

{
global $lng, $ilCtrl;
//var_dump($_GET);
//var_dump($_POST);
$this->setTabs();
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata.html", "Services/COPage");
$dtpl = $this->tpl;
//$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
$dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
$dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
$this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
//$this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
$this->tpl->addJavascript("./Services/COPage/js/paragraph_editing.js");
$this->tpl->addJavascript("./Services/COPage/js/page_editing_4_0_12.js");
// get all rows
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$xpc2 = xpath_new_context($this->dom);
$path2 = "//PageContent[@HierId='".$this->getHierId()."']".
"/Table/TableRow[$i+1]/TableData";
$res2 =& xpath_eval($xpc2, $path2);
// if this is the first row -> col icons
if ($i == 0)
{
for($j = 0; $j < count($res2->nodeset); $j++)
{
if ($j == 0)
{
$dtpl->touchBlock("empty_td");
}
if ($j == 0)
{
if (count($res2->nodeset) == 1)
{
$move_type = "none";
}
else
{
$move_type = "forward";
}
}
else if ($j == (count($res2->nodeset) - 1))
{
$move_type = "backward";
}
else
{
$move_type = "both";
}
$dtpl->setCurrentBlock("col_icon");
$dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
$dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
$dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
$dtpl->setVariable("NR", $j);
$dtpl->parseCurrentBlock();
}
$dtpl->setCurrentBlock("row");
$dtpl->parseCurrentBlock();
}
for($j = 0; $j < count($res2->nodeset); $j++)
{
// first col: row icons
if ($j == 0)
{
if ($i == 0)
{
if (count($res->nodeset) == 1)
{
$move_type = "none";
}
else
{
$move_type = "forward";
}
}
else if ($i == (count($res->nodeset) - 1))
{
$move_type = "backward";
}
else
{
$move_type = "both";
}
$dtpl->setCurrentBlock("row_icon");
$dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
$dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
$dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
$dtpl->setVariable("NR", $i);
$dtpl->parseCurrentBlock();
}
// cell
if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
{
$dtpl->setCurrentBlock("cell");
if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
{
$s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
}
else
{
$s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j));
}
$dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
$dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
$dtpl->setVariable("PAR_TA_CONTENT", $s_text);
$cs = $res2->nodeset[$j]->get_attribute("ColSpan");
$rs = $res2->nodeset[$j]->get_attribute("RowSpan");
// $dtpl->setVariable("WIDTH", "140");
// $dtpl->setVariable("HEIGHT", "80");
if ($cs > 1)
{
$dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
$dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
}
if ($rs > 1)
{
$dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
$dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
}
$dtpl->parseCurrentBlock();
}
}
$dtpl->setCurrentBlock("row");
$dtpl->parseCurrentBlock();
}
// init menues
$types = array("row", "col");
$moves = array("none", "backward", "both", "forward");
$commands = array(
"row" => array( "newRowAfter" => "cont_ed_new_row_after",
"newRowBefore" => "cont_ed_new_row_before",
"moveRowUp" => "cont_ed_row_up",
"moveRowDown" => "cont_ed_row_down",
"deleteRow" => "cont_ed_delete_row"),
"col" => array( "newColAfter" => "cont_ed_new_col_after",
"newColBefore" => "cont_ed_new_col_before",
"moveColLeft" => "cont_ed_col_left",
"moveColRight" => "cont_ed_col_right",
"deleteCol" => "cont_ed_delete_col")
);
foreach($types as $type)
{
foreach($moves as $move)
{
foreach($commands[$type] as $command => $lang_var)
{
if ($move == "none" && (substr($command, 0, 4) == "move"))
{
continue;
}
if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
{
continue;
}
$this->tpl->setCurrentBlock("menu_item");
$this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
$this->tpl->setVariable("CMD", $command);
$this->tpl->setVariable("TYPE", $type);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("menu");
$this->tpl->setVariable("TYPE", $type);
$this->tpl->setVariable("MOVE", $move);
$this->tpl->parseCurrentBlock();
}
}
// update/cancel
$this->tpl->setCurrentBlock("commands");
$this->tpl->setVariable("BTN_NAME", "update");
$this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
$this->tpl->parseCurrentBlock();
$this->tpl->setVariable("FORMACTION2",
$ilCtrl->getFormAction($this, "tableAction"));
$this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPCDataTableGUI::executeCommand ( )

execute command

Reimplemented from ilPCTableGUI.

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

References $cmd, $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

{
$this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
// get next class that processes or forwards current command
$next_class = $this->ctrl->getNextClass($this);
// get current command
$cmd = $this->ctrl->getCmd();
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilPCDataTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented from ilPCTableGUI.

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

References ilPageContentGUI\getPage().

{
return new ilPCDataTable($this->getPage());
}

+ Here is the call graph for this function:

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

Constructor public.

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

References ilPageContentGUI\ilPageContentGUI(), and ilPageContentGUI\setCharacteristics().

{
parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
$this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
}

+ Here is the call graph for this function:

ilPCDataTableGUI::setTabs ( )

Set tabs.

Reimplemented from ilPCTableGUI.

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

References $ilCtrl.

Referenced by editData(), and editDataCl().

{
global $ilCtrl, $ilTabs;
$ilTabs->addTarget("cont_ed_edit_data",
$ilCtrl->getLinkTarget($this, "editData"), "editData",
get_class($this));
}

+ Here is the caller graph for this function:

ilPCDataTableGUI::tableAction ( )

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

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

References $_POST, $_SESSION, $ilCtrl, and update().

{
global $ilCtrl;
$this->update(false);
$this->pg_obj->addHierIDs();
$cell_hier_id = ($_POST["type"] == "col")
? $this->hier_id."_1_".($_POST["id"] + 1)
: $this->hier_id."_".($_POST["id"] + 1)."_1";
$cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
if (is_object($cell_obj))
{
$cell_obj->$_POST["action"]();
$_SESSION["il_pg_error"] = $this->pg_obj->update();
}
$ilCtrl->redirect($this, "editData");
}

+ Here is the call graph for this function:

ilPCDataTableGUI::update (   $a_redirect = true)

Update table data in dom and update page in db.

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

References $_POST, $ilBench, ilPageContentGUI\$lng, $row, ilPCParagraph\_input2xml(), editData(), and ilUtil\sendSuccess().

Referenced by tableAction().

{
global $ilBench, $lng;
$ilBench->start("Editor","Data_Table_update");
// handle input data
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
$data = array();
//var_dump($_POST["cell"]);
//var_dump($_GET);
if (is_array($_POST["cell"]))
{
foreach ($_POST["cell"] as $i => $row)
{
if (is_array($row))
{
foreach ($row as $j => $cell)
{
$data[$i][$j] =
$this->content_obj->getLanguage());
}
}
}
}
$this->updated = $this->content_obj->setData($data);
if ($this->updated !== true)
{
$ilBench->stop("Editor","Data_Table_update");
$this->editData();
return;
}
$this->updated = $this->pg_obj->update();
$ilBench->stop("Editor","Data_Table_update");
if ($a_redirect)
{
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "editData");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPCDataTableGUI::updateJS ( )

Update via JavaScript.

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

References $_POST, $_SESSION, $ilBench, $ilCtrl, ilPageContentGUI\$lng, ilPCParagraph\_input2xml(), editData(), ilPCParagraph\handleAjaxContent(), ilPCParagraph\handleAjaxContentPost(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

{
global $ilBench, $lng, $ilCtrl;
if ($_POST["cancel_update"])
{
// $this->ctrl->redirect($this, "editData");
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
// handle input data
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
$data = array();
foreach ($_POST as $k => $content)
{
if (substr($k, 0, 5) != "cell_")
{
continue;
}
// determine cell content
$div = ilUtil::stripSlashes($content, false);
$p1 = strpos($div, '>');
$div = substr($div, $p1 + 1);
$div = "<div class='ilc_text_block_TableContent'>".$div;
if ($text === false)
{
$ilCtrl->returnToParent($this, "jump".$this->hier_id);
}
$text = $text["text"];
$this->content_obj->getLanguage(), true, false);
// set content in data array
$id = explode("_", $k);
$data[(int) $id[1]][(int) $id[2]] = $text;
}
// update data
$this->updated = $this->content_obj->setData($data);
if ($this->updated !== true)
{
$this->editData();
return;
}
$this->updated = $this->pg_obj->update();
// perform table action? (move...?)
//$this->update(false);
$this->pg_obj->addHierIDs();
if ($_POST["tab_cmd"] != "")
{
$cell_hier_id = ($_POST["tab_cmd_type"] == "col")
? $this->hier_id."_1_".($_POST["tab_cmd_id"] + 1)
: $this->hier_id."_".($_POST["tab_cmd_id"] + 1)."_1";
$cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
if (is_object($cell_obj))
{
$cell_obj->$_POST["tab_cmd"]();
$_SESSION["il_pg_error"] = $this->pg_obj->update();
}
}
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
if ($_POST["save_return"])
{
$this->ctrl->returnToParent($this, "jump".$this->hier_id);
}
else
{
$this->ctrl->redirect($this, "editData");
}
}

+ Here is the call graph for this function:


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