dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
dbxReport.class.php
Go to the documentation of this file.
1<?php
2
3require_once 'dbxForm.class.php';
4
143class dbxReport extends dbxForm {
144
146 protected $_report_state_flds = array(
147 'dbx_rpos' => array('default' => 0, 'rules' => 'int'),
148 );
149
151 protected $_table_render_tpl_cache = array();
152
154 public $_ajax = 1;
155
157 public $_mode = 'table';
158
160 public $_current_page = 0;
161
163 public $_current_report_ln = 0;
164
166 public $_current_page_ln = 0;
167
169 public $_first_page_lines = 9999;
170
172 public $_next_page_lines = 9999;
173
175 public $_fld_haeder = '';
176
178 public $_haeder_report = '';
179
181 public $_footer_report = '';
182
184 public $_haeder_page = '';
185
187 public $_footer_page = '';
188
190 public $_haeder_next_page = '';
191
193 public $_footer_next_page = '';
194
196 public $_page_break = '<div class="page-break printMe"> </div><br>';
197
199 public $_haeder = '';
200
202 public $_body = '';
203
205 public $_footer = '';
206
208 public $_record = array();
209
211 public $_rdata = array();
212
214 public $_rdata_inline = false;
215
217 public $_body_inline = '';
218
220 public $_rcount = 0;
221
223 public $_count_all = -1;
224
226 public $_rpos = 0;
227
229 public $_rrows = 20;
230
232 public $_rwhere_placeholder = '#search_for#';
233
235 public $_pages = 0;
236
238 public $_pagelink = '';
239
241 public $_auto_flds = '';
242
244 public $_auto_mode = '';
245
247 public $_rflds = '';
248
250 public $_tpl_pagination = 'dbx|pagination';
251
253 public $_but_pagination = 3;
254
256 public $_add_action = '';
257
259 public $_create_sel_flds = 0;
260
262 public $_create_row_select = 0;
263
265 public $_create_row_edit = 0;
266
268 public $_create_row_copy = 0;
269
271 public $_create_row_delete = 0;
272
274 public $_create_row_download = 0;
275
277 public $_create_row_show = 0;
278
280 public $_create_row_export = 0;
281
283 public $_create_row_import = 0;
284
286 public $_create_row_undo = 0;
287
289 public $_create_row_print = 0;
290
292 public $_rpt_format = array();
293
295 public $_options_rsort = array();
296
298 public $_options_rrows = array();
299
301 public $_options_rdesc = array();
302
304 public $_options_rselect = array();
305
307 public $_tabel_tpls = array();
308
310 public $_table_col_count = 0;
311
313 public $_multi_page_select = 0;
314
316 public $_multi_select_work = '';
317
319 protected $_report_multi_actions = array();
320
322 public $_table_buttons = 'left';
323
333 public $_data_table = 0;
334
336 public $_scroll_table = 0;
337
339 public $_class_haeder = array();
340
342 public $_style_haeder = array();
343
345 public $_class_body = array();
346
348 public $_count_selects = -1;
349
351 public $_msg_confirm_delete = 'Datensatz löschen ?';
352
354 public $_msg_confirm_delete_tab = 'Datenbank-Tabelle wirklich leeren ?';
355
357 public $_msg_confirm_copy = 'Datensatz kopieren ?';
358
360 public $_delete_tab_dd = '';
361
363 public $_delete_tab_label = 'Tabelle leeren';
364
365
366 /* =====================================================
367 * GRID / TABULURATOR SUPPORT
368 * ===================================================== */
369
371 public $_grid_read_url = '';
372
374 public $_grid_save_url = '';
375
377 public $_grid_delete_url = '';
378
380 public $_grid_insert_url = '';
381
383 public $_grid_sort_url = '';
384
386 public $_grid_sync_url = '';
387
389 public $_grid_print_url = '';
390
392 public $_grid_export_url = '';
393
395 public $_grid_schema = '';
396
398 public $_grid_id = '';
399
401 public $_grid_cols = '';
402
404 public $_grid_layout = 'fitColumns';
405
407 public $_grid_headerfilter = 1;
408
410 public $_grid_headersort = 1;
411
413 public $_grid_allow_delete = 1;
414
416 public $_grid_allow_edit = 1;
417
419 public $_grid_allow_insert = 1;
420
422 public $_grid_synctime = '2';
423
440 public function clear() {
441 $this->_forward_clear();
442
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;
449
450 $this->_fld_haeder = '';
451
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 = '';
458
459 $this->_haeder = '';
460 $this->_body = '';
461 $this->_footer = '';
462
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 = '';
470
471 $this->_rcount = 0;
472 $this->_count_all = -1;
473 $this->_rpos = 0;
474 $this->_rrows = 20;
475 $this->_pages = 0;
476 $this->_pagelink = '';
477
478 $this->_auto_flds = '';
479 $this->_auto_mode = '';
480 $this->_rflds = '';
481
482 $this->_add_action = '';
483
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;
495
496 $this->_rpt_format = array();
497
498
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();
505
506 $this->_data_table = 0;
507 $this->_scroll_table = 0;
508
509 $this->_style_haeder = array();
510 $this->_class_haeder = array();
511 $this->_class_body = array();
512
513 $this->_count_selects = -1;
514
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 ?';
518
519 $this->_delete_tab_dd = '';
520 $this->_delete_tab_label = 'Tabelle leeren';
521
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';
540
541 $table = array();
542
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';
556
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';
571
572 if ($this->_multi_page_select) {
573 $table['tpl_haeder_select'] = 'table_haeder_select-multi';
574 $table['tpl_row_select'] = 'table_row_select-multi';
575 }
576
577 $this->_tabel_tpls = $table;
578 }
579
588 public function set_tabel_tpl($tid, $tpl) {
589 $this->_tabel_tpls[$tid] = $tpl;
590 }
591
592
593
594
604 protected function get_report_action_url() {
605 if ($this->_action) {
606 return $this->_action;
607 }
608
609 $modul = $this->_dbx_modul;
610 $run1 = $this->_dbx_action;
611 $run2 = $this->_dbx_work;
612
613 if (!$run1) {
614 $run1 = dbx()->get_modul_var('dbx_run1', 0);
615 }
616
617 if (!$run2) {
618 $run2 = dbx()->get_modul_var('dbx_run2', 0);
619 }
620
621 $url = '?dbx_modul=' . $modul;
622
623 if ($run1) {
624 $url .= '&dbx_run1=' . $run1;
625 }
626
627 if ($run2) {
628 $url .= '&dbx_run2=' . $run2;
629 }
630
631 return $url;
632 }
633
642 public function enable_delete_tab($dd, $label = 'Tabelle leeren') {
643 $this->_delete_tab_dd = (string) $dd;
644 $this->_delete_tab_label = (string) $label;
645
646 if (!$this->_dd && $this->_delete_tab_dd) {
647 $this->_dd = $this->_delete_tab_dd;
648 }
649 }
650
656 protected function get_delete_tab_button() {
657 if (!$this->_delete_tab_dd) {
658 return '';
659 }
660
661 $action = $this->get_report_action_url();
662
663 if ($action) {
664 $action .= (strpos($action, '?') === false) ? '?' : '&';
665 $action .= 'dbx_do=delete_tab';
666 }
667
668 $data = array(
669 'action' => $action,
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',
675 );
676
677 $tpl = $this->get_tpl('dbx|action_button_delete_tab', $data);
678
679 return $tpl;
680 }
681
689 protected function merge_db_placeholders($content) {
690 $content = str_replace('{db:delete_tab}', $this->get_delete_tab_button(), $content);
691
692 return $content;
693 }
694
702 protected function normalize_multi_select_key($rid) {
703 if ($rid === null) {
704 return '';
705 }
706
707 $rid = trim((string) $rid);
708
709 if ($rid === '') {
710 return '';
711 }
712
713 return $rid;
714 }
715
731 protected function get_record_rid($record, $default = -1) {
732 if (!is_array($record)) {
733 return $default;
734 }
735
736 if ($this->_fld_id && array_key_exists($this->_fld_id, $record)) {
737 return $record[$this->_fld_id];
738 }
739
740 if (array_key_exists('rid', $record)) {
741 return $record['rid'];
742 }
743
744 if (array_key_exists('id', $record)) {
745 return $record['id'];
746 }
747
748 if (array_key_exists('recnum', $record)) {
749 return $record['recnum'];
750 }
751
752 return $default;
753 }
754
755 public function get_record(): array {
756 if (!is_array($this->_record)) {
757 return array();
758 }
759
760 return $this->_record;
761 }
762
763 public function set_record(array $record): void {
764 $this->_record = $record;
765 }
766
767 public function get_record_val(string $name, mixed $default = null): mixed {
768 if (!is_array($this->_record)) {
769 return $default;
770 }
771
772 if (array_key_exists($name, $this->_record)) {
773 return $this->_record[$name];
774 }
775
776 return $default;
777 }
778
779 public function set_record_val(string $name, mixed $value): void {
780 if (!is_array($this->_record)) {
781 $this->_record = array();
782 }
783
784 $this->_record[$name] = $value;
785 }
786
787 public function set_callback_owner($owner): void {
788 if (is_object($owner)) {
789 $this->_callback_owner = $owner;
790 }
791 }
792
793 public function set_report_header_callback(string $callback): void {
794 $this->set_callback('report_header', $callback);
795 }
796
797 public function set_page_header_callback(string $callback): void {
798 $this->set_callback('page_header', $callback);
799 }
800
801 public function set_header_callback(string $callback): void {
802 $this->set_callback('header', $callback);
803 }
804
805 public function set_body_callback(string $callback): void {
806 $this->set_callback('body', $callback);
807 }
808
809 public function set_footer_callback(string $callback): void {
810 $this->set_callback('footer', $callback);
811 }
812
813 public function set_page_footer_callback(string $callback): void {
814 $this->set_callback('page_footer', $callback);
815 }
816
817 public function set_report_footer_callback(string $callback): void {
818 $this->set_callback('report_footer', $callback);
819 }
820
821 public function set_next_record_callback(string $callback): void {
822 $this->set_callback('next_record', $callback);
823 }
824
832 protected function get_record_select_key($record) {
833 if (is_array($record) && array_key_exists('id', $record)) {
834 return $this->normalize_multi_select_key($record['id']);
835 }
836
837 $rid = $this->get_record_rid($record, '');
838
839 return $this->normalize_multi_select_key($rid);
840 }
841
856 protected function parse_multi_select_ids($raw) {
857 $ids = array();
858
859 if (is_array($raw)) {
860 foreach ($raw as $value) {
861 $key = $this->normalize_multi_select_key($value);
862
863 if ($key !== '') {
864 $ids[$key] = 1;
865 }
866 }
867
868 return array_keys($ids);
869 }
870
871 $raw = trim((string) $raw);
872
873 if ($raw === '') {
874 return array();
875 }
876
877 if ($raw[0] === '[') {
878 $decoded = json_decode($raw, true);
879
880 if (is_array($decoded)) {
881 return $this->parse_multi_select_ids($decoded);
882 }
883 }
884
885 $parts = preg_split('/[|,\s;]+/', $raw);
886
887 if (!is_array($parts)) {
888 return array();
889 }
890
891 foreach ($parts as $value) {
892 $key = $this->normalize_multi_select_key($value);
893
894 if ($key !== '') {
895 $ids[$key] = 1;
896 }
897 }
898
899 return array_keys($ids);
900 }
901
909 public function set_multi_select_ids(array $ids) {
910 $selects = $this->get_multi_selects();
911
912 foreach ($ids as $rid) {
913 $key = $this->normalize_multi_select_key($rid);
914
915 if ($key !== '') {
916 $selects[$key] = 1;
917 }
918 }
919
920 $this->set_multi_selects($selects);
921 }
922
930 public function del_multi_select_ids(array $ids) {
931 $selects = $this->get_multi_selects();
932
933 foreach ($ids as $rid) {
934 $key = $this->normalize_multi_select_key($rid);
935
936 if ($key !== '' && isset($selects[$key])) {
937 unset($selects[$key]);
938 }
939 }
940
941 $this->set_multi_selects($selects);
942 }
943
950 $ids = array();
951
952 if (!is_array($this->_rdata)) {
953 return array();
954 }
955
956 foreach ($this->_rdata as $record) {
957 $key = $this->get_record_select_key($record);
958
959 if ($key !== '') {
960 $ids[$key] = 1;
961 }
962 }
963
964 return array_keys($ids);
965 }
966
974 public function get_visible_multi_select_state(array $visibleIds = array()) {
975 if (!$visibleIds) {
976 $visibleIds = $this->get_visible_multi_select_ids();
977 }
978
979 $selects = $this->get_multi_selects();
980 $selectedVisible = array();
981
982 foreach ($visibleIds as $rid) {
983 $key = $this->normalize_multi_select_key($rid);
984
985 if ($key !== '' && isset($selects[$key])) {
986 $selectedVisible[] = $key;
987 }
988 }
989
990 $visibleCount = count($visibleIds);
991 $selectedCount = count($selectedVisible);
992 $headerState = 'none';
993
994 if ($visibleCount > 0 && $selectedCount === $visibleCount) {
995 $headerState = 'all';
996 } elseif ($selectedCount > 0) {
997 $headerState = 'partial';
998 }
999
1000 return array(
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,
1007 );
1008 }
1009
1018 protected function send_multi_select_json_response(array $visibleIds = array(), $dbx_do = '') {
1019 $quick = dbx()->get_modul_var('dbx_select_quick', 1, 'int');
1020
1021 if ($quick) {
1022 http_response_code(204);
1023 if (function_exists('session_write_close')) {
1024 session_write_close();
1025 }
1026 exit;
1027 }
1028
1029 $state = $this->get_visible_multi_select_state($visibleIds);
1030
1031 $response = array(
1032 'ok' => 1,
1033 'dbx_do' => $dbx_do,
1034 'count_selects' => $this->get_count_selects(),
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'],
1040 );
1041
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();
1046 }
1047 exit;
1048 }
1049
1050
1051
1052
1053
1061 public function check_is_multiselect($rid) {
1062 $checked = '';
1063 $key = $this->normalize_multi_select_key($rid);
1064 $selects = $this->get_multi_selects();
1065
1066 if ($key !== '' && isset($selects[$key])) {
1067 $checked = 'checked="checked"';
1068 }
1069
1070 return $checked;
1071 }
1072
1080 public function set_multi_select($rid) {
1081 $selects = $this->get_multi_selects();
1082
1083 if ($rid == '*') {
1084 foreach ($this->_rdata as $record) {
1085 $key = $this->get_record_select_key($record);
1086
1087 if ($key !== '') {
1088 $selects[$key] = 1;
1089 }
1090 }
1091 } else {
1092 $key = $this->normalize_multi_select_key($rid);
1093
1094 if ($key !== '') {
1095 $selects[$key] = 1;
1096 }
1097 }
1098
1099 $this->set_multi_selects($selects);
1100 }
1101
1109 public function del_multi_select($rid) {
1110 $selects = $this->get_multi_selects();
1111
1112 if ($rid != '*') {
1113 $key = $this->normalize_multi_select_key($rid);
1114
1115 if ($key !== '' && isset($selects[$key])) {
1116 unset($selects[$key]);
1117 }
1118 } else {
1119 $selects = array();
1120 }
1121
1122 $this->set_multi_selects($selects);
1123 }
1124
1132 public function set_multi_selects($selects) {
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) {
1138 $key = $this->normalize_multi_select_key($rid);
1139
1140 if ($key !== '') {
1141 $normalized[$key] = 1;
1142 }
1143 }
1144 }
1145 dbx()->set_remember_var('multi_select', $normalized, $modul_key);
1146 $this->_count_selects = -1;
1147 }
1148
1156 public function del_multi_selects($id) {
1157 if ($id == '*') {
1158 $this->set_multi_selects(array());
1159 return;
1160 }
1161
1162 $ids = $this->get_multi_selects();
1163 $key = $this->normalize_multi_select_key($id);
1164
1165 if ($key !== '' && isset($ids[$key])) {
1166 unset($ids[$key]);
1167 }
1168
1169 $this->set_multi_selects($ids);
1170 }
1171
1177 public function get_multi_selects(): array {
1178 $modul = $this->_dbx_modul ;
1179 $modul_key = $modul . '-rpt-' . $this->_fid;
1180 $selects = dbx()->get_remember_var('multi_select', array(), $modul_key);
1181
1182 if (!is_array($selects)) {
1183 $selects = array();
1184 }
1185
1186 $normalized = array();
1187
1188 foreach ($selects as $rid => $value) {
1189 $xkey = $this->normalize_multi_select_key($rid);
1190
1191 if ($xkey !== '') {
1192 $normalized[$xkey] = 1;
1193 }
1194 }
1195
1196 return $normalized;
1197 }
1198
1204 public function get_count_selects() {
1205 $count = $this->_count_selects;
1206
1207 if ($count == -1) {
1208 $selects = $this->get_multi_selects();
1209 $count = is_array($selects) ? count($selects) : 0;
1210 $this->_count_selects = $count;
1211 }
1212
1213 return $count;
1214 }
1215
1233 public function del_selected($rid = 0) {
1234 $count = 0;
1235
1236 if ($rid == '*') {
1237 $count = count($this->get_multi_selects());
1238 $this->del_multi_select('*');
1239 return $count;
1240 }
1241
1242 $key = $this->normalize_multi_select_key($rid);
1243
1244 if ($key === '') {
1245 return 0;
1246 }
1247
1248 $selects = $this->get_multi_selects();
1249
1250 if (isset($selects[$key])) {
1251 unset($selects[$key]);
1252 $this->set_multi_selects($selects);
1253 $count = 1;
1254 }
1255
1256 return $count;
1257 }
1258
1266 public function add_rwhere_select($rwhere) {
1267 $selects = $this->get_multi_selects();
1268 $fld_id = $this->_fld_id ? $this->_fld_id : 'id';
1269
1270 if (!is_array($selects) || !count($selects)) {
1271 if ($rwhere > '') {
1272 $rwhere .= ' and (1=0)';
1273 }
1274
1275 if ($rwhere == '') {
1276 $rwhere .= '1=0';
1277 }
1278
1279 return $rwhere;
1280 }
1281
1282 $values = array();
1283
1284 foreach ($selects as $id => $sel) {
1285 $key = $this->normalize_multi_select_key($id);
1286
1287 if ($key === '') {
1288 continue;
1289 }
1290
1291 if (preg_match('/^-?\d+$/', $key)) {
1292 $values[] = (string) ((int) $key);
1293 } else {
1294 $values[] = "'" . addslashes($key) . "'";
1295 }
1296 }
1297
1298 if (!count($values)) {
1299 if ($rwhere > '') {
1300 $rwhere .= ' and (1=0)';
1301 }
1302
1303 if ($rwhere == '') {
1304 $rwhere .= '1=0';
1305 }
1306
1307 return $rwhere;
1308 }
1309
1310 $selectWhere = $fld_id . ' IN (' . implode(',', $values) . ')';
1311
1312 if ($rwhere > '') {
1313 $rwhere .= ' and (' . $selectWhere . ')';
1314 } else {
1315 $rwhere = $selectWhere;
1316 }
1317
1318 return $rwhere;
1319 }
1320
1330 public function add_rwhere_search($sql, $suchWert, $feldListe) {
1331 if ($suchWert === null) {
1332 $suchWert = '';
1333 }
1334
1335 $suchWert = str_replace(array('\'', '"', '\\', '%'), '', $suchWert);
1336 $suchWert = filter_var($suchWert, FILTER_SANITIZE_SPECIAL_CHARS);
1337
1338 $datum = DateTime::createFromFormat('d.m.Y', $suchWert);
1339
1340 if ($datum && $datum->format('d.m.Y') === $suchWert) {
1341 $suchWert = $datum->format('Y-m-d');
1342 }
1343
1344 $felder = explode(',', $feldListe);
1345 $sql .= ' AND (';
1346 $bedingungen = array();
1347
1348 foreach ($felder as $feld) {
1349 $feld = trim($feld);
1350
1351 if ($feld === '') {
1352 continue;
1353 }
1354
1355 $bedingungen[] = "$feld LIKE '$suchWert%'";
1356 }
1357
1358 $sql .= implode(' OR ', $bedingungen);
1359 $sql .= ')';
1360
1361 return $sql;
1362 }
1363
1376 public function set_form_selects() {
1377 $dbx_do = dbx()->get_modul_var('dbx_do', '', 'parameter');
1378 $ajax = dbx()->get_system_var('dbx_ajax', 0, 'int');
1379
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', '', '*');
1383 $selected = $this->parse_multi_select_ids($idsRaw);
1384 $visibleIds = $this->parse_multi_select_ids($visibleRaw);
1385
1386 if (!$visibleIds) {
1387 $visibleIds = $selected;
1388 }
1389
1390 $selectedMap = array_flip($selected);
1391
1392 foreach ($visibleIds as $rid) {
1393 if (isset($selectedMap[$rid])) {
1394 $this->set_multi_select($rid);
1395 } else {
1396 $this->del_multi_select($rid);
1397 }
1398 }
1399
1400 if ($ajax) {
1401 $this->send_multi_select_json_response($visibleIds, $dbx_do);
1402 }
1403
1404 return 'handled';
1405 }
1406
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', '', '*');
1412
1413 if ($selectId !== '') {
1414 $rid = $selectId;
1415 }
1416
1417 $rid = $this->normalize_multi_select_key($rid);
1418
1419 if ($rid !== '') {
1420 if ($state) {
1421 $this->set_multi_select($rid);
1422 } else {
1423 $this->del_multi_select($rid);
1424 }
1425 }
1426
1427 if ($ajax) {
1429 $this->parse_multi_select_ids($visibleIds),
1430 $dbx_do
1431 );
1432 }
1433
1434 return 'handled';
1435 }
1436
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', '', '*');
1441 $ids = $this->parse_multi_select_ids($idsRaw);
1442 $visibleIds = $this->parse_multi_select_ids($visibleRaw);
1443
1444 if (!$visibleIds) {
1445 $visibleIds = $ids;
1446 }
1447
1448 if ($state) {
1449 $this->set_multi_select_ids($ids);
1450 } else {
1451 $this->del_multi_select_ids($ids);
1452 }
1453
1454 if ($ajax) {
1455 $this->send_multi_select_json_response($visibleIds, $dbx_do);
1456 }
1457
1458 return 'handled';
1459 }
1460
1461 if ($dbx_do === 'clear_selects') {
1462 $this->set_multi_selects(array());
1463
1464 if ($ajax) {
1465 $this->send_multi_select_json_response(array(), $dbx_do);
1466 }
1467
1468 return 'handled';
1469 }
1470
1471 return 0;
1472 }
1473
1482 public function rpt_format($key, $value) {
1483 $reform = $this->get_report_format($key);
1484
1485 if ($reform == 'php-date-usr' || $reform == 'date') {
1486 $value = $this->php_date_usr($value);
1487 }
1488
1489 if (
1490 $reform == 'php-datetime-usr' ||
1491 $reform == 'date_time' ||
1492 $reform == 'datetime' ||
1493 $reform == 'datetime_ms'
1494 ) {
1495 $value = $this->php_datetime_usr($value);
1496 }
1497
1498 if ($reform == 'html-chars') {
1499 $value = htmlspecialchars((string) $value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
1500 }
1501
1502 if ($value === null) {
1503 $value = '';
1504 }
1505
1506 return $value;
1507 }
1508
1516 protected function get_report_format($key) {
1517 $format = $this->_rpt_format;
1518 $reform = '';
1519
1520 if (is_array($format)) {
1521 if (isset($format[$key])) {
1522 $reform = $format[$key];
1523 }
1524 } else {
1525 $reform = $format;
1526 }
1527
1528 if ($reform === '') {
1529 $reform = $this->get_auto_report_format($key);
1530 }
1531
1532 return (string) $reform;
1533 }
1534
1542 protected function report_cell_allows_html($key) {
1543 $format = strtolower(trim($this->get_report_format($key)));
1544
1545 return in_array($format, array('html', 'raw-html', 'raw', 'tpl', 'template'), true);
1546 }
1547
1560 protected function render_report_cell_value($key, $value) {
1561 if ($value === null) {
1562 return '';
1563 }
1564
1565 return (string) $value;
1566 }
1567
1579 protected function get_auto_report_format($key) {
1580 static $cache = array();
1581
1582 if (!$this->_dd || !$key) {
1583 return '';
1584 }
1585
1586 $dd = (string) $this->_dd;
1587 $key = (string) $key;
1588 $cacheKey = $dd . '|' . $key;
1589
1590 if (array_key_exists($cacheKey, $cache)) {
1591 return $cache[$cacheKey];
1592 }
1593
1594 $format = '';
1595 $convert = strtolower(trim((string) $this->get_dd($dd, $key, 'convert')));
1596
1597 if (in_array($convert, array('date', 'php-date-usr'), true)) {
1598 $format = 'php-date-usr';
1599 $cache[$cacheKey] = $format;
1600 return $format;
1601 }
1602
1603 if (in_array($convert, array('date_time', 'datetime', 'datetime_ms', 'php-datetime-usr'), true)) {
1604 $format = 'php-datetime-usr';
1605 $cache[$cacheKey] = $format;
1606 return $format;
1607 }
1608
1609 $type = strtolower(trim((string) $this->get_dd($dd, $key, 'type')));
1610
1611 if ($type == 'date') {
1612 $format = 'php-date-usr';
1613 $cache[$cacheKey] = $format;
1614 return $format;
1615 }
1616
1617 if (in_array($type, array('datetime', 'date_time', 'datetime_ms', 'timestamp'), true)) {
1618 $format = 'php-datetime-usr';
1619 $cache[$cacheKey] = $format;
1620 return $format;
1621 }
1622
1623 $cache[$cacheKey] = '';
1624
1625 return '';
1626 }
1627
1635 public function rpt_merge_obj($content) {
1636 $count_select = $this->get_count_selects();
1637 $count_cols = $this->_table_col_count;
1638 $page = $this->_current_page;
1639 $page_break = $this->_page_break;
1640
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);
1645
1646 if (is_array($this->_obj)) {
1647 foreach ($this->_obj as $key => $value) {
1648 $xkey = '{obj:' . $key . '}';
1649
1650 if ($value === null) {
1651 $value = '';
1652 }
1653
1654 $content = str_replace($xkey, $value, $content);
1655 }
1656 }
1657
1658 return $content;
1659 }
1660
1661 public function forward_run_report_haeder($content) {
1662 return $this->rpt_merge_obj($content);
1663 }
1664
1665 public function forward_run_page_haeder($content) {
1666 return $this->rpt_merge_obj($content);
1667 }
1668
1669 public function forward_run_page_footer($content) {
1670 return $this->rpt_merge_obj($content);
1671 }
1672
1673 public function run_report_haeder($content) {
1674 $content = ($this->_fid != 'pagination') ? $this->callback('report_header', $content) : $content;
1675 return $this->forward_run_report_haeder($content);
1676 }
1677
1678 public function run_page_haeder($content) {
1679 $content = ($this->_fid != 'pagination') ? $this->callback('page_header', $content) : $content;
1680 return $this->forward_run_page_haeder($content);
1681 }
1682
1683 public function run_page_footer($content) {
1684 $content = ($this->_fid != 'pagination') ? $this->callback('page_footer', $content) : $content;
1685 return $this->forward_run_page_footer($content);
1686 }
1687
1688 public function forward_run_report_footer($content) {
1689 return $this->rpt_merge_obj($content);
1690 }
1691
1692 public function run_report_footer($content) {
1693 $content = ($this->_fid != 'pagination') ? $this->callback('report_footer', $content) : $content;
1694 return $this->forward_run_report_footer($content);
1695 }
1696
1697 public function run_haeder($content) {
1698 $content = ($this->_fid != 'pagination') ? $this->callback('header', $content) : $content;
1699 return $this->forward_run_haeder($content);
1700 }
1701
1702 public function run_body($content) {
1703 $content = ($this->_fid != 'pagination') ? $this->callback('body', $content) : $content;
1704 return $this->forward_run_body($content);
1705 }
1706
1707 public function run_footer($content) {
1708 $content = ($this->_fid != 'pagination') ? $this->callback('footer', $content) : $content;
1709 return $this->forward_run_footer($content);
1710 }
1711
1712 public function forward_run_haeder($content) {
1713 return $this->rpt_merge_obj($content);
1714 }
1715
1716 public function forward_get_footer_page() {
1717 $footer = $this->_footer_next_page;
1718 $footer .= $this->_footer_page;
1719 $footer = $this->rpt_merge_obj($footer);
1720
1721 return $footer;
1722 }
1723
1724 public function forward_get_haeder_page() {
1725 $haeder = $this->_haeder_page;
1726 $haeder .= $this->_haeder_next_page;
1727 $haeder = $this->get_report_haeder($haeder);
1728 $haeder = $this->rpt_merge_obj($haeder);
1729
1730 return $haeder;
1731 }
1732
1733 public function get_footer_page() {
1734 return $this->forward_get_footer_page();
1735 }
1736
1737 public function get_haeder_page() {
1738 return $this->forward_get_haeder_page();
1739 }
1740
1748 private function get_class_body($xkey) {
1749 $class = $xkey;
1750
1751 if (isset($this->_class_body[$xkey])) {
1752 $class = $this->_class_body[$xkey];
1753 }
1754
1755 return $class;
1756 }
1757
1758 public function forward_run_body($content) {
1759 $page_footer = '';
1760 $page_haeder = '';
1761 $rpt = $this->_fid;
1762
1763 if ($rpt != 'pagination') {
1764 $this->_current_report_ln++;
1765 $this->_current_page_ln++;
1766
1767 $pn = $this->_current_page;
1768 $ln = $this->_current_page_ln;
1769
1770 if ($pn == 1) {
1771 $max = $this->_first_page_lines;
1772 } else {
1773 $max = $this->_next_page_lines;
1774 }
1775
1776 if ($ln > $max) {
1777 $page_footer = $this->get_footer_page();
1778 $this->_current_page_ln = 1;
1779 $page_haeder = $this->get_haeder_page();
1780 }
1781
1782 $content = $this->rpt_merge_obj($content);
1783 }
1784
1785 return $page_footer . $page_haeder . $content;
1786 }
1787
1788 public function forward_run_footer($content) {
1789 return $this->rpt_merge_obj($content);
1790 }
1791
1792 public function set_class_haeder($key, $class = '') {
1793 if (!$class) {
1794 $class = 'th-' . $key;
1795 }
1796
1797 $this->_class_haeder[$key] = $class;
1798 }
1799
1800 private function get_class_haeder($key) {
1801 $class = '';
1802
1803 if (is_array($this->_class_haeder)) {
1804 if (isset($this->_class_haeder[$key])) {
1805 $class = $this->_class_haeder[$key];
1806 }
1807 }
1808
1809 if (!$class) {
1810 $class = 'th-' . $key;
1811 }
1812
1813 return $class;
1814 }
1815
1816 public function set_style_haeder($key, $style) {
1817 $this->_style_haeder[$key] = $style;
1818 }
1819
1820 private function get_style_haeder($key) {
1821 $style = '';
1822
1823 if (is_array($this->_style_haeder)) {
1824 if (isset($this->_style_haeder[$key])) {
1825 $style = $this->_style_haeder[$key];
1826 }
1827 }
1828
1829 return $style;
1830 }
1831
1840 protected function get_table_action_definitions() {
1841 return array(
1842 array(
1843 'type' => 'expander',
1844 'enabled' => (bool) $this->_data_table,
1845 'header_tpl' => 'tpl_haeder_expander',
1846 'row_tpl' => 'tpl_row_expander',
1847 ),
1848 array(
1849 'type' => 'edit',
1850 'enabled' => (bool) $this->_create_row_edit,
1851 'header_tpl' => 'tpl_haeder_edit',
1852 'row_tpl' => 'tpl_row_edit',
1853 ),
1854 array(
1855 'type' => 'copy',
1856 'enabled' => (bool) $this->_create_row_copy,
1857 'header_tpl' => 'tpl_haeder_copy',
1858 'row_tpl' => 'tpl_row_copy',
1859 ),
1860 array(
1861 'type' => 'show',
1862 'enabled' => (bool) $this->_create_row_show,
1863 'header_tpl' => 'tpl_haeder_show',
1864 'row_tpl' => 'tpl_row_show',
1865 ),
1866 array(
1867 'type' => 'export',
1868 'enabled' => (bool) $this->_create_row_export,
1869 'header_tpl' => 'tpl_haeder_export',
1870 'row_tpl' => 'tpl_row_export',
1871 ),
1872 array(
1873 'type' => 'import',
1874 'enabled' => (bool) $this->_create_row_import,
1875 'header_tpl' => 'tpl_haeder_import',
1876 'row_tpl' => 'tpl_row_import',
1877 ),
1878 array(
1879 'type' => 'download',
1880 'enabled' => (bool) $this->_create_row_download,
1881 'header_tpl' => 'tpl_haeder_download',
1882 'row_tpl' => 'tpl_row_download',
1883 ),
1884 array(
1885 'type' => 'delete',
1886 'enabled' => (bool) $this->_create_row_delete,
1887 'header_tpl' => 'tpl_haeder_delte',
1888 'row_tpl' => 'tpl_row_delete',
1889 ),
1890 array(
1891 'type' => 'print',
1892 'enabled' => (bool) $this->_create_row_print,
1893 'header_tpl' => 'tpl_haeder_print',
1894 'row_tpl' => 'tpl_row_print',
1895 ),
1896 );
1897 }
1898
1899 protected function render_simple_table_tpl($file, array $data) {
1900 if (!isset($this->_table_render_tpl_cache[$file])) {
1901 $this->_table_render_tpl_cache[$file] = $this->get_tpl($file, array());
1902 }
1903
1904 return $this->oTPL->replaces($this->_table_render_tpl_cache[$file], $data);
1905 }
1906
1913 $html = '';
1914 $count = 0;
1915
1916 foreach ($this->get_table_action_definitions() as $def) {
1917 if (!$def['enabled']) {
1918 continue;
1919 }
1920
1921 $file = $this->_tabel_tpls[$def['header_tpl']];
1922 $tpl = $this->render_simple_table_tpl($file, array(
1923 'name' => 'ID',
1924 'class' => 'no-sort',
1925 ));
1926
1927 $html .= $tpl . "\n";
1928 $count++;
1929 }
1930
1931 return array(
1932 'html' => $html,
1933 'count' => $count,
1934 );
1935 }
1936
1945 protected function get_table_row_action_data($type, array $record) {
1946 $rid = $this->get_record_rid($record, -1);
1947 $dat = array(
1948 'rid' => $rid,
1949 'value' => $rid,
1950 'action' => $this->get_report_action_url(),
1951 'class' => 'no-sort',
1952 'tooltip' => '',
1953 );
1954
1955 if ($type === 'download') {
1956 $dat['href_dir_file'] = dbx()->get_modul_var('href_dir_file', '', '*');
1957 }
1958
1959 if ($type === 'copy') {
1960 $dat['confirm'] = $this->_msg_confirm_copy;
1961 }
1962
1963 if ($type === 'delete') {
1964 $dat['confirm'] = $this->_msg_confirm_delete;
1965 }
1966
1967 if ($this->_fid != 'pagination') {
1968 $data = array(
1969 'type' => $type,
1970 'record' => $record,
1971 'data' => $dat,
1972 );
1973
1974 $data = $this->callback('row_action_data', $data);
1975
1976 if (is_array($data) && isset($data['data']) && is_array($data['data'])) {
1977 $dat = $data['data'];
1978 }
1979 }
1980
1981 return $dat;
1982 }
1983
1991 protected function render_table_row_action_block(array $record) {
1992 $html = '';
1993
1994 foreach ($this->get_table_action_definitions() as $def) {
1995 if (!$def['enabled']) {
1996 continue;
1997 }
1998
1999 $file = $this->_tabel_tpls[$def['row_tpl']];
2000 $dat = $this->get_table_row_action_data($def['type'], $record);
2001 $tpl = $this->render_simple_table_tpl($file, $dat);
2002
2003 $html .= $tpl . "\n";
2004 }
2005
2006 return $html;
2007 }
2008
2019 protected function render_table_header_select(array $auto_flds, $fld_id, $class, array $select_state) {
2020 $file = $this->_tabel_tpls['tpl_haeder_select'];
2021 $name = isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] : 'xID';
2022 $checked = '';
2023
2024 if (!empty($select_state['header_checked'])) {
2025 $checked = 'checked="checked"';
2026 }
2027
2028 return $this->render_simple_table_tpl($file, array(
2029 'name' => $name,
2030 'checked' => $checked,
2031 'class' => $class,
2032 'header_state' => isset($select_state['header_state']) ? $select_state['header_state'] : 'none',
2033 ));
2034 }
2035
2044 protected function render_table_row_select(array $record, $class) {
2045 $file = $this->_tabel_tpls['tpl_row_select'];
2046 $name = $this->_fid . '_select';
2047 $rid = $this->get_record_select_key($record);
2048 $checked = $this->check_is_multiselect($rid);
2049
2050 if ($checked) {
2051 $this->_post[$name] = 1;
2052 }
2053
2054 return $this->render_simple_table_tpl($file, array(
2055 'name' => $name,
2056 'value' => $rid,
2057 'rid' => $rid,
2058 'checked' => $checked,
2059 'class' => $class,
2060 'tooltip' => '',
2061 ));
2062 }
2063
2072 protected function render_table_header_data_columns(array $auto_flds, $fld_id) {
2073 $html = '';
2074 $count = 0;
2075
2076 foreach ($auto_flds as $key => $value) {
2077 $skip = 0;
2078
2079 if ($this->_create_row_select && $key == $fld_id) {
2080 $skip = 1;
2081 }
2082
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);
2087
2088 $tpl = $this->render_simple_table_tpl($file, array(
2089 'value' => $value,
2090 'name' => $key,
2091 'class' => $class,
2092 'style' => $style,
2093 ));
2094
2095 $html .= $tpl . "\n";
2096 $count++;
2097 }
2098 }
2099
2100 return array(
2101 'html' => $html,
2102 'count' => $count,
2103 );
2104 }
2105
2116 protected function render_table_row_data_columns(array $record, array $auto_flds, $fld_id, $defaultClass = 'auto-fld') {
2117 $html = '';
2118
2119 foreach ($auto_flds as $no => $key) {
2120 $xkey = '';
2121 $value = '-?-';
2122 $label = $auto_flds[$no];
2123 $skip = 0;
2124
2125 if (isset($record[$key])) {
2126 $xkey = $key;
2127 } elseif (isset($record[$no])) {
2128 $xkey = $no;
2129 }
2130
2131 if ($this->_create_row_select && $xkey == $fld_id) {
2132 $skip = 1;
2133 }
2134
2135 if (!$skip && $label > '') {
2136 if ($xkey) {
2137 $value = $record[$xkey];
2138 $value = $this->rpt_format($xkey, $value);
2139 }
2140
2141 $class = $defaultClass;
2142
2143 if ($defaultClass !== 'auto-fld') {
2144 $class = $this->get_class_body($xkey);
2145 }
2146
2147 $class = trim($class . ' dbx-report-cell');
2148 $value = $this->render_report_cell_value($xkey, $value);
2149
2150 $tpl = $this->render_simple_table_tpl($this->_tabel_tpls['tpl_row_col'], array(
2151 'value' => $value,
2152 'class' => $class,
2153 'tooltip' => '',
2154 ));
2155
2156 $html .= $tpl . "\n";
2157 }
2158 }
2159
2160 return $html;
2161 }
2162
2170 public function get_report_haeder($content = '') {
2171 if (!$content) {
2172 $content = $this->_haeder;
2173 }
2174
2175 $this->_current_page++;
2176 $col_count = 0;
2177 $auto_flds = $this->_auto_flds;
2178 $auto_mode = $this->_auto_mode;
2179 $select_state = $this->get_visible_multi_select_state();
2180
2181 if (!is_array($auto_flds)) {
2182 if (is_string($auto_flds) && $auto_flds !== '') {
2183 $auto_flds = explode(',', $auto_flds);
2184 } else {
2185 $auto_flds = array();
2186 }
2187 }
2188
2189 $pos = strpos($content, '[rpt:row]');
2190
2191 if ($pos !== false) {
2192 $row = '';
2193 $fld_id = $this->_fld_id;
2194
2195 if ($auto_mode == 'table' && is_array($auto_flds)) {
2196 $buttonBlock = $this->render_table_header_action_block();
2197 $columnBlock = $this->render_table_header_data_columns($auto_flds, $fld_id);
2198
2199 if ($this->_table_buttons != 'left') {
2200 if ($this->_create_row_select) {
2201 $row .= $this->render_table_header_select(
2202 $auto_flds,
2203 $fld_id,
2204 $this->get_class_haeder(isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] : 'xID'),
2205 $select_state
2206 ) . "\n";
2207 $col_count++;
2208 }
2209
2210 $row .= $columnBlock['html'];
2211 $col_count += $columnBlock['count'];
2212
2213 $row .= $buttonBlock['html'];
2214 $col_count += $buttonBlock['count'];
2215 } else {
2216 $row .= $buttonBlock['html'];
2217 $col_count += $buttonBlock['count'];
2218
2219 if ($this->_create_row_select) {
2220 $row .= $this->render_table_header_select(
2221 $auto_flds,
2222 $fld_id,
2223 'no-sort',
2224 $select_state
2225 ) . "\n";
2226 $col_count++;
2227 }
2228
2229 $row .= $columnBlock['html'];
2230 $col_count += $columnBlock['count'];
2231 }
2232
2233 $this->_table_col_count = $col_count;
2234 }
2235
2236 $content = str_replace('[rpt:row]', $row, $content);
2237 }
2238
2239 $content = $this->run_haeder($content);
2240
2241 return $content;
2242 }
2243
2249 public function get_report_body(): string {
2250 $content = '';
2251 $line = '';
2252 $loop = 0;
2253
2254 $auto_flds = $this->_auto_flds;
2255 $auto_mode = $this->_auto_mode;
2256
2257 if (!is_array($auto_flds)) {
2258 if (is_string($auto_flds) && $auto_flds !== '') {
2259 $auto_flds = explode(',', $auto_flds);
2260 } else {
2261 $auto_flds = array();
2262 }
2263 }
2264
2265 if (is_array($this->_rdata)) {
2266 foreach ($this->_rdata as $recnum => $record) {
2267 $loop++;
2268 $line = $this->_body;
2269
2270 $this->_record = $record;
2271 $record = ($this->_fid != 'pagination') ? $this->callback('next_record', $record) : $record;
2272 $this->_record = $record;
2273
2274 if (!is_array($record)) {
2275 continue;
2276 }
2277
2278 $line = $this->run_body($line);
2279 $record = $this->_record;
2280
2281 if (!is_array($record)) {
2282 continue;
2283 }
2284
2285 $fld_id = $this->_fld_id;
2286 $pos = strpos($line, '[rpt:row]');
2287
2288 if ($pos !== false && $this->_rdata_inline) {
2289 $inline = $this->_body_inline;
2290 return str_replace('[rpt:row]', $inline, $line);
2291 }
2292
2293 if ($pos !== false) {
2294 $row = '';
2295
2296 if ($auto_mode == 'table' && is_array($auto_flds)) {
2297 $buttonBlock = $this->render_table_row_action_block($record);
2298
2299 if ($this->_table_buttons != 'left') {
2300 if ($this->_create_row_select) {
2301 $row .= $this->render_table_row_select($record, 'no-sort') . "\n";
2302 }
2303
2304 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id, 'auto-fld');
2305 $row .= $buttonBlock;
2306 } else {
2307 $row .= $buttonBlock;
2308
2309 if ($this->_create_row_select) {
2310 $row .= $this->render_table_row_select($record, 'no-sort') . "\n";
2311 }
2312
2313 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id, 'body');
2314 }
2315 }
2316
2317 $line = str_replace('[rpt:row]', $row, $line);
2318 }
2319
2320 $tr_class = $this->get_class_tr($record);
2321 $tr_class .= ($loop % 2 != 0) ? ' odd' : ' even';
2322
2323 $line = str_replace('{tr-class}', $tr_class, $line);
2324
2325 if (is_array($record)) {
2326 foreach ($record as $field => $value) {
2327 $field_name = '{' . $field . '}';
2328
2329 if (strpos($line, $field_name) === false) {
2330 continue;
2331 }
2332
2333 $value = $this->rpt_format($field, $value);
2334
2335 if (!is_array($value) && !is_object($value)) {
2336 if ($value === null) {
2337 $value = '';
2338 }
2339
2340 $line = str_replace($field_name, (string) $value, $line);
2341 }
2342 }
2343 }
2344
2345 $col_count = $this->_table_col_count;
2346 $line = str_replace('{rpt:col_count}', $col_count, $line);
2347
2348 if (strpos($line, '{r}') !== false) {
2349 $r = dbx()->next_id(1);
2350 $line = str_replace('{r}', $r, $line);
2351 }
2352
2353 $content .= $line;
2354
2355 if ($this->_rdata_inline) {
2356 break;
2357 }
2358 }
2359 }
2360
2361 return $content;
2362 }
2363
2364 public function get_class_tr($record) {
2365 $class = '';
2366 $activ_id = $this->_activ_id;
2367
2368 if (!$activ_id) {
2369 $activ_id = $this->get_activ_id();
2370 }
2371
2372 if ($activ_id) {
2373 $key = $this->_fld_id;
2374
2375 if ($key && isset($record[$key])) {
2376 if ($activ_id == $record[$key]) {
2377 $class = 'table-active';
2378 }
2379 }
2380 }
2381
2382 return $class;
2383 }
2384
2385 public function get_report_footer() {
2386 $content = $this->_footer;
2387 $col_count = $this->_table_col_count;
2388
2389 $content = str_replace('{rpt:col_count}', $col_count, $content);
2390 $content = $this->run_footer($content);
2391
2392 return $content;
2393 }
2394
2395 public function split_tpl($report) {
2396 $report_part = explode('<hr class="dbx_split">', $report);
2397 $report_header = '';
2398 $report_body = '';
2399 $report_footer = '';
2400 $next_haeder_page = '';
2401 $next_footer_page = '';
2402 $count = count($report_part);
2403
2404 if ($count > 0) {
2405 $report_body = $report_part[0];
2406 }
2407
2408 if ($count > 1) {
2409 $report_header = $report_part[0];
2410 $report_body = $report_part[1];
2411 }
2412
2413 if ($count > 2) {
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];
2419 }
2420
2421 if ($count > 5) {
2422 $next_haeder_page = $report_part[3];
2423 $next_footer_page = $report_part[5];
2424 }
2425
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;
2431 }
2432
2444 protected function ensure_report_select_feature($content) {
2445 if ((!$this->_create_row_select && !$this->_create_sel_flds) || !is_string($content) || stripos($content, 'dbxReport') === false) {
2446 return $content;
2447 }
2448
2449 return preg_replace_callback(
2450 '/<div\b(?=[^>]*\bclass\s*=\s*(["\'])[^"\']*\bdbxReport\b[^"\']*\1)([^>]*)>/i',
2451 function ($match) {
2452 $tag = $match[0];
2453
2454 if (preg_match('/\bdata-dbx\s*=\s*(["\'])(.*?)\1/i', $tag, $dataMatch)) {
2455 $value = trim($dataMatch[2]);
2456
2457 if (stripos($value, 'lib=report') !== false) {
2458 return $tag;
2459 }
2460
2461 $value = ($value === '') ? 'lib=report|form=0' : $value . '||lib=report|form=0';
2462 $newAtt = 'data-dbx=' . $dataMatch[1] . $value . $dataMatch[1];
2463
2464 return str_replace($dataMatch[0], $newAtt, $tag);
2465 }
2466
2467 return substr($tag, 0, -1) . ' data-dbx="lib=report|form=0">';
2468 },
2469 $content,
2470 1
2471 );
2472 }
2473
2482 public function get_report_pages() {
2483 $content = '';
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;
2491
2492 if (!$link) {
2493 $link = '?dbx_modul=' . $modul . '&dbx_run1=' . $action;
2494 }
2495
2496 $link = $this->_action ?: $link;
2497 $content = $this->pagination($tpl, $link, $rpos, $rrows, $rcount);
2498
2499 return $content;
2500 }
2501
2502 private function lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount) {
2503 $active = '';
2504 $class = '';
2505 $current = '';
2506 $p_active = '';
2507 $s_active = '';
2508
2509 if ($p == $akt_page) {
2510 $p_active = ' aria-current="page"';
2511 $active = ' active';
2512 $current = ' aria-current="page" ';
2513 }
2514
2515 $rec = array();
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';
2522
2523 return $rec;
2524 }
2525
2526 private function pagination($tpl, $link, $rpos, $rrows, $rcount) {
2527 if ($rrows == 0) {
2528 return '';
2529 }
2530
2531 $pages = intval($rcount / $rrows);
2532
2533 if ($rcount % $rrows) $pages++;
2534 if ($pages == 0) $pages = 1;
2535
2536
2537 $pmax = $this->_but_pagination;
2538 $akt_page = intval($rpos / $rrows) + 1;
2539
2540 if ($akt_page < 1) $akt_page = 1;
2541 if ($akt_page > $pages) $akt_page = $pages;
2542
2543 $half = intval($pmax / 2);
2544 $p_s = $akt_page - $half;
2545 $p_e = $akt_page + $half;
2546
2547 if ($p_s < 1) {
2548 $p_s = 1;
2549 $p_e = $pmax;
2550 }
2551
2552 if ($p_e > $pages) {
2553 $p_e = $pages;
2554 $p_s = $pages - $pmax + 1;
2555
2556 if ($p_s < 1) {
2557 $p_s = 1;
2558 }
2559 }
2560
2561 $last_pos = ($pages - 1) * $rrows;
2562 $prev = ($akt_page - 2) * $rrows;
2563 $next = ($akt_page) * $rrows;
2564
2565 if ($prev < 0) $prev = 0;
2566 if ($next > $last_pos) $next = $last_pos;
2567
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 ;
2572
2573 $this->_sys['dbx_rpos'] = $rpos;
2574 $this->_sys['dbx_rrows'] = $rrows;
2575
2576 $dv = array();
2577 $dv['dbx_rpos'] = $rpos;
2578 $dv['dbx_rrows'] = $rrows;
2579 $rdata = array();
2580
2581 for ($p = $p_s; $p <= $p_e; $p++) {
2582 $rdata[] = $this->lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount);
2583
2584 if ($p >= $pages) {
2585 break;
2586 }
2587 }
2588
2589 $oReport = dbx()->get_system_obj('dbxReport');
2590
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;
2607
2608 $content = $oReport->run();
2609
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();
2615
2616 $countAll = ($this->_count_all >= 0) ? $this->_count_all : $rcount;
2617
2618 $content = $this->applyReportCountReplaces($content);
2619
2620 return $content;
2621 }
2622
2623 public function data_rows($data, $rpos, $rrows) {
2624 $rdata = array();
2625
2626 for ($i = $rpos; $i < ($rpos + $rrows); $i++) {
2627 if (isset($data[$i])) {
2628 $rdata[] = $data[$i];
2629 } else {
2630 break;
2631 }
2632 }
2633
2634 return $rdata;
2635 }
2636
2637 public function add_where($mode, $select, $where = '') {
2638 if ($select) {
2639 if ($where) {
2640 $where .= " $mode (";
2641 $where .= $select;
2642 $where .= ') ';
2643 } else {
2644 $where = $select;
2645 }
2646 }
2647
2648 return $where;
2649 }
2650
2651 public function no_page_reset() {
2652 $this->_page_reset = 0;
2653 }
2654
2655
2656
2657 protected function get_grid_replaces(): array {
2658 $gridId = $this->_grid_id;
2659
2660 if (!$gridId) {
2661 $gridId = $this->_fid . '_grid';
2662 }
2663
2664 $cols = $this->_grid_cols;
2665
2666 if (!$cols && $this->_dd) {
2667 $oDB = dbx()->get_system_obj('dbxDB');
2668 $cols = $oDB->get_dd_grid_cols($this->_dd);
2669 }
2670
2671 $rrows = (int) $this->_rrows;
2672 $rpos = (int) $this->_rpos;
2673 $page = ($rrows > 0) ? ((int) floor($rpos / $rrows) + 1) : 1;
2674
2675 return array(
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,
2692 );
2693 }
2694
2695 public function add_grid_stats(array $stats, $ariaLabel = '') {
2696 if (!$stats) {
2697 $this->add_rep('grid_stats', '');
2698 return;
2699 }
2700
2701 $html = '<div class="dbx-grid-stats"';
2702 if ((string)$ariaLabel !== '') {
2703 $html .= ' aria-label="' . htmlspecialchars((string)$ariaLabel, ENT_QUOTES) . '"';
2704 }
2705 $html .= '>';
2706
2707 foreach ($stats as $stat) {
2708 if (!is_array($stat)) {
2709 continue;
2710 }
2711
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';
2716
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);
2723 }
2724
2725 $html .= '<div class="' . $class . '"><span>' . $label . '</span><strong>' . $value . '</strong></div>';
2726 }
2727
2728 $html .= '</div>';
2729 $this->add_rep('grid_stats', $html);
2730 }
2731
2732 protected function buildGridBarObj() {
2733 if ($this->_mode !== 'tabulurator') {
2734 return;
2735 }
2736 }
2737
2738 protected function prepareReportFrameReplaces(int $i, array $options = array()): void {
2739 $withForm = (string)($this->_replaces['frame_use_form'] ?? '0') !== '0';
2740 if (array_key_exists('with_form', $options)) {
2741 $withForm = (bool)$options['with_form'];
2742 }
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;
2747 }
2748
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));
2752 }
2753 $panelAttrs = (string)($this->_replaces['report_shell_attrs'] ?? '');
2754 if ($panelAttrs === '') {
2755 $panelAttrs = (string)($this->_replaces['shell_panel_attrs'] ?? '');
2756 }
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'] ?? ''));
2762
2763 if ($withForm) {
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>');
2768 } else {
2769 $this->add_rep('frame_form_open', '');
2770 $this->add_rep('frame_form_close', '');
2771 }
2772 }
2773
2781 protected function applyReportCountReplaces($content) {
2782 $rcount = (int) $this->_rcount;
2783 $countAll = ($this->_count_all >= 0) ? (int) $this->_count_all : $rcount;
2784
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);
2790
2791 return $content;
2792 }
2793
2794 protected function cleanupReportBarSlots($content) {
2795 return preg_replace(
2796 '/<div class="dbx-report-bar-field"[^>]*>\s*\{obj:[a-z0-9_]+\}\s*<\/div>\s */i',
2797 '',
2798 (string) $content
2799 );
2800 }
2801
2809 protected function resolveReportMsgText($msg) {
2810 $msg = trim((string) $msg);
2811
2812 if ($msg === '') {
2813 return '';
2814 }
2815
2816 $editor = dbx()->get_system_var('dbx_editor', 0, 'int');
2817
2818 if (!$editor && preg_match('/^#form_msg_(info|success|error|warning)#$/', $msg)) {
2819 return '';
2820 }
2821
2822 return $msg;
2823 }
2824
2830 protected function buildReportFormMsgHtml() {
2831 $error = $this->resolveReportMsgText($this->_msg_error);
2832
2833 if ($error === '' && !empty($this->_msg_err)) {
2834 $error = $this->resolveReportMsgText($this->_msg_err);
2835 }
2836
2837 if ($error !== '') {
2838 return $this->get_form_msg('error', $error);
2839 }
2840
2841 $warning = $this->resolveReportMsgText($this->_msg_warning);
2842
2843 if ($warning !== '') {
2844 return $this->get_form_msg('warning', $warning);
2845 }
2846
2847 $success = $this->resolveReportMsgText($this->_msg_success);
2848
2849 if ($success !== '') {
2850 return $this->get_form_msg('success', $success);
2851 }
2852
2853 if ($this->submit() && $this->errors()) {
2854 return $this->get_form_msg('error', 'Pruefen Sie bitte Ihre Eingaben.');
2855 }
2856
2857 $info = $this->resolveReportMsgText($this->_msg_info);
2858
2859 if ($info !== '') {
2860 return $this->get_form_msg('info', $info);
2861 }
2862
2863 return '';
2864 }
2865
2876 public function add_action($obj, $tpl, $action = '', $data = '') {
2877 parent::add_action($obj, $tpl, $action, $data);
2878
2879 $dbx_do = $this->parse_report_action_code($action);
2880
2881 if ($dbx_do === '') {
2882 return;
2883 }
2884
2885 $confirm = '';
2886
2887 if ($tpl === 'action_button_delete') {
2888 $confirm = (string) $this->_msg_confirm_delete;
2889 }
2890
2891 $this->_report_multi_actions[$dbx_do] = array(
2892 'obj' => (string) $obj,
2893 'label' => $this->get_report_action_label($tpl),
2894 'tpl' => (string) $tpl,
2895 'action' => (string) $action,
2896 'confirm' => $confirm,
2897 'quick' => in_array($dbx_do, array('multi_select', 'multi_deselect'), true),
2898 );
2899 }
2900
2906 protected function parse_report_action_code($action) {
2907 $action = (string) $action;
2908
2909 if ($action === '' || $action[0] !== '&') {
2910 return '';
2911 }
2912
2913 if (preg_match('/(?:^|&)dbx_do=([^&]+)/', $action, $match)) {
2914 return (string) $match[1];
2915 }
2916
2917 if (preg_match('/(?:^|&)dbx_run2=([^&]+)/', $action, $match)) {
2918 return (string) $match[1];
2919 }
2920
2921 return '';
2922 }
2923
2929 protected function get_report_action_label($tpl) {
2930 $labels = array(
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',
2936 );
2937
2938 return $labels[$tpl] ?? (string) $tpl;
2939 }
2940
2950 public function delete_multi_selected_records($dd, $verify_access = 1, $trace = 1) {
2951 $db = dbx()->get_system_obj('dbxDB');
2952 $selects = array_keys($this->get_multi_selects());
2953 $fld_id = $this->_fld_id ? $this->_fld_id : 'id';
2954 $deleted = 0;
2955 $failed = 0;
2956
2957 if (!is_array($selects) || !count($selects)) {
2958 return array(
2959 'deleted' => 0,
2960 'failed' => 0,
2961 'total' => 0,
2962 );
2963 }
2964
2965 foreach ($selects as $id) {
2966 $key = $this->normalize_multi_select_key($id);
2967
2968 if ($key === '') {
2969 continue;
2970 }
2971
2972 if (preg_match('/^-?\d+$/', $key)) {
2973 $where = $fld_id . '=' . (int) $key;
2974 } else {
2975 $where = $fld_id . "='" . addslashes($key) . "'";
2976 }
2977
2978 $ok = $db->delete($dd, $where, $verify_access, $trace);
2979 $this->del_selected($key);
2980
2981 if ((int) $ok > 0) {
2982 $deleted++;
2983 } else {
2984 $failed++;
2985 }
2986 }
2987
2988 $this->_count_selects = -1;
2989
2990 return array(
2991 'deleted' => $deleted,
2992 'failed' => $failed,
2993 'total' => $deleted + $failed,
2994 );
2995 }
2996
3004 public function apply_multi_delete_result(array $result) {
3005 $deleted = (int) ($result['deleted'] ?? 0);
3006 $failed = (int) ($result['failed'] ?? 0);
3007
3008 if ($deleted <= 0 && $failed <= 0) {
3009 return;
3010 }
3011
3012 if ($deleted > 0 && $failed === 0) {
3013 if ($deleted === 1) {
3014 $this->_msg_success = '1 Datensatz gelöscht.';
3015 } else {
3016 $this->_msg_success = $deleted . ' Datensätze gelöscht.';
3017 }
3018 return;
3019 }
3020
3021 if ($deleted > 0) {
3022 $this->_msg_error = $deleted . ' Datensätze gelöscht, ' . $failed . ' fehlgeschlagen.';
3023 return;
3024 }
3025
3026 $this->_msg_error = 'Löschen fehlgeschlagen.';
3027 }
3028
3034 protected function buildReportFooterObj() {
3035 if (!$this->_create_row_select || !$this->_report_multi_actions) {
3036 return;
3037 }
3038
3039 if (isset($this->_obj['report_footer'])) {
3040 return;
3041 }
3042
3043 $selectOptions = '';
3044 $actionLinks = '';
3045 $hasSelect = 0;
3046
3047 foreach ($this->_report_multi_actions as $dbx_do => $action) {
3048 if (!empty($action['quick'])) {
3049 continue;
3050 }
3051
3052 $hasSelect = 1;
3053 $label = (string) ($action['label'] ?? $dbx_do);
3054 $actionSuffix = (string) ($action['action'] ?? '');
3055 $actionUrl = $actionSuffix;
3056
3057 if ($actionSuffix !== '' && $actionSuffix[0] === '&') {
3058 $actionUrl = $this->get_report_action_url() . $actionSuffix;
3059 }
3060
3061 $selectOptions .= $this->get_tpl('dbx|report-footer-action-option', array(
3062 'value' => (string) $dbx_do,
3063 'label' => $label,
3064 ));
3065
3066 $actionLink = trim($this->get_tpl((string) ($action['tpl'] ?? 'dbx|action_button'), array(
3067 'action' => $actionUrl,
3068 'label' => $label,
3069 'title' => 'Aktion bestaetigen',
3070 'confirm' => (string) ($action['confirm'] ?? ''),
3071 'class' => '',
3072 'tooltip' => '',
3073 )));
3074
3075 if ($actionLink !== '') {
3076 $actionLinks .= $this->get_tpl('dbx|report-footer-action-link', array(
3077 'value' => (string) $dbx_do,
3078 'action_link' => $actionLink,
3079 ));
3080 }
3081 }
3082
3083 if (!$hasSelect) {
3084 return;
3085 }
3086
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,
3092 ));
3093
3094 $html = trim($this->get_tpl('dbx|report-footer', array(
3095 'report_action_main' => $actionMain,
3096 )));
3097
3098 if ($html !== '') {
3099 $this->add_obj('report_footer', 'obj-value', $html);
3100 }
3101 }
3102
3110 protected function injectReportFooter($content) {
3111 if (!isset($this->_obj['report_footer'])) {
3112 return (string) $content;
3113 }
3114
3115 if (strpos($content, '{obj:report_footer}') !== false) {
3116 return (string) $content;
3117 }
3118
3119 if (stripos($content, '<tfoot') !== false) {
3120 return (string) $content;
3121 }
3122
3123 return (string) preg_replace(
3124 '/<\/tbody>\s*<\/table>/i',
3125 '</tbody>{obj:report_footer}</table>',
3126 (string) $content,
3127 1
3128 );
3129 }
3130
3131 public function apply_tabulurator_request() {
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');
3136
3137 if ($size > 0) {
3138 $this->_rrows = $size;
3139 } elseif ($limit > 0) {
3140 $this->_rrows = $limit;
3141 }
3142
3143 if ($offset >= 0) {
3144 $this->_rpos = $offset;
3145 } elseif ($page > 0 && $this->_rrows > 0) {
3146 $this->_rpos = (($page - 1) * $this->_rrows);
3147 }
3148 }
3149
3150 public function get_report_rows_array(): array {
3151 $rows = array();
3152
3153 if (!is_array($this->_rdata)) {
3154 return $rows;
3155 }
3156
3157 foreach ($this->_rdata as $record) {
3158 $this->_record = $record;
3159 $dummy = '';
3160 $this->run_body($dummy);
3161 $record = $this->_record;
3162
3163 if (!is_array($record)) {
3164 $record = array();
3165 }
3166
3167 $row = array();
3168
3169 foreach ($record as $field => $value) {
3170 if (is_array($value)) {
3171 $row[$field] = $value;
3172 } else {
3173 $row[$field] = $this->rpt_format($field, $value);
3174 }
3175 }
3176
3177 $rows[] = $row;
3178 }
3179
3180 return $rows;
3181 }
3182
3183 public function fast_response_rows_json() {
3184 $rows = $this->get_report_rows_array();
3185 $count = (int) $this->_rcount;
3186 $rrows = (int) $this->_rrows;
3187 $rpos = (int) $this->_rpos;
3188 $pages = 0;
3189 $page = 1;
3190
3191 if ($rrows > 0) {
3192 $pages = (int) ceil($count / $rrows);
3193 $page = (int) floor($rpos / $rrows) + 1;
3194 }
3195
3196 header('Content-Type: application/json; charset=utf-8');
3197
3198 echo json_encode(array(
3199 'ok' => 1,
3200 'count' => $count,
3201 'rows' => array_values($rows),
3202 'rpos' => $rpos,
3203 'rrows' => $rrows,
3204 'page' => $page,
3205 'pages' => $pages,
3206 ), JSON_UNESCAPED_UNICODE);
3207
3208 exit;
3209 }
3210
3211 public function create_selection_fields($fd = 'fd::') {
3212 dbx()->debug('create_selection_fields');
3213 $source = $fd;
3214
3215 if ($source === 'fd::') {
3216 $source = $this->_fd;
3217 } elseif ($source) {
3218 $this->_fd = $source;
3219 }
3220
3221 if (!$source) {
3222 return;
3223 }
3224
3225 $before = array_keys($this->_flds);
3226 $this->add_flds($source);
3227 $added = array_diff(array_keys($this->_flds), $before);
3228
3229 foreach ($this->_report_state_flds as $key => $state) {
3230 if (!array_key_exists($key, $this->_data)) {
3231 $this->_data[$key] = $state['default'] ?? '';
3232 }
3233 }
3234
3235 foreach ($added as $key) {
3236 if (!array_key_exists($key, $this->_data)) {
3237 $this->_data[$key] = $this->get_dd($source, $key, 'default');
3238 }
3239 }
3240 }
3241
3242
3243
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', '*');
3247 $this->forward_init($fid, $tpl);
3248 $this->set_callback_id($fid);
3249 //$this->create_selection_fields();
3250
3251 $modul = $this->_dbx_modul ;
3252 $modul_key = $modul . '-rpt-' . $this->_fid;
3253
3254
3255 if ($first_page_lines <= 0) $first_page_lines = 999999;
3256 if ($next_page_lines <= 0) $next_page_lines = 999999;
3257
3258 if ($current_line <= 0) $current_line = 0;
3259
3260 $current_page_line = 0;
3261 $current_page = 0;
3262
3263 if ($current_line >= 0) {
3264 if ($current_line < $first_page_lines) {
3265 $current_page = 1;
3266 $current_page_line = $current_line;
3267 } else {
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);
3271 }
3272
3273 $current_page--;
3274 }
3275
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;
3281
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 = '';
3289
3290 dbx()->set_remember_var('last_report_i', $this->_next_i, $modul_key);
3291
3292 $this->set_form_selects();
3293 $this->_multi_select_work = '';
3294 }
3295
3306 public function run() {
3307 $content = '';
3308 $norep = '';
3309 $i = $this->_next_i;
3310 $fid = $this->_fid;
3311 $tpl = $this->_tpl;
3312
3313 $pages = $this->_pages;
3314 $mode = $this->_mode;
3315 $flds = $this->_rflds;
3316
3317 if (!is_array($flds)) $flds = array();
3318
3319 $this->_dbx_modul= dbx()->get_system_var('dbx_activ_modul', 'dbx', '*');
3320 $this->_auto_flds = $flds;
3321 $this->_auto_mode = $mode;
3322 //$count = $this->_rcount;
3323
3324 if ($this->_dd) {
3325 $oDB = dbx()->get_system_obj('dbxDB');
3326 if (method_exists($oDB, 'get_dd_file')) {
3327 $this->add_editor_file('dd', $oDB->get_dd_file($this->_dd));
3328 }
3329 }
3330
3331 $this->buildModuleBarObj();
3332 $this->buildGridBarObj();
3333 $this->buildReportFooterObj();
3334 $this->prepareReportFrameReplaces((int)$i);
3335
3336 $replaces = $this->_replaces;
3337
3338 if ($mode == 'tabulurator') {
3339 $replaces = array_merge($replaces, $this->get_grid_replaces());
3340 }
3341
3342 foreach (array(
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;
3353 }
3354 }
3355
3356 if (strpos($tpl, '|') === false) {
3357 $tpl = $this->_dbx_modul . '|' . $tpl;
3358 }
3359
3360 $report_tpl = $this->get_tpl($tpl, $replaces, 'htm', $i);
3361 $report_tpl = $this->merge_tpl_data($report_tpl, $i);
3362 $report_tpl = $this->injectReportFooter($report_tpl);
3363 $report_tpl = $this->merge_fld_data($report_tpl, $i);
3364 $report_tpl = $this->merge_obj($report_tpl, $i);
3365 $report_tpl = $this->merge_db_placeholders($report_tpl);
3366 $report_tpl = $this->cleanupReportBarSlots($report_tpl);
3367 $report_tpl = $this->applyReportCountReplaces($report_tpl);
3368
3369 if ($mode == 'tabulurator') {
3370 $content = $report_tpl;
3371
3372 if ($fid != 'pagination') {
3373 $this->store_sysdata();
3374 }
3375
3376 $content = str_replace('{i}', $i, $content);
3377
3378 $msg_tpl = $this->buildReportFormMsgHtml();
3379 $content = str_replace('{obj:form_msg}', $msg_tpl, $content);
3380
3381 if ($pages) {
3382 $ReportPages = $this->get_report_pages();
3383 $content = str_replace('[dbx:pagination]', $ReportPages, $content);
3384 } else {
3385 $content = str_replace('[dbx:pagination]', '', $content);
3386 }
3387 $content = str_replace('{rpt:pages}', (string) $this->_current_page, $content);
3388
3389 $norep_ids = '';
3390 $js = $this->_js;
3391
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);
3396 }
3397 }
3398
3399 if ($norep_ids) {
3400 $norep = '<div class="norep">' . $norep_ids . '</div>';
3401 }
3402
3403 $content = str_replace('[dbx:js]', $norep, $content);
3404 $content = $this->ensure_report_select_feature($content);
3405
3406 return $this->add_editor_markers($content);
3407 }
3408
3409 $this->split_tpl($report_tpl);
3410
3411 $haeder = $this->get_report_haeder();
3412 $body = $this->get_report_body();
3413 $footer = $this->get_report_footer();
3414
3415 $content = $haeder . $body . $footer;
3416
3417 if ($fid != 'pagination') {
3418 $this->store_sysdata();
3419 }
3420
3421 if ($fid != 'pagination') {
3422 if ($pages) {
3423 $ReportPages = $this->get_report_pages();
3424 $content = str_replace('[dbx:pagination]', $ReportPages, $content);
3425 }
3426
3427 $haeder_report = $this->_haeder_report;
3428 $haeder_page = $this->_haeder_page;
3429 $footer_page = $this->_footer_page;
3430 $footer_report = $this->_footer_report;
3431
3432 $content = str_replace('{i}', $i, $content);
3433
3434 $msg_tpl = $this->buildReportFormMsgHtml();
3435 $content = str_replace('{obj:form_msg}', $msg_tpl, $content);
3436
3437 $haeder_report = $this->run_report_haeder($haeder_report);
3438 $haeder_page = $this->run_page_haeder($haeder_page);
3439 $footer_page = $this->run_page_footer($footer_page);
3440 $footer_report = $this->run_report_footer($footer_report);
3441
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);
3446 }
3447
3448 $norep_ids = '';
3449 $js = $this->_js;
3450
3451 if (is_array($js)) {
3452 $count = count($js);
3453
3454 if ($count) {
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);
3458 }
3459 }
3460 }
3461
3462 $content = str_replace('{i}', $i, $content);
3463
3464 if ($norep_ids) {
3465 $norep = '<div class="norep">' . $norep_ids . '</div>';
3466 }
3467
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);
3471 $content = $this->ensure_report_select_feature($content);
3472
3473 return $this->add_editor_markers($content);
3474 }
3475}
3476
3477?>
$table['server']
Definition .dd.php:6
get_activ_id($key='')
Liefert die aktive Remember-ID des aktuellen DD-Kontexts.
$_dbx_action
Aktive DBX-Aktion.
$_fld_id
Primärschlüsselfeld.
$_action
Formular-Action.
$_dbx_modul
Aktives Modul.
php_date_usr($value)
Wandelt Datumswerte in deutsches Format um.
add_editor_markers(string $content)
Fuegt passende Editor-Marker um den gerenderten Formularinhalt.
store_sysdata()
Speichert Sysdata des Formulars.
merge_fld_data($content, $i=0)
Fügt Felder in den Template-Inhalt ein.
$_dbx_work
Optionaler Work-Kontext.
merge_tpl_data($tpl, $i=0)
Führt grundlegende Form-Replaces in Templates aus.
get_tpl($tpl, $data='', $type='htm', $i=0)
Wrapper auf dbxTPL->get_tpl().
get_form_msg($mode, $msg='')
Gibt die Formular-Infobox zurück.
forward_init($fid, $tpl='')
Initialisiert den Form-Kontext.
$oDB
Zentraler DB-/DD-Service.
add_obj($obj, $tpl, $data='', $data2='')
Fügt ein {obj:*}-Objekt hinzu.
merge_obj($content, $i=0)
Ersetzt {obj:*}-Platzhalter.
add_editor_file(string $kind, string $file)
Registriert eine genutzte FD-/DD-/Class-Datei fuer Editor-Marker.
_forward_clear()
Setzt den internen Formularzustand zurück.
get_dd(string $dd, string $fld, string $var)
Liest einen Feldwert oder das ganze Feld aus einer DD-/FD-Quelle.
php_datetime_usr($value)
Wandelt Datums-/Zeitwerte in deutsches Format um.
errors()
Gibt die Anzahl der Fehler zurück.
add_rep($key, $val)
Fügt einen allgemeinen Replace-Wert hinzu.
add_flds($dd='fd::')
Fügt alle Felder der aktiven DD-/FD-Felddefinitionsquelle hinzu.
set_callback_id(string $id)
Setzt den Namenspraefix fuer konventionelle Callback-Methoden.
Definition dbxKernel.php:96
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.
run_footer($content)
$_rpt_format
Feldformatierungen.
$_pages
Pagination aktiv.
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.
split_tpl($report)
$_footer_next_page
Footer für Folgeseiten.
$_current_report_ln
Aktuelle Report-Zeile insgesamt.
$_rflds
Report-Feldliste.
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.
$_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)
get_class_tr($record)
$_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.
run_haeder($content)
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.
run_body($content)
$_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='')
$_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)
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)
$_rdata
Report-Daten.
$_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)
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.
$field
Definition config.dd.php:4
exit
Definition index.php:532
if( $syncRequest)
Definition index.php:520
$response
Definition index.php:518
DBX schema administration.
if(! $db->connect_db_server($server)) $result