ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPCTableGUI Class Reference

Class ilPCTableGUI. More...

+ Inheritance diagram for ilPCTableGUI:
+ Collaboration diagram for ilPCTableGUI:

Public Member Functions

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

Static Public Member Functions

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

Additional Inherited Members

- 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 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 17 of file class.ilPCTableGUI.php.

Member Function Documentation

◆ _addAlignmentCheckboxes()

static ilPCTableGUI::_addAlignmentCheckboxes (   $a_output,
  $a_table 
)
static

Add alignment checkboxes in edit mode.

Definition at line 506 of file class.ilPCTableGUI.php.

507 {
508 global $lng;
509
510 $classes = $a_table->getAllCellAlignments();
511
512 foreach ($classes as $k => $v)
513 {
514 if ($v == "")
515 {
516 $v = $lng->txt("default");
517 }
518 $check = $lng->txt("cont_alignment").": ".
519 '<input type="checkbox" value="1"'.
520 ' name="target['.$k.']">'.'</input> '.$v;
521
522 $a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
523 }
524 return $a_output;
525 }

References ilPageContentGUI\$lng.

Referenced by _renderTable().

+ Here is the caller graph for this function:

◆ _addSpanInputs()

static ilPCTableGUI::_addSpanInputs (   $a_output,
  $a_table 
)
static

Add span inputs.

Definition at line 550 of file class.ilPCTableGUI.php.

551 {
552 global $lng;
553
554 $spans = $a_table->getAllCellSpans();
555
556 foreach ($spans as $k => $v)
557 {
558 // colspans
559 $selects = '<div style="white-space:nowrap;">'.$lng->txt("cont_colspan").": ".
560 '<select class="small" name="colspan['.$k.']">';
561 for ($i = 1; $i <= $v["max_x"] - $v["x"] + 1; $i++)
562 {
563 $sel_str = ($i == $v["colspan"])
564 ? 'selected="selected"'
565 : '';
566 $selects.= '<option value="'.$i.'" '.$sel_str.'>'.$i.'</option>';
567 }
568 $selects.= "</select></div>";
569
570 // rowspans
571 $selects.= '<div style="margin-top:3px; white-space:nowrap;">'.$lng->txt("cont_rowspan").": ".
572 '<select class="small" name="rowspan['.$k.']">';
573 for ($i = 1; $i <= $v["max_y"] - $v["y"] + 1; $i++)
574 {
575 $sel_str = ($i == $v["rowspan"])
576 ? 'selected="selected"'
577 : '';
578 $selects.= '<option value="'.$i.'" '.$sel_str.'>'.$i.'</option>';
579 }
580 $selects.= "</select></div>";
581
582 $a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $selects, $a_output);
583 }
584 return $a_output;
585 }

References ilPageContentGUI\$lng.

Referenced by _renderTable().

+ Here is the caller graph for this function:

◆ _addStyleCheckboxes()

static ilPCTableGUI::_addStyleCheckboxes (   $a_output,
  $a_table 
)
static

Add style checkboxes in edit mode.

Definition at line 478 of file class.ilPCTableGUI.php.

479 {
480 global $lng;
481
482 $classes = $a_table->getAllCellClasses();
483
484 foreach ($classes as $k => $v)
485 {
486 if ($v == "")
487 {
488 $v = $lng->txt("none");
489 }
490 if (substr($v, 0, 4) == "ilc_")
491 {
492 $v = substr($v, 4);
493 }
494 $check = $lng->txt("cont_style").": ".
495 '<input type="checkbox" value="1"'.
496 ' name="target['.$k.']">'.'</input> '.$v;
497
498 $a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
499 }
500 return $a_output;
501 }

References ilPageContentGUI\$lng.

Referenced by _renderTable().

+ Here is the caller graph for this function:

◆ _addWidthInputs()

static ilPCTableGUI::_addWidthInputs (   $a_output,
  $a_table 
)
static

Add width inputs.

Definition at line 530 of file class.ilPCTableGUI.php.

531 {
532 global $lng;
533
534 $widths = $a_table->getAllCellWidths();
535
536 foreach ($widths as $k => $v)
537 {
538 $check = $lng->txt("cont_width").": ".
539 '<input class="small" type="text" size="5" maxlength="10"'.
540 ' name="width['.$k.']" value="'.$v.'">'.'</input>';
541
542 $a_output = str_replace("{{{{{TableEdit;".$k."}}}}}", $check, $a_output);
543 }
544 return $a_output;
545 }

References ilPageContentGUI\$lng.

Referenced by _renderTable().

+ Here is the caller graph for this function:

◆ _renderTable()

static ilPCTableGUI::_renderTable (   $content,
  $a_mode = "table_edit",
  $a_submode = "",
  $a_table_obj = null 
)
static

