ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 @access 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 ()
 Set tabs. More...
 
 editData ()
 Edit data of table. More...
 
- Public Member Functions inherited from ilPCTableGUI
 ilPCTableGUI (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor @access public. More...
 
 setBasicTableCellStyles ()
 Set basic table cell styles. More...
 
executeCommand ()
 execute command More...
 
 setTabs ()
 Set tabs. More...
 
 setCellPropertiesSubTabs ()
 Set tabs. More...
 
 getTemplateOptions ()
 Get table templates. More...
 
 edit ()
 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...
 
- Public Member Functions inherited from ilPageContentGUI
 ilPageContentGUI ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor @access 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...
 
 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...
 

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. 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
 
 $ilias
 
 $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;"
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- 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

◆ afterCreation()

ilPCDataTableGUI::afterCreation ( )

After creation processing.

Reimplemented from ilPCTableGUI.

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

413 {
414 global $ilCtrl;
415
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());
423 $this->editData();
424 }
editData()
Edit data of table.
setHierId($a_hier_id)
get hierarchical id in dom object
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

◆ editData()

ilPCDataTableGUI::editData ( )

Edit data of table.

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

472 {
473 global $lng, $ilCtrl;
474
475
477 {
478 return $this->editDataCl();
479 }
480
481//var_dump($_GET);
482//var_dump($_POST);
483
484 $this->setTabs();
485
486 $this->displayValidationError();
487
488
489 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
490
491 //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
492 //$dtpl = $this->tpl;
493 $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage");
494 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
495
496
497 $dtpl->setVariable("WYSIWYG_ACTION",
498 $ilCtrl->getFormAction($this, "updateJS"));
499
500 // get all rows
501 $xpc = xpath_new_context($this->dom);
502 $path = "//PageContent[@HierId='".$this->getHierId()."']".
503 "/Table/TableRow";
504 $res =& xpath_eval($xpc, $path);
505
506 for($i = 0; $i < count($res->nodeset); $i++)
507 {
508
509 $xpc2 = xpath_new_context($this->dom);
510 $path2 = "//PageContent[@HierId='".$this->getHierId()."']".
511 "/Table/TableRow[$i+1]/TableData";
512 $res2 =& xpath_eval($xpc2, $path2);
513
514 // if this is the first row -> col icons
515 if ($i == 0)
516 {
517 for($j = 0; $j < count($res2->nodeset); $j++)
518 {
519 if ($j == 0)
520 {
521 $dtpl->touchBlock("empty_td");
522 }
523
524 if ($j == 0)
525 {
526 if (count($res2->nodeset) == 1)
527 {
528 $move_type = "none";
529 }
530 else
531 {
532 $move_type = "forward";
533 }
534 }
535 else if ($j == (count($res2->nodeset) - 1))
536 {
537 $move_type = "backward";
538 }
539 else
540 {
541 $move_type = "both";
542 }
543 $dtpl->setCurrentBlock("col_icon");
544 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
545 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
546 $dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
547 $dtpl->setVariable("NR", $j);
548 $dtpl->parseCurrentBlock();
549 }
550 $dtpl->setCurrentBlock("row");
551 $dtpl->parseCurrentBlock();
552 }
553
554
555 for($j = 0; $j < count($res2->nodeset); $j++)
556 {
557 // first col: row icons
558 if ($j == 0)
559 {
560 if ($i == 0)
561 {
562 if (count($res->nodeset) == 1)
563 {
564 $move_type = "none";
565 }
566 else
567 {
568 $move_type = "forward";
569 }
570 }
571 else if ($i == (count($res->nodeset) - 1))
572 {
573 $move_type = "backward";
574 }
575 else
576 {
577 $move_type = "both";
578 }
579 $dtpl->setCurrentBlock("row_icon");
580 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
581 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
582 $dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
583 $dtpl->setVariable("NR", $i);
584 $dtpl->parseCurrentBlock();
585 }
586
587 // cell
588 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
589 {
590 $dtpl->setCurrentBlock("cell");
591
592 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
593 {
594 $s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
595 }
596 else
597 {
598 $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j),
599 true, false);
600 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
601 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent",
602 $this->content_obj->readPCId()."_".$i."_".$j);
603 }
604
605 // #20628
606 $s_text = str_replace("{", "&#123;", $s_text);
607 $s_text = str_replace("}", "&#125;", $s_text);
608
609 $dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
610 $dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
611
612 $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
613
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");
618 if ($cs > 1)
619 {
620 $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
621 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
622 }
623 if ($rs > 1)
624 {
625 $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
626 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
627 }
628 $dtpl->parseCurrentBlock();
629 }
630 }
631 $dtpl->setCurrentBlock("row");
632 $dtpl->parseCurrentBlock();
633 }
634
635 // init menues
636 $types = array("row", "col");
637 $moves = array("none", "backward", "both", "forward");
638 $commands = array(
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")
649 );
650
651 foreach($types as $type)
652 {
653 foreach($moves as $move)
654 {
655 foreach($commands[$type] as $command => $lang_var)
656 {
657 if ($move == "none" && (substr($command, 0, 4) == "move"))
658 {
659 continue;
660 }
661 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
662 ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
663 {
664 continue;
665 }
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();
671 }
672 $dtpl->setCurrentBlock("menu");
673 $dtpl->setVariable("TYPE", $type);
674 $dtpl->setVariable("MOVE", $move);
675 $dtpl->parseCurrentBlock();
676 }
677 }
678
679
680 $dtpl->setVariable("FORMACTION2",
681 $ilCtrl->getFormAction($this, "tableAction"));
682 $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
683
684 // js editing preparation
685 include_once("./Services/YUI/classes/class.ilYuiUtil.php");
689 $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_2_4/tinymce.js");
690 $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
691 $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
692
693 $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
694 preloader.src = './templates/default/images/loader.svg';
695 ilCOPage.setContentCss('".
697 ", ".ilUtil::getStyleSheetLocation().", ./Services/COPage/css/tiny_extra.css');
698 ilCOPage.editTD('cell_0_0');
699 ");
700
701 $cfg = $this->getPageConfig();
702 /*$tpl->setVariable("IL_TINY_MENU",
703 self::getTinyMenu(
704 $this->getPageObject()->getParentType(),
705 $cfg->getEnableInternalLinks(),
706 $cfg->getEnableWikiLinks(),
707 $cfg->getEnableKeywords(),
708 $this->getStyleId(), true, true,
709 $cfg->getEnableAnchors()
710 ));*/
711
712 $dtpl->setVariable("IL_TINY_MENU",
714 $this->pg_obj->getParentType(),
715 $cfg->getEnableInternalLinks(),
716 $cfg->getEnableWikiLinks(),
717 $cfg->getEnableKeywords(),
718 $this->getStyleId(),
719 false, true, $cfg->getEnableAnchors(), false));
720
721 // add int link parts
722 if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks())
723 {
724 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
725 $dtpl->setCurrentBlock("int_link_prep");
726 $dtpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
727 $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
728 "", false, true, false)));
729 }
730
731 $this->tpl->setContent($dtpl->get());
732 }
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
getContentStylePath($a_style_id)
get content style path
editDataCl()
Edit data of table.
static xml2outputJS($s_text, $char, $a_pc_id)
Prepare content for js output.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true)
Converts xml from DB to output in edit textarea.
getPageConfig()
Get Page Config.
displayValidationError()
display validation errors
_doJSEditing()
checks if current user has activated js editing and if browser is js capable
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.
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initDragDrop()
Init YUI Drag and Drop.
static initPanel($a_resize=false)
Init yui panel.
static initConnection()
Init YUI Connection module.
$_POST['username']
Definition: cron.php:12
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
$path
Definition: index.php:22

