ILIAS  release_4-4 Revision
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. 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 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 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
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 
- 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.

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

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

414  {
415  global $ilCtrl;
416 
417  $this->pg_obj->stripHierIDs();
418  $this->pg_obj->addHierIDs();
419  $ilCtrl->setParameter($this, "hier_id", $this->content_obj->readHierId());
420  $ilCtrl->setParameter($this, "pc_id", $this->content_obj->readPCId());
421  $this->content_obj->setHierId($this->content_obj->readHierId());
422  $this->setHierId($this->content_obj->readHierId());
423  $this->content_obj->setPCId($this->content_obj->readPCId());
424  $this->editData();
425  }
global $ilCtrl
Definition: ilias.php:18
editData()
Edit data of table.
setHierId($a_hier_id)
get hierarchical id in dom object
+ Here is the call graph for this function:

◆ editData()

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

473  {
474  global $lng, $ilCtrl;
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  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
489 
490  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
491  $dtpl = $this->tpl;
492  //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
493  $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
494 // $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
495 
496 // $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
497 // $this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
498 
499 
500  $this->tpl->setVariable("WYSIWYG_ACTION",
501  $ilCtrl->getFormAction($this, "updateJS"));
502 
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.png"));
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.png"));
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  $dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
610  $dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
611  $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
612 
613  $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
614  $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
615  $dtpl->setVariable("WIDTH", "140");
616  $dtpl->setVariable("HEIGHT", "80");
617  if ($cs > 1)
618  {
619  $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
620  $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
621  }
622  if ($rs > 1)
623  {
624  $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
625  $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
626  }
627  $dtpl->parseCurrentBlock();
628  }
629  }
630  $dtpl->setCurrentBlock("row");
631  $dtpl->parseCurrentBlock();
632  }
633 
634  // init menues
635  $types = array("row", "col");
636  $moves = array("none", "backward", "both", "forward");
637  $commands = array(
638  "row" => array( "newRowAfter" => "cont_ed_new_row_after",
639  "newRowBefore" => "cont_ed_new_row_before",
640  "moveRowUp" => "cont_ed_row_up",
641  "moveRowDown" => "cont_ed_row_down",
642  "deleteRow" => "cont_ed_delete_row"),
643  "col" => array( "newColAfter" => "cont_ed_new_col_after",
644  "newColBefore" => "cont_ed_new_col_before",
645  "moveColLeft" => "cont_ed_col_left",
646  "moveColRight" => "cont_ed_col_right",
647  "deleteCol" => "cont_ed_delete_col")
648  );
649 
650  foreach($types as $type)
651  {
652  foreach($moves as $move)
653  {
654  foreach($commands[$type] as $command => $lang_var)
655  {
656  if ($move == "none" && (substr($command, 0, 4) == "move"))
657  {
658  continue;
659  }
660  if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
661  ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
662  {
663  continue;
664  }
665  $this->tpl->setCurrentBlock("menu_item");
666  $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
667  $this->tpl->setVariable("CMD", $command);
668  $this->tpl->setVariable("TYPE", $type);
669  $this->tpl->parseCurrentBlock();
670  }
671  $this->tpl->setCurrentBlock("menu");
672  $this->tpl->setVariable("TYPE", $type);
673  $this->tpl->setVariable("MOVE", $move);
674  $this->tpl->parseCurrentBlock();
675  }
676  }
677 
678 
679  $this->tpl->setVariable("FORMACTION2",
680  $ilCtrl->getFormAction($this, "tableAction"));
681  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
682 
683  // js editing preparation
684  include_once("./Services/YUI/classes/class.ilYuiUtil.php");
687  ilYuiUtil::initPanel(false);
688  //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
689  $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_0_12/tinymce.js");
690  $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
691  //$GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
692  $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing_4_0_12.js");
693 
694  $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();
695  preloader.src = './templates/default/images/loader.gif';
696  ilCOPage.setContentCss('".
698  ", ".ilUtil::getStyleSheetLocation().", ./Services/COPage/css/tiny_extra.css');
699  ilCOPage.editTD('cell_0_0');
700  ");
701 
702 
703  $this->tpl->setVariable("IL_TINY_MENU",
705  $this->pg_obj->getParentType(),
706  false,
707  $this->pg_obj->getParentType() == "wpg",
708  false,
709  $this->getStyleId(),
710  false, true, false, false));
711 
712 
713  }
$_POST['username']
Definition: cron.php:12
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.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
global $ilCtrl
Definition: ilias.php:18
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true)
Converts xml from DB to output in edit textarea.
$GLOBALS['ct_recipient']
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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
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.
getContentStylePath($a_style_id)
get content style path
static initDragDrop()
Init YUI Drag and Drop.
$path
Definition: index.php:22
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.
+ 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.

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

