ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 @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
 __construct (&$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 ($a_type="")
 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
 __construct ($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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Reimplemented from ilPCTableGUI.

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

26 {
27 parent::__construct($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:

Member Function Documentation

◆ afterCreation()

ilPCDataTableGUI::afterCreation ( )

After creation processing.

Reimplemented from ilPCTableGUI.

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

416 {
417 global $ilCtrl;
418
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());
426 $this->editData();
427 }
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 475 of file class.ilPCDataTableGUI.php.

476 {
477 global $lng, $ilCtrl;
478
479
481 {
482 return $this->editDataCl();
483 }
484
485//var_dump($_GET);
486//var_dump($_POST);
487
488 $this->setTabs();
489
490 $this->displayValidationError();
491
492
493 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
494
495 //$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
496 //$dtpl = $this->tpl;
497 $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage");
498 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
499
500
501 $dtpl->setVariable("WYSIWYG_ACTION",
502 $ilCtrl->getFormAction($this, "updateJS"));
503
504 // get all rows
505 $xpc = xpath_new_context($this->dom);
506 $path = "//PageContent[@HierId='".$this->getHierId()."']".
507 "/Table/TableRow";
508 $res = xpath_eval($xpc, $path);
509
510 for($i = 0; $i < count($res->nodeset); $i++)
511 {
512
513 $xpc2 = xpath_new_context($this->dom);
514 $path2 = "//PageContent[@HierId='".$this->getHierId()."']".
515 "/Table/TableRow[$i+1]/TableData";
516 $res2 = xpath_eval($xpc2, $path2);
517
518 // if this is the first row -> col icons
519 if ($i == 0)
520 {
521 for($j = 0; $j < count($res2->nodeset); $j++)
522 {
523 if ($j == 0)
524 {
525 $dtpl->touchBlock("empty_td");
526 }
527
528 if ($j == 0)
529 {
530 if (count($res2->nodeset) == 1)
531 {
532 $move_type = "none";
533 }
534 else
535 {
536 $move_type = "forward";
537 }
538 }
539 else if ($j == (count($res2->nodeset) - 1))
540 {
541 $move_type = "backward";
542 }
543 else
544 {
545 $move_type = "both";
546 }
547 $dtpl->setCurrentBlock("col_icon");
548 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
549 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
550 $dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
551 $dtpl->setVariable("NR", $j);
552 $dtpl->parseCurrentBlock();
553 }
554 $dtpl->setCurrentBlock("row");
555 $dtpl->parseCurrentBlock();
556 }
557
558
559 for($j = 0; $j < count($res2->nodeset); $j++)
560 {
561 // first col: row icons
562 if ($j == 0)
563 {
564 if ($i == 0)
565 {
566 if (count($res->nodeset) == 1)
567 {
568 $move_type = "none";
569 }
570 else
571 {
572 $move_type = "forward";
573 }
574 }
575 else if ($i == (count($res->nodeset) - 1))
576 {
577 $move_type = "backward";
578 }
579 else
580 {
581 $move_type = "both";
582 }
583 $dtpl->setCurrentBlock("row_icon");
584 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
585 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
586 $dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
587 $dtpl->setVariable("NR", $i);
588 $dtpl->parseCurrentBlock();
589 }
590
591 // cell
592 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
593 {
594 $dtpl->setCurrentBlock("cell");
595
596 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
597 {
598 $s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
599 }
600 else
601 {
602 $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j),
603 true, false);
604 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
605 $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent",
606 $this->content_obj->readPCId()."_".$i."_".$j);
607 }
608
609 // #20628
610 $s_text = str_replace("{", "&#123;", $s_text);
611 $s_text = str_replace("}", "&#125;", $s_text);
612
613 $dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
614 $dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
615
616 $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
617
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");
622 if ($cs > 1)
623 {
624 $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
625 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
626 }
627 if ($rs > 1)
628 {
629 $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
630 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
631 }
632 $dtpl->parseCurrentBlock();
633 }
634 }
635 $dtpl->setCurrentBlock("row");
636 $dtpl->parseCurrentBlock();
637 }
638
639 // init menues
640 $types = array("row", "col");
641 $moves = array("none", "backward", "both", "forward");
642 $commands = array(
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")
653 );
654
655 foreach($types as $type)
656 {
657 foreach($moves as $move)
658 {
659 foreach($commands[$type] as $command => $lang_var)
660 {
661 if ($move == "none" && (substr($command, 0, 4) == "move"))
662 {
663 continue;
664 }
665 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
666 ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
667 {
668 continue;
669 }
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();
675 }
676 $dtpl->setCurrentBlock("menu");
677 $dtpl->setVariable("TYPE", $type);
678 $dtpl->setVariable("MOVE", $move);
679 $dtpl->parseCurrentBlock();
680 }
681 }
682
683
684 $dtpl->setVariable("FORMACTION2",
685 $ilCtrl->getFormAction($this, "tableAction"));
686 $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
687
688 // js editing preparation
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");
696
697 $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
698 preloader.src = './templates/default/images/loader.svg';
699 ilCOPage.setContentCss('".
701 ", ".ilUtil::getStyleSheetLocation().", ./Services/COPage/css/tiny_extra.css');
702 ilCOPage.editTD('cell_0_0');
703 ");
704
705 $cfg = $this->getPageConfig();
706 /*$tpl->setVariable("IL_TINY_MENU",
707 self::getTinyMenu(
708 $this->getPageObject()->getParentType(),
709 $cfg->getEnableInternalLinks(),
710 $cfg->getEnableWikiLinks(),
711 $cfg->getEnableKeywords(),
712 $this->getStyleId(), true, true,
713 $cfg->getEnableAnchors()
714 ));*/
715
716 $dtpl->setVariable("IL_TINY_MENU",
718 $this->pg_obj->getParentType(),
719 $cfg->getEnableInternalLinks(),
720 $cfg->getEnableWikiLinks(),
721 $cfg->getEnableKeywords(),
722 $this->getStyleId(),
723 false, true, $cfg->getEnableAnchors(), false));
724
725 // add int link parts
726 if ($cfg->getEnableInternalLinks() || $cfg->getEnableWikiLinks())
727 {
728 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
729 $dtpl->setCurrentBlock("int_link_prep");
730 $dtpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
731 $ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"),
732 "", false, true, false)));
733 }
734
735 $this->tpl->setContent($dtpl->get());
736 }
$path
Definition: aliased.php:25
$_POST["username"]
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
static 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
static _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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)

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
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");
86
87 // get all rows
88 $xpc = xpath_new_context($this->dom);
89 $path = "//PageContent[@HierId='".$this->getHierId()."']".
90 "/Table/TableRow";
91 $res = xpath_eval($xpc, $path);
92
93 for($i = 0; $i < count($res->nodeset); $i++)
94 {
95
96 $xpc2 = xpath_new_context($this->dom);
97 $path2 = "//PageContent[@HierId='".$this->getHierId()."']".
98 "/Table/TableRow[$i+1]/TableData";
99 $res2 = xpath_eval($xpc2, $path2);
100
101 // if this is the first row -> col icons
102 if ($i == 0)
103 {
104 for($j = 0; $j < count($res2->nodeset); $j++)
105 {
106 if ($j == 0)
107 {
108 $dtpl->touchBlock("empty_td");
109 }
110
111 if ($j == 0)
112 {
113 if (count($res2->nodeset) == 1)
114 {
115 $move_type = "none";
116 }
117 else
118 {
119 $move_type = "forward";
120 }
121 }
122 else if ($j == (count($res2->nodeset) - 1))
123 {
124 $move_type = "backward";
125 }
126 else
127 {
128 $move_type = "both";
129 }
130 $dtpl->setCurrentBlock("col_icon");
131 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
132 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.svg"));
133 $dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
134 $dtpl->setVariable("NR", $j);
135 $dtpl->parseCurrentBlock();
136 }
137 $dtpl->setCurrentBlock("row");
138 $dtpl->parseCurrentBlock();
139 }
140
141
142 for($j = 0; $j < count($res2->nodeset); $j++)
143 {
144 // first col: row icons
145 if ($j == 0)
146 {
147 if ($i == 0)
148 {
149 if (count($res->nodeset) == 1)
150 {
151 $move_type = "none";
152 }
153 else
154 {
155 $move_type = "forward";
156 }
157 }
158 else if ($i == (count($res->nodeset) - 1))
159 {
160 $move_type = "backward";
161 }
162 else
163 {
164 $move_type = "both";
165 }
166 $dtpl->setCurrentBlock("row_icon");
167 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
168 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.svg"));
169 $dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
170 $dtpl->setVariable("NR", $i);
171 $dtpl->parseCurrentBlock();
172 }
173
174 // cell
175 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
176 {
177 $dtpl->setCurrentBlock("cell");
178
179 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
180 {
181 $s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
182 }
183 else
184 {
185 $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j));
186 }
187
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);
191
192 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
193 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
194// $dtpl->setVariable("WIDTH", "140");
195// $dtpl->setVariable("HEIGHT", "80");
196 if ($cs > 1)
197 {
198 $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
199 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
200 }
201 if ($rs > 1)
202 {
203 $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
204 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
205 }
206 $dtpl->parseCurrentBlock();
207 }
208 }
209 $dtpl->setCurrentBlock("row");
210 $dtpl->parseCurrentBlock();
211 }
212
213 // init menues
214 $types = array("row", "col");
215 $moves = array("none", "backward", "both", "forward");
216 $commands = array(
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")
227 );
228
229 foreach($types as $type)
230 {
231 foreach($moves as $move)
232 {
233 foreach($commands[$type] as $command => $lang_var)
234 {
235 if ($move == "none" && (substr($command, 0, 4) == "move"))
236 {
237 continue;
238 }
239 if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
240 ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
241 {
242 continue;
243 }
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();
249 }
250 $this->tpl->setCurrentBlock("menu");
251 $this->tpl->setVariable("TYPE", $type);
252 $this->tpl->setVariable("MOVE", $move);
253 $this->tpl->parseCurrentBlock();
254 }
255 }
256
257 // update/cancel
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();
262
263 $this->tpl->setVariable("FORMACTION2",
264 $ilCtrl->getFormAction($this, "tableAction"));
265 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
266
267 }
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(), ilYuiUtil\initConnection(), ilYuiUtil\initDragDrop(), ilYuiUtil\initPanel(), 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.
$ret
Definition: parser.php:6
$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 407 of file class.ilPCDataTableGUI.php.

