39 private \ILIAS\DI\UIServices
$ui;
96 protected string $id =
"";
127 ?
object $a_parent_obj,
128 string $a_parent_cmd =
"",
129 string $a_template_context =
"" 132 $this->main_tpl = $DIC->ui()->mainTemplate();
133 $this->
ui = $DIC->ui();
135 $this->
lng = $DIC->language();
136 $this->
ctrl = $DIC->ctrl();
137 $lng = $DIC->language();
139 if (isset($DIC[
"http"])) {
140 $this->table_request = new \ILIAS\Table\TableGUIRequest(
147 $this->unique_id = md5(uniqid(
'',
true));
148 $this->parent_obj = $a_parent_obj;
149 $this->parent_cmd = $a_parent_cmd;
150 $this->buttons = array();
151 $this->header_commands = array();
152 $this->multi = array();
153 $this->hidden_inputs = array();
155 $this->tpl =
new ilTemplate(
"tpl.table2.html",
true,
true,
"components/ILIAS/Table");
159 if (!$a_template_context) {
160 $a_template_context = $this->
getId();
165 if (isset($this->table_request)) {
166 $this->export_mode = $this->table_request->getExportMode($this->prefix);
169 if ($this->table_request->getTemplate($this->prefix) !=
"") {
170 $this->
restoreTemplate($this->table_request->getTemplate($this->prefix));
179 $this->raw_post_data = [];
180 if (isset($DIC[
"http"])) {
181 $this->raw_post_data = $DIC->http()->request()->getParsedBody();
187 if (is_null($this->table_request)) {
190 $this->requested_nav_par = $this->table_request->getNavPar($this->
getNavParameter());
191 $this->requested_nav_par1 = $this->table_request->getNavPar($this->
getNavParameter(), 1);
192 $this->requested_nav_par2 = $this->table_request->getNavPar($this->
getNavParameter(), 2);
193 $this->requested_tmpl_create = $this->table_request->getTemplCreate();
194 $this->requested_tmpl_delete = $this->table_request->getTemplDelete();
199 $this->open_form_tag = $a_val;
209 $this->close_form_tag = $a_val;
222 if (isset($DIC[
"ilUser"])) {
223 $ilUser = $DIC[
"ilUser"];
226 if ($this->limit_determined) {
231 if (isset($this->table_request) && !is_null($this->table_request->getRows($this->prefix))) {
232 $this->
storeProperty(
"rows", $this->table_request->getRows($this->prefix));
233 $limit = $this->table_request->getRows($this->prefix) ?? 0;
247 $this->limit_determined =
true;
261 if ($this->columns_determined) {
268 if ($old_sel !=
"") {
269 $sel_fields = unserialize((
string) $old_sel);
272 if (!is_array($sel_fields)) {
274 $sel_fields = array();
277 $this->selected_columns = array();
282 if (isset($this->table_request)) {
283 $fs = $this->table_request->getFS($this->
getId());
284 $fsh = $this->table_request->getFSH($this->
getId());
288 $this->selected_column[$k] =
false;
290 $new_column = (!isset($sel_fields[$k]));
294 if (in_array($k, $fs)) {
295 $this->selected_column[$k] =
true;
297 } elseif ($stored && !$new_column) {
298 $this->selected_column[$k] = $sel_fields[$k];
303 if (isset(
$c[
"default"]) &&
$c[
"default"]) {
304 $this->selected_column[$k] =
true;
310 if (isset($this->table_request)) {
311 $ff = $this->table_request->getFF($this->
getId());
313 if (count($ff) > 0) {
315 if (in_array($k, $ff)) {
316 $this->selected_column[$k] =
true;
321 if ($old_sel != serialize($this->selected_column) && $set) {
322 $this->
storeProperty(
"selfields", serialize($this->selected_column));
325 $this->columns_determined =
true;
330 return $this->selected_column[$col] ??
false;
336 foreach ($this->selected_column as $k => $v) {
344 public function executeCommand():
bool 350 switch ($next_class) {
351 case 'ilformpropertydispatchgui':
356 $this->table_request->getPostVar()
358 $form_prop_dispatch->setItem($item);
359 return (
bool) $ilCtrl->forwardCommand($form_prop_dispatch);
364 public function resetOffset(
bool $a_in_determination =
false): void
366 if (!$this->nav_determined && !$a_in_determination) {
390 $this->top_anchor = $a_val;
400 $this->noentriestext = $a_text;
410 $this->datatable = $a_val;
420 $this->enabled[
"title"] = $a_enabletitle;
425 return $this->enabled[
"title"];
430 $this->enabled[
"header"] = $a_enableheader;
435 return $this->enabled[
"header"];
440 $this->num_info = $a_val;
451 string $a_icon_alt =
"" 453 parent::setTitle($a_title, $a_icon, $a_icon_alt);
458 $this->description = $a_val;
468 $this->order_field = $a_order_field;
476 final public function setData(array $a_data): void
478 $this->row_data = $a_data;
488 return count($this->row_data) > 0;
493 $this->prefix = $a_prefix;
504 bool $a_optional =
false 506 $a_input_item->setParentTable($this);
508 $this->filters[] = $a_input_item;
510 $this->optional_filters[] = $a_input_item;
514 if ($this->restore_filter) {
515 if (array_key_exists($a_input_item->getFieldId(), $this->restore_filter_values ?? [])) {
516 $this->
setFilterValue($a_input_item, $this->restore_filter_values[$a_input_item->getFieldId()]);
529 int $type = self::FILTER_TEXT,
530 bool $a_optional =
false,
535 $lng = $DIC->language();
542 case self::FILTER_CHECKBOX:
546 case self::FILTER_SELECT:
550 case self::FILTER_DATE:
554 case self::FILTER_TEXT:
556 $item->setMaxLength(64);
561 case self::FILTER_LANGUAGE:
564 $options = array(
"" =>
$lng->
txt(
"trac_all"));
566 $options[$lang_key] =
$lng->
txt(
"meta_l_" . $lang_key);
568 $item->setOptions($options);
571 case self::FILTER_NUMBER_RANGE:
574 $combi_item->setSize(5);
575 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
577 $combi_item->setSize(5);
578 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
584 case self::FILTER_DATE_RANGE:
587 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
589 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
593 case self::FILTER_DATETIME_RANGE:
596 $combi_item->setShowTime(
true);
597 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
599 $combi_item->setShowTime(
true);
600 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
604 case self::FILTER_DURATION_RANGE:
608 $combi_item->setShowMonths(
false);
609 $combi_item->setShowDays(
true);
610 $combi_item->setShowSeconds(
true);
611 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
613 $combi_item->setShowMonths(
false);
614 $combi_item->setShowDays(
true);
615 $combi_item->setShowSeconds(
true);
616 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
625 $item->readFromSession();
640 if ($item->getPostVar() == $a_post_var) {
645 if ($item->getPostVar() == $a_post_var) {
654 $this->filter_cols = $a_val;
664 $this->disable_filter_hiding = $a_val;
677 return (
bool) $this->selected_filter[$a_col];
683 foreach ($this->selected_filter as $k => $v) {
693 if ($this->filters_determined) {
700 if ($old_sel !=
"") {
702 unserialize((
string) $old_sel);
705 if (!is_array($sel_filters)) {
707 $sel_filters = array();
710 $this->selected_filter = array();
713 $k = $item->getPostVar();
715 $this->selected_filter[$k] =
false;
717 if ($this->table_request->getFSF($this->getId())) {
719 if (in_array($k, $this->table_request->getFF($this->getId()))) {
720 $this->selected_filter[$k] =
true;
722 $item->setValue(null);
723 $item->writeToSession();
726 $this->selected_filter[$k] = $sel_filters[$k] ??
"";
730 if ($old_sel != serialize($this->selected_filter) && $set) {
731 $this->
storeProperty(
"selfilters", serialize($this->selected_filter));
734 $this->filters_determined =
true;
741 $this->custom_prev_next =
true;
742 $this->custom_prev = $a_prev_link;
743 $this->custom_next = $a_next_link;
747 string $a_form_action,
748 bool $a_multipart =
false 750 $this->form_action = $a_form_action;
751 $this->form_multipart = $a_multipart;
761 $this->formname = $a_name;
769 public function setId(
string $a_val): void
775 if (strlen($this->
id) > 30) {
776 throw new ilException(
"Table ID to long (max. 30 char): " . $this->
id);
787 $this->display_as_block = $a_val;
796 string $a_select_all_checkbox,
797 bool $a_select_all_on_top =
false 799 $this->select_all_checkbox = $a_select_all_checkbox;
800 $this->select_all_on_top = $a_select_all_on_top;
805 $this->ext_sort = $a_val;
815 string $a_caption =
"" 817 $this->filter_cmd = $a_val;
818 $this->filter_cmd_txt = $a_caption;
828 string $a_caption =
"" 830 $this->reset_cmd = $a_val;
831 $this->reset_cmd_txt = $a_caption;
841 $this->ext_seg = $a_val;
854 final public function setRowTemplate(
string $a_template,
string $a_template_dir =
""): void
856 $this->row_template = $a_template;
857 $this->row_template_dir = $a_template_dir;
862 $this->defaultorderfield = $a_defaultorderfield;
873 $this->defaultorderdirection = $a_defaultorderdirection;
883 $this->default_filter_visibility = $a_status;
893 $this->buttons = array();
899 string $a_onclick =
'',
903 $this->buttons[] = array(
"cmd" => $a_cmd,
"text" => $a_text,
'onclick' => $a_onclick,
904 "id" => $a_id,
"class" => $a_class);
909 $this->buttons[] = $a_button;
925 string $a_default_selection =
'' 927 $this->mi_sel_buttons[] = array(
"sel_var" => $a_sel_var,
"options" => $a_options,
"selected" => $a_default_selection,
"cmd" => $a_cmd,
"text" => $a_text);
933 $this->close_command = $a_link;
938 $this->multi[] = array(
"cmd" => $a_cmd,
"text" => $a_text);
943 $this->hidden_inputs[] = array(
"name" => $a_name,
"value" => $a_value);
949 string $a_target =
"",
952 $this->header_commands[] = array(
"href" => $a_href,
"text" => $a_text,
953 "target" => $a_target,
"img" => $a_img);
958 $this->top_commands = $a_val;
968 string $a_sort_field =
"",
969 string $a_width =
"",
970 bool $a_is_checkbox_action_column =
false,
971 string $a_class =
"",
972 string $a_tooltip =
"",
973 bool $a_tooltip_with_html =
false 975 $this->column[] = array(
977 "sort_field" => $a_sort_field,
979 "is_checkbox_action_column" => $a_is_checkbox_action_column,
981 "tooltip" => $a_tooltip,
982 "tooltip_html" => $a_tooltip_with_html
984 if ($a_sort_field !=
"") {
985 $this->sortable_fields[] = $a_sort_field;
987 $this->column_count = count($this->column);
993 return $this->prefix .
"_table_nav";
1000 $ilUser = $DIC->user();
1006 $old = $this->requested_nav_par ??
'';
1012 urlencode($key) .
":" . $order_dir .
":" . $this->offset
1014 $this->tpl->setVariable(
1016 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd) . $hash
1020 $ilCtrl->setParameter(
1031 $allcolumnswithwidth =
true;
1032 foreach ($this->column as $idx => $column) {
1033 if (!strlen($column[
"width"])) {
1034 $allcolumnswithwidth =
false;
1035 } elseif ($column[
"width"] ==
"1") {
1037 $this->column[$idx][
"width"] =
"1%";
1040 if ($allcolumnswithwidth) {
1041 foreach ($this->column as $column) {
1042 $this->tpl->setCurrentBlock(
"tbl_colgroup_column");
1043 $width = (is_numeric($column[
"width"]))
1044 ? $column[
"width"] .
"px" 1046 $this->tpl->setVariable(
"COLGROUP_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1047 $this->tpl->parseCurrentBlock();
1051 foreach ($this->column as $column) {
1054 if ($column[
"tooltip"] !=
"") {
1056 "thc_" . $this->
getId() .
"_" . $ccnt,
1061 !$column[
"tooltip_html"]
1065 if ($column[
'is_checkbox_action_column'] && $this->select_all_on_top) {
1066 $this->tpl->setCurrentBlock(
'tbl_header_top_select_all');
1067 $this->tpl->setVariable(
"HEAD_SELECT_ALL_TXT_SELECT_ALL",
$lng->
txt(
"select_all"));
1069 $this->tpl->setVariable(
"HEAD_SELECT_ALL_FORM_NAME", $this->
getFormName());
1070 $this->tpl->setVariable(
"HEAD_CHECKBOXNAME",
"chb_select_all_" . $this->unique_id .
'_top');
1071 $this->tpl->parseCurrentBlock();
1075 if ($column[
'is_checkbox_action_column'] && !$this->select_all_on_top) {
1076 $this->tpl->setCurrentBlock(
'tbl_header_top_select_column');
1077 if ($column[
"width"] !=
"") {
1078 $width = (is_numeric($column[
"width"]))
1079 ? $column[
"width"] .
"px" 1081 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1083 $this->tpl->parseCurrentBlock();
1088 !$this->enabled[
"sort"] ||
1089 (($column[
"sort_field"] ==
"") &&
1090 !($column[
"is_checkbox_action_column"] && $this->select_all_on_top))
1092 $this->tpl->setCurrentBlock(
"tbl_header_no_link");
1093 if ($column[
"width"] !=
"") {
1094 $width = (is_numeric($column[
"width"]))
1095 ? $column[
"width"] .
"px" 1097 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH_NO_LINK",
" style=\"width:" . $width .
"\"");
1099 if ($column[
"class"] !=
"") {
1100 $this->tpl->setVariable(
"TBL_COLUMN_CLASS_NO_LINK",
" class=\"" . $column[
"class"] .
"\"");
1102 if (!$column[
"is_checkbox_action_column"]) {
1103 $this->tpl->setVariable(
1104 "TBL_HEADER_CELL_NO_LINK",
1108 $this->tpl->setVariable(
1109 "TBL_HEADER_CELL_NO_LINK",
1113 $this->tpl->setVariable(
"HEAD_CELL_NL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1114 if ($column[
"class"] !=
"") {
1115 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1117 $this->tpl->parseCurrentBlock();
1118 $this->tpl->touchBlock(
"tbl_header_th");
1121 if (($column[
"sort_field"] == $this->order_field) && ($this->order_direction !=
"")) {
1122 $this->tpl->setCurrentBlock(
"tbl_order_image");
1123 if ($this->order_direction ===
"asc") {
1124 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-up");
1125 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_asc"));
1127 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-down");
1128 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_desc"));
1130 $this->tpl->setVariable(
"IMG_ORDER_ALT", $this->
lng->txt(
"change_sort_direction"));
1131 $this->tpl->parseCurrentBlock();
1134 $this->tpl->setCurrentBlock(
"tbl_header_cell");
1135 $this->tpl->setVariable(
"TBL_HEADER_CELL", $column[
"text"]);
1136 $this->tpl->setVariable(
"HEAD_CELL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1139 if ($column[
"width"] !=
"") {
1140 $width = (is_numeric($column[
"width"]))
1141 ? $column[
"width"] .
"px" 1143 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1145 if ($column[
"class"] !=
"") {
1146 $this->tpl->setVariable(
"TBL_COLUMN_CLASS",
" class=\"" . $column[
"class"] .
"\"");
1149 $lng_sort_column = $this->
lng->txt(
"sort_by_this_column");
1150 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_sort_column);
1154 if ($column[
"sort_field"] == $this->order_field) {
1157 if ($order_dir ===
"asc") {
1158 $lng_change_sort = $this->
lng->txt(
"sort_ascending_long");
1160 $lng_change_sort = $this->
lng->txt(
"sort_descending_long");
1162 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_change_sort);
1165 if ($column[
"class"] !=
"") {
1166 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1168 $this->
setOrderLink($column[
"sort_field"], $order_dir);
1169 $this->tpl->parseCurrentBlock();
1170 $this->tpl->touchBlock(
"tbl_header_th");
1173 $this->tpl->setCurrentBlock(
"tbl_header");
1174 $this->tpl->parseCurrentBlock();
1189 if (isset($DIC[
"ilUser"])) {
1190 $ilUser = $DIC[
"ilUser"];
1193 if ($this->nav_determined) {
1197 if ($this->requested_nav_par1 !=
"") {
1198 if ($this->requested_nav_par1 != ($this->requested_nav_par ??
"")) {
1201 $this->requested_nav_par2 !=
"" &&
1202 $this->requested_nav_par2 != $this->requested_nav_par
1206 } elseif ($this->requested_nav_par !=
"") {
1212 if (in_array($order, $this->sortable_fields)) {
1223 $nav = explode(
":", $this->nav_value);
1226 $req_order_field = $nav[0] ??
"";
1227 $req_order_dir = $nav[1] ??
"";
1228 $req_offset = (
int) ($nav[2] ?? 0);
1232 if (!$a_omit_offset) {
1243 if (!$a_omit_offset) {
1244 $this->nav_determined =
true;
1270 if (isset($DIC[
"ilUser"])) {
1271 $ilUser = $DIC[
"ilUser"];
1293 if ($this->form_multipart) {
1294 $this->tpl->touchBlock(
"form_multipart_bl");
1298 $this->tpl->touchBlock(
"pdfs");
1301 $this->tpl->setCurrentBlock(
"tbl_form_header");
1302 $this->tpl->setVariable(
"FORMACTION", $this->
getFormAction() . $hash);
1303 $this->tpl->setVariable(
"FORMNAME", $this->
getFormName());
1304 $this->tpl->parseCurrentBlock();
1308 $this->tpl->touchBlock(
"tbl_form_footer");
1312 if (!$this->enabled[
'content']) {
1322 $this->
setFooter(
"tblfooter", $this->
lng->txt(
"previous"), $this->
lng->txt(
"next"));
1348 $this->tpl->addBlockFile(
1351 $this->row_template,
1352 $this->row_template_dir
1355 foreach ($data as $set) {
1356 $this->tpl->setCurrentBlock(
"tbl_content");
1357 $this->css_row = ($this->css_row !==
"tblrow1")
1360 $this->tpl->setVariable(
"CSS_ROW", $this->css_row);
1363 $this->tpl->setCurrentBlock(
"tbl_content");
1364 $this->tpl->parseCurrentBlock();
1372 $this->css_row = ($this->css_row !==
"tblrow1")
1376 $this->tpl->setCurrentBlock(
"tbl_no_entries");
1377 $this->tpl->setVariable(
'TBL_NO_ENTRY_CSS_ROW', $this->css_row);
1378 $this->tpl->setVariable(
'TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
1379 $this->tpl->setVariable(
'TBL_NO_ENTRY_TEXT', trim($no_items_text));
1380 $this->tpl->parseCurrentBlock();
1409 $this->tpl->setVariable(
"CSS_TABLE", $this->
getStyle(
"table"));
1410 if ($this->
getId() !=
"") {
1411 $this->tpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
1416 $this->tpl->setCurrentBlock(
"tbl_header_description");
1417 $this->tpl->setVariable(
"TBL_DESCRIPTION", $this->
getDescription());
1418 $this->tpl->parseCurrentBlock();
1426 $this->tpl->touchBlock(
"outer_start_1");
1427 $this->tpl->touchBlock(
"outer_end_1");
1429 $this->tpl->touchBlock(
"outer_start_2");
1430 $this->tpl->touchBlock(
"outer_end_2");
1434 if ($this->enabled[
"title"] && ($this->title !=
"" 1435 || $this->icon !=
"" || count($this->header_commands) > 0 ||
1436 $this->headerHTML !=
"" || $this->close_command !=
"")) {
1437 if ($this->enabled[
"icon"]) {
1438 $this->tpl->setCurrentBlock(
"tbl_header_title_icon");
1440 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT", $this->icon_alt);
1441 $this->tpl->parseCurrentBlock();
1445 foreach ($this->header_commands as $command) {
1446 if ($command[
"img"] !=
"") {
1447 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1448 if ($command[
"target"] !=
"") {
1449 $this->tpl->setVariable(
1451 'target="' . $command[
"target"] .
'"' 1454 $this->tpl->setVariable(
"ALT_IMG_LINK", $command[
"text"]);
1455 $this->tpl->setVariable(
"HREF_IMG_LINK", $command[
"href"]);
1456 $this->tpl->setVariable(
1461 $this->tpl->setCurrentBlock(
"head_cmd");
1462 $this->tpl->setVariable(
"TXT_HEAD_CMD", $command[
"text"]);
1463 $this->tpl->setVariable(
"HREF_HEAD_CMD", $command[
"href"]);
1465 $this->tpl->parseCurrentBlock();
1469 if (isset($this->headerHTML)) {
1470 $this->tpl->setCurrentBlock(
"tbl_header_html");
1471 $this->tpl->setVariable(
"HEADER_HTML", $this->headerHTML);
1472 $this->tpl->parseCurrentBlock();
1476 if ($this->close_command !=
"") {
1477 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1478 $this->tpl->setVariable(
"ALT_IMG_LINK",
$lng->
txt(
"close"));
1479 $this->tpl->setVariable(
"HREF_IMG_LINK", $this->close_command);
1480 $this->tpl->parseCurrentBlock();
1483 $this->tpl->setCurrentBlock(
"tbl_header_title");
1484 $this->tpl->setVariable(
"TBL_TITLE", $this->title);
1486 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1488 $this->tpl->parseCurrentBlock();
1492 if ($this->enabled[
"header"]) {
1496 $this->tpl->touchBlock(
"tbl_table_end");
1498 return $this->tpl->get();
1509 $main_tpl = $DIC[
"tpl"];
1514 $main_tpl->addJavascript(
"assets/js/ServiceTable.js");
1516 if (count($filter) == 0 && count($opt_filter) == 0) {
1525 if (count($filter) > 0) {
1526 foreach ($filter as $item) {
1528 $this->tpl->setCurrentBlock(
"filter_row");
1529 $this->tpl->parseCurrentBlock();
1532 $this->tpl->setCurrentBlock(
"filter_item");
1533 $this->tpl->setVariable(
1537 $this->tpl->setVariable(
1539 $item->getTableFilterLabelFor()
1541 $this->tpl->setVariable(
1543 $item->getTableFilterHTML()
1545 $this->tpl->parseCurrentBlock();
1551 if (count($opt_filter) > 0) {
1554 foreach ($opt_filter as $item) {
1557 $this->tpl->setCurrentBlock(
"filter_row");
1558 $this->tpl->parseCurrentBlock();
1561 $this->tpl->setCurrentBlock(
"filter_item");
1562 $this->tpl->setVariable(
1566 $this->tpl->setVariable(
1570 $this->tpl->setVariable(
1572 $item->getTableFilterHTML()
1574 $this->tpl->parseCurrentBlock();
1581 foreach ($opt_filter as $item) {
1582 $k = $item->getPostVar();
1583 $items[$k] = array(
"txt" => $item->getTitle(),
1588 $cb_over->setLinkTitle(
$lng->
txt(
"optional_filters"));
1589 $cb_over->setItems($items);
1592 $cb_over->setFieldVar(
"tblff" . $this->
getId());
1593 $cb_over->setHiddenVar(
"tblfsf" . $this->
getId());
1595 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1596 $this->tpl->setCurrentBlock(
"filter_select");
1599 $this->tpl->setVariable(
"HIDDEN_CMD_APPLY", $this->filter_cmd);
1601 $this->tpl->setVariable(
"FILTER_SELECTOR", $cb_over->getHTML(
false));
1602 $this->tpl->parseCurrentBlock();
1606 if ($ccnt > 0 || count($opt_filter) > 0) {
1607 $this->tpl->setVariable(
"TXT_FILTER",
$lng->
txt(
"filter"));
1612 $this->tpl->touchBlock(
"filter_empty_cell");
1615 $this->tpl->setCurrentBlock(
"filter_row");
1616 $this->tpl->parseCurrentBlock();
1618 $this->tpl->setCurrentBlock(
"filter_buttons");
1619 $this->tpl->setVariable(
"CMD_APPLY", $this->filter_cmd);
1620 $this->tpl->setVariable(
"TXT_APPLY", $this->filter_cmd_txt
1621 ?:
$lng->
txt(
"apply_filter"));
1622 $this->tpl->setVariable(
"CMD_RESET", $this->reset_cmd);
1623 $this->tpl->setVariable(
"TXT_RESET", $this->reset_cmd_txt
1624 ?:
$lng->
txt(
"reset_filter"));
1625 } elseif (count($opt_filter) > 0) {
1626 $this->tpl->setCurrentBlock(
"optional_filter_hint");
1627 $this->tpl->setVariable(
'TXT_OPT_HINT',
$lng->
txt(
'optional_filter_hint'));
1628 $this->tpl->parseCurrentBlock();
1631 $this->tpl->setCurrentBlock(
"filter_section");
1632 $this->tpl->setVariable(
"FIL_ID", $this->
getId());
1633 $this->tpl->parseCurrentBlock();
1637 $id = $this->
getId();
1638 $this->main_tpl->addOnLoadCode(
" 1639 ilTableHideFilter['atfil_$id'] = true; 1640 ilTableHideFilter['tfil_$id'] = true; 1641 ilTableHideFilter['dtfil_$id'] = true; 1648 $this->main_tpl->addOnLoadCode(
"ilInitTableFilters()");
1658 if ($prop ===
'0' || $prop ===
'1') {
1659 return (
bool) $prop;
1672 if ($item === $a_element) {
1681 $advmd_record_gui = null;
1682 if (method_exists($this,
"getAdvMDRecordGUI")) {
1683 $advmd_record_gui = $this->getAdvMDRecordGUI();
1687 if ($advmd_record_gui &&
1692 if ($item->checkInput()) {
1693 $item->setValueByArray($this->raw_post_data);
1694 $item->writeToSession();
1698 if ($advmd_record_gui &&
1703 if ($item->checkInput()) {
1704 $item->setValueByArray($this->raw_post_data);
1705 $item->writeToSession();
1709 if ($advmd_record_gui) {
1710 $advmd_record_gui->importFilter();
1714 $this->requested_tmpl_create =
"";
1715 $this->requested_tmpl_delete =
"";
1723 foreach ($filter as $item) {
1724 if ($item->checkInput()) {
1726 $item->setValueByArray([]);
1727 $item->clearFromSession();
1730 foreach ($opt_filter as $item) {
1731 if ($item->checkInput()) {
1733 $item->setValueByArray([]);
1734 $item->clearFromSession();
1739 $this->requested_tmpl_create =
"";
1740 $this->requested_tmpl_delete =
"";
1750 foreach ($a_set as $key => $value) {
1751 $this->tpl->setVariable(
"VAL_" . strtoupper($key), $value);
1760 if (isset($DIC[
"ilUser"])) {
1761 $ilUser = $DIC[
"ilUser"];
1764 $ui_factory = $this->
ui->factory();
1765 $ui_renderer = $this->
ui->renderer();
1773 $column_selector =
'';
1777 $this->tpl->setCurrentBlock(
"select_all_checkbox");
1778 $this->tpl->setVariable(
"SELECT_ALL_TXT_SELECT_ALL",
$lng->
txt(
"select_all"));
1780 $this->tpl->setVariable(
"SELECT_ALL_FORM_NAME", $this->
getFormName());
1781 $this->tpl->setVariable(
"CHECKBOXNAME",
"chb_select_all_" . $this->unique_id);
1782 $this->tpl->parseCurrentBlock();
1786 if ($this->enabled[
"numinfo"] && $this->enabled[
"footer"]) {
1787 $start = $this->offset + 1;
1793 if ($end > $this->max_count or $this->limit == 0) {
1797 if ($this->max_count > 0) {
1798 if ($this->lang_support) {
1799 $numinfo =
"(" . $start .
" - " . $end .
" " . strtolower($this->
lng->txt(
"of")) .
" " . $this->max_count .
")";
1801 $numinfo =
"(" . $start .
" - " . $end .
" of " . $this->max_count .
")";
1804 if ($this->max_count > 0) {
1806 $this->tpl->setCurrentBlock(
"tbl_footer_numinfo");
1807 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1808 $this->tpl->parseCurrentBlock();
1815 if ($this->enabled[
"linkbar"] && $this->enabled[
"footer"] && $this->limit != 0
1816 && $this->max_count > 0) {
1818 $this->tpl->setCurrentBlock(
"tbl_footer_linkbar");
1819 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1820 $this->tpl->parseCurrentBlock();
1829 $items[$k] = array(
"txt" =>
$c[
"txt"],
1833 $cb_over->setLinkTitle(
$lng->
txt(
"columns"));
1834 $cb_over->setItems($items);
1838 $cb_over->setFieldVar(
"tblfs" . $this->
getId());
1839 $cb_over->setHiddenVar(
"tblfsh" . $this->
getId());
1840 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1841 $column_selector = $cb_over->getHTML();
1846 if ($this->requested_tmpl_create !=
"") {
1847 if ($this->
saveTemplate($this->requested_tmpl_create)) {
1848 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"tbl_template_created"));
1850 } elseif ($this->requested_tmpl_delete !=
"") {
1852 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"tbl_template_deleted"));
1856 $create_id =
"template_create_overlay_" . $this->
getId();
1857 $delete_id =
"template_delete_overlay_" . $this->
getId();
1858 $list_id =
"template_stg_" . $this->
getId();
1861 $templates = $storage->getNames($this->
getContext(), $ilUser->getId());
1864 if (count($templates) > 0) {
1866 $this->tpl->setCurrentBlock(
"template_editor_delete_item");
1867 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE",
"");
1868 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION",
"- " .
$lng->
txt(
"form_please_select") .
" -");
1869 $this->tpl->parseCurrentBlock();
1870 foreach ($templates as $name) {
1871 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE", $name);
1872 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION", $name);
1873 $this->tpl->parseCurrentBlock();
1876 $this->tpl->setCurrentBlock(
"template_editor_delete");
1877 $this->tpl->setVariable(
"TEMPLATE_DELETE_ID", $delete_id);
1878 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE",
$lng->
txt(
"tbl_template_delete"));
1879 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE_SUBMIT",
$lng->
txt(
"delete"));
1880 $this->tpl->setVariable(
"TEMPLATE_DELETE_CMD", $this->parent_cmd);
1881 $this->tpl->parseCurrentBlock();
1884 $this->tpl->setCurrentBlock(
"template_editor");
1885 $this->tpl->setVariable(
"TEMPLATE_CREATE_ID", $create_id);
1886 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE",
$lng->
txt(
"tbl_template_create"));
1887 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE_SUBMIT",
$lng->
txt(
"save"));
1888 $this->tpl->setVariable(
"TEMPLATE_CREATE_CMD", $this->parent_cmd);
1889 $this->tpl->parseCurrentBlock();
1893 $actions[] = $ui_factory->button()->shy(
1894 $lng->
txt(
"tbl_template_create"),
1897 return "document.getElementById('$id').id = '" . $list_id .
"_create';";
1899 if (count($templates) > 0) {
1900 $actions[] = $ui_factory->button()->shy(
1901 $lng->
txt(
"tbl_template_delete"),
1904 return "document.getElementById('$id').id = '" . $list_id .
"_delete';";
1906 foreach ($templates as $name) {
1907 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl", urlencode($name));
1908 $actions[] = $ui_factory->link()->standard(
1910 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
1912 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl",
"");
1915 $dd = $ui_factory->dropdown()->standard(
1917 )->withLabel(
$lng->
txt(
"tbl_templates"));
1918 $this->tpl->setVariable(
"TEMPLATE_SELECTOR",
" " . $ui_renderer->render($dd));
1922 $overlay->setTrigger($list_id .
"_create");
1923 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
1924 $overlay->setAutoHide(
false);
1927 if (count($templates) > 0) {
1929 $overlay->setTrigger($list_id .
"_delete");
1930 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
1931 $overlay->setAutoHide(
false);
1937 $this->tpl->setCurrentBlock(
"tbl_footer");
1938 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
1940 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1942 $this->tpl->parseCurrentBlock();
1945 if ($numinfo !=
"" || $linkbar !=
"" || $column_selector !=
"" ||
1946 count($this->filters) > 0 || count($this->optional_filters) > 0) {
1947 if (is_object($ilUser) && (count($this->filters) || count($this->optional_filters))) {
1948 $this->tpl->setCurrentBlock(
"filter_activation");
1949 $this->tpl->setVariable(
"TXT_ACTIVATE_FILTER",
$lng->
txt(
"show_filter"));
1950 $this->tpl->setVariable(
"FILA_ID", $this->
getId());
1951 if ($this->
getId() !=
"") {
1952 $this->tpl->setVariable(
"SAVE_URLA",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1953 $this->
getId() .
"&cmd=showFilter&user_id=" . $ilUser->getId());
1955 $this->tpl->parseCurrentBlock();
1959 $this->tpl->setCurrentBlock(
"filter_deactivation");
1960 $this->tpl->setVariable(
"TXT_HIDE",
$lng->
txt(
"hide_filter"));
1961 if ($this->
getId() !=
"") {
1962 $this->tpl->setVariable(
"SAVE_URL",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1963 $this->
getId() .
"&cmd=hideFilter&user_id=" . $ilUser->getId());
1964 $this->tpl->setVariable(
"FILD_ID", $this->
getId());
1966 $this->tpl->parseCurrentBlock();
1971 $this->tpl->setCurrentBlock(
"top_numinfo");
1972 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1973 $this->tpl->parseCurrentBlock();
1977 $this->tpl->setCurrentBlock(
"top_linkbar");
1978 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1979 $this->tpl->parseCurrentBlock();
1983 $this->tpl->setVariable(
"COLUMN_SELECTOR", $column_selector);
1987 is_object($ilUser) &&
1989 !$this->rows_selector_off) {
1992 $options = array(5 => 5, 10 => 10, 15 => 15, 20 => 20,
1993 30 => 30, 40 => 40, 50 => 50,
1994 100 => 100, 200 => 200, 400 => 400, 800 => 800);
1995 foreach ($options as $k => $v) {
1996 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows", $k);
1997 $actions[] = $ui_factory->link()->standard(
1999 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
2001 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows",
"");
2003 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
2006 $this->tpl->setVariable(
"ROW_SELECTOR", $ui_renderer->render($dd));
2010 if (count($this->export_formats) > 0 && $this->
dataExists()) {
2012 foreach ($this->export_formats as $format => $caption_lng_id) {
2013 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt", $format);
2014 $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
2015 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
"");
2016 $actions[] = $ui_factory->link()->standard(
2021 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
$lng->
txt(
"export"));
2022 $this->tpl->setVariable(
"EXPORT_SELECTOR",
" " . $ui_renderer->render($dd));
2025 $this->tpl->setCurrentBlock(
"top_navigation");
2026 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2028 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2030 $this->tpl->parseCurrentBlock();
2039 $ilUser = $DIC->user();
2046 $link = $ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd) .
2051 $layout_prev =
$lng->
txt(
"previous");
2052 $layout_next =
$lng->
txt(
"next");
2055 if ($this->max_count > $this->
getLimit() || $this->custom_prev_next) {
2056 $sep =
"<span> | </span>";
2059 $pages = intval($this->max_count / $this->
getLimit());
2062 if (($this->max_count % $this->
getLimit())) {
2067 $offset_arr = array();
2068 for ($i = 1 ;$i <= $pages ; $i++) {
2069 $newoffset = $this->
getLimit() * ($i - 1);
2075 $sep =
"<span> </span>";
2078 if ($this->custom_prev_next && $this->custom_prev !=
"") {
2079 $LinkBar .=
"<a href=\"" . $this->custom_prev . $hash .
"\">" . $layout_prev .
"</a>";
2080 } elseif ($this->
getOffset() >= 1 && !$this->custom_prev_next) {
2082 $LinkBar .=
"<a href=\"" . $link . $prevoffset . $hash .
"\">" . $layout_prev .
"</a>";
2084 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_prev .
"</span>";
2088 if ($a_num ==
"1") {
2089 $LinkBar .=
'<input type="hidden" name="' . $this->
getNavParameter() .
2093 $sep =
"<span> | </span>";
2097 if ($this->custom_prev_next && $this->custom_next !=
"") {
2098 $LinkBar .=
"<a href=\"" . $this->custom_next . $hash .
"\">" . $layout_next .
"</a>";
2099 } elseif (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1) &&
2100 !$this->custom_prev_next) {
2102 $LinkBar .=
"<a href=\"" . $link . $newoffset . $hash .
"\">" . $layout_next .
"</a>";
2104 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_next .
"</span>";
2107 $sep =
"<span> </span>";
2109 if (count($offset_arr) && !$this->
getDisplayAsBlock() && !$this->custom_prev_next) {
2113 '<label for="tab_page_sel_' . $a_num .
'">' .
$lng->
txt(
"page") .
'</label> ' .
2122 array(
"id" =>
"tab_page_sel_" . $a_num,
2123 "onchange" =>
"ilTablePageSelection(this, 'cmd[" . $this->parent_cmd .
"]')")
2135 $hidden_row =
false;
2136 if (count($this->hidden_inputs)) {
2137 foreach ($this->hidden_inputs as $hidden_input) {
2138 $this->tpl->setCurrentBlock(
"tbl_hidden_field");
2139 $this->tpl->setVariable(
"FIELD_NAME", $hidden_input[
"name"]);
2140 $this->tpl->setVariable(
"FIELD_VALUE", $hidden_input[
"value"]);
2141 $this->tpl->parseCurrentBlock();
2144 $this->tpl->setCurrentBlock(
"tbl_hidden_row");
2145 $this->tpl->parseCurrentBlock();
2154 $action_row =
false;
2160 if (count($this->sel_buttons) > 0) {
2161 foreach ($this->sel_buttons as $button) {
2162 $this->tpl->setCurrentBlock(
"sel_button");
2163 $this->tpl->setVariable(
2166 $button[
"selected"],
2173 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2174 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2175 $this->tpl->parseCurrentBlock();
2178 $this->tpl->setCurrentBlock(
"sel_top_button");
2179 $this->tpl->setVariable(
2182 $button[
"selected"],
2189 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2190 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2191 $this->tpl->parseCurrentBlock();
2197 $this->sel_buttons[] = array(
"options" => [],
"cmd" =>
'',
"text" =>
'');
2200 if (count($this->buttons) > 0) {
2201 foreach ($this->buttons as $button) {
2202 if (!is_array($button)) {
2204 $this->tpl->setVariable(
'BUTTON_OBJ', $button->render());
2207 $button = clone $button;
2209 $this->tpl->setVariable(
'BUTTON_TOP_OBJ', $button->render());
2214 if (strlen($button[
'onclick'])) {
2215 $this->tpl->setCurrentBlock(
'cmdonclick');
2216 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2217 $this->tpl->parseCurrentBlock();
2219 $this->tpl->setCurrentBlock(
"plain_button");
2220 if ($button[
"id"] !=
"") {
2221 $this->tpl->setVariable(
"PBID",
' id="' . $button[
"id"] .
'" ');
2223 if ($button[
"class"] !=
"") {
2224 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2226 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2227 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2228 $this->tpl->parseCurrentBlock();
2231 if (strlen($button[
'onclick'])) {
2232 $this->tpl->setCurrentBlock(
'top_cmdonclick');
2233 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2234 $this->tpl->parseCurrentBlock();
2236 $this->tpl->setCurrentBlock(
"plain_top_button");
2237 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2238 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2239 if ($button[
"class"] !=
"") {
2240 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2242 $this->tpl->parseCurrentBlock();
2251 if (count($this->mi_sel_buttons)) {
2252 foreach ($this->mi_sel_buttons as $button) {
2253 $this->tpl->setCurrentBlock(
"mi_sel_button");
2254 $this->tpl->setVariable(
2257 $button[
"selected"],
2264 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2265 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2266 $this->tpl->parseCurrentBlock();
2269 $this->tpl->setCurrentBlock(
"mi_top_sel_button");
2270 $this->tpl->setVariable(
2273 $button[
"selected"],
2274 $button[
"sel_var"] .
"_2",
2280 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2281 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2282 $this->tpl->parseCurrentBlock();
2290 if (count($this->multi) > 1 && $this->
dataExists()) {
2291 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2292 $this->tpl->setCurrentBlock(
"tbl_cmd_select_all");
2293 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->
txt(
"all_objects"));
2294 $this->tpl->parseCurrentBlock();
2297 $this->tpl->setCurrentBlock(
"tbl_cmd_select");
2299 foreach ($this->multi as $mc) {
2300 $sel[$mc[
"cmd"]] = $mc[
"text"];
2302 $this->tpl->setVariable(
2306 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->
txt(
"execute"));
2307 $this->tpl->parseCurrentBlock();
2312 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2313 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select_all");
2314 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->
txt(
"all_objects"));
2315 $this->tpl->parseCurrentBlock();
2318 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select");
2320 foreach ($this->multi as $mc) {
2321 $sel[$mc[
"cmd"]] = $mc[
"text"];
2323 $this->tpl->setVariable(
2327 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->
txt(
"execute"));
2328 $this->tpl->parseCurrentBlock();
2330 } elseif (count($this->multi) == 1 && $this->
dataExists()) {
2331 $this->tpl->setCurrentBlock(
"tbl_single_cmd");
2332 foreach ($this->multi as $mc) {
2336 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2337 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2338 $this->tpl->parseCurrentBlock();
2343 $this->tpl->setCurrentBlock(
"tbl_top_single_cmd");
2344 foreach ($this->multi as $mc) {
2348 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2349 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2350 $this->tpl->parseCurrentBlock();
2355 $this->tpl->setCurrentBlock(
"tbl_action_img_arrow");
2357 $this->tpl->setVariable(
"ALT_ARROW",
$lng->
txt(
"action"));
2358 $this->tpl->parseCurrentBlock();
2361 $this->tpl->setCurrentBlock(
"tbl_top_action_img_arrow");
2363 $this->tpl->setVariable(
"ALT_ARROW",
$lng->
txt(
"action"));
2364 $this->tpl->parseCurrentBlock();
2369 $this->tpl->setCurrentBlock(
"tbl_action_row");
2370 $this->tpl->parseCurrentBlock();
2372 $this->tpl->setCurrentBlock(
"tbl_top_action_row");
2373 $this->tpl->parseCurrentBlock();
2380 $this->headerHTML = $html;
2388 if (isset($DIC[
"ilUser"])) {
2389 $ilUser = $DIC[
"ilUser"];
2392 if (is_object($ilUser) && $this->
getId() !=
"") {
2395 $tab_prop->storeProperty($this->
getId(), $ilUser->getId(), $type, $value);
2404 if (isset($DIC[
"ilUser"])) {
2405 $ilUser = $DIC[
"ilUser"];
2408 if (is_object($ilUser) && $this->
getId() !=
"") {
2411 return $tab_prop->getProperty($this->
getId(), $ilUser->getId(), $type);
2432 $result[
"rows"] = $this->
getLimit();
2440 if ($this->filters) {
2441 foreach ($this->filters as $item) {
2442 $result[
"filter_values"][$item->getFieldId()] = $this->
getFilterValue($item);
2445 if ($this->optional_filters && $result[
"selfilters"]) {
2446 foreach ($this->optional_filters as $item) {
2447 if (in_array($item->getFieldId(), $result[
"selfilters"])) {
2448 $result[
"filter_values"][$item->getFieldId()] = $this->
getFilterValue($item);
2462 if (method_exists($a_item,
"getChecked")) {
2463 return (
string) $a_item->getChecked();
2464 } elseif (method_exists($a_item,
"getValue")) {
2465 return $a_item->getValue() ?:
"";
2466 } elseif (method_exists($a_item,
"getDate")) {
2467 return $a_item->getDate()?->get(
IL_CAL_DATE) ??
"";
2478 if (method_exists($a_item,
"setChecked")) {
2479 $a_item->setChecked((
bool) $a_value);
2480 } elseif (method_exists($a_item,
"setValue")) {
2481 $a_item->setValue($a_value);
2482 } elseif (method_exists($a_item,
"setDate")) {
2485 $a_item->writeToSession();
2491 $this->context =
$id;
2505 $this->show_rows_selector = $a_value;
2515 $this->show_templates = $a_value;
2530 $ilUser = $DIC->user();
2537 $data = $storage->load($this->
getContext(), $ilUser->getId(), $a_name);
2538 if (is_array(
$data)) {
2539 foreach (
$data as $property => $value) {
2544 $data[
"filter_values"] = unserialize((
string)
$data[
"filter_values"]);
2545 if ($data[
"filter_values"]) {
2546 $this->restore_filter_values = $data[
"filter_values"];
2549 $this->restore_filter =
true;
2563 $ilUser = $DIC->user();
2571 $state[
"filter_values"] = serialize($state[
"filter_values"] ?? null);
2572 $state[
"selfields"] = serialize($state[
"selfields"] ?? null);
2573 $state[
"selfilters"] = serialize($state[
"selfilters"] ?? null);
2575 $storage->store($this->
getContext(), $ilUser->getId(), $a_name, $state);
2585 $ilUser = $DIC->user();
2591 $storage->delete($this->
getContext(), $ilUser->getId(), $a_name);
2602 return parent::getLimit();
2610 return parent::getOffset();
2618 $this->export_formats = array();
2621 $valid = array(self::EXPORT_EXCEL =>
"tbl_export_excel",
2622 self::EXPORT_CSV =>
"tbl_export_csv");
2624 foreach ($formats as $format) {
2625 if (array_key_exists($format,
$valid)) {
2626 $this->export_formats[$format] =
$valid[$format];
2633 $this->print_mode = $a_value;
2649 public function exportData(
int $format,
bool $send =
false): void
2666 case self::EXPORT_EXCEL:
2668 $excel->addSheet($this->title
2669 ?: $this->
lng->txt(
"export"));
2682 foreach ($this->row_data as $set) {
2695 case self::EXPORT_CSV:
2697 $csv->setSeparator(
";");
2702 foreach ($this->row_data as $set) {
2709 header(
"Content-type: text/comma-separated-values");
2710 header(
"Content-Disposition: attachment; filename=\"" .
$filename .
"\"");
2712 header(
"Cache-Control: must-revalidate, post-check=0,pre-check=0");
2713 header(
"Pragma: public");
2714 echo $csv->getCSVString();
2716 file_put_contents(
$filename, $csv->getCSVString());
2746 foreach ($this->column as $column) {
2747 $title = strip_tags($column[
"text"]);
2765 foreach ($a_set as $value) {
2766 if (is_array($value)) {
2767 $value = implode(
', ', $value);
2769 $a_excel->
setCell($a_row, $col++, $value);
2789 foreach ($this->column as $column) {
2790 $title = strip_tags($column[
"text"]);
2806 foreach ($a_set as $key => $value) {
2807 if (is_array($value)) {
2808 $value = implode(
', ', $value);
2817 $this->enable_command_for_all = $a_value;
2824 $ilClientIniFile = $DIC[
"ilClientIniFile"];
2826 $limit = $ilClientIniFile->readVariable(
"system",
"TABLE_ACTION_ALL_LIMIT");
2828 $limit = self::ACTION_ALL_LIMIT;
2846 $this->prevent_double_submission = $a_val;
2854 public function setLimit(
int $a_limit = 0,
int $a_default_limit = 0): void
2856 parent::setLimit($a_limit, $a_default_limit);
2859 if ($a_limit == 9999 &&
2860 $this->limit_determined) {
2861 $this->rows_selector_off =
true;
saveTemplate(string $a_name)
Save current state as template.
setNoEntriesText(string $a_text)
setOffset(int $a_offset)
set dataset offset
array $restore_filter_values
numericOrdering(string $a_field)
Should this field be sorted numeric?
static array static setUseRelativeDates(bool $a_status)
set use relative dates
prepareOutput()
Anything that must be done before HTML is generated.
string $row_selector_label
setTopCommands(bool $a_val)
bool $enable_command_for_all
fillMetaCSV(ilCSVWriter $a_csv)
Add meta information to csv export.
setExportFormats(array $formats)
Set available export formats.
addCommandButtonInstance(ilButtonBase $a_button)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getStyle(string $a_element)
bool $disable_filter_hiding
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...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setOrderLink(string $key, string $order_dir)
string $defaultorderdirection
string $requested_nav_par2
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
CSV Version of Fill Row.
getSelectableColumns()
Get selectable columns.
setEnableTitle(bool $a_enabletitle)
renderFilter()
Render Filter section.
ILIAS Table TableGUIRequest $table_request
loadProperty(string $type)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setResetCommand(string $a_val, string $a_caption="")
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
getColumnCoord(int $a_col)
Get column "name" from number.
determineSelectedColumns()
setCloseFormTag(bool $a_val)
setShowTemplates(bool $a_value)
setDescription(string $a_val)
string $requested_tmpl_create
setDisableFilterHiding(bool $a_val=true)
string $requested_nav_par1
setPrintMode(bool $a_value=false)
isAdvMDFilter(ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
Check if filter element is based on adv md.
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...
setFormName(string $a_name="")
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
const FILTER_NUMBER_RANGE
array $selectable_columns
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFilterValue(ilTableFilterItem $a_item)
Get current filter value.
getFilterItemByPostVar(string $a_post_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withOnLoadCode(Closure $binder)
exportData(int $format, bool $send=false)
Export and optionally send current table data.
ilGlobalTemplateInterface $main_tpl
setIsDataTable(bool $a_val)
addMultiItemSelectionButton(string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
isFilterSelected(string $a_col)
Is given filter selected?
resetOffset(bool $a_in_determination=false)
getDefaultOrderDirection()
setExternalSorting(bool $a_val)
bool $default_filter_visibility
isColumnSelected(string $col)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setBold(string $a_coords)
Set cell(s) to bold.
getNextClass($a_gui_class=null)
fillRow(array $a_set)
Standard Version of Fill Row.
const FILTER_DATETIME_RANGE
addHiddenInput(string $a_name, string $a_value)
isFilterVisible()
Check if filter is visible: manually shown (session, db) or default value set.
setOrderDirection(string $a_order_direction)
setDefaultOrderField(string $a_defaultorderfield)
const FILTER_DURATION_RANGE
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
getExternalSegmentation()
static getAllCommandLimit()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillMetaExcel(ilExcel $a_excel, int &$a_row)
Add meta information to excel export.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setDefaultOrderDirection(string $a_defaultorderdirection)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
Excel Version of Fill Row.
setEnableAllCommand(bool $a_value)
setTopAnchor(string $a_val)
restoreTemplate(string $a_name)
Restore state from template.
getPreventDoubleSubmission()
addHeaderCommand(string $a_href, string $a_text, string $a_target="", string $a_img="")
getInstalledLanguages()
Get installed languages.
deleteTemplate(string $a_name)
setCloseCommand(string $a_link)
fillHeaderCSV(ilCSVWriter $a_csv)
CSV Version of Fill Header.
setOrderField(string $a_order_field)
getLinkbar(string $a_num)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setFilterValue(ilTableFilterItem $a_item, $a_value)
string $requested_tmpl_delete
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
Excel Version of Fill Header.
determineSelectedFilters()
setRowSelectorLabel(string $row_selector_label)
setEnableNumInfo(bool $a_val)
setPreventDoubleSubmission(bool $a_val)
setFooter(string $a_style, string $a_previous="", string $a_next="")
__construct(Container $dic, ilPlugin $plugin)
setLimit(int $a_limit=0, int $a_default_limit=0)
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)
getCurrentState()
get current settings for order, limit, columns and filter
getFilterElements(bool $a_only_non_empty=true)
Get SQL conditions for current filter value(s)
string $requested_nav_par
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
setDisplayAsBlock(bool $a_val)
setHeaderHTML(string $html)
string $defaultorderfield
getFilterItems(bool $a_optionals=false)
setOpenFormTag(bool $a_val)
getDefaultFilterVisibility()
setDefaultFilterVisiblity(bool $a_status)
addMultiCommand(string $a_cmd, string $a_text)
setCustomPreviousNext(string $a_prev_link, string $a_next_link)
static initConnection(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
determineOffsetAndOrder(bool $a_omit_offset=false)
getSelectAllCheckbox()
get the name of the checkbox that should be toggled with a select all button
storeProperty(string $type, string $value)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
bool $prevent_double_submission
setFilterCols(int $a_val)
setExternalSegmentation(bool $a_val)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
setPrefix(string $a_prefix)