39 private \ILIAS\DI\UIServices
$ui;
93 protected string $id =
"";
124 ?
object $a_parent_obj,
125 string $a_parent_cmd =
"",
126 string $a_template_context =
""
129 $this->main_tpl =
$DIC->ui()->mainTemplate();
130 $this->
ui = $DIC->ui();
132 $this->
lng = $DIC->language();
133 $this->
ctrl = $DIC->ctrl();
136 if (isset(
$DIC[
"http"])) {
137 $this->table_request = new \ILIAS\Table\TableGUIRequest(
144 $this->unique_id = md5(uniqid(
'',
true));
145 $this->parent_obj = $a_parent_obj;
146 $this->parent_cmd = $a_parent_cmd;
147 $this->buttons = array();
148 $this->header_commands = array();
149 $this->multi = array();
150 $this->hidden_inputs = array();
152 $this->tpl =
new ilTemplate(
"tpl.table2.html",
true,
true,
"components/ILIAS/Table");
156 if (!$a_template_context) {
157 $a_template_context = $this->
getId();
162 if (isset($this->table_request)) {
163 $this->export_mode = $this->table_request->getExportMode($this->prefix);
171 $this->raw_post_data = [];
172 if (isset(
$DIC[
"http"])) {
173 $this->raw_post_data =
$DIC->http()->request()->getParsedBody();
179 if (is_null($this->table_request)) {
182 $this->requested_nav_par = $this->table_request->getNavPar($this->
getNavParameter());
183 $this->requested_nav_par1 = $this->table_request->getNavPar($this->
getNavParameter(), 1);
184 $this->requested_nav_par2 = $this->table_request->getNavPar($this->
getNavParameter(), 2);
189 $this->open_form_tag = $a_val;
199 $this->close_form_tag = $a_val;
212 if (isset(
$DIC[
"ilUser"])) {
213 $ilUser =
$DIC[
"ilUser"];
216 if ($this->limit_determined) {
221 if (isset($this->table_request) && !is_null($this->table_request->getRows($this->prefix))) {
222 $this->
storeProperty(
"rows", $this->table_request->getRows($this->prefix));
223 $limit = $this->table_request->getRows($this->prefix) ?? 0;
237 $this->limit_determined =
true;
251 if ($this->columns_determined) {
258 if ($old_sel !=
"") {
259 $sel_fields = unserialize((
string) $old_sel);
262 if (!is_array($sel_fields)) {
264 $sel_fields = array();
267 $this->selected_columns = array();
272 if (isset($this->table_request)) {
273 $fs = $this->table_request->getFS($this->
getId());
274 $fsh = $this->table_request->getFSH($this->
getId());
278 $this->selected_column[$k] =
false;
280 $new_column = (!isset($sel_fields[$k]));
284 if (in_array($k, $fs)) {
285 $this->selected_column[$k] =
true;
287 } elseif ($stored && !$new_column) {
288 $this->selected_column[$k] = $sel_fields[$k];
293 if (isset(
$c[
"default"]) &&
$c[
"default"]) {
294 $this->selected_column[$k] =
true;
300 if (isset($this->table_request)) {
301 $ff = $this->table_request->getFF($this->
getId());
303 if (count($ff) > 0) {
305 if (in_array($k, $ff)) {
306 $this->selected_column[$k] =
true;
311 if ($old_sel != serialize($this->selected_column) && $set) {
312 $this->
storeProperty(
"selfields", serialize($this->selected_column));
315 $this->columns_determined =
true;
320 return $this->selected_column[$col] ??
false;
326 foreach ($this->selected_column as $k => $v) {
334 public function executeCommand(): bool
340 switch ($next_class) {
341 case 'ilformpropertydispatchgui':
346 $this->table_request->getPostVar()
348 $form_prop_dispatch->setItem($item);
349 return (
bool) $ilCtrl->forwardCommand($form_prop_dispatch);
354 public function resetOffset(
bool $a_in_determination =
false): void
356 if (!$this->nav_determined && !$a_in_determination) {
380 $this->top_anchor = $a_val;
390 $this->noentriestext = $a_text;
400 $this->datatable = $a_val;
410 $this->enabled[
"title"] = $a_enabletitle;
415 return $this->enabled[
"title"];
420 $this->enabled[
"header"] = $a_enableheader;
425 return $this->enabled[
"header"];
430 $this->num_info = $a_val;
441 string $a_icon_alt =
""
443 parent::
setTitle($a_title, $a_icon, $a_icon_alt);
448 $this->description = $a_val;
453 return $this->description;
458 $this->order_field = $a_order_field;
463 return $this->order_field;
466 final public function setData(array $a_data): void
468 $this->row_data = $a_data;
473 return $this->row_data;
478 return count($this->row_data) > 0;
483 $this->prefix = $a_prefix;
484 $this->getRequestedValues();
489 return $this->prefix;
494 bool $a_optional =
false
496 $a_input_item->setParentTable($this);
498 $this->filters[] = $a_input_item;
500 $this->optional_filters[] = $a_input_item;
504 if ($this->restore_filter) {
505 if (array_key_exists($a_input_item->getFieldId(), $this->restore_filter_values ?? [])) {
506 $this->setFilterValue($a_input_item, $this->restore_filter_values[$a_input_item->getFieldId()]);
508 $this->setFilterValue($a_input_item,
null);
519 int $type = self::FILTER_TEXT,
520 bool $a_optional =
false,
532 case self::FILTER_CHECKBOX:
536 case self::FILTER_SELECT:
540 case self::FILTER_DATE:
544 case self::FILTER_TEXT:
546 $item->setMaxLength(64);
551 case self::FILTER_LANGUAGE:
552 $lng->loadLanguageModule(
"meta");
555 foreach (
$lng->getInstalledLanguages() as $lang_key) {
561 case self::FILTER_NUMBER_RANGE:
564 $combi_item->setSize(5);
565 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
567 $combi_item->setSize(5);
568 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
574 case self::FILTER_DATE_RANGE:
577 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
579 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
583 case self::FILTER_DATETIME_RANGE:
586 $combi_item->setShowTime(
true);
587 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
589 $combi_item->setShowTime(
true);
590 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
594 case self::FILTER_DURATION_RANGE:
595 $lng->loadLanguageModule(
"form");
598 $combi_item->setShowMonths(
false);
599 $combi_item->setShowDays(
true);
600 $combi_item->setShowSeconds(
true);
601 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
603 $combi_item->setShowMonths(
false);
604 $combi_item->setShowDays(
true);
605 $combi_item->setShowSeconds(
true);
606 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
614 $this->addFilterItem($item, $a_optional);
615 $item->readFromSession();
622 return $this->filters;
624 return $this->optional_filters;
629 foreach ($this->getFilterItems() as $item) {
630 if ($item->getPostVar() == $a_post_var) {
634 foreach ($this->getFilterItems(
true) as $item) {
635 if ($item->getPostVar() == $a_post_var) {
644 $this->filter_cols = $a_val;
649 return $this->filter_cols;
654 $this->disable_filter_hiding = $a_val;
659 return $this->disable_filter_hiding;
667 return (
bool) $this->selected_filter[$a_col];
673 foreach ($this->selected_filter as $k => $v) {
683 if ($this->filters_determined) {
687 $old_sel = $this->loadProperty(
"selfilters");
690 if ($old_sel !=
"") {
692 unserialize((
string) $old_sel);
695 if (!is_array($sel_filters)) {
697 $sel_filters = array();
700 $this->selected_filter = array();
702 foreach ($this->getFilterItems(
true) as $item) {
703 $k = $item->getPostVar();
705 $this->selected_filter[$k] =
false;
707 if ($this->table_request->getFSF($this->getId())) {
709 if (in_array($k, $this->table_request->getFF($this->getId()))) {
710 $this->selected_filter[$k] =
true;
712 $item->setValue(
null);
713 $item->writeToSession();
716 $this->selected_filter[$k] = $sel_filters[$k] ??
"";
720 if ($old_sel != serialize($this->selected_filter) && $set) {
721 $this->storeProperty(
"selfilters", serialize($this->selected_filter));
724 $this->filters_determined =
true;
731 $this->custom_prev_next =
true;
732 $this->custom_prev = $a_prev_link;
733 $this->custom_next = $a_next_link;
737 string $a_form_action,
738 bool $a_multipart =
false
740 $this->form_action = $a_form_action;
741 $this->form_multipart = $a_multipart;
746 return $this->form_action;
751 $this->formname = $a_name;
756 return $this->formname;
759 public function setId(
string $a_val): void
762 if ($this->getPrefix() ==
"") {
763 $this->setPrefix($a_val);
765 if (strlen($this->
id) > 30) {
766 throw new ilException(
"Table ID to long (max. 30 char): " . $this->
id);
777 $this->display_as_block = $a_val;
782 return $this->display_as_block;
786 string $a_select_all_checkbox,
787 bool $a_select_all_on_top =
false
789 $this->select_all_checkbox = $a_select_all_checkbox;
790 $this->select_all_on_top = $a_select_all_on_top;
795 $this->ext_sort = $a_val;
800 return $this->ext_sort;
805 string $a_caption =
""
807 $this->filter_cmd = $a_val;
808 $this->filter_cmd_txt = $a_caption;
813 return $this->filter_cmd;
818 string $a_caption =
""
820 $this->reset_cmd = $a_val;
821 $this->reset_cmd_txt = $a_caption;
826 return $this->reset_cmd;
831 $this->ext_seg = $a_val;
836 return $this->ext_seg;
844 final public function setRowTemplate(
string $a_template,
string $a_template_dir =
""): void
846 $this->row_template = $a_template;
847 $this->row_template_dir = $a_template_dir;
852 $this->defaultorderfield = $a_defaultorderfield;
857 return $this->defaultorderfield;
863 $this->defaultorderdirection = $a_defaultorderdirection;
868 return $this->defaultorderdirection;
873 $this->default_filter_visibility = $a_status;
878 return $this->default_filter_visibility;
883 $this->buttons = array();
889 string $a_onclick =
'',
893 $this->buttons[] = array(
"cmd" => $a_cmd,
"text" => $a_text,
'onclick' => $a_onclick,
894 "id" => $a_id,
"class" => $a_class);
899 $this->buttons[] = $a_button;
915 string $a_default_selection =
''
917 $this->mi_sel_buttons[] = array(
"sel_var" => $a_sel_var,
"options" => $a_options,
"selected" => $a_default_selection,
"cmd" => $a_cmd,
"text" => $a_text);
918 $this->addHiddenInput(
"cmd_sv[" . $a_cmd .
"]", $a_sel_var);
923 $this->close_command = $a_link;
928 $this->multi[] = array(
"cmd" => $a_cmd,
"text" => $a_text);
933 $this->hidden_inputs[] = array(
"name" => $a_name,
"value" => $a_value);
939 string $a_target =
"",
942 $this->header_commands[] = array(
"href" => $a_href,
"text" => $a_text,
943 "target" => $a_target,
"img" => $a_img);
948 $this->top_commands = $a_val;
953 return $this->top_commands;
958 string $a_sort_field =
"",
959 string $a_width =
"",
960 bool $a_is_checkbox_action_column =
false,
961 string $a_class =
"",
962 string $a_tooltip =
"",
963 bool $a_tooltip_with_html =
false
965 $this->column[] = array(
967 "sort_field" => $a_sort_field,
969 "is_checkbox_action_column" => $a_is_checkbox_action_column,
971 "tooltip" => $a_tooltip,
972 "tooltip_html" => $a_tooltip_with_html
974 if ($a_sort_field !=
"") {
975 $this->sortable_fields[] = $a_sort_field;
977 $this->column_count = count($this->column);
983 return $this->prefix .
"_table_nav";
990 $ilUser =
$DIC->user();
992 $ilCtrl = $this->ctrl;
996 $old = $this->requested_nav_par ??
'';
999 $ilCtrl->setParameter(
1001 $this->getNavParameter(),
1002 urlencode($key) .
":" . $order_dir .
":" . $this->offset
1004 $this->tpl->setVariable(
1006 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd) . $hash
1010 $ilCtrl->setParameter(
1012 $this->getNavParameter(),
1021 $allcolumnswithwidth =
true;
1022 foreach ($this->column as $idx => $column) {
1023 if (!strlen($column[
"width"])) {
1024 $allcolumnswithwidth =
false;
1025 } elseif ($column[
"width"] ==
"1") {
1027 $this->column[$idx][
"width"] =
"1%";
1030 if ($allcolumnswithwidth) {
1031 foreach ($this->column as $column) {
1032 $this->tpl->setCurrentBlock(
"tbl_colgroup_column");
1033 $width = (is_numeric($column[
"width"]))
1034 ? $column[
"width"] .
"px"
1036 $this->tpl->setVariable(
"COLGROUP_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1037 $this->tpl->parseCurrentBlock();
1041 foreach ($this->column as $column) {
1044 if ($column[
'is_checkbox_action_column'] && $this->select_all_on_top) {
1045 $this->tpl->setCurrentBlock(
'tbl_header_top_select_all');
1046 $this->tpl->setVariable(
"HEAD_SELECT_ALL_TXT_SELECT_ALL",
$lng->txt(
"select_all"));
1047 $this->tpl->setVariable(
"HEAD_SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox());
1048 $this->tpl->setVariable(
"HEAD_SELECT_ALL_FORM_NAME", $this->getFormName());
1049 $this->tpl->setVariable(
"HEAD_CHECKBOXNAME",
"chb_select_all_" . $this->unique_id .
'_top');
1050 $this->tpl->parseCurrentBlock();
1054 if ($column[
'is_checkbox_action_column'] && !$this->select_all_on_top) {
1055 $this->tpl->setCurrentBlock(
'tbl_header_top_select_column');
1056 if ($column[
"width"] !=
"") {
1057 $width = (is_numeric($column[
"width"]))
1058 ? $column[
"width"] .
"px"
1060 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1062 $this->tpl->setVariable(
"TXT_SELECTION", $this->
lng->txt(
"tbl_selection"));
1063 $this->tpl->parseCurrentBlock();
1068 !$this->enabled[
"sort"] ||
1069 (($column[
"sort_field"] ==
"") &&
1070 !($column[
"is_checkbox_action_column"] && $this->select_all_on_top))
1072 $this->tpl->setCurrentBlock(
"tbl_header_no_link");
1073 if ($column[
"width"] !=
"") {
1074 $width = (is_numeric($column[
"width"]))
1075 ? $column[
"width"] .
"px"
1077 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH_NO_LINK",
" style=\"width:" . $width .
"\"");
1079 if ($column[
"class"] !=
"") {
1080 $this->tpl->setVariable(
"TBL_COLUMN_CLASS_NO_LINK",
" class=\"" . $column[
"class"] .
"\"");
1082 if (!$column[
"is_checkbox_action_column"]) {
1083 $this->tpl->setVariable(
1084 "TBL_HEADER_CELL_NO_LINK",
1088 $this->tpl->setVariable(
1089 "TBL_HEADER_CELL_NO_LINK",
1093 $this->tpl->setVariable(
"HEAD_CELL_NL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1094 if ($column[
"class"] !=
"") {
1095 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1097 $this->tpl->parseCurrentBlock();
1098 $this->tpl->touchBlock(
"tbl_header_th");
1101 if (($column[
"sort_field"] == $this->order_field) && ($this->order_direction !=
"")) {
1102 $this->tpl->setCurrentBlock(
"tbl_order_image");
1103 if ($this->order_direction ===
"asc") {
1104 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-up");
1105 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_asc"));
1107 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-down");
1108 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_desc"));
1110 $this->tpl->setVariable(
"IMG_ORDER_ALT", $this->
lng->txt(
"change_sort_direction"));
1111 $this->tpl->parseCurrentBlock();
1114 $this->tpl->setCurrentBlock(
"tbl_header_cell");
1115 $this->tpl->setVariable(
"TBL_HEADER_CELL", $column[
"text"]);
1116 $this->tpl->setVariable(
"HEAD_CELL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1119 if ($column[
"width"] !=
"") {
1120 $width = (is_numeric($column[
"width"]))
1121 ? $column[
"width"] .
"px"
1123 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1125 if ($column[
"class"] !=
"") {
1126 $this->tpl->setVariable(
"TBL_COLUMN_CLASS",
" class=\"" . $column[
"class"] .
"\"");
1129 $lng_sort_column = $this->
lng->txt(
"sort_by_this_column");
1130 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_sort_column);
1134 if ($column[
"sort_field"] == $this->order_field) {
1135 $order_dir = $this->sort_order;
1137 if ($order_dir ===
"asc") {
1138 $lng_change_sort = $this->
lng->txt(
"sort_ascending_long");
1140 $lng_change_sort = $this->
lng->txt(
"sort_descending_long");
1142 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_change_sort);
1145 if ($column[
"class"] !=
"") {
1146 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1148 $this->setOrderLink($column[
"sort_field"], $order_dir);
1149 $this->tpl->parseCurrentBlock();
1150 $this->tpl->touchBlock(
"tbl_header_th");
1153 $this->tpl->setCurrentBlock(
"tbl_header");
1154 $this->tpl->parseCurrentBlock();
1169 if (isset(
$DIC[
"ilUser"])) {
1170 $ilUser =
$DIC[
"ilUser"];
1173 if ($this->nav_determined) {
1177 if ($this->requested_nav_par1 !=
"") {
1178 if ($this->requested_nav_par1 != ($this->requested_nav_par ??
"")) {
1179 $this->nav_value = $this->requested_nav_par1;
1181 $this->requested_nav_par2 !=
"" &&
1182 $this->requested_nav_par2 != $this->requested_nav_par
1184 $this->nav_value = $this->requested_nav_par2;
1186 } elseif ($this->requested_nav_par !=
"") {
1187 $this->nav_value = $this->requested_nav_par;
1191 $order = $this->loadProperty(
"order");
1192 if (in_array($order, $this->sortable_fields)) {
1193 $direction = $this->loadProperty(
"direction");
1195 $direction = $this->getDefaultOrderDirection();
1201 $this->loadProperty(
"offset");
1203 $nav = explode(
":", $this->nav_value);
1206 $req_order_field = $nav[0] ??
"";
1207 $req_order_dir = $nav[1] ??
"";
1208 $req_offset = (
int) ($nav[2] ?? 0);
1209 $this->setOrderField(($req_order_field !=
"") ? $req_order_field : $this->getDefaultOrderField());
1210 $this->setOrderDirection(($req_order_dir !=
"") ? $req_order_dir : $this->getDefaultOrderDirection());
1212 if (!$a_omit_offset) {
1214 if (!$this->getExternalSegmentation() && $this->limit_determined && $this->limit == 9999) {
1215 $this->resetOffset(
true);
1216 } elseif (!$this->getExternalSegmentation() && $req_offset >= $this->max_count) {
1217 $this->resetOffset(
true);
1219 $this->setOffset($req_offset);
1223 if (!$a_omit_offset) {
1224 $this->nav_determined =
true;
1230 if ($this->getOrderField() !=
"") {
1231 $this->storeProperty(
"order", $this->getOrderField());
1233 if ($this->getOrderDirection() !=
"") {
1234 $this->storeProperty(
"direction", $this->getOrderDirection());
1236 if ($this->getOffset() >= 0) {
1237 $this->storeProperty(
"offset", (
string) $this->getOffset());
1250 if (isset(
$DIC[
"ilUser"])) {
1251 $ilUser =
$DIC[
"ilUser"];
1255 $ilCtrl = $this->ctrl;
1258 if ($this->getExportMode() > 0) {
1259 $this->exportData($this->getExportMode(),
true);
1262 $this->prepareOutput();
1264 if (is_object($ilCtrl) && is_object($this->getParentObject()) && $this->
getId() ==
"") {
1265 $ilCtrl->saveParameter($this->getParentObject(), $this->getNavParameter());
1268 if (!$this->getPrintMode()) {
1270 if ($this->form_action !=
"" && $this->getOpenFormTag()) {
1273 if ($this->form_multipart) {
1274 $this->tpl->touchBlock(
"form_multipart_bl");
1277 if ($this->getPreventDoubleSubmission()) {
1278 $this->tpl->touchBlock(
"pdfs");
1281 $this->tpl->setCurrentBlock(
"tbl_form_header");
1282 $this->tpl->setVariable(
"FORMACTION", $this->getFormAction() . $hash);
1283 $this->tpl->setVariable(
"FORMNAME", $this->getFormName());
1284 $this->tpl->parseCurrentBlock();
1287 if ($this->form_action !=
"" && $this->getCloseFormTag()) {
1288 $this->tpl->touchBlock(
"tbl_form_footer");
1292 if (!$this->enabled[
'content']) {
1293 return $this->render();
1296 if (!$this->getExternalSegmentation()) {
1297 $this->setMaxCount(count($this->row_data));
1300 $this->determineOffsetAndOrder();
1302 $this->setFooter(
"tblfooter", $this->
lng->txt(
"previous"), $this->lng->txt(
"next"));
1304 $data = $this->getData();
1305 if ($this->dataExists()) {
1307 if (!$this->getExternalSorting() && $this->enabled[
"sort"]) {
1310 $this->getOrderField(),
1311 $this->getOrderDirection(),
1312 $this->numericOrdering($this->getOrderField())
1317 if (!$this->getExternalSegmentation()) {
1318 $data = array_slice(
$data, $this->getOffset(), $this->getLimit());
1323 if ($this->dataExists()) {
1324 if ($this->getPrintMode()) {
1328 $this->tpl->addBlockFile(
1331 $this->row_template,
1332 $this->row_template_dir
1335 foreach (
$data as $set) {
1336 $this->tpl->setCurrentBlock(
"tbl_content");
1337 $this->css_row = ($this->css_row !==
"tblrow1")
1340 $this->tpl->setVariable(
"CSS_ROW", $this->css_row);
1342 $this->fillRow($set);
1343 $this->tpl->setCurrentBlock(
"tbl_content");
1344 $this->tpl->parseCurrentBlock();
1348 $no_items_text = (trim($this->getNoEntriesText()) !=
'')
1349 ? $this->getNoEntriesText()
1350 :
$lng->txt(
"no_items");
1352 $this->css_row = ($this->css_row !==
"tblrow1")
1356 $this->tpl->setCurrentBlock(
"tbl_no_entries");
1357 $this->tpl->setVariable(
'TBL_NO_ENTRY_CSS_ROW', $this->css_row);
1358 $this->tpl->setVariable(
'TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
1359 $this->tpl->setVariable(
'TBL_NO_ENTRY_TEXT', trim($no_items_text));
1360 $this->tpl->parseCurrentBlock();
1364 if (!$this->getPrintMode()) {
1365 $this->fillFooter();
1367 $this->fillHiddenRow();
1369 $this->fillActionRow();
1371 $this->storeNavParameter();
1374 return $this->render();
1389 $this->tpl->setVariable(
"CSS_TABLE", $this->getStyle(
"table"));
1390 if ($this->
getId() !=
"") {
1391 $this->tpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
1395 if ($this->getDescription() !=
"") {
1396 $this->tpl->setCurrentBlock(
"tbl_header_description");
1397 $this->tpl->setVariable(
"TBL_DESCRIPTION", $this->getDescription());
1398 $this->tpl->parseCurrentBlock();
1401 if (!$this->getPrintMode()) {
1402 $this->renderFilter();
1405 if ($this->getDisplayAsBlock()) {
1406 $this->tpl->touchBlock(
"outer_start_1");
1407 $this->tpl->touchBlock(
"outer_end_1");
1409 $this->tpl->touchBlock(
"outer_start_2");
1410 $this->tpl->touchBlock(
"outer_end_2");
1414 if ($this->enabled[
"title"] && ($this->title !=
""
1415 || $this->icon !=
"" || count($this->header_commands) > 0 ||
1416 $this->headerHTML !=
"" || $this->close_command !=
"")) {
1417 if ($this->enabled[
"icon"]) {
1418 $this->tpl->setCurrentBlock(
"tbl_header_title_icon");
1420 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT", $this->icon_alt);
1421 $this->tpl->parseCurrentBlock();
1424 if (!$this->getPrintMode()) {
1425 foreach ($this->header_commands as $command) {
1426 if ($command[
"img"] !=
"") {
1427 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1428 if ($command[
"target"] !=
"") {
1429 $this->tpl->setVariable(
1431 'target="' . $command[
"target"] .
'"'
1434 $this->tpl->setVariable(
"ALT_IMG_LINK", $command[
"text"]);
1435 $this->tpl->setVariable(
"HREF_IMG_LINK", $command[
"href"]);
1436 $this->tpl->setVariable(
1441 $this->tpl->setCurrentBlock(
"head_cmd");
1442 $this->tpl->setVariable(
"TXT_HEAD_CMD", $command[
"text"]);
1443 $this->tpl->setVariable(
"HREF_HEAD_CMD", $command[
"href"]);
1445 $this->tpl->parseCurrentBlock();
1449 if (isset($this->headerHTML)) {
1450 $this->tpl->setCurrentBlock(
"tbl_header_html");
1451 $this->tpl->setVariable(
"HEADER_HTML", $this->headerHTML);
1452 $this->tpl->parseCurrentBlock();
1456 if ($this->close_command !=
"") {
1457 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1458 $this->tpl->setVariable(
"ALT_IMG_LINK",
$lng->txt(
"close"));
1459 $this->tpl->setVariable(
"HREF_IMG_LINK", $this->close_command);
1460 $this->tpl->parseCurrentBlock();
1463 $this->tpl->setCurrentBlock(
"tbl_header_title");
1464 $this->tpl->setVariable(
"TBL_TITLE", $this->title);
1465 if ($this->getDisplayAsBlock()) {
1466 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1468 $this->tpl->parseCurrentBlock();
1472 if ($this->enabled[
"header"]) {
1473 $this->fillHeader();
1476 $this->tpl->touchBlock(
"tbl_table_end");
1478 return $this->tpl->get();
1489 $main_tpl =
$DIC[
"tpl"];
1491 $filter = $this->getFilterItems();
1492 $opt_filter = $this->getFilterItems(
true);
1494 $main_tpl->addJavascript(
"assets/js/ServiceTable.js");
1496 if (count($filter) == 0 && count($opt_filter) == 0) {
1503 if (count($filter) > 0) {
1504 foreach ($filter as $item) {
1505 if ($ccnt >= $this->getFilterCols()) {
1506 $this->tpl->setCurrentBlock(
"filter_row");
1507 $this->tpl->parseCurrentBlock();
1510 $this->tpl->setCurrentBlock(
"filter_item");
1511 $this->tpl->setVariable(
1515 $this->tpl->setVariable(
1517 $item->getTableFilterLabelFor()
1519 $this->tpl->setVariable(
1521 $item->getTableFilterHTML()
1523 $this->tpl->parseCurrentBlock();
1529 if (count($opt_filter) > 0) {
1530 $this->determineSelectedFilters();
1532 foreach ($opt_filter as $item) {
1533 if ($this->isFilterSelected($item->getPostVar())) {
1534 if ($ccnt >= $this->getFilterCols()) {
1535 $this->tpl->setCurrentBlock(
"filter_row");
1536 $this->tpl->parseCurrentBlock();
1539 $this->tpl->setCurrentBlock(
"filter_item");
1540 $this->tpl->setVariable(
1544 $this->tpl->setVariable(
1548 $this->tpl->setVariable(
1550 $item->getTableFilterHTML()
1552 $this->tpl->parseCurrentBlock();
1559 foreach ($opt_filter as $item) {
1560 $k = $item->getPostVar();
1561 $items[$k] = array(
"txt" => $item->getTitle(),
1562 "selected" => $this->isFilterSelected($k));
1566 $cb_over->setLinkTitle(
$lng->txt(
"optional_filters"));
1567 $cb_over->setItems($items);
1569 $cb_over->setFormCmd($this->getParentCmd());
1570 $cb_over->setFieldVar(
"tblff" . $this->
getId());
1571 $cb_over->setHiddenVar(
"tblfsf" . $this->
getId());
1573 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1574 $this->tpl->setCurrentBlock(
"filter_select");
1577 $this->tpl->setVariable(
"HIDDEN_CMD_APPLY", $this->filter_cmd);
1579 $this->tpl->setVariable(
"FILTER_SELECTOR", $cb_over->getHTML(
false));
1580 $this->tpl->parseCurrentBlock();
1584 if ($ccnt > 0 || count($opt_filter) > 0) {
1585 $this->tpl->setVariable(
"TXT_FILTER",
$lng->txt(
"filter"));
1588 if ($ccnt < $this->getFilterCols()) {
1589 for ($i = $ccnt; $i <= $this->getFilterCols(); $i++) {
1590 $this->tpl->touchBlock(
"filter_empty_cell");
1593 $this->tpl->setCurrentBlock(
"filter_row");
1594 $this->tpl->parseCurrentBlock();
1596 $this->tpl->setCurrentBlock(
"filter_buttons");
1597 $this->tpl->setVariable(
"CMD_APPLY", $this->filter_cmd);
1598 $this->tpl->setVariable(
"TXT_APPLY", $this->filter_cmd_txt
1599 ?:
$lng->txt(
"apply_filter"));
1600 $this->tpl->setVariable(
"CMD_RESET", $this->reset_cmd);
1601 $this->tpl->setVariable(
"TXT_RESET", $this->reset_cmd_txt
1602 ?:
$lng->txt(
"reset_filter"));
1603 } elseif (count($opt_filter) > 0) {
1604 $this->tpl->setCurrentBlock(
"optional_filter_hint");
1605 $this->tpl->setVariable(
'TXT_OPT_HINT',
$lng->txt(
'optional_filter_hint'));
1606 $this->tpl->parseCurrentBlock();
1609 $this->tpl->setCurrentBlock(
"filter_section");
1610 $this->tpl->setVariable(
"FIL_ID", $this->
getId());
1611 $this->tpl->parseCurrentBlock();
1614 if (!$this->isFilterVisible() && !$this->getDisableFilterHiding()) {
1616 $this->main_tpl->addOnLoadCode(
"
1617 ilTableHideFilter['atfil_$id'] = true;
1618 ilTableHideFilter['tfil_$id'] = true;
1619 ilTableHideFilter['dtfil_$id'] = true;
1626 $this->main_tpl->addOnLoadCode(
"ilInitTableFilters()");
1635 $prop = $this->loadProperty(
'filter');
1636 if ($prop ===
'0' || $prop ===
'1') {
1637 return (
bool) $prop;
1639 return $this->getDefaultFilterVisibility();
1649 foreach ($a_gui->getFilterElements(false) as $item) {
1650 if ($item === $a_element) {
1659 $advmd_record_gui =
null;
1660 if (method_exists($this,
"getAdvMDRecordGUI")) {
1661 $advmd_record_gui = $this->getAdvMDRecordGUI();
1664 foreach ($this->getFilterItems() as $item) {
1665 if ($advmd_record_gui &&
1666 $this->isAdvMDFilter($advmd_record_gui, $item)) {
1670 if ($item->checkInput()) {
1671 $item->setValueByArray($this->raw_post_data);
1672 $item->writeToSession();
1675 foreach ($this->getFilterItems(
true) as $item) {
1676 if ($advmd_record_gui &&
1677 $this->isAdvMDFilter($advmd_record_gui, $item)) {
1681 if ($item->checkInput()) {
1682 $item->setValueByArray($this->raw_post_data);
1683 $item->writeToSession();
1687 if ($advmd_record_gui) {
1688 $advmd_record_gui->importFilter();
1694 $filter = $this->getFilterItems();
1695 $opt_filter = $this->getFilterItems(
true);
1697 foreach ($filter as $item) {
1698 if ($item->checkInput()) {
1700 $item->setValueByArray([]);
1701 $item->clearFromSession();
1704 foreach ($opt_filter as $item) {
1705 if ($item->checkInput()) {
1707 $item->setValueByArray([]);
1708 $item->clearFromSession();
1720 foreach ($a_set as $key => $value) {
1721 $this->tpl->setVariable(
"VAL_" . strtoupper($key), $value);
1730 if (isset(
$DIC[
"ilUser"])) {
1731 $ilUser =
$DIC[
"ilUser"];
1734 $ui_factory = $this->
ui->factory();
1735 $ui_renderer = $this->
ui->renderer();
1738 $ilCtrl = $this->ctrl;
1743 $column_selector =
'';
1746 if ((strlen($this->getFormName())) && (strlen($this->getSelectAllCheckbox())) && $this->dataExists()) {
1747 $this->tpl->setCurrentBlock(
"select_all_checkbox");
1748 $this->tpl->setVariable(
"SELECT_ALL_TXT_SELECT_ALL",
$lng->txt(
"select_all"));
1749 $this->tpl->setVariable(
"SELECT_ALL_CHECKBOX_NAME", $this->getSelectAllCheckbox());
1750 $this->tpl->setVariable(
"SELECT_ALL_FORM_NAME", $this->getFormName());
1751 $this->tpl->setVariable(
"CHECKBOXNAME",
"chb_select_all_" . $this->unique_id);
1752 $this->tpl->parseCurrentBlock();
1756 if ($this->enabled[
"numinfo"] && $this->enabled[
"footer"]) {
1757 $start = $this->offset + 1;
1758 if (!$this->dataExists()) {
1761 $end = $this->offset + $this->limit;
1763 if ($end > $this->max_count or $this->limit == 0) {
1764 $end = $this->max_count;
1767 if ($this->max_count > 0) {
1768 if ($this->lang_support) {
1769 $numinfo =
"(" . $start .
" - " . $end .
" " . strtolower($this->
lng->txt(
"of")) .
" " . $this->max_count .
")";
1771 $numinfo =
"(" . $start .
" - " . $end .
" of " . $this->max_count .
")";
1774 if ($this->max_count > 0) {
1775 if ($this->getEnableNumInfo()) {
1776 $this->tpl->setCurrentBlock(
"tbl_footer_numinfo");
1777 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1778 $this->tpl->parseCurrentBlock();
1785 if ($this->enabled[
"linkbar"] && $this->enabled[
"footer"] && $this->limit != 0
1786 && $this->max_count > 0) {
1787 $linkbar = $this->getLinkbar(
"1");
1788 $this->tpl->setCurrentBlock(
"tbl_footer_linkbar");
1789 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1790 $this->tpl->parseCurrentBlock();
1796 if (is_array($this->getSelectableColumns()) && count($this->getSelectableColumns()) > 0) {
1798 foreach ($this->getSelectableColumns() as $k =>
$c) {
1799 $items[$k] = array(
"txt" =>
$c[
"txt"],
1800 "selected" => $this->isColumnSelected($k));
1803 $cb_over->setLinkTitle(
$lng->txt(
"columns"));
1804 $cb_over->setItems($items);
1807 $cb_over->setFormCmd($this->getParentCmd());
1808 $cb_over->setFieldVar(
"tblfs" . $this->
getId());
1809 $cb_over->setHiddenVar(
"tblfsh" . $this->
getId());
1810 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1811 $column_selector = $cb_over->getHTML();
1816 $this->tpl->setCurrentBlock(
"tbl_footer");
1817 $this->tpl->setVariable(
"COLUMN_COUNT", $this->getColumnCount());
1818 if ($this->getDisplayAsBlock()) {
1819 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1821 $this->tpl->parseCurrentBlock();
1824 if ($numinfo !=
"" || $linkbar !=
"" || $column_selector !=
"" ||
1825 count($this->filters) > 0 || count($this->optional_filters) > 0) {
1826 if (is_object($ilUser) && (count($this->filters) || count($this->optional_filters))) {
1827 $this->tpl->setCurrentBlock(
"filter_activation");
1828 $this->tpl->setVariable(
"TXT_ACTIVATE_FILTER",
$lng->txt(
"show_filter"));
1829 $this->tpl->setVariable(
"FILA_ID", $this->
getId());
1830 if ($this->
getId() !=
"") {
1831 $this->tpl->setVariable(
"SAVE_URLA",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1832 $this->
getId() .
"&cmd=showFilter&user_id=" . $ilUser->getId());
1834 $this->tpl->parseCurrentBlock();
1837 if (!$this->getDisableFilterHiding()) {
1838 $this->tpl->setCurrentBlock(
"filter_deactivation");
1839 $this->tpl->setVariable(
"TXT_HIDE",
$lng->txt(
"hide_filter"));
1840 if ($this->
getId() !=
"") {
1841 $this->tpl->setVariable(
"SAVE_URL",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1842 $this->
getId() .
"&cmd=hideFilter&user_id=" . $ilUser->getId());
1843 $this->tpl->setVariable(
"FILD_ID", $this->
getId());
1845 $this->tpl->parseCurrentBlock();
1849 if ($numinfo !=
"" && $this->getEnableNumInfo()) {
1850 $this->tpl->setCurrentBlock(
"top_numinfo");
1851 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1852 $this->tpl->parseCurrentBlock();
1854 if ($linkbar !=
"" && !$this->getDisplayAsBlock()) {
1855 $linkbar = $this->getLinkbar(
"2");
1856 $this->tpl->setCurrentBlock(
"top_linkbar");
1857 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1858 $this->tpl->parseCurrentBlock();
1862 $this->tpl->setVariable(
"COLUMN_SELECTOR", $column_selector);
1865 if ($this->getShowRowsSelector() &&
1866 is_object($ilUser) &&
1868 !$this->rows_selector_off) {
1871 $options = array(5 => 5, 10 => 10, 15 => 15, 20 => 20,
1872 30 => 30, 40 => 40, 50 => 50,
1873 100 => 100, 200 => 200, 400 => 400, 800 => 800);
1875 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows", $k);
1876 $actions[] = $ui_factory->link()->standard(
1878 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
1880 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows",
"");
1882 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
1883 $this->getRowSelectorLabel() ?:
$lng->txt(
"rows")
1885 $this->tpl->setVariable(
"ROW_SELECTOR", $ui_renderer->render($dd));
1889 if (count($this->export_formats) > 0 && $this->dataExists()) {
1891 foreach ($this->export_formats as $format => $caption_lng_id) {
1892 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt", $format);
1893 $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
1894 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
"");
1895 $actions[] = $ui_factory->link()->standard(
1896 $lng->txt($caption_lng_id),
1900 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
$lng->txt(
"export"));
1901 $this->tpl->setVariable(
"EXPORT_SELECTOR",
" " . $ui_renderer->render($dd));
1904 $this->tpl->setCurrentBlock(
"top_navigation");
1905 $this->tpl->setVariable(
"COLUMN_COUNT", $this->getColumnCount());
1906 if ($this->getDisplayAsBlock()) {
1907 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1909 $this->tpl->parseCurrentBlock();
1918 $ilUser =
$DIC->user();
1920 $ilCtrl = $this->ctrl;
1925 $link = $ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd) .
1926 "&" . $this->getNavParameter() .
"=" .
1927 $this->getOrderField() .
":" . $this->getOrderDirection() .
":";
1930 $layout_prev =
$lng->txt(
"previous");
1931 $layout_next =
$lng->txt(
"next");
1934 if ($this->max_count > $this->getLimit() || $this->custom_prev_next) {
1935 $sep =
"<span> | </span>";
1938 $pages = intval($this->max_count / $this->getLimit());
1941 if (($this->max_count % $this->getLimit())) {
1946 $offset_arr = array();
1947 for ($i = 1 ;$i <= $pages ; $i++) {
1948 $newoffset = $this->getLimit() * ($i - 1);
1950 $nav_value = $this->getOrderField() .
":" . $this->getOrderDirection() .
":" . $newoffset;
1951 $offset_arr[$nav_value] = $i;
1954 $sep =
"<span> </span>";
1957 if ($this->custom_prev_next && $this->custom_prev !=
"") {
1958 $LinkBar .=
"<a href=\"" . $this->custom_prev . $hash .
"\">" . $layout_prev .
"</a>";
1959 } elseif ($this->getOffset() >= 1 && !$this->custom_prev_next) {
1960 $prevoffset = $this->getOffset() - $this->getLimit();
1961 $LinkBar .=
"<a href=\"" . $link . $prevoffset . $hash .
"\">" . $layout_prev .
"</a>";
1963 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_prev .
"</span>";
1967 if ($a_num ==
"1") {
1968 $LinkBar .=
'<input type="hidden" name="' . $this->getNavParameter() .
1969 '" value="' . $this->getOrderField() .
":" . $this->getOrderDirection() .
":" . $this->getOffset() .
'" />';
1972 $sep =
"<span> | </span>";
1976 if ($this->custom_prev_next && $this->custom_next !=
"") {
1977 $LinkBar .=
"<a href=\"" . $this->custom_next . $hash .
"\">" . $layout_next .
"</a>";
1978 } elseif (!(($this->getOffset() / $this->getLimit()) == ($pages - 1)) && ($pages != 1) &&
1979 !$this->custom_prev_next) {
1980 $newoffset = $this->getOffset() + $this->getLimit();
1981 $LinkBar .=
"<a href=\"" . $link . $newoffset . $hash .
"\">" . $layout_next .
"</a>";
1983 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_next .
"</span>";
1986 $sep =
"<span> </span>";
1988 if (count($offset_arr) && !$this->getDisplayAsBlock() && !$this->custom_prev_next) {
1992 '<label for="tab_page_sel_' . $a_num .
'">' .
$lng->txt(
"page") .
'</label> ' .
1995 $this->getNavParameter() . $a_num,
2001 array(
"id" =>
"tab_page_sel_" . $a_num,
2002 "onchange" =>
"ilTablePageSelection(this, 'cmd[" . $this->parent_cmd .
"]')")
2014 $hidden_row =
false;
2015 if (count($this->hidden_inputs)) {
2016 foreach ($this->hidden_inputs as $hidden_input) {
2017 $this->tpl->setCurrentBlock(
"tbl_hidden_field");
2018 $this->tpl->setVariable(
"FIELD_NAME", $hidden_input[
"name"]);
2019 $this->tpl->setVariable(
"FIELD_VALUE", $hidden_input[
"value"]);
2020 $this->tpl->parseCurrentBlock();
2023 $this->tpl->setCurrentBlock(
"tbl_hidden_row");
2024 $this->tpl->parseCurrentBlock();
2033 $action_row =
false;
2039 if (count($this->sel_buttons) > 0) {
2040 foreach ($this->sel_buttons as $button) {
2041 $this->tpl->setCurrentBlock(
"sel_button");
2042 $this->tpl->setVariable(
2045 $button[
"selected"],
2052 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2053 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2054 $this->tpl->parseCurrentBlock();
2056 if ($this->getTopCommands()) {
2057 $this->tpl->setCurrentBlock(
"sel_top_button");
2058 $this->tpl->setVariable(
2061 $button[
"selected"],
2068 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2069 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2070 $this->tpl->parseCurrentBlock();
2076 $this->sel_buttons[] = array(
"options" => [],
"cmd" =>
'',
"text" =>
'');
2079 if (count($this->buttons) > 0) {
2080 foreach ($this->buttons as $button) {
2081 if (!is_array($button)) {
2083 $this->tpl->setVariable(
'BUTTON_OBJ', $button->render());
2086 $button = clone $button;
2088 $this->tpl->setVariable(
'BUTTON_TOP_OBJ', $button->render());
2093 if (strlen($button[
'onclick'])) {
2094 $this->tpl->setCurrentBlock(
'cmdonclick');
2095 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2096 $this->tpl->parseCurrentBlock();
2098 $this->tpl->setCurrentBlock(
"plain_button");
2099 if ($button[
"id"] !=
"") {
2100 $this->tpl->setVariable(
"PBID",
' id="' . $button[
"id"] .
'" ');
2102 if ($button[
"class"] !=
"") {
2103 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2105 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2106 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2107 $this->tpl->parseCurrentBlock();
2109 if ($this->getTopCommands()) {
2110 if (strlen($button[
'onclick'])) {
2111 $this->tpl->setCurrentBlock(
'top_cmdonclick');
2112 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2113 $this->tpl->parseCurrentBlock();
2115 $this->tpl->setCurrentBlock(
"plain_top_button");
2116 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2117 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2118 if ($button[
"class"] !=
"") {
2119 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2121 $this->tpl->parseCurrentBlock();
2130 if (count($this->mi_sel_buttons)) {
2131 foreach ($this->mi_sel_buttons as $button) {
2132 $this->tpl->setCurrentBlock(
"mi_sel_button");
2133 $this->tpl->setVariable(
2136 $button[
"selected"],
2143 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2144 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2145 $this->tpl->parseCurrentBlock();
2147 if ($this->getTopCommands()) {
2148 $this->tpl->setCurrentBlock(
"mi_top_sel_button");
2149 $this->tpl->setVariable(
2152 $button[
"selected"],
2153 $button[
"sel_var"] .
"_2",
2159 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2160 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2161 $this->tpl->parseCurrentBlock();
2169 if (count($this->multi) > 1 && $this->dataExists()) {
2170 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2171 $this->tpl->setCurrentBlock(
"tbl_cmd_select_all");
2172 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2173 $this->tpl->parseCurrentBlock();
2176 $this->tpl->setCurrentBlock(
"tbl_cmd_select");
2178 foreach ($this->multi as $mc) {
2179 $sel[$mc[
"cmd"]] = $mc[
"text"];
2181 $this->tpl->setVariable(
2185 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2186 $this->tpl->parseCurrentBlock();
2190 if ($this->getTopCommands()) {
2191 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2192 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select_all");
2193 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2194 $this->tpl->parseCurrentBlock();
2197 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select");
2199 foreach ($this->multi as $mc) {
2200 $sel[$mc[
"cmd"]] = $mc[
"text"];
2202 $this->tpl->setVariable(
2206 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2207 $this->tpl->parseCurrentBlock();
2209 } elseif (count($this->multi) == 1 && $this->dataExists()) {
2210 $this->tpl->setCurrentBlock(
"tbl_single_cmd");
2211 foreach ($this->multi as $mc) {
2215 $this->tpl->setVariable(
"TXT_SINGLE_CMD", $txt);
2216 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2217 $this->tpl->parseCurrentBlock();
2221 if ($this->getTopCommands()) {
2222 $this->tpl->setCurrentBlock(
"tbl_top_single_cmd");
2223 foreach ($this->multi as $mc) {
2227 $this->tpl->setVariable(
"TXT_SINGLE_CMD", $txt);
2228 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2229 $this->tpl->parseCurrentBlock();
2234 $this->tpl->setCurrentBlock(
"tbl_action_img_arrow");
2236 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2237 $this->tpl->parseCurrentBlock();
2239 if ($this->getTopCommands()) {
2240 $this->tpl->setCurrentBlock(
"tbl_top_action_img_arrow");
2242 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2243 $this->tpl->parseCurrentBlock();
2248 $this->tpl->setCurrentBlock(
"tbl_action_row");
2249 $this->tpl->parseCurrentBlock();
2250 if ($this->getTopCommands()) {
2251 $this->tpl->setCurrentBlock(
"tbl_top_action_row");
2252 $this->tpl->parseCurrentBlock();
2259 $this->headerHTML = $html;
2267 if (isset(
$DIC[
"ilUser"])) {
2268 $ilUser =
$DIC[
"ilUser"];
2271 if (is_object($ilUser) && $this->
getId() !=
"") {
2274 $tab_prop->storeProperty($this->
getId(), $ilUser->getId(), $type, $value);
2283 if (isset(
$DIC[
"ilUser"])) {
2284 $ilUser =
$DIC[
"ilUser"];
2287 if (is_object($ilUser) && $this->
getId() !=
"") {
2290 return $tab_prop->getProperty($this->
getId(), $ilUser->getId(), $type);
2300 $this->determineOffsetAndOrder();
2301 $this->determineLimit();
2302 $this->determineSelectedColumns();
2303 $this->determineSelectedFilters();
2308 $result[
"order"] = $this->getOrderField();
2309 $result[
"direction"] = $this->getOrderDirection();
2310 $result[
"offset"] = $this->getOffset();
2311 $result[
"rows"] = $this->getLimit();
2312 $result[
"selfilters"] = $this->getSelectedFilters();
2316 $result[
"selfields"] = $this->selected_column;
2319 if ($this->filters) {
2320 foreach ($this->filters as $item) {
2321 $result[
"filter_values"][$item->getFieldId()] = $this->getFilterValue($item);
2324 if ($this->optional_filters && $result[
"selfilters"]) {
2325 foreach ($this->optional_filters as $item) {
2326 if (in_array($item->getFieldId(), $result[
"selfilters"])) {
2327 $result[
"filter_values"][$item->getFieldId()] = $this->getFilterValue($item);
2341 if (method_exists($a_item,
"getChecked")) {
2342 return (
string) $a_item->getChecked();
2343 } elseif (method_exists($a_item,
"getValue")) {
2344 return $a_item->getValue() ?:
"";
2345 } elseif (method_exists($a_item,
"getDate")) {
2346 return $a_item->getDate()?->get(
IL_CAL_DATE) ??
"";
2357 if (method_exists($a_item,
"setChecked")) {
2358 $a_item->setChecked((
bool) $a_value);
2359 } elseif (method_exists($a_item,
"setValue")) {
2360 $a_item->setValue($a_value);
2361 } elseif (method_exists($a_item,
"setDate")) {
2364 $a_item->writeToSession();
2370 $this->context =
$id;
2376 return $this->context;
2384 $this->show_rows_selector = $a_value;
2389 return $this->show_rows_selector;
2394 if ($this->getExportMode() || $this->getPrintMode()) {
2397 return parent::getLimit();
2402 if ($this->getExportMode() || $this->getPrintMode()) {
2405 return parent::getOffset();
2413 $this->export_formats = array();
2416 $valid = array(self::EXPORT_EXCEL =>
"tbl_export_excel",
2417 self::EXPORT_CSV =>
"tbl_export_csv");
2419 foreach ($formats as $format) {
2420 if (array_key_exists($format,
$valid)) {
2421 $this->export_formats[$format] =
$valid[$format];
2428 $this->print_mode = $a_value;
2433 return $this->print_mode;
2438 return $this->export_mode;
2444 public function exportData(
int $format,
bool $send =
false): void
2446 if ($this->dataExists()) {
2448 if (!$this->getExternalSorting() && $this->enabled[
"sort"]) {
2449 $this->determineOffsetAndOrder(
true);
2453 $this->getOrderField(),
2454 $this->getOrderDirection(),
2455 $this->numericOrdering($this->getOrderField())
2461 case self::EXPORT_EXCEL:
2463 $excel->addSheet($this->title
2464 ?: $this->
lng->txt(
"export"));
2468 $this->fillMetaExcel($excel, $row);
2472 $this->fillHeaderExcel($excel, $row);
2477 foreach ($this->row_data as $set) {
2478 $this->fillRowExcel($excel, $row, $set);
2490 case self::EXPORT_CSV:
2492 $csv->setSeparator(
";");
2495 $this->fillMetaCSV($csv);
2496 $this->fillHeaderCSV($csv);
2497 foreach ($this->row_data as $set) {
2498 $this->fillRowCSV($csv, $set);
2504 header(
"Content-type: text/comma-separated-values");
2505 header(
"Content-Disposition: attachment; filename=\"" .
$filename .
"\"");
2507 header(
"Cache-Control: must-revalidate, post-check=0,pre-check=0");
2508 header(
"Pragma: public");
2509 echo $csv->getCSVString();
2511 file_put_contents(
$filename, $csv->getCSVString());
2541 foreach ($this->column as $column) {
2542 $title = strip_tags($column[
"text"]);
2544 $a_excel->
setCell($a_row, $col++, $title);
2560 foreach ($a_set as $value) {
2561 if (is_array($value)) {
2562 $value = implode(
', ', $value);
2564 $a_excel->
setCell($a_row, $col++, $value);
2584 foreach ($this->column as $column) {
2585 $title = strip_tags($column[
"text"]);
2601 foreach ($a_set as $key => $value) {
2602 if (is_array($value)) {
2603 $value = implode(
', ', $value);
2612 $this->enable_command_for_all = $a_value;
2619 $ilClientIniFile =
$DIC[
"ilClientIniFile"];
2621 $limit = $ilClientIniFile->readVariable(
"system",
"TABLE_ACTION_ALL_LIMIT");
2623 $limit = self::ACTION_ALL_LIMIT;
2631 $this->row_selector_label = $row_selector_label;
2636 return $this->row_selector_label;
2641 $this->prevent_double_submission = $a_val;
2646 return $this->prevent_double_submission;
2649 public function setLimit(
int $a_limit = 0,
int $a_default_limit = 0): void
2651 parent::setLimit($a_limit, $a_default_limit);
2654 if ($a_limit == 9999 &&
2655 $this->limit_determined) {
2656 $this->rows_selector_off =
true;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
static setUseRelativeDates(bool $a_status)
set use relative dates
setBold(string $a_coords)
Set cell(s) to bold.
getColumnCoord(int $a_col)
Get column "name" from number.
setCell(int $a_row, int $col, $value, ?string $datatype=null)
Set cell value.
Base class for ILIAS Exception handling.
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $defaultorderdirection
setTopAnchor(string $a_val)
isFilterSelected(string $a_col)
Is given filter selected?
isColumnSelected(string $col)
array $restore_filter_values
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
setOrderLink(string $key, string $order_dir)
bool $enable_command_for_all
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setFilterCommand(string $a_val, string $a_caption="")
getFormName()
get the name of the parent form
prepareOutput()
Anything that must be done before HTML is generated.
setOrderField(string $a_order_field)
setPreventDoubleSubmission(bool $a_val)
getDefaultFilterVisibility()
getFilterItemByPostVar(string $a_post_var)
determineSelectedColumns()
loadProperty(string $type)
bool $disable_filter_hiding
setEnableAllCommand(bool $a_value)
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
bool $prevent_double_submission
string $requested_nav_par1
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
CSV Version of Fill Row.
setIsDataTable(bool $a_val)
setRowSelectorLabel(string $row_selector_label)
determineOffsetAndOrder(bool $a_omit_offset=false)
setCustomPreviousNext(string $a_prev_link, string $a_next_link)
setOpenFormTag(bool $a_val)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
string $row_selector_label
setEnableNumInfo(bool $a_val)
setExportFormats(array $formats)
Set available export formats.
setExternalSegmentation(bool $a_val)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setEnableTitle(bool $a_enabletitle)
setFormName(string $a_name="")
getLinkbar(string $a_num)
setDescription(string $a_val)
addHiddenInput(string $a_name, string $a_value)
addMultiCommand(string $a_cmd, string $a_text)
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setFormAction(string $a_form_action, bool $a_multipart=false)
resetOffset(bool $a_in_determination=false)
setHeaderHTML(string $html)
string $defaultorderfield
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
ILIAS Table TableGUIRequest $table_request
fillHeaderCSV(ilCSVWriter $a_csv)
CSV Version of Fill Header.
setEnableHeader(bool $a_enableheader)
getDefaultOrderDirection()
renderFilter()
Render Filter section.
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
Excel Version of Fill Row.
isFilterVisible()
Check if filter is visible: manually shown (session, db) or default value set.
addCommandButtonInstance(ilButtonBase $a_button)
setDefaultOrderField(string $a_defaultorderfield)
ilGlobalTemplateInterface $main_tpl
setPrintMode(bool $a_value=false)
setDisplayAsBlock(bool $a_val)
fillRow(array $a_set)
Standard Version of Fill Row.
getCurrentState()
get current settings for order, limit, columns and filter
getSelectableColumns()
Get selectable columns.
addHeaderCommand(string $a_href, string $a_text, string $a_target="", string $a_img="")
static getAllCommandLimit()
getExternalSegmentation()
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
string $requested_nav_par
setDisableFilterHiding(bool $a_val=true)
numericOrdering(string $a_field)
Should this field be sorted numeric?
setNoEntriesText(string $a_text)
fillMetaExcel(ilExcel $a_excel, int &$a_row)
Add meta information to excel export.
setTopCommands(bool $a_val)
getFilterItems(bool $a_optionals=false)
setFilterValue(ilTableFilterItem $a_item, $a_value)
setExternalSorting(bool $a_val)
isAdvMDFilter(ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
Check if filter element is based on adv md.
array $selectable_columns
const FILTER_DURATION_RANGE
string $requested_nav_par2
addMultiItemSelectionButton(string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
setCloseCommand(string $a_link)
getFilterValue(ilTableFilterItem $a_item)
Get current filter value.
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
bool $default_filter_visibility
setDefaultOrderDirection(string $a_defaultorderdirection)
setFilterCols(int $a_val)
setResetCommand(string $a_val, string $a_caption="")
storeProperty(string $type, string $value)
setDefaultFilterVisiblity(bool $a_status)
setData(array $a_data)
Set table data.
const FILTER_NUMBER_RANGE
exportData(int $format, bool $send=false)
Export and optionally send current table data.
fillMetaCSV(ilCSVWriter $a_csv)
Add meta information to csv export.
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
Excel Version of Fill Header.
setCloseFormTag(bool $a_val)
getPreventDoubleSubmission()
const FILTER_DATETIME_RANGE
determineSelectedFilters()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOffset(int $a_offset)
set dataset offset
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 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 img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc