ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPCTableGUI Class Reference

Class ilPCTableGUI. More...

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

Public Member Functions

 __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 ($data_tab_txt_key="")
 Set tabs. More...
 
 setCellPropertiesSubTabs ()
 Set tabs. More...
 
 getTemplateOptions ($a_type="")
 Get table templates. More...
 
 edit ()
 
 editProperties ()
 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...
 
 editData ()
 Edit data of table. More...
 
 getEditDataTable ($initial=false)
 
- 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...
 
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. 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, $unmask=true, $page_object=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...
 

Protected Member Functions

 setEditorToolContext ()
 Set editor tool context. More...
 
 getCellContent (int $i, int $j)
 
 renderCell ( $content, $unmask=true, $page_object=null)
 Static render table function. More...
 
 getColumnCaption (int $nr)
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent ($hier_id="")
 Redirect to parent. More...
 
 getParentReturn ($hier_id="")
 

Protected Attributes

 $tabs
 
 $user
 
 $tool_context
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $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;"
 
- 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$

See https://mantis.ilias.de/view.php?id=32856 @ilCtrl_Calls ilPCTableGUI: ilAssGenFeedbackPageGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Reimplemented in ilPCDataTableGUI.

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

42 {
43 global $DIC;
44
45 $this->tabs = $DIC->tabs();
46 $this->ctrl = $DIC->ctrl();
47 $this->lng = $DIC->language();
48 $this->tpl = $DIC["tpl"];
49 $this->user = $DIC->user();
50 parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
51 $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
52 $this->tool_context = $DIC->globalScreen()->tool()->context();
53 }
user()
Definition: user.php:4
setCharacteristics($a_chars)
Set Characteristics.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilPageContentGUI\setCharacteristics(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _addAlignmentCheckboxes()

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

Add alignment checkboxes in edit mode.

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

577 {
578 global $DIC;
579
580 $lng = $DIC->language();
581
582 $classes = $a_table->getAllCellAlignments();
583
584 foreach ($classes as $k => $v) {
585 if ($v == "") {
586 $v = $lng->txt("default");
587 }
588 $check = $lng->txt("cont_alignment") . ": " .
589 '<input type="checkbox" value="1"' .
590 ' name="target[' . $k . ']">' . '</input> ' . $v;
591
592 $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
593 }
594 return $a_output;
595 }

References $DIC, and 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 621 of file class.ilPCTableGUI.php.

622 {
623 global $DIC;
624
625 $lng = $DIC->language();
626
627 $spans = $a_table->getAllCellSpans();
628
629 foreach ($spans as $k => $v) {
630 // colspans
631 $selects = '<div style="white-space:nowrap;">' . $lng->txt("cont_colspan") . ": " .
632 '<select class="small" name="colspan[' . $k . ']">';
633 for ($i = 1; $i <= $v["max_x"] - $v["x"] + 1; $i++) {
634 $sel_str = ($i == $v["colspan"])
635 ? 'selected="selected"'
636 : '';
637 $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
638 }
639 $selects .= "</select></div>";
640
641 // rowspans
642 $selects .= '<div style="margin-top:3px; white-space:nowrap;">' . $lng->txt("cont_rowspan") . ": " .
643 '<select class="small" name="rowspan[' . $k . ']">';
644 for ($i = 1; $i <= $v["max_y"] - $v["y"] + 1; $i++) {
645 $sel_str = ($i == $v["rowspan"])
646 ? 'selected="selected"'
647 : '';
648 $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
649 }
650 $selects .= "</select></div>";
651
652 $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $selects, $a_output);
653 }
654 return $a_output;
655 }
$i
Definition: metadata.php:24

References $DIC, $i, and 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 549 of file class.ilPCTableGUI.php.

550 {
551 global $DIC;
552
553 $lng = $DIC->language();
554
555 $classes = $a_table->getAllCellClasses();
556
557 foreach ($classes as $k => $v) {
558 if ($v == "") {
559 $v = $lng->txt("none");
560 }
561 if (substr($v, 0, 4) == "ilc_") {
562 $v = substr($v, 4);
563 }
564 $check = $lng->txt("cont_style") . ": " .
565 '<input type="checkbox" value="1"' .
566 ' name="target[' . $k . ']">' . '</input> ' . $v;
567
568 $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
569 }
570 return $a_output;
571 }

References $DIC, and 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 600 of file class.ilPCTableGUI.php.

601 {
602 global $DIC;
603
604 $lng = $DIC->language();
605
606 $widths = $a_table->getAllCellWidths();
607
608 foreach ($widths as $k => $v) {
609 $check = $lng->txt("cont_width") . ": " .
610 '<input class="small" type="text" size="5" maxlength="10"' .
611 ' name="width[' . $k . ']" value="' . $v . '">' . '</input>';
612
613 $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
614 }
615 return $a_output;
616 }

References $DIC, and 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,
  $unmask = true,
  $page_object = null 
)
static

Static render table function.

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

482 {
483 global $DIC;
484
485 $ilUser = $DIC->user();
486
487 $content = "<dummy>" . $content . "</dummy>";
488
489 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
490 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
491 $xh = xslt_create();
492 //echo "<b>XML</b>:".htmlentities($content).":<br>";
493 //echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
494 $wb_path = ilUtil::getWebspaceDir("output") . "/";
495 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
496 $params = array('mode' => $a_mode,
497 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
498 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
499 echo xslt_error($xh);
500 xslt_free($xh);
501
502 // unmask user html
503 if ($unmask) {
504 $output = str_replace("&lt;", "<", $output);
505 $output = str_replace("&gt;", ">", $output);
506 $output = str_replace("&amp;", "&", $output);
507 }
508
509 if ($a_mode == "table_edit" && !is_null($a_table_obj)) {
510 switch ($a_submode) {
511 case "style":
512 $output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
513 break;
514
515 case "alignment":
516 $output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
517 break;
518
519 case "width":
520 $output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
521 break;
522
523 case "span":
524 $output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
525 break;
526 }
527 }
528
529 // for all page components...
530 if (isset($page_object)) {
532 foreach ($defs as $def) {
534 $pc_class = $def["pc_class"];
535 $pc_obj = new $pc_class($page_object);
536
537 // post xsl page content modification by pc elements
538 $output = $pc_obj->modifyPageContentPostXsl($output, "presentation", false);
539 }
540 }
541
542
543 return $output;
544 }
static getPCDefinitions()
Get PC definitions.
static requirePCClassByName($a_name)
Get instance.
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)
$ilUser
Definition: imgupload.php:18
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()

