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");
27 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
28 $this->
setCharacteristics(array(
"StandardTable" => $this->lng->txt(
"cont_StandardTable")));
39 $next_class = $this->ctrl->getNextClass($this);
42 $cmd = $this->ctrl->getCmd();
72 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
74 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.tabledata.html",
"Services/COPage");
77 $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"tableAction"));
78 $dtpl->setVariable(
"BB_MENU", $this->
getBBMenu(
"cell_0_0"));
80 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
81 $this->tpl->addJavascript(
"./Services/COPage/js/page_editing.js");
82 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
86 $path =
"//PageContent[@HierId='".$this->getHierId().
"']".
90 for($i = 0; $i < count(
$res->nodeset); $i++)
94 $path2 =
"//PageContent[@HierId='".$this->getHierId().
"']".
95 "/Table/TableRow[$i+1]/TableData";
101 for($j = 0; $j < count($res2->nodeset); $j++)
105 $dtpl->touchBlock(
"empty_td");
110 if (count($res2->nodeset) == 1)
116 $move_type =
"forward";
119 else if ($j == (count($res2->nodeset) - 1))
121 $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++)
146 if (count(
$res->nodeset) == 1)
152 $move_type =
"forward";
155 else if ($i == (count(
$res->nodeset) - 1))
157 $move_type =
"backward";
163 $dtpl->setCurrentBlock(
"row_icon");
164 $dtpl->setVariable(
"ROW_ICON_ALT", $lng->txt(
"content_row"));
166 $dtpl->setVariable(
"ROW_ONCLICK",
"ROW_".$move_type);
167 $dtpl->setVariable(
"NR", $i);
168 $dtpl->parseCurrentBlock();
172 if ($res2->nodeset[$j]->get_attribute(
"Hidden") !=
"Y")
174 $dtpl->setCurrentBlock(
"cell");
176 if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) ==
"update")
185 $dtpl->setVariable(
"PAR_TA_NAME",
"cell[".$i.
"][".$j.
"]");
186 $dtpl->setVariable(
"PAR_TA_ID",
"cell_".$i.
"_".$j);
187 $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
189 $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
190 $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
195 $dtpl->setVariable(
"COLSPAN",
'colspan="'.$cs.
'"');
196 $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
200 $dtpl->setVariable(
"ROWSPAN",
'rowspan="'.$rs.
'"');
201 $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
203 $dtpl->parseCurrentBlock();
206 $dtpl->setCurrentBlock(
"row");
207 $dtpl->parseCurrentBlock();
211 $types = array(
"row",
"col");
212 $moves = array(
"none",
"backward",
"both",
"forward");
214 "row" => array(
"newRowAfter" =>
"cont_ed_new_row_after",
215 "newRowBefore" =>
"cont_ed_new_row_before",
216 "moveRowUp" =>
"cont_ed_row_up",
217 "moveRowDown" =>
"cont_ed_row_down",
218 "deleteRow" =>
"cont_ed_delete_row"),
219 "col" => array(
"newColAfter" =>
"cont_ed_new_col_after",
220 "newColBefore" =>
"cont_ed_new_col_before",
221 "moveColLeft" =>
"cont_ed_col_left",
222 "moveColRight" =>
"cont_ed_col_right",
223 "deleteCol" =>
"cont_ed_delete_col")
226 foreach($types as $type)
228 foreach($moves as $move)
230 foreach($commands[$type] as $command => $lang_var)
232 if ($move ==
"none" && (substr($command, 0, 4) ==
"move"))
236 if (($move ==
"backward" && (in_array($command, array(
"movedown",
"moveright")))) ||
237 ($move ==
"forward" && (in_array($command, array(
"moveup",
"moveleft")))))
241 $this->tpl->setCurrentBlock(
"menu_item");
242 $this->tpl->setVariable(
"MENU_ITEM_TITLE", $lng->txt($lang_var));
243 $this->tpl->setVariable(
"CMD", $command);
244 $this->tpl->setVariable(
"TYPE", $type);
245 $this->tpl->parseCurrentBlock();
247 $this->tpl->setCurrentBlock(
"menu");
248 $this->tpl->setVariable(
"TYPE", $type);
249 $this->tpl->setVariable(
"MOVE", $move);
250 $this->tpl->parseCurrentBlock();
255 $this->tpl->setCurrentBlock(
"commands");
256 $this->tpl->setVariable(
"BTN_NAME",
"update");
257 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
258 $this->tpl->parseCurrentBlock();
260 $this->tpl->setVariable(
"FORMACTION2",
261 $ilCtrl->getFormAction($this,
"tableAction"));
262 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
273 $ilBench->start(
"Editor",
"Data_Table_update");
276 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
280 if (is_array(
$_POST[
"cell"]))
286 foreach (
$row as $j => $cell)
290 $this->content_obj->getLanguage());
296 $this->updated = $this->content_obj->setData(
$data);
298 if ($this->updated !==
true)
300 $ilBench->stop(
"Editor",
"Data_Table_update");
305 $this->updated = $this->pg_obj->update();
306 $ilBench->stop(
"Editor",
"Data_Table_update");
311 $this->ctrl->redirect($this,
"editData");
322 if (
$_POST[
"cancel_update"])
325 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
329 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
330 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
332 foreach (
$_POST as $k => $content)
334 if (substr($k, 0, 5) !=
"cell_")
341 $p1 = strpos($div,
'>');
342 $div = substr($div, $p1 + 1);
343 $div =
"<div class='ilc_text_block_TableContent'>".$div;
347 $ilCtrl->returnToParent($this,
"jump".$this->hier_id);
349 $text = $text[
"text"];
352 $this->content_obj->getLanguage(),
true,
false);
356 $id = explode(
"_", $k);
357 $data[(int) $id[1]][(
int) $id[2]] = $text;
361 $this->updated = $this->content_obj->setData(
$data);
363 if ($this->updated !==
true)
369 $this->updated = $this->pg_obj->update();
374 $this->pg_obj->addHierIDs();
376 if (
$_POST[
"tab_cmd"] !=
"")
378 $cell_hier_id = (
$_POST[
"tab_cmd_type"] ==
"col")
379 ? $this->hier_id.
"_1_".(
$_POST[
"tab_cmd_id"] + 1)
380 : $this->hier_id.
"_".(
$_POST[
"tab_cmd_id"] + 1).
"_1";
381 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
382 if (is_object($cell_obj))
384 $cell_obj->$_POST[
"tab_cmd"]();
385 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
390 if (
$_POST[
"save_return"])
392 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
396 $this->ctrl->redirect($this,
"editData");
416 $this->pg_obj->stripHierIDs();
417 $this->pg_obj->addHierIDs();
418 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
419 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
420 $this->content_obj->setHierId($this->content_obj->readHierId());
421 $this->
setHierId($this->content_obj->readHierId());
422 $this->content_obj->setPCId($this->content_obj->readPCId());
434 $this->pg_obj->addHierIDs();
436 $cell_hier_id = (
$_POST[
"type"] ==
"col")
437 ? $this->hier_id.
"_1_".(
$_POST[
"id"] + 1)
438 : $this->hier_id.
"_".(
$_POST[
"id"] + 1).
"_1";
439 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
440 if (is_object($cell_obj))
442 $cell_obj->$_POST[
"action"]();
443 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
445 $ilCtrl->redirect($this,
"editData");
457 $ilTabs->addTarget(
"cont_ed_edit_data",
458 $ilCtrl->getLinkTarget($this,
"editData"),
"editData",
489 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
493 $dtpl =
new ilTemplate(
"tpl.tabledata2.html",
true,
true,
"Services/COPage");
494 $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"tableAction"));
497 $dtpl->setVariable(
"WYSIWYG_ACTION",
498 $ilCtrl->getFormAction($this,
"updateJS"));
502 $path =
"//PageContent[@HierId='".$this->getHierId().
"']".
506 for($i = 0; $i < count(
$res->nodeset); $i++)
510 $path2 =
"//PageContent[@HierId='".$this->getHierId().
"']".
511 "/Table/TableRow[$i+1]/TableData";
517 for($j = 0; $j < count($res2->nodeset); $j++)
521 $dtpl->touchBlock(
"empty_td");
526 if (count($res2->nodeset) == 1)
532 $move_type =
"forward";
535 else if ($j == (count($res2->nodeset) - 1))
537 $move_type =
"backward";
543 $dtpl->setCurrentBlock(
"col_icon");
544 $dtpl->setVariable(
"COL_ICON_ALT", $lng->txt(
"content_column"));
546 $dtpl->setVariable(
"COL_ONCLICK",
"COL_".$move_type);
547 $dtpl->setVariable(
"NR", $j);
548 $dtpl->parseCurrentBlock();
550 $dtpl->setCurrentBlock(
"row");
551 $dtpl->parseCurrentBlock();
555 for($j = 0; $j < count($res2->nodeset); $j++)
562 if (count(
$res->nodeset) == 1)
568 $move_type =
"forward";
571 else if ($i == (count(
$res->nodeset) - 1))
573 $move_type =
"backward";
579 $dtpl->setCurrentBlock(
"row_icon");
580 $dtpl->setVariable(
"ROW_ICON_ALT", $lng->txt(
"content_row"));
582 $dtpl->setVariable(
"ROW_ONCLICK",
"ROW_".$move_type);
583 $dtpl->setVariable(
"NR", $i);
584 $dtpl->parseCurrentBlock();
588 if ($res2->nodeset[$j]->get_attribute(
"Hidden") !=
"Y")
590 $dtpl->setCurrentBlock(
"cell");
592 if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) ==
"update")
600 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
602 $this->content_obj->readPCId().
"_".$i.
"_".$j);
606 $s_text = str_replace(
"{",
"{", $s_text);
607 $s_text = str_replace(
"}",
"}", $s_text);
609 $dtpl->setVariable(
"PAR_TA_NAME",
"cell[".$i.
"][".$j.
"]");
610 $dtpl->setVariable(
"PAR_TA_ID",
"cell_".$i.
"_".$j);
612 $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
614 $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
615 $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
616 $dtpl->setVariable(
"WIDTH",
"140");
617 $dtpl->setVariable(
"HEIGHT",
"80");
620 $dtpl->setVariable(
"COLSPAN",
'colspan="'.$cs.
'"');
621 $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
625 $dtpl->setVariable(
"ROWSPAN",
'rowspan="'.$rs.
'"');
626 $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
628 $dtpl->parseCurrentBlock();
631 $dtpl->setCurrentBlock(
"row");
632 $dtpl->parseCurrentBlock();
636 $types = array(
"row",
"col");
637 $moves = array(
"none",
"backward",
"both",
"forward");
639 "row" => array(
"newRowAfter" =>
"cont_ed_new_row_after",
640 "newRowBefore" =>
"cont_ed_new_row_before",
641 "moveRowUp" =>
"cont_ed_row_up",
642 "moveRowDown" =>
"cont_ed_row_down",
643 "deleteRow" =>
"cont_ed_delete_row"),
644 "col" => array(
"newColAfter" =>
"cont_ed_new_col_after",
645 "newColBefore" =>
"cont_ed_new_col_before",
646 "moveColLeft" =>
"cont_ed_col_left",
647 "moveColRight" =>
"cont_ed_col_right",
648 "deleteCol" =>
"cont_ed_delete_col")
651 foreach($types as $type)
653 foreach($moves as $move)
655 foreach($commands[$type] as $command => $lang_var)
657 if ($move ==
"none" && (substr($command, 0, 4) ==
"move"))
661 if (($move ==
"backward" && (in_array($command, array(
"movedown",
"moveright")))) ||
662 ($move ==
"forward" && (in_array($command, array(
"moveup",
"moveleft")))))
666 $dtpl->setCurrentBlock(
"menu_item");
667 $dtpl->setVariable(
"MENU_ITEM_TITLE", $lng->txt($lang_var));
668 $dtpl->setVariable(
"CMD", $command);
669 $dtpl->setVariable(
"TYPE", $type);
670 $dtpl->parseCurrentBlock();
672 $dtpl->setCurrentBlock(
"menu");
673 $dtpl->setVariable(
"TYPE", $type);
674 $dtpl->setVariable(
"MOVE", $move);
675 $dtpl->parseCurrentBlock();
680 $dtpl->setVariable(
"FORMACTION2",
681 $ilCtrl->getFormAction($this,
"tableAction"));
682 $dtpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
685 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
689 $GLOBALS[
"tpl"]->addJavascript(
"Services/COPage/tiny/4_1_5/tinymce.js");
690 $GLOBALS[
"tpl"]->addJavaScript(
"./Services/COPage/js/ilcopagecallback.js");
691 $GLOBALS[
"tpl"]->addJavascript(
"Services/COPage/js/page_editing.js");
693 $GLOBALS[
"tpl"]->addOnloadCode(
"var preloader = new Image(); 694 preloader.src = './templates/default/images/loader.svg'; 695 ilCOPage.setContentCss('".
698 ilCOPage.editTD('cell_0_0'); 712 $dtpl->setVariable(
"IL_TINY_MENU",
714 $this->pg_obj->getParentType(),
715 $cfg->getEnableInternalLinks(),
716 $cfg->getEnableWikiLinks(),
717 $cfg->getEnableKeywords(),
719 false,
true, $cfg->getEnableAnchors(),
false));
722 if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks())
724 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
725 $dtpl->setCurrentBlock(
"int_link_prep");
727 $ilCtrl->getLinkTargetByClass(array(
"ilpageeditorgui",
"ilinternallinkgui"),
728 "",
false,
true,
false)));
731 $this->tpl->setContent($dtpl->get());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
tableAction()
Perform operation on table (adding, moving, deleting rows/cols)
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
updateJS()
Update via JavaScript.
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
xpath_new_context($dom_document)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static initConnection()
Init YUI Connection module.
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
update($a_redirect=true)
Update table data in dom and update page in db.
getPageConfig()
Get Page Config.
ilPCDataTableGUI(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
setCharacteristics($a_chars)
Set Characteristics.
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true)
Converts xml from DB to output in edit textarea.
afterCreation()
After creation processing.
static handleAjaxContent($a_content)
Handle ajax content.
& executeCommand()
execute command
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
displayValidationError()
display validation errors
getStyleId()
Get Style Id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
editData()
Edit data of table.
static initPanel($a_resize=false)
Init yui panel.
_doJSEditing()
checks if current user has activated js editing and if browser is js capable
editDataCl()
Edit data of table.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
getNewTableObject()
Get new table object.
getContentStylePath($a_style_id)
get content style path
static initDragDrop()
Init YUI Drag and Drop.
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)
Get Tiny Menu.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
setHierId($a_hier_id)
get hierarchical id in dom object