3require_once
'dbxForm.class.php';
147 'dbx_rpos' => array(
'default' => 0,
'rules' =>
'int'),
196 public $_page_break =
'<div class="page-break printMe"> </div><br>';
443 $this->_mode =
'table';
444 $this->_current_page = 0;
445 $this->_current_report_ln = 0;
446 $this->_current_page_ln = 0;
447 $this->_first_page_lines = 9999;
448 $this->_next_page_lines = 9999;
450 $this->_fld_haeder =
'';
452 $this->_haeder_report =
'';
453 $this->_footer_report =
'';
454 $this->_haeder_page =
'';
455 $this->_footer_page =
'';
456 $this->_haeder_next_page =
'';
457 $this->_footer_next_page =
'';
463 $this->_record = array();
464 $this->_callback_owner =
null;
465 $this->_callback_id =
'';
466 $this->_callbacks = array();
467 $this->_rdata = array();
468 $this->_rdata_inline =
false;
469 $this->_body_inline =
'';
472 $this->_count_all = -1;
476 $this->_pagelink =
'';
478 $this->_auto_flds =
'';
479 $this->_auto_mode =
'';
482 $this->_add_action =
'';
484 $this->_create_sel_flds = 0;
485 $this->_create_row_select = 0;
486 $this->_create_row_edit = 0;
487 $this->_create_row_copy = 0;
488 $this->_create_row_delete = 0;
489 $this->_create_row_download = 0;
490 $this->_create_row_show = 0;
491 $this->_create_row_export = 0;
492 $this->_create_row_import = 0;
493 $this->_create_row_undo = 0;
494 $this->_create_row_print = 0;
496 $this->_rpt_format = array();
499 $this->_table_col_count = 0;
500 $this->_multi_page_select = 0;
501 $this->_multi_select_work =
'';
502 $this->_report_multi_actions = array();
503 $this->_table_buttons =
'left';
504 $this->_table_render_tpl_cache = array();
506 $this->_data_table = 0;
507 $this->_scroll_table = 0;
509 $this->_style_haeder = array();
510 $this->_class_haeder = array();
511 $this->_class_body = array();
513 $this->_count_selects = -1;
515 $this->_msg_confirm_delete =
'Datensatz löschen ?';
516 $this->_msg_confirm_delete_tab =
'Datenbank-Tabelle wirklich leeren ?';
517 $this->_msg_confirm_copy =
'Datensatz kopieren ?';
519 $this->_delete_tab_dd =
'';
520 $this->_delete_tab_label =
'Tabelle leeren';
522 $this->_grid_read_url =
'';
523 $this->_grid_save_url =
'';
524 $this->_grid_delete_url =
'';
525 $this->_grid_insert_url =
'';
526 $this->_grid_sort_url =
'';
527 $this->_grid_sync_url =
'';
528 $this->_grid_print_url =
'';
529 $this->_grid_export_url =
'';
530 $this->_grid_schema =
'';
531 $this->_grid_id =
'';
532 $this->_grid_cols =
'';
533 $this->_grid_layout =
'fitColumns';
534 $this->_grid_headerfilter = 1;
535 $this->_grid_headersort = 1;
536 $this->_grid_allow_delete = 1;
537 $this->_grid_allow_edit = 1;
538 $this->_grid_allow_insert = 1;
539 $this->_grid_synctime =
'2';
543 $table[
'tpl_haeder_col'] =
'table_haeder_col';
544 $table[
'tpl_haeder_select'] =
'table_haeder_select';
545 $table[
'tpl_haeder_delte'] =
'table_haeder_delete';
546 $table[
'tpl_haeder_expand'] =
'table_haeder_expand';
547 $table[
'tpl_haeder_expander'] =
'table_haeder_expander';
548 $table[
'tpl_haeder_edit'] =
'table_haeder_edit';
549 $table[
'tpl_haeder_copy'] =
'table_haeder_copy';
550 $table[
'tpl_haeder_undo'] =
'table_haeder_undo';
551 $table[
'tpl_haeder_show'] =
'table_haeder_show';
552 $table[
'tpl_haeder_import'] =
'table_haeder_import';
553 $table[
'tpl_haeder_export'] =
'table_haeder_export';
554 $table[
'tpl_haeder_download'] =
'table_haeder_download';
555 $table[
'tpl_haeder_print'] =
'table_haeder_print';
557 $table[
'tpl_row_col'] =
'table_row_col';
558 $table[
'tpl_row_select'] =
'table_row_select';
559 $table[
'tpl_row_expand'] =
'table_row_expand';
560 $table[
'tpl_row_expander'] =
'table_row_expander';
561 $table[
'tpl_row_edit'] =
'table_row_edit';
562 $table[
'tpl_row_copy'] =
'table_row_copy';
563 $table[
'tpl_row_delete'] =
'table_row_delete';
564 $table[
'tpl_row_save'] =
'table_row_save';
565 $table[
'tpl_row_undo'] =
'table_row_undo';
566 $table[
'tpl_row_show'] =
'table_row_show';
567 $table[
'tpl_row_export'] =
'table_row_export';
568 $table[
'tpl_row_import'] =
'table_row_import';
569 $table[
'tpl_row_download'] =
'table_row_download';
570 $table[
'tpl_row_print'] =
'table_row_print';
572 if ($this->_multi_page_select) {
573 $table[
'tpl_haeder_select'] =
'table_haeder_select-multi';
574 $table[
'tpl_row_select'] =
'table_row_select-multi';
577 $this->_tabel_tpls =
$table;
589 $this->_tabel_tpls[$tid] = $tpl;
605 if ($this->_action) {
614 $run1 =
dbx()->get_modul_var(
'dbx_run1', 0);
618 $run2 =
dbx()->get_modul_var(
'dbx_run2', 0);
621 $url =
'?dbx_modul=' . $modul;
624 $url .=
'&dbx_run1=' . $run1;
628 $url .=
'&dbx_run2=' . $run2;
643 $this->_delete_tab_dd = (string) $dd;
644 $this->_delete_tab_label = (string) $label;
646 if (!$this->_dd && $this->_delete_tab_dd) {
657 if (!$this->_delete_tab_dd) {
664 $action .= (strpos($action,
'?') ===
false) ?
'?' :
'&';
665 $action .=
'dbx_do=delete_tab';
670 'label' => $this->_delete_tab_label,
671 'title' =>
'Tabelle leeren',
672 'confirm' => $this->_msg_confirm_delete_tab,
673 'class' =>
'btn-danger',
674 'tooltip' =>
'Datenbank-Tabelle leeren',
677 $tpl = $this->
get_tpl(
'dbx|action_button_delete_tab', $data);
707 $rid = trim((
string) $rid);
732 if (!is_array($record)) {
736 if ($this->_fld_id && array_key_exists($this->_fld_id, $record)) {
740 if (array_key_exists(
'rid', $record)) {
741 return $record[
'rid'];
744 if (array_key_exists(
'id', $record)) {
745 return $record[
'id'];
748 if (array_key_exists(
'recnum', $record)) {
749 return $record[
'recnum'];
756 if (!is_array($this->_record)) {
764 $this->_record = $record;
768 if (!is_array($this->_record)) {
772 if (array_key_exists($name, $this->_record)) {
773 return $this->_record[$name];
780 if (!is_array($this->_record)) {
781 $this->_record = array();
784 $this->_record[$name] = $value;
788 if (is_object($owner)) {
789 $this->_callback_owner = $owner;
833 if (is_array($record) && array_key_exists(
'id', $record)) {
859 if (is_array($raw)) {
860 foreach ($raw as $value) {
868 return array_keys($ids);
871 $raw = trim((
string) $raw);
877 if ($raw[0] ===
'[') {
878 $decoded = json_decode($raw,
true);
880 if (is_array($decoded)) {
885 $parts = preg_split(
'/[|,\s;]+/', $raw);
887 if (!is_array($parts)) {
891 foreach ($parts as $value) {
899 return array_keys($ids);
912 foreach ($ids as $rid) {
933 foreach ($ids as $rid) {
936 if ($key !==
'' && isset($selects[$key])) {
937 unset($selects[$key]);
952 if (!is_array($this->_rdata)) {
956 foreach ($this->_rdata as $record) {
964 return array_keys($ids);
980 $selectedVisible = array();
982 foreach ($visibleIds as $rid) {
985 if ($key !==
'' && isset($selects[$key])) {
986 $selectedVisible[] = $key;
990 $visibleCount = count($visibleIds);
991 $selectedCount = count($selectedVisible);
992 $headerState =
'none';
994 if ($visibleCount > 0 && $selectedCount === $visibleCount) {
995 $headerState =
'all';
996 } elseif ($selectedCount > 0) {
997 $headerState =
'partial';
1001 'visible_ids' => array_values($visibleIds),
1002 'selected_ids_visible' => array_values($selectedVisible),
1003 'visible_count' => $visibleCount,
1004 'selected_count' => $selectedCount,
1005 'header_state' => $headerState,
1006 'header_checked' => ($headerState ===
'all') ? 1 : 0,
1019 $quick =
dbx()->get_modul_var(
'dbx_select_quick', 1,
'int');
1022 http_response_code(204);
1023 if (function_exists(
'session_write_close')) {
1024 session_write_close();
1033 'dbx_do' => $dbx_do,
1035 'visible_ids' => $state[
'visible_ids'],
1036 'selected_ids_visible' => $state[
'selected_ids_visible'],
1037 'visible_count' => $state[
'visible_count'],
1038 'visible_selected_count' => $state[
'selected_count'],
1039 'header_state' => $state[
'header_state'],
1042 header(
'Content-Type: application/json; charset=utf-8');
1043 echo json_encode(
$response, JSON_UNESCAPED_UNICODE);
1044 if (function_exists(
'session_write_close')) {
1045 session_write_close();
1066 if ($key !==
'' && isset($selects[$key])) {
1067 $checked =
'checked="checked"';
1084 foreach ($this->_rdata as $record) {
1115 if ($key !==
'' && isset($selects[$key])) {
1116 unset($selects[$key]);
1133 $normalized = array();
1134 $modul = $this->_dbx_modul ;
1135 $modul_key = $modul .
'-rpt-' . $this->_fid;
1136 if (is_array($selects)) {
1137 foreach ($selects as $rid => $value) {
1141 $normalized[$key] = 1;
1145 dbx()->set_remember_var(
'multi_select', $normalized, $modul_key);
1146 $this->_count_selects = -1;
1165 if ($key !==
'' && isset($ids[$key])) {
1178 $modul = $this->_dbx_modul ;
1179 $modul_key = $modul .
'-rpt-' . $this->_fid;
1180 $selects =
dbx()->get_remember_var(
'multi_select', array(), $modul_key);
1182 if (!is_array($selects)) {
1186 $normalized = array();
1188 foreach ($selects as $rid => $value) {
1189 $xkey = $this->normalize_multi_select_key($rid);
1192 $normalized[$xkey] = 1;
1205 $count = $this->_count_selects;
1209 $count = is_array($selects) ? count($selects) : 0;
1210 $this->_count_selects =
$count;
1250 if (isset($selects[$key])) {
1251 unset($selects[$key]);
1268 $fld_id = $this->_fld_id ? $this->_fld_id :
'id';
1270 if (!is_array($selects) || !count($selects)) {
1272 $rwhere .=
' and (1=0)';
1275 if ($rwhere ==
'') {
1284 foreach ($selects as $id => $sel) {
1291 if (preg_match(
'/^-?\d+$/', $key)) {
1292 $values[] = (string) ((
int) $key);
1294 $values[] =
"'" . addslashes($key) .
"'";
1298 if (!count($values)) {
1300 $rwhere .=
' and (1=0)';
1303 if ($rwhere ==
'') {
1310 $selectWhere = $fld_id .
' IN (' . implode(
',', $values) .
')';
1313 $rwhere .=
' and (' . $selectWhere .
')';
1315 $rwhere = $selectWhere;
1331 if ($suchWert ===
null) {
1335 $suchWert = str_replace(array(
'\'',
'"',
'\\',
'%'),
'', $suchWert);
1336 $suchWert = filter_var($suchWert, FILTER_SANITIZE_SPECIAL_CHARS);
1338 $datum = DateTime::createFromFormat(
'd.m.Y', $suchWert);
1340 if ($datum && $datum->format(
'd.m.Y') === $suchWert) {
1341 $suchWert = $datum->format(
'Y-m-d');
1344 $felder = explode(
',', $feldListe);
1346 $bedingungen = array();
1348 foreach ($felder as $feld) {
1349 $feld = trim($feld);
1355 $bedingungen[] =
"$feld LIKE '$suchWert%'";
1358 $sql .= implode(
' OR ', $bedingungen);
1377 $dbx_do =
dbx()->get_modul_var(
'dbx_do',
'',
'parameter');
1378 $ajax =
dbx()->get_system_var(
'dbx_ajax', 0,
'int');
1380 if ($dbx_do ===
'selection_state') {
1381 $idsRaw =
dbx()->get_modul_var(
'dbx_select_ids',
'',
'*');
1382 $visibleRaw =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1387 $visibleIds = $selected;
1390 $selectedMap = array_flip($selected);
1392 foreach ($visibleIds as $rid) {
1393 if (isset($selectedMap[$rid])) {
1407 if ($dbx_do ===
'row_select') {
1408 $state =
dbx()->get_modul_var(
'dbx_select_state', 0,
'int');
1409 $rid =
dbx()->get_modul_var(
'rid',
'',
'parameter+.');
1410 $selectId =
dbx()->get_modul_var(
'dbx_select_id',
'',
'parameter+.');
1411 $visibleIds =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1413 if ($selectId !==
'') {
1437 if ($dbx_do ===
'rows_select') {
1438 $state =
dbx()->get_modul_var(
'dbx_select_state', 0,
'int');
1439 $idsRaw =
dbx()->get_modul_var(
'dbx_select_ids',
'',
'*');
1440 $visibleRaw =
dbx()->get_modul_var(
'dbx_select_visible_ids',
'',
'*');
1461 if ($dbx_do ===
'clear_selects') {
1485 if ($reform ==
'php-date-usr' || $reform ==
'date') {
1490 $reform ==
'php-datetime-usr' ||
1491 $reform ==
'date_time' ||
1492 $reform ==
'datetime' ||
1493 $reform ==
'datetime_ms'
1498 if ($reform ==
'html-chars') {
1499 $value = htmlspecialchars((
string) $value, ENT_QUOTES | ENT_SUBSTITUTE,
'UTF-8');
1502 if ($value ===
null) {
1517 $format = $this->_rpt_format;
1520 if (is_array($format)) {
1521 if (isset($format[$key])) {
1522 $reform = $format[$key];
1528 if ($reform ===
'') {
1532 return (
string) $reform;
1545 return in_array($format, array(
'html',
'raw-html',
'raw',
'tpl',
'template'),
true);
1561 if ($value ===
null) {
1565 return (
string) $value;
1580 static $cache = array();
1582 if (!$this->_dd || !$key) {
1586 $dd = (string) $this->_dd;
1587 $key = (string) $key;
1588 $cacheKey = $dd .
'|' . $key;
1590 if (array_key_exists($cacheKey, $cache)) {
1591 return $cache[$cacheKey];
1595 $convert = strtolower(trim((
string) $this->
get_dd($dd, $key,
'convert')));
1597 if (in_array($convert, array(
'date',
'php-date-usr'),
true)) {
1598 $format =
'php-date-usr';
1599 $cache[$cacheKey] = $format;
1603 if (in_array($convert, array(
'date_time',
'datetime',
'datetime_ms',
'php-datetime-usr'),
true)) {
1604 $format =
'php-datetime-usr';
1605 $cache[$cacheKey] = $format;
1609 $type = strtolower(trim((
string) $this->
get_dd($dd, $key,
'type')));
1611 if ($type ==
'date') {
1612 $format =
'php-date-usr';
1613 $cache[$cacheKey] = $format;
1617 if (in_array($type, array(
'datetime',
'date_time',
'datetime_ms',
'timestamp'),
true)) {
1618 $format =
'php-datetime-usr';
1619 $cache[$cacheKey] = $format;
1623 $cache[$cacheKey] =
'';
1637 $count_cols = $this->_table_col_count;
1638 $page = $this->_current_page;
1639 $page_break = $this->_page_break;
1641 $content = str_replace(
'{rpt:count_sel}', $count_select, $content);
1642 $content = str_replace(
'{rpt:col_count}', $count_cols, $content);
1643 $content = str_replace(
'{rpt:page}', $page, $content);
1644 $content = str_replace(
'{rpt:pagebrak}', $page_break, $content);
1646 if (is_array($this->_obj)) {
1647 foreach ($this->_obj as $key => $value) {
1648 $xkey =
'{obj:' . $key .
'}';
1650 if ($value ===
null) {
1654 $content = str_replace($xkey, $value, $content);
1674 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'report_header', $content) : $content;
1679 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'page_header', $content) : $content;
1684 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'page_footer', $content) : $content;
1693 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'report_footer', $content) : $content;
1698 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'header', $content) : $content;
1703 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'body', $content) : $content;
1708 $content = ($this->_fid !=
'pagination') ? $this->
callback(
'footer', $content) : $content;
1717 $footer = $this->_footer_next_page;
1718 $footer .= $this->_footer_page;
1725 $haeder = $this->_haeder_page;
1726 $haeder .= $this->_haeder_next_page;
1748 private function get_class_body($xkey) {
1751 if (isset($this->_class_body[$xkey])) {
1752 $class = $this->_class_body[$xkey];
1763 if ($rpt !=
'pagination') {
1764 $this->_current_report_ln++;
1765 $this->_current_page_ln++;
1767 $pn = $this->_current_page;
1768 $ln = $this->_current_page_ln;
1771 $max = $this->_first_page_lines;
1773 $max = $this->_next_page_lines;
1778 $this->_current_page_ln = 1;
1785 return $page_footer . $page_haeder . $content;
1794 $class =
'th-' . $key;
1797 $this->_class_haeder[$key] = $class;
1800 private function get_class_haeder($key) {
1803 if (is_array($this->_class_haeder)) {
1804 if (isset($this->_class_haeder[$key])) {
1805 $class = $this->_class_haeder[$key];
1810 $class =
'th-' . $key;
1817 $this->_style_haeder[$key] = $style;
1820 private function get_style_haeder($key) {
1823 if (is_array($this->_style_haeder)) {
1824 if (isset($this->_style_haeder[$key])) {
1825 $style = $this->_style_haeder[$key];
1843 'type' =>
'expander',
1844 'enabled' => (
bool) $this->_data_table,
1845 'header_tpl' =>
'tpl_haeder_expander',
1846 'row_tpl' =>
'tpl_row_expander',
1850 'enabled' => (
bool) $this->_create_row_edit,
1851 'header_tpl' =>
'tpl_haeder_edit',
1852 'row_tpl' =>
'tpl_row_edit',
1856 'enabled' => (
bool) $this->_create_row_copy,
1857 'header_tpl' =>
'tpl_haeder_copy',
1858 'row_tpl' =>
'tpl_row_copy',
1862 'enabled' => (
bool) $this->_create_row_show,
1863 'header_tpl' =>
'tpl_haeder_show',
1864 'row_tpl' =>
'tpl_row_show',
1868 'enabled' => (
bool) $this->_create_row_export,
1869 'header_tpl' =>
'tpl_haeder_export',
1870 'row_tpl' =>
'tpl_row_export',
1874 'enabled' => (
bool) $this->_create_row_import,
1875 'header_tpl' =>
'tpl_haeder_import',
1876 'row_tpl' =>
'tpl_row_import',
1879 'type' =>
'download',
1880 'enabled' => (
bool) $this->_create_row_download,
1881 'header_tpl' =>
'tpl_haeder_download',
1882 'row_tpl' =>
'tpl_row_download',
1886 'enabled' => (
bool) $this->_create_row_delete,
1887 'header_tpl' =>
'tpl_haeder_delte',
1888 'row_tpl' =>
'tpl_row_delete',
1892 'enabled' => (
bool) $this->_create_row_print,
1893 'header_tpl' =>
'tpl_haeder_print',
1894 'row_tpl' =>
'tpl_row_print',
1900 if (!isset($this->_table_render_tpl_cache[$file])) {
1901 $this->_table_render_tpl_cache[$file] = $this->
get_tpl($file, array());
1904 return $this->oTPL->replaces($this->_table_render_tpl_cache[$file], $data);
1917 if (!$def[
'enabled']) {
1921 $file = $this->_tabel_tpls[$def[
'header_tpl']];
1924 'class' =>
'no-sort',
1927 $html .= $tpl .
"\n";
1951 'class' =>
'no-sort',
1955 if ($type ===
'download') {
1956 $dat[
'href_dir_file'] =
dbx()->get_modul_var(
'href_dir_file',
'',
'*');
1959 if ($type ===
'copy') {
1960 $dat[
'confirm'] = $this->_msg_confirm_copy;
1963 if ($type ===
'delete') {
1964 $dat[
'confirm'] = $this->_msg_confirm_delete;
1967 if ($this->_fid !=
'pagination') {
1970 'record' => $record,
1974 $data = $this->
callback(
'row_action_data', $data);
1976 if (is_array($data) && isset($data[
'data']) && is_array($data[
'data'])) {
1977 $dat = $data[
'data'];
1995 if (!$def[
'enabled']) {
1999 $file = $this->_tabel_tpls[$def[
'row_tpl']];
2003 $html .= $tpl .
"\n";
2020 $file = $this->_tabel_tpls[
'tpl_haeder_select'];
2021 $name = isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] :
'xID';
2024 if (!empty($select_state[
'header_checked'])) {
2025 $checked =
'checked="checked"';
2030 'checked' => $checked,
2032 'header_state' => isset($select_state[
'header_state']) ? $select_state[
'header_state'] :
'none',
2045 $file = $this->_tabel_tpls[
'tpl_row_select'];
2046 $name = $this->_fid .
'_select';
2051 $this->_post[$name] = 1;
2058 'checked' => $checked,
2076 foreach ($auto_flds as $key => $value) {
2079 if ($this->_create_row_select && $key == $fld_id) {
2083 if (!$skip && $value >
'') {
2084 $file = $this->_tabel_tpls[
'tpl_haeder_col'];
2085 $class = $this->get_class_haeder($key);
2086 $style = $this->get_style_haeder($key);
2095 $html .= $tpl .
"\n";
2119 foreach ($auto_flds as $no => $key) {
2122 $label = $auto_flds[$no];
2125 if (isset($record[$key])) {
2127 } elseif (isset($record[$no])) {
2131 if ($this->_create_row_select && $xkey == $fld_id) {
2135 if (!$skip && $label >
'') {
2137 $value = $record[$xkey];
2141 $class = $defaultClass;
2143 if ($defaultClass !==
'auto-fld') {
2144 $class = $this->get_class_body($xkey);
2147 $class = trim($class .
' dbx-report-cell');
2156 $html .= $tpl .
"\n";
2172 $content = $this->_haeder;
2175 $this->_current_page++;
2177 $auto_flds = $this->_auto_flds;
2178 $auto_mode = $this->_auto_mode;
2181 if (!is_array($auto_flds)) {
2182 if (is_string($auto_flds) && $auto_flds !==
'') {
2183 $auto_flds = explode(
',', $auto_flds);
2185 $auto_flds = array();
2189 $pos = strpos($content,
'[rpt:row]');
2191 if ($pos !==
false) {
2193 $fld_id = $this->_fld_id;
2195 if ($auto_mode ==
'table' && is_array($auto_flds)) {
2199 if ($this->_table_buttons !=
'left') {
2200 if ($this->_create_row_select) {
2204 $this->get_class_haeder(isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] :
'xID'),
2210 $row .= $columnBlock[
'html'];
2211 $col_count += $columnBlock[
'count'];
2213 $row .= $buttonBlock[
'html'];
2214 $col_count += $buttonBlock[
'count'];
2216 $row .= $buttonBlock[
'html'];
2217 $col_count += $buttonBlock[
'count'];
2219 if ($this->_create_row_select) {
2229 $row .= $columnBlock[
'html'];
2230 $col_count += $columnBlock[
'count'];
2233 $this->_table_col_count = $col_count;
2236 $content = str_replace(
'[rpt:row]', $row, $content);
2254 $auto_flds = $this->_auto_flds;
2255 $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 if (is_array($this->_rdata)) {
2266 foreach ($this->_rdata as $recnum => $record) {
2268 $line = $this->_body;
2270 $this->_record = $record;
2271 $record = ($this->_fid !=
'pagination') ? $this->callback(
'next_record', $record) : $record;
2272 $this->_record = $record;
2274 if (!is_array($record)) {
2278 $line = $this->run_body($line);
2279 $record = $this->_record;
2281 if (!is_array($record)) {
2285 $fld_id = $this->_fld_id;
2286 $pos = strpos($line,
'[rpt:row]');
2288 if ($pos !==
false && $this->_rdata_inline) {
2289 $inline = $this->_body_inline;
2290 return str_replace(
'[rpt:row]', $inline, $line);
2293 if ($pos !==
false) {
2296 if ($auto_mode ==
'table' && is_array($auto_flds)) {
2297 $buttonBlock = $this->render_table_row_action_block($record);
2299 if ($this->_table_buttons !=
'left') {
2300 if ($this->_create_row_select) {
2301 $row .= $this->render_table_row_select($record,
'no-sort') .
"\n";
2304 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id,
'auto-fld');
2305 $row .= $buttonBlock;
2307 $row .= $buttonBlock;
2309 if ($this->_create_row_select) {
2310 $row .= $this->render_table_row_select($record,
'no-sort') .
"\n";
2313 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id,
'body');
2317 $line = str_replace(
'[rpt:row]', $row, $line);
2320 $tr_class = $this->get_class_tr($record);
2321 $tr_class .= ($loop % 2 != 0) ?
' odd' :
' even';
2323 $line = str_replace(
'{tr-class}', $tr_class, $line);
2325 if (is_array($record)) {
2326 foreach ($record as
$field => $value) {
2327 $field_name =
'{' .
$field .
'}';
2329 if (strpos($line, $field_name) ===
false) {
2333 $value = $this->rpt_format(
$field, $value);
2335 if (!is_array($value) && !is_object($value)) {
2336 if ($value ===
null) {
2340 $line = str_replace($field_name, (
string) $value, $line);
2345 $col_count = $this->_table_col_count;
2346 $line = str_replace(
'{rpt:col_count}', $col_count, $line);
2348 if (strpos($line,
'{r}') !==
false) {
2349 $r =
dbx()->next_id(1);
2350 $line = str_replace(
'{r}', $r, $line);
2355 if ($this->_rdata_inline) {
2366 $activ_id = $this->_activ_id;
2373 $key = $this->_fld_id;
2375 if ($key && isset($record[$key])) {
2376 if ($activ_id == $record[$key]) {
2377 $class =
'table-active';
2386 $content = $this->_footer;
2387 $col_count = $this->_table_col_count;
2389 $content = str_replace(
'{rpt:col_count}', $col_count, $content);
2396 $report_part = explode(
'<hr class="dbx_split">', $report);
2397 $report_header =
'';
2399 $report_footer =
'';
2400 $next_haeder_page =
'';
2401 $next_footer_page =
'';
2402 $count = count($report_part);
2405 $report_body = $report_part[0];
2409 $report_header = $report_part[0];
2410 $report_body = $report_part[1];
2414 $report_header = $report_part[0];
2415 $report_body = $report_part[1];
2416 $report_footer = $report_part[2];
2417 $next_haeder_page = $report_part[0];
2418 $next_footer_page = $report_part[2];
2422 $next_haeder_page = $report_part[3];
2423 $next_footer_page = $report_part[5];
2426 $this->_haeder = $report_header;
2427 $this->_body = $report_body;
2428 $this->_footer = $report_footer;
2429 $this->_footer_next_page = $next_footer_page;
2430 $this->_haeder_next_page = $next_haeder_page;
2445 if ((!$this->_create_row_select && !$this->_create_sel_flds) || !is_string($content) || stripos($content,
'dbxReport') ===
false) {
2449 return preg_replace_callback(
2450 '/<div\b(?=[^>]*\bclass\s*=\s*(["\'])[^"\']*\bdbxReport\b[^"\']*\1)([^>]*)>/i',
2454 if (preg_match(
'/\bdata-dbx\s*=\s*(["\'])(.*?)\1/i', $tag, $dataMatch)) {
2455 $value = trim($dataMatch[2]);
2457 if (stripos($value,
'lib=report') !==
false) {
2461 $value = ($value ===
'') ?
'lib=report|form=0' : $value .
'||lib=report|form=0';
2462 $newAtt =
'data-dbx=' . $dataMatch[1] . $value . $dataMatch[1];
2464 return str_replace($dataMatch[0], $newAtt, $tag);
2467 return substr($tag, 0, -1) .
' data-dbx="lib=report|form=0">';
2484 $modul = $this->_dbx_modul;
2485 $action = $this->_dbx_action;
2486 $rcount = $this->_rcount;
2487 $link = $this->_pagelink;
2488 $tpl = $this->_tpl_pagination;
2489 $rpos = $this->_rpos;
2490 $rrows = $this->_rrows;
2493 $link =
'?dbx_modul=' . $modul .
'&dbx_run1=' . $action;
2496 $link = $this->_action ?: $link;
2497 $content = $this->pagination($tpl, $link, $rpos, $rrows, $rcount);
2502 private function lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount) {
2509 if ($p == $akt_page) {
2510 $p_active =
' aria-current="page"';
2511 $active =
' active';
2512 $current =
' aria-current="page" ';
2516 $rec[
'p'] = $p . $s_active;
2517 $rec[
'href_page'] = $link .
'&dbx_rrows=' . $rrows .
'&dbx_rpos=' . (($p - 1) * $rrows);
2518 $rec[
'p_active'] = $p_active;
2519 $rec[
'active'] = $active;
2520 $rec[
'current'] = $current;
2521 $rec[
'class'] = $class .
' dbxAjax';
2526 private function pagination($tpl, $link, $rpos, $rrows, $rcount) {
2531 $pages = intval($rcount / $rrows);
2533 if ($rcount % $rrows) $pages++;
2534 if ($pages == 0) $pages = 1;
2537 $pmax = $this->_but_pagination;
2538 $akt_page = intval($rpos / $rrows) + 1;
2540 if ($akt_page < 1) $akt_page = 1;
2541 if ($akt_page > $pages) $akt_page = $pages;
2543 $half = intval($pmax / 2);
2544 $p_s = $akt_page - $half;
2545 $p_e = $akt_page + $half;
2552 if ($p_e > $pages) {
2554 $p_s = $pages - $pmax + 1;
2561 $last_pos = ($pages - 1) * $rrows;
2562 $prev = ($akt_page - 2) * $rrows;
2563 $next = ($akt_page) * $rrows;
2565 if ($prev < 0) $prev = 0;
2566 if ($next > $last_pos) $next = $last_pos;
2568 $href_first = $link .
'&dbx_rpos=0&dbx_rrows=' . $rrows;
2569 $href_last = $link .
'&dbx_rpos=' . $last_pos .
'&dbx_rrows=' . $rrows ;
2570 $href_prev = $link .
'&dbx_rpos=' . $prev .
'&dbx_rrows=' . $rrows ;
2571 $href_next = $link .
'&dbx_rpos=' . $next .
'&dbx_rrows=' . $rrows ;
2573 $this->_sys[
'dbx_rpos'] = $rpos;
2574 $this->_sys[
'dbx_rrows'] = $rrows;
2577 $dv[
'dbx_rpos'] = $rpos;
2578 $dv[
'dbx_rrows'] = $rrows;
2581 for ($p = $p_s; $p <= $p_e; $p++) {
2582 $rdata[] = $this->lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount);
2589 $oReport =
dbx()->get_system_obj(
'dbxReport');
2591 $oReport->init(
'pagination');
2592 $oReport->_data = $dv;
2593 $oReport->_dbx_modul =
'dbx';
2594 $oReport->_dbx_action =
'pagination';
2595 $oReport->_dbx_modul_id = 888;
2596 $oReport->_rdata = $rdata;
2597 $oReport->_rcount = $rcount;
2598 $oReport->_rrows = $rrows;
2599 $oReport->_rpos = $rpos;
2600 $oReport->_action = $link;
2601 $oReport->_tpl = $tpl;
2602 $oReport->_pages = 0;
2603 $oReport->_mode =
'table';
2604 $oReport->_rflds = array();
2605 $oReport->_body_inline =
false;
2606 $oReport->_create_sel_flds = 0;
2608 $content = $oReport->run();
2610 $content = str_replace(
'{href_first}', $href_first, $content);
2611 $content = str_replace(
'{href_last}', $href_last, $content);
2612 $content = str_replace(
'{href_prev}', $href_prev, $content);
2613 $content = str_replace(
'{href_next}', $href_next, $content);
2614 $selectState = $this->get_visible_multi_select_state();
2616 $countAll = ($this->_count_all >= 0) ? $this->_count_all : $rcount;
2618 $content = $this->applyReportCountReplaces($content);
2626 for ($i = $rpos; $i < ($rpos + $rrows); $i++) {
2627 if (isset($data[$i])) {
2628 $rdata[] = $data[$i];
2640 $where .=
" $mode (";
2652 $this->_page_reset = 0;
2658 $gridId = $this->_grid_id;
2661 $gridId = $this->_fid .
'_grid';
2664 $cols = $this->_grid_cols;
2666 if (!$cols && $this->_dd) {
2667 $oDB =
dbx()->get_system_obj(
'dbxDB');
2668 $cols = $oDB->get_dd_grid_cols($this->_dd);
2671 $rrows = (int) $this->_rrows;
2672 $rpos = (int) $this->_rpos;
2673 $page = ($rrows > 0) ? ((
int) floor($rpos / $rrows) + 1) : 1;
2676 'read_url' => $this->_grid_read_url,
2677 'save_url' => $this->_grid_save_url,
2678 'delete_url' => $this->_grid_delete_url,
2679 'insert_url' => $this->_grid_insert_url,
2680 'sort_url' => $this->_grid_sort_url,
2681 'sync_url' => $this->_grid_sync_url,
2682 'print_url' => $this->_grid_print_url,
2683 'export_url' => $this->_grid_export_url,
2684 'grid_id' => $gridId,
2685 'grid_cols' => $cols,
2686 'grid_schema' => $this->_grid_schema,
2687 'grid_layout' => $this->_grid_layout,
2688 'grid_height' => $this->_rrows,
2689 'grid_synctime' => $this->_grid_synctime,
2690 'grid_page' => $page,
2691 'grid_page_size' => ($rrows > 0) ? $rrows : 25,
2697 $this->
add_rep(
'grid_stats',
'');
2701 $html =
'<div class="dbx-grid-stats"';
2702 if ((
string)$ariaLabel !==
'') {
2703 $html .=
' aria-label="' . htmlspecialchars((
string)$ariaLabel, ENT_QUOTES) .
'"';
2707 foreach ($stats as $stat) {
2708 if (!is_array($stat)) {
2712 $label = htmlspecialchars((
string)($stat[
'label'] ??
''), ENT_QUOTES);
2713 $value = htmlspecialchars((
string)($stat[
'value'] ??
''), ENT_QUOTES);
2714 $tone = (string)($stat[
'tone'] ??
'');
2715 $class =
'dbx-grid-stat';
2717 if ($tone ===
'ok') {
2718 $class .=
' dbx-grid-stat-ok';
2719 } elseif ($tone ===
'lock') {
2720 $class .=
' dbx-grid-stat-lock';
2721 } elseif ($tone !==
'') {
2722 $class .=
' dbx-grid-stat-' . preg_replace(
'/[^a-z0-9_-]/i',
'', $tone);
2725 $html .=
'<div class="' . $class .
'"><span>' . $label .
'</span><strong>' . $value .
'</strong></div>';
2729 $this->
add_rep(
'grid_stats', $html);
2733 if ($this->_mode !==
'tabulurator') {
2739 $withForm = (string)($this->_replaces[
'frame_use_form'] ??
'0') !==
'0';
2740 if (array_key_exists(
'with_form', $options)) {
2741 $withForm = (bool)$options[
'with_form'];
2743 $panelClass = trim(
'dbxReport ' . (
string)($this->_replaces[
'report_shell_class'] ??
'') .
' ' . (
string)($this->_replaces[
'shell_panel_class'] ??
''));
2744 $frameId = trim((
string)($this->_replaces[
'frame_id'] ??
''));
2745 if ($frameId ===
'') {
2746 $frameId =
'dbx_target_' . $i;
2749 $this->add_rep(
'frame_id', $frameId);
2750 if (trim((
string)($this->_replaces[
'frame_panel_class'] ??
'')) ===
'') {
2751 $this->add_rep(
'frame_panel_class', trim($panelClass));
2753 $panelAttrs = (string)($this->_replaces[
'report_shell_attrs'] ??
'');
2754 if ($panelAttrs ===
'') {
2755 $panelAttrs = (string)($this->_replaces[
'shell_panel_attrs'] ??
'');
2757 $this->add_rep(
'frame_panel_attrs', $panelAttrs);
2758 $this->add_rep(
'frame_subbar',
'');
2759 $this->add_rep(
'frame_body_class', (
string)($this->_replaces[
'shell_body_class'] ??
''));
2760 $this->add_rep(
'frame_body_head', (
string)($this->_replaces[
'frame_body_head'] ??
''));
2761 $this->add_rep(
'frame_body_tail', (
string)($this->_replaces[
'frame_body_tail'] ??
''));
2764 $reportFormClass = trim((
string)($this->_replaces[
'report_form_class'] ??
''));
2765 $reportFormAttrs = trim((
string)($this->_replaces[
'report_form_attrs'] ??
''));
2766 $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 :
'') .
'>');
2767 $this->add_rep(
'frame_form_close',
'</form>');
2769 $this->add_rep(
'frame_form_open',
'');
2770 $this->add_rep(
'frame_form_close',
'');
2782 $rcount = (int) $this->_rcount;
2783 $countAll = ($this->_count_all >= 0) ? (
int) $this->_count_all : $rcount;
2785 $content = str_replace(
'{pagination:count_all}', (
string) $countAll, (
string) $content);
2786 $content = str_replace(
'{pagination:count_selected}', (
string) $rcount, (
string) $content);
2787 $content = str_replace(
'{pagination:count_checked}', (
string) $this->
get_count_selects(), (
string) $content);
2788 $content = str_replace(
'{report_extra_stats}', (
string)($this->_replaces[
'report_extra_stats'] ??
''), (
string) $content);
2789 $content = str_replace(
'{report_bar_actions}', (
string)($this->_replaces[
'report_bar_actions'] ??
''), (
string) $content);
2795 return preg_replace(
2796 '/<div class="dbx-report-bar-field"[^>]*>\s*\{obj:[a-z0-9_]+\}\s*<\/div>\s */i',
2810 $msg = trim((
string) $msg);
2816 $editor =
dbx()->get_system_var(
'dbx_editor', 0,
'int');
2818 if (!$editor && preg_match(
'/^#form_msg_(info|success|error|warning)#$/', $msg)) {
2833 if ($error ===
'' && !empty($this->_msg_err)) {
2837 if ($error !==
'') {
2843 if ($warning !==
'') {
2849 if ($success !==
'') {
2854 return $this->
get_form_msg(
'error',
'Pruefen Sie bitte Ihre Eingaben.');
2876 public function add_action($obj, $tpl, $action =
'', $data =
'') {
2877 parent::add_action($obj, $tpl, $action, $data);
2881 if ($dbx_do ===
'') {
2887 if ($tpl ===
'action_button_delete') {
2888 $confirm = (string) $this->_msg_confirm_delete;
2891 $this->_report_multi_actions[$dbx_do] = array(
2892 'obj' => (
string) $obj,
2894 'tpl' => (
string) $tpl,
2895 'action' => (
string) $action,
2896 'confirm' => $confirm,
2897 'quick' => in_array($dbx_do, array(
'multi_select',
'multi_deselect'),
true),
2907 $action = (string) $action;
2909 if ($action ===
'' || $action[0] !==
'&') {
2913 if (preg_match(
'/(?:^|&)dbx_do=([^&]+)/', $action, $match)) {
2914 return (
string) $match[1];
2917 if (preg_match(
'/(?:^|&)dbx_run2=([^&]+)/', $action, $match)) {
2918 return (
string) $match[1];
2931 'action_button_delete' =>
'Ausgewaehlte loeschen',
2932 'action_button_activate' =>
'Ausgewaehlte aktivieren',
2933 'action_button_deactivate' =>
'Ausgewaehlte deaktivieren',
2934 'action_button_select' =>
'Sichtbare selektieren',
2935 'action_button_deselect' =>
'Sichtbare deselektieren',
2938 return $labels[$tpl] ?? (string) $tpl;
2951 $db =
dbx()->get_system_obj(
'dbxDB');
2953 $fld_id = $this->_fld_id ? $this->_fld_id :
'id';
2957 if (!is_array($selects) || !count($selects)) {
2965 foreach ($selects as $id) {
2972 if (preg_match(
'/^-?\d+$/', $key)) {
2973 $where = $fld_id .
'=' . (int) $key;
2975 $where = $fld_id .
"='" . addslashes($key) .
"'";
2978 $ok =
$db->delete($dd, $where, $verify_access, $trace);
2981 if ((
int) $ok > 0) {
2988 $this->_count_selects = -1;
2991 'deleted' => $deleted,
2992 'failed' => $failed,
2993 'total' => $deleted + $failed,
3005 $deleted = (int) (
$result[
'deleted'] ?? 0);
3006 $failed = (int) (
$result[
'failed'] ?? 0);
3008 if ($deleted <= 0 && $failed <= 0) {
3012 if ($deleted > 0 && $failed === 0) {
3013 if ($deleted === 1) {
3014 $this->_msg_success =
'1 Datensatz gelöscht.';
3016 $this->_msg_success = $deleted .
' Datensätze gelöscht.';
3022 $this->_msg_error = $deleted .
' Datensätze gelöscht, ' . $failed .
' fehlgeschlagen.';
3026 $this->_msg_error =
'Löschen fehlgeschlagen.';
3035 if (!$this->_create_row_select || !$this->_report_multi_actions) {
3039 if (isset($this->_obj[
'report_footer'])) {
3043 $selectOptions =
'';
3047 foreach ($this->_report_multi_actions as $dbx_do => $action) {
3048 if (!empty($action[
'quick'])) {
3053 $label = (string) ($action[
'label'] ?? $dbx_do);
3054 $actionSuffix = (string) ($action[
'action'] ??
'');
3055 $actionUrl = $actionSuffix;
3057 if ($actionSuffix !==
'' && $actionSuffix[0] ===
'&') {
3061 $selectOptions .= $this->
get_tpl(
'dbx|report-footer-action-option', array(
3062 'value' => (
string) $dbx_do,
3066 $actionLink = trim($this->
get_tpl((
string) ($action[
'tpl'] ??
'dbx|action_button'), array(
3067 'action' => $actionUrl,
3069 'title' =>
'Aktion bestaetigen',
3070 'confirm' => (
string) ($action[
'confirm'] ??
''),
3075 if ($actionLink !==
'') {
3076 $actionLinks .= $this->
get_tpl(
'dbx|report-footer-action-link', array(
3077 'value' => (
string) $dbx_do,
3078 'action_link' => $actionLink,
3087 $i = (int) $this->_next_i;
3088 $actionMain = $this->
get_tpl(
'dbx|report-footer-action-main', array(
3089 'action_id' =>
'dbx_report_action_' . $i,
3090 'report_action_options' => $selectOptions,
3091 'report_action_links' => $actionLinks,
3094 $html = trim($this->
get_tpl(
'dbx|report-footer', array(
3095 'report_action_main' => $actionMain,
3099 $this->
add_obj(
'report_footer',
'obj-value', $html);
3111 if (!isset($this->_obj[
'report_footer'])) {
3112 return (
string) $content;
3115 if (strpos($content,
'{obj:report_footer}') !==
false) {
3116 return (
string) $content;
3119 if (stripos($content,
'<tfoot') !==
false) {
3120 return (
string) $content;
3123 return (
string) preg_replace(
3124 '/<\/tbody>\s*<\/table>/i',
3125 '</tbody>{obj:report_footer}</table>',
3132 $page =
dbx()->get_request_var(
'page', 0,
'int');
3133 $size =
dbx()->get_request_var(
'size', 0,
'int');
3134 $limit =
dbx()->get_request_var(
'limit', 0,
'int');
3135 $offset =
dbx()->get_request_var(
'offset', -1,
'int');
3138 $this->_rrows = $size;
3139 } elseif ($limit > 0) {
3140 $this->_rrows = $limit;
3144 $this->_rpos = $offset;
3145 } elseif ($page > 0 && $this->_rrows > 0) {
3146 $this->_rpos = (($page - 1) * $this->_rrows);
3153 if (!is_array($this->_rdata)) {
3157 foreach ($this->_rdata as $record) {
3158 $this->_record = $record;
3160 $this->run_body($dummy);
3161 $record = $this->_record;
3163 if (!is_array($record)) {
3169 foreach ($record as
$field => $value) {
3170 if (is_array($value)) {
3185 $count = (int) $this->_rcount;
3186 $rrows = (int) $this->_rrows;
3187 $rpos = (int) $this->_rpos;
3192 $pages = (int) ceil(
$count / $rrows);
3193 $page = (int) floor($rpos / $rrows) + 1;
3196 header(
'Content-Type: application/json; charset=utf-8');
3198 echo json_encode(array(
3201 'rows' => array_values($rows),
3206 ), JSON_UNESCAPED_UNICODE);
3212 dbx()->debug(
'create_selection_fields');
3215 if ($source ===
'fd::') {
3216 $source = $this->_fd;
3217 } elseif ($source) {
3218 $this->_fd = $source;
3225 $before = array_keys($this->_flds);
3227 $added = array_diff(array_keys($this->_flds), $before);
3229 foreach ($this->_report_state_flds as $key => $state) {
3230 if (!array_key_exists($key, $this->_data)) {
3231 $this->_data[$key] = $state[
'default'] ??
'';
3235 foreach ($added as $key) {
3236 if (!array_key_exists($key, $this->_data)) {
3237 $this->_data[$key] = $this->
get_dd($source, $key,
'default');
3244 public function init($fid, $tpl =
'', $first_page_lines = -1, $next_page_lines = -1, $current_line = -1) {
3245 if ($fid ==
'pagination')
return;
3246 $this->_dbx_modul=
dbx()->get_system_var(
'dbx_activ_modul',
'dbx',
'*');
3251 $modul = $this->_dbx_modul ;
3252 $modul_key = $modul .
'-rpt-' . $this->_fid;
3255 if ($first_page_lines <= 0) $first_page_lines = 999999;
3256 if ($next_page_lines <= 0) $next_page_lines = 999999;
3258 if ($current_line <= 0) $current_line = 0;
3260 $current_page_line = 0;
3263 if ($current_line >= 0) {
3264 if ($current_line < $first_page_lines) {
3266 $current_page_line = $current_line;
3268 $remaining_lines = $current_line - $first_page_lines;
3269 $current_page = 2 + intval($remaining_lines / $next_page_lines);
3270 $current_page_line = ($remaining_lines % $next_page_lines);
3276 $this->_current_page = $current_page;
3277 $this->_current_report_ln = $current_line;
3278 $this->_current_page_ln = $current_page_line;
3279 $this->_first_page_lines = $first_page_lines;
3280 $this->_next_page_lines = $next_page_lines;
3282 $this->_fld_haeder =
'';
3283 $this->_haeder_report =
'';
3284 $this->_footer_report =
'';
3285 $this->_haeder_page =
'';
3286 $this->_footer_page =
'';
3287 $this->_haeder_next_page =
'';
3288 $this->_footer_next_page =
'';
3290 dbx()->set_remember_var(
'last_report_i', $this->_next_i, $modul_key);
3293 $this->_multi_select_work =
'';
3309 $i = $this->_next_i;
3313 $pages = $this->_pages;
3314 $mode = $this->_mode;
3315 $flds = $this->_rflds;
3317 if (!is_array($flds)) $flds = array();
3319 $this->_dbx_modul=
dbx()->get_system_var(
'dbx_activ_modul',
'dbx',
'*');
3320 $this->_auto_flds = $flds;
3321 $this->_auto_mode = $mode;
3325 $oDB =
dbx()->get_system_obj(
'dbxDB');
3326 if (method_exists(
$oDB,
'get_dd_file')) {
3336 $replaces = $this->_replaces;
3338 if ($mode ==
'tabulurator') {
3343 'report_shell_class' =>
'',
3344 'report_shell_attrs' =>
'',
3345 'report_form_class' =>
'',
3346 'report_form_attrs' =>
'',
3347 'shell_panel_class' =>
'',
3348 'shell_panel_attrs' =>
'',
3349 'shell_body_class' =>
'',
3350 ) as $shellKey => $shellDefault) {
3351 if (!isset($replaces[$shellKey]) || (
string) $replaces[$shellKey] ===
'') {
3352 $replaces[$shellKey] = $shellDefault;
3356 if (strpos($tpl,
'|') ===
false) {
3357 $tpl = $this->_dbx_modul .
'|' . $tpl;
3360 $report_tpl = $this->
get_tpl($tpl, $replaces,
'htm', $i);
3364 $report_tpl = $this->
merge_obj($report_tpl, $i);
3369 if ($mode ==
'tabulurator') {
3370 $content = $report_tpl;
3372 if ($fid !=
'pagination') {
3376 $content = str_replace(
'{i}', $i, $content);
3379 $content = str_replace(
'{obj:form_msg}', $msg_tpl, $content);
3383 $content = str_replace(
'[dbx:pagination]', $ReportPages, $content);
3385 $content = str_replace(
'[dbx:pagination]',
'', $content);
3387 $content = str_replace(
'{rpt:pages}', (
string) $this->_current_page, $content);
3392 if (is_array($js)) {
3393 foreach ($js as $javascript) {
3394 $javascript = str_replace(
'{i}', $i, $javascript);
3395 $norep_ids .=
dbx()->norep(
"\n" .
'<script type="text/javascript">' . $javascript .
'</script>' .
"\n", $i);
3400 $norep =
'<div class="norep">' . $norep_ids .
'</div>';
3403 $content = str_replace(
'[dbx:js]', $norep, $content);
3415 $content = $haeder . $body . $footer;
3417 if ($fid !=
'pagination') {
3421 if ($fid !=
'pagination') {
3424 $content = str_replace(
'[dbx:pagination]', $ReportPages, $content);
3427 $haeder_report = $this->_haeder_report;
3428 $haeder_page = $this->_haeder_page;
3429 $footer_page = $this->_footer_page;
3430 $footer_report = $this->_footer_report;
3432 $content = str_replace(
'{i}', $i, $content);
3435 $content = str_replace(
'{obj:form_msg}', $msg_tpl, $content);
3442 $content = str_replace(
'[rpt:haeder_report]', $haeder_report, $content);
3443 $content = str_replace(
'[rpt:haeder_page]', $haeder_page, $content);
3444 $content = str_replace(
'[rpt:footer_page]', $footer_page, $content);
3445 $content = str_replace(
'[rpt:footer_report]', $footer_report, $content);
3451 if (is_array($js)) {
3455 foreach ($js as $javascript) {
3456 $javascript = str_replace(
'{i}', $i, $javascript);
3457 $norep_ids .=
dbx()->norep(
"\n" .
'<script type="text/javascript">' . $javascript .
'</script>' .
"\n", $i);
3462 $content = str_replace(
'{i}', $i, $content);
3465 $norep =
'<div class="norep">' . $norep_ids .
'</div>';
3468 $content = str_replace(
'[dbx:js]', $norep, $content);
3469 $content = str_replace(
'[dbx:pagination]',
'', $content);
3470 $content = str_replace(
'{rpt:pages}', $this->_current_page, $content);
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.
$_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}.
enable_delete_tab($dd, $label='Tabelle leeren')
Aktiviert den Template-Platzhalter {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)
$_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.
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 und Report-Objekte in einen String 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.
DBX schema administration.
if(! $db->connect_db_server($server)) $result