References $DIC, $ilUser, _addAlignmentCheckboxes(), _addSpanInputs(), _addStyleCheckboxes(), _addWidthInputs(), ilUtil\getImagePath(), ilCOPagePCDef\getPCDefinitions(), ilUtil\getWebspaceDir(), ilCOPagePCDef\requirePCClassByName(), 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 1002 of file class.ilPCTableGUI.php.

1003 {
1004 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
1005 }

Referenced by create().

+ Here is the caller graph for this function:

◆ centerAlign()

ilPCTableGUI::centerAlign ( )

align table to left

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

898 {
899 $this->content_obj->setHorizontalAlign("Center");
900 $_SESSION["il_pg_error"] = $this->pg_obj->update();
901 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
902 }
$_SESSION["AccountId"]

References $_SESSION.

◆ create()

ilPCTableGUI::create ( )

create new table in dom and update page in db

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

953 {
954 global $lng;
955
956 $this->content_obj = $this->getNewTableObject();
957 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
958 $import_table = trim($_POST["import_table"]);
959
960 // import xhtml or spreadsheet table
961 if (!empty($import_table)) {
962 switch ($_POST["import_type"]) {
963 // xhtml import
964 case "html":
965 if (!$this->content_obj->importHtml($_POST["language"], $import_table)) {
966 $this->insert();
967 return;
968 }
969 break;
970
971 // spreadsheet
972 case "spreadsheet":
973 $this->content_obj->importSpreadsheet($_POST["language"], $import_table);
974 break;
975 }
976 } else {
977 $this->content_obj->addRows(
978 ilUtil::stripSlashes($_POST["nr_rows"]),
979 ilUtil::stripSlashes($_POST["nr_cols"])
980 );
981 }
982
983 $this->setProperties();
984
985 $frtype = ilUtil::stripSlashes($_POST["first_row_style"]);
986 if ($frtype != "") {
987 $this->content_obj->setFirstRowStyle($frtype);
988 }
989
990 $this->updated = $this->pg_obj->update();
991
992 if ($this->updated === true) {
993 $this->afterCreation();
994 } else {
995 $this->insert();
996 }
997 }
$_POST["username"]
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

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

+ Here is the call graph for this function:

◆ edit()

ilPCTableGUI::edit ( )

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

174 {
175 $this->ctrl->redirect($this, "editData");
176 }

Referenced by saveProperties().

+ Here is the caller graph for this function:

◆ editCellAlignment()

ilPCTableGUI::editCellAlignment ( )

Edit cell styles.

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

1016 {
1017 $ilCtrl = $this->ctrl;
1018 $tpl = $this->tpl;
1019 $lng = $this->lng;
1020 $ilTabs = $this->tabs;
1021
1022 $this->displayValidationError();
1023 $this->setTabs();
1024 $this->setCellPropertiesSubTabs();
1025 $ilTabs->setSubTabActive("cont_alignment");
1026 $ilTabs->setTabActive("cont_table_cell_properties");
1027
1028 // edit form
1029 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1030 $form = new ilPropertyFormGUI();
1031 $form->setFormAction($ilCtrl->getFormAction($this));
1032 $form->setTitle($this->lng->txt("cont_table_cell_properties"));
1033
1034 // alignment
1035 $options = array(
1036 "" => $lng->txt("default"),
1037 "Left" => $lng->txt("cont_left"),
1038 "Center" => $lng->txt("cont_center"),
1039 "Right" => $lng->txt("cont_right")
1040 );
1041 $si = new ilSelectInputGUI($lng->txt("cont_alignment"), "alignment");
1042 $si->setOptions($options);
1043 $si->setInfo($lng->txt(""));
1044 $form->addItem($si);
1045
1046 $form->setKeepOpen(true);
1047
1048 $form->addCommandButton("setAlignment", $lng->txt("cont_set_alignment"));
1049
1050 $html = $form->getHTML();
1051 $html .= "<br />" . $this->renderTable("table_edit", "alignment") . "</form>";
1052 $tpl->setContent($html);
1053 }
setTabs($data_tab_txt_key="")
Set tabs.
renderTable($a_mode="table_edit", $a_submode="")
Render the table.
setCellPropertiesSubTabs()
Set tabs.
displayValidationError()
display validation errors
This class represents a property form user interface.
This class represents a selection list property in a property form.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $si, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), renderTable(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellSpan()

ilPCTableGUI::editCellSpan ( )

Edit cell spans.

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

736 {
737 $ilCtrl = $this->ctrl;
740 $ilTabs = $this->tabs;
741
742 $this->displayValidationError();
743 $this->setTabs();
745 $ilTabs->setSubTabActive("cont_span");
746 $ilTabs->setTabActive("cont_table_cell_properties");
747
748 $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
749 $ctpl->setVariable("BTN_NAME", "setSpans");
750 $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_spans"));
751 $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
752
753 $html = $ctpl->get();
754 $html .= "<br />" . $this->renderTable("table_edit", "span") . "</form>";
755 $tpl->setContent($html);
756 }
special template class to simplify handling of ITX/PEAR

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), renderTable(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellStyle()

ilPCTableGUI::editCellStyle ( )

Edit cell styles.

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

661 {
662 $ilCtrl = $this->ctrl;
665 $ilTabs = $this->tabs;
666
667 $this->displayValidationError();
668 $this->setTabs();
670 $ilTabs->setSubTabActive("cont_style");
671
672 // edit form
673 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
674 $form = new ilPropertyFormGUI();
675 $form->setFormAction($ilCtrl->getFormAction($this));
676 $form->setTitle($this->lng->txt("cont_table_cell_properties"));
677
678 // first row style
679 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
680 $style = new ilAdvSelectInputGUI(
681 $this->lng->txt("cont_style"),
682 "style"
683 );
685 $this->getCharacteristicsOfCurrentStyle("table_cell"); // scorm-2004
686 $chars = $this->getCharacteristics(); // scorm-2004
687 $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
688 foreach ($options as $k => $option) {
689 $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_' . $k . '">' .
690 $option . '</td></tr></table>';
691 $style->addOption($k, $option, $html);
692 }
693
694 $style->setValue("");
695 $style->setInfo($lng->txt("cont_set_tab_style_info"));
696 $form->addItem($style);
697 $form->setKeepOpen(true);
698
699 $form->addCommandButton("setStyles", $lng->txt("cont_set_styles"));
700
701 $html = $form->getHTML();
702 $html .= "<br />" . $this->renderTable("table_edit", "style") . "</form>";
703 $tpl->setContent($html);
704 }
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.

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), renderTable(), setBasicTableCellStyles(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editCellWidth()

ilPCTableGUI::editCellWidth ( )

Edit cell widths.

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

710 {
711 $ilCtrl = $this->ctrl;
714 $ilTabs = $this->tabs;
715
716 $this->displayValidationError();
717 $this->setTabs();
719 $ilTabs->setSubTabActive("cont_width");
720 $ilTabs->setTabActive("cont_table_cell_properties");
721
722 $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
723 $ctpl->setVariable("BTN_NAME", "setWidths");
724 $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_widths"));
725 $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
726
727 $html = $ctpl->get();
728 $html .= "<br />" . $this->renderTable("table_edit", "width") . "</form>";
729 $tpl->setContent($html);
730 }

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), renderTable(), setCellPropertiesSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ editData()