References $_POST, $GLOBALS, $ilCtrl, ilPageContentGUI\$lng, $path, $res, ilPageEditorGUI\_doJSEditing(), ilPageContentGUI\displayValidationError(), editDataCl(), ilObjStyleSheet\getContentStylePath(), ilUtil\getImagePath(), ilInternalLinkGUI\getInitHTML(), ilPageContentGUI\getPageConfig(), 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editDataCl()

ilPCDataTableGUI::editDataCl ( )

Edit data of table.

(classic version)

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

63 {
64 global $lng, $ilCtrl;
65//var_dump($_GET);
66//var_dump($_POST);
67
68 $this->setTabs();
69
71
72 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
73
74 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata.html", "Services/COPage");
75 $dtpl = $this->tpl;
76 //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
77 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
78 $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
79
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");
83
84 // get all rows
85 $xpc = xpath_new_context($this->dom);
86 $path = "//PageContent[@HierId='".$this->getHierId()."']".
87 "/Table/TableRow";
88 $res =& xpath_eval($xpc, $path);
89
90 for($i = 0; $i < count($res->nodeset); $i++)
91 {
92
93 $xpc2 = xpath_new_context($this->dom);
94 $path2 = "//PageContent[@HierId='".$this->getHierId()."']".
95 "/Table/TableRow[$i+1]/TableData";
96 $res2 =& xpath_eval($xpc2, $path2);
97
98 // if this is the first row -> col icons
99 if ($i == 0)
100 {
101 for($j = 0; $j < count($res2->nodeset); $j++)
102 {
103 if ($j == 0)
104 {
105 $dtpl->touchBlock("empty_td");
106 }
107
108 if ($j == 0)
109 {
110 if (count($res2->nodeset) == 1)
111 {
112 $move_type = "none";
113 }
114 else
115 {
116 $move_type = "forward";
117 }
118 }
119 else if ($j == (count($res2->nodeset) - 1))
120 {
121 $move_type = "backward";
122 }
123 else
124 {
125 $move_type = "both";
126 }
127 $dtpl->setCurrentBlock("col_icon");
128 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
129 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
130 $dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
131 $dtpl->setVariable("NR", $j);
132 $dtpl->parseCurrentBlock();
133 }
134 $dtpl->setCurrentBlock("row");
135 $dtpl->parseCurrentBlock();
136 }
137
138
139 for($j = 0; $j < count($res2->nodeset); $j++)
140 {
141 // first col: row icons
142 if ($j == 0)
143 {
144 if ($i == 0)
145 {
146 if (count($res->nodeset) == 1)
147 {
148 $move_type = "none";
149 }
150 else
151 {
152 $move_type = "forward";
153 }
154 }
155 else if ($i == (count($res->nodeset) - 1))
156 {
157 $move_type = "backward";
158 }
159 else
160 {
161 $move_type = "both";
162 }
163 $dtpl->setCurrentBlock("row_icon");
164 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
165 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
166 $dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
167 $dtpl->setVariable("NR", $i);
168 $dtpl->parseCurrentBlock();
169 }
170
171 // cell
172 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
173 {
174 $dtpl->setCurrentBlock("cell");
175
176 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
177 {
178 $s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
179 }
180 else
181 {
182 $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j));
183 }
184
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);
188
189 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
190 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
191// $dtpl->setVariable("WIDTH", "140");
192// $dtpl->setVariable("HEIGHT", "80");
193 if ($cs > 1)
194 {
195 $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
196 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
197 }
198 if ($rs > 1)
199 {
200 $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
201 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
202 }
203 $dtpl->parseCurrentBlock();
204 }
205 }
206 $dtpl->setCurrentBlock("row");
207 $dtpl->parseCurrentBlock();
208 }
209
210 // init menues
211 $types = array("row", "col");
212 $moves = array("none", "backward", "both", "forward");
213 $commands = array(
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")
224 );
225
226 foreach($types as $type)
227 {
228 foreach($moves as $move)
229 {
230 foreach($commands[$type] as $command => $lang_var)
231 {
232 if ($move == "none" && (substr($command, 0, 4) == "move"))
233 {
234 continue;
235 }
236 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
237 ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
238 {
239 continue;
240 }
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();
246 }
247 $this->tpl->setCurrentBlock("menu");
248 $this->tpl->setVariable("TYPE", $type);
249 $this->tpl->setVariable("MOVE", $move);
250 $this->tpl->parseCurrentBlock();
251 }
252 }
253
254 // update/cancel
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();
259
260 $this->tpl->setVariable("FORMACTION2",
261 $ilCtrl->getFormAction($this, "tableAction"));
262 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
263
264 }
getBBMenu($a_ta_name="par_content")
Get the bb menu incl.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilPCDataTableGUI::executeCommand ( )