Static render table function.

Definition at line 423 of file class.ilPCTableGUI.php.

424 {
425 global $ilUser;
426
427 $content = "<dummy>".$content."</dummy>";
428
429 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
430 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
431 $xh = xslt_create();
432//echo "<b>XML</b>:".htmlentities($content).":<br>";
433//echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
434 $wb_path = ilUtil::getWebspaceDir("output");
435 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
436 $params = array ('mode' => $a_mode,
437 'media_mode' => $ilUser->getPref("ilPageEditor_MediaMode"),
438 'media_mode' => 'disable',
439 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
440 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
441 echo xslt_error($xh);
442 xslt_free($xh);
443
444 // unmask user html
445 $output = str_replace("&lt;","<",$output);
446 $output = str_replace("&gt;",">",$output);
447 $output = str_replace("&amp;","&",$output);
448
449 if ($a_mode == "table_edit" && !is_null($a_table_obj))
450 {
451 switch ($a_submode)
452 {
453 case "style":
454 $output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
455 break;
456
457 case "alignment":
458 $output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
459 break;
460
461 case "width":
462 $output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
463 break;
464
465 case "span":
466 $output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
467 break;
468 }
469 }
470
471
472 return '<div class="ilFloatLeft">'.$output.'</div>';
473 }
static _addAlignmentCheckboxes($a_output, $a_table)
Add alignment checkboxes in edit mode.
static _addWidthInputs($a_output, $a_table)
Add width inputs.
static _addStyleCheckboxes($a_output, $a_table)
Add style checkboxes in edit mode.
static _addSpanInputs($a_output, $a_table)
Add span inputs.
static getWebspaceDir($mode="filesystem")
get webspace directory
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$params
Definition: example_049.php:96
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
global $ilUser
Definition: imgupload.php:15

References $ilUser, $params, _addAlignmentCheckboxes(), _addSpanInputs(), _addStyleCheckboxes(), _addWidthInputs(), ilUtil\getImagePath(), ilUtil\getWebspaceDir(), xslt_create(), xslt_error(), and xslt_free().

Referenced by ilObjStyleSheetGUI\_getTemplatePreview(), and renderTable().

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

◆ afterCreation()

ilPCTableGUI::afterCreation ( )

After creation processing.

Reimplemented in ilPCDataTableGUI.

Definition at line 934 of file class.ilPCTableGUI.php.

935 {
936 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
937 }

Referenced by create().

+ Here is the caller graph for this function:

◆ centerAlign()

ilPCTableGUI::centerAlign ( )

align table to left

Definition at line 825 of file class.ilPCTableGUI.php.

826 {
827 $this->content_obj->setHorizontalAlign("Center");
828 $_SESSION["il_pg_error"] = $this->pg_obj->update();
829 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
830 }
$_SESSION["AccountId"]

References $_SESSION.

◆ create()

ilPCTableGUI::create ( )

create new table in dom and update page in db

Definition at line 877 of file class.ilPCTableGUI.php.

878 {
879 global $lng;
880
881 $this->content_obj = $this->getNewTableObject();
882 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
883 $import_table = trim($_POST["import_table"]);
884
885 // import xhtml or spreadsheet table
886 if (!empty ($import_table))
887 {
888 switch($_POST["import_type"])
889 {
890 // xhtml import
891 case "html":
892 if (!$this->content_obj->importHtml ($_POST["language"], $import_table))
893 {
894 $this->insert();
895 return;
896 }
897 break;
898
899 // spreadsheet
900 case "spreadsheet":
901 $this->content_obj->importSpreadsheet($_POST["language"], $import_table);
902 break;
903 }
904 }
905 else
906 {
907 $this->content_obj->addRows(ilUtil::stripSlashes($_POST["nr_rows"]),
908 ilUtil::stripSlashes($_POST["nr_cols"]));
909 }
910
911 $this->setProperties();
912
913 $frtype = ilUtil::stripSlashes($_POST["first_row_style"]);
914 if ($frtype != "")
915 {
916 $this->content_obj->setFirstRowStyle($frtype);
917 }
918
919 $this->updated = $this->pg_obj->update();
920
921 if ($this->updated === true)
922 {
923 $this->afterCreation();
924 }
925 else
926 {
927 $this->insert();
928 }
929 }
setProperties()
Set properties from input form.
insert()
insert new table form
afterCreation()
After creation processing.
getNewTableObject()
Get new table object.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12

References $_POST, ilPageContentGUI\$lng, afterCreation(), getNewTableObject(), insert(), setProperties(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ edit()

ilPCTableGUI::edit ( )

edit properties form

Definition at line 120 of file class.ilPCTableGUI.php.

121 {
122 global $ilCtrl, $lng, $tpl;
123
124 $this->displayValidationError();
125 $this->setTabs();
126
127 $this->initPropertiesForm();
129 $html = $this->form->getHTML();
130 $html.= "<br />".$this->renderTable("");
131 $tpl->setContent($html);
132 }
setTabs()
Set tabs.
initPropertiesForm($a_mode="edit")
Init properties form.
getPropertiesFormValues()
Get properties form.
displayValidationError()
display validation errors
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18

References $html, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getPropertiesFormValues(), initPropertiesForm(), and setTabs().

Referenced by saveProperties().

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

◆ editCellAlignment()

ilPCTableGUI::editCellAlignment ( )

Edit cell styles.

Definition at line 947 of file class.ilPCTableGUI.php.

948 {
949 global $ilCtrl, $tpl, $lng, $ilTabs;
950
951 $this->displayValidationError();
952 $this->setTabs();
954 $ilTabs->setSubTabActive("cont_alignment");
955 $ilTabs->setTabActive("cont_table_cell_properties");
956
957 // edit form
958 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
959 $form = new ilPropertyFormGUI();
960 $form->setFormAction($ilCtrl->getFormAction($this));
961 $form->setTitle($this->lng->txt("cont_table_cell_properties"));
962
963 // alignment
964 $options = array(
965 "" => $lng->txt("default"),
966 "Left" => $lng->txt("cont_left"),
967 "Center" => $lng->txt("cont_center"),
968 "Right" => $lng->txt("cont_right")
969 );
970 $si = new ilSelectInputGUI($lng->txt("cont_alignment"), "alignment");
971 $si->setOptions($options);
972 $si->setInfo($lng->txt(""));
973 $form->addItem($si);
974
975 $form->setKeepOpen(true);
976
977 $form->addCommandButton("setAlignment", $lng->txt("cont_set_alignment"));
978
979 $html = $form->getHTML();
980 $html.= "<br />".$this->renderTable("table_edit", "alignment")."</form>";
981 $tpl->setContent($html);
982
983 }
setCellPropertiesSubTabs()
Set tabs.
This class represents a property form user interface.
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $html, $ilCtrl, ilPageContentGUI\$lng, $options, $si, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellSpan()

ilPCTableGUI::editCellSpan ( )

Edit cell spans.

Definition at line 660 of file class.ilPCTableGUI.php.

661 {
662 global $ilCtrl, $tpl, $lng, $ilTabs;
663
664 $this->displayValidationError();
665 $this->setTabs();
667 $ilTabs->setSubTabActive("cont_span");
668 $ilTabs->setTabActive("cont_table_cell_properties");
669
670 $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
671 $ctpl->setVariable("BTN_NAME", "setSpans");
672 $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_spans"));
673 $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
674
675 $html = $ctpl->get();
676 $html.= "<br />".$this->renderTable("table_edit", "span")."</form>";
677 $tpl->setContent($html);
678
679 }
special template class to simplify handling of ITX/PEAR

References $html, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellStyle()

ilPCTableGUI::editCellStyle ( )

Edit cell styles.

Definition at line 590 of file class.ilPCTableGUI.php.

591 {
592 global $ilCtrl, $tpl, $lng, $ilTabs;
593
594 $this->displayValidationError();
595 $this->setTabs();
597 $ilTabs->setSubTabActive("cont_style");
598
599 // edit form
600 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
601 $form = new ilPropertyFormGUI();
602 $form->setFormAction($ilCtrl->getFormAction($this));
603 $form->setTitle($this->lng->txt("cont_table_cell_properties"));
604
605 // first row style
606 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
607 $style = new ilAdvSelectInputGUI($this->lng->txt("cont_style"),
608 "style");
610 $this->getCharacteristicsOfCurrentStyle("table_cell"); // scorm-2004
611 $chars = $this->getCharacteristics(); // scorm-2004
612 $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
613 foreach($options as $k => $option)
614 {
615 $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_'.$k.'">'.
616 $option.'</td></tr></table>';
617 $style->addOption($k, $option, $html);
618 }
619
620 $style->setValue("");
621 $style->setInfo($lng->txt("cont_set_tab_style_info"));
622 $form->addItem($style);
623 $form->setKeepOpen(true);
624
625 $form->addCommandButton("setStyles", $lng->txt("cont_set_styles"));
626
627 $html = $form->getHTML();
628 $html.= "<br />".$this->renderTable("table_edit", "style")."</form>";
629 $tpl->setContent($html);
630
631 }
This class represents an advanced selection list property in a property form.
setBasicTableCellStyles()
Set basic table cell styles.
getCharacteristicsOfCurrentStyle($a_type)
Get characteristics of current style.
getCharacteristics()
Get characteristics.
$style
Definition: example_012.php:70

References $html, $ilCtrl, ilPageContentGUI\$lng, $options, $style, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), setBasicTableCellStyles(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellWidth()

ilPCTableGUI::editCellWidth ( )

Edit cell widths.

Definition at line 636 of file class.ilPCTableGUI.php.

637 {
638 global $ilCtrl, $tpl, $lng, $ilTabs;
639
640 $this->displayValidationError();
641 $this->setTabs();
643 $ilTabs->setSubTabActive("cont_width");
644 $ilTabs->setTabActive("cont_table_cell_properties");
645
646 $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
647 $ctpl->setVariable("BTN_NAME", "setWidths");
648 $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_widths"));
649 $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
650
651 $html = $ctpl->get();
652 $html.= "<br />".$this->renderTable("table_edit", "width")."</form>";
653 $tpl->setContent($html);
654
655 }

References $html, $ilCtrl, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ executeCommand()

& ilPCTableGUI::executeCommand ( )

execute command

Reimplemented in ilPCDataTableGUI.

Definition at line 43 of file class.ilPCTableGUI.php.

44 {
45 $this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
46
47 // get next class that processes or forwards current command
48 $next_class = $this->ctrl->getNextClass($this);
49
50 // get current command
51 $cmd = $this->ctrl->getCmd();
52
53 switch($next_class)
54 {
55 default:
56 $ret =& $this->$cmd();
57 break;
58 }
59
60 return $ret;
61 }
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ getNewTableObject()

ilPCTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented in ilPCDataTableGUI.

Definition at line 869 of file class.ilPCTableGUI.php.

870 {
871 return new ilPCTable($this->getPage());
872 }
Class ilPCTable.

References ilPageContentGUI\getPage().

Referenced by create().

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

◆ getPropertiesFormValues()

ilPCTableGUI::getPropertiesFormValues ( )

Get properties form.

Definition at line 362 of file class.ilPCTableGUI.php.

363 {
364 $values = array();
365 $values["width"] = $this->content_obj->getWidth();
366 $values["border"] = $this->content_obj->getBorder();
367 $values["padding"] = $this->content_obj->getCellPadding();
368 $values["spacing"] = $this->content_obj->getCellSpacing();
369 $values["row_header"] = $this->content_obj->getHeaderRows();
370 $values["row_footer"] = $this->content_obj->getFooterRows();
371 $values["col_header"] = $this->content_obj->getHeaderCols();
372 $values["col_footer"] = $this->content_obj->getFooterCols();
373 if ($this->content_obj->getTemplate() != "")
374 {
375 $values["characteristic"] = "t:".
376 ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()).":".
377 $this->content_obj->getTemplate();
378 }
379 else
380 {
381 $values["characteristic"] = $this->content_obj->getClass();
382 }
383 $values["align"] = $this->content_obj->getHorizontalAlign();
384 $values["caption"] = $this->content_obj->getCaption();
385 $values["cap_align"] = $this->content_obj->getCaptionAlign();
386 $values["language"] = $this->content_obj->getLanguage();
387
388 $this->form->setValuesByArray($values);
389
390 $ca = $this->form->getItemByPostVar("cap_align");
391 $ca->setValue($this->content_obj->getCaptionAlign());
392 }
static _lookupTemplateIdByName($a_style_id, $a_name)
Lookup table template preview.

References ilObjStyleSheet\_lookupTemplateIdByName(), and ilPageContentGUI\getStyleId().

Referenced by edit().

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

◆ getTemplateOptions()

ilPCTableGUI::getTemplateOptions ( )

Get table templates.

Definition at line 112 of file class.ilPCTableGUI.php.

113 {
114 return parent::getTemplateOptions("table");
115 }

Referenced by initPropertiesForm().

+ Here is the caller graph for this function:

◆ ilPCTableGUI()

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

Constructor @access public.

Definition at line 24 of file class.ilPCTableGUI.php.

25 {
26 parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
27 $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
28
29 }
setCharacteristics($a_chars)
Set Characteristics.

References ilPageContentGUI\setCharacteristics().

+ Here is the call graph for this function:

◆ initPropertiesForm()

ilPCTableGUI::initPropertiesForm (   $a_mode = "edit")

Init properties form.

Definition at line 137 of file class.ilPCTableGUI.php.

138 {
139 global $ilCtrl, $lng, $tpl, $ilUser;
140
141 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
142 $this->form = new ilPropertyFormGUI();
143 $this->form->setFormAction($ilCtrl->getFormAction($this));
144 if ($a_mode == "create")
145 {
146 $this->form->setTitle($this->lng->txt("cont_insert_table"));
147 }
148 else
149 {
150 $this->form->setTitle($this->lng->txt("cont_table_properties"));
151 }
152
153 if ($a_mode == "create")
154 {
155 $nr = array();
156 for($i=1; $i<=20; $i++)
157 {
158 $nr[$i] = $i;
159 }
160
161 // cols
162 $cols = new ilSelectInputGUI($this->lng->txt("cont_nr_cols"), "nr_cols");
163 $cols->setOptions($nr);
164 $cols->setValue(2);
165 $this->form->addItem($cols);
166
167 // rows
168 $rows = new ilSelectInputGUI($this->lng->txt("cont_nr_rows"), "nr_rows");
169 $rows->setOptions($nr);
170 $rows->setValue(2);
171 $this->form->addItem($rows);
172 }
173
174 // width
175 $width = new ilTextInputGUI($this->lng->txt("cont_table_width"), "width");
176 $width->setSize(6);
177 $width->setMaxLength(6);
178 $this->form->addItem($width);
179
180 // border
181 $border = new ilTextInputGUI($this->lng->txt("cont_table_border"), "border");
182 $border->setInfo($this->lng->txt("cont_table_border_info"));
183 $border->setValue("1px");
184 $border->setSize(6);
185 $border->setMaxLength(6);
186 $this->form->addItem($border);
187
188 // padding
189 $padding = new ilTextInputGUI($this->lng->txt("cont_table_cellpadding"), "padding");
190 $padding->setInfo($this->lng->txt("cont_table_cellpadding_info"));
191 $padding->setValue("2px");
192 $padding->setSize(6);
193 $padding->setMaxLength(6);
194 $this->form->addItem($padding);
195
196 // spacing (deprecated, only hidden)
197 $spacing = new ilHiddenInputGUI("spacing");
198 $spacing->setValue("0px");
199 $this->form->addItem($spacing);
200 /*$spacing = new ilTextInputGUI($this->lng->txt("cont_table_cellspacing"), "spacing");
201 $spacing->setValue("0px");
202 $spacing->setSize(6);
203 $spacing->setMaxLength(6);
204 $this->form->addItem($spacing);*/
205
206 // table templates and table classes
207 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
208 $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"),
209 "characteristic");
210 $chars = $this->getCharacteristics();
211 $templates = $this->getTemplateOptions();
212 $chars = array_merge($templates, $chars);
213 if (is_object($this->content_obj))
214 {
215 if ($chars[$a_seleted_value] == "" && ($this->content_obj->getClass() != ""))
216 {
217 $chars = array_merge(
218 array($this->content_obj->getClass() => $this->content_obj->getClass()),
219 $chars);
220 }
221 }
222 foreach($chars as $k => $char)
223 {
224 if (strpos($k, ":") > 0)
225 {
226 $t = explode(":", $k);
227 $html = $this->style->lookupTemplatePreview($t[1]).'<div style="clear:both;" class="small">'.$char."</div>";
228 }
229 else
230 {
231 $html = '<table class="ilc_table_'.$k.'"><tr><td class="small">'.
232 $char.'</td></tr></table>';
233 }
234 $char_prop->addOption($k, $char, $html);
235 }
236 $char_prop->setValue("StandardTable");
237 $this->form->addItem($char_prop);
238
239 $nr = array();
240 for($i=0; $i<=3; $i++)
241 {
242 $nr[$i] = $i;
243 }
244
245 // row header
246 $rh = new ilSelectInputGUI($this->lng->txt("cont_nr_row_header"), "row_header");
247 $rh->setOptions($nr);
248 $rh->setValue(1);
249 $this->form->addItem($rh);
250
251 // row footer
252 $rf = new ilSelectInputGUI($this->lng->txt("cont_nr_row_footer"), "row_footer");
253 $rf->setOptions($nr);
254 $rf->setValue(0);
255 $this->form->addItem($rf);
256
257 // col header
258 $ch = new ilSelectInputGUI($this->lng->txt("cont_nr_col_header"), "col_header");
259 $ch->setOptions($nr);
260 $ch->setValue(0);
261 $this->form->addItem($ch);
262
263 // col footer
264 $cf = new ilSelectInputGUI($this->lng->txt("cont_nr_col_footer"), "col_footer");
265 $cf->setOptions($nr);
266 $cf->setValue(0);
267 $this->form->addItem($cf);
268
269 if ($a_mode == "create")
270 {
271 // first row style
272 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
273 $fr_style = new ilAdvSelectInputGUI($this->lng->txt("cont_first_row_style"),
274 "first_row_style");
276 $this->getCharacteristicsOfCurrentStyle("table_cell");
277 $chars = $this->getCharacteristics();
278 $options = array_merge(array("" => $this->lng->txt("none")), $chars);
279 foreach($options as $k => $option)
280 {
281 $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_'.$k.'">'.
282 $option.'</td></tr></table>';
283 $fr_style->addOption($k, $option, $html);
284 }
285
286 $fr_style->setValue("");
287 $this->form->addItem($fr_style);
288 }
289
290 // alignment
291 $align_opts = array("Left" => $lng->txt("cont_left"),
292 "Right" => $lng->txt("cont_right"), "Center" => $lng->txt("cont_center"),
293 "LeftFloat" => $lng->txt("cont_left_float"),
294 "RightFloat" => $lng->txt("cont_right_float"));
295 $align = new ilSelectInputGUI($this->lng->txt("cont_align"), "align");
296 $align->setOptions($align_opts);
297 $align->setValue("Center");
298 $this->form->addItem($align);
299
300 // caption
301 $caption = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
302 $caption->setSize(60);
303 $this->form->addItem($caption);
304
305 // caption align
306 $ca_opts = array("top" => $lng->txt("cont_top"),
307 "bottom" => $lng->txt("cont_bottom"));
308 $ca = new ilSelectInputGUI($this->lng->txt("cont_align"),
309 "cap_align");
310 $ca->setOptions($ca_opts);
311 $caption->addSubItem($ca);
312
313 // import
314 if ($a_mode == "create")
315 {
316 // import table
317 $import = new ilRadioGroupInputGUI($this->lng->txt("cont_paste_table"), "import_type");
318 $op = new ilRadioOption($this->lng->txt("cont_html_table"), "html");
319 $import->addOption($op);
320 $op2 = new ilRadioOption($this->lng->txt("cont_spreadsheet_table"), "spreadsheet");
321
322 $import_data = new ilTextAreaInputGUI("", "import_table");
323 $import_data->setRows(8);
324 $import_data->setCols(50);
325 $op2->addSubItem($import_data);
326
327 $import->addOption($op2);
328 $import->setValue("html");
329 $this->form->addItem($import);
330 }
331
332 // language
333 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
334 {
335 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
336 }
337 else
338 {
339 $s_lang = $ilUser->getLanguage();
340 }
341 require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
343 $language = new ilSelectInputGUI($this->lng->txt("language"), "language");
344 $language->setOptions($lang);
345 $language->setValue($s_lang);
346 $this->form->addItem($language);
347
348 if ($a_mode == "create")
349 {
350 $this->form->addCommandButton("create_tab", $lng->txt("save"));
351 $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
352 }
353 else
354 {
355 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
356 }
357 }
$_GET["client_id"]
This class represents a hidden form property in a property form.
getTemplateOptions()
Get table templates.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$border