63  {
64  global $lng, $ilCtrl;
65 //var_dump($_GET);
66 //var_dump($_POST);
67 
68  $this->setTabs();
69 
70  $this->displayValidationError();
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  $this->tpl->addJavascript("./Services/COPage/js/page_editing_4_0_12.js");
84 
85  // get all rows
86  $xpc = xpath_new_context($this->dom);
87  $path = "//PageContent[@HierId='".$this->getHierId()."']".
88  "/Table/TableRow";
89  $res =& xpath_eval($xpc, $path);
90 
91  for($i = 0; $i < count($res->nodeset); $i++)
92  {
93 
94  $xpc2 = xpath_new_context($this->dom);
95  $path2 = "//PageContent[@HierId='".$this->getHierId()."']".
96  "/Table/TableRow[$i+1]/TableData";
97  $res2 =& xpath_eval($xpc2, $path2);
98 
99  // if this is the first row -> col icons
100  if ($i == 0)
101  {
102  for($j = 0; $j < count($res2->nodeset); $j++)
103  {
104  if ($j == 0)
105  {
106  $dtpl->touchBlock("empty_td");
107  }
108 
109  if ($j == 0)
110  {
111  if (count($res2->nodeset) == 1)
112  {
113  $move_type = "none";
114  }
115  else
116  {
117  $move_type = "forward";
118  }
119  }
120  else if ($j == (count($res2->nodeset) - 1))
121  {
122  $move_type = "backward";
123  }
124  else
125  {
126  $move_type = "both";
127  }
128  $dtpl->setCurrentBlock("col_icon");
129  $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
130  $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
131  $dtpl->setVariable("COL_ONCLICK", "COL_".$move_type);
132  $dtpl->setVariable("NR", $j);
133  $dtpl->parseCurrentBlock();
134  }
135  $dtpl->setCurrentBlock("row");
136  $dtpl->parseCurrentBlock();
137  }
138 
139 
140  for($j = 0; $j < count($res2->nodeset); $j++)
141  {
142  // first col: row icons
143  if ($j == 0)
144  {
145  if ($i == 0)
146  {
147  if (count($res->nodeset) == 1)
148  {
149  $move_type = "none";
150  }
151  else
152  {
153  $move_type = "forward";
154  }
155  }
156  else if ($i == (count($res->nodeset) - 1))
157  {
158  $move_type = "backward";
159  }
160  else
161  {
162  $move_type = "both";
163  }
164  $dtpl->setCurrentBlock("row_icon");
165  $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
166  $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
167  $dtpl->setVariable("ROW_ONCLICK", "ROW_".$move_type);
168  $dtpl->setVariable("NR", $i);
169  $dtpl->parseCurrentBlock();
170  }
171 
172  // cell
173  if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y")
174  {
175  $dtpl->setCurrentBlock("cell");
176 
177  if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update")
178  {
179  $s_text = ilUtil::stripSlashes("cell_".$i."_".$j, false);
180  }
181  else
182  {
183  $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j));
184  }
185 
186  $dtpl->setVariable("PAR_TA_NAME", "cell[".$i."][".$j."]");
187  $dtpl->setVariable("PAR_TA_ID", "cell_".$i."_".$j);
188  $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
189 
190  $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
191  $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
192 // $dtpl->setVariable("WIDTH", "140");
193 // $dtpl->setVariable("HEIGHT", "80");
194  if ($cs > 1)
195  {
196  $dtpl->setVariable("COLSPAN", 'colspan="'.$cs.'"');
197  $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
198  }
199  if ($rs > 1)
200  {
201  $dtpl->setVariable("ROWSPAN", 'rowspan="'.$rs.'"');
202  $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
203  }
204  $dtpl->parseCurrentBlock();
205  }
206  }
207  $dtpl->setCurrentBlock("row");
208  $dtpl->parseCurrentBlock();
209  }
210 
211  // init menues
212  $types = array("row", "col");
213  $moves = array("none", "backward", "both", "forward");
214  $commands = array(
215  "row" => array( "newRowAfter" => "cont_ed_new_row_after",
216  "newRowBefore" => "cont_ed_new_row_before",
217  "moveRowUp" => "cont_ed_row_up",
218  "moveRowDown" => "cont_ed_row_down",
219  "deleteRow" => "cont_ed_delete_row"),
220  "col" => array( "newColAfter" => "cont_ed_new_col_after",
221  "newColBefore" => "cont_ed_new_col_before",
222  "moveColLeft" => "cont_ed_col_left",
223  "moveColRight" => "cont_ed_col_right",
224  "deleteCol" => "cont_ed_delete_col")
225  );
226 
227  foreach($types as $type)
228  {
229  foreach($moves as $move)
230  {
231  foreach($commands[$type] as $command => $lang_var)
232  {
233  if ($move == "none" && (substr($command, 0, 4) == "move"))
234  {
235  continue;
236  }
237  if (($move == "backward" && (in_array($command, array("movedown", "moveright")))) ||
238  ($move == "forward" && (in_array($command, array("moveup", "moveleft")))))
239  {
240  continue;
241  }
242  $this->tpl->setCurrentBlock("menu_item");
243  $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
244  $this->tpl->setVariable("CMD", $command);
245  $this->tpl->setVariable("TYPE", $type);
246  $this->tpl->parseCurrentBlock();
247  }
248  $this->tpl->setCurrentBlock("menu");
249  $this->tpl->setVariable("TYPE", $type);
250  $this->tpl->setVariable("MOVE", $move);
251  $this->tpl->parseCurrentBlock();
252  }
253  }
254 
255  // update/cancel
256  $this->tpl->setCurrentBlock("commands");
257  $this->tpl->setVariable("BTN_NAME", "update");
258  $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
259  $this->tpl->parseCurrentBlock();
260 
261  $this->tpl->setVariable("FORMACTION2",
262  $ilCtrl->getFormAction($this, "tableAction"));
263  $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
264 
265  }
$_POST['username']
Definition: cron.php:12
xpath_new_context($dom_document)
xpath_eval($xpath_context, $eval_str, $contextnode=null)
global $ilCtrl
Definition: ilias.php:18
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.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
displayValidationError()
display validation errors
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilPCDataTableGUI::executeCommand ( )