execute command

Reimplemented from ilPCTableGUI.

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

35 {
36 $this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
37
38 // get next class that processes or forwards current command
39 $next_class = $this->ctrl->getNextClass($this);
40
41 // get current command
42 $cmd = $this->ctrl->getCmd();
43
44 switch($next_class)
45 {
46 default:
47 $ret =& $this->$cmd();
48 break;
49 }
50
51 return $ret;
52 }
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ getNewTableObject()

ilPCDataTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented from ilPCTableGUI.

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

405 {
406 return new ilPCDataTable($this->getPage());
407 }
Class ilPCDataTable.

References ilPageContentGUI\getPage().

+ Here is the call graph for this function:

◆ ilPCDataTableGUI()

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

Constructor @access public.

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

26 {
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")));
29 }
setCharacteristics($a_chars)
Set Characteristics.

References ilPageContentGUI\setCharacteristics().

+ Here is the call graph for this function:

◆ setTabs()

ilPCDataTableGUI::setTabs ( )

Set tabs.

Reimplemented from ilPCTableGUI.

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

452 {
453 global $ilCtrl, $ilTabs;
454
455 parent::setTabs();
456
457 $ilTabs->addTarget("cont_ed_edit_data",
458 $ilCtrl->getLinkTarget($this, "editData"), "editData",
459 get_class($this));
460
461 }