References $_GET, $_SESSION, $border, $html, $ilCtrl, $ilUser, $lang, ilPageContentGUI\$lng, $options, $t, ilPageContentGUI\$tpl, ilMDLanguageItem\_getLanguages(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), getTemplateOptions(), and setBasicTableCellStyles().

Referenced by edit(), and insert().

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

◆ insert()

ilPCTableGUI::insert ( )

insert new table form

Definition at line 855 of file class.ilPCTableGUI.php.

856 {
857 global $ilUser, $ilCtrl, $tpl, $lng;
858
859 $this->displayValidationError();
860
861 $this->initPropertiesForm("create");
862 $html = $this->form->getHTML();
863 $tpl->setContent($html);
864 }

References $html, $ilCtrl, $ilUser, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initPropertiesForm().

Referenced by create().

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

◆ leftAlign()

ilPCTableGUI::leftAlign ( )

align table to left

Definition at line 815 of file class.ilPCTableGUI.php.

816 {
817 $this->content_obj->setHorizontalAlign("Left");
818 $_SESSION["il_pg_error"] = $this->pg_obj->update();
819 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
820 }

References $_SESSION.

◆ leftFloatAlign()

ilPCTableGUI::leftFloatAlign ( )

align table to left float

Definition at line 835 of file class.ilPCTableGUI.php.