execute command

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

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

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
+ Here is the call graph for this function:

◆ getNewTableObject()

ilPCDataTableGUI::getNewTableObject ( )

Get new table object.

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

References ilPageContentGUI\getPage().

406  {
407  return new ilPCDataTable($this->getPage());
408  }
Class ilPCDataTable.
+ Here is the call graph for this function:

◆ ilPCDataTableGUI()

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

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.
+ Here is the call graph for this function:

◆ setTabs()

ilPCDataTableGUI::setTabs ( )

Set tabs.

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

References $ilCtrl.

Referenced by editData(), and editDataCl().

453  {
454  global $ilCtrl, $ilTabs;
455 
456  parent::setTabs();
457 
458  $ilTabs->addTarget("cont_ed_edit_data",
459  $ilCtrl->getLinkTarget($this, "editData"), "editData",
460  get_class($this));
461 
462  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ tableAction()

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

431  {
432  global $ilCtrl;
433 
434  $this->update(false);
435  $this->pg_obj->addHierIDs();
436 
437  $cell_hier_id = ($_POST["type"] == "col")
438  ? $this->hier_id."_1_".($_POST["id"] + 1)
439  : $this->hier_id."_".($_POST["id"] + 1)."_1";
440  $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
441  if (is_object($cell_obj))
442  {
443  $cell_obj->$_POST["action"]();
444  $_SESSION["il_pg_error"] = $this->pg_obj->update();
445  }
446  $ilCtrl->redirect($this, "editData");
447  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
update($a_redirect=true)
Update table data in dom and update page in db.
global $ilCtrl
Definition: ilias.php:18
+ 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 270 of file class.ilPCDataTableGUI.php.

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

Referenced by tableAction().

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

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

320  {
321  global $ilBench, $lng, $ilCtrl;
322 
323  if ($_POST["cancel_update"])
324  {
325 // $this->ctrl->redirect($this, "editData");
326  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
327  }
328 
329  // handle input data
330  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
331  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
332  $data = array();
333  foreach ($_POST as $k => $content)
334  {
335  if (substr($k, 0, 5) != "cell_")
336  {
337  continue;
338  }
339 
340  // determine cell content
341  $div = ilUtil::stripSlashes($content, false);
342  $p1 = strpos($div, '>');
343  $div = substr($div, $p1 + 1);
344  $div = "<div class='ilc_text_block_TableContent'>".$div;
345  $text = ilPCParagraph::handleAjaxContent($div);
346  if ($text === false)
347  {
348  $ilCtrl->returnToParent($this, "jump".$this->hier_id);
349  }
350  $text = $text["text"];
351 
352  $text = ilPCParagraph::_input2xml($text,
353  $this->content_obj->getLanguage(), true, false);
355 
356  // set content in data array
357  $id = explode("_", $k);
358  $data[(int) $id[1]][(int) $id[2]] = $text;
359  }
360 
361  // update data
362  $this->updated = $this->content_obj->setData($data);
363 
364  if ($this->updated !== true)
365  {
366  $this->editData();
367  return;
368  }
369 
370  $this->updated = $this->pg_obj->update();
371 
372 
373  // perform table action? (move...?)
374  //$this->update(false);
375  $this->pg_obj->addHierIDs();
376 
377  if ($_POST["tab_cmd"] != "")
378  {
379  $cell_hier_id = ($_POST["tab_cmd_type"] == "col")
380  ? $this->hier_id."_1_".($_POST["tab_cmd_id"] + 1)
381  : $this->hier_id."_".($_POST["tab_cmd_id"] + 1)."_1";
382  $cell_obj = $this->pg_obj->getContentObject($cell_hier_id);
383  if (is_object($cell_obj))
384  {
385  $cell_obj->$_POST["tab_cmd"]();
386  $_SESSION["il_pg_error"] = $this->pg_obj->update();
387  }
388  }
389 
390  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
391  if ($_POST["save_return"])
392  {
393  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
394  }
395  else
396  {
397  $this->ctrl->redirect($this, "editData");
398  }
399  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static handleAjaxContentPost($text)
Post input2xml handling of ajax content.
global $ilCtrl
Definition: ilias.php:18
static handleAjaxContent($a_content)
Handle ajax content.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
editData()
Edit data of table.
static _input2xml($a_text, $a_lang, $a_wysiwyg=0, $a_handle_lists=true)
converts user input to xml
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

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