29 protected \ILIAS\COPage\Xsl\XslManager
$xsl;
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();
49 $this->tool_context =
$DIC->globalScreen()->tool()->context();
50 $this->xsl =
$DIC->copage()->internal()->domain()->xsl();
51 $this->pc_definition =
$DIC
57 $this->dom_util =
$DIC->copage()->internal()->domain()->domUtil();
63 "Cell3" =>
"Cell3",
"Cell4" =>
"Cell4"));
74 $next_class = $this->
ctrl->getNextClass($this);
77 $cmd = $this->
ctrl->getCmd();
79 switch ($next_class) {
88 string $data_tab_txt_key =
""
90 $ilTabs = $this->
tabs;
94 $ilTabs->setBackTarget(
101 $ilTabs->setBackTarget(
103 (
string) $this->ctrl->getParentReturn($this)
106 if ($data_tab_txt_key ==
"") {
107 $data_tab_txt_key =
"cont_table_edit_cells";
112 $ilCtrl->getLinkTarget($this,
"editData"),
118 "cont_table_properties",
119 $ilCtrl->getLinkTarget($this,
"editProperties"),
125 "cont_table_cell_properties",
126 $ilCtrl->getLinkTarget($this,
"editCellStyle"),
134 $ilTabs = $this->tabs;
135 $ilCtrl = $this->ctrl;
137 $ilTabs->addSubTabTarget(
139 $ilCtrl->getLinkTarget($this,
"editCellStyle"),
144 $ilTabs->addSubTabTarget(
146 $ilCtrl->getLinkTarget($this,
"editCellWidth"),
151 $ilTabs->addSubTabTarget(
153 $ilCtrl->getLinkTarget($this,
"editCellAlignment"),
158 $ilTabs->addSubTabTarget(
160 $ilCtrl->getLinkTarget($this,
"editCellSpan"),
168 return parent::getTemplateOptions(
"table");
173 $this->
ctrl->redirect($this,
"editData");
180 $this->displayValidationError();
183 $this->initPropertiesForm();
184 $this->getPropertiesFormValues();
185 $html = $this->
form->getHTML();
186 $html .=
"<br />" . $this->renderTable(
"");
187 $tpl->setContent($html);
192 if ($a_mode ===
"create") {
193 return $this->
lng->txt(
"cont_insert_table");
195 return $this->
lng->txt(
"cont_table_properties");
199 string $a_mode =
"edit"
201 $a_seleted_value =
"";
202 $ilCtrl = $this->ctrl;
204 $ilUser = $this->user;
207 $this->
form->setFormAction($ilCtrl->getFormAction($this));
208 $this->
form->setTitle($this->getFormTitle($a_mode));
210 if ($a_mode ==
"create") {
212 for ($i = 1; $i <= 20; $i++) {
218 $cols->setOptions($nr);
220 $this->
form->addItem($cols);
224 $rows->setOptions($nr);
226 $this->
form->addItem($rows);
232 $width->setMaxLength(6);
233 $this->
form->addItem($width);
259 $this->
lng->txt(
"cont_characteristic_table"),
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()),
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>";
279 $html =
'<table class="ilc_table_' . $k .
'"><tr><td class="small">' .
280 $char .
'</td></tr></table>';
283 $options[$k] = $char;
285 $char_prop->setOptions($options);
286 $char_prop->setValue(
"StandardTable");
287 $this->
form->addItem($char_prop);
290 for ($i = 0; $i <= 3; $i++) {
296 $rh->setOptions($nr);
298 $this->
form->addItem($rh);
302 $rf->setOptions($nr);
304 $this->
form->addItem($rf);
308 $ch->setOptions($nr);
310 $this->
form->addItem($ch);
314 $cf->setOptions($nr);
316 $this->
form->addItem($cf);
318 if ($a_mode ==
"create") {
321 $this->
lng->txt(
"cont_first_row_style"),
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);
330 $fr_style->setValue(
"");
331 $this->
form->addItem($fr_style);
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"));
340 $align->setOptions($align_opts);
341 $align->setValue(
"Center");
342 $this->
form->addItem($align);
346 $caption->setSize(60);
347 $this->
form->addItem($caption);
350 $ca_opts = array(
"top" =>
$lng->txt(
"cont_top"),
351 "bottom" =>
$lng->txt(
"cont_bottom"));
353 $this->
lng->txt(
"cont_align"),
356 $ca->setOptions($ca_opts);
357 $caption->addSubItem($ca);
360 if ($a_mode ==
"create") {
364 $import->addOption($op);
365 $op2 =
new ilRadioOption($this->
lng->txt(
"cont_spreadsheet_table"),
"spreadsheet");
368 $import_data->setRows(8);
369 $import_data->setCols(50);
370 $op2->addSubItem($import_data);
372 $import->addOption($op2);
373 $import->setValue(
"html");
374 $this->
form->addItem($import);
378 if ($this->getCurrentTextLang() !=
"") {
379 $s_lang = $this->getCurrentTextLang();
381 $s_lang = $ilUser->getLanguage();
384 foreach ($this->lom_services->dataHelper()->getAllLanguages() as $language) {
385 $languages[$language->value()] = $language->presentableLabel();
388 $language->setOptions($languages);
389 $language->setValue($s_lang);
390 $this->
form->addItem($language);
392 if ($a_mode ==
"create") {
393 $this->
form->addCommandButton(
"create",
$lng->txt(
"save"));
394 $this->
form->addCommandButton(
"cancelCreate",
$lng->txt(
"cancel"));
396 $this->
form->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
397 $this->
form->addCommandButton(
"editData",
$lng->txt(
"close"));
404 $values[
"width"] = $this->content_obj->getWidth();
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:" .
415 $this->content_obj->getTemplate();
417 $values[
"characteristic"] = $this->content_obj->getClass();
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();
424 $this->
form->setValuesByArray($values);
426 $ca = $this->
form->getItemByPostVar(
"cap_align");
427 $ca->setValue($this->content_obj->getCaptionAlign());
430 public function renderTable(
431 string $a_mode =
"table_edit",
432 string $a_submode =
""
435 $tab_node = $this->content_obj->getDomNode();
436 $tab_node->setAttribute(
"Enabled",
"True");
437 $content = $this->dom_util->dump($tab_node);
439 $trans = $this->pg_obj->getLanguageVariablesXML();
440 $mobs = $this->pg_obj->getMultimediaXML();
441 if ($this->getStyleId() > 0) {
444 $template_xml = $style->getTemplateXML();
448 $content = $content . $mobs . $trans . $template_xml;
451 $tab = $this->content_obj;
457 !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
464 string $a_mode =
"table_edit",
465 string $a_submode =
"",
472 $ilUser =
$DIC->user();
473 $xsl =
$DIC->copage()->internal()->domain()->xsl();
474 $pc_definition =
$DIC->copage()->internal()->domain()->pc()->definition();
476 $content =
"<dummy>" . $content .
"</dummy>";
480 $params = array(
'mode' => $a_mode,
481 'webspace_path' => $wb_path,
'enlarge_path' => $enlarge_path);
482 $output = $xsl->process($content,
$params);
486 $output = str_replace(
"<",
"<", $output);
487 $output = str_replace(
">",
">", $output);
488 $output = str_replace(
"&",
"&", $output);
491 if ($a_mode ==
"table_edit" && !is_null($a_table_obj)) {
492 switch ($a_submode) {
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);
519 $output = $pc_obj->modifyPageContentPostXsl($output,
"presentation",
false);
539 foreach ($classes as $k => $v) {
541 $v =
$lng->txt(
"none");
543 if (substr($v, 0, 4) ==
"ilc_") {
547 '<input type="checkbox" value="1"' .
548 ' name="target[' . $k .
']">' .
'</input> ' . $v;
550 $a_output = str_replace(
"{{{{{TableEdit;" . $k .
"}}}}}",
$check, $a_output);
568 foreach ($classes as $k => $v) {
570 $v =
$lng->txt(
"default");
573 '<input type="checkbox" value="1"' .
574 ' name="target[' . $k .
']">' .
'</input> ' . $v;
576 $a_output = str_replace(
"{{{{{TableEdit;" . $k .
"}}}}}",
$check, $a_output);
594 foreach ($widths as $k => $v) {
596 '<input class="small" type="text" size="5" maxlength="10"' .
597 ' name="width[' . $k .
']" value="' . $v .
'">' .
'</input>';
599 $a_output = str_replace(
"{{{{{TableEdit;" . $k .
"}}}}}",
$check, $a_output);
617 foreach ($spans as $k => $v) {
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"'
625 $selects .=
'<option value="' . $i .
'" ' . $sel_str .
'>' . $i .
'</option>';
627 $selects .=
"</select></div>";
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"'
636 $selects .=
'<option value="' . $i .
'" ' . $sel_str .
'>' . $i .
'</option>';
638 $selects .=
"</select></div>";
640 $a_output = str_replace(
"{{{{{TableEdit;" . $k .
"}}}}}", $selects, $a_output);
647 $ilCtrl = $this->ctrl;
650 $ilTabs = $this->tabs;
652 $this->displayValidationError();
654 $this->setCellPropertiesSubTabs();
655 $ilTabs->setSubTabActive(
"cont_style");
660 $form->
setTitle($this->
lng->txt(
"cont_table_cell_properties"));
664 $this->
lng->txt(
"cont_style"),
667 $this->setBasicTableCellStyles();
668 $this->getCharacteristicsOfCurrentStyle([
"table_cell"]);
669 $chars = $this->getCharacteristics();
670 $options = array_merge(array(
"" => $this->
lng->txt(
"none")), $chars);
671 $style->setOptions($options);
673 $style->setValue(
"");
674 $style->setInfo(
$lng->txt(
"cont_set_tab_style_info"));
681 $html .=
"<br />" . $this->renderTable(
"table_edit",
"style") .
"</form>";
682 $tpl->setContent($html);
687 $ilCtrl = $this->ctrl;
690 $ilTabs = $this->tabs;
692 $this->displayValidationError();
694 $this->setCellPropertiesSubTabs();
695 $ilTabs->setSubTabActive(
"cont_width");
696 $ilTabs->setTabActive(
"cont_table_cell_properties");
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));
703 $html = $ctpl->get();
704 $html .=
"<br />" . $this->renderTable(
"table_edit",
"width") .
"</form>";
705 $tpl->setContent($html);
710 $ilCtrl = $this->ctrl;
713 $ilTabs = $this->tabs;
715 $this->displayValidationError();
717 $this->setCellPropertiesSubTabs();
718 $ilTabs->setSubTabActive(
"cont_span");
719 $ilTabs->setTabActive(
"cont_table_cell_properties");
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));
726 $html = $ctpl->get();
727 $html .=
"<br />" . $this->renderTable(
"table_edit",
"span") .
"</form>";
728 $tpl->setContent($html);
738 $target = $this->request->getStringArray(
"target");
739 if (count($target)) {
740 foreach ($target as $k => $value) {
742 $cid = explode(
":", $k);
743 $this->content_obj->setTDClass(
745 $this->request->getString(
"style"),
751 $this->updated = $this->pg_obj->update();
752 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
753 $this->
ctrl->redirect($this,
"editCellStyle");
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(
774 $this->updated = $this->pg_obj->update();
775 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
776 $this->
ctrl->redirect($this,
"editCellWidth");
786 $colspans = $this->request->getStringArray(
"colspan");
787 $rowspans = $this->request->getStringArray(
"rowspan");
790 if (count($colspans) > 0) {
791 foreach ($colspans as $k => $span) {
793 $rs[$k] = $rowspans[$k];
795 $this->content_obj->setTDSpans($cs, $rs);
797 $this->updated = $this->pg_obj->update();
798 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
799 $this->
ctrl->redirect($this,
"editCellSpan");
807 $this->initPropertiesForm();
808 $this->
form->checkInput();
811 $caption = $this->
form->getInput(
"caption");
812 $caption = str_replace(
"&",
"&", $caption);
813 $caption = str_replace(
"<",
"<", $caption);
814 $caption = str_replace(
">",
">", $caption);
816 $this->content_obj->setLanguage($this->
form->getInput(
"language"));
817 $this->content_obj->setWidth($this->
form->getInput(
"width"));
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(
"");
831 $this->content_obj->setClass($this->
form->getInput(
"characteristic"));
832 $this->content_obj->setTemplate(
"");
834 $this->content_obj->setCaption(
836 $this->
form->getInput(
"cap_align")
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");
851 $this->pg_obj->addHierIDs();
858 $this->content_obj->setHorizontalAlign(
"Right");
859 $this->updateAndReturn();
864 $this->content_obj->setHorizontalAlign(
"Left");
865 $this->updateAndReturn();
870 $this->content_obj->setHorizontalAlign(
"Center");
871 $this->updateAndReturn();
876 $this->content_obj->setHorizontalAlign(
"LeftFloat");
877 $this->updateAndReturn();
882 $this->content_obj->setHorizontalAlign(
"RightFloat");
883 $this->updateAndReturn();
890 $this->displayValidationError();
891 $this->initPropertiesForm(
"create");
892 $html = $this->
form->getHTML();
893 $tpl->setContent($html);
906 $this->content_obj = $this->getNewTableObject();
907 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
909 $this->initPropertiesForm(
"create");
910 $this->
form->checkInput();
912 $import_table = trim($this->
form->getInput(
"import_table"));
915 if (!empty($import_table)) {
916 switch ($this->
form->getInput(
"import_type")) {
921 $this->content_obj->importSpreadsheet($this->
form->getInput(
"language"), $import_table);
925 $this->content_obj->addRows(
926 $this->
form->getInput(
"nr_rows"),
927 $this->form->getInput(
"nr_cols")
931 $this->setProperties();
933 $frtype = $this->
form->getInput(
"first_row_style");
935 $this->content_obj->setFirstRowStyle($frtype);
938 $this->updated = $this->pg_obj->update();
940 if ($this->updated ===
true) {
941 $this->afterCreation();
949 $this->
ctrl->returnToParent($this,
"jump" . $this->hier_id);
959 $ilCtrl = $this->ctrl;
962 $ilTabs = $this->tabs;
964 $this->displayValidationError();
966 $this->setCellPropertiesSubTabs();
967 $ilTabs->setSubTabActive(
"cont_alignment");
968 $ilTabs->setTabActive(
"cont_table_cell_properties");
973 $form->
setTitle($this->
lng->txt(
"cont_table_cell_properties"));
977 "" =>
$lng->txt(
"default"),
978 "Left" =>
$lng->txt(
"cont_left"),
979 "Center" =>
$lng->txt(
"cont_center"),
980 "Right" =>
$lng->txt(
"cont_right")
983 $si->setOptions($options);
984 $si->setInfo(
$lng->txt(
""));
992 $html .=
"<br />" . $this->renderTable(
"table_edit",
"alignment") .
"</form>";
993 $tpl->setContent($html);
1003 $targets = $this->request->getStringArray(
"target");
1004 if (count($targets) > 0) {
1005 foreach ($targets as $k => $value) {
1007 $cid = explode(
":", $k);
1008 $this->content_obj->setTDAlignment(
1010 $this->request->getString(
"alignment"),
1016 $this->updated = $this->pg_obj->update();
1017 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
1019 $this->
ctrl->redirect($this,
"editCellAlignment");
1030 $this->displayValidationError();
1031 $this->initEditor();
1032 $this->tpl->addJavaScript(
"assets/js/AdvancedSelectionList.js");
1034 $this->tpl->setContent($this->getEditDataTable(
true));
1037 public function getEditDataTable(
bool $initial =
false): string
1039 $ilCtrl = $this->ctrl;
1042 $pc_tab = $this->content_obj;
1044 $dtpl =
new ilTemplate(
"tpl.tabledata2.html",
true,
true,
"components/ILIAS/COPage");
1045 $dtpl->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this,
"tableAction"));
1046 $dtpl->setVariable(
"HIERID", $this->hier_id);
1047 $dtpl->setVariable(
"PCID", $this->pc_id);
1048 $class = $pc_tab->getClass();
1049 if ($class ===
"") {
1050 $class =
"StandardTable";
1052 $template_classes = [];
1053 if ($this->getStyleId() > 0 && $pc_tab->getTemplate() !=
"") {
1057 $template_classes = $style->getTemplateClasses(
$id);
1058 if ($template_classes[
"table"] !==
"") {
1059 $class = $template_classes[
"table"];
1063 $dtpl->setVariable(
"TABLE_CLASS",
"ilc_table" . $class);
1067 $ilCtrl->getFormAction($this,
"updateJS")
1071 $path =
"//PageContent[@HierId='" . $this->getHierId() .
"']" .
1073 $nodes = $this->dom_util->path($this->dom,
$path);
1075 $total_rows = count($nodes);
1076 foreach ($nodes as $node) {
1077 $path2 =
"//PageContent[@HierId='" . $this->getHierId() .
"']" .
1078 "/Table/TableRow[$i+1]/TableData";
1079 $nodes2 = $this->dom_util->path($this->dom, $path2);
1082 $total_cols = count($nodes2);
1084 foreach ($nodes2 as $node2) {
1086 $dtpl->touchBlock(
"empty_td");
1089 $move_forward =
false;
1090 $move_backward =
false;
1092 if (count($nodes2) == 1) {
1095 $move_forward =
true;
1097 } elseif ($j == (count($nodes2) - 1)) {
1098 $move_backward =
true;
1100 $move_forward =
true;
1101 $move_backward =
true;
1103 $dtpl->setCurrentBlock(
"col_icon");
1104 $dtpl->setVariable(
"NR_COLUMN", $j + 1);
1105 $dtpl->setVariable(
"PCID_COLUMN", $node2->getAttribute(
"PCID"));
1106 $dtpl->setVariable(
"COLUMN_CAPTION", $this->getColumnCaption($j + 1));
1107 $dtpl->parseCurrentBlock();
1110 $dtpl->setCurrentBlock(
"row");
1111 $dtpl->parseCurrentBlock();
1115 foreach ($nodes2 as $node2) {
1119 if (count($nodes) == 1) {
1120 $move_type =
"none";
1122 $move_type =
"forward";
1124 } elseif ($i == (count($nodes) - 1)) {
1125 $move_type =
"backward";
1127 $move_type =
"both";
1129 $dtpl->setCurrentBlock(
"row_icon");
1130 $dtpl->setVariable(
"NR_ROW", $i + 1);
1131 $dtpl->setVariable(
"PCID_ROW", $node2->getAttribute(
"PCID"));
1132 $dtpl->setVariable(
"ROW_CAPTION", $i + 1);
1133 $dtpl->parseCurrentBlock();
1137 if ($node2->getAttribute(
"Hidden") !=
"Y") {
1139 $dtpl->touchBlock(
"cell_type");
1144 $dtpl->setCurrentBlock(
"cell");
1146 $dtpl->setVariable(
"PAR_TA_NAME",
"cell[" . $i .
"][" . $j .
"]");
1147 $dtpl->setVariable(
"PAR_TA_ID",
"cell_" . $i .
"_" . $j);
1148 $dtpl->setVariable(
"PAR_ROW", (
string) $i);
1149 $dtpl->setVariable(
"PAR_COLUMN", (
string) $j);
1157 $dtpl->setVariable(
"CELL_TAG",
"td");
1160 $node_class = $node2->getAttribute(
"Class");
1161 $class = $this->getCellClass(
1169 if ($class !==
"") {
1170 $dtpl->setVariable(
"CELL_CLASS",
"ilc_table_cell_" . $class);
1175 $this->getCellContent($i, $j)
1178 $cs = $node2->getAttribute(
"ColSpan");
1179 $width = (
int) $node2->getAttribute(
"Width");
1180 $rs = $node2->getAttribute(
"RowSpan");
1182 $dtpl->setVariable(
"WIDTH", $width);
1184 $align = (string) $node2->getAttribute(
"HorizontalAlign");
1185 if ($align !==
"") {
1186 $dtpl->setVariable(
"ALIGN", $align);
1188 $dtpl->setVariable(
"HEIGHT",
"80");
1190 $dtpl->setVariable(
"COLSPAN",
'colspan="' . $cs .
'"');
1194 $dtpl->setVariable(
"ROWSPAN",
'rowspan="' . $rs .
'"');
1197 $dtpl->parseCurrentBlock();
1201 $dtpl->setCurrentBlock(
"row");
1202 $dtpl->parseCurrentBlock();
1205 $dtpl->setVariable(
"TXT_ACTION", $this->
lng->txt(
"cont_table"));
1208 $dtpl->setCurrentBlock(
"int_link_prep");
1212 $ilCtrl->getLinkTargetByClass(
1213 array(
"ilpageeditorgui",
"ilinternallinkgui"),
1221 $dtpl->parseCurrentBlock();
1223 $html = $dtpl->get();
1225 $html .= $this->getEditorScriptTag();
1231 protected function getCellClass(
1235 array $template_classes,
1241 $pc_tab = $this->content_obj;
1245 if (($template_classes[
"even_row"] ??
"") !==
"") {
1247 $class = $template_classes[
"even_row"];
1251 if (($template_classes[
"odd_row"] ??
"") !==
"") {
1253 $class = $template_classes[
"odd_row"];
1257 if (($template_classes[
"even_col"] ??
"") !==
"") {
1259 $class = $template_classes[
"even_col"];
1263 if (($template_classes[
"odd_col"] ??
"") !==
"") {
1265 $class = $template_classes[
"odd_col"];
1269 if (($template_classes[
"row_foot"] ??
"") !==
"") {
1270 if ($i + $pc_tab->getFooterRows() >= $total_rows) {
1271 $class = $template_classes[
"row_foot"];
1275 if (($template_classes[
"col_foot"] ??
"") !==
"") {
1276 if ($j + $pc_tab->getFooterCols() >= $total_cols) {
1277 $class = $template_classes[
"col_foot"];
1281 if (($template_classes[
"row_head"] ??
"") !==
"") {
1282 if ($i < $pc_tab->getHeaderRows()) {
1283 $class = $template_classes[
"row_head"];
1287 if (($template_classes[
"col_head"] ??
"") !==
"") {
1288 if ($j < $pc_tab->getHeaderCols()) {
1289 $class = $template_classes[
"col_head"];
1293 if ($class ===
"") {
1294 if ($i < $pc_tab->getHeaderRows()) {
1295 $class =
"StandardHeader";
1299 if ($class ===
"") {
1300 $class =
"StandardCell1";
1304 if ($node_class !==
"") {
1305 $class = $node_class;
1315 $chr = ($nr - 1) % $base;
1316 $cap = chr($chr + 65) . $cap;
1317 $nr = ($nr - 1 - $chr) / $base;
1324 $tab_node = $this->content_obj->getDomNode();
1329 foreach ($tab_node->firstChild->childNodes as $child) {
1332 foreach ($child->childNodes as $child2) {
1334 foreach ($child2->childNodes as $cell_content_node) {
1335 $content .= $this->dom_util->dump($cell_content_node);
1343 $trans = $this->pg_obj->getLanguageVariablesXML();
1344 $mobs = $this->pg_obj->getMultimediaXML();
1345 if ($this->getStyleId() > 0) {
1348 $template_xml = $style->getTemplateXML();
1352 $content = $content . $mobs . $trans . $template_xml;
1354 return $this->renderCell(
1356 !$this->pg_obj->getPageConfig()->getPreventHTMLUnmasking(),
1371 $ilUser =
$DIC->user();
1372 $content =
"<dummy>" . $content .
"</dummy>";
1376 $params = array(
'webspace_path' => $wb_path,
'enlarge_path' => $enlarge_path);
1377 $output = $this->xsl->process($content,
$params);
1381 $output = str_replace(
"<",
"<", $output);
1382 $output = str_replace(
">",
">", $output);
1383 $output = str_replace(
"&",
"&", $output);
1387 if (isset($page_object)) {
1388 $defs = $this->pc_definition->getPCDefinitions();
1389 foreach ($defs as $def) {
1390 $pc_class = $def[
"pc_class"];
1391 $pc_obj =
new $pc_class($page_object);
1394 $output = $pc_obj->modifyPageContentPostXsl((
string) $output,
"presentation",
false);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
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 _lookupTemplateIdByName(int $a_style_id, string $a_name)
Lookup table template preview.
static getBaseContentStylePath()
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCellContent(int $i, int $j)
__construct(ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
static _addSpanInputs(string $a_output, ilPCTable $a_table)
Add span inputs.
create()
create new table in dom and update page in db
getColumnCaption(int $nr)
getTemplateOptions(string $a_type="")
Get table templates.
setStyles()
Set cell styles.
ILIAS COPage PC PCDefinition $pc_definition
initPropertiesForm(string $a_mode="edit")
editData()
Edit data of table.
ILIAS COPage Xsl XslManager $xsl
setProperties()
Set properties from input form.
static _addStyleCheckboxes(string $a_output, ilPCTable $a_table)
Add style checkboxes in edit mode.
getFormTitle(string $a_mode="edit")
saveProperties()
save table properties in db and return to page edit screen
static _addAlignmentCheckboxes(string $a_output, ilPCTable $a_table)
Add alignment checkboxes in edit mode.
setSpans()
Set cell spans.
setWidths()
Set cell widths.
static _addWidthInputs(string $a_output, ilPCTable $a_table)
Add width inputs.
getPropertiesFormValues()
ILIAS COPage Dom DomUtil $dom_util
setBasicTableCellStyles()
static _renderTable(string $content, string $a_mode="table_edit", string $a_submode="", ?ilPCTable $a_table_obj=null, bool $unmask=true, ?ilPageObject $page_object=null)
setTabs(string $data_tab_txt_key="")
setCellPropertiesSubTabs()
renderCell( $content, $unmask=true, $page_object=null)
Static render table function.
setAlignment()
Set cell alignments.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAllCellClasses()
Get all cell classes.
getAllCellSpans()
Get all cell spans.
getAllCellWidths()
Get all cell widths.
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
getCharacteristicsOfCurrentStyle(array $a_type)
Get characteristics of current style and call setCharacteristics, if style is given.
setCharacteristics(array $a_chars)
Content object of ilPageObject (see ILIAS DTD).
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd, string $submit_caption="")