836 {
837 $this->content_obj->setHorizontalAlign("LeftFloat");
838 $_SESSION["il_pg_error"] = $this->pg_obj->update();
839 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
840 }

References $_SESSION.

◆ renderTable()

ilPCTableGUI::renderTable (   $a_mode = "table_edit",
  $a_submode = "" 
)

Render the table.

Definition at line 397 of file class.ilPCTableGUI.php.

398 {
399 $tab_node = $this->content_obj->getNode();
400 $tab_node->set_attribute("Enabled", "True");
401 $content = $this->dom->dump_node($tab_node);
402
403 $trans = $this->pg_obj->getLanguageVariablesXML();
404 $mobs = $this->pg_obj->getMultimediaXML();
405 if ($this->getStyleId() > 0)
406 {
407 if (ilObject::_lookupType($this->getStyleId()) == "sty")
408 {
409 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
410 $style = new ilObjStyleSheet($this->getStyleId());
411 $template_xml = $style->getTemplateXML();
412 }
413 }
414
415 $content = $content.$mobs.$trans.$template_xml;
416
417 return ilPCTableGUI::_renderTable($content, $a_mode, $a_submode, $this->content_obj);
418 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _renderTable($content, $a_mode="table_edit", $a_submode="", $a_table_obj=null)
Static render table function.
$mobs

References $mobs, $style, ilObject\_lookupType(), _renderTable(), and ilPageContentGUI\getStyleId().

+ Here is the call graph for this function:

◆ rightAlign()

ilPCTableGUI::rightAlign ( )

align table to right

Definition at line 805 of file class.ilPCTableGUI.php.

806 {
807 $this->content_obj->setHorizontalAlign("Right");
808 $_SESSION["il_pg_error"] = $this->pg_obj->update();
809 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
810 }

References $_SESSION.

◆ rightFloatAlign()

ilPCTableGUI::rightFloatAlign ( )

align table to left

Definition at line 845 of file class.ilPCTableGUI.php.

846 {
847 $this->content_obj->setHorizontalAlign("RightFloat");
848 $_SESSION["il_pg_error"] = $this->pg_obj->update();
849 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
850 }

References $_SESSION.

◆ saveProperties()

ilPCTableGUI::saveProperties ( )

save table properties in db and return to page edit screen

Definition at line 786 of file class.ilPCTableGUI.php.

787 {
788 $this->setProperties();
789 $this->updated = $this->pg_obj->update();
790 if ($this->updated === true)
791 {
792 $this->ctrl->redirect($this, "edit");
793 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
794 }
795 else
796 {
797 $this->pg_obj->addHierIDs();
798 $this->edit();
799 }
800 }
edit()
edit properties form

References edit(), and setProperties().

+ Here is the call graph for this function:

◆ setAlignment()

ilPCTableGUI::setAlignment ( )

Set cell alignments.

Definition at line 988 of file class.ilPCTableGUI.php.

989 {
990 global $lng;
991
992 if (is_array($_POST["target"]))
993 {
994 foreach ($_POST["target"] as $k => $value)
995 {
996 if ($value > 0)
997 {
998 $cid = explode(":", $k);
999 $this->content_obj->setTDAlignment(ilUtil::stripSlashes($cid[0]),
1000 ilUtil::stripSlashes($_POST["alignment"]), ilUtil::stripSlashes($cid[1]));
1001 }
1002 }
1003 }
1004 $this->updated = $this->pg_obj->update();
1005 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1006
1007 $this->ctrl->redirect($this, "editCellAlignment");
1008 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, ilPageContentGUI\$lng, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setBasicTableCellStyles()

ilPCTableGUI::setBasicTableCellStyles ( )

Set basic table cell styles.

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

35 {
36 $this->setCharacteristics(array("Cell1" => "Cell1", "Cell2" => "Cell2",
37 "Cell3" => "Cell3", "Cell4" => "Cell4"));
38 }

References ilPageContentGUI\setCharacteristics().

Referenced by editCellStyle(), and initPropertiesForm().

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

◆ setCellPropertiesSubTabs()

ilPCTableGUI::setCellPropertiesSubTabs ( )

Set tabs.

Definition at line 87 of file class.ilPCTableGUI.php.

88 {
89 global $ilTabs, $ilCtrl, $lng;
90
91 $ilTabs->addSubTabTarget("cont_style",
92 $ilCtrl->getLinkTarget($this, "editCellStyle"), "editCellStyle",
93 get_class($this));
94
95 $ilTabs->addSubTabTarget("cont_width",
96 $ilCtrl->getLinkTarget($this, "editCellWidth"), "editCellWidth",
97 get_class($this));
98
99 $ilTabs->addSubTabTarget("cont_alignment",
100 $ilCtrl->getLinkTarget($this, "editCellAlignment"), "editCellAlignment",
101 get_class($this));
102
103 $ilTabs->addSubTabTarget("cont_span",
104 $ilCtrl->getLinkTarget($this, "editCellSpan"), "editCellSpan",
105 get_class($this));
106
107 }

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by editCellAlignment(), editCellSpan(), editCellStyle(), and editCellWidth().

+ Here is the caller graph for this function:

◆ setProperties()

ilPCTableGUI::setProperties ( )

Set properties from input form.

Definition at line 750 of file class.ilPCTableGUI.php.

751 {
752 // mask html
753 $caption = ilUtil::stripSlashes($_POST["caption"]);
754 $caption = str_replace("&","&amp;", $caption);
755 $caption = str_replace("<","&lt;", $caption);
756 $caption = str_replace(">","&gt;", $caption);
757
758 $this->content_obj->setLanguage(ilUtil::stripSlashes($_POST["language"]));
759 $this->content_obj->setWidth(ilUtil::stripSlashes($_POST["width"]));
760 $this->content_obj->setBorder(ilUtil::stripSlashes($_POST["border"]));
761 $this->content_obj->setCellSpacing(ilUtil::stripSlashes($_POST["spacing"]));
762 $this->content_obj->setCellPadding(ilUtil::stripSlashes($_POST["padding"]));
763 $this->content_obj->setHorizontalAlign(ilUtil::stripSlashes($_POST["align"]));
764 $this->content_obj->setHeaderRows(ilUtil::stripSlashes($_POST["row_header"]));
765 $this->content_obj->setHeaderCols(ilUtil::stripSlashes($_POST["col_header"]));
766 $this->content_obj->setFooterRows(ilUtil::stripSlashes($_POST["row_footer"]));
767 $this->content_obj->setFooterCols(ilUtil::stripSlashes($_POST["col_footer"]));
768 if (strpos($_POST["characteristic"], ":") > 0)
769 {
770 $t = explode(":", $_POST["characteristic"]);
771 $this->content_obj->setTemplate(ilUtil::stripSlashes($t[2]));
772 $this->content_obj->setClass("");
773 }
774 else
775 {
776 $this->content_obj->setClass(ilUtil::stripSlashes($_POST["characteristic"]));
777 $this->content_obj->setTemplate("");
778 }
779 $this->content_obj->setCaption($caption,
780 ilUtil::stripSlashes($_POST["cap_align"]));
781 }

References $_POST, $t, and ilUtil\stripSlashes().

Referenced by create(), and saveProperties().

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

◆ setSpans()

ilPCTableGUI::setSpans ( )

Set cell spans.

Definition at line 729 of file class.ilPCTableGUI.php.

730 {
731 global $lng;
732
733 if (is_array($_POST["colspan"]))
734 {
735 foreach ($_POST["colspan"] as $k => $span)
736 {
737 $_POST["colspan"][$k] = ilUtil::stripSlashes($span);
738 $_POST["rowspan"][$k] = ilUtil::stripSlashes($_POST["rowspan"][$k]);
739 }
740 $this->content_obj->setTDSpans($_POST["colspan"], $_POST["rowspan"]);
741 }
742 $this->updated = $this->pg_obj->update();
743 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
744 $this->ctrl->redirect($this, "editCellSpan");
745 }

References $_POST, ilPageContentGUI\$lng, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setStyles()

ilPCTableGUI::setStyles ( )

Set cell styles and.

Definition at line 684 of file class.ilPCTableGUI.php.

685 {
686 global $lng;
687
688 if (is_array($_POST["target"]))
689 {
690 foreach ($_POST["target"] as $k => $value)
691 {
692 if ($value > 0)
693 {
694 $cid = explode(":", $k);
695 $this->content_obj->setTDClass(ilUtil::stripSlashes($cid[0]),
697 }
698 }
699 }
700 $this->updated = $this->pg_obj->update();
701 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
702 $this->ctrl->redirect($this, "editCellStyle");
703 }

References $_POST, ilPageContentGUI\$lng, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setTabs()

ilPCTableGUI::setTabs ( )

Set tabs.

Reimplemented in ilPCDataTableGUI.

Definition at line 67 of file class.ilPCTableGUI.php.

68 {
69 global $ilTabs, $ilCtrl, $lng;
70
71 $ilTabs->setBackTarget($lng->txt("pg"),
72 $this->ctrl->getParentReturn($this));
73
74 $ilTabs->addTarget("cont_table_properties",
75 $ilCtrl->getLinkTarget($this, "edit"), "edit",
76 get_class($this));
77
78 $ilTabs->addTarget("cont_table_cell_properties",
79 $ilCtrl->getLinkTarget($this, "editCellStyle"), "editCellStyle",
80 get_class($this));
81
82 }

References $ilCtrl, and ilPageContentGUI\$lng.

Referenced by edit(), editCellAlignment(), editCellSpan(), editCellStyle(), and editCellWidth().

+ Here is the caller graph for this function:

◆ setWidths()

ilPCTableGUI::setWidths ( )

Set cell widths.

Definition at line 708 of file class.ilPCTableGUI.php.

709 {
710 global $lng;
711
712 if (is_array($_POST["width"]))
713 {
714 foreach ($_POST["width"] as $k => $width)
715 {
716 $cid = explode(":", $k);
717 $this->content_obj->setTDWidth(ilUtil::stripSlashes($cid[0]),
719 }
720 }
721 $this->updated = $this->pg_obj->update();
722 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
723 $this->ctrl->redirect($this, "editCellWidth");
724 }

References $_POST, ilPageContentGUI\$lng, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

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