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");
25 function __construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id =
"")
27 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
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"));
83 $this->tpl->addJavascript(
"./Services/COPage/phpBB/3_0_5/editor.js");
84 $this->tpl->addJavascript(
"./Services/COPage/js/page_editing.js");
85 $this->tpl->addJavascript(
"./Services/COPage/js/paragraph_editing.js");
89 $path =
"//PageContent[@HierId='".$this->getHierId().
"']".
93 for($i = 0; $i < count(
$res->nodeset); $i++)
97 $path2 =
"//PageContent[@HierId='".$this->getHierId().
"']".
98 "/Table/TableRow[$i+1]/TableData";
104 for($j = 0; $j < count($res2->nodeset); $j++)
108 $dtpl->touchBlock(
"empty_td");
113 if (count($res2->nodeset) == 1)
119 $move_type =
"forward";
122 else if ($j == (count($res2->nodeset) - 1))
124 $move_type =
"backward";
130 $dtpl->setCurrentBlock(
"col_icon");
131 $dtpl->setVariable(
"COL_ICON_ALT", $lng->txt(
"content_column"));
133 $dtpl->setVariable(
"COL_ONCLICK",
"COL_".$move_type);
134 $dtpl->setVariable(
"NR", $j);
135 $dtpl->parseCurrentBlock();
137 $dtpl->setCurrentBlock(
"row");
138 $dtpl->parseCurrentBlock();
142 for($j = 0; $j < count($res2->nodeset); $j++)
149 if (count(
$res->nodeset) == 1)
155 $move_type =
"forward";
158 else if ($i == (count(
$res->nodeset) - 1))
160 $move_type =
"backward";
166 $dtpl->setCurrentBlock(
"row_icon");
167 $dtpl->setVariable(
"ROW_ICON_ALT", $lng->txt(
"content_row"));
169 $dtpl->setVariable(
"ROW_ONCLICK",
"ROW_".$move_type);
170 $dtpl->setVariable(
"NR", $i);
171 $dtpl->parseCurrentBlock();
175 if ($res2->nodeset[$j]->get_attribute(
"Hidden") !=
"Y")
177 $dtpl->setCurrentBlock(
"cell");
179 if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) ==
"update")
188 $dtpl->setVariable(
"PAR_TA_NAME",
"cell[".$i.
"][".$j.
"]");
189 $dtpl->setVariable(
"PAR_TA_ID",
"cell_".$i.
"_".$j);
190 $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
192 $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
193 $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
198 $dtpl->setVariable(
"COLSPAN",
'colspan="'.$cs.
'"');
199 $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
203 $dtpl->setVariable(
"ROWSPAN",
'rowspan="'.$rs.
'"');
204 $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
206 $dtpl->parseCurrentBlock();
209 $dtpl->setCurrentBlock(
"row");
210 $dtpl->parseCurrentBlock();
214 $types =
array(
"row",
"col");
215 $moves =
array(
"none",
"backward",
"both",
"forward");
217 "row" =>
array(
"newRowAfter" =>
"cont_ed_new_row_after",
218 "newRowBefore" =>
"cont_ed_new_row_before",
219 "moveRowUp" =>
"cont_ed_row_up",
220 "moveRowDown" =>
"cont_ed_row_down",
221 "deleteRow" =>
"cont_ed_delete_row"),
222 "col" =>
array(
"newColAfter" =>
"cont_ed_new_col_after",
223 "newColBefore" =>
"cont_ed_new_col_before",
224 "moveColLeft" =>
"cont_ed_col_left",
225 "moveColRight" =>
"cont_ed_col_right",
226 "deleteCol" =>
"cont_ed_delete_col")
229 foreach($types as $type)
231 foreach($moves as $move)
233 foreach($commands[$type] as $command => $lang_var)
235 if ($move ==
"none" && (substr($command, 0, 4) ==
"move"))
239 if (($move ==
"backward" && (in_array($command,
array(
"movedown",
"moveright")))) ||
240 ($move ==
"forward" && (in_array($command,
array(
"moveup",
"moveleft")))))
244 $this->tpl->setCurrentBlock(
"menu_item");
245 $this->tpl->setVariable(
"MENU_ITEM_TITLE", $lng->txt($lang_var));
246 $this->tpl->setVariable(
"CMD", $command);
247 $this->tpl->setVariable(
"TYPE", $type);
248 $this->tpl->parseCurrentBlock();
250 $this->tpl->setCurrentBlock(
"menu");
251 $this->tpl->setVariable(
"TYPE", $type);
252 $this->tpl->setVariable(
"MOVE", $move);
253 $this->tpl->parseCurrentBlock();
258 $this->tpl->setCurrentBlock(
"commands");
259 $this->tpl->setVariable(
"BTN_NAME",
"update");
260 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
261 $this->tpl->parseCurrentBlock();
263 $this->tpl->setVariable(
"FORMACTION2",
264 $ilCtrl->getFormAction($this,
"tableAction"));
265 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
276 $ilBench->start(
"Editor",
"Data_Table_update");
279 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
283 if (is_array(
$_POST[
"cell"]))
289 foreach (
$row as $j => $cell)
293 $this->content_obj->getLanguage());
299 $this->updated = $this->content_obj->setData(
$data);
301 if ($this->updated !==
true)
303 $ilBench->stop(
"Editor",
"Data_Table_update");
308 $this->updated = $this->pg_obj->update();
309 $ilBench->stop(
"Editor",
"Data_Table_update");
314 $this->ctrl->redirect($this,
"editData");
325 if (
$_POST[
"cancel_update"])
328 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
332 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
333 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
335 foreach (
$_POST as $k => $content)
337 if (substr($k, 0, 5) !=
"cell_")
344 $p1 = strpos($div,
'>');
345 $div = substr($div, $p1 + 1);
346 $div =
"<div class='ilc_text_block_TableContent'>".$div;
350 $ilCtrl->returnToParent($this,
"jump".$this->hier_id);
355 $this->content_obj->getLanguage(),
true,
false);
359 $id = explode(
"_", $k);
364 $this->updated = $this->content_obj->setData(
$data);
366 if ($this->updated !==
true)
372 $this->updated = $this->pg_obj->update();
377 $this->pg_obj->addHierIDs();
378 if (
$_POST[
"tab_cmd"] !=
"")
380 $cell_hier_id = (
$_POST[
"tab_cmd_type"] ==
"col")
381 ? $this->hier_id.
"_1_".(
$_POST[
"tab_cmd_id"] + 1)
382 : $this->hier_id.
"_".(
$_POST[
"tab_cmd_id"] + 1).
"_1";
383 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
384 if (is_object($cell_obj))
386 $tab_cmd =
$_POST[
"tab_cmd"];
387 $cell_obj->$tab_cmd();
388 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
393 if (
$_POST[
"save_return"])
395 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
399 $this->ctrl->redirect($this,
"editData");
419 $this->pg_obj->stripHierIDs();
420 $this->pg_obj->addHierIDs();
421 $ilCtrl->setParameter($this,
"hier_id", $this->content_obj->readHierId());
422 $ilCtrl->setParameter($this,
"pc_id", $this->content_obj->readPCId());
423 $this->content_obj->setHierId($this->content_obj->readHierId());
424 $this->
setHierId($this->content_obj->readHierId());
425 $this->content_obj->setPCId($this->content_obj->readPCId());
437 $this->pg_obj->addHierIDs();
439 $cell_hier_id = (
$_POST[
"type"] ==
"col")
440 ? $this->hier_id.
"_1_".(
$_POST[
"id"] + 1)
441 : $this->hier_id.
"_".(
$_POST[
"id"] + 1).
"_1";
442 $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
443 if (is_object($cell_obj))
446 $cell_obj->$action();
447 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
449 $ilCtrl->redirect($this,
"editData");
461 $ilTabs->addTarget(
"cont_ed_edit_data",
462 $ilCtrl->getLinkTarget($this,
"editData"),
"editData",
493 include_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
497 $dtpl =
new ilTemplate(
"tpl.tabledata2.html",
true,
true,
"Services/COPage");
498 $dtpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"tableAction"));
501 $dtpl->setVariable(
"WYSIWYG_ACTION",
502 $ilCtrl->getFormAction($this,
"updateJS"));
506 $path =
"//PageContent[@HierId='".$this->getHierId().
"']".
510 for($i = 0; $i < count(
$res->nodeset); $i++)
514 $path2 =
"//PageContent[@HierId='".$this->getHierId().
"']".
515 "/Table/TableRow[$i+1]/TableData";
521 for($j = 0; $j < count($res2->nodeset); $j++)
525 $dtpl->touchBlock(
"empty_td");
530 if (count($res2->nodeset) == 1)
536 $move_type =
"forward";
539 else if ($j == (count($res2->nodeset) - 1))
541 $move_type =
"backward";
547 $dtpl->setCurrentBlock(
"col_icon");
548 $dtpl->setVariable(
"COL_ICON_ALT", $lng->txt(
"content_column"));
550 $dtpl->setVariable(
"COL_ONCLICK",
"COL_".$move_type);
551 $dtpl->setVariable(
"NR", $j);
552 $dtpl->parseCurrentBlock();
554 $dtpl->setCurrentBlock(
"row");
555 $dtpl->parseCurrentBlock();
559 for($j = 0; $j < count($res2->nodeset); $j++)
566 if (count(
$res->nodeset) == 1)
572 $move_type =
"forward";
575 else if ($i == (count(
$res->nodeset) - 1))
577 $move_type =
"backward";
583 $dtpl->setCurrentBlock(
"row_icon");
584 $dtpl->setVariable(
"ROW_ICON_ALT", $lng->txt(
"content_row"));
586 $dtpl->setVariable(
"ROW_ONCLICK",
"ROW_".$move_type);
587 $dtpl->setVariable(
"NR", $i);
588 $dtpl->parseCurrentBlock();
592 if ($res2->nodeset[$j]->get_attribute(
"Hidden") !=
"Y")
594 $dtpl->setCurrentBlock(
"cell");
596 if (is_array(
$_POST[
"cmd"]) && key(
$_POST[
"cmd"]) ==
"update")
604 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
606 $this->content_obj->readPCId().
"_".$i.
"_".$j);
610 $s_text = str_replace(
"{",
"{", $s_text);
611 $s_text = str_replace(
"}",
"}", $s_text);
613 $dtpl->setVariable(
"PAR_TA_NAME",
"cell[".$i.
"][".$j.
"]");
614 $dtpl->setVariable(
"PAR_TA_ID",
"cell_".$i.
"_".$j);
616 $dtpl->setVariable(
"PAR_TA_CONTENT", $s_text);
618 $cs = $res2->nodeset[$j]->get_attribute(
"ColSpan");
619 $rs = $res2->nodeset[$j]->get_attribute(
"RowSpan");
620 $dtpl->setVariable(
"WIDTH",
"140");
621 $dtpl->setVariable(
"HEIGHT",
"80");
624 $dtpl->setVariable(
"COLSPAN",
'colspan="'.$cs.
'"');
625 $dtpl->setVariable(
"WIDTH", (140 + ($cs - 1) * 146));
629 $dtpl->setVariable(
"ROWSPAN",
'rowspan="'.$rs.
'"');
630 $dtpl->setVariable(
"HEIGHT", (80 + ($rs - 1) * 86));
632 $dtpl->parseCurrentBlock();
635 $dtpl->setCurrentBlock(
"row");
636 $dtpl->parseCurrentBlock();
640 $types =
array(
"row",
"col");
641 $moves =
array(
"none",
"backward",
"both",
"forward");
643 "row" =>
array(
"newRowAfter" =>
"cont_ed_new_row_after",
644 "newRowBefore" =>
"cont_ed_new_row_before",
645 "moveRowUp" =>
"cont_ed_row_up",
646 "moveRowDown" =>
"cont_ed_row_down",
647 "deleteRow" =>
"cont_ed_delete_row"),
648 "col" =>
array(
"newColAfter" =>
"cont_ed_new_col_after",
649 "newColBefore" =>
"cont_ed_new_col_before",
650 "moveColLeft" =>
"cont_ed_col_left",
651 "moveColRight" =>
"cont_ed_col_right",
652 "deleteCol" =>
"cont_ed_delete_col")
655 foreach($types as $type)
657 foreach($moves as $move)
659 foreach($commands[$type] as $command => $lang_var)
661 if ($move ==
"none" && (substr($command, 0, 4) ==
"move"))
665 if (($move ==
"backward" && (in_array($command,
array(
"movedown",
"moveright")))) ||
666 ($move ==
"forward" && (in_array($command,
array(
"moveup",
"moveleft")))))
670 $dtpl->setCurrentBlock(
"menu_item");
671 $dtpl->setVariable(
"MENU_ITEM_TITLE", $lng->txt($lang_var));
672 $dtpl->setVariable(
"CMD", $command);
673 $dtpl->setVariable(
"TYPE", $type);
674 $dtpl->parseCurrentBlock();
676 $dtpl->setCurrentBlock(
"menu");
677 $dtpl->setVariable(
"TYPE", $type);
678 $dtpl->setVariable(
"MOVE", $move);
679 $dtpl->parseCurrentBlock();
684 $dtpl->setVariable(
"FORMACTION2",
685 $ilCtrl->getFormAction($this,
"tableAction"));
686 $dtpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_table"));
689 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
693 $GLOBALS[
"tpl"]->addJavascript(
"Services/COPage/tiny/4_2_4/tinymce.js");
694 $GLOBALS[
"tpl"]->addJavaScript(
"./Services/COPage/js/ilcopagecallback.js");
695 $GLOBALS[
"tpl"]->addJavascript(
"Services/COPage/js/page_editing.js");
697 $GLOBALS[
"tpl"]->addOnloadCode(
"var preloader = new Image(); 698 preloader.src = './templates/default/images/loader.svg'; 699 ilCOPage.setContentCss('".
702 ilCOPage.editTD('cell_0_0'); 716 $dtpl->setVariable(
"IL_TINY_MENU",
718 $this->pg_obj->getParentType(),
719 $cfg->getEnableInternalLinks(),
720 $cfg->getEnableWikiLinks(),
721 $cfg->getEnableKeywords(),
723 false,
true, $cfg->getEnableAnchors(),
false));
726 if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks())
728 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
729 $dtpl->setCurrentBlock(
"int_link_prep");
731 $ilCtrl->getLinkTargetByClass(
array(
"ilpageeditorgui",
"ilinternallinkgui"),
732 "",
false,
true,
false)));
735 $this->tpl->setContent($dtpl->get());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
__construct(&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
Constructor public.
tableAction()
Perform operation on table (adding, moving, deleting rows/cols)
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
updateJS()
Update via JavaScript.
executeCommand()
execute command
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
update($a_redirect=true)
Update table data in dom and update page in db.
Add rich text string
The name of the decorator.
getPageConfig()
Get Page Config.
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.
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
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
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.
Create styles array
The data for the language used.
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.
static initPanel($a_resize=false)
Init yui panel.
editDataCl()
Edit data of table.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
static getContentStylePath($a_style_id)
get content style path
getNewTableObject()
Get new table object.
static initDragDrop()
Init YUI Drag and Drop.
setHierId($a_hier_id)
get hierarchical id in dom object