4 require_once(
"Services/Table/classes/class.ilTableGUI.php");
123 public function __construct($a_parent_obj, $a_parent_cmd =
"", $a_template_context =
"")
127 $this->lng = $DIC->language();
128 $this->ctrl = $DIC->ctrl();
129 $lng = $DIC->language();
132 $this->unique_id = md5(uniqid());
133 $this->parent_obj = $a_parent_obj;
134 $this->parent_cmd = $a_parent_cmd;
135 $this->buttons = array();
136 $this->header_commands = array();
137 $this->multi = array();
138 $this->hidden_inputs = array();
140 $this->tpl =
new ilTemplate(
"tpl.table2.html",
true,
true,
"Services/Table");
142 $lng->loadLanguageModule(
'tbl');
144 if (!$a_template_context) {
145 $a_template_context = $this->
getId();
150 if (isset(
$_GET[$this->prefix .
"_xpt"])) {
151 $this->export_mode = (int)
$_GET[$this->prefix .
"_xpt"];
155 if (isset(
$_GET[$this->prefix .
"_tpl"])) {
172 $this->open_form_tag = $a_val;
192 $this->close_form_tag = $a_val;
213 if (isset($DIC[
"ilUser"])) {
217 if ($this->limit_determined) {
222 if (isset(
$_GET[$this->prefix .
"_trows"])) {
242 $this->limit_determined =
true;
260 if ($this->columns_determined) {
267 if ($old_sel !=
"") {
269 @unserialize($old_sel);
272 if (!is_array($sel_fields)) {
274 $sel_fields = array();
277 $this->selected_columns = array();
280 $this->selected_column[$k] =
false;
282 $new_column = ($sel_fields[$k] === null);
287 $this->selected_column[$k] =
true;
289 } elseif ($stored && !$new_column) {
290 $this->selected_column[$k] = $sel_fields[$k];
295 if (isset(
$c[
"default"]) &&
$c[
"default"]) {
296 $this->selected_column[$k] =
true;
304 $this->selected_column[$k] =
true;
310 if ($old_sel != serialize($this->selected_column) && $set) {
311 $this->
storeProperty(
"selfields", serialize($this->selected_column));
314 $this->columns_determined =
true;
325 return $this->selected_column[$a_col];
337 foreach ($this->selected_column as $k => $v) {
352 $next_class =
$ilCtrl->getNextClass($this);
355 switch ($next_class) {
356 case 'ilformpropertydispatchgui':
357 include_once
'./Services/Form/classes/class.ilFormPropertyDispatchGUI.php';
361 $form_prop_dispatch->setItem($item);
362 return $ilCtrl->forwardCommand($form_prop_dispatch);
374 if (!$this->nav_determined && !$a_in_determination) {
420 $this->top_anchor = $a_val;
440 $this->noentriestext = $a_text;
450 return $this->noentriestext;
460 $this->datatable = $a_val;
470 return $this->datatable;
480 $this->enabled[
"title"] = $a_enabletitle;
490 return $this->enabled[
"title"];
500 $this->enabled[
"header"] = $a_enableheader;
510 return $this->enabled[
"header"];
520 $this->num_info = $a_val;
530 return $this->num_info;
536 final public function setTitle($a_title, $a_icon = 0, $a_icon_alt = 0)
538 parent::setTitle($a_title, $a_icon, $a_icon_alt);
548 $this->description = $a_val;
558 return $this->description;
568 $this->order_field = $a_order_field;
573 return $this->order_field;
579 if (defined(
'DEVMODE') && DEVMODE &&
580 $this->enabled[
"header"] && $this->enabled[
"sort"] &&
581 $this->columns_determined && is_array($this->column) &&
584 $check = array_keys(array_shift($check));
585 foreach ($this->column as $col) {
586 if ($col[
"sort_field"] && !in_array($col[
"sort_field"], $check)) {
587 $invalid[] = $col[
"sort_field"];
602 $this->row_data = $a_data;
603 if (!is_array($this->row_data)) {
604 $this->row_data = [];
610 return $this->row_data;
615 if (is_array($this->row_data)) {
616 if (count($this->row_data) > 0) {
625 $this->prefix = $a_prefix;
639 $a_input_item->setParent($this);
641 $this->filters[] = $a_input_item;
643 $this->optional_filters[] = $a_input_item;
647 if ($this->restore_filter) {
649 $this->setFilterValue($a_input_item, $this->restore_filter_values[$a_input_item->getFieldId()]);
651 $this->setFilterValue($a_input_item, null);
669 $lng = $DIC->language();
672 $caption =
$lng->txt($id);
675 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
678 case self::FILTER_CHECKBOX:
682 case self::FILTER_SELECT:
683 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
687 case self::FILTER_DATE:
688 include_once(
"./Services/Form/classes/class.ilDateTimeInputGUI.php");
692 case self::FILTER_TEXT:
693 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
695 $item->setMaxLength(64);
700 case self::FILTER_LANGUAGE:
701 $lng->loadLanguageModule(
"meta");
702 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
704 $options = array(
"" =>
$lng->txt(
"trac_all"));
705 foreach (
$lng->getInstalledLanguages() as $lang_key) {
706 $options[$lang_key] =
$lng->txt(
"meta_l_" . $lang_key);
708 $item->setOptions($options);
711 case self::FILTER_NUMBER_RANGE:
712 include_once(
"./Services/Form/classes/class.ilCombinationInputGUI.php");
713 include_once(
"./Services/Form/classes/class.ilNumberInputGUI.php");
716 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
718 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
720 $item->setMaxLength(7);
724 case self::FILTER_DATE_RANGE:
725 include_once(
"./Services/Form/classes/class.ilCombinationInputGUI.php");
726 include_once(
"./Services/Form/classes/class.ilDateTimeInputGUI.php");
729 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
731 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
735 case self::FILTER_DATETIME_RANGE:
736 include_once(
"./Services/Form/classes/class.ilCombinationInputGUI.php");
737 include_once(
"./Services/Form/classes/class.ilDateTimeInputGUI.php");
740 $combi_item->setShowTime(
true);
741 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
743 $combi_item->setShowTime(
true);
744 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
748 case self::FILTER_DURATION_RANGE:
749 $lng->loadLanguageModule(
"form");
750 include_once(
"./Services/Form/classes/class.ilCombinationInputGUI.php");
751 include_once(
"./Services/Form/classes/class.ilDurationInputGUI.php");
754 $combi_item->setShowMonths(
false);
755 $combi_item->setShowDays(
true);
756 $combi_item->setShowSeconds(
true);
757 $item->addCombinationItem(
"from", $combi_item,
$lng->txt(
"from"));
759 $combi_item->setShowMonths(
false);
760 $combi_item->setShowDays(
true);
761 $combi_item->setShowSeconds(
true);
762 $item->addCombinationItem(
"to", $combi_item,
$lng->txt(
"to"));
771 $item->readFromSession();
789 if ($item->getPostVar() == $a_post_var) {
794 if ($item->getPostVar() == $a_post_var) {
808 $this->filter_cols = $a_val;
828 $this->disable_filter_hiding = $a_val;
849 return $this->selected_filter[$a_col];
861 foreach ($this->selected_filter as $k => $v) {
877 if ($this->filters_determined) {
883 if ($old_sel !=
"") {
885 @unserialize($old_sel);
888 if (!is_array($sel_filters)) {
890 $sel_filters = array();
893 $this->selected_filter = array();
896 $k = $item->getPostVar();
898 $this->selected_filter[$k] =
false;
903 $this->selected_filter[$k] =
true;
905 $item->setValue(null);
906 $item->writeToSession();
909 $this->selected_filter[$k] = $sel_filters[$k];
913 if ($old_sel != serialize($this->selected_filter) && $set) {
914 $this->
storeProperty(
"selfilters", serialize($this->selected_filter));
917 $this->filters_determined =
true;
925 $this->custom_prev_next =
true;
926 $this->custom_prev = $a_prev_link;
927 $this->custom_next = $a_next_link;
938 $this->form_action = $a_form_action;
939 $this->form_multipart = (bool) $a_multipart;
949 return $this->form_action;
959 $this->formname = $a_formname;
969 return $this->formname;
1002 $this->display_as_block = $a_val;
1012 return $this->display_as_block;
1033 $this->select_all_checkbox = $a_select_all_checkbox;
1034 $this->select_all_on_top = $a_select_all_on_top;
1044 $this->ext_sort = $a_val;
1065 $this->filter_cmd = $a_val;
1066 $this->filter_cmd_txt = $a_caption;
1087 $this->reset_cmd = $a_val;
1088 $this->reset_cmd_txt = $a_caption;
1108 $this->ext_seg = $a_val;
1129 $this->row_template = $a_template;
1130 $this->row_template_dir = $a_template_dir;
1140 $this->defaultorderfield = $a_defaultorderfield;
1150 return $this->defaultorderfield;
1160 $this->defaultorderdirection = $a_defaultorderdirection;
1170 return $this->defaultorderdirection;
1179 $this->default_filter_visibility = $a_status;
1198 $this->buttons = array();
1207 public function addCommandButton($a_cmd, $a_text, $a_onclick =
'', $a_id =
"", $a_class = null)
1209 $this->buttons[] = array(
"cmd" => $a_cmd,
"text" => $a_text,
'onclick' => $a_onclick,
1210 "id" => $a_id,
"class" => $a_class);
1220 $this->buttons[] = $a_button;
1235 echo
"ilTabl2GUI->addSelectionButton() has been deprecated with 4.2. Please try to move the drop-down to ilToolbarGUI.";
1250 $this->mi_sel_buttons[] = array(
"sel_var" => $a_sel_var,
"options" => $a_options,
"selected" => $a_default_selection,
"cmd" => $a_cmd,
"text" => $a_text);
1264 $this->close_command = $a_link;
1275 $this->multi[] = array(
"cmd" => $a_cmd,
"text" => $a_text);
1286 $this->hidden_inputs[] = array(
"name" => $a_name,
"value" => $a_value);
1297 $this->header_commands[] = array(
"href" => $a_href,
"text" => $a_text,
1298 "target" => $a_target,
"img" => $a_img);
1308 $this->top_commands = $a_val;
1332 $a_is_checkbox_action_column =
false,
1335 $a_tooltip_with_html =
false 1337 $this->column[] = array(
1339 "sort_field" => $a_sort_field,
1340 "width" => $a_width,
1341 "is_checkbox_action_column" => $a_is_checkbox_action_column,
1342 "class" => $a_class,
1343 "tooltip" => $a_tooltip,
1344 "tooltip_html" => (
bool) $a_tooltip_with_html
1346 if ($a_sort_field !=
"") {
1347 $this->sortable_fields[] = $a_sort_field;
1349 $this->column_count = count($this->column);
1355 return $this->prefix .
"_table_nav";
1367 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
1377 $sort_field .
":" . $order_dir .
":" . $this->offset
1379 $this->tpl->setVariable(
1381 $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd) . $hash
1396 $allcolumnswithwidth =
true;
1397 foreach ((array) $this->column as $idx => $column) {
1398 if (!strlen($column[
"width"])) {
1399 $allcolumnswithwidth =
false;
1400 } elseif ($column[
"width"] ==
"1") {
1402 $this->column[$idx][
"width"] =
"1%";
1405 if ($allcolumnswithwidth) {
1406 foreach ((array) $this->column as $column) {
1407 $this->tpl->setCurrentBlock(
"tbl_colgroup_column");
1408 $width = (is_numeric($column[
"width"]))
1409 ? $column[
"width"].
"px" 1411 $this->tpl->setVariable(
"COLGROUP_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1412 $this->tpl->parseCurrentBlock();
1416 foreach ((array) $this->column as $column) {
1419 if ($column[
"tooltip"] !=
"") {
1420 include_once(
"./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1422 "thc_" . $this->
getId() .
"_" . $ccnt,
1427 !$column[
"tooltip_html"]
1431 if ($column[
'is_checkbox_action_column'] && $this->select_all_on_top) {
1432 $this->tpl->setCurrentBlock(
'tbl_header_top_select_all');
1433 $this->tpl->setVariable(
"HEAD_SELECT_ALL_TXT_SELECT_ALL",
$lng->txt(
"select_all"));
1435 $this->tpl->setVariable(
"HEAD_SELECT_ALL_FORM_NAME", $this->
getFormName());
1436 $this->tpl->setVariable(
"HEAD_CHECKBOXNAME",
"chb_select_all_" . $this->unique_id .
'_top');
1437 $this->tpl->parseCurrentBlock();
1441 !$this->enabled[
"sort"] ||
1442 $column[
"sort_field"] ==
"" &&
1443 !($column[
"is_checkbox_action_column"] && $this->select_all_on_top)
1445 $this->tpl->setCurrentBlock(
"tbl_header_no_link");
1446 if ($column[
"width"] !=
"") {
1447 $width = (is_numeric($column[
"width"]))
1448 ? $column[
"width"].
"px" 1450 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH_NO_LINK",
" style=\"width:" . $width .
"\"");
1452 if ($column[
"class"] !=
"") {
1453 $this->tpl->setVariable(
"TBL_COLUMN_CLASS_NO_LINK",
" class=\"" . $column[
"class"] .
"\"");
1455 if (!$column[
"is_checkbox_action_column"]) {
1456 $this->tpl->setVariable(
1457 "TBL_HEADER_CELL_NO_LINK",
1461 $this->tpl->setVariable(
1462 "TBL_HEADER_CELL_NO_LINK",
1466 $this->tpl->setVariable(
"HEAD_CELL_NL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1467 if ($column[
"class"] !=
"") {
1468 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1470 $this->tpl->parseCurrentBlock();
1471 $this->tpl->touchBlock(
"tbl_header_th");
1474 if (($column[
"sort_field"] == $this->order_field) && ($this->order_direction !=
"")) {
1475 $this->tpl->setCurrentBlock(
"tbl_order_image");
1476 if ($this->order_direction ==
"asc") {
1477 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-up");
1479 $this->tpl->setVariable(
"ORDER_CLASS",
"glyphicon glyphicon-arrow-down");
1481 $this->tpl->setVariable(
"IMG_ORDER_ALT", $this->lng->txt(
"change_sort_direction"));
1482 $this->tpl->parseCurrentBlock();
1485 $this->tpl->setCurrentBlock(
"tbl_header_cell");
1486 $this->tpl->setVariable(
"TBL_HEADER_CELL", $column[
"text"]);
1487 $this->tpl->setVariable(
"HEAD_CELL_ID",
"thc_" . $this->
getId() .
"_" . $ccnt);
1490 if ($column[
"width"] !=
"") {
1491 $width = (is_numeric($column[
"width"]))
1492 ? $column[
"width"].
"px" 1494 $this->tpl->setVariable(
"TBL_COLUMN_WIDTH",
" style=\"width:" . $width .
"\"");
1496 if ($column[
"class"] !=
"") {
1497 $this->tpl->setVariable(
"TBL_COLUMN_CLASS",
" class=\"" . $column[
"class"] .
"\"");
1500 $lng_sort_column = $this->lng->txt(
"sort_by_this_column");
1501 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_sort_column);
1505 if ($column[
"sort_field"] == $this->order_field) {
1506 $order_dir = $this->sort_order;
1508 $lng_change_sort = $this->lng->txt(
"change_sort_direction");
1509 $this->tpl->setVariable(
"TBL_ORDER_ALT", $lng_change_sort);
1512 if ($column[
"class"] !=
"") {
1513 $this->tpl->setVariable(
"TBL_HEADER_CLASS",
" " . $column[
"class"]);
1515 $this->
setOrderLink($column[
"sort_field"], $order_dir);
1516 $this->tpl->parseCurrentBlock();
1517 $this->tpl->touchBlock(
"tbl_header_th");
1520 $this->tpl->setCurrentBlock(
"tbl_header");
1521 $this->tpl->parseCurrentBlock();
1540 if (isset($DIC[
"ilUser"])) {
1544 if ($this->nav_determined) {
1560 if ($this->nav_value ==
"" && $this->
getId() !=
"" &&
$ilUser->getId() != ANONYMOUS_USER_ID) {
1562 if (in_array($order, $this->sortable_fields)) {
1573 $nav = explode(
":", $this->nav_value);
1579 if (!$a_omit_offset) {
1590 if (!$a_omit_offset) {
1591 $this->nav_determined =
true;
1618 if (isset($DIC[
"ilUser"])) {
1640 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
1644 if ((
bool) $this->form_multipart) {
1645 $this->tpl->touchBlock(
"form_multipart_bl");
1649 $this->tpl->touchBlock(
"pdfs");
1652 $this->tpl->setCurrentBlock(
"tbl_form_header");
1653 $this->tpl->setVariable(
"FORMACTION", $this->
getFormAction() . $hash);
1654 $this->tpl->setVariable(
"FORMNAME", $this->
getFormName());
1655 $this->tpl->parseCurrentBlock();
1659 $this->tpl->touchBlock(
"tbl_form_footer");
1663 if (!$this->enabled[
'content']) {
1673 $this->
setFooter(
"tblfooter", $this->lng->txt(
"previous"), $this->lng->txt(
"next"));
1699 $this->tpl->addBlockFile(
1702 $this->row_template,
1703 $this->row_template_dir
1706 foreach ($data as $set) {
1707 $this->tpl->setCurrentBlock(
"tbl_content");
1708 $this->css_row = ($this->css_row !=
"tblrow1")
1711 $this->tpl->setVariable(
"CSS_ROW", $this->css_row);
1714 $this->tpl->setCurrentBlock(
"tbl_content");
1715 $this->tpl->parseCurrentBlock();
1721 :
$lng->txt(
"no_items");
1723 $this->css_row = ($this->css_row !=
"tblrow1")
1727 $this->tpl->setCurrentBlock(
"tbl_no_entries");
1728 $this->tpl->setVariable(
'TBL_NO_ENTRY_CSS_ROW', $this->css_row);
1729 $this->tpl->setVariable(
'TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
1730 $this->tpl->setVariable(
'TBL_NO_ENTRY_TEXT', trim($no_items_text));
1731 $this->tpl->parseCurrentBlock();
1767 $this->tpl->setVariable(
"CSS_TABLE", $this->
getStyle(
"table"));
1769 if ($this->
getId() !=
"") {
1770 $this->tpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
1775 $this->tpl->setCurrentBlock(
"tbl_header_description");
1776 $this->tpl->setVariable(
"TBL_DESCRIPTION", $this->
getDescription());
1777 $this->tpl->parseCurrentBlock();
1785 $this->tpl->touchBlock(
"outer_start_1");
1786 $this->tpl->touchBlock(
"outer_end_1");
1788 $this->tpl->touchBlock(
"outer_start_2");
1789 $this->tpl->touchBlock(
"outer_end_2");
1793 if ($this->enabled[
"title"] && ($this->title !=
"" 1794 || $this->icon !=
"" || count($this->header_commands) > 0 ||
1795 $this->headerHTML !=
"" || $this->close_command !=
"")) {
1796 if ($this->enabled[
"icon"]) {
1797 $this->tpl->setCurrentBlock(
"tbl_header_title_icon");
1799 $this->tpl->setVariable(
"TBL_TITLE_IMG_ALT", $this->icon_alt);
1800 $this->tpl->parseCurrentBlock();
1804 foreach ($this->header_commands as $command) {
1805 if ($command[
"img"] !=
"") {
1806 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1807 if ($command[
"target"] !=
"") {
1808 $this->tpl->setVariable(
1810 'target="' . $command[
"target"] .
'"' 1813 $this->tpl->setVariable(
"ALT_IMG_LINK", $command[
"text"]);
1814 $this->tpl->setVariable(
"HREF_IMG_LINK", $command[
"href"]);
1815 $this->tpl->setVariable(
1819 $this->tpl->parseCurrentBlock();
1821 $this->tpl->setCurrentBlock(
"head_cmd");
1822 $this->tpl->setVariable(
"TXT_HEAD_CMD", $command[
"text"]);
1823 $this->tpl->setVariable(
"HREF_HEAD_CMD", $command[
"href"]);
1824 $this->tpl->parseCurrentBlock();
1829 if (isset($this->headerHTML)) {
1830 $this->tpl->setCurrentBlock(
"tbl_header_html");
1831 $this->tpl->setVariable(
"HEADER_HTML", $this->headerHTML);
1832 $this->tpl->parseCurrentBlock();
1836 if ($this->close_command !=
"") {
1837 $this->tpl->setCurrentBlock(
"tbl_header_img_link");
1838 $this->tpl->setVariable(
"ALT_IMG_LINK",
$lng->txt(
"close"));
1839 $this->tpl->setVariable(
"HREF_IMG_LINK", $this->close_command);
1840 $this->tpl->parseCurrentBlock();
1843 $this->tpl->setCurrentBlock(
"tbl_header_title");
1844 $this->tpl->setVariable(
"TBL_TITLE", $this->title);
1845 $this->tpl->setVariable(
"TOP_ANCHOR", $this->
getTopAnchor());
1847 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
1849 $this->tpl->parseCurrentBlock();
1853 if ($this->enabled[
"header"]) {
1857 $this->tpl->touchBlock(
"tbl_table_end");
1859 return $this->tpl->get();
1870 $main_tpl = $DIC[
"tpl"];
1875 $main_tpl->addJavascript(
"./Services/Table/js/ServiceTable.js");
1877 if (count($filter) == 0 && count($opt_filter) == 0) {
1881 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1887 if (count($filter) > 0) {
1888 foreach ($filter as $item) {
1890 $this->tpl->setCurrentBlock(
"filter_row");
1891 $this->tpl->parseCurrentBlock();
1894 $this->tpl->setCurrentBlock(
"filter_item");
1895 $this->tpl->setVariable(
1899 $this->tpl->setVariable(
1901 $item->getTableFilterLabelFor()
1903 $this->tpl->setVariable(
1905 $item->getTableFilterHTML()
1907 $this->tpl->parseCurrentBlock();
1913 if (count($opt_filter) > 0) {
1916 foreach ($opt_filter as $item) {
1919 $this->tpl->setCurrentBlock(
"filter_row");
1920 $this->tpl->parseCurrentBlock();
1923 $this->tpl->setCurrentBlock(
"filter_item");
1924 $this->tpl->setVariable(
1928 $this->tpl->setVariable(
1932 $this->tpl->setVariable(
1934 $item->getTableFilterHTML()
1936 $this->tpl->parseCurrentBlock();
1943 foreach ($opt_filter as $item) {
1944 $k = $item->getPostVar();
1945 $items[$k] = array(
"txt" => $item->getTitle(),
1949 include_once(
"./Services/UIComponent/CheckboxListOverlay/classes/class.ilCheckboxListOverlayGUI.php");
1951 $cb_over->setLinkTitle(
$lng->txt(
"optional_filters"));
1952 $cb_over->setItems($items);
1955 $cb_over->setFieldVar(
"tblff" . $this->
getId());
1956 $cb_over->setHiddenVar(
"tblfsf" . $this->
getId());
1958 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
1959 $this->tpl->setCurrentBlock(
"filter_select");
1962 $this->tpl->setVariable(
"HIDDEN_CMD_APPLY", $this->filter_cmd);
1964 $this->tpl->setVariable(
"FILTER_SELECTOR", $cb_over->getHTML(
false));
1965 $this->tpl->parseCurrentBlock();
1969 if ($ccnt > 0 || count($opt_filter) > 0) {
1970 $this->tpl->setVariable(
"TXT_FILTER",
$lng->txt(
"filter"));
1975 $this->tpl->touchBlock(
"filter_empty_cell");
1978 $this->tpl->setCurrentBlock(
"filter_row");
1979 $this->tpl->parseCurrentBlock();
1981 $this->tpl->setCurrentBlock(
"filter_buttons");
1982 $this->tpl->setVariable(
"CMD_APPLY", $this->filter_cmd);
1983 $this->tpl->setVariable(
"TXT_APPLY", $this->filter_cmd_txt
1984 ? $this->filter_cmd_txt
1985 :
$lng->txt(
"apply_filter"));
1986 $this->tpl->setVariable(
"CMD_RESET", $this->reset_cmd);
1987 $this->tpl->setVariable(
"TXT_RESET", $this->reset_cmd_txt
1988 ? $this->reset_cmd_txt
1989 :
$lng->txt(
"reset_filter"));
1990 } elseif (count($opt_filter) > 0) {
1991 $this->tpl->setCurrentBlock(
"optional_filter_hint");
1992 $this->tpl->setVariable(
'TXT_OPT_HINT',
$lng->txt(
'optional_filter_hint'));
1993 $this->tpl->parseCurrentBlock();
1996 $this->tpl->setCurrentBlock(
"filter_section");
1997 $this->tpl->setVariable(
"FIL_ID", $this->
getId());
1998 $this->tpl->parseCurrentBlock();
2003 $this->tpl->setCurrentBlock(
"filter_hidden");
2004 $this->tpl->setVariable(
"FI_ID", $this->
getId());
2005 $this->tpl->parseCurrentBlock();
2018 if ($prop ===
'0' || $prop ===
'1') {
2019 return (
bool) $prop;
2034 if ($item === $a_element) {
2046 $advmd_record_gui = null;
2047 if (method_exists($this,
"getAdvMDRecordGUI")) {
2048 $advmd_record_gui = $this->getAdvMDRecordGUI();
2052 if ($advmd_record_gui &&
2057 if ($item->checkInput()) {
2058 $item->setValueByArray(
$_POST);
2059 $item->writeToSession();
2063 if ($advmd_record_gui &&
2068 if ($item->checkInput()) {
2069 $item->setValueByArray(
$_POST);
2070 $item->writeToSession();
2074 if ($advmd_record_gui) {
2075 $advmd_record_gui->importFilter();
2079 unset($_REQUEST[
"tbltplcrt"]);
2080 unset($_REQUEST[
"tbltpldel"]);
2093 foreach ($filter as $item) {
2094 if ($item->checkInput()) {
2096 $item->setValueByArray([]);
2097 $item->clearFromSession();
2100 foreach ($opt_filter as $item) {
2101 if ($item->checkInput()) {
2103 $item->setValueByArray([]);
2104 $item->clearFromSession();
2109 unset($_REQUEST[
"tbltplcrt"]);
2110 unset($_REQUEST[
"tbltpldel"]);
2121 foreach ($a_set as $key => $value) {
2122 $this->tpl->setVariable(
"VAL_" . strtoupper($key), $value);
2134 if (isset($DIC[
"ilUser"])) {
2145 $this->tpl->setCurrentBlock(
"select_all_checkbox");
2146 $this->tpl->setVariable(
"SELECT_ALL_TXT_SELECT_ALL",
$lng->txt(
"select_all"));
2148 $this->tpl->setVariable(
"SELECT_ALL_FORM_NAME", $this->
getFormName());
2149 $this->tpl->setVariable(
"CHECKBOXNAME",
"chb_select_all_" . $this->unique_id);
2150 $this->tpl->parseCurrentBlock();
2154 if ($this->enabled[
"numinfo"] && $this->enabled[
"footer"]) {
2155 $start = $this->offset + 1;
2161 if ($end > $this->max_count or $this->limit == 0) {
2165 if ($this->max_count > 0) {
2166 if ($this->lang_support) {
2167 $numinfo =
"(" . $start .
" - " . $end .
" " . strtolower($this->lng->txt(
"of")) .
" " . $this->max_count .
")";
2169 $numinfo =
"(" . $start .
" - " . $end .
" of " . $this->max_count .
")";
2172 if ($this->max_count > 0) {
2174 $this->tpl->setCurrentBlock(
"tbl_footer_numinfo");
2175 $this->tpl->setVariable(
"NUMINFO", $numinfo);
2176 $this->tpl->parseCurrentBlock();
2183 if ($this->enabled[
"linkbar"] && $this->enabled[
"footer"] && $this->limit != 0
2184 && $this->max_count > 0) {
2186 "link" => $this->footer_style,
2187 "prev" => $this->footer_previous,
2188 "next" => $this->footer_next,
2193 $this->tpl->setCurrentBlock(
"tbl_footer_linkbar");
2194 $this->tpl->setVariable(
"LINKBAR", $linkbar);
2195 $this->tpl->parseCurrentBlock();
2205 $items[$k] = array(
"txt" =>
$c[
"txt"],
2208 include_once(
"./Services/UIComponent/CheckboxListOverlay/classes/class.ilCheckboxListOverlayGUI.php");
2210 $cb_over->setLinkTitle(
$lng->txt(
"columns"));
2211 $cb_over->setItems($items);
2215 $cb_over->setFieldVar(
"tblfs" . $this->
getId());
2216 $cb_over->setHiddenVar(
"tblfsh" . $this->
getId());
2217 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
2218 $column_selector = $cb_over->getHTML();
2224 if (isset($_REQUEST[
"tbltplcrt"]) && $_REQUEST[
"tbltplcrt"]) {
2226 ilUtil::sendSuccess(
$lng->txt(
"tbl_template_created"));
2228 } elseif (isset($_REQUEST[
"tbltpldel"]) && $_REQUEST[
"tbltpldel"]) {
2230 ilUtil::sendSuccess(
$lng->txt(
"tbl_template_deleted"));
2234 $create_id =
"template_create_overlay_" . $this->
getId();
2235 $delete_id =
"template_delete_overlay_" . $this->
getId();
2236 $list_id =
"template_stg_" . $this->
getId();
2238 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
2242 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
2245 if (
sizeof($templates)) {
2247 $overlay->setTrigger($list_id .
"_delete");
2248 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
2249 $overlay->setAutoHide(
false);
2252 $lng->loadLanguageModule(
"form");
2253 $this->tpl->setCurrentBlock(
"template_editor_delete_item");
2254 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE",
"");
2255 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION",
"- " .
$lng->txt(
"form_please_select") .
" -");
2256 $this->tpl->parseCurrentBlock();
2257 foreach ($templates as
$name) {
2258 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE", $name);
2259 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION", $name);
2260 $this->tpl->parseCurrentBlock();
2263 $this->tpl->setCurrentBlock(
"template_editor_delete");
2264 $this->tpl->setVariable(
"TEMPLATE_DELETE_ID", $delete_id);
2265 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE",
$lng->txt(
"tbl_template_delete"));
2266 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE_SUBMIT",
$lng->txt(
"delete"));
2267 $this->tpl->setVariable(
"TEMPLATE_DELETE_CMD", $this->parent_cmd);
2268 $this->tpl->parseCurrentBlock();
2274 $overlay->setTrigger($list_id .
"_create");
2275 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
2276 $overlay->setAutoHide(
false);
2279 $this->tpl->setCurrentBlock(
"template_editor");
2280 $this->tpl->setVariable(
"TEMPLATE_CREATE_ID", $create_id);
2281 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE",
$lng->txt(
"tbl_template_create"));
2282 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE_SUBMIT",
$lng->txt(
"save"));
2283 $this->tpl->setVariable(
"TEMPLATE_CREATE_CMD", $this->parent_cmd);
2284 $this->tpl->parseCurrentBlock();
2287 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2289 $alist->setId($list_id);
2290 $alist->addItem(
$lng->txt(
"tbl_template_create"),
"create",
"#");
2291 if (
sizeof($templates)) {
2292 $alist->addItem(
$lng->txt(
"tbl_template_delete"),
"delete",
"#");
2293 foreach ($templates as
$name) {
2294 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl", urlencode($name));
2295 $alist->addItem($name, $name,
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
2296 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl",
"");
2299 $alist->setListTitle(
$lng->txt(
"tbl_templates"));
2301 $this->tpl->setVariable(
"TEMPLATE_SELECTOR",
" " . $alist->getHTML());
2305 $this->tpl->setCurrentBlock(
"tbl_footer");
2306 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2308 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2310 $this->tpl->parseCurrentBlock();
2313 if ($numinfo !=
"" || $linkbar !=
"" || $column_selector !=
"" ||
2314 count($this->filters) > 0 || count($this->optional_filters) > 0) {
2315 if (is_object(
$ilUser) && (count($this->filters) || count($this->optional_filters))) {
2316 $this->tpl->setCurrentBlock(
"filter_activation");
2317 $this->tpl->setVariable(
"TXT_ACTIVATE_FILTER",
$lng->txt(
"show_filter"));
2318 $this->tpl->setVariable(
"FILA_ID", $this->
getId());
2319 if ($this->
getId() !=
"") {
2320 $this->tpl->setVariable(
"SAVE_URLA",
"./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" .
2321 $this->
getId() .
"&cmd=showFilter&user_id=" .
$ilUser->getId());
2323 $this->tpl->parseCurrentBlock();
2327 $this->tpl->setCurrentBlock(
"filter_deactivation");
2328 $this->tpl->setVariable(
"TXT_HIDE",
$lng->txt(
"hide_filter"));
2329 if ($this->
getId() !=
"") {
2330 $this->tpl->setVariable(
"SAVE_URL",
"./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" .
2331 $this->
getId() .
"&cmd=hideFilter&user_id=" .
$ilUser->getId());
2332 $this->tpl->setVariable(
"FILD_ID", $this->
getId());
2334 $this->tpl->parseCurrentBlock();
2339 $this->tpl->setCurrentBlock(
"top_numinfo");
2340 $this->tpl->setVariable(
"NUMINFO", $numinfo);
2341 $this->tpl->parseCurrentBlock();
2345 $this->tpl->setCurrentBlock(
"top_linkbar");
2346 $this->tpl->setVariable(
"LINKBAR", $linkbar);
2347 $this->tpl->parseCurrentBlock();
2351 $this->tpl->setVariable(
"COLUMN_SELECTOR", $column_selector);
2357 !$this->rows_selector_off) {
2358 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2361 $alist->setId(
"sellst_rows_" . $this->
getId());
2362 $hpp = (
$ilUser->getPref(
"hits_per_page") != 9999)
2363 ?
$ilUser->getPref(
"hits_per_page")
2364 :
$lng->txt(
"no_limit");
2366 $options = array(0 =>
$lng->txt(
"default") .
" (" . $hpp .
")",5 => 5, 10 => 10, 15 => 15, 20 => 20,
2367 30 => 30, 40 => 40, 50 => 50,
2368 100 => 100, 200 => 200, 400 => 400, 800 => 800);
2369 foreach ($options as $k => $v) {
2370 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows", $k);
2371 $alist->addItem($v, $k,
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
2372 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows",
"");
2375 $this->tpl->setVariable(
"ROW_SELECTOR", $alist->getHTML());
2379 if (
sizeof($this->export_formats) && $this->
dataExists()) {
2380 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2383 $alist->setId(
"sellst_xpt");
2384 foreach ($this->export_formats as
$format => $caption_lng_id) {
2385 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
$format);
2386 $url =
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
2387 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
"");
2390 $alist->setListTitle(
$lng->txt(
"export"));
2391 $this->tpl->setVariable(
"EXPORT_SELECTOR",
" " . $alist->getHTML());
2394 $this->tpl->setCurrentBlock(
"top_navigation");
2395 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2397 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2399 $this->tpl->parseCurrentBlock();
2421 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
2425 $link =
$ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd) .
2430 $layout_prev =
$lng->txt(
"previous");
2431 $layout_next =
$lng->txt(
"next");
2434 if ($this->max_count > $this->
getLimit() || $this->custom_prev_next) {
2435 $sep =
"<span> | </span>";
2438 $pages = intval($this->max_count / $this->
getLimit());
2441 if (($this->max_count % $this->
getLimit())) {
2446 $offset_arr = array();
2447 for (
$i = 1 ;
$i <= $pages ;
$i++) {
2451 $offset_arr[$nav_value] =
$i;
2454 $sep =
"<span> </span>";
2457 if ($this->custom_prev_next && $this->custom_prev !=
"") {
2458 if ($LinkBar !=
"") {
2461 $LinkBar .=
"<a href=\"" . $this->custom_prev . $hash .
"\">" . $layout_prev .
"</a>";
2462 } elseif ($this->
getOffset() >= 1 && !$this->custom_prev_next) {
2463 if ($LinkBar !=
"") {
2467 $LinkBar .=
"<a href=\"" . $link . $prevoffset . $hash .
"\">" . $layout_prev .
"</a>";
2469 if ($LinkBar !=
"") {
2472 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_prev .
"</span>";
2476 if ($a_num ==
"1") {
2477 $LinkBar .=
'<input type="hidden" name="' . $this->
getNavParameter() .
2481 $sep =
"<span> | </span>";
2484 if ($this->custom_prev_next && $this->custom_next !=
"") {
2485 if ($LinkBar !=
"") {
2488 $LinkBar .=
"<a href=\"" . $this->custom_next . $hash .
"\">" . $layout_next .
"</a>";
2489 } elseif (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1) &&
2490 !$this->custom_prev_next) {
2491 if ($LinkBar !=
"") {
2495 $LinkBar .=
"<a href=\"" . $link . $newoffset . $hash .
"\">" . $layout_next .
"</a>";
2497 if ($LinkBar !=
"") {
2500 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_next .
"</span>";
2503 $sep =
"<span> </span>";
2505 if (count($offset_arr) && !$this->
getDisplayAsBlock() && !$this->custom_prev_next) {
2506 if ($LinkBar !=
"") {
2510 '<label for="tab_page_sel_' . $a_num .
'">' .
$lng->txt(
"page") .
'</label> ' .
2519 array(
"id" =>
"tab_page_sel_" . $a_num,
2520 "onchange" =>
"ilTablePageSelection(this, 'cmd[" . $this->parent_cmd .
"]')")
2534 $hidden_row =
false;
2535 if (count($this->hidden_inputs)) {
2536 foreach ($this->hidden_inputs as $hidden_input) {
2537 $this->tpl->setCurrentBlock(
"tbl_hidden_field");
2538 $this->tpl->setVariable(
"FIELD_NAME", $hidden_input[
"name"]);
2539 $this->tpl->setVariable(
"FIELD_VALUE", $hidden_input[
"value"]);
2540 $this->tpl->parseCurrentBlock();
2543 $this->tpl->setCurrentBlock(
"tbl_hidden_row");
2544 $this->tpl->parseCurrentBlock();
2556 $action_row =
false;
2560 if (count($this->sel_buttons) > 0) {
2561 foreach ($this->sel_buttons as $button) {
2562 $this->tpl->setCurrentBlock(
"sel_button");
2563 $this->tpl->setVariable(
2566 $button[
"selected"],
2573 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2574 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2575 $this->tpl->parseCurrentBlock();
2578 $this->tpl->setCurrentBlock(
"sel_top_button");
2579 $this->tpl->setVariable(
2582 $button[
"selected"],
2589 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2590 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2591 $this->tpl->parseCurrentBlock();
2597 $this->sel_buttons[] = array(
"options" => $a_options,
"cmd" => $a_cmd,
"text" => $a_text);
2600 if (count($this->buttons) > 0) {
2601 foreach ($this->buttons as $button) {
2602 if (!is_array($button)) {
2604 $this->tpl->setVariable(
'BUTTON_OBJ', $button->render());
2607 $button = clone $button;
2609 $this->tpl->setVariable(
'BUTTON_TOP_OBJ', $button->render());
2614 if (strlen($button[
'onclick'])) {
2615 $this->tpl->setCurrentBlock(
'cmdonclick');
2616 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2617 $this->tpl->parseCurrentBlock();
2619 $this->tpl->setCurrentBlock(
"plain_button");
2620 if ($button[
"id"] !=
"") {
2621 $this->tpl->setVariable(
"PBID",
' id="' . $button[
"id"] .
'" ');
2623 if ($button[
"class"] !=
"") {
2624 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2626 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2627 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2628 $this->tpl->parseCurrentBlock();
2631 if (strlen($button[
'onclick'])) {
2632 $this->tpl->setCurrentBlock(
'top_cmdonclick');
2633 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2634 $this->tpl->parseCurrentBlock();
2636 $this->tpl->setCurrentBlock(
"plain_top_button");
2637 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2638 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2639 if ($button[
"class"] !=
"") {
2640 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2642 $this->tpl->parseCurrentBlock();
2651 if (count($this->mi_sel_buttons)) {
2652 foreach ($this->mi_sel_buttons as $button) {
2653 $this->tpl->setCurrentBlock(
"mi_sel_button");
2654 $this->tpl->setVariable(
2657 $button[
"selected"],
2664 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2665 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2666 $this->tpl->parseCurrentBlock();
2669 $this->tpl->setCurrentBlock(
"mi_top_sel_button");
2670 $this->tpl->setVariable(
2673 $button[
"selected"],
2674 $button[
"sel_var"] .
"_2",
2680 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2681 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2682 $this->tpl->parseCurrentBlock();
2690 if (count($this->multi) > 1 && $this->
dataExists()) {
2691 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2692 $this->tpl->setCurrentBlock(
"tbl_cmd_select_all");
2693 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2694 $this->tpl->parseCurrentBlock();
2697 $this->tpl->setCurrentBlock(
"tbl_cmd_select");
2699 foreach ($this->multi as $mc) {
2700 $sel[$mc[
"cmd"]] = $mc[
"text"];
2702 $this->tpl->setVariable(
2706 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2707 $this->tpl->parseCurrentBlock();
2712 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2713 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select_all");
2714 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2715 $this->tpl->parseCurrentBlock();
2718 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select");
2720 foreach ($this->multi as $mc) {
2721 $sel[$mc[
"cmd"]] = $mc[
"text"];
2723 $this->tpl->setVariable(
2727 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2728 $this->tpl->parseCurrentBlock();
2730 } elseif (count($this->multi) == 1 && $this->
dataExists()) {
2731 $this->tpl->setCurrentBlock(
"tbl_single_cmd");
2733 foreach ($this->multi as $mc) {
2737 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2738 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2739 $this->tpl->parseCurrentBlock();
2744 $this->tpl->setCurrentBlock(
"tbl_top_single_cmd");
2746 foreach ($this->multi as $mc) {
2750 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2751 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2752 $this->tpl->parseCurrentBlock();
2757 $this->tpl->setCurrentBlock(
"tbl_action_img_arrow");
2759 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2760 $this->tpl->parseCurrentBlock();
2763 $this->tpl->setCurrentBlock(
"tbl_top_action_img_arrow");
2765 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2766 $this->tpl->parseCurrentBlock();
2771 $this->tpl->setCurrentBlock(
"tbl_action_row");
2772 $this->tpl->parseCurrentBlock();
2774 $this->tpl->setCurrentBlock(
"tbl_top_action_row");
2775 $this->tpl->parseCurrentBlock();
2787 $this->headerHTML = $html;
2801 if (isset($DIC[
"ilUser"])) {
2806 include_once(
"./Services/Table/classes/class.ilTablePropertiesStorage.php");
2824 if (isset($DIC[
"ilUser"])) {
2829 include_once(
"./Services/Table/classes/class.ilTablePropertiesStorage.php");
2863 if ($this->filters) {
2864 foreach ($this->filters as $item) {
2868 if ($this->optional_filters &&
$result[
"selfilters"]) {
2869 foreach ($this->optional_filters as $item) {
2870 if (in_array($item->getFieldId(),
$result[
"selfilters"])) {
2887 if (method_exists($a_item,
"getChecked")) {
2888 return $a_item->getChecked();
2889 } elseif (method_exists($a_item,
"getValue")) {
2890 return $a_item->getValue();
2891 } elseif (method_exists($a_item,
"getDate")) {
2904 if (method_exists($a_item,
"setChecked")) {
2905 $a_item->setChecked($a_value);
2906 } elseif (method_exists($a_item,
"setValue")) {
2907 $a_item->setValue($a_value);
2908 } elseif (method_exists($a_item,
"setDate")) {
2922 $this->context = $id;
2943 $this->show_rows_selector = (bool) $a_value;
2963 $this->show_templates = (bool) $a_value;
2991 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
2995 if (is_array(
$data)) {
2996 foreach (
$data as $property => $value) {
3001 $data[
"filter_values"] = unserialize(
$data[
"filter_values"]);
3002 if (
$data[
"filter_values"]) {
3003 $this->restore_filter_values =
$data[
"filter_values"];
3006 $this->restore_filter =
true;
3028 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
3032 $state[
"filter_values"] = serialize($state[
"filter_values"]);
3033 $state[
"selfields"] = serialize($state[
"selfields"]);
3034 $state[
"selfilters"] = serialize($state[
"selfilters"]);
3057 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
3073 return parent::getLimit();
3084 return parent::getOffset();
3094 $this->export_formats = array();
3097 $valid = array(self::EXPORT_EXCEL =>
"tbl_export_excel",
3098 self::EXPORT_CSV =>
"tbl_export_csv");
3100 foreach ($formats as
$format) {
3101 if (array_key_exists($format,
$valid)) {
3113 $this->print_mode = (bool) $a_value;
3158 case self::EXPORT_EXCEL:
3159 include_once
"./Services/Excel/classes/class.ilExcel.php";
3161 $excel->addSheet($this->title
3163 : $this->lng->txt(
"export"));
3176 foreach ($this->row_data as $set) {
3189 case self::EXPORT_CSV:
3190 include_once
"./Services/Utilities/classes/class.ilCSVWriter.php";
3192 $csv->setSeparator(
";");
3197 foreach ($this->row_data as $set) {
3204 header(
"Content-type: text/comma-separated-values");
3205 header(
"Content-Disposition: attachment; filename=\"" .
$filename .
"\"");
3206 header(
"Expires: 0");
3207 header(
"Cache-Control: must-revalidate, post-check=0,pre-check=0");
3208 header(
"Pragma: public");
3209 echo $csv->getCSVString();
3211 file_put_contents(
$filename, $csv->getCSVString());
3243 foreach ($this->column as $column) {
3244 $title = strip_tags($column[
"text"]);
3263 foreach ($a_set as $value) {
3264 if (is_array($value)) {
3265 $value = implode(
', ', $value);
3267 $a_excel->
setCell($a_row, $col++, $value);
3289 foreach ($this->column as $column) {
3290 $title = strip_tags($column[
"text"]);
3292 $a_csv->addColumn(
$title);
3307 foreach ($a_set as $key => $value) {
3308 if (is_array($value)) {
3309 $value = implode(
', ', $value);
3311 $a_csv->addColumn(strip_tags($value));
3323 $this->enable_command_for_all = (bool) $a_value;
3335 $ilClientIniFile = $DIC[
"ilClientIniFile"];
3337 $limit = $ilClientIniFile->readVariable(
"system",
"TABLE_ACTION_ALL_LIMIT");
3339 $limit = self::ACTION_ALL_LIMIT;
3369 $this->prevent_double_submission = $a_val;
3382 public function setLimit($a_limit = 0, $a_default_limit = 0)
3384 parent::setLimit($a_limit, $a_default_limit);
3387 if ($a_limit == 9999 &&
3388 $this->limit_determined) {
3389 $this->rows_selector_off =
true;
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
setRowSelectorLabel($row_selector_label)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
setDescription($a_val)
Set description.
getExternalSorting()
Get external sorting.
fillHeaderExcel(ilExcel $a_excel, &$a_row)
Excel Version of Fill Header.
prepareOutput()
Anything that must be done before HTML is generated.
setExternalSorting($a_val)
Set external sorting.
__construct($a_parent_obj, $a_parent_cmd="", $a_template_context="")
ilTable2GUI constructor.
getDefaultOrderField()
Get Default order field.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
addHiddenInput($a_name, $a_value)
Add Hidden Input field.
getTopAnchor()
Get top anchor.
getTopCommands()
Get top commands (display command buttons on top of table, too)
addCommandButtonInstance(ilButtonBase $a_button)
Add Command button instance.
getColumnCount()
Returns the column count based on the number of the header row columns public.
setDisplayAsBlock($a_val)
Set display as block.
getSelectAllCheckbox()
Get the name of the checkbox that should be toggled with a select all button.
getFilterCommand()
Get filter command.
getSelectableColumns()
Get selectable columns.
setOffset($a_offset)
set dataset offset public
setPrintMode($a_value=false)
Toogle print mode.
renderFilter()
Render Filter section.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
Excel Version of Fill Row.
$prevent_double_submission
setShowTemplates($a_value)
Toggle templates.
storeProperty($type, $value)
Store table property.
getIsDataTable()
Get is data table.
setEnableNumInfo($a_val)
Set enable num info.
getFilterValue(ilFormPropertyGUI $a_item)
Get current filter value.
setFilterCols($a_val)
Set filter columns.
setExternalSegmentation($a_val)
Set external segmentation.
determineSelectedColumns()
Determine selected columns.
exportData($format, $send=false)
Export and optionally send current table data.
resetOffset($a_in_determination=false)
Reset offset.
getFilterItemByPostVar($a_post_var)
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static setUseRelativeDates($a_status)
set use relative dates
setIsDataTable($a_val)
Set is data table.
getFormName()
Get Form name.
Saves (mostly asynchronously) user properties of tables (e.g.
setFooter($a_style, $a_previous=0, $a_next=0)
set order direction public
determineLimit()
Determine the limit.
getOpenFormTag()
Get open form tag.
setDefaultFilterVisiblity($a_status)
Set default filter visiblity.
deleteTemplate($a_name)
Delete template.
getParentCmd()
Get parent command.
getOrderDirection()
Get order direction.
getLinkbar($a_num)
Get previous/next linkbar.
setNoEntriesText($a_text)
Set text for an empty table.
fillFooter()
Fill footer row.
getParentObject()
Get parent object.
const FILTER_NUMBER_RANGE
getDescription()
Get description.
saveTemplate($a_name)
Save current state as template.
getDisplayAsBlock()
Get display as block.
addHeaderCommand($a_href, $a_text, $a_target="", $a_img="")
Add Header Command (Link) (Image needed for now)
Saves (mostly asynchronously) user properties of tables (e.g.
fillActionRow()
Fill Action Row.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
getShowRowsSelector()
Get rows-per-page selector state.
getDefaultOrderDirection()
Get Default order direction.
setOrderLink($sort_field, $order_dir)
getFilterElements($a_only_non_empty=true)
Get SQL conditions for current filter value(s)
getShowTemplates()
Get template state.
setOrderDirection($a_order_direction)
set order direction public
setOrderField($a_order_field)
set order column
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
const FILTER_DATETIME_RANGE
isFilterVisible()
Check if filter is visible: manually shown (session, db) or default value set.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
getColumnCoord($a_col)
Get column "name" from number.
setBold($a_coords)
Set cell(s) to bold.
fillMetaCSV($a_csv)
Add meta information to csv export.
getDisableFilterHiding()
Get disable filter hiding.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
restoreTemplate($a_name)
Restore state from template.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
const FILTER_DURATION_RANGE
numericOrdering($a_field)
Should this field be sorted numeric?
getExternalSegmentation()
Get external segmentation.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static getAllCommandLimit()
Get maximum number of entries to enable actions for all.
This is a utility class for the yui overlays.
$default_filter_visibility
setCustomPreviousNext($a_prev_link, $a_next_link)
Set custom previous/next links.
setHeaderHTML($html)
set header html
User interface class for a checkbox list overlay.
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
getFormAction()
Get Form action parameter.
isAdvMDFilter(ilAdvancedMDRecordGUI $a_gui, $a_element)
Check if filter element is based on adv md.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getPreventDoubleSubmission()
Get prevent double submission.
getEnableHeader()
Get Enable Header.
SetFilterValue(ilFormPropertyGUI $a_item, $a_value)
Set current filter value.
setEnableAllCommand($a_value)
Enable actions for all entries in current result.
addSelectionButton($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
Add Selection List + Command button.
getEnableTitle()
Get Enable Title.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
getNoEntriesText()
Get text for an empty table.
writeFilterToSession()
Write filter values to session.
executeCommand()
Execute command.
isColumnSelected($a_col)
Is given column selected?
isFilterSelected($a_col)
Is given filter selected?
render()
render table public
addMultiItemSelectionButton($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
Add Selection List + Command button for selected items.
getResetCommand()
Get reset filter command.
setContext($id)
Set context.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
determineSelectedFilters()
Determine selected filters.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
getEnableNumInfo()
Get enable num info.
getSelectedFilters()
Get selected filters.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
getFilterCols()
Get filter columns.
setFormName($a_formname="")
Set Form name.
__construct(Container $dic, ilPlugin $plugin)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getPrintMode()
Get print mode.
getCurrentState()
get current settings for order, limit, columns and filter
setOpenFormTag($a_val)
Set open form tag.
setEnableHeader($a_enableheader)
Set Enable Header.
loadProperty($type)
Load table property.
fillRow($a_set)
Standard Version of Fill Row.
setCloseCommand($a_link)
Add command for closing table.
fillHeaderCSV($a_csv)
CSV Version of Fill Header.
setMaxCount($a_max_count)
set max.
getCloseFormTag()
Get close form tag.
fillMetaExcel(ilExcel $a_excel, &$a_row)
Add meta information to excel export.
getExportMode()
Was export activated?
getFilterItems($a_optionals=false)
Get filter items.
setEnableTitle($a_enabletitle)
Set Enable Title.
getDefaultFilterVisibility()
Get default filter visibility.
resetFilter()
Reset filter.
setPreventDoubleSubmission($a_val)
Set prevent double submission.
setTopAnchor($a_val)
Set top anchor.
setCloseFormTag($a_val)
Set close form tag.
setLimit($a_limit=0, $a_default_limit=0)
fillRowCSV($a_csv, $a_set)
CSV Version of Fill Row.
setFilterCommand($a_val, $a_caption=null)
Set filter command.