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();
131 parent::__construct(0,
false);
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;
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();
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");
705 foreach (
$lng->getInstalledLanguages() as $lang_key) {
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());
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()) {
2095 $item->setValueByArray(
$_POST);
2096 $item->clearFromSession();
2099 foreach ($opt_filter as $item) {
2100 if ($item->checkInput()) {
2101 $item->setValueByArray(
$_POST);
2102 $item->clearFromSession();
2107 unset($_REQUEST[
"tbltplcrt"]);
2108 unset($_REQUEST[
"tbltpldel"]);
2119 foreach ($a_set as
$key => $value) {
2120 $this->tpl->setVariable(
"VAL_" . strtoupper(
$key), $value);
2132 if (isset($DIC[
"ilUser"])) {
2143 $this->tpl->setCurrentBlock(
"select_all_checkbox");
2144 $this->tpl->setVariable(
"SELECT_ALL_TXT_SELECT_ALL",
$lng->txt(
"select_all"));
2146 $this->tpl->setVariable(
"SELECT_ALL_FORM_NAME", $this->
getFormName());
2147 $this->tpl->setVariable(
"CHECKBOXNAME",
"chb_select_all_" . $this->unique_id);
2148 $this->tpl->parseCurrentBlock();
2152 if ($this->enabled[
"numinfo"] && $this->enabled[
"footer"]) {
2153 $start = $this->offset + 1;
2159 if (
$end > $this->max_count
or $this->limit == 0) {
2163 if ($this->max_count > 0) {
2164 if ($this->lang_support) {
2165 $numinfo =
"(" .
$start .
" - " .
$end .
" " . strtolower($this->lng->txt(
"of")) .
" " . $this->max_count .
")";
2167 $numinfo =
"(" .
$start .
" - " .
$end .
" of " . $this->max_count .
")";
2170 if ($this->max_count > 0) {
2172 $this->tpl->setCurrentBlock(
"tbl_footer_numinfo");
2173 $this->tpl->setVariable(
"NUMINFO", $numinfo);
2174 $this->tpl->parseCurrentBlock();
2181 if ($this->enabled[
"linkbar"] && $this->enabled[
"footer"] && $this->limit != 0
2182 && $this->max_count > 0) {
2184 "link" => $this->footer_style,
2185 "prev" => $this->footer_previous,
2186 "next" => $this->footer_next,
2191 $this->tpl->setCurrentBlock(
"tbl_footer_linkbar");
2192 $this->tpl->setVariable(
"LINKBAR", $linkbar);
2193 $this->tpl->parseCurrentBlock();
2203 $items[$k] = array(
"txt" =>
$c[
"txt"],
2206 include_once(
"./Services/UIComponent/CheckboxListOverlay/classes/class.ilCheckboxListOverlayGUI.php");
2208 $cb_over->setLinkTitle(
$lng->txt(
"columns"));
2209 $cb_over->setItems($items);
2213 $cb_over->setFieldVar(
"tblfs" . $this->
getId());
2214 $cb_over->setHiddenVar(
"tblfsh" . $this->
getId());
2215 $cb_over->setSelectionHeaderClass(
"ilTableMenuItem");
2216 $column_selector = $cb_over->getHTML();
2222 if (isset($_REQUEST[
"tbltplcrt"]) && $_REQUEST[
"tbltplcrt"]) {
2224 ilUtil::sendSuccess(
$lng->txt(
"tbl_template_created"));
2226 } elseif (isset($_REQUEST[
"tbltpldel"]) && $_REQUEST[
"tbltpldel"]) {
2228 ilUtil::sendSuccess(
$lng->txt(
"tbl_template_deleted"));
2232 $create_id =
"template_create_overlay_" . $this->
getId();
2233 $delete_id =
"template_delete_overlay_" . $this->
getId();
2234 $list_id =
"template_stg_" . $this->
getId();
2236 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
2240 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
2243 if (
sizeof($templates)) {
2245 $overlay->setTrigger($list_id .
"_delete");
2246 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
2247 $overlay->setAutoHide(
false);
2250 $lng->loadLanguageModule(
"form");
2251 $this->tpl->setCurrentBlock(
"template_editor_delete_item");
2252 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE",
"");
2253 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION",
"- " .
$lng->txt(
"form_please_select") .
" -");
2254 $this->tpl->parseCurrentBlock();
2255 foreach ($templates as
$name) {
2256 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION_VALUE", $name);
2257 $this->tpl->setVariable(
"TEMPLATE_DELETE_OPTION", $name);
2258 $this->tpl->parseCurrentBlock();
2261 $this->tpl->setCurrentBlock(
"template_editor_delete");
2262 $this->tpl->setVariable(
"TEMPLATE_DELETE_ID", $delete_id);
2263 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE",
$lng->txt(
"tbl_template_delete"));
2264 $this->tpl->setVariable(
"TXT_TEMPLATE_DELETE_SUBMIT",
$lng->txt(
"delete"));
2265 $this->tpl->setVariable(
"TEMPLATE_DELETE_CMD", $this->parent_cmd);
2266 $this->tpl->parseCurrentBlock();
2272 $overlay->setTrigger($list_id .
"_create");
2273 $overlay->setAnchor(
"ilAdvSelListAnchorElement_" . $list_id);
2274 $overlay->setAutoHide(
false);
2277 $this->tpl->setCurrentBlock(
"template_editor");
2278 $this->tpl->setVariable(
"TEMPLATE_CREATE_ID", $create_id);
2279 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE",
$lng->txt(
"tbl_template_create"));
2280 $this->tpl->setVariable(
"TXT_TEMPLATE_CREATE_SUBMIT",
$lng->txt(
"save"));
2281 $this->tpl->setVariable(
"TEMPLATE_CREATE_CMD", $this->parent_cmd);
2282 $this->tpl->parseCurrentBlock();
2285 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2287 $alist->setId($list_id);
2288 $alist->addItem(
$lng->txt(
"tbl_template_create"),
"create",
"#");
2289 if (
sizeof($templates)) {
2290 $alist->addItem(
$lng->txt(
"tbl_template_delete"),
"delete",
"#");
2291 foreach ($templates as
$name) {
2292 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl", urlencode($name));
2293 $alist->addItem($name, $name,
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
2294 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_tpl",
"");
2297 $alist->setListTitle(
$lng->txt(
"tbl_templates"));
2299 $this->tpl->setVariable(
"TEMPLATE_SELECTOR",
" " . $alist->getHTML());
2303 $this->tpl->setCurrentBlock(
"tbl_footer");
2304 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2306 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2308 $this->tpl->parseCurrentBlock();
2311 if ($numinfo !=
"" || $linkbar !=
"" || $column_selector !=
"" ||
2312 count($this->filters) > 0 || count($this->optional_filters) > 0) {
2313 if (is_object(
$ilUser) && (count($this->filters) || count($this->optional_filters))) {
2314 $this->tpl->setCurrentBlock(
"filter_activation");
2315 $this->tpl->setVariable(
"TXT_ACTIVATE_FILTER",
$lng->txt(
"show_filter"));
2316 $this->tpl->setVariable(
"FILA_ID", $this->
getId());
2317 if ($this->
getId() !=
"") {
2318 $this->tpl->setVariable(
"SAVE_URLA",
"./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" .
2319 $this->
getId() .
"&cmd=showFilter&user_id=" .
$ilUser->getId());
2321 $this->tpl->parseCurrentBlock();
2325 $this->tpl->setCurrentBlock(
"filter_deactivation");
2326 $this->tpl->setVariable(
"TXT_HIDE",
$lng->txt(
"hide_filter"));
2327 if ($this->
getId() !=
"") {
2328 $this->tpl->setVariable(
"SAVE_URL",
"./ilias.php?baseClass=ilTablePropertiesStorage&table_id=" .
2329 $this->
getId() .
"&cmd=hideFilter&user_id=" .
$ilUser->getId());
2330 $this->tpl->setVariable(
"FILD_ID", $this->
getId());
2332 $this->tpl->parseCurrentBlock();
2337 $this->tpl->setCurrentBlock(
"top_numinfo");
2338 $this->tpl->setVariable(
"NUMINFO", $numinfo);
2339 $this->tpl->parseCurrentBlock();
2343 $this->tpl->setCurrentBlock(
"top_linkbar");
2344 $this->tpl->setVariable(
"LINKBAR", $linkbar);
2345 $this->tpl->parseCurrentBlock();
2349 $this->tpl->setVariable(
"COLUMN_SELECTOR", $column_selector);
2355 !$this->rows_selector_off) {
2356 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2359 $alist->setId(
"sellst_rows_" . $this->
getId());
2360 $hpp = (
$ilUser->getPref(
"hits_per_page") != 9999)
2361 ?
$ilUser->getPref(
"hits_per_page")
2362 :
$lng->txt(
"no_limit");
2364 $options = array(0 =>
$lng->txt(
"default") .
" (" . $hpp .
")",5 => 5, 10 => 10, 15 => 15, 20 => 20,
2365 30 => 30, 40 => 40, 50 => 50,
2366 100 => 100, 200 => 200, 400 => 400, 800 => 800);
2368 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows", $k);
2369 $alist->addItem($v, $k,
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
2370 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_trows",
"");
2373 $this->tpl->setVariable(
"ROW_SELECTOR", $alist->getHTML());
2377 if (
sizeof($this->export_formats) && $this->
dataExists()) {
2378 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2381 $alist->setId(
"sellst_xpt");
2382 foreach ($this->export_formats as
$format => $caption_lng_id) {
2383 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
$format);
2384 $url =
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd);
2385 $ilCtrl->setParameter($this->parent_obj, $this->prefix .
"_xpt",
"");
2388 $alist->setListTitle(
$lng->txt(
"export"));
2389 $this->tpl->setVariable(
"EXPORT_SELECTOR",
" " . $alist->getHTML());
2392 $this->tpl->setCurrentBlock(
"top_navigation");
2393 $this->tpl->setVariable(
"COLUMN_COUNT", $this->
getColumnCount());
2395 $this->tpl->setVariable(
"BLK_CLASS",
"Block");
2397 $this->tpl->parseCurrentBlock();
2419 if (is_object(
$ilUser) &&
$ilUser->getPref(
"screen_reader_optimization")) {
2423 $link =
$ilCtrl->getLinkTargetByClass(get_class($this->parent_obj), $this->parent_cmd) .
2428 $layout_prev =
$lng->txt(
"previous");
2429 $layout_next =
$lng->txt(
"next");
2432 if ($this->max_count > $this->
getLimit() || $this->custom_prev_next) {
2433 $sep =
"<span> | </span>";
2436 $pages = intval($this->max_count / $this->
getLimit());
2439 if (($this->max_count % $this->
getLimit())) {
2444 $offset_arr = array();
2445 for (
$i = 1 ;
$i <= $pages ;
$i++) {
2449 $offset_arr[$nav_value] =
$i;
2452 $sep =
"<span> </span>";
2455 if ($this->custom_prev_next && $this->custom_prev !=
"") {
2456 if ($LinkBar !=
"") {
2459 $LinkBar .=
"<a href=\"" . $this->custom_prev . $hash .
"\">" . $layout_prev .
"</a>";
2460 } elseif ($this->
getOffset() >= 1 && !$this->custom_prev_next) {
2461 if ($LinkBar !=
"") {
2465 $LinkBar .=
"<a href=\"" . $link . $prevoffset . $hash .
"\">" . $layout_prev .
"</a>";
2467 if ($LinkBar !=
"") {
2470 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_prev .
"</span>";
2474 if ($a_num ==
"1") {
2475 $LinkBar .=
'<input type="hidden" name="' . $this->
getNavParameter() .
2479 $sep =
"<span> | </span>";
2482 if ($this->custom_prev_next && $this->custom_next !=
"") {
2483 if ($LinkBar !=
"") {
2486 $LinkBar .=
"<a href=\"" . $this->custom_next . $hash .
"\">" . $layout_next .
"</a>";
2487 } elseif (!(($this->
getOffset() / $this->
getLimit()) == ($pages - 1)) && ($pages != 1) &&
2488 !$this->custom_prev_next) {
2489 if ($LinkBar !=
"") {
2493 $LinkBar .=
"<a href=\"" . $link . $newoffset . $hash .
"\">" . $layout_next .
"</a>";
2495 if ($LinkBar !=
"") {
2498 $LinkBar .=
'<span class="ilTableFootLight">' . $layout_next .
"</span>";
2501 $sep =
"<span> </span>";
2503 if (count($offset_arr) && !$this->
getDisplayAsBlock() && !$this->custom_prev_next) {
2504 if ($LinkBar !=
"") {
2508 '<label for="tab_page_sel_' . $a_num .
'">' .
$lng->txt(
"page") .
'</label> ' .
2517 array(
"id" =>
"tab_page_sel_" . $a_num,
2518 "onchange" =>
"ilTablePageSelection(this, 'cmd[" . $this->parent_cmd .
"]')")
2532 $hidden_row =
false;
2533 if (count($this->hidden_inputs)) {
2534 foreach ($this->hidden_inputs as $hidden_input) {
2535 $this->tpl->setCurrentBlock(
"tbl_hidden_field");
2536 $this->tpl->setVariable(
"FIELD_NAME", $hidden_input[
"name"]);
2537 $this->tpl->setVariable(
"FIELD_VALUE", $hidden_input[
"value"]);
2538 $this->tpl->parseCurrentBlock();
2541 $this->tpl->setCurrentBlock(
"tbl_hidden_row");
2542 $this->tpl->parseCurrentBlock();
2554 $action_row =
false;
2558 if (count($this->sel_buttons) > 0) {
2559 foreach ($this->sel_buttons as $button) {
2560 $this->tpl->setCurrentBlock(
"sel_button");
2561 $this->tpl->setVariable(
2564 $button[
"selected"],
2571 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2572 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2573 $this->tpl->parseCurrentBlock();
2576 $this->tpl->setCurrentBlock(
"sel_top_button");
2577 $this->tpl->setVariable(
2580 $button[
"selected"],
2587 $this->tpl->setVariable(
"SBTN_NAME", $button[
"cmd"]);
2588 $this->tpl->setVariable(
"SBTN_VALUE", $button[
"text"]);
2589 $this->tpl->parseCurrentBlock();
2595 $this->sel_buttons[] = array(
"options" => $a_options,
"cmd" => $a_cmd,
"text" => $a_text);
2598 if (count($this->buttons) > 0) {
2599 foreach ($this->buttons as $button) {
2600 if (!is_array($button)) {
2602 $this->tpl->setVariable(
'BUTTON_OBJ', $button->render());
2605 $button = clone $button;
2607 $this->tpl->setVariable(
'BUTTON_TOP_OBJ', $button->render());
2612 if (strlen($button[
'onclick'])) {
2613 $this->tpl->setCurrentBlock(
'cmdonclick');
2614 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2615 $this->tpl->parseCurrentBlock();
2617 $this->tpl->setCurrentBlock(
"plain_button");
2618 if ($button[
"id"] !=
"") {
2619 $this->tpl->setVariable(
"PBID",
' id="' . $button[
"id"] .
'" ');
2621 if ($button[
"class"] !=
"") {
2622 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2624 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2625 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2626 $this->tpl->parseCurrentBlock();
2629 if (strlen($button[
'onclick'])) {
2630 $this->tpl->setCurrentBlock(
'top_cmdonclick');
2631 $this->tpl->setVariable(
'CMD_ONCLICK', $button[
'onclick']);
2632 $this->tpl->parseCurrentBlock();
2634 $this->tpl->setCurrentBlock(
"plain_top_button");
2635 $this->tpl->setVariable(
"PBTN_NAME", $button[
"cmd"]);
2636 $this->tpl->setVariable(
"PBTN_VALUE", $button[
"text"]);
2637 if ($button[
"class"] !=
"") {
2638 $this->tpl->setVariable(
"PBBT_CLASS",
' ' . $button[
"class"]);
2640 $this->tpl->parseCurrentBlock();
2649 if (count($this->mi_sel_buttons)) {
2650 foreach ($this->mi_sel_buttons as $button) {
2651 $this->tpl->setCurrentBlock(
"mi_sel_button");
2652 $this->tpl->setVariable(
2655 $button[
"selected"],
2662 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2663 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2664 $this->tpl->parseCurrentBlock();
2667 $this->tpl->setCurrentBlock(
"mi_top_sel_button");
2668 $this->tpl->setVariable(
2671 $button[
"selected"],
2672 $button[
"sel_var"] .
"_2",
2678 $this->tpl->setVariable(
"MI_BTN_NAME", $button[
"cmd"]);
2679 $this->tpl->setVariable(
"MI_BTN_VALUE", $button[
"text"]);
2680 $this->tpl->parseCurrentBlock();
2688 if (count($this->multi) > 1 && $this->
dataExists()) {
2689 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2690 $this->tpl->setCurrentBlock(
"tbl_cmd_select_all");
2691 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2692 $this->tpl->parseCurrentBlock();
2695 $this->tpl->setCurrentBlock(
"tbl_cmd_select");
2697 foreach ($this->multi as $mc) {
2698 $sel[$mc[
"cmd"]] = $mc[
"text"];
2700 $this->tpl->setVariable(
2704 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2705 $this->tpl->parseCurrentBlock();
2710 if ($this->enable_command_for_all && $this->max_count <= self::getAllCommandLimit()) {
2711 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select_all");
2712 $this->tpl->setVariable(
"TXT_SELECT_CMD_ALL",
$lng->txt(
"all_objects"));
2713 $this->tpl->parseCurrentBlock();
2716 $this->tpl->setCurrentBlock(
"tbl_top_cmd_select");
2718 foreach ($this->multi as $mc) {
2719 $sel[$mc[
"cmd"]] = $mc[
"text"];
2721 $this->tpl->setVariable(
2725 $this->tpl->setVariable(
"TXT_EXECUTE",
$lng->txt(
"execute"));
2726 $this->tpl->parseCurrentBlock();
2728 } elseif (count($this->multi) == 1 && $this->
dataExists()) {
2729 $this->tpl->setCurrentBlock(
"tbl_single_cmd");
2731 foreach ($this->multi as $mc) {
2735 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2736 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2737 $this->tpl->parseCurrentBlock();
2742 $this->tpl->setCurrentBlock(
"tbl_top_single_cmd");
2744 foreach ($this->multi as $mc) {
2748 $this->tpl->setVariable(
"TXT_SINGLE_CMD",
$txt);
2749 $this->tpl->setVariable(
"SINGLE_CMD", $cmd);
2750 $this->tpl->parseCurrentBlock();
2755 $this->tpl->setCurrentBlock(
"tbl_action_img_arrow");
2757 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2758 $this->tpl->parseCurrentBlock();
2761 $this->tpl->setCurrentBlock(
"tbl_top_action_img_arrow");
2763 $this->tpl->setVariable(
"ALT_ARROW",
$lng->txt(
"action"));
2764 $this->tpl->parseCurrentBlock();
2769 $this->tpl->setCurrentBlock(
"tbl_action_row");
2770 $this->tpl->parseCurrentBlock();
2772 $this->tpl->setCurrentBlock(
"tbl_top_action_row");
2773 $this->tpl->parseCurrentBlock();
2785 $this->headerHTML =
$html;
2799 if (isset($DIC[
"ilUser"])) {
2804 include_once(
"./Services/Table/classes/class.ilTablePropertiesStorage.php");
2822 if (isset($DIC[
"ilUser"])) {
2827 include_once(
"./Services/Table/classes/class.ilTablePropertiesStorage.php");
2861 if ($this->filters) {
2862 foreach ($this->filters as $item) {
2866 if ($this->optional_filters &&
$result[
"selfilters"]) {
2867 foreach ($this->optional_filters as $item) {
2868 if (in_array($item->getFieldId(),
$result[
"selfilters"])) {
2885 if (method_exists($a_item,
"getChecked")) {
2886 return $a_item->getChecked();
2887 } elseif (method_exists($a_item,
"getValue")) {
2888 return $a_item->getValue();
2889 } elseif (method_exists($a_item,
"getDate")) {
2902 if (method_exists($a_item,
"setChecked")) {
2903 $a_item->setChecked($a_value);
2904 } elseif (method_exists($a_item,
"setValue")) {
2905 $a_item->setValue($a_value);
2906 } elseif (method_exists($a_item,
"setDate")) {
2920 $this->context =
$id;
2941 $this->show_rows_selector = (bool) $a_value;
2961 $this->show_templates = (bool) $a_value;
2989 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
2993 if (is_array(
$data)) {
2994 foreach (
$data as $property => $value) {
2999 $data[
"filter_values"] = unserialize(
$data[
"filter_values"]);
3000 if (
$data[
"filter_values"]) {
3001 $this->restore_filter_values =
$data[
"filter_values"];
3004 $this->restore_filter =
true;
3026 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
3030 $state[
"filter_values"] = serialize(
$state[
"filter_values"]);
3032 $state[
"selfilters"] = serialize(
$state[
"selfilters"]);
3055 include_once(
"./Services/Table/classes/class.ilTableTemplatesStorage.php");
3071 return parent::getLimit();
3082 return parent::getOffset();
3092 $this->export_formats = array();
3095 $valid = array(self::EXPORT_EXCEL =>
"tbl_export_excel",
3096 self::EXPORT_CSV =>
"tbl_export_csv");
3098 foreach ($formats as
$format) {
3099 if (array_key_exists($format,
$valid)) {
3111 $this->print_mode = (bool) $a_value;
3156 case self::EXPORT_EXCEL:
3157 include_once
"./Services/Excel/classes/class.ilExcel.php";
3159 $excel->addSheet($this->title
3161 : $this->lng->txt(
"export"));
3174 foreach ($this->row_data as $set) {
3187 case self::EXPORT_CSV:
3188 include_once
"./Services/Utilities/classes/class.ilCSVWriter.php";
3190 $csv->setSeparator(
";");
3195 foreach ($this->row_data as $set) {
3202 header(
"Content-type: text/comma-separated-values");
3203 header(
"Content-Disposition: attachment; filename=\"" .
$filename .
"\"");
3204 header(
"Expires: 0");
3205 header(
"Cache-Control: must-revalidate, post-check=0,pre-check=0");
3206 header(
"Pragma: public");
3207 echo $csv->getCSVString();
3209 file_put_contents(
$filename, $csv->getCSVString());
3241 foreach ($this->column as $column) {
3242 $title = strip_tags($column[
"text"]);
3261 foreach ($a_set as $value) {
3262 if (is_array($value)) {
3263 $value = implode(
', ', $value);
3265 $a_excel->
setCell($a_row, $col++, $value);
3287 foreach ($this->column as $column) {
3288 $title = strip_tags($column[
"text"]);
3290 $a_csv->addColumn(
$title);
3305 foreach ($a_set as
$key => $value) {
3306 if (is_array($value)) {
3307 $value = implode(
', ', $value);
3309 $a_csv->addColumn(strip_tags($value));
3321 $this->enable_command_for_all = (bool) $a_value;
3333 $ilClientIniFile = $DIC[
"ilClientIniFile"];
3335 $limit = $ilClientIniFile->readVariable(
"system",
"TABLE_ACTION_ALL_LIMIT");
3337 $limit = self::ACTION_ALL_LIMIT;
3367 $this->prevent_double_submission = $a_val;
3380 public function setLimit($a_limit = 0, $a_default_limit = 0)
3382 parent::setLimit($a_limit, $a_default_limit);
3385 if ($a_limit == 9999 &&
3386 $this->limit_determined) {
3387 $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.
Helper class to generate CSV files.
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.
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
getFilterItemByPostVar($a_post_var)
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
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.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
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
special template class to simplify handling of ITX/PEAR
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.
This class represents a text property in a property form.
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.
User interface class for advanced drop-down selection lists.
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.
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.