ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCTableGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 setBasicTableCellStyles ()
 
 executeCommand ()
 
 setTabs (string $data_tab_txt_key="")
 
 setCellPropertiesSubTabs ()
 
 getTemplateOptions (string $a_type="")
 
 edit ()
 
 editProperties ()
 
 initPropertiesForm (string $a_mode="edit")
 
 getPropertiesFormValues ()
 
 editCellStyle ()
 
 editCellWidth ()
 
 editCellSpan ()
 
 setStyles ()
 Set cell styles. 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 ()
 
 leftAlign ()
 
 centerAlign ()
 
 leftFloatAlign ()
 
 rightFloatAlign ()
 
 insert ()
 
 getNewTableObject ()
 
 create ()
 create new table in dom and update page in db More...
 
 afterCreation ()
 
 editCellAlignment ()
 
 setAlignment ()
 Set cell alignments. More...
 
 editData ()
 Edit data of table. More...
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 displayValidationError ()
 
 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 (string $a_type="")
 Get table templates. More...
 

Static Public Member Functions

static _renderTable (string $content, string $a_mode="table_edit", string $a_submode="", ?ilPCTable $a_table_obj=null, bool $unmask=true, ?ilPageObject $page_object=null)
 
static _addStyleCheckboxes (string $a_output, ilPCTable $a_table)
 Add style checkboxes in edit mode. More...
 
static _addAlignmentCheckboxes (string $a_output, ilPCTable $a_table)
 Add alignment checkboxes in edit mode. More...
 
static _addWidthInputs (string $a_output, ilPCTable $a_table)
 Add width inputs. More...
 
static _addSpanInputs (string $a_output, ilPCTable $a_table)
 Add span inputs. More...
 
- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 

Protected Member Functions

 getFormTitle (string $a_mode="edit")
 
 getColumnCaption (int $nr)
 
 getCellContent (int $i, int $j)
 
 renderCell ( $content, $unmask=true, $page_object=null)
 Static render table function. More...
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 

Protected Attributes

ILIAS COPage Dom DomUtil $dom_util
 
ILIAS COPage PC PCDefinition $pc_definition
 
ILIAS COPage Xsl XslManager $xsl
 
ilPropertyFormGUI $form
 
ilTabsGUI $tabs
 
ilObjUser $user
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
LOMServices $lom_services
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static string $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 array $common_bb_buttons
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning User Interface for Table Editing

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de See https://mantis.ilias.de/view.php?id=32856 ilPCTableGUI: ilAssGenFeedbackPageGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPCTableGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

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

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

39  {
40  global $DIC;
41 
42  $this->tabs = $DIC->tabs();
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->tpl = $DIC["tpl"];
46  $this->user = $DIC->user();
47  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
48  $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
49  $this->tool_context = $DIC->globalScreen()->tool()->context();
50  $this->xsl = $DIC->copage()->internal()->domain()->xsl();
51  $this->pc_definition = $DIC
52  ->copage()
53  ->internal()
54  ->domain()
55  ->pc()
56  ->definition();
57  $this->dom_util = $DIC->copage()->internal()->domain()->domUtil();
58  }
setCharacteristics(array $a_chars)
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ _addAlignmentCheckboxes()

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

Add alignment checkboxes in edit mode.

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

References $check, $DIC, ilPageContentGUI\$lng, ilPCTable\getAllCellAlignments(), and ilLanguage\txt().

Referenced by _renderTable().