ilPCTableGUI::editData ( )

Edit data of table.

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

1097 {
1098 $this->setEditorToolContext();
1099
1100 $this->setTabs();
1101
1102 $this->displayValidationError();
1103
1104 $editor_init = new \ILIAS\COPage\Editor\UI\Init();
1105 $editor_init->initUI($this->tpl);
1106
1107 $this->tpl->setContent($this->getEditDataTable(true));
1108 }
setEditorToolContext()
Set editor tool context.
getEditDataTable($initial=false)

References ilPageContentGUI\displayValidationError(), getEditDataTable(), setEditorToolContext(), and setTabs().

Referenced by ilPCDataTableGUI\update(), and ilPCDataTableGUI\updateJS().

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

◆ editProperties()

ilPCTableGUI::editProperties ( )

edit properties form

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

182 {
184
185 $this->displayValidationError();
186 $this->setTabs();
187
188 $this->initPropertiesForm();
190 $html = $this->form->getHTML();
191 $html .= "<br />" . $this->renderTable("");
192 $tpl->setContent($html);
193 }
initPropertiesForm($a_mode="edit")
Init properties form.
getPropertiesFormValues()
Get properties form.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getPropertiesFormValues(), initPropertiesForm(), renderTable(), and setTabs().

+ Here is the call graph for this function:

◆ executeCommand()

ilPCTableGUI::executeCommand ( )

execute command

Reimplemented in ilPCDataTableGUI.

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

68 {
69 $this->getCharacteristicsOfCurrentStyle("table"); // scorm-2004
70
71 // get next class that processes or forwards current command
72 $next_class = $this->ctrl->getNextClass($this);
73
74 // get current command
75 $cmd = $this->ctrl->getCmd();
76
77 switch ($next_class) {
78 default:
79 $ret = $this->$cmd();
80 break;
81 }
82
83 return $ret;
84 }
$ret
Definition: parser.php:6

References $ret, and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

+ Here is the call graph for this function:

◆ getCellContent()

ilPCTableGUI::getCellContent ( int  $i,
int  $j 
)
protected

Reimplemented in ilPCDataTableGUI.

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

1252 : string
1253 {
1254 $tab_node = $this->content_obj->getNode();
1255 $cnt_i = 0;
1256 $content = "";
1257 // get correct cell and dump content of all its childrem
1258 foreach ($tab_node->first_child()->child_nodes() as $child) {
1259 if ($i == $cnt_i) {
1260 $cnt_j = 0;
1261 foreach($child->child_nodes() as $child2)
1262 {
1263 if ($j == $cnt_j) {
1264 foreach($child2->child_nodes() as $cell_content_node) {
1265 $content.= $this->dom->dump_node($cell_content_node);
1266 }
1267 }
1268 $cnt_j++;
1269 }
1270 }
1271 $cnt_i++;
1272 }
1273 $trans = $this->pg_obj->getLanguageVariablesXML();
1274 $mobs = $this->pg_obj->getMultimediaXML();
1275 if ($this->getStyleId() > 0) {
1276 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1277 $style = new ilObjStyleSheet($this->getStyleId());
1278 $template_xml = $style->getTemplateXML();
1279 }
1280 }
1281
1282 $content = $content . $mobs . $trans . $template_xml;
1283
1284 return $this->renderCell(
1285 $content,
1286 !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
1287 $this->getPage()
1288 );
1289 }
Class ilObjStyleSheet.
static _lookupType($a_id, $a_reference=false)
lookup object type
renderCell( $content, $unmask=true, $page_object=null)
Static render table function.
$mobs
Definition: imgupload.php:54

