ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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...
 
 getEditDataTable (bool $initial=false)
 
- 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 ()
 
 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 ()
 
 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")
 
 setEditorToolContext ()
 Set editor tool context. More...
 
 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 ()
 

Protected Attributes

ilPropertyFormGUI $form
 
ilTabsGUI $tabs
 
ilObjUser $user
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
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 = ""
 
php4DOMDocument $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 26 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 33 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().

38  {
39  global $DIC;
40 
41  $this->tabs = $DIC->tabs();
42  $this->ctrl = $DIC->ctrl();
43  $this->lng = $DIC->language();
44  $this->tpl = $DIC["tpl"];
45  $this->user = $DIC->user();
46  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
47  $this->setCharacteristics(array("StandardTable" => $this->lng->txt("cont_StandardTable")));
48  $this->tool_context = $DIC->globalScreen()->tool()->context();
49  }
setCharacteristics(array $a_chars)
global $DIC
Definition: feed.php:28
__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 543 of file class.ilPCTableGUI.php.

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

Referenced by _renderTable().

546  : string {
547  global $DIC;
548 
549  $lng = $DIC->language();
550 
551  $classes = $a_table->getAllCellAlignments();
552 
553  foreach ($classes as $k => $v) {
554  if ($v == "") {
555  $v = $lng->txt("default");
556  }
557  $check = $lng->txt("cont_alignment") . ": " .
558  '<input type="checkbox" value="1"' .
559  ' name="target[' . $k . ']">' . '</input> ' . $v;
560 
561  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
562  }
563  return $a_output;
564  }
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: feed.php:28
$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 592 of file class.ilPCTableGUI.php.

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

Referenced by _renderTable().

595  : string {
596  global $DIC;
597 
598  $lng = $DIC->language();
599 
600  $spans = $a_table->getAllCellSpans();
601 
602  foreach ($spans as $k => $v) {
603  // colspans
604  $selects = '<div style="white-space:nowrap;">' . $lng->txt("cont_colspan") . ": " .
605  '<select class="small" name="colspan[' . $k . ']">';
606  for ($i = 1; $i <= $v["max_x"] - $v["x"] + 1; $i++) {
607  $sel_str = ($i == $v["colspan"])
608  ? 'selected="selected"'
609  : '';
610  $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
611  }
612  $selects .= "</select></div>";
613 
614  // rowspans
615  $selects .= '<div style="margin-top:3px; white-space:nowrap;">' . $lng->txt("cont_rowspan") . ": " .
616  '<select class="small" name="rowspan[' . $k . ']">';
617  for ($i = 1; $i <= $v["max_y"] - $v["y"] + 1; $i++) {
618  $sel_str = ($i == $v["rowspan"])
619  ? 'selected="selected"'
620  : '';
621  $selects .= '<option value="' . $i . '" ' . $sel_str . '>' . $i . '</option>';
622  }
623  $selects .= "</select></div>";
624 
625  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $selects, $a_output);
626  }
627  return $a_output;
628  }
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: feed.php:28
getAllCellSpans()
Get all cell spans.
$i
Definition: metadata.php:41
+ 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 514 of file class.ilPCTableGUI.php.

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

Referenced by _renderTable().

517  : string {
518  global $DIC;
519 
520  $lng = $DIC->language();
521 
522  $classes = $a_table->getAllCellClasses();
523 
524  foreach ($classes as $k => $v) {
525  if ($v == "") {
526  $v = $lng->txt("none");
527  }
528  if (substr($v, 0, 4) == "ilc_") {
529  $v = substr($v, 4);
530  }
531  $check = $lng->txt("cont_style") . ": " .
532  '<input type="checkbox" value="1"' .
533  ' name="target[' . $k . ']">' . '</input> ' . $v;
534 
535  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
536  }
537  return $a_output;
538  }
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: feed.php:28
$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 569 of file class.ilPCTableGUI.php.

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

Referenced by _renderTable().

