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,
"Services/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;
242 if (is_object($ilUser)) {
243 $limit = (
int) $ilUser->getPref(
"hits_per_page");
251 $this->limit_determined =
true;
265 if ($this->columns_determined) {
272 if ($old_sel !=
"") {
273 $sel_fields = unserialize((
string) $old_sel);
276 if (!is_array($sel_fields)) {
278 $sel_fields = array();
281 $this->selected_columns = array();
286 if (isset($this->table_request)) {
287 $fs = $this->table_request->getFS($this->
getId());
288 $fsh = $this->table_request->getFSH($this->
getId());
292 $this->selected_column[$k] =
false;
294 $new_column = (!isset($sel_fields[$k]));
298 if (in_array($k, $fs)) {
299 $this->selected_column[$k] =
true;
301 } elseif ($stored && !$new_column) {
302 $this->selected_column[$k] = $sel_fields[$k];
307 if (isset(
$c[
"default"]) &&
$c[
"default"]) {
308 $this->selected_column[$k] =
true;
314 if (isset($this->table_request)) {
315 $ff = $this->table_request->getFF($this->
getId());
317 if (count($ff) > 0) {
319 if (in_array($k, $ff)) {
320 $this->selected_column[$k] =
true;
325 if ($old_sel != serialize($this->selected_column) && $set) {
326 $this->
storeProperty(
"selfields", serialize($this->selected_column));
329 $this->columns_determined =
true;
334 return $this->selected_column[$col] ??
false;
340 foreach ($this->selected_column as $k => $v) {
348 public function executeCommand():
bool 354 switch ($next_class) {
355 case 'ilformpropertydispatchgui':
360 $this->table_request->getPostVar()
362 $form_prop_dispatch->setItem($item);
363 return (
bool) $ilCtrl->forwardCommand($form_prop_dispatch);
368 public function resetOffset(
bool $a_in_determination =
false): void
370 if (!$this->nav_determined && !$a_in_determination) {
394 $this->top_anchor = $a_val;
404 $this->noentriestext = $a_text;
414 $this->datatable = $a_val;
424 $this->enabled[
"title"] = $a_enabletitle;
429 return $this->enabled[
"title"];
434 $this->enabled[
"header"] = $a_enableheader;
439 return $this->enabled[
"header"];
444 $this->num_info = $a_val;
455 string $a_icon_alt =
"" 457 parent::setTitle($a_title, $a_icon, $a_icon_alt);
462 $this->description = $a_val;
472 $this->order_field = $a_order_field;
480 final public function setData(array $a_data): void
482 $this->row_data = $a_data;
492 return count($this->row_data) > 0;
497 $this->prefix = $a_prefix;
508 bool $a_optional =
false 510 $a_input_item->setParentTable($this);
512 $this->filters[] = $a_input_item;
514 $this->optional_filters[] = $a_input_item;
518 if ($this->restore_filter) {
519 if (array_key_exists($a_input_item->getFieldId(), $this->restore_filter_values ?? [])) {
520 $this->
setFilterValue($a_input_item, $this->restore_filter_values[$a_input_item->getFieldId()]);
533 int $type = self::FILTER_TEXT,
534 bool $a_optional =
false,
539 $lng = $DIC->language();
546 case self::FILTER_CHECKBOX:
550 case self::FILTER_SELECT:
554 case self::FILTER_DATE:
558 case self::FILTER_TEXT:
560 $item->setMaxLength(64);
565 case self::FILTER_LANGUAGE:
568 $options = array(
"" =>
$lng->
txt(
"trac_all"));
570 $options[$lang_key] =
$lng->
txt(
"meta_l_" . $lang_key);
572 $item->setOptions($options);
575 case self::FILTER_NUMBER_RANGE:
578 $combi_item->setSize(5);
579 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
581 $combi_item->setSize(5);
582 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
588 case self::FILTER_DATE_RANGE:
591 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
593 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
597 case self::FILTER_DATETIME_RANGE:
600 $combi_item->setShowTime(
true);
601 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
603 $combi_item->setShowTime(
true);
604 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
608 case self::FILTER_DURATION_RANGE:
612 $combi_item->setShowMonths(
false);
613 $combi_item->setShowDays(
true);
614 $combi_item->setShowSeconds(
true);
615 $item->addCombinationItem(
"from", $combi_item,
$lng->
txt(
"from"));
617 $combi_item->setShowMonths(
false);
618 $combi_item->setShowDays(
true);
619 $combi_item->setShowSeconds(
true);
620 $item->addCombinationItem(
"to", $combi_item,
$lng->
txt(
"to"));
629 $item->readFromSession();
644 if ($item->getPostVar() == $a_post_var) {
649 if ($item->getPostVar() == $a_post_var) {
658 $this->filter_cols = $a_val;
668 $this->disable_filter_hiding = $a_val;
681 return (
bool) $this->selected_filter[$a_col];
687 foreach ($this->selected_filter as $k => $v) {
697 if ($this->filters_determined) {
704 if ($old_sel !=
"") {
706 unserialize((
string) $old_sel);
709 if (!is_array($sel_filters)) {
711 $sel_filters = array();
714 $this->selected_filter = array();
717 $k = $item->getPostVar();
719 $this->selected_filter[$k] =
false;
721 if ($this->table_request->getFSF($this->getId())) {
723 if (in_array($k, $this->table_request->getFF($this->getId()))) {
724 $this->selected_filter[$k] =
true;
726 $item->setValue(null);
727 $item->writeToSession();
730 $this->selected_filter[$k] = $sel_filters[$k] ??
"";
734 if ($old_sel != serialize($this->selected_filter) && $set) {
735 $this->
storeProperty(
"selfilters", serialize($this->selected_filter));
738 $this->filters_determined =
true;
745 $this->custom_prev_next =
true;
746 $this->custom_prev = $a_prev_link;
747 $this->custom_next = $a_next_link;
751 string $a_form_action,
752 bool $a_multipart =
false 754 $this->form_action = $a_form_action;
755 $this->form_multipart = $a_multipart;
765 $this->formname = $a_name;
773 public function setId(
string $a_val): void
779 if (strlen($this->
id) > 30) {
780 throw new ilException(
"Table ID to long (max. 30 char): " . $this->
id);
791 $this->display_as_block = $a_val;
800 string $a_select_all_checkbox,
801 bool $a_select_all_on_top =
false 803 $this->select_all_checkbox = $a_select_all_checkbox;
804 $this->select_all_on_top = $a_select_all_on_top;
809 $this->ext_sort = $a_val;
819 string $a_caption =
"" 821 $this->filter_cmd = $a_val;
822 $this->filter_cmd_txt = $a_caption;
832 string $a_caption =
"" 834 $this->reset_cmd = $a_val;
835 $this->reset_cmd_txt = $a_caption;
845 $this->ext_seg = $a_val;
858 final public function setRowTemplate(
string $a_template,
string $a_template_dir =
""): void
860 $this->row_template = $a_template;
861 $this->row_template_dir = $a_template_dir;
866 $this->defaultorderfield = $a_defaultorderfield;
877 $this->defaultorderdirection = $a_defaultorderdirection;
887 $this->default_filter_visibility = $a_status;
897 $this->buttons = array();
903 string $a_onclick =
'',
907 $this->buttons[] = array(
"cmd" => $a_cmd,
"text" => $a_text,
'onclick' => $a_onclick,
908 "id" => $a_id,
"class" => $a_class);
913 $this->buttons[] = $a_button;
929 string $a_default_selection =
'' 931 $this->mi_sel_buttons[] = array(
"sel_var" => $a_sel_var,
"options" => $a_options,
"selected" => $a_default_selection,
"cmd" => $a_cmd,
"text" => $a_text);
937 $this->close_command = $a_link;
942 $this->multi[] = array(
"cmd" => $a_cmd,
"text" => $a_text);
947 $this->hidden_inputs[] = array(
"name" => $a_name,
"value" => $a_value);
953 string $a_target =
"",
956 $this->header_commands[] = array(
"href" => $a_href,
"text" => $a_text,
957 "target" => $a_target,
"img" => $a_img);
962 $this->top_commands = $a_val;
972 string $a_sort_field =
"",
973 string $a_width =
"",
974 bool $a_is_checkbox_action_column =
false,
975 string $a_class =
"",
976 string $a_tooltip =
"",
977 bool $a_tooltip_with_html =
false 979 $this->column[] = array(
981 "sort_field" => $a_sort_field,
983 "is_checkbox_action_column" => $a_is_checkbox_action_column,
985 "tooltip" => $a_tooltip,
986 "tooltip_html" => $a_tooltip_with_html
988 if ($a_sort_field !=
"") {
989 $this->sortable_fields[] = $a_sort_field;
991 $this->column_count = count($this->column);
997 return $this->prefix .
"_table_nav";
1004 $ilUser = $DIC->user();
1010 $old = $this->requested_nav_par ??
'';
1016 urlencode($key) .
":" . $order_dir .
":" . $this->offset
1018 $this->tpl->setVariable(
1020 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd) . $hash
1024 $ilCtrl->setParameter(
1035 $allcolumnswithwidth =
true;
1036 foreach ($this->column as $idx => $column) {
1037 if (!strlen($column[
"width"])) {
1038 $allcolumnswithwidth =
false;
1039 } elseif ($column[
"width"] ==
"1") {
1041 $this->column[$idx][
"width"] =
"1%";
1044 if ($allcolumnswithwidth) {
1045 foreach ($this->column as $column) {
1046 $this->tpl->setCurrentBlock(
"tbl_colgroup_column");
1047 $width = (is_numeric($column[
"width"]))
1048 ? $column[
"width"] .
"px" 1050 $this->tpl->setVariable(
"COLGROUP_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1051 $this->tpl->parseCurrentBlock();
1055 foreach ($this->column as $column) {
1058 if ($column[
"tooltip"] !=
"") {
1060 "thc_" . $this->
getId() .
"_" . $ccnt,
1065 !$column[
"tooltip_html"]
1069 if ($column[
'is_checkbox_action_column'] && $this->select_all_on_top) {
1070 $this->tpl->setCurrentBlock(
'tbl_header_top_select_all');
1071 $this->tpl->setVariable(
"HEAD_SELECT_ALL_TXT_SELECT_ALL",
$lng->
txt(
"select_all"));
1073 $this->tpl->setVariable(
"HEAD_SELECT_ALL_FORM_NAME", $this->
getFormName());
1074 $this->tpl->setVariable(
"HEAD_CHECKBOXNAME",
"chb_select_all_" . $this->unique_id .
'_top');
1075 $this->tpl->parseCurrentBlock();
1079 if ($column[
'is_checkbox_action_column'] && !$this->select_all_on_top) {
1080 $this->tpl->setCurrentBlock(
'tbl_header_top_select_column');
1081 if ($column[
"width"] !=
"") {
1082 $width = (is_numeric($column[
"width"]))
1083 ? $column[
"width"] .
"px" 1085 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1087 $this->tpl->parseCurrentBlock();
1092 !$this->enabled[
"sort"] ||
1093 (($column[
"sort_field"] ==
"") &&
1094 !($column[
"is_checkbox_action_column"] && $this->select_all_on_top))
1096 $this->tpl->setCurrentBlock(
"tbl_header_no_link");
1097 if ($column[
"width"] !=
"") {
1098 $width = (is_numeric($column[
"width"]))
1099 ? $column[
"width"] .
"px" 1101 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH_NO_LINK",
" style=\"width:" . $width .
"\"");
1103 if ($column[
"class"] !=
"") {
1104 $this->tpl->setVariable(
"TBL_COLUMN_CLASS_NO_LINK",
" class=\"" . $column[
"class"] .
"\"");
1106 if (!$column[
"is_checkbox_action_column"]) {
1107 $this->tpl->setVariable(
1108 "TBL_HEADER_CELL_NO_LINK",
1112 $this->tpl->setVariable(
1113 "TBL_HEADER_CELL_NO_LINK",
1117 $this->tpl->setVariable(
"HEAD_CELL_NL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1118 if ($column[
"class"] !=
"") {
1119 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1121 $this->tpl->parseCurrentBlock();
1122 $this->tpl->touchBlock(
"tbl_header_th");
1125 if (($column[
"sort_field"] == $this->order_field) && ($this->order_direction !=
"")) {
1126 $this->tpl->setCurrentBlock(
"tbl_order_image");
1127 if ($this->order_direction ===
"asc") {
1128 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-up");
1129 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_asc"));
1131 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-down");
1132 $this->tpl->setVariable(
"ORDER_TXT", $this->
lng->txt(
"sorting_desc"));
1134 $this->tpl->setVariable(
"IMG_ORDER_ALT", $this->
lng->txt(
"change_sort_direction"));
1135 $this->tpl->parseCurrentBlock();
1138 $this->tpl->setCurrentBlock(
"tbl_header_cell");
1139 $this->tpl->setVariable(
"TBL_HEADER_CELL", $column[
"text"]);
1140 $this->tpl->setVariable(
"HEAD_CELL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1143 if ($column[
"width"] !=
"") {
1144 $width = (is_numeric($column[
"width"]))
1145 ? $column[
"width"] .
"px" 1147 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1149 if ($column[
"class"] !=
"") {
1150 $this->tpl->setVariable(
"TBL_COLUMN_CLASS",
" class=\"" . $column[
"class"] .
"\"");
1153 $lng_sort_column = $this->
lng->txt(
"sort_by_this_column");
1154 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_sort_column);
1158 if ($column[
"sort_field"] == $this->order_field) {
1161 if ($order_dir ===
"asc") {
1162 $lng_change_sort = $this->
lng->txt(
"sort_ascending_long");
1164 $lng_change_sort = $this->
lng->txt(
"sort_descending_long");
1166 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_change_sort);
1169 if ($column[
"class"] !=
"") {
1170 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1172 $this->
setOrderLink($column[
"sort_field"], $order_dir);
1173 $this->tpl->parseCurrentBlock();
1174 $this->tpl->touchBlock(
"tbl_header_th");
1177 $this->tpl->setCurrentBlock(
"tbl_header");
1178 $this->tpl->parseCurrentBlock();
1193 if (isset($DIC[
"ilUser"])) {
1194 $ilUser = $DIC[
"ilUser"];
1197 if ($this->nav_determined) {
1201 if ($this->requested_nav_par1 !=
"") {
1202 if ($this->requested_nav_par1 != ($this->requested_nav_par ??
"")) {
1205 $this->requested_nav_par2 !=
"" &&
1206 $this->requested_nav_par2 != $this->requested_nav_par
1210 } elseif ($this->requested_nav_par !=
"") {
1216 if (in_array($order, $this->sortable_fields)) {
1227 $nav = explode(
":", $this->nav_value);
1230 $req_order_field = $nav[0] ??
"";
1231 $req_order_dir = $nav[1] ??
"";
1232 $req_offset = (
int) ($nav[2] ?? 0);
1236 if (!$a_omit_offset) {
1247 if (!$a_omit_offset) {
1248 $this->nav_determined =
true;
1274 if (isset($DIC[
"ilUser"])) {
1275 $ilUser = $DIC[
"ilUser"];
1297 if ($this->form_multipart) {
1298 $this->tpl->touchBlock(
"form_multipart_bl");
1302 $this->tpl->touchBlock(
"pdfs");
1305 $this->tpl->setCurrentBlock(
"tbl_form_header");
1306 $this->tpl->setVariable(
"FORMACTION", $this->
getFormAction() . $hash);
1307 $this->tpl->setVariable(
"FORMNAME", $this->
getFormName());
1308 $this->tpl->parseCurrentBlock();
1312 $this->tpl->touchBlock(
"tbl_form_footer");
1316 if (!$this->enabled[
'content']) {
1326 $this->
setFooter(
"tblfooter", $this->
lng->txt(
"previous"), $this->
lng->txt(
"next"));
1352 $this->tpl->addBlockFile(
1355 $this->row_template,
1356 $this->row_template_dir
1359 foreach ($data as $set) {
1360 $this->tpl->setCurrentBlock(
"tbl_content");
1361 $this->css_row = ($this->css_row !==
"tblrow1")
1364 $this->tpl->setVariable(
"CSS_ROW", $this->css_row);
1367 $this->tpl->setCurrentBlock(
"tbl_content");
1368 $this->tpl->parseCurrentBlock();
1376 $this->css_row = ($this->css_row !==
"tblrow1")
1380 $this->tpl->setCurrentBlock(
"tbl_no_entries");
1381 $this->tpl->setVariable(
'TBL_NO_ENTRY_CSS_ROW', $this->css_row);
1382 $this->tpl->setVariable(
'TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
1383 $this->tpl->setVariable(
'TBL_NO_ENTRY_TEXT', trim($no_items_text));
1384 $this->tpl->parseCurrentBlock();
1413 $this->tpl->setVariable(
"CSS_TABLE", $this->
getStyle(
"table"));
1414 if ($this->
getId() !=
"") {
1415 $this->tpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
1420 $this->tpl->setCurrentBlock(
"tbl_header_description");
1421 $this->tpl->setVariable(
"TBL_DESCRIPTION", $this->
getDescription());
1422 $this->tpl->parseCurrentBlock();
1430 $this->tpl->touchBlock(
"outer_start_1");
1431 $this->tpl->touchBlock(
"outer_end_1");
1433 $this->tpl->touchBlock(
"outer_start_2");
1434 $this->tpl->touchBlock(
"outer_end_2");
1438 if ($this->enabled[
"title"] && ($this->title !=
"" 1439 || $this->icon !=
"" || count($this->header_commands) > 0 ||
1440 $this->headerHTML !=
"" || $this->close_command !=
"")) {
1441 if ($this->enabled[
"icon"]) {
1442 $this->tpl->setCurrentBlock(
"tbl_header_title_icon");
1444 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT", $this->icon_alt);
1445 $this->tpl->parseCurrentBlock();
1449 foreach ($this->header_commands as $command) {
1450 if ($command[
"img"] !=
"") {
1451 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1452 if ($command[
"target"] !=
"") {
1453 $this->tpl->setVariable(
1455 'target="' . $command[
"target"] .
'"' 1458 $this->tpl->setVariable(
"ALT_IMG_LINK", $command[
"text"]);
1459 $this->tpl->setVariable(
"HREF_IMG_LINK", $command[
"href"]);
1460 $this->tpl->setVariable(
1465 $this->tpl->setCurrentBlock(
"head_cmd");
1466 $this->tpl->setVariable(
"TXT_HEAD_CMD", $command[
"text"]);
1467 $this->tpl->setVariable(
"HREF_HEAD_CMD", $command[
"href"]);
1469 $this->tpl->parseCurrentBlock();
1473 if (isset($this->headerHTML)) {
1474 $this->tpl->setCurrentBlock(
"tbl_header_html");
1475 $this->tpl->setVariable(
"HEADER_HTML", $this->headerHTML);
1476 $this->tpl->parseCurrentBlock();
1480 if ($this->close_command !=
"") {
1481 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1482 $this->tpl->setVariable(
"ALT_IMG_LINK",
$lng->
txt(
"close"));
1483 $this->tpl->setVariable(
"HREF_IMG_LINK", $this->close_command);
1484 $this->tpl->parseCurrentBlock();
1487 $this->tpl->setCurrentBlock(
"tbl_header_title");
1488 $this->tpl->setVariable(
"TBL_TITLE", $this->title);
1490 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1492 $this->tpl->parseCurrentBlock();
1496 if ($this->enabled[
"header"]) {
1500 $this->tpl->touchBlock(
"tbl_table_end");
1502 return $this->tpl->get();
1513 $main_tpl = $DIC[
"tpl"];
1518 $main_tpl->addJavascript(
"./Services/Table/js/ServiceTable.js");
1520 if (count($filter) == 0 && count($opt_filter) == 0) {
1529 if (count($filter) > 0) {
1530 foreach ($filter as $item) {
1532 $this->tpl->setCurrentBlock(
"filter_row");
1533 $this->tpl->parseCurrentBlock();
1536 $this->tpl->setCurrentBlock(
"filter_item");
1537 $this->tpl->setVariable(
1541 $this->tpl->setVariable(
1543 $item->getTableFilterLabelFor()
1545 $this->tpl->setVariable(
1547 $item->getTableFilterHTML()
1549 $this->tpl->parseCurrentBlock();
1555 if (count($opt_filter) > 0) {
1558 foreach ($opt_filter as $item) {
1561 $this->tpl->setCurrentBlock(
"filter_row");
1562 $this->tpl->parseCurrentBlock();
1565 $this->tpl->setCurrentBlock(
"filter_item");
1566 $this->tpl->setVariable(
1570 $this->tpl->setVariable(
1574 $this->tpl->setVariable(
1576 $item->getTableFilterHTML()
1578 $this->tpl->parseCurrentBlock();
1585 foreach ($opt_filter as $item) {
1586 $k = $item->getPostVar();
1587 $items[$k] = array(
"txt" => $item->getTitle(),
1592 $cb_over->setLinkTitle(
$lng->
txt(
"optional_filters"));
1593 $cb_over->setItems($items);
1596 $cb_over->setFieldVar(
"tblff" . $this->
getId());
1597 $cb_over->setHiddenVar(
"tblfsf" . $this->
getId());
1599 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1600 $this->tpl->setCurrentBlock(
"filter_select");
1603 $this->tpl->setVariable(
"HIDDEN_CMD_APPLY", $this->filter_cmd);
1605 $this->tpl->setVariable(
"FILTER_SELECTOR", $cb_over->getHTML(
false));
1606 $this->tpl->parseCurrentBlock();
1610 if ($ccnt > 0 || count($opt_filter) > 0) {
1611 $this->tpl->setVariable(
"TXT_FILTER",
$lng->
txt(
"filter"));
1616 $this->tpl->touchBlock(
"filter_empty_cell");
1619 $this->tpl->setCurrentBlock(
"filter_row");
1620 $this->tpl->parseCurrentBlock();
1622 $this->tpl->setCurrentBlock(
"filter_buttons");
1623 $this->tpl->setVariable(
"CMD_APPLY", $this->filter_cmd);
1624 $this->tpl->setVariable(
"TXT_APPLY", $this->filter_cmd_txt
1625 ?:
$lng->
txt(
"apply_filter"));
1626 $this->tpl->setVariable(
"CMD_RESET", $this->reset_cmd);
1627 $this->tpl->setVariable(
"TXT_RESET", $this->reset_cmd_txt
1628 ?:
$lng->
txt(
"reset_filter"));
1629 } elseif (count($opt_filter) > 0) {
1630 $this->tpl->setCurrentBlock(
"optional_filter_hint");
1631 $this->tpl->setVariable(
'TXT_OPT_HINT',
$lng->
txt(
'optional_filter_hint'));
1632 $this->tpl->parseCurrentBlock();
1635 $this->tpl->setCurrentBlock(
"filter_section");
1636 $this->tpl->setVariable(
"FIL_ID", $this->
getId());
1637 $this->tpl->parseCurrentBlock();
1641 $id = $this->
getId();
1642 $this->main_tpl->addOnLoadCode(
" 1643 ilTableHideFilter['atfil_$id'] = true; 1644 ilTableHideFilter['tfil_$id'] = true; 1645 ilTableHideFilter['dtfil_$id'] = true; 1652 $this->main_tpl->addOnLoadCode(
"ilInitTableFilters()");
1662 if ($prop ===
'0' || $prop ===
'1') {
1663 return (
bool) $prop;
1676 if ($item === $a_element) {
1685 $advmd_record_gui = null;
1686 if (method_exists($this,
"getAdvMDRecordGUI")) {
1687 $advmd_record_gui = $this->getAdvMDRecordGUI();
1691 if ($advmd_record_gui &&
1696 if ($item->checkInput()) {
1697 $item->setValueByArray($this->raw_post_data);
1698 $item->writeToSession();
1702 if ($advmd_record_gui &&
1707 if ($item->checkInput()) {
1708 $item->setValueByArray($this->raw_post_data);
1709 $item->writeToSession();
1713 if ($advmd_record_gui) {
1714 $advmd_record_gui->importFilter();
1718 $this->requested_tmpl_create =
"";
1719 $this->requested_tmpl_delete =
"";
1727 foreach ($filter as $item) {
1728 if ($item->checkInput()) {
1730 $item->setValueByArray([]);
1731 $item->clearFromSession();
1734 foreach ($opt_filter as $item) {
1735 if ($item->checkInput()) {
1737 $item->setValueByArray([]);
1738 $item->clearFromSession();
1743 $this->requested_tmpl_create =
"";
1744 $this->requested_tmpl_delete =
"";
1754 foreach ($a_set as
$key => $value) {
1755 $this->tpl->setVariable(
"VAL_" . strtoupper(
$key), $value);
1764 if (isset($DIC[
"ilUser"])) {
1765 $ilUser = $DIC[
"ilUser"];
1768 $ui_factory = $this->
ui->factory();
1769 $ui_renderer = $this->
ui->renderer();
1777 $column_selector =
'';
1781 $this->tpl->setCurrentBlock(
"select_all_checkbox");
1782 $this->tpl->setVariable(
"SELECT_ALL_TXT_SELECT_ALL",
$lng->
txt(
"select_all"));
1784 $this->tpl->setVariable(
"SELECT_ALL_FORM_NAME", $this->
getFormName());
1785 $this->tpl->setVariable(
"CHECKBOXNAME",
"chb_select_all_" . $this->unique_id);
1786 $this->tpl->parseCurrentBlock();
1790 if ($this->enabled[
"numinfo"] && $this->enabled[
"footer"]) {
1791 $start = $this->offset + 1;
1797 if ($end > $this->max_count or $this->limit == 0) {
1801 if ($this->max_count > 0) {
1802 if ($this->lang_support) {
1803 $numinfo =
"(" . $start .
" - " . $end .
" " . strtolower($this->
lng->txt(
"of")) .
" " . $this->max_count .
")";
1805 $numinfo =
"(" . $start .
" - " . $end .
" of " . $this->max_count .
")";
1808 if ($this->max_count > 0) {
1810 $this->tpl->setCurrentBlock(
"tbl_footer_numinfo");
1811 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1812 $this->tpl->parseCurrentBlock();
1819 if ($this->enabled[
"linkbar"] && $this->enabled[
"footer"] && $this->limit != 0
1820 && $this->max_count > 0) {
1822 $this->tpl->setCurrentBlock(
"tbl_footer_linkbar");
1823 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1824 $this->tpl->parseCurrentBlock();
1833 $items[$k] = array(
"txt" =>
$c[
"txt"],
1837 $cb_over->setLinkTitle(
$lng->
txt(
"columns"));
1838 $cb_over->setItems($items);
1842 $cb_over->setFieldVar(
"tblfs" . $this->
getId());
1843 $cb_over->setHiddenVar(
"tblfsh" . $this->
getId());
1844 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1845 $column_selector = $cb_over->getHTML();
1850 if ($this->requested_tmpl_create !=
"") {
1851 if ($this->
saveTemplate($this->requested_tmpl_create)) {
1852 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"tbl_template_created"));
1854 } elseif ($this->requested_tmpl_delete !=
"") {
1856 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
"tbl_template_deleted"));
1860 $create_id =
"template_create_overlay_" . $this->
getId();
1861 $delete_id =
"template_delete_overlay_" . $this->
getId();
1862 $list_id =
"template_stg_" . $this->
getId();
1865 $templates = $storage->getNames($this->
getContext(), $ilUser->getId());
1868 if (count($templates) > 0) {
1870 $this->tpl->setCurrentBlock(
"template_editor_delete_item");
1871 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE",
"");
1872 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION",
"- " .
$lng->
txt(
"form_please_select") .
" -");
1873 $this->tpl->parseCurrentBlock();
1874 foreach ($templates as $name) {
1875 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE", $name);
1876 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION", $name);
1877 $this->tpl->parseCurrentBlock();
1880 $this->tpl->setCurrentBlock(
"template_editor_delete");
1881 $this->tpl->setVariable(
"TEMPLATE_DELETE_ID", $delete_id);
1882 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE",
$lng->
txt(
"tbl_template_delete"));
1883 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE_SUBMIT",
$lng->
txt(
"delete"));
1884 $this->tpl->setVariable(
"TEMPLATE_DELETE_CMD", $this->parent_cmd);
1885 $this->tpl->parseCurrentBlock();
1888 $this->tpl->setCurrentBlock(
"template_editor");
1889 $this->tpl->setVariable(
"TEMPLATE_CREATE_ID", $create_id);
1890 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE",
$lng->
txt(
"tbl_template_create"));
1891 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE_SUBMIT",
$lng->
txt(
"save"));
1892 $this->tpl->setVariable(
"TEMPLATE_CREATE_CMD", $this->parent_cmd);
1893 $this->tpl->parseCurrentBlock();
1897 $actions[] = $ui_factory->button()->shy(
1898 $lng->
txt(
"tbl_template_create"),
1901 return "document.getElementById('$id').id = '" . $list_id .
"_create';";
1903 if (count($templates) > 0) {
1904 $actions[] = $ui_factory->button()->shy(
1905 $lng->
txt(
"tbl_template_delete"),
1908 return "document.getElementById('$id').id = '" . $list_id .
"_delete';";
1910 foreach ($templates as $name) {
1911 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl", urlencode($name));
1912 $actions[] = $ui_factory->link()->standard(
1914 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
1916 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl",
"");
1919 $dd = $ui_factory->dropdown()->standard(
1921 )->withLabel(
$lng->
txt(
"tbl_templates"));
1922 $this->tpl->setVariable(
"TEMPLATE_SELECTOR",
" " . $ui_renderer->render($dd));
1926 $overlay->setTrigger($list_id .
"_create");
1927 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
1928 $overlay->setAutoHide(
false);
1931 if (count($templates) > 0) {
1933 $overlay->setTrigger($list_id .
"_delete");
1934 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
1935 $overlay->setAutoHide(
false);
1941 $this->tpl->setCurrentBlock(
"tbl_footer");
1942 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
1944 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1946 $this->tpl->parseCurrentBlock();
1949 if ($numinfo !=
"" || $linkbar !=
"" || $column_selector !=
"" ||
1950 count($this->filters) > 0 || count($this->optional_filters) > 0) {
1951 if (is_object($ilUser) && (count($this->filters) || count($this->optional_filters))) {
1952 $this->tpl->setCurrentBlock(
"filter_activation");
1953 $this->tpl->setVariable(
"TXT_ACTIVATE_FILTER",
$lng->
txt(
"show_filter"));
1954 $this->tpl->setVariable(
"FILA_ID", $this->
getId());
1955 if ($this->
getId() !=
"") {
1956 $this->tpl->setVariable(
"SAVE_URLA",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1957 $this->
getId() .
"&cmd=showFilter&user_id=" . $ilUser->getId());
1959 $this->tpl->parseCurrentBlock();
1963 $this->tpl->setCurrentBlock(
"filter_deactivation");
1964 $this->tpl->setVariable(
"TXT_HIDE",
$lng->
txt(
"hide_filter"));
1965 if ($this->
getId() !=
"") {
1966 $this->tpl->setVariable(
"SAVE_URL",
"./ilias.php?baseClass=ilTablePropertiesStorageGUI&table_id=" .
1967 $this->
getId() .
"&cmd=hideFilter&user_id=" . $ilUser->getId());
1968 $this->tpl->setVariable(
"FILD_ID", $this->
getId());
1970 $this->tpl->parseCurrentBlock();
1975 $this->tpl->setCurrentBlock(
"top_numinfo");
1976 $this->tpl->setVariable(
"NUMINFO", $numinfo);
1977 $this->tpl->parseCurrentBlock();
1981 $this->tpl->setCurrentBlock(
"top_linkbar");
1982 $this->tpl->setVariable(
"LINKBAR", $linkbar);
1983 $this->tpl->parseCurrentBlock();
1987 $this->tpl->setVariable(
"COLUMN_SELECTOR", $column_selector);
1991 is_object($ilUser) &&
1993 !$this->rows_selector_off) {
1996 $hpp = ($ilUser->getPref(
"hits_per_page") != 9999)
1997 ? $ilUser->getPref(
"hits_per_page")
2000 $options = array(0 =>
$lng->
txt(
"default") .
" (" . $hpp .
")",5 => 5, 10 => 10, 15 => 15, 20 => 20,
2001 30 => 30, 40 => 40, 50 => 50,
2002 100 => 100, 200 => 200, 400 => 400, 800 => 800);
2003 foreach ($options as $k => $v) {
2004 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows", $k);
2005 $actions[] = $ui_factory->link()->standard(
2007 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)
2009 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows",
"");
2011 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
2014 $this->tpl->setVariable(
"ROW_SELECTOR", $ui_renderer->render($dd));
2018 if (count($this->export_formats) > 0 && $this->
dataExists()) {
2020 foreach ($this->export_formats as $format => $caption_lng_id) {
2021 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt", $format);
2022 $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
2023 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
"");
2024 $actions[] = $ui_factory->link()->standard(
2029 $dd = $ui_factory->dropdown()->standard($actions)->withLabel(
$lng->
txt(
"export"));
2030 $this->tpl->setVariable(
"EXPORT_SELECTOR",
" " . $ui_renderer->render($dd));
2033 $this->tpl->setCurrentBlock(
"top_navigation");
2034 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2036 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2038 $this->tpl->parseCurrentBlock();
2047 $ilUser = $DIC->user();
2054 $link = $ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd) .
2059 $layout_prev =
$lng->
txt(
"previous");
2060 $layout_next =
$lng->
txt(
"next");
2063 if ($this->max_count > $this->
getLimit() || $this->custom_prev_next) {
2064 $sep =
"<span> | </span>";
2067 $pages = intval($this->max_count / $this->
getLimit());
2070 if (($this->max_count % $this->
getLimit())) {
2075 $offset_arr = array();
2076 for ($i = 1 ;$i <= $pages ; $i++) {
2077 $newoffset = $this->
getLimit() * ($i - 1);
2083 $sep =
"<span> </span>";
2086 if ($this->custom_prev_next && $this->custom_prev !=
"") {
2087 $LinkBar .=
"<a href=\"" . $this->custom_prev . $hash .
"\">" . $layout_prev .
"</a>";
2088 } elseif ($this->
getOffset() >= 1 && !$this->custom_prev_next) {
2090 $LinkBar .=
"<a href=\"" . $link . $prevoffset . $hash .
"\">" . $layout_prev .
"</a>";
2092 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_prev .
"</span>";
2096 if ($a_num ==
"1") {
2097 $LinkBar .=
'<input type="hidden" name="' . $this->
getNavParameter() .
2101 $sep =
"<span> | </span>";
2105 if ($this->custom_prev_next && $this->custom_next !=
"") {
2106 $LinkBar .=
"<a href=\"" . $this->custom_next . $hash .
"\">" . $layout_next .
"</a>";
2107 } elseif (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1) &&
2108 !$this->custom_prev_next) {
2110 $LinkBar .=
"<a href=\"" . $link . $newoffset . $hash .
"\">" . $layout_next .
"</a>";
2112 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_next .
"</span>";
2115 $sep =
"<span> </span>";
2117 if (count($offset_arr) && !$this->
getDisplayAsBlock() && !$this->custom_prev_next) {
2121 '<label for="tab_page_sel_' . $a_num .
'">' .
$lng->
txt(
"page") .
'</label> ' .
2130 array(
"id" =>
"tab_page_sel_" . $a_num,
2131 "onchange" =>
"ilTablePageSelection(this, 'cmd[" . $this->parent_cmd .
"]')")
2143 $hidden_row =
false;
2144 if (count($this->hidden_inputs)) {
2145 foreach ($this->hidden_inputs as $hidden_input) {
2146 $this->tpl->setCurrentBlock(
"tbl_hidden_field");
2147 $this->tpl->setVariable(
"FIELD_NAME", $hidden_input[
"name"]);
2148 $this->tpl->setVariable(
"FIELD_VALUE", $hidden_input[
"value"]);
2149 $this->tpl->parseCurrentBlock();
2152 $this->tpl->setCurrentBlock(
"tbl_hidden_row");
2153 $this->tpl->parseCurrentBlock();
2162 $action_row =
false;
2168 if (count($this->sel_buttons) > 0) {
2169 foreach ($this->sel_buttons as $button) {
2170 $this->tpl->setCurrentBlock(
"sel_button");
2171 $this->tpl->setVariable(
2174 $button[
"selected"],
2181 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2182 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2183 $this->tpl->parseCurrentBlock();
2186 $this->tpl->setCurrentBlock(
"sel_top_button");
2187 $this->tpl->setVariable(
2190 $button[
"selected"],
2197 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2198 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2199 $this->tpl->parseCurrentBlock();
2205 $this->sel_buttons[] = array(
"options" => [],
"cmd" =>
'',
"text" =>
'');
2208 if (count($this->buttons) > 0) {
2209 foreach ($this->buttons as $button) {
2210 if (!is_array($button)) {
2212 $this->tpl->setVariable(
'BUTTON_OBJ', $button->render());
2215 $button = clone $button;
2217 $this->tpl->setVariable(
'BUTTON_TOP_OBJ', $button->render());
2222 if (strlen($button[
'onclick'])) {
2223 $this->tpl->setCurrentBlock(
'cmdonclick');
2224 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2225 $this->tpl->parseCurrentBlock();
2227 $this->tpl->setCurrentBlock(
"plain_button");
2228 if ($button[
"id"] !=
"") {
2229 $this->tpl->setVariable(
"PBID",
' id="' . $button[
"id"] .
'" ');
2231 if ($button[
"class"] !=
"") {
2232 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2234 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2235 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2236 $this->tpl->parseCurrentBlock();
2239 if (strlen($button[
'onclick'])) {
2240 $this->tpl->setCurrentBlock(
'top_cmdonclick');
2241 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2242 $this->tpl->parseCurrentBlock();
2244 $this->tpl->setCurrentBlock(
"plain_top_button");
2245 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2246 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2247 if ($button[
"class"] !=
"") {
2248 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2250 $this->tpl->parseCurrentBlock();
2259 if (count($this->mi_sel_buttons)) {
2260 foreach ($this->mi_sel_buttons as $button) {
2261 $this->tpl->setCurrentBlock(
"mi_sel_button");
2262 $this->tpl->setVariable(
2265 $button[
"selected"],
2272 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2273 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2274 $this->tpl->parseCurrentBlock();
2277 $this->tpl->setCurrentBlock(
"mi_top_sel_button");
2278 $this->tpl->setVariable(
2281 $button[
"selected"],
2282 $button[
"sel_var"] .
"_2",
2288 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2289 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2290 $this->tpl->parseCurrentBlock();
2298 if (count($this->multi) > 1 && $this->
dataExists()) {
2299 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2300 $this->tpl->setCurrentBlock(
"tbl_cmd_select_all");
2301 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->
txt(
"all_objects"));
2302 $this->tpl->parseCurrentBlock();
2305 $this->tpl->setCurrentBlock(
"tbl_cmd_select");
2307 foreach ($this->multi as $mc) {
2308 $sel[$mc[
"cmd"]] = $mc[
"text"];
2310 $this->tpl->setVariable(
2314 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->
txt(
"execute"));
2315 $this->tpl->parseCurrentBlock();
2320 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2321 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select_all");
2322 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->
txt(
"all_objects"));
2323 $this->tpl->parseCurrentBlock();
2326 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select");
2328 foreach ($this->multi as $mc) {
2329 $sel[$mc[
"cmd"]] = $mc[
"text"];
2331 $this->tpl->setVariable(
2335 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->
txt(
"execute"));
2336 $this->tpl->parseCurrentBlock();
2338 } elseif (count($this->multi) == 1 && $this->
dataExists()) {
2339 $this->tpl->setCurrentBlock(
"tbl_single_cmd");
2340 foreach ($this->multi as $mc) {
2344 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2345 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2346 $this->tpl->parseCurrentBlock();
2351 $this->tpl->setCurrentBlock(
"tbl_top_single_cmd");
2352 foreach ($this->multi as $mc) {
2356 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2357 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2358 $this->tpl->parseCurrentBlock();
2363 $this->tpl->setCurrentBlock(
"tbl_action_img_arrow");
2365 $this->tpl->setVariable(
"ALT_ARROW",
$lng->
txt(
"action"));
2366 $this->tpl->parseCurrentBlock();
2369 $this->tpl->setCurrentBlock(
"tbl_top_action_img_arrow");
2371 $this->tpl->setVariable(
"ALT_ARROW",
$lng->
txt(
"action"));
2372 $this->tpl->parseCurrentBlock();
2377 $this->tpl->setCurrentBlock(
"tbl_action_row");
2378 $this->tpl->parseCurrentBlock();
2380 $this->tpl->setCurrentBlock(
"tbl_top_action_row");
2381 $this->tpl->parseCurrentBlock();
2388 $this->headerHTML = $html;
2396 if (isset($DIC[
"ilUser"])) {
2397 $ilUser = $DIC[
"ilUser"];
2400 if (is_object($ilUser) && $this->
getId() !=
"") {
2403 $tab_prop->storeProperty($this->
getId(), $ilUser->getId(), $type, $value);
2412 if (isset($DIC[
"ilUser"])) {
2413 $ilUser = $DIC[
"ilUser"];
2416 if (is_object($ilUser) && $this->
getId() !=
"") {
2419 return $tab_prop->getProperty($this->
getId(), $ilUser->getId(), $type);
2440 $result[
"rows"] = $this->
getLimit();
2448 if ($this->filters) {
2449 foreach ($this->filters as $item) {
2450 $result[
"filter_values"][$item->getFieldId()] = $this->
getFilterValue($item);
2453 if ($this->optional_filters && $result[
"selfilters"]) {
2454 foreach ($this->optional_filters as $item) {
2455 if (in_array($item->getFieldId(), $result[
"selfilters"])) {
2456 $result[
"filter_values"][$item->getFieldId()] = $this->
getFilterValue($item);
2470 if (method_exists($a_item,
"getChecked")) {
2471 return (
string) $a_item->getChecked();
2472 } elseif (method_exists($a_item,
"getValue")) {
2473 return $a_item->getValue() ?:
"";
2474 } elseif (method_exists($a_item,
"getDate")) {
2475 return $a_item->getDate()?->get(
IL_CAL_DATE) ??
"";
2486 if (method_exists($a_item,
"setChecked")) {
2487 $a_item->setChecked((
bool) $a_value);
2488 } elseif (method_exists($a_item,
"setValue")) {
2489 $a_item->setValue($a_value);
2490 } elseif (method_exists($a_item,
"setDate")) {
2493 $a_item->writeToSession();
2499 $this->context =
$id;
2513 $this->show_rows_selector = $a_value;
2523 $this->show_templates = $a_value;
2538 $ilUser = $DIC->user();
2545 $data = $storage->load($this->
getContext(), $ilUser->getId(), $a_name);
2546 if (is_array(
$data)) {
2547 foreach (
$data as $property => $value) {
2552 $data[
"filter_values"] = unserialize((
string)
$data[
"filter_values"]);
2553 if ($data[
"filter_values"]) {
2554 $this->restore_filter_values = $data[
"filter_values"];
2557 $this->restore_filter =
true;
2571 $ilUser = $DIC->user();
2579 $state[
"filter_values"] = serialize($state[
"filter_values"] ?? null);
2580 $state[
"selfields"] = serialize($state[
"selfields"] ?? null);
2581 $state[
"selfilters"] = serialize($state[
"selfilters"] ?? null);
2583 $storage->store($this->
getContext(), $ilUser->getId(), $a_name, $state);
2593 $ilUser = $DIC->user();
2599 $storage->delete($this->
getContext(), $ilUser->getId(), $a_name);
2610 return parent::getLimit();
2618 return parent::getOffset();
2626 $this->export_formats = array();
2629 $valid = array(self::EXPORT_EXCEL =>
"tbl_export_excel",
2630 self::EXPORT_CSV =>
"tbl_export_csv");
2632 foreach ($formats as $format) {
2633 if (array_key_exists($format,
$valid)) {
2634 $this->export_formats[$format] =
$valid[$format];
2641 $this->print_mode = $a_value;
2657 public function exportData(
int $format,
bool $send =
false): void
2674 case self::EXPORT_EXCEL:
2676 $excel->addSheet($this->title
2677 ?: $this->
lng->txt(
"export"));
2690 foreach ($this->row_data as $set) {
2703 case self::EXPORT_CSV:
2705 $csv->setSeparator(
";");
2710 foreach ($this->row_data as $set) {
2717 header(
"Content-type: text/comma-separated-values");
2718 header(
"Content-Disposition: attachment; filename=\"" .
$filename .
"\"");
2720 header(
"Cache-Control: must-revalidate, post-check=0,pre-check=0");
2721 header(
"Pragma: public");
2722 echo $csv->getCSVString();
2724 file_put_contents(
$filename, $csv->getCSVString());
2754 foreach ($this->column as $column) {
2755 $title = strip_tags($column[
"text"]);
2773 foreach ($a_set as $value) {
2774 if (is_array($value)) {
2775 $value = implode(
', ', $value);
2777 $a_excel->
setCell($a_row, $col++, $value);
2797 foreach ($this->column as $column) {
2798 $title = strip_tags($column[
"text"]);
2814 foreach ($a_set as
$key => $value) {
2815 if (is_array($value)) {
2816 $value = implode(
', ', $value);
2825 $this->enable_command_for_all = $a_value;
2832 $ilClientIniFile = $DIC[
"ilClientIniFile"];
2834 $limit = $ilClientIniFile->readVariable(
"system",
"TABLE_ACTION_ALL_LIMIT");
2836 $limit = self::ACTION_ALL_LIMIT;
2854 $this->prevent_double_submission = $a_val;
2862 public function setLimit(
int $a_limit = 0,
int $a_default_limit = 0): void
2864 parent::setLimit($a_limit, $a_default_limit);
2867 if ($a_limit == 9999 &&
2868 $this->limit_determined) {
2869 $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?
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)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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.
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
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)
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.
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="")
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)
static setUseRelativeDates(bool $a_status)
set use relative dates
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)