References $i, $mobs, ilObject\_lookupType(), ilPageContentGUI\getStyleId(), and renderCell().

Referenced by getEditDataTable().

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

◆ getColumnCaption()

ilPCTableGUI::getColumnCaption ( int  $nr)
protected

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

1338 {
1339 $cap = "";
1340 $base = 26;
1341 while($nr > 0) {
1342 $chr = ($nr - 1) % $base;
1343 $cap = chr($chr + 65) . $cap;
1344 $nr = ($nr - 1 - $chr) / $base;
1345 }
1346 return $cap;
1347 }
$base
Definition: index.php:4

References $base.

Referenced by getEditDataTable().

+ Here is the caller graph for this function:

◆ getEditDataTable()

ilPCTableGUI::getEditDataTable (   $initial = false)

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

1111 {
1112 $ilCtrl = $this->ctrl;
1113
1114 include_once("./Services/COPage/classes/class.ilPCParagraph.php");
1115
1116 $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage");
1117 $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
1118 $dtpl->setVariable("HIERID", $this->hier_id);
1119 $dtpl->setVariable("PCID", $this->pc_id);
1120
1121 $dtpl->setVariable(
1122 "WYSIWYG_ACTION",
1123 $ilCtrl->getFormAction($this, "updateJS")
1124 );
1125
1126 // get all rows
1127 $xpc = xpath_new_context($this->dom);
1128 $path = "//PageContent[@HierId='" . $this->getHierId() . "']" .
1129 "/Table/TableRow";
1130 $res = xpath_eval($xpc, $path);
1131
1132 for ($i = 0; $i < count($res->nodeset); $i++) {
1133 $xpc2 = xpath_new_context($this->dom);
1134 $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" .
1135 "/Table/TableRow[$i+1]/TableData";
1136 $res2 = xpath_eval($xpc2, $path2);
1137
1138 // if this is the first row -> col icons
1139 if ($i == 0) {
1140 for ($j = 0; $j < count($res2->nodeset); $j++) {
1141 if ($j == 0) {
1142 $dtpl->touchBlock("empty_td");
1143 }
1144
1145 $move_forward = false;
1146 $move_backward = false;
1147 if ($j == 0) {
1148 if (count($res2->nodeset) == 1) {
1149 //
1150 } else {
1151 $move_forward = true;
1152 }
1153 } elseif ($j == (count($res2->nodeset) - 1)) {
1154 $move_backward = true;
1155 } else {
1156 $move_forward = true;
1157 $move_backward = true;
1158 }
1159 $dtpl->setCurrentBlock("col_icon");
1160 $dtpl->setVariable("NR_COLUMN", $j + 1);
1161 $dtpl->setVariable("PCID_COLUMN", $res2->nodeset[$j]->get_attribute("PCID"));
1162 $dtpl->setVariable("COLUMN_CAPTION", $this->getColumnCaption($j + 1));
1163 $dtpl->parseCurrentBlock();
1164 }
1165 $dtpl->setCurrentBlock("row");
1166 $dtpl->parseCurrentBlock();
1167 }
1168
1169 for ($j = 0; $j < count($res2->nodeset); $j++) {
1170 // first col: row icons
1171 if ($j == 0) {
1172 if ($i == 0) {
1173 if (count($res->nodeset) == 1) {
1174 $move_type = "none";
1175 } else {
1176 $move_type = "forward";
1177 }
1178 } elseif ($i == (count($res->nodeset) - 1)) {
1179 $move_type = "backward";
1180 } else {
1181 $move_type = "both";
1182 }
1183 $dtpl->setCurrentBlock("row_icon");
1184 $dtpl->setVariable("NR_ROW", $i + 1);
1185 $dtpl->setVariable("PCID_ROW", $res2->nodeset[$j]->get_attribute("PCID"));
1186 $dtpl->setVariable("ROW_CAPTION", $i + 1);
1187 $dtpl->parseCurrentBlock();
1188 }
1189
1190 // cell
1191 if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
1192 if ($this->content_obj->getType() == "dtab") {
1193 $dtpl->touchBlock("cell_type");
1194 //$dtpl->setCurrentBlock("cell_type");
1195 //$dtpl->parseCurrentBlock();
1196 }
1197
1198 $dtpl->setCurrentBlock("cell");
1199
1200 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
1201 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
1202 $dtpl->setVariable("PAR_ROW", (string) $i);
1203 $dtpl->setVariable("PAR_COLUMN", (string) $j);
1204
1205 $dtpl->setVariable("PAR_TA_CONTENT",
1206 $this->getCellContent($i, $j));
1207
1208 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
1209 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
1210 $dtpl->setVariable("WIDTH", "140");
1211 $dtpl->setVariable("HEIGHT", "80");
1212 if ($cs > 1) {
1213 $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
1214 $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
1215 }
1216 if ($rs > 1) {
1217 $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
1218 $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
1219 }
1220 $dtpl->parseCurrentBlock();
1221 }
1222 }
1223 $dtpl->setCurrentBlock("row");
1224 $dtpl->parseCurrentBlock();
1225 }
1226
1227 $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
1228
1229 // add int link parts
1230 $dtpl->setCurrentBlock("int_link_prep");
1231 $dtpl->setVariable(
1232 "INT_LINK_PREP",
1234 $ilCtrl->getLinkTargetByClass(
1235 array("ilpageeditorgui", "ilinternallinkgui"),
1236 "",
1237 false,
1238 true,
1239 false
1240 )
1241 )
1242 );
1243 $dtpl->parseCurrentBlock();
1244
1245 if ($initial) {
1246 $dtpl->touchBlock("script");
1247 }
1248
1249 return $dtpl->get();
1250 }
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
getCellContent(int $i, int $j)
getHierId()
get hierarchical id in dom object
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
foreach($_POST as $key=> $value) $res