572  : string {
573  global $DIC;
574 
575  $lng = $DIC->language();
576 
577  $widths = $a_table->getAllCellWidths();
578 
579  foreach ($widths as $k => $v) {
580  $check = $lng->txt("cont_width") . ": " .
581  '<input class="small" type="text" size="5" maxlength="10"' .
582  ' name="width[' . $k . ']" value="' . $v . '">' . '</input>';
583 
584  $a_output = str_replace("{{{{{TableEdit;" . $k . "}}}}}", $check, $a_output);
585  }
586  return $a_output;
587  }
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: feed.php:28
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 442 of file class.ilPCTableGUI.php.

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

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

449  : string {
450  global $DIC;
451 
452  $ilUser = $DIC->user();
453 
454  $content = "<dummy>" . $content . "</dummy>";
455 
456  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
457  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
458  $xh = xslt_create();
459  //echo "<b>XML</b>:".htmlentities($content).":<br>";
460  //echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
461  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
462  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
463  $params = array('mode' => $a_mode,
464  'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
465  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
466  xslt_error($xh);
467  xslt_free($xh);
468 
469  // unmask user html
470  if ($unmask) {
471  $output = str_replace("&lt;", "<", $output);
472  $output = str_replace("&gt;", ">", $output);
473  $output = str_replace("&amp;", "&", $output);
474  }
475 
476  if ($a_mode == "table_edit" && !is_null($a_table_obj)) {
477  switch ($a_submode) {
478  case "style":
479  $output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
480  break;
481 
482  case "alignment":
483  $output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
484  break;
485 
486  case "width":
487  $output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
488  break;
489 
490  case "span":
491  $output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
492  break;
493  }
494  }
495 
496  // for all page components...
497  if (isset($page_object)) {
499  foreach ($defs as $def) {
500  $pc_class = $def["pc_class"];
501  $pc_obj = new $pc_class($page_object);
502 
503  // post xsl page content modification by pc elements
504  $output = $pc_obj->modifyPageContentPostXsl($output, "presentation", false);
505  }
506  }
507 
508  return $output;
509  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
xslt_create()
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
xslt_free(&$proc)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _addStyleCheckboxes(string $a_output, ilPCTable $a_table)
Add style checkboxes in edit mode.
global $DIC
Definition: feed.php:28
xslt_error(&$proc)
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.
$ilUser
Definition: imgupload.php:34
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 857 of file class.ilPCTableGUI.php.

References ilPageContentGUI\updateAndReturn().

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

◆ create()

ilPCTableGUI::create ( )

create new table in dom and update page in db

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

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

893  : void
894  {
895  $this->content_obj = $this->getNewTableObject();
896  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
897 
898  $this->initPropertiesForm("create");
899  $this->form->checkInput();
900 
901  $import_table = trim($this->form->getInput("import_table"));
902 
903  // import xhtml or spreadsheet table
904  if (!empty($import_table)) {
905  switch ($this->form->getInput("import_type")) {
906  // xhtml import
907  case "html":
908  $res = $this->content_obj->importHtml(
909  $this->form->getInput("language"),
910  $import_table
911  );
912  if ($res !== true) {
913  $this->tpl->setOnScreenMessage('failure', $res);
914  $this->insert();
915  return;
916  }
917  break;
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  }
$res
Definition: ltiservices.php:69
initPropertiesForm(string $a_mode="edit")
form( $class_path, string $cmd)
setProperties()
Set properties from input form.
+ Here is the call graph for this function:

◆ edit()

ilPCTableGUI::edit ( )

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

References ILIAS\Repository\ctrl().

Referenced by saveProperties().

155  : void
156  {
157  $this->ctrl->redirect($this, "editData");
158  }
+ 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(), ilGlobalTemplateInterface\setContent(), ilFormGUI\setFormAction(), ilFormGUI\setKeepOpen(), 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  }
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:

◆ editCellSpan()

ilPCTableGUI::editCellSpan ( )

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

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

697  : void
698  {
699  $ilCtrl = $this->ctrl;
700  $tpl = $this->tpl;
701  $lng = $this->lng;
702  $ilTabs = $this->tabs;
703 
704  $this->displayValidationError();
705  $this->setTabs();
706  $this->setCellPropertiesSubTabs();
707  $ilTabs->setSubTabActive("cont_span");
708  $ilTabs->setTabActive("cont_table_cell_properties");
709 
710  $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
711  $ctpl->setVariable("BTN_NAME", "setSpans");
712  $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_spans"));
713  $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
714 
715  $html = $ctpl->get();
716  $html .= "<br />" . $this->renderTable("table_edit", "span") . "</form>";
717  $tpl->setContent($html);
718  }
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 630 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(), ilGlobalTemplateInterface\setContent(), ilFormGUI\setFormAction(), ilFormGUI\setKeepOpen(), setTabs(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

630  : void
631  {
632  $ilCtrl = $this->ctrl;
633  $tpl = $this->tpl;
634  $lng = $this->lng;
635  $ilTabs = $this->tabs;
636 
637  $this->displayValidationError();
638  $this->setTabs();
639  $this->setCellPropertiesSubTabs();
640  $ilTabs->setSubTabActive("cont_style");
641 
642  // edit form
643  $form = new ilPropertyFormGUI();
644  $form->setFormAction($ilCtrl->getFormAction($this));
645  $form->setTitle($this->lng->txt("cont_table_cell_properties"));
646 
647  // first row style
649  $this->lng->txt("cont_style"),
650  "style"
651  );
652  $this->setBasicTableCellStyles();
653  $this->getCharacteristicsOfCurrentStyle(["table_cell"]); // scorm-2004
654  $chars = $this->getCharacteristics(); // scorm-2004
655  $options = array_merge(array("" => $this->lng->txt("none")), $chars); // scorm-2004
656  foreach ($options as $k => $option) {
657  $html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ilc_table_cell_' . $k . '">' .
658  $option . '</td></tr></table>';
659  $style->addOption($k, $option, $html);
660  }
661 
662  $style->setValue("");
663  $style->setInfo($lng->txt("cont_set_tab_style_info"));
664  $form->addItem($style);
665  $form->setKeepOpen(true);
666 
667  $form->addCommandButton("setStyles", $lng->txt("cont_set_styles"));
668 
669  $html = $form->getHTML();
670  $html .= "<br />" . $this->renderTable("table_edit", "style") . "</form>";
671  $tpl->setContent($html);
672  }
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
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="")
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:

◆ editCellWidth()

ilPCTableGUI::editCellWidth ( )

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

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

674  : void
675  {
676  $ilCtrl = $this->ctrl;
677  $tpl = $this->tpl;
678  $lng = $this->lng;
679  $ilTabs = $this->tabs;
680 
681  $this->displayValidationError();
682  $this->setTabs();
683  $this->setCellPropertiesSubTabs();
684  $ilTabs->setSubTabActive("cont_width");
685  $ilTabs->setTabActive("cont_table_cell_properties");
686 
687  $ctpl = new ilTemplate("tpl.table_cell_properties.html", true, true, "Services/COPage");
688  $ctpl->setVariable("BTN_NAME", "setWidths");
689  $ctpl->setVariable("BTN_TEXT", $lng->txt("cont_save_widths"));
690  $ctpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
691 
692  $html = $ctpl->get();
693  $html .= "<br />" . $this->renderTable("table_edit", "width") . "</form>";
694  $tpl->setContent($html);
695  }
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 1038 of file class.ilPCTableGUI.php.

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

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

1038  : void
1039  {
1040  $this->setEditorToolContext();
1041 
1042  $this->setTabs();
1043 
1044  $this->displayValidationError();
1045 
1046  $editor_init = new \ILIAS\COPage\Editor\UI\Init();
1047  $editor_init->initUI($this->tpl);
1048 
1049  $this->tpl->setContent($this->getEditDataTable(true));
1050  }
setEditorToolContext()
Set editor tool context.
getEditDataTable(bool $initial=false)
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 160 of file class.ilPCTableGUI.php.

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

160  : void
161  {
162  $tpl = $this->tpl;
163 
164  $this->displayValidationError();
165  $this->setTabs();
166 
167  $this->initPropertiesForm();
168  $this->getPropertiesFormValues();
169  $html = $this->form->getHTML();
170  $html .= "<br />" . $this->renderTable("");
171  $tpl->setContent($html);
172  }
initPropertiesForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd)
setTabs(string $data_tab_txt_key="")
+ Here is the call graph for this function:

◆ executeCommand()

ilPCTableGUI::executeCommand ( )
Returns
mixed

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

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

61  {
62  $this->getCharacteristicsOfCurrentStyle(["table"]); // scorm-2004
63 
64  // get next class that processes or forwards current command
65  $next_class = $this->ctrl->getNextClass($this);
66 
67  // get current command
68  $cmd = $this->ctrl->getCmd();
69 
70  switch ($next_class) {
71  default:
72  $this->$cmd();
73  break;
74  }
75  return "";
76  }
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 1206 of file class.ilPCTableGUI.php.

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

Referenced by getEditDataTable().

1206  : string
1207  {
1208  $tab_node = $this->content_obj->getNode();
1209  $cnt_i = 0;
1210  $content = "";
1211  $template_xml = "";
1212  // get correct cell and dump content of all its childrem
1213  foreach ($tab_node->first_child()->child_nodes() as $child) {
1214  if ($i == $cnt_i) {
1215  $cnt_j = 0;
1216  foreach ($child->child_nodes() as $child2) {
1217  if ($j == $cnt_j) {
1218  foreach ($child2->child_nodes() as $cell_content_node) {
1219  $content .= $this->dom->dump_node($cell_content_node);
1220  }
1221  }
1222  $cnt_j++;
1223  }
1224  }
1225  $cnt_i++;
1226  }
1227  $trans = $this->pg_obj->getLanguageVariablesXML();
1228  $mobs = $this->pg_obj->getMultimediaXML();
1229  if ($this->getStyleId() > 0) {
1230  if (ilObject::_lookupType($this->getStyleId()) == "sty") {
1231  $style = new ilObjStyleSheet($this->getStyleId());
1232  $template_xml = $style->getTemplateXML();
1233  }
1234  }
1235 
1236  $content = $content . $mobs . $trans . $template_xml;
1237 
1238  return $this->renderCell(
1239  $content,
1240  !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
1241  $this->getPage()
1242  );
1243  }
renderCell( $content, $unmask=true, $page_object=null)
Static render table function.
$mobs
Definition: imgupload.php:70
getTemplateXML()
Get table template xml.
static _lookupType(int $id, bool $reference=false)
$i
Definition: metadata.php:41
+ 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 1194 of file class.ilPCTableGUI.php.

References $base.

Referenced by getEditDataTable().

1194  : string
1195  {
1196  $cap = "";
1197  $base = 26;
1198  while ($nr > 0) {
1199  $chr = ($nr - 1) % $base;
1200  $cap = chr($chr + 65) . $cap;
1201  $nr = ($nr - 1 - $chr) / $base;
1202  }
1203  return $cap;
1204  }
$base
Definition: index.php:4
+ Here is the caller graph for this function:

◆ getEditDataTable()

ilPCTableGUI::getEditDataTable ( bool  $initial = false)

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

References ilPageContentGUI\$ctrl, $i, $path, $res, ILIAS\Repository\ctrl(), getCellContent(), getColumnCaption(), ilPageContentGUI\getHierId(), ilInternalLinkGUI\getInitHTML(), ILIAS\Repository\lng(), xpath_eval(), and xpath_new_context().

Referenced by editData().

1052  : string
1053  {
1054  $ilCtrl = $this->ctrl;
1055 
1056  $dtpl = new ilTemplate("tpl.tabledata2.html", true, true, "Services/COPage");
1057  $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
1058  $dtpl->setVariable("HIERID", $this->hier_id);
1059  $dtpl->setVariable("PCID", $this->pc_id);
1060 
1061  $dtpl->setVariable(
1062  "WYSIWYG_ACTION",
1063  $ilCtrl->getFormAction($this, "updateJS")
1064  );
1065 
1066  // get all rows
1067  $xpc = xpath_new_context($this->dom);
1068  $path = "//PageContent[@HierId='" . $this->getHierId() . "']" .
1069  "/Table/TableRow";
1070  $res = xpath_eval($xpc, $path);
1071 
1072  for ($i = 0; $i < count($res->nodeset); $i++) {
1073  $xpc2 = xpath_new_context($this->dom);
1074  $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" .
1075  "/Table/TableRow[$i+1]/TableData";
1076  $res2 = xpath_eval($xpc2, $path2);
1077 
1078  // if this is the first row -> col icons
1079  if ($i == 0) {
1080  for ($j = 0; $j < count($res2->nodeset); $j++) {
1081  if ($j == 0) {
1082  $dtpl->touchBlock("empty_td");
1083  }
1084 
1085  $move_forward = false;
1086  $move_backward = false;
1087  if ($j == 0) {
1088  if (count($res2->nodeset) == 1) {
1089  //
1090  } else {
1091  $move_forward = true;
1092  }
1093  } elseif ($j == (count($res2->nodeset) - 1)) {
1094  $move_backward = true;
1095  } else {
1096  $move_forward = true;
1097  $move_backward = true;
1098  }
1099  $dtpl->setCurrentBlock("col_icon");
1100  $dtpl->setVariable("NR_COLUMN", $j + 1);
1101  $dtpl->setVariable("PCID_COLUMN", $res2->nodeset[$j]->get_attribute("PCID"));
1102  $dtpl->setVariable("COLUMN_CAPTION", $this->getColumnCaption($j + 1));
1103  $dtpl->parseCurrentBlock();
1104  }
1105  $dtpl->setCurrentBlock("row");
1106  $dtpl->parseCurrentBlock();
1107  }
1108 
1109  for ($j = 0; $j < count($res2->nodeset); $j++) {
1110  // first col: row icons
1111  if ($j == 0) {
1112  if ($i == 0) {
1113  if (count($res->nodeset) == 1) {
1114  $move_type = "none";
1115  } else {
1116  $move_type = "forward";
1117  }
1118  } elseif ($i == (count($res->nodeset) - 1)) {
1119  $move_type = "backward";
1120  } else {
1121  $move_type = "both";
1122  }
1123  $dtpl->setCurrentBlock("row_icon");
1124  $dtpl->setVariable("NR_ROW", $i + 1);
1125  $dtpl->setVariable("PCID_ROW", $res2->nodeset[$j]->get_attribute("PCID"));
1126  $dtpl->setVariable("ROW_CAPTION", $i + 1);
1127  $dtpl->parseCurrentBlock();
1128  }
1129 
1130  // cell
1131  if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
1132  if ($this->content_obj->getType() == "dtab") {
1133  $dtpl->touchBlock("cell_type");
1134  //$dtpl->setCurrentBlock("cell_type");
1135  //$dtpl->parseCurrentBlock();
1136  }
1137 
1138  $dtpl->setCurrentBlock("cell");
1139 
1140  $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
1141  $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
1142  $dtpl->setVariable("PAR_ROW", (string) $i);
1143  $dtpl->setVariable("PAR_COLUMN", (string) $j);
1144 
1145  $dtpl->setVariable(
1146  "PAR_TA_CONTENT",
1147  $this->getCellContent($i, $j)
1148  );
1149 
1150  $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
1151  $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
1152  $dtpl->setVariable("WIDTH", "140");
1153  $dtpl->setVariable("HEIGHT", "80");
1154  if ($cs > 1) {
1155  $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
1156  $dtpl->setVariable("WIDTH", (140 + ($cs - 1) * 146));
1157  }
1158  if ($rs > 1) {
1159  $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
1160  $dtpl->setVariable("HEIGHT", (80 + ($rs - 1) * 86));
1161  }
1162  $dtpl->parseCurrentBlock();
1163  }
1164  }
1165  $dtpl->setCurrentBlock("row");
1166  $dtpl->parseCurrentBlock();
1167  }
1168 
1169  $dtpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
1170 
1171  // add int link parts
1172  $dtpl->setCurrentBlock("int_link_prep");
1173  $dtpl->setVariable(
1174  "INT_LINK_PREP",
1176  $ilCtrl->getLinkTargetByClass(
1177  array("ilpageeditorgui", "ilinternallinkgui"),
1178  "",
1179  false,
1180  true,
1181  false
1182  )
1183  )
1184  );
1185  $dtpl->parseCurrentBlock();
1186 
1187  if ($initial) {
1188  $dtpl->touchBlock("script");
1189  }
1190 
1191  return $dtpl->get();
1192  }
xpath_eval(php4DOMXPath $xpath_context, string $eval_str, $contextnode=null)
$res
Definition: ltiservices.php:69
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
$path
Definition: ltiservices.php:32
xpath_new_context($dom_document)
getCellContent(int $i, int $j)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormTitle()

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

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

