3require_once
'dbxForm.class.php';
149 'dbx_rpos' => array(
'default' => 0,
'rules' =>
'int'),
198 public $_page_break =
'<div class="page-break printMe"> </div><br>';
456 $this->_mode =
'table';
457 $this->_current_page = 0;
458 $this->_current_report_ln = 0;
459 $this->_current_page_ln = 0;
460 $this->_first_page_lines = 9999;
461 $this->_next_page_lines = 9999;
463 $this->_fld_haeder =
'';
465 $this->_haeder_report =
'';
466 $this->_footer_report =
'';
467 $this->_haeder_page =
'';
468 $this->_footer_page =
'';
469 $this->_haeder_next_page =
'';
470 $this->_footer_next_page =
'';
476 $this->_record = array();
477 $this->_callback_owner =
null;
478 $this->_callback_id =
'';
479 $this->_callbacks = array();
480 $this->_rdata = array();
481 $this->_rdata_inline =
false;
482 $this->_body_inline =
'';
485 $this->_count_all = -1;
489 $this->_pagelink =
'';
491 $this->_auto_flds =
'';
492 $this->_auto_mode =
'';
495 $this->_add_action =
'';
497 $this->_create_sel_flds = 0;
498 $this->_create_row_select = 0;
499 $this->_create_row_edit = 0;
500 $this->_create_row_copy = 0;
501 $this->_create_row_delete = 0;
502 $this->_create_row_download = 0;
503 $this->_create_row_show = 0;
504 $this->_create_row_export = 0;
505 $this->_create_row_import = 0;
506 $this->_create_row_undo = 0;
507 $this->_create_row_print = 0;
509 $this->_rpt_format = array();
513 $this->_multi_page_select = 0;
514 $this->_multi_select_work =
'';
515 $this->_report_multi_actions = array();
516 $this->_table_buttons =
'left';
517 $this->_table_render_tpl_cache = array();
519 $this->_data_table = 0;
520 $this->_scroll_table = 0;
522 $this->_style_haeder = array();
523 $this->_class_haeder = array();
524 $this->_class_body = array();
526 $this->_count_selects = -1;
528 $this->_msg_confirm_delete =
'Datensatz löschen ?';
529 $this->_msg_confirm_delete_tab =
'Datenbank-Tabelle wirklich leeren ?';
530 $this->_msg_confirm_copy =
'Datensatz kopieren ?';
532 $this->_delete_tab_dd =
'';
533 $this->_delete_tab_label =
'Tabelle leeren';
534 $this->_delete_tab_label_from_fd =
false;
536 $this->_grid_read_url =
'';
537 $this->_grid_save_url =
'';
538 $this->_grid_delete_url =
'';
539 $this->_grid_insert_url =
'';
540 $this->_grid_sort_url =
'';
541 $this->_grid_sync_url =
'';
542 $this->_grid_print_url =
'';
543 $this->_grid_export_url =
'';
544 $this->_grid_schema =
'';
545 $this->_grid_id =
'';
546 $this->_grid_cols =
'';
547 $this->_grid_layout =
'fitColumns';
548 $this->_grid_headerfilter = 1;
549 $this->_grid_headersort = 1;
550 $this->_grid_allow_delete = 1;
551 $this->_grid_allow_edit = 1;
552 $this->_grid_allow_insert = 1;
553 $this->_grid_synctime =
'2';
557 $table[
'tpl_haeder_col'] =
'table_haeder_col';
558 $table[
'tpl_haeder_select'] =
'table_haeder_select';
559 $table[
'tpl_haeder_delte'] =
'table_haeder_delete';
560 $table[
'tpl_haeder_expand'] =
'table_haeder_expand';
561 $table[
'tpl_haeder_expander'] =
'table_haeder_expander';
562 $table[
'tpl_haeder_edit'] =
'table_haeder_edit';
563 $table[
'tpl_haeder_copy'] =
'table_haeder_copy';
564 $table[
'tpl_haeder_undo'] =
'table_haeder_undo';
565 $table[
'tpl_haeder_show'] =
'table_haeder_show';
566 $table[
'tpl_haeder_import'] =
'table_haeder_import';
567 $table[
'tpl_haeder_export'] =
'table_haeder_export';
568 $table[
'tpl_haeder_download'] =
'table_haeder_download';
569 $table[
'tpl_haeder_print'] =
'table_haeder_print';
571 $table[
'tpl_row_col'] =
'table_row_col';
572 $table[
'tpl_row_select'] =
'table_row_select';
573 $table[
'tpl_row_expand'] =
'table_row_expand';
574 $table[
'tpl_row_expander'] =
'table_row_expander';
575 $table[
'tpl_row_edit'] =
'table_row_edit';
576 $table[
'tpl_row_copy'] =
'table_row_copy';
577 $table[
'tpl_row_delete'] =
'table_row_delete';
578 $table[
'tpl_row_save'] =
'table_row_save';
579 $table[
'tpl_row_undo'] =
'table_row_undo';
580 $table[
'tpl_row_show'] =
'table_row_show';
581 $table[
'tpl_row_export'] =
'table_row_export';
582 $table[
'tpl_row_import'] =
'table_row_import';
583 $table[
'tpl_row_download'] =
'table_row_download';
584 $table[
'tpl_row_print'] =
'table_row_print';
586 if ($this->_multi_page_select) {
587 $table[
'tpl_haeder_select'] =
'table_haeder_select-multi';
588 $table[
'tpl_row_select'] =
'table_row_select-multi';
591 $this->_tabel_tpls =
$table;
603 $this->_tabel_tpls[$tid] =
$tpl;
619 if ($this->_action) {
628 $run1 =
dbx()->get_modul_var(
'dbx_run1', 0);
632 $run2 =
dbx()->get_modul_var(
'dbx_run2', 0);
635 $url =
'?dbx_modul=' . $modul;
638 $url .=
'&dbx_run1=' . $run1;
642 $url .=
'&dbx_run2=' . $run2;
659 $this->_delete_tab_dd = (string)
$dd;
660 $this->_delete_tab_label_from_fd = $label ===
null || $label ===
'';
661 if (!$this->_delete_tab_label_from_fd) {
662 $this->_delete_tab_label = (string) $label;
665 if (!$this->_dd && $this->_delete_tab_dd) {
681 if (!$this->_delete_tab_dd) {
689 $action =
$webApp->append_route_params($action, array(
690 'dbx_do' =>
'delete_tab',
692 $action =
dbx()->action_url($action);
695 $label = $this->_delete_tab_label_from_fd
706 'delete_tab_confirm',
707 $this->_msg_confirm_delete_tab
710 'delete_tab_tooltip',
719 'class' =>
'btn-danger',
720 'tooltip' => $tooltip,
723 $tpl = $this->
get_tpl(
'dbx|action_button_delete_tab', $data);
753 $rid = trim((
string) $rid);
778 if (!is_array($record)) {
782 if ($this->_fld_id && array_key_exists($this->_fld_id, $record)) {
786 if (array_key_exists(
'rid', $record)) {
787 return $record[
'rid'];
790 if (array_key_exists(
'id', $record)) {
791 return $record[
'id'];
794 if (array_key_exists(
'recnum', $record)) {
795 return $record[
'recnum'];
802 if (!is_array($this->_record)) {
810 $this->_record = $record;
814 if (!is_array($this->_record)) {
818 if (array_key_exists($name, $this->_record)) {
819 return $this->_record[$name];
826 if (!is_array($this->_record)) {
827 $this->_record = array();
830 $this->_record[$name] =
$value;
835 $this->_callback_owner =
$owner;
879 if (is_array($record) && array_key_exists(
'id', $record)) {
905 if (is_array($raw)) {
906 foreach ($raw as
$value) {
914 return array_keys($ids);
917 $raw = trim((
string) $raw);
923 if ($raw[0] ===
'[') {
924 $decoded = json_decode($raw,
true);
926 if (is_array($decoded)) {
931 $parts = preg_split(
'/[|,\s;]+/', $raw);
933 if (!is_array($parts)) {
937 foreach ($parts as
$value) {
945 return array_keys($ids);
958 foreach ($ids as $rid) {
979 foreach ($ids as $rid) {
982 if ($key !==
'' && isset($selects[$key])) {
983 unset($selects[$key]);
998 if (!is_array($this->_rdata)) {
1002 foreach ($this->_rdata as $record) {
1010 return array_keys($ids);
1026 $selectedVisible = array();
1028 foreach ($visibleIds as $rid) {
1031 if ($key !==
'' && isset($selects[$key])) {
1032 $selectedVisible[] = $key;
1036 $visibleCount = count($visibleIds);
1037 $selectedCount = count($selectedVisible);
1038 $headerState =
'none';
1040 if ($visibleCount > 0 && $selectedCount === $visibleCount) {
1041 $headerState =
'all';
1042 } elseif ($selectedCount > 0) {
1043 $headerState =
'partial';
1047 'visible_ids' => array_values($visibleIds),
1048 'selected_ids_visible' => array_values($selectedVisible),
1049 'visible_count' => $visibleCount,
1050 'selected_count' => $selectedCount,
1051 'header_state' => $headerState,
1052 'header_checked' => ($headerState ===
'all') ? 1 : 0,
1065 $quick =
dbx()->get_modul_var(
'dbx_select_quick', 1,
'int');
1068 http_response_code(204);
1069 if (function_exists(
'session_write_close')) {
1070 session_write_close();
1079 'dbx_do' => $dbx_do,
1081 'visible_ids' =>
$state[
'visible_ids'],
1082 'selected_ids_visible' =>
$state[
'selected_ids_visible'],
1083 'visible_count' =>
$state[
'visible_count'],
1084 'visible_selected_count' =>
$state[
'selected_count'],
1085 'header_state' =>
$state[
'header_state'],
1088 header(
'Content-Type: application/json; charset=utf-8');
1089 echo json_encode(
$response, JSON_UNESCAPED_UNICODE);
1090 if (function_exists(
'session_write_close')) {
1091 session_write_close();
1112 if ($key !==
'' && isset($selects[$key])) {
1130 foreach ($this->_rdata as $record) {
1161 if ($key !==
'' && isset($selects[$key])) {
1162 unset($selects[$key]);
1180 $modul = $this->_dbx_modul ;
1181 $modul_key = $modul .
'-rpt-' . $this->_fid;
1182 if (is_array($selects)) {
1183 foreach ($selects as $rid =>
$value) {
1191 dbx()->set_remember_var(
'multi_select',
$normalized, $modul_key);
1192 $this->_count_selects = -1;
1211 if ($key !==
'' && isset($ids[$key])) {
1225 $modul_key = $modul .
'-rpt-' . $this->_fid;
1226 $selects =
dbx()->get_remember_var(
'multi_select', array(), $modul_key);
1228 if (!is_array($selects)) {
1234 foreach ($selects as $rid =>
$value) {
1235 $xkey = $this->normalize_multi_select_key($rid);
1251 $count = $this->_count_selects;
1255 $count = is_array($selects) ? count($selects) : 0;
1256 $this->_count_selects =
$count;
1296 if (isset($selects[$key])) {
1297 unset($selects[$key]);
1314 $fld_id = $this->_fld_id ? $this->_fld_id :
'id';
1316 if (!is_array($selects) || !count($selects)) {
1318 $rwhere .=
' and (1=0)';
1321 if ($rwhere ==
'') {
1330 foreach ($selects as $id => $sel) {
1337 if (preg_match(
'/^-?\d+$/', $key)) {
1338 $values[] = (string) ((
int) $key);
1340 $values[] =
"'" . addslashes($key) .
"'";
1344 if (!count($values)) {
1346 $rwhere .=
' and (1=0)';
1349 if ($rwhere ==
'') {
1356 $selectWhere = $fld_id .
' IN (' . implode(
',', $values) .
')';
1359 $rwhere .=
' and (' . $selectWhere .
')';
1361 $rwhere = $selectWhere;
1377 if ($suchWert ===
null) {
1381 $suchWert = str_replace(array(
'\'',
'"',
'\\',
'%'),
'', $suchWert);
1382 $suchWert = filter_var($suchWert, FILTER_SANITIZE_SPECIAL_CHARS);
1384 $datum = DateTime::createFromFormat(
'd.m.Y', $suchWert);
1386 if ($datum && $datum->format(
'd.m.Y') === $suchWert) {
1387 $suchWert = $datum->format(
'Y-m-d');
1390 $felder = explode(
',', $feldListe);
1392 $bedingungen = array();
1394 foreach ($felder as $feld) {
1395 $feld = trim($feld);
1401 $bedingungen[] =
"$feld LIKE '$suchWert%'";
1404 $sql .= implode(
' OR ', $bedingungen);
1423 $dbx_do =
dbx()->get_modul_var(
'dbx_do',
'',
'parameter');
1424 $ajax =
dbx()->get_system_var(
'dbx_ajax', 0,
'int');
1426 if ($dbx_do ===
'selection_state') {
1427 $idsRaw =
dbx()->get_modul_var(
'dbx_select_ids',
'',
'*');
1428 $visibleRaw =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1433 $visibleIds = $selected;
1436 $selectedMap = array_flip($selected);
1438 foreach ($visibleIds as $rid) {
1439 if (isset($selectedMap[$rid])) {
1453 if ($dbx_do ===
'row_select') {
1454 $state =
dbx()->get_modul_var(
'dbx_select_state', 0,
'int');
1455 $rid =
dbx()->get_modul_var(
'rid',
'',
'parameter+.');
1456 $selectId =
dbx()->get_modul_var(
'dbx_select_id',
'',
'parameter+.');
1457 $visibleIds =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1459 if ($selectId !==
'') {
1483 if ($dbx_do ===
'rows_select') {
1484 $state =
dbx()->get_modul_var(
'dbx_select_state', 0,
'int');
1485 $idsRaw =
dbx()->get_modul_var(
'dbx_select_ids',
'',
'*');
1486 $visibleRaw =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1507 if ($dbx_do ===
'clear_selects') {
1531 if ($reform ==
'php-date-usr' || $reform ==
'date') {
1536 $reform ==
'php-datetime-usr' ||
1537 $reform ==
'date_time' ||
1538 $reform ==
'datetime' ||
1539 $reform ==
'datetime_ms'
1544 if ($reform ==
'html-chars') {
1545 $value = htmlspecialchars((
string)
$value, ENT_QUOTES | ENT_SUBSTITUTE,
'UTF-8');
1563 $format = $this->_rpt_format;
1566 if (is_array($format)) {
1567 if (isset($format[$key])) {
1568 $reform = $format[$key];
1574 if ($reform ===
'') {
1578 return (
string) $reform;
1591 return in_array($format, array(
'html',
'raw-html',
'raw',
'tpl',
'template'),
true);
1626 static $cache = array();
1628 if (!$this->_dd || !$key) {
1632 $dd = (string) $this->_dd;
1633 $key = (string) $key;
1634 $cacheKey =
$dd .
'|' . $key;
1636 if (array_key_exists($cacheKey, $cache)) {
1637 return $cache[$cacheKey];
1641 $convert = strtolower(trim((
string) $this->
get_dd(
$dd, $key,
'convert')));
1643 if (in_array($convert, array(
'date',
'php-date-usr'),
true)) {
1644 $format =
'php-date-usr';
1645 $cache[$cacheKey] = $format;
1649 if (in_array($convert, array(
'date_time',
'datetime',
'datetime_ms',
'php-datetime-usr'),
true)) {
1650 $format =
'php-datetime-usr';
1651 $cache[$cacheKey] = $format;
1655 $type = strtolower(trim((
string) $this->
get_dd(
$dd, $key,
'type')));
1657 if ($type ==
'date') {
1658 $format =
'php-date-usr';
1659 $cache[$cacheKey] = $format;
1663 if (in_array($type, array(
'datetime',
'date_time',
'datetime_ms',
'timestamp'),
true)) {
1664 $format =
'php-datetime-usr';
1665 $cache[$cacheKey] = $format;
1669 $cache[$cacheKey] =
'';
1688 $count_cols = $this->_table_col_count;
1689 $label_colspan = max(1, $count_cols - 1);
1690 $page = $this->_current_page;
1691 $page_break = $this->_page_break;
1699 if (is_array($this->_obj)) {
1700 foreach ($this->_obj as $key =>
$value) {
1701 $xkey =
'{obj:' . $key .
'}';
1770 $footer = $this->_footer_next_page;
1771 $footer .= $this->_footer_page;
1778 $haeder = $this->_haeder_page;
1779 $haeder .= $this->_haeder_next_page;
1801 private function get_class_body($xkey) {
1804 if (isset($this->_class_body[$xkey])) {
1805 $class = $this->_class_body[$xkey];
1816 if ($rpt !=
'pagination') {
1817 $this->_current_report_ln++;
1818 $this->_current_page_ln++;
1820 $pn = $this->_current_page;
1821 $ln = $this->_current_page_ln;
1824 $max = $this->_first_page_lines;
1826 $max = $this->_next_page_lines;
1831 $this->_current_page_ln = 1;
1838 return $page_footer . $page_haeder .
$content;
1850 $this->_class_haeder[$key] =
$class;
1853 private function get_class_haeder($key) {
1856 if (is_array($this->_class_haeder)) {
1857 if (isset($this->_class_haeder[$key])) {
1858 $class = $this->_class_haeder[$key];
1870 $this->_style_haeder[$key] =
$style;
1873 private function get_style_haeder($key) {
1876 if (is_array($this->_style_haeder)) {
1877 if (isset($this->_style_haeder[$key])) {
1878 $style = $this->_style_haeder[$key];
1896 'type' =>
'expander',
1897 'enabled' => (
bool) $this->_data_table,
1898 'header_tpl' =>
'tpl_haeder_expander',
1899 'row_tpl' =>
'tpl_row_expander',
1903 'enabled' => (
bool) $this->_create_row_edit,
1904 'header_tpl' =>
'tpl_haeder_edit',
1905 'row_tpl' =>
'tpl_row_edit',
1909 'enabled' => (
bool) $this->_create_row_copy,
1910 'header_tpl' =>
'tpl_haeder_copy',
1911 'row_tpl' =>
'tpl_row_copy',
1915 'enabled' => (
bool) $this->_create_row_show,
1916 'header_tpl' =>
'tpl_haeder_show',
1917 'row_tpl' =>
'tpl_row_show',
1921 'enabled' => (
bool) $this->_create_row_export,
1922 'header_tpl' =>
'tpl_haeder_export',
1923 'row_tpl' =>
'tpl_row_export',
1927 'enabled' => (
bool) $this->_create_row_import,
1928 'header_tpl' =>
'tpl_haeder_import',
1929 'row_tpl' =>
'tpl_row_import',
1932 'type' =>
'download',
1933 'enabled' => (
bool) $this->_create_row_download,
1934 'header_tpl' =>
'tpl_haeder_download',
1935 'row_tpl' =>
'tpl_row_download',
1939 'enabled' => (
bool) $this->_create_row_delete,
1940 'header_tpl' =>
'tpl_haeder_delte',
1941 'row_tpl' =>
'tpl_row_delete',
1945 'enabled' => (
bool) $this->_create_row_print,
1946 'header_tpl' =>
'tpl_haeder_print',
1947 'row_tpl' =>
'tpl_row_print',
1953 if (!isset($this->_table_render_tpl_cache[
$file])) {
1957 return $this->oTPL->replaces($this->_table_render_tpl_cache[
$file], $data);
1970 if (!$def[
'enabled']) {
1974 $file = $this->_tabel_tpls[$def[
'header_tpl']];
1977 'class' =>
'no-sort',
2004 'class' =>
'no-sort',
2008 if ($type ===
'download') {
2009 $dat[
'href_dir_file'] =
dbx()->get_modul_var(
'href_dir_file',
'',
'*');
2012 if ($type ===
'copy') {
2013 $dat[
'confirm'] = $this->_msg_confirm_copy;
2016 if ($type ===
'delete') {
2017 $dat[
'confirm'] = $this->_msg_confirm_delete;
2020 if ($this->_fid !=
'pagination') {
2023 'record' => $record,
2027 $data = $this->
callback(
'row_action_data', $data);
2029 if (is_array($data) && isset($data[
'data']) && is_array($data[
'data'])) {
2030 $dat = $data[
'data'];
2034 if ($type ===
'delete') {
2035 $webApp =
dbx()->get_system_obj(
'dbxWebApp');
2036 $deleteRid = (int)($dat[
'rid'] ?? $rid);
2037 $deleteParams = array(
2038 'dbx_do' =>
'row_delete',
2039 'rid' => $deleteRid,
2042 $action = trim((
string)($dat[
'action'] ??
''));
2043 if ($action !==
'' && $action !==
'#' && stripos($action,
'javascript:') !== 0) {
2044 $action =
$webApp->append_route_params($action, $deleteParams);
2045 $dat[
'action'] =
dbx()->action_url($action);
2050 $deleteUrl = trim((
string)($dat[
'delete_url'] ??
''));
2071 if (!$def[
'enabled']) {
2075 $file = $this->_tabel_tpls[$def[
'row_tpl']];
2096 $file = $this->_tabel_tpls[
'tpl_haeder_select'];
2097 $name = isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] :
'xID';
2100 if (!empty($select_state[
'header_checked'])) {
2108 'header_state' => isset($select_state[
'header_state']) ? $select_state[
'header_state'] :
'none',
2121 $file = $this->_tabel_tpls[
'tpl_row_select'];
2122 $name = $this->_fid .
'_select';
2127 $this->_post[$name] = 1;
2152 foreach ($auto_flds as $key =>
$value) {
2155 if ($this->_create_row_select && $key == $fld_id) {
2159 if (!$skip &&
$value >
'') {
2160 $file = $this->_tabel_tpls[
'tpl_haeder_col'];
2161 $class = $this->get_class_haeder($key);
2162 $style = $this->get_style_haeder($key);
2195 foreach ($auto_flds as $no => $key) {
2198 $label = $auto_flds[$no];
2201 if (isset($record[$key])) {
2203 } elseif (isset($record[$no])) {
2207 if ($this->_create_row_select && $xkey == $fld_id) {
2211 if (!$skip && $label >
'') {
2219 if ($defaultClass !==
'auto-fld') {
2220 $class = $this->get_class_body($xkey);
2251 $this->_current_page++;
2253 $auto_flds = $this->_auto_flds;
2254 $auto_mode = $this->_auto_mode;
2257 if (!is_array($auto_flds)) {
2258 if (is_string($auto_flds) && $auto_flds !==
'') {
2259 $auto_flds = explode(
',', $auto_flds);
2261 $auto_flds = array();
2265 $pos = strpos(
$content,
'[rpt:row]');
2267 if ($pos !==
false) {
2269 $fld_id = $this->_fld_id;
2271 if ($auto_mode ==
'table' && is_array($auto_flds)) {
2275 if ($this->_table_buttons !=
'left') {
2276 if ($this->_create_row_select) {
2280 $this->get_class_haeder(isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] :
'xID'),
2286 $row .= $columnBlock[
'html'];
2287 $col_count += $columnBlock[
'count'];
2289 $row .= $buttonBlock[
'html'];
2290 $col_count += $buttonBlock[
'count'];
2292 $row .= $buttonBlock[
'html'];
2293 $col_count += $buttonBlock[
'count'];
2295 if ($this->_create_row_select) {
2305 $row .= $columnBlock[
'html'];
2306 $col_count += $columnBlock[
'count'];
2330 $auto_flds = $this->_auto_flds;
2331 $auto_mode = $this->_auto_mode;
2333 if (!is_array($auto_flds)) {
2334 if (is_string($auto_flds) && $auto_flds !==
'') {
2335 $auto_flds = explode(
',', $auto_flds);
2337 $auto_flds = array();
2341 if (is_array($this->_rdata)) {
2342 foreach ($this->_rdata as $recnum => $record) {
2344 $line = $this->_body;
2346 $this->_record = $record;
2347 $record = ($this->_fid !=
'pagination') ? $this->callback(
'next_record', $record) : $record;
2348 $this->_record = $record;
2350 if (!is_array($record)) {
2354 $line = $this->run_body($line);
2355 $record = $this->_record;
2357 if (!is_array($record)) {
2361 $fld_id = $this->_fld_id;
2362 $pos = strpos($line,
'[rpt:row]');
2364 if ($pos !==
false && $this->_rdata_inline) {
2365 $inline = $this->_body_inline;
2366 return str_replace(
'[rpt:row]', $inline, $line);
2369 if ($pos !==
false) {
2372 if ($auto_mode ==
'table' && is_array($auto_flds)) {
2373 $buttonBlock = $this->render_table_row_action_block($record);
2375 if ($this->_table_buttons !=
'left') {
2376 if ($this->_create_row_select) {
2377 $row .= $this->render_table_row_select($record,
'no-sort') .
"\n";
2380 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id,
'auto-fld');
2381 $row .= $buttonBlock;
2383 $row .= $buttonBlock;
2385 if ($this->_create_row_select) {
2386 $row .= $this->render_table_row_select($record,
'no-sort') .
"\n";
2389 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id,
'body');
2393 $line = str_replace(
'[rpt:row]', $row, $line);
2396 $tr_class = $this->get_class_tr($record);
2397 $tr_class .= ($loop % 2 != 0) ?
' odd' :
' even';
2399 $line = str_replace(
'{tr-class}', $tr_class, $line);
2401 if (is_array($record)) {
2403 $field_name =
'{' .
$field .
'}';
2405 if (strpos($line, $field_name) ===
false) {
2416 $line = str_replace($field_name, (
string)
$value, $line);
2421 $col_count = $this->_table_col_count;
2422 $line = str_replace(
'{rpt:col_count}', $col_count, $line);
2424 if (strpos($line,
'{r}') !==
false) {
2425 $r =
dbx()->next_id(1);
2426 $line = str_replace(
'{r}', $r, $line);
2431 if ($this->_rdata_inline) {
2442 $activ_id = $this->_activ_id;
2449 $key = $this->_fld_id;
2451 if ($key && isset($record[$key])) {
2452 if ($activ_id == $record[$key]) {
2463 $col_count = $this->_table_col_count;
2473 $report_part = explode(
'<hr class="dbx_split">',
$report);
2474 $report_header =
'';
2476 $report_footer =
'';
2477 $next_haeder_page =
'';
2478 $next_footer_page =
'';
2479 $count = count($report_part);
2482 $report_body = $report_part[0];
2486 $report_header = $report_part[0];
2487 $report_body = $report_part[1];
2491 $report_header = $report_part[0];
2492 $report_body = $report_part[1];
2493 $report_footer = $report_part[2];
2494 $next_haeder_page = $report_part[0];
2495 $next_footer_page = $report_part[2];
2499 $next_haeder_page = $report_part[3];
2500 $next_footer_page = $report_part[5];
2503 $this->_haeder = $report_header;
2504 $this->_body = $report_body;
2505 $this->_footer = $report_footer;
2506 $this->_footer_next_page = $next_footer_page;
2507 $this->_haeder_next_page = $next_haeder_page;
2522 if ((!$this->_create_row_select && !$this->_create_sel_flds) || !is_string(
$content) || stripos(
$content,
'dbxReport') ===
false) {
2526 return preg_replace_callback(
2527 '/<div\b(?=[^>]*\bclass\s*=\s*(["\'])[^"\']*\bdbxReport\b[^"\']*\1)([^>]*)>/i',
2531 if (preg_match(
'/\bdata-dbx\s*=\s*(["\'])(.*?)\1/i', $tag, $dataMatch)) {
2532 $value = trim($dataMatch[2]);
2534 if (stripos(
$value,
'lib=report') !==
false) {
2539 $newAtt =
'data-dbx=' . $dataMatch[1] .
$value . $dataMatch[1];
2541 return str_replace($dataMatch[0], $newAtt, $tag);
2544 return substr($tag, 0, -1) .
' data-dbx="lib=report|form=0">';
2561 $modul = $this->_dbx_modul;
2562 $action = $this->_dbx_action;
2563 $rcount = $this->_rcount;
2564 $link = $this->_pagelink;
2565 $tpl = $this->_tpl_pagination;
2566 $rpos = $this->_rpos;
2567 $rrows = $this->_rrows;
2570 $link =
'?dbx_modul=' . $modul .
'&dbx_run1=' . $action;
2573 $link = $this->_action ?: $link;
2574 $content = $this->pagination(
$tpl, $link, $rpos, $rrows, $rcount);
2579 private function lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount) {
2586 if ($p == $akt_page) {
2587 $p_active =
' aria-current="page"';
2588 $active =
' active';
2589 $current =
' aria-current="page" ';
2593 $rec[
'p'] = $p . $s_active;
2594 $rec[
'href_page'] = $link .
'&dbx_rrows=' . $rrows .
'&dbx_rpos=' . (($p - 1) * $rrows);
2595 $rec[
'p_active'] = $p_active;
2596 $rec[
'active'] = $active;
2597 $rec[
'current'] = $current;
2598 $rec[
'class'] =
$class .
' dbxAjax';
2603 private function pagination(
$tpl, $link, $rpos, $rrows, $rcount) {
2608 $pages = intval($rcount / $rrows);
2610 if ($rcount % $rrows)
$pages++;
2614 $pmax = $this->_but_pagination;
2615 $akt_page = intval($rpos / $rrows) + 1;
2617 if ($akt_page < 1) $akt_page = 1;
2620 $half = intval($pmax / 2);
2621 $p_s = $akt_page - $half;
2622 $p_e = $akt_page + $half;
2631 $p_s =
$pages - $pmax + 1;
2638 $last_pos = (
$pages - 1) * $rrows;
2639 $prev = ($akt_page - 2) * $rrows;
2640 $next = ($akt_page) * $rrows;
2642 if ($prev < 0) $prev = 0;
2643 if ($next > $last_pos) $next = $last_pos;
2645 $href_first = $link .
'&dbx_rpos=0&dbx_rrows=' . $rrows;
2646 $href_last = $link .
'&dbx_rpos=' . $last_pos .
'&dbx_rrows=' . $rrows ;
2647 $href_prev = $link .
'&dbx_rpos=' . $prev .
'&dbx_rrows=' . $rrows ;
2648 $href_next = $link .
'&dbx_rpos=' . $next .
'&dbx_rrows=' . $rrows ;
2650 $this->
_sys[
'dbx_rpos'] = $rpos;
2651 $this->
_sys[
'dbx_rrows'] = $rrows;
2654 $dv[
'dbx_rpos'] = $rpos;
2655 $dv[
'dbx_rrows'] = $rrows;
2658 for ($p = $p_s; $p <= $p_e; $p++) {
2659 $rdata[] = $this->lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount);
2666 $oReport =
dbx()->get_system_obj(
'dbxReport');
2668 $oReport->init(
'pagination');
2669 $oReport->_data = $dv;
2670 $oReport->_dbx_modul =
'dbx';
2671 $oReport->_dbx_action =
'pagination';
2672 $oReport->_dbx_modul_id = 888;
2673 $oReport->_rdata = $rdata;
2674 $oReport->_rcount = $rcount;
2675 $oReport->_rrows = $rrows;
2676 $oReport->_rpos = $rpos;
2677 $oReport->_action = $link;
2678 $oReport->_tpl =
$tpl;
2679 $oReport->_pages = 0;
2680 $oReport->_mode =
'table';
2681 $oReport->_rflds = array();
2682 $oReport->_body_inline =
false;
2683 $oReport->_create_sel_flds = 0;
2691 $selectState = $this->get_visible_multi_select_state();
2693 $countAll = ($this->_count_all >= 0) ? $this->_count_all : $rcount;
2703 for ($i = $rpos; $i < ($rpos + $rrows); $i++) {
2704 if (isset($data[$i])) {
2705 $rdata[] = $data[$i];
2717 $where .=
" $mode (";
2729 $this->_page_reset = 0;
2745 $securedUrl =
dbx()->action_url(
$url);
2746 if ($securedUrl ===
$url) {
2748 'dbxReport grid action blocked: convention not recognized'
2749 .
' action=(' . (
string)$action .
') url=(' .
$url .
')'
2758 $gridId = $this->_grid_id;
2761 $gridId = $this->_fid .
'_grid';
2764 $cols = $this->_grid_cols;
2766 if (!$cols && $this->_dd) {
2767 $oDB =
dbx()->get_system_obj(
'dbxDB');
2768 $cols = $oDB->get_dd_grid_cols($this->_dd);
2771 $rrows = (int) $this->_rrows;
2772 $rpos = (int) $this->_rpos;
2773 $page = ($rrows > 0) ? ((
int) floor($rpos / $rrows) + 1) : 1;
2776 'read_url' => $this->_grid_read_url,
2777 'save_url' => $this->get_grid_action_url($this->_grid_save_url,
'save'),
2778 'delete_url' => $this->get_grid_action_url($this->_grid_delete_url,
'delete'),
2779 'insert_url' => $this->get_grid_action_url($this->_grid_insert_url,
'insert'),
2780 'sort_url' => $this->get_grid_action_url($this->_grid_sort_url,
'sort'),
2781 'sync_url' => $this->get_grid_action_url($this->_grid_sync_url,
'sync'),
2782 'print_url' => $this->_grid_print_url,
2783 'export_url' => $this->_grid_export_url,
2784 'grid_id' => $gridId,
2785 'grid_cols' => $cols,
2786 'grid_schema' => $this->_grid_schema,
2787 'grid_layout' => $this->_grid_layout,
2788 'grid_height' => $this->_rrows,
2789 'grid_synctime' => $this->_grid_synctime,
2790 'grid_page' =>
$page,
2791 'grid_page_size' => ($rrows > 0) ? $rrows : 25,
2797 $this->
add_rep(
'grid_stats',
'');
2801 $html =
'<div class="dbx-grid-stats"';
2802 if ((
string)$ariaLabel !==
'') {
2803 $html .=
' aria-label="' . htmlspecialchars((
string)$ariaLabel, ENT_QUOTES) .
'"';
2807 foreach ($stats as $stat) {
2808 if (!is_array($stat)) {
2812 $label = htmlspecialchars((
string)($stat[
'label'] ??
''), ENT_QUOTES);
2813 $value = htmlspecialchars((
string)($stat[
'value'] ??
''), ENT_QUOTES);
2814 $tone = (string)($stat[
'tone'] ??
'');
2815 $class =
'dbx-grid-stat';
2817 if ($tone ===
'ok') {
2818 $class .=
' dbx-grid-stat-ok';
2819 } elseif ($tone ===
'lock') {
2820 $class .=
' dbx-grid-stat-lock';
2821 } elseif ($tone !==
'') {
2822 $class .=
' dbx-grid-stat-' . preg_replace(
'/[^a-z0-9_-]/i',
'', $tone);
2825 $html .=
'<div class="' .
$class .
'"><span>' . $label .
'</span><strong>' .
$value .
'</strong></div>';
2833 if ($this->_mode !==
'tabulurator') {
2839 $withForm = (string)($this->_replaces[
'frame_use_form'] ??
'0') !==
'0';
2840 if (array_key_exists(
'with_form',
$options)) {
2841 $withForm = (bool)
$options[
'with_form'];
2843 $panelClass = trim(
'dbxReport ' . (
string)($this->_replaces[
'report_shell_class'] ??
'') .
' ' . (
string)($this->_replaces[
'shell_panel_class'] ??
''));
2844 $frameId = trim((
string)($this->_replaces[
'frame_id'] ??
''));
2845 if ($frameId ===
'') {
2846 $frameId =
'dbx_target_' . $i;
2849 $this->add_rep(
'frame_id', $frameId);
2850 if (trim((
string)($this->_replaces[
'frame_panel_class'] ??
'')) ===
'') {
2851 $this->add_rep(
'frame_panel_class', trim($panelClass));
2853 $panelAttrs = (string)($this->_replaces[
'report_shell_attrs'] ??
'');
2854 if ($panelAttrs ===
'') {
2855 $panelAttrs = (string)($this->_replaces[
'shell_panel_attrs'] ??
'');
2857 $this->add_rep(
'frame_panel_attrs', $panelAttrs);
2858 $this->add_rep(
'frame_subbar',
'');
2859 $this->add_rep(
'frame_body_class', (
string)($this->_replaces[
'shell_body_class'] ??
''));
2860 $this->add_rep(
'frame_body_head', (
string)($this->_replaces[
'frame_body_head'] ??
''));
2861 $this->add_rep(
'frame_body_tail', (
string)($this->_replaces[
'frame_body_tail'] ??
''));
2864 $reportFormClass = trim((
string)($this->_replaces[
'report_form_class'] ??
''));
2865 $reportFormAttrs = trim((
string)($this->_replaces[
'report_form_attrs'] ??
''));
2866 $this->add_rep(
'frame_form_open',
'<form action="' . htmlspecialchars((
string)$this->_action, ENT_QUOTES) .
'" method="post" id="dbx_form_' . $i .
'" class="dbxAjax' . ($reportFormClass !==
'' ?
' ' . $reportFormClass :
'') .
'"' . ($reportFormAttrs !==
'' ?
' ' . $reportFormAttrs :
'') .
'>');
2867 $this->add_rep(
'frame_form_close',
'</form>');
2869 $this->add_rep(
'frame_form_open',
'');
2870 $this->add_rep(
'frame_form_close',
'');
2882 $rcount = (int) $this->_rcount;
2883 $countAll = ($this->_count_all >= 0) ? (
int) $this->_count_all : $rcount;
2885 $content = str_replace(
'{pagination:count_all}', (
string) $countAll, (
string)
$content);
2886 $content = str_replace(
'{pagination:count_selected}', (
string) $rcount, (
string)
$content);
2888 $content = str_replace(
'{report_extra_stats}', (
string)($this->_replaces[
'report_extra_stats'] ??
''), (
string)
$content);
2889 $content = str_replace(
'{report_bar_actions}', (
string)($this->_replaces[
'report_bar_actions'] ??
''), (
string)
$content);
2895 return preg_replace(
2896 '/<div class="dbx-report-bar-field"[^>]*>\s*\{obj:[a-z0-9_]+\}\s*<\/div>\s */i',
2910 $msg = trim((
string) $msg);
2916 $editor =
dbx()->get_system_var(
'dbx_editor', 0,
'int');
2918 if (!$editor && preg_match(
'/^#form_msg_(info|success|error|warning)#$/', $msg)) {
2933 if ($error ===
'' && !empty($this->_msg_err)) {
2937 if ($error !==
'') {
2949 if ($success !==
'') {
2954 return $this->
get_form_msg(
'error',
'Pruefen Sie bitte Ihre Eingaben.');
2978 $actionUrl = (string)$action;
2980 if ($actionUrl !==
'' && $actionUrl[0] ===
'&') {
2984 if ($actionUrl !==
'') {
2985 $actionUrl =
dbx()->action_url($actionUrl);
2988 parent::add_action($obj,
$tpl, $actionUrl, $data);
2990 if ($dbx_do ===
'') {
2996 if (
$tpl ===
'action_button_delete') {
2997 $confirm = (string) $this->_msg_confirm_delete;
3000 $this->_report_multi_actions[$dbx_do] = array(
3001 'obj' => (
string) $obj,
3003 'tpl' => (
string)
$tpl,
3004 'action' => (
string) $actionUrl,
3006 'quick' => in_array($dbx_do, array(
'multi_select',
'multi_deselect'),
true),
3016 $action = (string) $action;
3018 if ($action ===
'' || $action[0] !==
'&') {
3022 if (preg_match(
'/(?:^|&)dbx_do=([^&]+)/', $action, $match)) {
3023 return (
string) $match[1];
3026 if (preg_match(
'/(?:^|&)dbx_run2=([^&]+)/', $action, $match)) {
3027 return (
string) $match[1];
3040 'action_button_delete' => array(
3041 'key' =>
'action_delete_selected',
3042 'de' =>
'Ausgewählte löschen',
3043 'en' =>
'Delete selected',
3044 'es' =>
'Eliminar seleccionados',
3046 'action_button_activate' => array(
3047 'key' =>
'action_activate_selected',
3048 'de' =>
'Ausgewählte aktivieren',
3049 'en' =>
'Activate selected',
3050 'es' =>
'Activar seleccionados',
3052 'action_button_deactivate' => array(
3053 'key' =>
'action_deactivate_selected',
3054 'de' =>
'Ausgewählte deaktivieren',
3055 'en' =>
'Deactivate selected',
3056 'es' =>
'Desactivar seleccionados',
3058 'action_button_select' => array(
3059 'key' =>
'action_select_visible',
3060 'de' =>
'Sichtbare auswählen',
3061 'en' =>
'Select visible',
3062 'es' =>
'Seleccionar visibles',
3064 'action_button_deselect' => array(
3065 'key' =>
'action_deselect_visible',
3066 'de' =>
'Sichtbare abwählen',
3067 'en' =>
'Deselect visible',
3068 'es' =>
'Deseleccionar visibles',
3072 if (!isset($labels[
$tpl])) {
3073 return (
string)
$tpl;
3076 $language = in_array($this->
_dbx_lng, array(
'en',
'es'),
true)
3097 $db =
dbx()->get_system_obj(
'dbxDB');
3099 $fld_id = $this->_fld_id ? $this->_fld_id :
'id';
3103 if (!is_array($selects) || !count($selects)) {
3111 foreach ($selects as $id) {
3118 if (preg_match(
'/^-?\d+$/', $key)) {
3119 $where = $fld_id .
'=' . (int) $key;
3121 $where = $fld_id .
"='" . addslashes($key) .
"'";
3124 $ok =
$db->delete(
$dd, $where, $verify_access, $trace);
3127 if ((
int)
$ok > 0) {
3134 $this->_count_selects = -1;
3137 'deleted' => $deleted,
3139 'total' => $deleted +
$failed,
3151 $deleted = (int) (
$result[
'deleted'] ?? 0);
3153 $language = in_array($this->
_dbx_lng, array(
'en',
'es'),
true)
3157 if ($deleted <= 0 &&
$failed <= 0) {
3161 if ($deleted > 0 &&
$failed === 0) {
3162 if ($deleted === 1) {
3164 'de' =>
'1 Datensatz gelöscht.',
3165 'en' =>
'1 record was deleted.',
3166 'es' =>
'Se eliminó 1 registro.',
3174 'de' => $deleted .
' Datensätze gelöscht.',
3175 'en' => $deleted .
' records were deleted.',
3176 'es' =>
'Se eliminaron ' . $deleted .
' registros.',
3179 'multi_delete_many',
3180 array(
'count' => $deleted),
3189 'de' => $deleted .
' Datensätze gelöscht, ' .
$failed .
' fehlgeschlagen.',
3190 'en' => $deleted .
' records were deleted; ' .
$failed .
' failed.',
3191 'es' =>
'Se eliminaron ' . $deleted .
' registros; ' .
$failed .
' fallaron.',
3194 'multi_delete_partial',
3195 array(
'deleted' => $deleted,
'failed' =>
$failed),
3202 'de' =>
'Löschen fehlgeschlagen.',
3203 'en' =>
'Deletion failed.',
3204 'es' =>
'La eliminación falló.',
3207 'multi_delete_failed',
3218 if (!$this->_create_row_select || !$this->_report_multi_actions) {
3222 if (isset($this->_obj[
'report_footer'])) {
3226 $selectOptions =
'';
3230 foreach ($this->_report_multi_actions as $dbx_do => $action) {
3231 if (!empty($action[
'quick'])) {
3237 (
string) ($action[
'tpl'] ??
'')
3239 $actionSuffix = (string) ($action[
'action'] ??
'');
3240 $actionUrl = $actionSuffix;
3242 if ($actionSuffix !==
'' && $actionSuffix[0] ===
'&') {
3246 $selectOptions .= $this->
get_tpl(
'dbx|report-footer-action-option', array(
3247 'value' => (
string) $dbx_do,
3251 $actionLink = trim($this->
get_tpl((
string) ($action[
'tpl'] ??
'dbx|action_button'), array(
3252 'action' => $actionUrl,
3255 'report_action_confirm_title',
3257 'de' =>
'Aktion bestätigen',
3258 'en' =>
'Confirm action',
3259 'es' =>
'Confirmar acción',
3260 )[in_array($this->
_dbx_lng, array(
'en',
'es'),
true)
3264 'confirm' => (
string) ($action[
'confirm'] ??
''),
3269 if ($actionLink !==
'') {
3270 $actionLinks .= $this->
get_tpl(
'dbx|report-footer-action-link', array(
3271 'value' => (
string) $dbx_do,
3272 'action_link' => $actionLink,
3281 $i = (int) $this->_next_i;
3282 $actionMain = $this->
get_tpl(
'dbx|report-footer-action-main', array(
3283 'action_id' =>
'dbx_report_action_' . $i,
3284 'report_action_options' => $selectOptions,
3285 'report_action_links' => $actionLinks,
3288 $html = trim($this->
get_tpl(
'dbx|report-footer', array(
3289 'report_action_main' => $actionMain,
3305 if (!isset($this->_obj[
'report_footer'])) {
3309 if (strpos(
$content,
'{obj:report_footer}') !==
false) {
3313 if (stripos(
$content,
'<tfoot') !==
false) {
3317 return (
string) preg_replace(
3318 '/<\/tbody>\s*<\/table>/i',
3319 '</tbody>{obj:report_footer}</table>',
3326 $page =
dbx()->get_request_var(
'page', 0,
'int');
3327 $size =
dbx()->get_request_var(
'size', 0,
'int');
3328 $limit =
dbx()->get_request_var(
'limit', 0,
'int');
3329 $offset =
dbx()->get_request_var(
'offset', -1,
'int');
3332 $this->_rrows = $size;
3333 } elseif ($limit > 0) {
3334 $this->_rrows = $limit;
3338 $this->_rpos = $offset;
3339 } elseif (
$page > 0 && $this->_rrows > 0) {
3340 $this->_rpos = ((
$page - 1) * $this->_rrows);
3347 if (!is_array($this->_rdata)) {
3351 foreach ($this->_rdata as $record) {
3352 $this->_record = $record;
3354 $this->run_body($dummy);
3355 $record = $this->_record;
3357 if (!is_array($record)) {
3379 $count = (int) $this->_rcount;
3380 $rrows = (int) $this->_rrows;
3381 $rpos = (int) $this->_rpos;
3387 $page = (int) floor($rpos / $rrows) + 1;
3390 header(
'Content-Type: application/json; charset=utf-8');
3392 echo json_encode(array(
3395 'rows' => array_values(
$rows),
3400 ), JSON_UNESCAPED_UNICODE);
3406 dbx()->debug(
'create_selection_fields');
3419 $before = array_keys($this->_flds);
3421 $added = array_diff(array_keys($this->_flds), $before);
3423 foreach ($this->_report_state_flds as $key =>
$state) {
3424 if (!array_key_exists($key, $this->_data)) {
3425 $this->_data[$key] =
$state[
'default'] ??
'';
3429 foreach ($added as $key) {
3430 if (!array_key_exists($key, $this->_data)) {
3431 $this->_data[$key] = $this->
get_dd(
$source, $key,
'default');
3438 public function init($fid,
$tpl =
'', $first_page_lines = -1, $next_page_lines = -1, $current_line = -1) {
3439 if ($fid ==
'pagination')
return;
3440 $this->
_dbx_modul=
dbx()->get_system_var(
'dbx_activ_modul',
'dbx',
'*');
3445 $modul = $this->_dbx_modul ;
3446 $modul_key = $modul .
'-rpt-' . $this->_fid;
3449 if ($first_page_lines <= 0) $first_page_lines = 999999;
3450 if ($next_page_lines <= 0) $next_page_lines = 999999;
3452 if ($current_line <= 0) $current_line = 0;
3454 $current_page_line = 0;
3457 if ($current_line >= 0) {
3458 if ($current_line < $first_page_lines) {
3460 $current_page_line = $current_line;
3462 $remaining_lines = $current_line - $first_page_lines;
3463 $current_page = 2 + intval($remaining_lines / $next_page_lines);
3464 $current_page_line = ($remaining_lines % $next_page_lines);
3470 $this->_current_page = $current_page;
3471 $this->_current_report_ln = $current_line;
3472 $this->_current_page_ln = $current_page_line;
3473 $this->_first_page_lines = $first_page_lines;
3474 $this->_next_page_lines = $next_page_lines;
3476 $this->_fld_haeder =
'';
3477 $this->_haeder_report =
'';
3478 $this->_footer_report =
'';
3479 $this->_haeder_page =
'';
3480 $this->_footer_page =
'';
3481 $this->_haeder_next_page =
'';
3482 $this->_footer_next_page =
'';
3484 dbx()->set_remember_var(
'last_report_i', $this->_next_i, $modul_key);
3487 $this->_multi_select_work =
'';
3503 $i = $this->_next_i;
3508 $mode = $this->_mode;
3509 $flds = $this->_rflds;
3511 if (!is_array($flds)) $flds = array();
3513 $this->
_dbx_modul=
dbx()->get_system_var(
'dbx_activ_modul',
'dbx',
'*');
3514 $this->_auto_flds = $flds;
3515 $this->_auto_mode =
$mode;
3519 $oDB =
dbx()->get_system_obj(
'dbxDB');
3520 if (method_exists(
$oDB,
'get_dd_file')) {
3530 $replaces = $this->_replaces;
3532 if (
$mode ==
'tabulurator') {
3537 'report_shell_class' =>
'',
3538 'report_shell_attrs' =>
'',
3539 'report_form_class' =>
'',
3540 'report_form_attrs' =>
'',
3541 'shell_panel_class' =>
'',
3542 'shell_panel_attrs' =>
'',
3543 'shell_body_class' =>
'',
3544 ) as $shellKey => $shellDefault) {
3545 if (!isset($replaces[$shellKey]) || (
string) $replaces[$shellKey] ===
'') {
3546 $replaces[$shellKey] = $shellDefault;
3550 if (strpos(
$tpl,
'|') ===
false) {
3554 $report_tpl = $this->
get_tpl(
$tpl, $replaces,
'htm', $i);
3558 $report_tpl = $this->
merge_obj($report_tpl, $i);
3564 if (
$mode ==
'tabulurator') {
3567 if ($fid !=
'pagination') {
3582 $content = str_replace(
'{rpt:pages}', (
string) $this->_current_page,
$content);
3587 if (is_array($js)) {
3590 $norep_ids .=
dbx()->norep(
"\n" .
'<script type="text/javascript">' .
$javascript .
'</script>' .
"\n", $i);
3595 $norep =
'<div class="norep">' . $norep_ids .
'</div>';
3612 if ($fid !=
'pagination') {
3616 if ($fid !=
'pagination') {
3622 $haeder_report = $this->_haeder_report;
3623 $haeder_page = $this->_haeder_page;
3624 $footer_page = $this->_footer_page;
3625 $footer_report = $this->_footer_report;
3646 if (is_array($js)) {
3652 $norep_ids .=
dbx()->norep(
"\n" .
'<script type="text/javascript">' .
$javascript .
'</script>' .
"\n", $i);
3660 $norep =
'<div class="norep">' . $norep_ids .
'</div>';
set_callback_id(string $id)
Setzt den Namenspraefix fuer konventionelle Callback-Methoden.
set_callback(string $event, string $callback)
Ordnet einem Event einen konkreten Methodennamen zu.
callback(string $event, mixed $value)
Fuehrt einen Callback aus und gibt dessen Rueckgabewert zurueck.
$_options_rrows
Seitenlängenoptionen.
$_multi_page_select
Multi-Select seitenübergreifend.
$_options_rdesc
ASC/DESC Optionen.
get_count_selects()
Liefert die Anzahl aktuell selektierter Zeilen.
$_haeder_next_page
Header für Folgeseiten.
get_visible_multi_select_ids()
Liefert die aktuell im Report sichtbaren Select-IDs.
$_rpt_format
Feldformatierungen.
get_multi_selects()
Liest die aktuelle Mehrfachauswahl.
$_footer_page
Seiten-Footer.
buildReportFormMsgHtml()
Baut die sichtbare Report-Formularmeldung (leer wenn nicht gesetzt).
resolveReportMsgText($msg)
Editor-Platzhalter (form_msg_info#) im Live-Betrieb als leer behandeln.
send_multi_select_json_response(array $visibleIds=array(), $dbx_do='')
Sendet einen JSON-Response für Multi-Select-AJAX.
add_action($obj, $tpl, $action='', $data='')
Registriert Report-Aktionen und baut Footer-Select-Metadaten auf.
$_create_row_undo
Zeilen-Undo aktiv.
$_delete_tab_dd
DD der Tabelle, die über {db:delete_tab} geleert werden darf.
$_grid_cols
Grid-Spalten-Definition.
set_style_haeder($key, $style)
render_table_row_data_columns(array $record, array $auto_flds, $fld_id, $defaultClass='auto-fld')
Rendert die automatischen Body-Datenspalten.
applyReportCountReplaces($content)
Entfernt unbenutzte Report-Bar-Feldslots ({obj:...} ohne Felddefinition).
render_table_row_action_block(array $record)
Rendert den zentralen Row-Buttonblock.
enable_delete_tab($dd, $label=null)
Aktiviert den Template-Platzhalter {db:delete_tab}.
$_haeder_page
Seiten-Header.
$_grid_export_url
Export-URL.
$_grid_headerfilter
Headerfilter für Grid.
$_footer_next_page
Footer für Folgeseiten.
$_current_report_ln
Aktuelle Report-Zeile insgesamt.
clear()
Löscht den kompletten Report-Zustand und setzt saubere Defaultwerte.
run_page_haeder($content)
merge_db_placeholders($content)
Ersetzt DB-spezifische Report-Platzhalter.
$_options_rselect
Auswahloptionen.
forward_get_haeder_page()
$_page_break
Seitenumbruch-Markup.
get_report_body()
Erzeugt den HTML-Body für klassische Reportmodi.
rpt_format($key, $value)
Formatiert einen Reportwert anhand der Felddefinition.
get_visible_multi_select_state(array $visibleIds=array())
Liefert den Multi-Select-Zustand relativ zu den aktuell sichtbaren IDs.
$_count_selects
Caching für Anzahl ausgewählter Datensätze.
del_multi_select_ids(array $ids)
Entfernt mehrere IDs aus der Auswahl.
$_report_multi_actions
Registrierte Report-Mehrfachaktionen fuer Footer-Select.
$_create_row_show
Zeilen-Show aktiv.
$_add_action
Zusatzparameter an Row-Aktionen.
ensure_report_select_feature($content)
Aktiviert die Report-JS-Lib automatisch fuer Reports mit Row-Checkboxen.
get_record_rid($record, $default=-1)
Liefert die sauber ermittelte Record-ID eines Datensatzes.
apply_multi_delete_result(array $result)
Setzt Erfolgs-/Fehlermeldung nach Mehrfach-Loeschung.
$_auto_flds
Automatische Feldliste.
check_is_multiselect($rid)
Prüft, ob eine Zeile aktuell im Multi-Select aktiv ist.
init($fid, $tpl='', $first_page_lines=-1, $next_page_lines=-1, $current_line=-1)
get_report_haeder($content='')
Erzeugt den Report-Header.
get_delete_tab_button()
Rendert den Button fuer {db:delete_tab}.
$_current_page_ln
Aktuelle Zeile auf aktueller Seite.
$_table_buttons
Buttons links oder rechts.
set_footer_callback(string $callback)
$_haeder_report
Report-Header außerhalb der eigentlichen Seiten.
forward_run_haeder($content)
$_ajax
AJAX-Linkklasse für klassische Report-Buttons.
$_grid_headersort
Headersort für Grid.
$_rwhere_placeholder
Platzhaltertext für Suchfeld.
$_class_body
Body-Klassen.
del_multi_selects($id)
Entfernt IDs aus dem Remember-basierten Multi-Select.
$_footer_report
Report-Footer außerhalb der eigentlichen Seiten.
$_record
Aktueller Datensatz im Body-Lauf.
add_rwhere_select($rwhere)
Ergänzt eine WHERE-Bedingung um aktuell selektierte IDs.
forward_run_body($content)
forward_run_report_footer($content)
get_grid_action_url($url, $action)
Markiert und signiert einen schreibenden Grid-Endpunkt.
$_fld_haeder
Historischer Header-Name.
get_table_action_definitions()
Liefert die aktivierten Tabellen-Aktionsdefinitionen.
set_record_val(string $name, mixed $value)
set_page_footer_callback(string $callback)
get_table_row_action_data($type, array $record)
Baut das Standard-Datenarray für Row-Aktions-Templates.
$_grid_save_url
Save-URL für Grid.
set_tabel_tpl($tid, $tpl)
Überschreibt ein Tabellen-Template gezielt.
$_create_row_delete
Zeilen-Delete aktiv.
$_mode
Report-Modus: table|tpl|tabulurator.
$_create_row_import
Zeilen-Import aktiv.
$_grid_allow_insert
Insert im Grid erlaubt.
prepareReportFrameReplaces(int $i, array $options=array())
del_selected($rid=0)
Entfernt Datensätze nur aus der gemerkten Auswahl.
$_delete_tab_label_from_fd
Verwendet für die Delete-Tab-Aktion die Meldungsschlüssel der aktiven FD.
run_page_footer($content)
parse_report_action_code($action)
$_first_page_lines
Maximale Zeilen auf erster Seite.
$_current_page
Aktuelle logische Report-Seite.
$_grid_read_url
Read-URL für Grid.
$_create_row_export
Zeilen-Export aktiv.
$_report_state_flds
Interne Report-State-Werte ohne sichtbares Formularfeld.
render_table_header_select(array $auto_flds, $fld_id, $class, array $select_state)
Rendert die Header-Checkbox für die sichtbaren Rows.
set_header_callback(string $callback)
get_report_format($key)
Ermittelt die explizite oder automatische Reportformatierung.
get_report_action_url()
Liefert die Basis-Action-URL des aktuellen Reports.
$_create_row_download
Zeilen-Download aktiv.
$_grid_delete_url
Delete-URL für Grid.
$_but_pagination
Anzahl sichtbarer Pagination-Buttons.
$_grid_allow_delete
Delete im Grid erlaubt.
create_selection_fields($fd='fd::')
$_rdata_inline
Inline-Modus: Daten werden nur einmal in Body eingefügt.
$_create_sel_flds
Selektionsfelder erstellen.
$_grid_schema
Schema-Name für Grid.
$_delete_tab_label
Button-Label für {db:delete_tab}.
rpt_merge_obj($content)
Fügt reportweite Platzhalter, Objekte und dbxForm-Replacements ein.
$_count_all
Gesamtanzahl ohne Report-Filter; -1 = nicht separat gesetzt.
render_report_cell_value($key, $value)
Bereitet einen Tabellenwert fuer normale Reportzellen auf.
add_grid_stats(array $stats, $ariaLabel='')
fast_response_rows_json()
$_rrows
Datensätze pro Seite.
get_record_select_key($record)
Liefert den reportbezogenen Select-Key eines Datensatzes.
report_cell_allows_html($key)
Prueft, ob eine Reportzelle bewusst HTML ausgeben darf.
get_report_action_label($tpl)
forward_run_report_haeder($content)
$_grid_print_url
Print-URL für Grid/Shell.
get_record_val(string $name, mixed $default=null)
$_data_table
Daten-Tabellen-/Expander-Schalter.
$_grid_layout
Grid-Layout.
del_selected($dd, $rid=0)
Löscht ausgewählte Datensätze.
$_grid_synctime
Grid-Synctime.
$_footer
Interner Bereich: Footer.
$_msg_confirm_copy
Confirm-Text für Copy.
forward_run_page_footer($content)
forward_get_footer_page()
set_report_header_callback(string $callback)
$_create_row_copy
Zeilen-Copy aktiv.
$_grid_sync_url
Sync-URL für Grid.
render_simple_table_tpl($file, array $data)
$_table_col_count
Anzahl sichtbarer Tabellen-Spalten.
get_report_pages()
Erzeugt die Pagination des Reports.
set_page_header_callback(string $callback)
run_report_haeder($content)
cleanupReportBarSlots($content)
$_tpl_pagination
Pagination-Template.
$_msg_confirm_delete_tab
Confirm-Text für Tabellenleerung.
$_next_page_lines
Maximale Zeilen auf Folgeseiten.
buildReportFooterObj()
Baut Footer mit Aktions-Select und Schnellaktionen.
set_class_haeder($key, $class='')
$_table_render_tpl_cache
vorbereitete einfache Tabellen-Templates
set_multi_select($rid)
Fügt eine ID oder alle aktuell geladenen Reportzeilen zur Mehrfachauswahl hinzu.
set_callback_owner($owner)
Setzt ein explizites Owner-Objekt fuer Callback-Aufrufe.
$_multi_select_work
Interner Multi-Select-Arbeitsmodus.
run()
Rendert den Report mit bereits gesetzten Properties.
render_table_header_action_block()
Rendert den zentralen Header-Buttonblock.
$_tabel_tpls
Tabellen-Templates.
$_class_haeder
Header-Klassen.
$_msg_confirm_delete
Confirm-Text für Delete.
$_grid_sort_url
Sort-URL für Grid.
$_scroll_table
Scrollbare Tabelle.
add_where($mode, $select, $where='')
forward_run_footer($content)
add_rwhere_search($sql, $suchWert, $feldListe)
Ergänzt eine Such-WHERE über eine Feldliste.
forward_run_page_haeder($content)
$_body
Interner Bereich: Body.
data_rows($data, $rpos, $rrows)
set_next_record_callback(string $callback)
set_form_selects()
Verarbeitet AJAX-/Select-Aktionen für Report-Mehrfachauswahl.
$_pagelink
Pagination-Link.
set_record(array $record)
apply_tabulurator_request()
get_auto_report_format($key)
Ermittelt automatische Reportformatierung aus DD/FD-Metadaten.
delete_multi_selected_records($dd, $verify_access=1, $trace=1)
Loescht gemerkte Mehrfachauswahl Datensatz fuer Datensatz (Trace pro Zeile).
set_multi_selects($selects)
Speichert die komplette Mehrfachauswahl per Remember.
set_body_callback(string $callback)
normalize_multi_select_key($rid)
Normalisiert einen Multi-Select-Key.
$_create_row_edit
Zeilen-Edit aktiv.
set_report_footer_callback(string $callback)
$_create_row_select
Zeilen-Select aktiv.
$_grid_insert_url
Insert-URL für Grid.
$_grid_allow_edit
Edit im Grid erlaubt.
parse_multi_select_ids($raw)
Parst eine ID-Liste in ein sauberes eindeutiges Array.
$_body_inline
Inline-Body.
injectReportFooter($content)
Fuegt Report-Footer vor Tabellenende ein, falls noch kein Slot vorhanden.
$_options_rsort
Sortieroptionen.
$_auto_mode
Automatischer Ausgabemodus.
submit()
Öffentliche Submit-Abfrage.
$_style_haeder
Header-Styles.
$_rcount
Gesamtanzahl Datensätze.
del_multi_select($rid)
Entfernt eine ID oder alle IDs aus der Mehrfachauswahl.
run_report_footer($content)
$_create_row_print
Zeilen-Print aktiv.
render_table_header_data_columns(array $auto_flds, $fld_id)
Rendert die automatischen Header-Datenspalten.
$_haeder
Interner Bereich: Header.
render_table_row_select(array $record, $class)
Rendert die Row-Checkbox.
set_multi_select_ids(array $ids)
Fügt mehrere IDs zur Auswahl hinzu.
if((string)($formActionPolicy['action'] ?? '') !=='dbxAction.save'||!dbx() ->check_action_token((string)($formActionPolicy['scope'] ?? ''),(string)($formActionRoute['params']['dbx_token'] ?? ''))) $report
if($web->content_permalink_redirect_target() !=='') $tpl
if(!defined( 'IMG_WEBP')) define( 'IMG_WEBP'
foreach( $valid as $email) foreach($invalid as $email) $fd
DBX schema administration.
if($cinematic===''||!str_contains($cinematic, 'data-dbx-cinema')) $page