References ilPageContentGUI\$ctrl, $i, $res, getCellContent(), getColumnCaption(), ilPageContentGUI\getHierId(), ilInternalLinkGUI\getInitHTML(), 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:

◆ getNewTableObject()

ilPCTableGUI::getNewTableObject ( )

Get new table object.

Reimplemented in ilPCDataTableGUI.

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

945 {
946 return new ilPCTable($this->getPage());
947 }
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 412 of file class.ilPCTableGUI.php.

413 {
414 $values = array();
415 $values["width"] = $this->content_obj->getWidth();
416 $values["border"] = $this->content_obj->getBorder();
417 $values["padding"] = $this->content_obj->getCellPadding();
418 $values["spacing"] = $this->content_obj->getCellSpacing();
419 $values["row_header"] = $this->content_obj->getHeaderRows();
420 $values["row_footer"] = $this->content_obj->getFooterRows();
421 $values["col_header"] = $this->content_obj->getHeaderCols();
422 $values["col_footer"] = $this->content_obj->getFooterCols();
423 if ($this->content_obj->getTemplate() != "") {
424 $values["characteristic"] = "t:" .
425 ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()) . ":" .
426 $this->content_obj->getTemplate();
427 } else {
428 $values["characteristic"] = $this->content_obj->getClass();
429 }
430 $values["align"] = $this->content_obj->getHorizontalAlign();
431 $values["caption"] = $this->content_obj->getCaption();
432 $values["cap_align"] = $this->content_obj->getCaptionAlign();
433 $values["language"] = $this->content_obj->getLanguage();
434
435 $this->form->setValuesByArray($values);
436
437 $ca = $this->form->getItemByPostVar("cap_align");
438 $ca->setValue($this->content_obj->getCaptionAlign());
439 }
static _lookupTemplateIdByName($a_style_id, $a_name)
Lookup table template preview.

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

Referenced by editProperties().

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

◆ getTemplateOptions()

ilPCTableGUI::getTemplateOptions (   $a_type = "")

Get table templates.

Reimplemented from ilPageContentGUI.

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

169 {
170 return parent::getTemplateOptions("table");
171 }

Referenced by initPropertiesForm().

+ Here is the caller graph for this function:

◆ initPropertiesForm()

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

Init properties form.

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