561  : string {
562  global $DIC;
563 
564  $lng = $DIC->language();
565 
566  $classes = $a_table->getAllCellAlignments();
567 
568  foreach ($classes as $k => $v) {
569  if ($v == "") {
570  $v = $lng->txt("default");
571  }
572  $check = $lng->txt("cont_alignment") . ": " .
573  '<input type="checkbox" value="1"' .
574  ' name="target[' . $k . ']">' . '</input> ' . $v;
575 
576  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
577  }
578  return $a_output;
579  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: shib_login.php:22
$check
Definition: buildRTE.php:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _addSpanInputs()

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

Add span inputs.

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

References $DIC, ilPageContentGUI\$lng, ilPCTable\getAllCellSpans(), and ilLanguage\txt().

Referenced by _renderTable().

610  : string {
611  global $DIC;
612 
613  $lng = $DIC->language();
614 
615  $spans = $a_table->getAllCellSpans();
616 
617  foreach ($spans as $k => $v) {
618  // colspans
619  $selects = '<div style="white-space:nowrap;">' . $lng->txt("cont_colspan") . ": " .
620  '<select class="small" name="colspan[' . $k . ']">';
621  for ($i = 1; $i <= $v["max_x"] - $v["x"] + 1; $i++) {
622  $sel_str = ($i == $v["colspan"])
623  ? 'selected="selected"'
624  : '';
625  $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
626  }
627  $selects .= "</select></div>";
628 
629  // rowspans
630  $selects .= '<div style="margin-top:3px; white-space:nowrap;">' . $lng->txt("cont_rowspan") . ": " .
631  '<select class="small" name="rowspan[' . $k . ']">';
632  for ($i = 1; $i <= $v["max_y"] - $v["y"] + 1; $i++) {
633  $sel_str = ($i == $v["rowspan"])
634  ? 'selected="selected"'
635  : '';
636  $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
637  }
638  $selects .= "</select></div>";
639 
640  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $selects, $a_output);
641  }
642  return $a_output;
643  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: shib_login.php:22
getAllCellSpans()
Get all cell spans.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _addStyleCheckboxes()

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

Add style checkboxes in edit mode.

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

References $check, $DIC, ilPageContentGUI\$lng, ilPCTable\getAllCellClasses(), and ilLanguage\txt().

Referenced by _renderTable().

532  : string {
533  global $DIC;
534 
535  $lng = $DIC->language();
536 
537  $classes = $a_table->getAllCellClasses();
538 
539  foreach ($classes as $k => $v) {
540  if ($v == "") {
541  $v = $lng->txt("none");
542  }
543  if (substr($v, 0, 4) == "ilc_") {
544  $v = substr($v, 4);
545  }
546  $check = $lng->txt("cont_style") . ": " .
547  '<input type="checkbox" value="1"' .
548  ' name="target[' . $k . ']">' . '</input> ' . $v;
549 
550  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
551  }
552  return $a_output;
553  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: shib_login.php:22
$check
Definition: buildRTE.php:81
getAllCellClasses()
Get all cell classes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _addWidthInputs()

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

Add width inputs.

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

References $check, $DIC, ilPageContentGUI\$lng, ilPCTable\getAllCellWidths(), and ilLanguage\txt().

Referenced by _renderTable().

587  : string {
588  global $DIC;
589 
590  $lng = $DIC->language();
591 
592  $widths = $a_table->getAllCellWidths();
593 
594  foreach ($widths as $k => $v) {
595  $check = $lng->txt("cont_width") . ": " .
596  '<input class="small" type="text" size="5" maxlength="10"' .
597  ' name="width[' . $k . ']" value="' . $v . '">' . '</input>';
598 
599  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
600  }
601  return $a_output;
602  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: shib_login.php:22
getAllCellWidths()
Get all cell widths.
$check
Definition: buildRTE.php:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _renderTable()

static ilPCTableGUI::_renderTable ( string  $content,
string  $a_mode = "table_edit",
string  $a_submode = "",
?ilPCTable  $a_table_obj = null,
bool  $unmask = true,
?ilPageObject  $page_object = null 
)
static

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

References $DIC, $params, _addAlignmentCheckboxes(), _addSpanInputs(), _addStyleCheckboxes(), _addWidthInputs(), ilUtil\getImagePath(), and ilFileUtils\getWebspaceDir().

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

469  : string {
470  global $DIC;
471 
472  $ilUser = $DIC->user();
473  $xsl = $DIC->copage()->internal()->domain()->xsl();
474  $pc_definition = $DIC->copage()->internal()->domain()->pc()->definition();
475 
476  $content = "<dummy>" . $content . "</dummy>";
477 
478  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
479  $enlarge_path = ilUtil::getImagePath("media/enlarge.svg");
480  $params = array('mode' => $a_mode,
481  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
482  $output = $xsl->process($content, $params);
483 
484  // unmask user html
485  if ($unmask) {
486  $output = str_replace("&lt;", "<", $output);
487  $output = str_replace("&gt;", ">", $output);
488  $output = str_replace("&amp;", "&", $output);
489  }
490 
491  if ($a_mode == "table_edit" && !is_null($a_table_obj)) {
492  switch ($a_submode) {
493  case "style":
494  $output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
495  break;
496 
497  case "alignment":
498  $output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
499  break;
500 
501  case "width":
502  $output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
503  break;
504 
505  case "span":
506  $output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
507  break;
508  }
509  }
510 
511  // for all page components...
512  if (isset($page_object)) {
513  $defs = $pc_definition->getPCDefinitions();
514  foreach ($defs as $def) {
515  $pc_class = $def["pc_class"];
516  $pc_obj = new $pc_class($page_object);
517 
518  // post xsl page content modification by pc elements
519  $output = $pc_obj->modifyPageContentPostXsl($output, "presentation", false);
520  }
521  }
522 
523  return $output;
524  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
ILIAS COPage PC PCDefinition $pc_definition
static _addStyleCheckboxes(string $a_output, ilPCTable $a_table)
Add style checkboxes in edit mode.
static _addSpanInputs(string $a_output, ilPCTable $a_table)
Add span inputs.
static _addAlignmentCheckboxes(string $a_output, ilPCTable $a_table)
Add alignment checkboxes in edit mode.
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
ILIAS COPage Xsl XslManager $xsl
static _addWidthInputs(string $a_output, ilPCTable $a_table)
Add width inputs.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterCreation()

ilPCTableGUI::afterCreation ( )

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

References ILIAS\Repository\ctrl().

Referenced by create().

947  : void
948  {
949  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
950  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ centerAlign()

ilPCTableGUI::centerAlign ( )

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

References ilPageContentGUI\updateAndReturn().

868  : void
869  {
870  $this->content_obj->setHorizontalAlign("Center");
871  $this->updateAndReturn();
872  }
+ Here is the call graph for this function:

◆ create()

ilPCTableGUI::create ( )

create new table in dom and update page in db

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

References afterCreation(), ILIAS\Repository\form(), getNewTableObject(), initPropertiesForm(), insert(), and setProperties().

904  : void
905  {
906  $this->content_obj = $this->getNewTableObject();
907  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
908 
909  $this->initPropertiesForm("create");
910  $this->form->checkInput();
911 
912  $import_table = trim($this->form->getInput("import_table"));
913 
914  // import xhtml or spreadsheet table
915  if (!empty($import_table)) {
916  switch ($this->form->getInput("import_type")) {
917  // xhtml import
918 
919  // spreadsheet
920  case "spreadsheet":
921  $this->content_obj->importSpreadsheet($this->form->getInput("language"), $import_table);
922  break;
923  }
924  } else {
925  $this->content_obj->addRows(
926  $this->form->getInput("nr_rows"),
927  $this->form->getInput("nr_cols")
928  );
929  }
930 
931  $this->setProperties();
932 
933  $frtype = $this->form->getInput("first_row_style");
934  if ($frtype != "") {
935  $this->content_obj->setFirstRowStyle($frtype);
936  }
937 
938  $this->updated = $this->pg_obj->update();
939 
940  if ($this->updated === true) {
941  $this->afterCreation();
942  } else {
943  $this->insert();
944  }
945  }
initPropertiesForm(string $a_mode="edit")
form( $class_path, string $cmd, string $submit_caption="")
setProperties()
Set properties from input form.
+ Here is the call graph for this function:

◆ edit()

ilPCTableGUI::edit ( )

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

References ILIAS\Repository\ctrl().

Referenced by saveProperties().

171  : void
172  {
173  $this->ctrl->redirect($this, "editData");
174  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editCellAlignment()

ilPCTableGUI::editCellAlignment ( )

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

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilPageContentGUI\displayValidationError(), ilPropertyFormGUI\getHTML(), ILIAS\Repository\lng(), setCellPropertiesSubTabs(), ILIAS\UICore\GlobalTemplate\setContent(), ilFormGUI\setFormAction(), ilFormGUI\setKeepOpen(), ilSelectInputGUI\setOptions(), setTabs(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

957  : void
958  {
959  $ilCtrl = $this->ctrl;
960  $tpl = $this->tpl;
961  $lng = $this->lng;
962  $ilTabs = $this->tabs;
963 
964  $this->displayValidationError();
965  $this->setTabs();
966  $this->setCellPropertiesSubTabs();
967  $ilTabs->setSubTabActive("cont_alignment");
968  $ilTabs->setTabActive("cont_table_cell_properties");
969 
970  // edit form
971  $form = new ilPropertyFormGUI();
972  $form->setFormAction($ilCtrl->getFormAction($this));
973  $form->setTitle($this->lng->txt("cont_table_cell_properties"));
974 
975  // alignment
976  $options = array(
977  "" => $lng->txt("default"),
978  "Left" => $lng->txt("cont_left"),
979  "Center" => $lng->txt("cont_center"),
980  "Right" => $lng->txt("cont_right")
981  );
982  $si = new ilSelectInputGUI($lng->txt("cont_alignment"), "alignment");
983  $si->setOptions($options);
984  $si->setInfo($lng->txt(""));
985  $form->addItem($si);
986 
987  $form->setKeepOpen(true);
988 
989  $form->addCommandButton("setAlignment", $lng->txt("cont_set_alignment"));
990 
991  $html = $form->getHTML();
992  $html .= "<br />" . $this->renderTable("table_edit", "alignment") . "</form>";
993  $tpl->setContent($html);
994  }
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilPropertyFormGUI $form
setContent(string $a_html)
Sets content for standard template.
setOptions(array $a_options)
setFormAction(string $a_formaction)
ilGlobalTemplateInterface $tpl
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
setKeepOpen(bool $a_keepopen)
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ editCellSpan()

ilPCTableGUI::editCellSpan ( )

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

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), ILIAS\UICore\GlobalTemplate\setContent(), setTabs(), and ilLanguage\txt().

708  : void
709  {
710  $ilCtrl = $this->ctrl;
711  $tpl = $this->tpl;
712  $lng = $this->lng;
713  $ilTabs = $this->tabs;
714 
715  $this->displayValidationError();
716  $this->setTabs();
717  $this->setCellPropertiesSubTabs();
718  $ilTabs->setSubTabActive("cont_span");
719  $ilTabs->setTabActive("cont_table_cell_properties");
720 
721  $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "components/ILIAS/COPage");
722  $ctpl->setVariable("BTN_NAME", "setSpans");
723  $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_spans"));
724  $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
725 
726  $html = $ctpl->get();
727  $html .= "<br />" . $this->renderTable("table_edit", "span") . "</form>";
728  $tpl->setContent($html);
729  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ editCellStyle()

ilPCTableGUI::editCellStyle ( )

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

References ilPageContentGUI\$chars, ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilPageContentGUI\$style, $tabs, ilPageContentGUI\$tpl, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilPageContentGUI\displayValidationError(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ilPropertyFormGUI\getHTML(), ILIAS\Repository\lng(), setBasicTableCellStyles(), setCellPropertiesSubTabs(), ILIAS\UICore\GlobalTemplate\setContent(), ilFormGUI\setFormAction(), ilFormGUI\setKeepOpen(), setTabs(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

645  : void
646  {
647  $ilCtrl = $this->ctrl;
648  $tpl = $this->tpl;
649  $lng = $this->lng;
650  $ilTabs = $this->tabs;
651 
652  $this->displayValidationError();
653  $this->setTabs();
654  $this->setCellPropertiesSubTabs();
655  $ilTabs->setSubTabActive("cont_style");
656 
657  // edit form
658  $form = new ilPropertyFormGUI();
659  $form->setFormAction($ilCtrl->getFormAction($this));
660  $form->setTitle($this->lng->txt("cont_table_cell_properties"));
661 
662  // first row style
663  $style = new ilSelectInputGUI(
664  $this->lng->txt("cont_style"),
665  "style"
666  );
667  $this->setBasicTableCellStyles();
668  $this->getCharacteristicsOfCurrentStyle(["table_cell"]); // scorm-2004
669  $chars = $this->getCharacteristics(); // scorm-2004
670  $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
671  $style->setOptions($options);
672 
673  $style->setValue("");
674  $style->setInfo($lng->txt("cont_set_tab_style_info"));
675  $form->addItem($style);
676  $form->setKeepOpen(true);
677 
678  $form->addCommandButton("setStyles", $lng->txt("cont_set_styles"));
679 
680  $html = $form->getHTML();
681  $html .= "<br />" . $this->renderTable("table_edit", "style") . "</form>";
682  $tpl->setContent($html);
683  }
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilPropertyFormGUI $form
setContent(string $a_html)
Sets content for standard template.
setFormAction(string $a_formaction)
ilGlobalTemplateInterface $tpl
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
setKeepOpen(bool $a_keepopen)
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ editCellWidth()

ilPCTableGUI::editCellWidth ( )

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

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), setCellPropertiesSubTabs(), ILIAS\UICore\GlobalTemplate\setContent(), setTabs(), and ilLanguage\txt().

685  : void
686  {
687  $ilCtrl = $this->ctrl;
688  $tpl = $this->tpl;
689  $lng = $this->lng;
690  $ilTabs = $this->tabs;
691 
692  $this->displayValidationError();
693  $this->setTabs();
694  $this->setCellPropertiesSubTabs();
695  $ilTabs->setSubTabActive("cont_width");
696  $ilTabs->setTabActive("cont_table_cell_properties");
697 
698  $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "components/ILIAS/COPage");
699  $ctpl->setVariable("BTN_NAME", "setWidths");
700  $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_widths"));
701  $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
702 
703  $html = $ctpl->get();
704  $html .= "<br />" . $this->renderTable("table_edit", "width") . "</form>";
705  $tpl->setContent($html);
706  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ editData()

ilPCTableGUI::editData ( )

Edit data of table.

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

References ilPageContentGUI\$content_obj, ilPageContentGUI\$ctrl, $id, $path, ilPageContentGUI\$style, ilObjStyleSheet\_lookupTemplateIdByName(), ILIAS\Repository\ctrl(), ilPageContentGUI\displayValidationError(), ilObjStyleSheet\getBaseContentStylePath(), getCellContent(), getColumnCaption(), ilPageContentGUI\getEditorScriptTag(), ilPageContentGUI\getHierId(), ilInternalLinkGUI\getInitHTML(), ilPageContentGUI\getStyleId(), ilPageContentGUI\initEditor(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and setTabs().

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

1026  : void
1027  {
1028  $this->setTabs();
1029 
1030  $this->displayValidationError();
1031  $this->initEditor();
1032  $this->tpl->addJavaScript("assets/js/AdvancedSelectionList.js");
1033  $this->tpl->addCss(ilObjStyleSheet::getBaseContentStylePath());
1034  $this->tpl->setContent($this->getEditDataTable(true));
1035  }
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editProperties()

ilPCTableGUI::editProperties ( )

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ILIAS\Repository\form(), getPropertiesFormValues(), initPropertiesForm(), ILIAS\UICore\GlobalTemplate\setContent(), and setTabs().

176  : void
177  {
178  $tpl = $this->tpl;
179 
180  $this->displayValidationError();
181  $this->setTabs();
182 
183  $this->initPropertiesForm();
184  $this->getPropertiesFormValues();
185  $html = $this->form->getHTML();
186  $html .= "<br />" . $this->renderTable("");
187  $tpl->setContent($html);
188  }
initPropertiesForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd, string $submit_caption="")
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ executeCommand()

ilPCTableGUI::executeCommand ( )
Returns
mixed

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

References ILIAS\Repository\ctrl(), and ilPageContentGUI\getCharacteristicsOfCurrentStyle().

70  {
71  $this->getCharacteristicsOfCurrentStyle(["table"]); // scorm-2004
72 
73  // get next class that processes or forwards current command
74  $next_class = $this->ctrl->getNextClass($this);
75 
76  // get current command
77  $cmd = $this->ctrl->getCmd();
78 
79  switch ($next_class) {
80  default:
81  $this->$cmd();
82  break;
83  }
84  return "";
85  }
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
+ Here is the call graph for this function:

◆ getCellContent()

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

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

References ilPageContentGUI\$style, ilObject\_lookupType(), ilPageContentGUI\getPage(), ilPageContentGUI\getStyleId(), ilObjStyleSheet\getTemplateXML(), and renderCell().

Referenced by editData().

1320  : string
1321  {
1322  $tab_node = $this->content_obj->getDomNode();
1323  $cnt_i = 0;
1324  $content = "";
1325  $template_xml = "";
1326  // get correct cell and dump content of all its childrem
1327  foreach ($tab_node->firstChild->childNodes as $child) {
1328  if ($i == $cnt_i) {
1329  $cnt_j = 0;
1330  foreach ($child->childNodes as $child2) {
1331  if ($j == $cnt_j) {
1332  foreach ($child2->childNodes as $cell_content_node) {
1333  $content .= $this->dom_util->dump($cell_content_node);
1334  }
1335  }
1336  $cnt_j++;
1337  }
1338  }
1339  $cnt_i++;
1340  }
1341  $trans = $this->pg_obj->getLanguageVariablesXML();
1342  $mobs = $this->pg_obj->getMultimediaXML();
1343  if ($this->getStyleId() > 0) {
1344  if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1345  $style = new ilObjStyleSheet($this->getStyleId());
1346  $template_xml = $style->getTemplateXML();
1347  }
1348  }
1349 
1350  $content = $content . $mobs . $trans . $template_xml;
1351 
1352  return $this->renderCell(
1353  $content,
1354  !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
1355  $this->getPage()
1356  );
1357  }
renderCell( $content, $unmask=true, $page_object=null)
Static render table function.
getTemplateXML()
Get table template xml.
static _lookupType(int $id, bool $reference=false)
+ 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 1308 of file class.ilPCTableGUI.php.

Referenced by editData().

1308  : string
1309  {
1310  $cap = "";
1311  $base = 26;
1312  while ($nr > 0) {
1313  $chr = ($nr - 1) % $base;
1314  $cap = chr($chr + 65) . $cap;
1315  $nr = ($nr - 1 - $chr) / $base;
1316  }
1317  return $cap;
1318  }
+ Here is the caller graph for this function:

◆ getFormTitle()

ilPCTableGUI::getFormTitle ( string  $a_mode = "edit")
protected

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

References ILIAS\Repository\lng().

Referenced by initPropertiesForm().

190  : string
191  {
192  if ($a_mode === "create") {
193  return $this->lng->txt("cont_insert_table");
194  }
195  return $this->lng->txt("cont_table_properties");
196  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewTableObject()

ilPCTableGUI::getNewTableObject ( )

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

References ilPageContentGUI\getPage().

Referenced by create().

896  : ilPCTable
897  {
898  return new ilPCTable($this->getPage());
899  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPropertiesFormValues()

ilPCTableGUI::getPropertiesFormValues ( )

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

References ilPageContentGUI\$content_obj, ilPageContentGUI\$style, ilObjStyleSheet\_lookupTemplateIdByName(), ilObject\_lookupType(), _renderTable(), ILIAS\Repository\form(), ilPageContentGUI\getPage(), ilPageContentGUI\getStyleId(), and ilObjStyleSheet\getTemplateXML().

Referenced by editProperties().

401  : void
402  {
403  $values = array();
404  $values["width"] = $this->content_obj->getWidth();
405  //$values["border"] = $this->content_obj->getBorder();
406  //$values["padding"] = $this->content_obj->getCellPadding();
407  //$values["spacing"] = $this->content_obj->getCellSpacing();
408  $values["row_header"] = $this->content_obj->getHeaderRows();
409  $values["row_footer"] = $this->content_obj->getFooterRows();
410  $values["col_header"] = $this->content_obj->getHeaderCols();
411  $values["col_footer"] = $this->content_obj->getFooterCols();
412  if ($this->content_obj->getTemplate() != "") {
413  $values["characteristic"] = "t:" .
414  ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()) . ":" .
415  $this->content_obj->getTemplate();
416  } else {
417  $values["characteristic"] = $this->content_obj->getClass();
418  }
419  $values["align"] = $this->content_obj->getHorizontalAlign();
420  $values["caption"] = $this->content_obj->getCaption();
421  $values["cap_align"] = $this->content_obj->getCaptionAlign();
422  $values["language"] = $this->content_obj->getLanguage();
423 
424  $this->form->setValuesByArray($values);
425 
426  $ca = $this->form->getItemByPostVar("cap_align");
427  $ca->setValue($this->content_obj->getCaptionAlign());
428  }
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateOptions()

ilPCTableGUI::getTemplateOptions ( string  $a_type = "")

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

Referenced by ilPCDataTableGUI\initCreationForm(), ilPCDataTableGUI\initEditingForm(), ilPCDataTableGUI\initImportForm(), and initPropertiesForm().

166  : array
167  {
168  return parent::getTemplateOptions("table");
169  }
+ Here is the caller graph for this function:

◆ initPropertiesForm()

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

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

References ilPageContentGUI\$chars, ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $user, ilRadioOption\addSubItem(), ILIAS\Repository\form(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ilPageContentGUI\getCurrentTextLang(), getFormTitle(), getTemplateOptions(), ILIAS\Repository\lng(), setBasicTableCellStyles(), ilSelectInputGUI\setOptions(), and ilLanguage\txt().

Referenced by create(), editProperties(), insert(), and setProperties().

200  : void {
201  $a_seleted_value = "";
202  $ilCtrl = $this->ctrl;
203  $lng = $this->lng;
204  $ilUser = $this->user;
205 
206  $this->form = new ilPropertyFormGUI();
207  $this->form->setFormAction($ilCtrl->getFormAction($this));
208  $this->form->setTitle($this->getFormTitle($a_mode));
209 
210  if ($a_mode == "create") {
211  $nr = array();
212  for ($i = 1; $i <= 20; $i++) {
213  $nr[$i] = $i;
214  }
215 
216  // cols
217  $cols = new ilSelectInputGUI($this->lng->txt("cont_nr_cols"), "nr_cols");
218  $cols->setOptions($nr);
219  $cols->setValue(2);
220  $this->form->addItem($cols);
221 
222  // rows
223  $rows = new ilSelectInputGUI($this->lng->txt("cont_nr_rows"), "nr_rows");
224  $rows->setOptions($nr);
225  $rows->setValue(2);
226  $this->form->addItem($rows);
227  }
228 
229  // width
230  $width = new ilTextInputGUI($this->lng->txt("cont_table_width"), "width");
231  $width->setSize(6);
232  $width->setMaxLength(6);
233  $this->form->addItem($width);
234 
235  /*
236  // border
237  $border = new ilTextInputGUI($this->lng->txt("cont_table_border"), "border");
238  $border->setInfo($this->lng->txt("cont_table_border_info"));
239  $border->setValue("1px");
240  $border->setSize(6);
241  $border->setMaxLength(6);
242  $this->form->addItem($border);
243 
244  // padding
245  $padding = new ilTextInputGUI($this->lng->txt("cont_table_cellpadding"), "padding");
246  $padding->setInfo($this->lng->txt("cont_table_cellpadding_info"));
247  $padding->setValue("2px");
248  $padding->setSize(6);
249  $padding->setMaxLength(6);
250  $this->form->addItem($padding);
251 
252  // spacing (deprecated, only hidden)
253  $spacing = new ilHiddenInputGUI("spacing");
254  $spacing->setValue("0px");
255  $this->form->addItem($spacing);*/
256 
257  // table templates and table classes
258  $char_prop = new ilSelectInputGUI(
259  $this->lng->txt("cont_characteristic_table"),
260  "characteristic"
261  );
262  $chars = $this->getCharacteristics();
263  $templates = $this->getTemplateOptions();
264  $chars = array_merge($templates, $chars);
265  if (is_object($this->content_obj)) {
266  if (($chars[$a_seleted_value] ?? "") == "" && ($this->content_obj->getClass() != "")) {
267  $chars = array_merge(
268  array($this->content_obj->getClass() => $this->content_obj->getClass()),
269  $chars
270  );
271  }
272  }
273  $options = [];
274  foreach ($chars as $k => $char) {
275  if (strpos($k, ":") > 0) {
276  $t = explode(":", $k);
277  $html = $this->style->lookupTemplatePreview($t[1]) . '<div style="clear:both;" class="small">' . $char . "</div>";
278  } else {
279  $html = '<table class="ilc_table_' . $k . '"><tr><td class="small">' .
280  $char . '</td></tr></table>';
281  }
282  //$char_prop->addOption($k, $char, $html);
283  $options[$k] = $char;
284  }
285  $char_prop->setOptions($options);
286  $char_prop->setValue("StandardTable");
287  $this->form->addItem($char_prop);
288 
289  $nr = array();
290  for ($i = 0; $i <= 3; $i++) {
291  $nr[$i] = $i;
292  }
293 
294  // row header
295  $rh = new ilSelectInputGUI($this->lng->txt("cont_nr_row_header"), "row_header");
296  $rh->setOptions($nr);
297  $rh->setValue(1);
298  $this->form->addItem($rh);
299 
300  // row footer
301  $rf = new ilSelectInputGUI($this->lng->txt("cont_nr_row_footer"), "row_footer");
302  $rf->setOptions($nr);
303  $rf->setValue(0);
304  $this->form->addItem($rf);
305 
306  // col header
307  $ch = new ilSelectInputGUI($this->lng->txt("cont_nr_col_header"), "col_header");
308  $ch->setOptions($nr);
309  $ch->setValue(0);
310  $this->form->addItem($ch);
311 
312  // col footer
313  $cf = new ilSelectInputGUI($this->lng->txt("cont_nr_col_footer"), "col_footer");
314  $cf->setOptions($nr);
315  $cf->setValue(0);
316  $this->form->addItem($cf);
317 
318  if ($a_mode == "create") {
319  // first row style
320  $fr_style = new ilSelectInputGUI(
321  $this->lng->txt("cont_first_row_style"),
322  "first_row_style"
323  );
324  $this->setBasicTableCellStyles();
325  $this->getCharacteristicsOfCurrentStyle(["table_cell"]);
326  $chars = $this->getCharacteristics();
327  $options = array_merge(array("" => $this->lng->txt("none")), $chars);
328  $fr_style->setOptions($options);
329 
330  $fr_style->setValue("");
331  $this->form->addItem($fr_style);
332  }
333 
334  // alignment
335  $align_opts = array("Left" => $lng->txt("cont_left"),
336  "Right" => $lng->txt("cont_right"), "Center" => $lng->txt("cont_center"),
337  "LeftFloat" => $lng->txt("cont_left_float"),
338  "RightFloat" => $lng->txt("cont_right_float"));
339  $align = new ilSelectInputGUI($this->lng->txt("cont_align"), "align");
340  $align->setOptions($align_opts);
341  $align->setValue("Center");
342  $this->form->addItem($align);
343 
344  // caption
345  $caption = new ilTextInputGUI($this->lng->txt("cont_caption"), "caption");
346  $caption->setSize(60);
347  $this->form->addItem($caption);
348 
349  // caption align
350  $ca_opts = array("top" => $lng->txt("cont_top"),
351  "bottom" => $lng->txt("cont_bottom"));
352  $ca = new ilSelectInputGUI(
353  $this->lng->txt("cont_align"),
354  "cap_align"
355  );
356  $ca->setOptions($ca_opts);
357  $caption->addSubItem($ca);
358 
359  // import
360  if ($a_mode == "create") {
361  // import table
362  $import = new ilRadioGroupInputGUI($this->lng->txt("cont_paste_table"), "import_type");
363  $op = new ilRadioOption($this->lng->txt("cont_html_table"), "html");
364  $import->addOption($op);
365  $op2 = new ilRadioOption($this->lng->txt("cont_spreadsheet_table"), "spreadsheet");
366 
367  $import_data = new ilTextAreaInputGUI("", "import_table");
368  $import_data->setRows(8);
369  $import_data->setCols(50);
370  $op2->addSubItem($import_data);
371 
372  $import->addOption($op2);
373  $import->setValue("html");
374  $this->form->addItem($import);
375  }
376 
377  // language
378  if ($this->getCurrentTextLang() != "") {
379  $s_lang = $this->getCurrentTextLang();
380  } else {
381  $s_lang = $ilUser->getLanguage();
382  }
383  $languages = [];
384  foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
385  $languages[$language->value()] = $language->presentableLabel();
386  }
387  $language = new ilSelectInputGUI($this->lng->txt("language"), "language");
388  $language->setOptions($languages);
389  $language->setValue($s_lang);
390  $this->form->addItem($language);
391 
392  if ($a_mode == "create") {
393  $this->form->addCommandButton("create", $lng->txt("save"));
394  $this->form->addCommandButton("cancelCreate", $lng->txt("cancel"));
395  } else {
396  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
397  $this->form->addCommandButton("editData", $lng->txt("close"));
398  }
399  }
This class represents an option in a radio group.
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setOptions(array $a_options)
This class represents a property in a property form.
getFormTitle(string $a_mode="edit")
form( $class_path, string $cmd, string $submit_caption="")
getTemplateOptions(string $a_type="")
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCTableGUI::insert ( )

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), ILIAS\Repository\form(), initPropertiesForm(), and ILIAS\UICore\GlobalTemplate\setContent().

Referenced by create().

886  : void
887  {
888  $tpl = $this->tpl;
889 
890  $this->displayValidationError();
891  $this->initPropertiesForm("create");
892  $html = $this->form->getHTML();
893  $tpl->setContent($html);
894  }
initPropertiesForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftAlign()

ilPCTableGUI::leftAlign ( )

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

References ilPageContentGUI\updateAndReturn().

862  : void
863  {
864  $this->content_obj->setHorizontalAlign("Left");
865  $this->updateAndReturn();
866  }
+ Here is the call graph for this function:

◆ leftFloatAlign()

ilPCTableGUI::leftFloatAlign ( )

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

References ilPageContentGUI\updateAndReturn().

874  : void
875  {
876  $this->content_obj->setHorizontalAlign("LeftFloat");
877  $this->updateAndReturn();
878  }
+ Here is the call graph for this function:

◆ renderCell()

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

Static render table function.

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

References $DIC, $params, ilUtil\getImagePath(), and ilFileUtils\getWebspaceDir().

Referenced by getCellContent().

1366  : string {
1367  global $DIC;
1368 
1369  $ilUser = $DIC->user();
1370  $content = "<dummy>" . $content . "</dummy>";
1371 
1372  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
1373  $enlarge_path = ilUtil::getImagePath("media/enlarge.svg");
1374  $params = array('webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
1375  $output = $this->xsl->process($content, $params);
1376 
1377  // unmask user html
1378  if ($unmask) {
1379  $output = str_replace("&lt;", "<", $output);
1380  $output = str_replace("&gt;", ">", $output);
1381  $output = str_replace("&amp;", "&", $output);
1382  }
1383 
1384  // for all page components...
1385  if (isset($page_object)) {
1386  $defs = $this->pc_definition->getPCDefinitions();
1387  foreach ($defs as $def) {
1388  $pc_class = $def["pc_class"];
1389  $pc_obj = new $pc_class($page_object);
1390 
1391  // post xsl page content modification by pc elements
1392  $output = $pc_obj->modifyPageContentPostXsl((string) $output, "presentation", false);
1393  }
1394  }
1395 
1396 
1397  return $output;
1398  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rightAlign()

ilPCTableGUI::rightAlign ( )

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

References ilPageContentGUI\updateAndReturn().

856  : void
857  {
858  $this->content_obj->setHorizontalAlign("Right");
859  $this->updateAndReturn();
860  }
+ Here is the call graph for this function:

◆ rightFloatAlign()

ilPCTableGUI::rightFloatAlign ( )

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

References ilPageContentGUI\updateAndReturn().

880  : void
881  {
882  $this->content_obj->setHorizontalAlign("RightFloat");
883  $this->updateAndReturn();
884  }
+ Here is the call graph for this function:

◆ saveProperties()

ilPCTableGUI::saveProperties ( )

save table properties in db and return to page edit screen

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

References ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), and setProperties().

843  : void
844  {
845  $this->setProperties();
846  $this->updated = $this->pg_obj->update();
847  if ($this->updated === true) {
848  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
849  $this->ctrl->redirect($this, "editProperties");
850  } else {
851  $this->pg_obj->addHierIDs();
852  $this->edit();
853  }
854  }
setProperties()
Set properties from input form.
+ Here is the call graph for this function:

◆ setAlignment()

ilPCTableGUI::setAlignment ( )

Set cell alignments.

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

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), ilUtil\stripSlashes(), and ilLanguage\txt().

999  : void
1000  {
1001  $lng = $this->lng;
1002 
1003  $targets = $this->request->getStringArray("target");
1004  if (count($targets) > 0) {
1005  foreach ($targets as $k => $value) {
1006  if ($value > 0) {
1007  $cid = explode(":", $k);
1008  $this->content_obj->setTDAlignment(
1009  ilUtil::stripSlashes($cid[0]),
1010  $this->request->getString("alignment"),
1011  ilUtil::stripSlashes($cid[1])
1012  );
1013  }
1014  }
1015  }
1016  $this->updated = $this->pg_obj->update();
1017  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1018 
1019  $this->ctrl->redirect($this, "editCellAlignment");
1020  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:

◆ setBasicTableCellStyles()

ilPCTableGUI::setBasicTableCellStyles ( )

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

References ilPageContentGUI\setCharacteristics().

Referenced by editCellStyle(), ilPCDataTableGUI\initCellPropertiesForm(), and initPropertiesForm().

60  : void
61  {
62  $this->setCharacteristics(array("Cell1" => "Cell1", "Cell2" => "Cell2",
63  "Cell3" => "Cell3", "Cell4" => "Cell4"));
64  }
setCharacteristics(array $a_chars)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCellPropertiesSubTabs()

ilPCTableGUI::setCellPropertiesSubTabs ( )

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

References ilPageContentGUI\$ctrl, and $tabs.

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

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

◆ setProperties()

ilPCTableGUI::setProperties ( )

Set properties from input form.

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

References ILIAS\Repository\form(), and initPropertiesForm().

Referenced by create(), and saveProperties().

805  : void
806  {
807  $this->initPropertiesForm();
808  $this->form->checkInput();
809 
810  // mask html
811  $caption = $this->form->getInput("caption");
812  $caption = str_replace("&", "&amp;", $caption);
813  $caption = str_replace("<", "&lt;", $caption);
814  $caption = str_replace(">", "&gt;", $caption);
815 
816  $this->content_obj->setLanguage($this->form->getInput("language"));
817  $this->content_obj->setWidth($this->form->getInput("width"));
818  //$this->content_obj->setBorder($this->form->getInput("border"));
819  //$this->content_obj->setCellSpacing($this->form->getInput("spacing"));
820  //$this->content_obj->setCellPadding($this->form->getInput("padding"));
821  $this->content_obj->setHorizontalAlign($this->form->getInput("align"));
822  $this->content_obj->setHeaderRows($this->form->getInput("row_header"));
823  $this->content_obj->setHeaderCols($this->form->getInput("col_header"));
824  $this->content_obj->setFooterRows($this->form->getInput("row_footer"));
825  $this->content_obj->setFooterCols($this->form->getInput("col_footer"));
826  if (strpos($this->form->getInput("characteristic"), ":") > 0) {
827  $t = explode(":", $this->form->getInput("characteristic"));
828  $this->content_obj->setTemplate($t[2]);
829  $this->content_obj->setClass("");
830  } else {
831  $this->content_obj->setClass($this->form->getInput("characteristic"));
832  $this->content_obj->setTemplate("");
833  }
834  $this->content_obj->setCaption(
835  $caption,
836  $this->form->getInput("cap_align")
837  );
838  }
initPropertiesForm(string $a_mode="edit")
form( $class_path, string $cmd, string $submit_caption="")
+ 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 782 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), and ilLanguage\txt().

782  : void
783  {
784  $lng = $this->lng;
785 
786  $colspans = $this->request->getStringArray("colspan");
787  $rowspans = $this->request->getStringArray("rowspan");
788  $cs = [];
789  $rs = [];
790  if (count($colspans) > 0) {
791  foreach ($colspans as $k => $span) {
792  $cs[$k] = $span;
793  $rs[$k] = $rowspans[$k];
794  }
795  $this->content_obj->setTDSpans($cs, $rs);
796  }
797  $this->updated = $this->pg_obj->update();
798  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
799  $this->ctrl->redirect($this, "editCellSpan");
800  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ setStyles()

ilPCTableGUI::setStyles ( )

Set cell styles.

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

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), ilUtil\stripSlashes(), and ilLanguage\txt().

734  : void
735  {
736  $lng = $this->lng;
737 
738  $target = $this->request->getStringArray("target");
739  if (count($target)) {
740  foreach ($target as $k => $value) {
741  if ($value > 0) {
742  $cid = explode(":", $k);
743  $this->content_obj->setTDClass(
744  ilUtil::stripSlashes($cid[0]),
745  $this->request->getString("style"),
746  ilUtil::stripSlashes($cid[1])
747  );
748  }
749  }
750  }
751  $this->updated = $this->pg_obj->update();
752  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
753  $this->ctrl->redirect($this, "editCellStyle");
754  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:

◆ setTabs()

ilPCTableGUI::setTabs ( string  $data_tab_txt_key = "")

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

References ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, $tabs, ILIAS\Repository\ctrl(), and ilLanguage\txt().

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

89  : void {
90  $ilTabs = $this->tabs;
91  $ilCtrl = $this->ctrl;
92  $lng = $this->lng;
93 
94  $ilTabs->setBackTarget(
95  "",
96  ""
97  );
98 
99  return;
100 
101  $ilTabs->setBackTarget(
102  $lng->txt("pg"),
103  (string) $this->ctrl->getParentReturn($this)
104  );
105 
106  if ($data_tab_txt_key == "") {
107  $data_tab_txt_key = "cont_table_edit_cells";
108  }
109 
110  $ilTabs->addTarget(
111  $data_tab_txt_key,
112  $ilCtrl->getLinkTarget($this, "editData"),
113  "editData",
114  get_class($this)
115  );
116 
117  $ilTabs->addTarget(
118  "cont_table_properties",
119  $ilCtrl->getLinkTarget($this, "editProperties"),
120  "editProperties",
121  get_class($this)
122  );
123 
124  $ilTabs->addTarget(
125  "cont_table_cell_properties",
126  $ilCtrl->getLinkTarget($this, "editCellStyle"),
127  "editCellStyle",
128  get_class($this)
129  );
130  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setWidths()

ilPCTableGUI::setWidths ( )

Set cell widths.

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

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), ilUtil\stripSlashes(), and ilLanguage\txt().

759  : void
760  {
761  $lng = $this->lng;
762 
763  $widths = $this->request->getStringArray("width");
764  if (count($widths) > 0) {
765  foreach ($widths as $k => $width) {
766  $cid = explode(":", $k);
767  $this->content_obj->setTDWidth(
768  ilUtil::stripSlashes($cid[0]),
769  ilUtil::stripSlashes($width),
770  ilUtil::stripSlashes($cid[1])
771  );
772  }
773  }
774  $this->updated = $this->pg_obj->update();
775  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
776  $this->ctrl->redirect($this, "editCellWidth");
777  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:

Field Documentation

◆ $dom_util

ILIAS COPage Dom DomUtil ilPCTableGUI::$dom_util
protected

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

◆ $form

◆ $pc_definition

ILIAS COPage PC PCDefinition ilPCTableGUI::$pc_definition
protected

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

◆ $tabs

ilTabsGUI ilPCTableGUI::$tabs
protected

◆ $user

◆ $xsl

ILIAS COPage Xsl XslManager ilPCTableGUI::$xsl
protected

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


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