408 {
409 return new ilPCDataTable($this->getPage());
410 }
Class ilPCDataTable.

References ilPageContentGUI\getPage().

+ Here is the call graph for this function:

◆ setTabs()

ilPCDataTableGUI::setTabs ( )

Set tabs.

Reimplemented from ilPCTableGUI.

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

456 {
457 global $ilCtrl, $ilTabs;
458
459 parent::setTabs();
460
461 $ilTabs->addTarget("cont_ed_edit_data",
462 $ilCtrl->getLinkTarget($this, "editData"), "editData",
463 get_class($this));
464
465 }

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

433 {
434 global $ilCtrl;
435
436 $this->update(false);
437 $this->pg_obj->addHierIDs();
438
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))
444 {
445 $action = (string) ($_POST["action"]);
446 $cell_obj->$action();
447 $_SESSION["il_pg_error"] = $this->pg_obj->update();
448 }
449 $ilCtrl->redirect($this, "editData");
450 }
$_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 272 of file class.ilPCDataTableGUI.php.

273 {
274 global $ilBench, $lng;
275
276 $ilBench->start("Editor","Data_Table_update");
277
278 // handle input data
279 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
280 $data = array();
281//var_dump($_POST["cell"]);
282//var_dump($_GET);
283 if (is_array($_POST["cell"]))
284 {
285 foreach ($_POST["cell"] as $i => $row)
286 {
287 if (is_array($row))
288 {
289 foreach ($row as $j => $cell)
290 {
291 $data[$i][$j] =
293 $this->content_obj->getLanguage());
294 }
295 }
296 }
297 }
298
299 $this->updated = $this->content_obj->setData($data);
300
301 if ($this->updated !== true)
302 {
303 $ilBench->stop("Editor","Data_Table_update");
304 $this->editData();
305 return;
306 }
307
308 $this->updated = $this->pg_obj->update();
309 $ilBench->stop("Editor","Data_Table_update");
310
311 if ($a_redirect)
312 {
313 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
314 $this->ctrl->redirect($this, "editData");
315 }
316 }
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.
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 321 of file class.ilPCDataTableGUI.php.

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