199 {
200 $ilCtrl = $this->ctrl;
204
205 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
206 $this->form = new ilPropertyFormGUI();
207 $this->form->setFormAction($ilCtrl->getFormAction($this));
208 if ($a_mode == "create") {
209 $this->form->setTitle($this->lng->txt("cont_insert_table"));
210 } else {
211 $this->form->setTitle($this->lng->txt("cont_table_properties"));
212 }
213
214 if ($a_mode == "create") {
215 $nr = array();
216 for ($i = 1; $i <= 20; $i++) {
217 $nr[$i] = $i;
218 }
219
220 // cols
221 $cols = new ilSelectInputGUI($this->lng->txt("cont_nr_cols"), "nr_cols");
222 $cols->setOptions($nr);
223 $cols->setValue(2);
224 $this->form->addItem($cols);
225
226 // rows
227 $rows = new ilSelectInputGUI($this->lng->txt("cont_nr_rows"), "nr_rows");
228 $rows->setOptions($nr);
229 $rows->setValue(2);
230 $this->form->addItem($rows);
231 }
232
233 // width
234 $width = new ilTextInputGUI($this->lng->txt("cont_table_width"), "width");
235 $width->setSize(6);
236 $width->setMaxLength(6);
237 $this->form->addItem($width);
238
239 // border
240 $border = new ilTextInputGUI($this->lng->txt("cont_table_border"), "border");
241 $border->setInfo($this->lng->txt("cont_table_border_info"));
242 $border->setValue("1px");
243 $border->setSize(6);
244 $border->setMaxLength(6);
245 $this->form->addItem($border);
246
247 // padding
248 $padding = new ilTextInputGUI($this->lng->txt("cont_table_cellpadding"), "padding");
249 $padding->setInfo($this->lng->txt("cont_table_cellpadding_info"));
250 $padding->setValue("2px");
251 $padding->setSize(6);
252 $padding->setMaxLength(6);
253 $this->form->addItem($padding);
254
255 // spacing (deprecated, only hidden)
256 $spacing = new ilHiddenInputGUI("spacing");
257 $spacing->setValue("0px");
258 $this->form->addItem($spacing);
259 /*$spacing = new ilTextInputGUI($this->lng->txt("cont_table_cellspacing"), "spacing");
260 $spacing->setValue("0px");
261 $spacing->setSize(6);
262 $spacing->setMaxLength(6);
263 $this->form->addItem($spacing);*/
264
265 // table templates and table classes
266 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
267 $char_prop = new ilAdvSelectInputGUI(
268 $this->lng->txt("cont_characteristic"),
269 "characteristic"
270 );
271 $chars = $this->getCharacteristics();
272 $templates = $this->getTemplateOptions();
273 $chars = array_merge($templates, $chars);
274 if (is_object($this->content_obj)) {
275 if ($chars[$a_seleted_value] == "" && ($this->content_obj->getClass() != "")) {
276 $chars = array_merge(
277 array($this->content_obj->getClass() => $this->content_obj->getClass()),
278 $chars
279 );
280 }
281 }
282 foreach ($chars as $k => $char) {
283 if (strpos($k, ":") > 0) {
284 $t = explode(":", $k);
285 $html = $this->style->lookupTemplatePreview($t[1]) . '<div style="clear:both;" class="small">' . $char . "</div>";
286 } else {
287 $html = '<table class="ilc_table_' . $k . '"><tr><td class="small">' .
288 $char . '</td></tr></table>';
289 }
290 $char_prop->addOption($k, $char, $html);
291 }
292 $char_prop->setValue("StandardTable");
293 $this->form->addItem($char_prop);
294
295 $nr = array();
296 for ($i = 0; $i <= 3; $i++) {
297 $nr[$i] = $i;
298 }
299
300 // row header
301 $rh = new ilSelectInputGUI($this->lng->txt("cont_nr_row_header"), "row_header");
302 $rh->setOptions($nr);
303 $rh->setValue(1);
304 $this->form->addItem($rh);
305
306 // row footer
307 $rf = new ilSelectInputGUI($this->lng->txt("cont_nr_row_footer"), "row_footer");
308 $rf->setOptions($nr);
309 $rf->setValue(0);
310 $this->form->addItem($rf);
311
312 // col header
313 $ch = new ilSelectInputGUI($this->lng->txt("cont_nr_col_header"), "col_header");
314 $ch->setOptions($nr);
315 $ch->setValue(0);
316 $this->form->addItem($ch);
317
318 // col footer
319 $cf = new ilSelectInputGUI($this->lng->txt("cont_nr_col_footer"), "col_footer");
320 $cf->setOptions($nr);
321 $cf->setValue(0);
322 $this->form->addItem($cf);
323
324 if ($a_mode == "create") {
325 // first row style
326 require_once("./Services/Form/classes/class.ilAdvSelectInputGUI.php");
327 $fr_style = new ilAdvSelectInputGUI(
328 $this->lng->txt("cont_first_row_style"),
329 "first_row_style"
330 );
332 $this->getCharacteristicsOfCurrentStyle("table_cell");
333 $chars = $this->getCharacteristics();
334 $options = array_merge(array("" => $this->lng->txt("none")), $chars);
335 foreach ($options as $k => $option) {
336 $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_' . $k . '">' .
337 $option . '</td></tr></table>';
338 $fr_style->addOption($k, $option, $html);
339 }
340
341 $fr_style->setValue("");
342 $this->form->addItem($fr_style);
343 }
344
345 // alignment
346 $align_opts = array("Left" => $lng->txt("cont_left"),
347 "Right" => $lng->txt("cont_right"), "Center" => $lng->txt("cont_center"),
348 "LeftFloat" => $lng->txt("cont_left_float"),
349 "RightFloat" => $lng->txt("cont_right_float"));
350 $align = new ilSelectInputGUI($this->lng->txt("cont_align"), "align");
351 $align->setOptions($align_opts);
352 $align->setValue("Center");
353 $this->form->addItem($align);
354
355 // caption
356 $caption = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
357 $caption->setSize(60);
358 $this->form->addItem($caption);
359
360 // caption align
361 $ca_opts = array("top" => $lng->txt("cont_top"),
362 "bottom" => $lng->txt("cont_bottom"));
363 $ca = new ilSelectInputGUI(
364 $this->lng->txt("cont_align"),
365 "cap_align"
366 );
367 $ca->setOptions($ca_opts);
368 $caption->addSubItem($ca);
369
370 // import
371 if ($a_mode == "create") {
372 // import table
373 $import = new ilRadioGroupInputGUI($this->lng->txt("cont_paste_table"), "import_type");
374 $op = new ilRadioOption($this->lng->txt("cont_html_table"), "html");
375 $import->addOption($op);
376 $op2 = new ilRadioOption($this->lng->txt("cont_spreadsheet_table"), "spreadsheet");
377
378 $import_data = new ilTextAreaInputGUI("", "import_table");
379 $import_data->setRows(8);
380 $import_data->setCols(50);
381 $op2->addSubItem($import_data);
382
383 $import->addOption($op2);
384 $import->setValue("html");
385 $this->form->addItem($import);
386 }
387
388 // language
389 if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
390 $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
391 } else {
392 $s_lang = $ilUser->getLanguage();
393 }
394 require_once("Services/MetaData/classes/class.ilMDLanguageItem.php");
396 $language = new ilSelectInputGUI($this->lng->txt("language"), "language");
397 $language->setOptions($lang);
398 $language->setValue($s_lang);
399 $this->form->addItem($language);
400
401 if ($a_mode == "create") {
402 $this->form->addCommandButton("create_tab", $lng->txt("save"));
403 $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
404 } else {
405 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
406 }
407 }
$_GET["client_id"]
This class represents a hidden form property in a property form.
getTemplateOptions($a_type="")
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.
$lang
Definition: xapiexit.php:8
$cols
Definition: xhr_table.php:11
$rows
Definition: xhr_table.php:10

References $_GET, $_SESSION, $cols, ilPageContentGUI\$ctrl, $i, $ilUser, $lang, ilPageContentGUI\$lng, $rows, ilPageContentGUI\$tpl, $user, ilMDLanguageItem\_getLanguages(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), getTemplateOptions(), and setBasicTableCellStyles().

Referenced by editProperties(), 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 927 of file class.ilPCTableGUI.php.

928 {
930 $ilCtrl = $this->ctrl;
933
934 $this->displayValidationError();
935
936 $this->initPropertiesForm("create");
937 $html = $this->form->getHTML();
938 $tpl->setContent($html);
939 }

References ilPageContentGUI\$ctrl, $ilUser, ilPageContentGUI\$lng, ilPageContentGUI\$tpl, $user, 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 887 of file class.ilPCTableGUI.php.

888 {
889 $this->content_obj->setHorizontalAlign("Left");
890 $_SESSION["il_pg_error"] = $this->pg_obj->update();
891 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
892 }

References $_SESSION.

◆ leftFloatAlign()

ilPCTableGUI::leftFloatAlign ( )

align table to left float

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