References $ilCtrl.

Referenced by editData(), and editDataCl().

+ Here is the caller graph for this function:

◆ tableAction()

ilPCDataTableGUI::tableAction ( )

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

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

430 {
431 global $ilCtrl;
432
433 $this->update(false);
434 $this->pg_obj->addHierIDs();
435
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))
441 {
442 $cell_obj->$_POST["action"]();
443 $_SESSION["il_pg_error"] = $this->pg_obj->update();
444 }
445 $ilCtrl->redirect($this, "editData");
446 }
$_SESSION["AccountId"]
update($a_redirect=true)
Update table data in dom and update page in db.

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

+ 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 269 of file class.ilPCDataTableGUI.php.

270 {
271 global $ilBench, $lng;
272
273 $ilBench->start("Editor","Data_Table_update");
274
275 // handle input data
276 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
277 $data = array();
278//var_dump($_POST["cell"]);
279//var_dump($_GET);
280 if (is_array($_POST["cell"]))
281 {
282 foreach ($_POST["cell"] as $i => $row)
283 {
284 if (is_array($row))
285 {
286 foreach ($row as $j => $cell)
287 {
288 $data[$i][$j] =
290 $this->content_obj->getLanguage());
291 }
292 }
293 }
294 }
295
296 $this->updated = $this->content_obj->setData($data);
297
298 if ($this->updated !== true)
299 {
300 $ilBench->stop("Editor","Data_Table_update");
301 $this->editData();
302 return;
303 }
304
305 $this->updated = $this->pg_obj->update();
306 $ilBench->stop("Editor","Data_Table_update");
307
308 if ($a_redirect)
309 {
310 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
311 $this->ctrl->redirect($this, "editData");
312 }
313 }
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$data
global $ilBench
Definition: ilias.php:18

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

Referenced by tableAction().

+ 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 318 of file class.ilPCDataTableGUI.php.

319 {
320 global $ilBench, $lng, $ilCtrl;
321
322 if ($_POST["cancel_update"])
323 {
324// $this->ctrl->redirect($this, "editData");
325 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
326 }
327
328 // handle input data
329 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
330 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
331 $data = array();
332 foreach ($_POST as $k => $content)
333 {
334 if (substr($k, 0, 5) != "cell_")
335 {
336 continue;
337 }
338
339 // determine cell content
340 $div = ilUtil::stripSlashes($content, false);
341 $p1 = strpos($div, '>');
342 $div = substr($div, $p1 + 1);
343 $div = "<div class='ilc_text_block_TableContent'>".$div;
345 if ($text === false)
346 {
347 $ilCtrl->returnToParent($this, "jump".$this->hier_id);
348 }
349 $text = $text["text"];
350
352 $this->content_obj->getLanguage(), true, false);
354
355 // set content in data array
356 $id = explode("_", $k);
357 $data[(int) $id[1]][(int) $id[2]] = $text;
358 }
359
360 // update data
361 $this->updated = $this->content_obj->setData($data);
362
363 if ($this->updated !== true)
364 {
365 $this->editData();
366 return;
367 }
368
369 $this->updated = $this->pg_obj->update();
370
371
372 // perform table action? (move...?)
373 //$this->update(false);
374 $this->pg_obj->addHierIDs();
375
376 if ($_POST["tab_cmd"] != "")
377 {
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))
383 {
384 $cell_obj->$_POST["tab_cmd"]();
385 $_SESSION["il_pg_error"] = $this->pg_obj->update();
386 }
387 }
388
389 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
390 if ($_POST["save_return"])
391 {
392 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
393 }
394 else
395 {
396 $this->ctrl->redirect($this, "editData");
397 }
398 }
static handleAjaxContent($a_content)
Handle ajax content.
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
$text

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

+ Here is the call graph for this function:

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