References ILIAS\Repository\lng().

Referenced by initPropertiesForm().

174  : string
175  {
176  if ($a_mode === "create") {
177  return $this->lng->txt("cont_insert_table");
178  }
179  return $this->lng->txt("cont_table_properties");
180  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewTableObject()

ilPCTableGUI::getNewTableObject ( )

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

References ilPageContentGUI\getPage().

Referenced by create().

885  : ilPCTable
886  {
887  return new ilPCTable($this->getPage());
888  }
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 381 of file class.ilPCTableGUI.php.

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

Referenced by editProperties().

381  : void
382  {
383  $values = array();
384  $values["width"] = $this->content_obj->getWidth();
385  $values["border"] = $this->content_obj->getBorder();
386  $values["padding"] = $this->content_obj->getCellPadding();
387  $values["spacing"] = $this->content_obj->getCellSpacing();
388  $values["row_header"] = $this->content_obj->getHeaderRows();
389  $values["row_footer"] = $this->content_obj->getFooterRows();
390  $values["col_header"] = $this->content_obj->getHeaderCols();
391  $values["col_footer"] = $this->content_obj->getFooterCols();
392  if ($this->content_obj->getTemplate() != "") {
393  $values["characteristic"] = "t:" .
394  ilObjStyleSheet::_lookupTemplateIdByName($this->getStyleId(), $this->content_obj->getTemplate()) . ":" .
395  $this->content_obj->getTemplate();
396  } else {
397  $values["characteristic"] = $this->content_obj->getClass();
398  }
399  $values["align"] = $this->content_obj->getHorizontalAlign();
400  $values["caption"] = $this->content_obj->getCaption();
401  $values["cap_align"] = $this->content_obj->getCaptionAlign();
402  $values["language"] = $this->content_obj->getLanguage();
403 
404  $this->form->setValuesByArray($values);
405 
406  $ca = $this->form->getItemByPostVar("cap_align");
407  $ca->setValue($this->content_obj->getCaptionAlign());
408  }
static _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
form( $class_path, string $cmd)
+ 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 150 of file class.ilPCTableGUI.php.

Referenced by initPropertiesForm().

150  : array
151  {
152  return parent::getTemplateOptions("table");
153  }
+ Here is the caller graph for this function:

◆ initPropertiesForm()

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

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

References ilPageContentGUI\$chars, $cols, ilPageContentGUI\$ctrl, $i, $ilUser, $lang, ilPageContentGUI\$lng, $rows, $user, ilMDLanguageItem\_getLanguages(), ilRadioOption\addSubItem(), ILIAS\Repository\form(), ilPageContentGUI\getCharacteristics(), ilPageContentGUI\getCharacteristicsOfCurrentStyle(), ilPageContentGUI\getCurrentTextLang(), getFormTitle(), getTemplateOptions(), ILIAS\Repository\lng(), setBasicTableCellStyles(), and ilLanguage\txt().

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

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

◆ insert()

ilPCTableGUI::insert ( )

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

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

Referenced by create().

875  : void
876  {
877  $tpl = $this->tpl;
878 
879  $this->displayValidationError();
880  $this->initPropertiesForm("create");
881  $html = $this->form->getHTML();
882  $tpl->setContent($html);
883  }
initPropertiesForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftAlign()

ilPCTableGUI::leftAlign ( )

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

References ilPageContentGUI\updateAndReturn().

851  : void
852  {
853  $this->content_obj->setHorizontalAlign("Left");
854  $this->updateAndReturn();
855  }
+ Here is the call graph for this function:

◆ leftFloatAlign()

ilPCTableGUI::leftFloatAlign ( )

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

References ilPageContentGUI\updateAndReturn().

863  : void
864  {
865  $this->content_obj->setHorizontalAlign("LeftFloat");
866  $this->updateAndReturn();
867  }
+ 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 1248 of file class.ilPCTableGUI.php.

References $DIC, $ilUser, $params, ilUtil\getImagePath(), ilCOPagePCDef\getPCDefinitions(), ilFileUtils\getWebspaceDir(), xslt_create(), and xslt_free().

Referenced by getCellContent().

1252  : string {
1253  global $DIC;
1254 
1255  $ilUser = $DIC->user();
1256  $content = "<dummy>" . $content . "</dummy>";
1257 
1258  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1259  $args = array( '/_xml' => $content, '/_xsl' => $xsl );
1260  $xh = xslt_create();
1261  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
1262  $enlarge_path = ilUtil::getImagePath("enlarge.svg");
1263  $params = array('webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
1264  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1265  xslt_free($xh);
1266 
1267  // unmask user html
1268  if ($unmask) {
1269  $output = str_replace("&lt;", "<", $output);
1270  $output = str_replace("&gt;", ">", $output);
1271  $output = str_replace("&amp;", "&", $output);
1272  }
1273 
1274  // for all page components...
1275  if (isset($page_object)) {
1277  foreach ($defs as $def) {
1278  //ilCOPagePCDef::requirePCClassByName($def["name"]);
1279  $pc_class = $def["pc_class"];
1280  $pc_obj = new $pc_class($page_object);
1281 
1282  // post xsl page content modification by pc elements
1283  $output = $pc_obj->modifyPageContentPostXsl((string) $output, "presentation", false);
1284  }
1285  }
1286 
1287 
1288  return $output;
1289  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
xslt_create()
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
xslt_free(&$proc)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rightAlign()

ilPCTableGUI::rightAlign ( )

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

References ilPageContentGUI\updateAndReturn().

845  : void
846  {
847  $this->content_obj->setHorizontalAlign("Right");
848  $this->updateAndReturn();
849  }
+ Here is the call graph for this function:

◆ rightFloatAlign()

ilPCTableGUI::rightFloatAlign ( )

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

References ilPageContentGUI\updateAndReturn().

869  : void
870  {
871  $this->content_obj->setHorizontalAlign("RightFloat");
872  $this->updateAndReturn();
873  }
+ 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 832 of file class.ilPCTableGUI.php.

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

832  : void
833  {
834  $this->setProperties();
835  $this->updated = $this->pg_obj->update();
836  if ($this->updated === true) {
837  $this->ctrl->redirect($this, "editProperties");
838  //$this->ctrl->returnToParent($this, "jump".$this->hier_id);
839  } else {
840  $this->pg_obj->addHierIDs();
841  $this->edit();
842  }
843  }
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 51 of file class.ilPCTableGUI.php.

References ilPageContentGUI\setCharacteristics().

Referenced by editCellStyle(), and initPropertiesForm().

51  : void
52  {
53  $this->setCharacteristics(array("Cell1" => "Cell1", "Cell2" => "Cell2",
54  "Cell3" => "Cell3", "Cell4" => "Cell4"));
55  }
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 116 of file class.ilPCTableGUI.php.

References ilPageContentGUI\$ctrl, and $tabs.

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

116  : void
117  {
118  $ilTabs = $this->tabs;
119  $ilCtrl = $this->ctrl;
120 
121  $ilTabs->addSubTabTarget(
122  "cont_style",
123  $ilCtrl->getLinkTarget($this, "editCellStyle"),
124  "editCellStyle",
125  get_class($this)
126  );
127 
128  $ilTabs->addSubTabTarget(
129  "cont_width",
130  $ilCtrl->getLinkTarget($this, "editCellWidth"),
131  "editCellWidth",
132  get_class($this)
133  );
134 
135  $ilTabs->addSubTabTarget(
136  "cont_alignment",
137  $ilCtrl->getLinkTarget($this, "editCellAlignment"),
138  "editCellAlignment",
139  get_class($this)
140  );
141 
142  $ilTabs->addSubTabTarget(
143  "cont_span",
144  $ilCtrl->getLinkTarget($this, "editCellSpan"),
145  "editCellSpan",
146  get_class($this)
147  );
148  }
+ Here is the caller graph for this function:

◆ setEditorToolContext()

ilPCTableGUI::setEditorToolContext ( )
protected

Set editor tool context.

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

References ilCOPageEditGSToolProvider\SHOW_EDITOR.

Referenced by editData().

1025  : void
1026  {
1027  $collection = $this->tool_context->current()->getAdditionalData();
1028  if ($collection->exists(ilCOPageEditGSToolProvider::SHOW_EDITOR)) {
1029  $collection->replace(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
1030  } else {
1031  $collection->add(ilCOPageEditGSToolProvider::SHOW_EDITOR, true);
1032  }
1033  }
+ Here is the caller graph for this function:

◆ setProperties()

ilPCTableGUI::setProperties ( )

Set properties from input form.

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

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

Referenced by create(), and saveProperties().

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

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

771  : void
772  {
773  $lng = $this->lng;
774 
775  $colspans = $this->request->getStringArray("colspan");
776  $rowspans = $this->request->getStringArray("rowspan");
777  $cs = [];
778  $rs = [];
779  if (count($colspans) > 0) {
780  foreach ($colspans as $k => $span) {
781  $cs[$k] = $span;
782  $rs[$k] = $rowspans[$k];
783  }
784  $this->content_obj->setTDSpans($cs, $rs);
785  }
786  $this->updated = $this->pg_obj->update();
787  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
788  $this->ctrl->redirect($this, "editCellSpan");
789  }
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 723 of file class.ilPCTableGUI.php.

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

723  : void
724  {
725  $lng = $this->lng;
726 
727  $target = $this->request->getStringArray("target");
728  if (count($target)) {
729  foreach ($target as $k => $value) {
730  if ($value > 0) {
731  $cid = explode(":", $k);
732  $this->content_obj->setTDClass(
733  ilUtil::stripSlashes($cid[0]),
734  $this->request->getString("style"),
735  ilUtil::stripSlashes($cid[1])
736  );
737  }
738  }
739  }
740  $this->updated = $this->pg_obj->update();
741  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
742  $this->ctrl->redirect($this, "editCellStyle");
743  }
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 78 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().

80  : void {
81  $ilTabs = $this->tabs;
82  $ilCtrl = $this->ctrl;
83  $lng = $this->lng;
84 
85  $ilTabs->setBackTarget(
86  $lng->txt("pg"),
87  (string) $this->ctrl->getParentReturn($this)
88  );
89 
90  if ($data_tab_txt_key == "") {
91  $data_tab_txt_key = "cont_table_edit_cells";
92  }
93 
94  $ilTabs->addTarget(
95  $data_tab_txt_key,
96  $ilCtrl->getLinkTarget($this, "editData"),
97  "editData",
98  get_class($this)
99  );
100 
101  $ilTabs->addTarget(
102  "cont_table_properties",
103  $ilCtrl->getLinkTarget($this, "editProperties"),
104  "editProperties",
105  get_class($this)
106  );
107 
108  $ilTabs->addTarget(
109  "cont_table_cell_properties",
110  $ilCtrl->getLinkTarget($this, "editCellStyle"),
111  "editCellStyle",
112  get_class($this)
113  );
114  }
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 748 of file class.ilPCTableGUI.php.

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

748  : void
749  {
750  $lng = $this->lng;
751 
752  $widths = $this->request->getStringArray("width");
753  if (count($widths) > 0) {
754  foreach ($widths as $k => $width) {
755  $cid = explode(":", $k);
756  $this->content_obj->setTDWidth(
757  ilUtil::stripSlashes($cid[0]),
758  ilUtil::stripSlashes($width),
759  ilUtil::stripSlashes($cid[1])
760  );
761  }
762  }
763  $this->updated = $this->pg_obj->update();
764  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
765  $this->ctrl->redirect($this, "editCellWidth");
766  }
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

◆ $form

ilPropertyFormGUI ilPCTableGUI::$form
protected

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

◆ $tabs

ilTabsGUI ilPCTableGUI::$tabs
protected

◆ $tool_context

ILIAS GlobalScreen ScreenContext ContextServices ilPCTableGUI::$tool_context
protected

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

◆ $user

ilObjUser ilPCTableGUI::$user
protected

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

Referenced by initPropertiesForm().


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