908 {
909 $this->content_obj->setHorizontalAlign("LeftFloat");
910 $_SESSION["il_pg_error"] = $this->pg_obj->update();
911 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
912 }

References $_SESSION.

◆ renderCell()

ilPCTableGUI::renderCell (   $content,
  $unmask = true,
  $page_object = null 
)
protected

Static render table function.

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

1298 : string {
1299 global $DIC;
1300
1301 $ilUser = $DIC->user();
1302 $content = "<dummy>" . $content . "</dummy>";
1303
1304 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1305 $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1306 $xh = xslt_create();
1307 $wb_path = ilUtil::getWebspaceDir("output") . "/";
1308 $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1309 $params = array('webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
1310 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1311 xslt_free($xh);
1312
1313 // unmask user html
1314 if ($unmask) {
1315 $output = str_replace("&lt;", "<", $output);
1316 $output = str_replace("&gt;", ">", $output);
1317 $output = str_replace("&amp;", "&", $output);
1318 }
1319
1320 // for all page components...
1321 if (isset($page_object)) {
1323 foreach ($defs as $def) {
1325 $pc_class = $def["pc_class"];
1326 $pc_obj = new $pc_class($page_object);
1327
1328 // post xsl page content modification by pc elements
1329 $output = $pc_obj->modifyPageContentPostXsl($output, "presentation", false);
1330 }
1331 }
1332
1333
1334 return $output;
1335 }

Referenced by getCellContent().

+ Here is the caller graph for this function:

◆ renderTable()

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

Render the table.

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

445 {
446 $tab_node = $this->content_obj->getNode();
447 $tab_node->set_attribute("Enabled", "True");
448 $content = $this->dom->dump_node($tab_node);
449
450 $trans = $this->pg_obj->getLanguageVariablesXML();
451 $mobs = $this->pg_obj->getMultimediaXML();
452 if ($this->getStyleId() > 0) {
453 if (ilObject::_lookupType($this->getStyleId()) == "sty") {
454 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
455 $style = new ilObjStyleSheet($this->getStyleId());
456 $template_xml = $style->getTemplateXML();
457 }
458 }
459
460 $content = $content . $mobs . $trans . $template_xml;
461
463 $content,
464 $a_mode,
465 $a_submode,
466 $this->content_obj,
467 !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
468 $this->getPage()
469 );
470 }
static _renderTable( $content, $a_mode="table_edit", $a_submode="", $a_table_obj=null, $unmask=true, $page_object=null)
Static render table function.

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

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

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

◆ rightAlign()

ilPCTableGUI::rightAlign ( )

align table to right

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

878 {
879 $this->content_obj->setHorizontalAlign("Right");
880 $_SESSION["il_pg_error"] = $this->pg_obj->update();
881 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
882 }

References $_SESSION.

◆ rightFloatAlign()

ilPCTableGUI::rightFloatAlign ( )

align table to left

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

918 {
919 $this->content_obj->setHorizontalAlign("RightFloat");
920 $_SESSION["il_pg_error"] = $this->pg_obj->update();
921 $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
922 }

References $_SESSION.

◆ saveProperties()

ilPCTableGUI::saveProperties ( )

save table properties in db and return to page edit screen

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

862 {
863 $this->setProperties();
864 $this->updated = $this->pg_obj->update();
865 if ($this->updated === true) {
866 $this->ctrl->redirect($this, "editProperties");
867 //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
868 } else {
869 $this->pg_obj->addHierIDs();
870 $this->edit();
871 }
872 }

References edit(), and setProperties().

+ Here is the call graph for this function:

◆ setAlignment()

ilPCTableGUI::setAlignment ( )

Set cell alignments.

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

1059 {
1060 $lng = $this->lng;
1061
1062 if (is_array($_POST["target"])) {
1063 foreach ($_POST["target"] as $k => $value) {
1064 if ($value > 0) {
1065 $cid = explode(":", $k);
1066 $this->content_obj->setTDAlignment(
1067 ilUtil::stripSlashes($cid[0]),
1068 ilUtil::stripSlashes($_POST["alignment"]),
1069 ilUtil::stripSlashes($cid[1])
1070 );
1071 }
1072 }
1073 }
1074 $this->updated = $this->pg_obj->update();
1075 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1076
1077 $this->ctrl->redirect($this, "editCellAlignment");
1078 }

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

+ Here is the call graph for this function:

◆ setBasicTableCellStyles()

ilPCTableGUI::setBasicTableCellStyles ( )

Set basic table cell styles.

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

59 {
60 $this->setCharacteristics(array("Cell1" => "Cell1", "Cell2" => "Cell2",
61 "Cell3" => "Cell3", "Cell4" => "Cell4"));
62 }

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

131 {
132 $ilTabs = $this->tabs;
133 $ilCtrl = $this->ctrl;
135
136 $ilTabs->addSubTabTarget(
137 "cont_style",
138 $ilCtrl->getLinkTarget($this, "editCellStyle"),
139 "editCellStyle",
140 get_class($this)
141 );
142
143 $ilTabs->addSubTabTarget(
144 "cont_width",
145 $ilCtrl->getLinkTarget($this, "editCellWidth"),
146 "editCellWidth",
147 get_class($this)
148 );
149
150 $ilTabs->addSubTabTarget(
151 "cont_alignment",
152 $ilCtrl->getLinkTarget($this, "editCellAlignment"),
153 "editCellAlignment",
154 get_class($this)
155 );
156
157 $ilTabs->addSubTabTarget(
158 "cont_span",
159 $ilCtrl->getLinkTarget($this, "editCellSpan"),
160 "editCellSpan",
161 get_class($this)
162 );
163 }

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and $tabs.

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

+ Here is the caller graph for this function:

◆ setEditorToolContext()

ilPCTableGUI::setEditorToolContext ( )
protected

Set editor tool context.

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

1084 {
1085 $collection = $this->tool_context->current()->getAdditionalData();
1086 if ($collection->exists(ilCOPageEditGSToolProvider::SHOW_EDITOR)) {
1087 $collection->replace(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
1088 } else {
1089 $collection->add(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
1090 }
1091 }

References ilCOPageEditGSToolProvider\SHOW_EDITOR.

Referenced by editData().

+ Here is the caller graph for this function:

◆ setProperties()

ilPCTableGUI::setProperties ( )

Set properties from input form.

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

827 {
828 // mask html
829 $caption = ilUtil::stripSlashes($_POST["caption"]);
830 $caption = str_replace("&", "&amp;", $caption);
831 $caption = str_replace("<", "&lt;", $caption);
832 $caption = str_replace(">", "&gt;", $caption);
833
834 $this->content_obj->setLanguage(ilUtil::stripSlashes($_POST["language"]));
835 $this->content_obj->setWidth(ilUtil::stripSlashes($_POST["width"]));
836 $this->content_obj->setBorder(ilUtil::stripSlashes($_POST["border"]));
837 $this->content_obj->setCellSpacing(ilUtil::stripSlashes($_POST["spacing"]));
838 $this->content_obj->setCellPadding(ilUtil::stripSlashes($_POST["padding"]));
839 $this->content_obj->setHorizontalAlign(ilUtil::stripSlashes($_POST["align"]));
840 $this->content_obj->setHeaderRows(ilUtil::stripSlashes($_POST["row_header"]));
841 $this->content_obj->setHeaderCols(ilUtil::stripSlashes($_POST["col_header"]));
842 $this->content_obj->setFooterRows(ilUtil::stripSlashes($_POST["row_footer"]));
843 $this->content_obj->setFooterCols(ilUtil::stripSlashes($_POST["col_footer"]));
844 if (strpos($_POST["characteristic"], ":") > 0) {
845 $t = explode(":", $_POST["characteristic"]);
846 $this->content_obj->setTemplate(ilUtil::stripSlashes($t[2]));
847 $this->content_obj->setClass("");
848 } else {
849 $this->content_obj->setClass(ilUtil::stripSlashes($_POST["characteristic"]));
850 $this->content_obj->setTemplate("");
851 }
852 $this->content_obj->setCaption(
853 $caption,
854 ilUtil::stripSlashes($_POST["cap_align"])
855 );
856 }

References $_POST, 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 807 of file class.ilPCTableGUI.php.

808 {
810
811 if (is_array($_POST["colspan"])) {
812 foreach ($_POST["colspan"] as $k => $span) {
813 $_POST["colspan"][$k] = ilUtil::stripSlashes($span);
814 $_POST["rowspan"][$k] = ilUtil::stripSlashes($_POST["rowspan"][$k]);
815 }
816 $this->content_obj->setTDSpans($_POST["colspan"], $_POST["rowspan"]);
817 }
818 $this->updated = $this->pg_obj->update();
819 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
820 $this->ctrl->redirect($this, "editCellSpan");
821 }

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

+ Here is the call graph for this function:

◆ setStyles()

ilPCTableGUI::setStyles ( )

Set cell styles and.

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

762 {
764
765 if (is_array($_POST["target"])) {
766 foreach ($_POST["target"] as $k => $value) {
767 if ($value > 0) {
768 $cid = explode(":", $k);
769 $this->content_obj->setTDClass(
770 ilUtil::stripSlashes($cid[0]),
772 ilUtil::stripSlashes($cid[1])
773 );
774 }
775 }
776 }
777 $this->updated = $this->pg_obj->update();
778 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
779 $this->ctrl->redirect($this, "editCellStyle");
780 }

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

+ Here is the call graph for this function:

◆ setTabs()

ilPCTableGUI::setTabs (   $data_tab_txt_key = "")

Set tabs.

Reimplemented in ilPCDataTableGUI.

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

91 {
92 $ilTabs = $this->tabs;
93 $ilCtrl = $this->ctrl;
95
96 $ilTabs->setBackTarget(
97 $lng->txt("pg"),
98 $this->ctrl->getParentReturn($this)
99 );
100
101 if ($data_tab_txt_key == "") {
102 $data_tab_txt_key = "cont_table_edit_cells";
103 }
104
105 $ilTabs->addTarget(
106 $data_tab_txt_key,
107 $ilCtrl->getLinkTarget($this, "editData"),
108 "editData",
109 get_class($this)
110 );
111
112 $ilTabs->addTarget(
113 "cont_table_properties",
114 $ilCtrl->getLinkTarget($this, "editProperties"),
115 "editProperties",
116 get_class($this)
117 );
118
119 $ilTabs->addTarget(
120 "cont_table_cell_properties",
121 $ilCtrl->getLinkTarget($this, "editCellStyle"),
122 "editCellStyle",
123 get_class($this)
124 );
125 }

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, and $tabs.

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

+ Here is the caller graph for this function:

◆ setWidths()

ilPCTableGUI::setWidths ( )

Set cell widths.

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

786 {
788
789 if (is_array($_POST["width"])) {
790 foreach ($_POST["width"] as $k => $width) {
791 $cid = explode(":", $k);
792 $this->content_obj->setTDWidth(
793 ilUtil::stripSlashes($cid[0]),
794 ilUtil::stripSlashes($width),
795 ilUtil::stripSlashes($cid[1])
796 );
797 }
798 }
799 $this->updated = $this->pg_obj->update();
800 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
801 $this->ctrl->redirect($this, "editCellWidth");
802 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $tabs

ilPCTableGUI::$tabs
protected

◆ $tool_context

ilPCTableGUI::$tool_context
protected

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

◆ $user

ilPCTableGUI::$user
protected

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

Referenced by initPropertiesForm(), and insert().


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