dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
dbxDBexport.class.php
Go to the documentation of this file.
1<?php
2
3require_once 'dbxForm.class.php';
4
118class dbxReport extends dbxForm {
119
121 public $_ajax = 0;
122
124 public $_mode = 'table';
125
127 public $_current_page = 0;
128
131
134
136 public $_first_page_lines = 9999;
137
139 public $_next_page_lines = 9999;
140
142 public $_fld_haeder = '';
143
145 public $_haeder_report = '';
146
148 public $_footer_report = '';
149
151 public $_haeder_page = '';
152
154 public $_footer_page = '';
155
158
161
163 public $_page_break = '<div class="page-break printMe"> </div><br>';
164
166 public $_haeder = '';
167
169 public $_body = '';
170
172 public $_footer = '';
173
175 public $_record = array();
176
178 public $_rdata = array();
179
181 public $_rdata_inline = false;
182
184 public $_body_inline = '';
185
187 public $_rcount = 0;
188
190 public $_rpos = 0;
191
193 public $_rrows = 20;
194
196 public $_rwhere_placeholder = '#search_for#';
197
199 public $_pages = 0;
200
202 public $_pagelink = '';
203
205 public $_auto_flds = '';
206
208 public $_auto_mode = '';
209
211 public $_rflds = '';
212
214 public $_tpl_pagination = 'dbx|pagination';
215
218
220 public $_add_action = '';
221
224
227
230
233
236
239
242
245
248
251
254
256 public $_rpt_format = array();
257
259 public $_options_rsort = array();
260
262 public $_options_rrows = array();
263
265 public $_options_rdesc = array();
266
268 public $_options_rselect = array();
269
271 public $_tabel_tpls = array();
272
275
278
281
283 public $_table_buttons = 'left';
284
294 public $_data_table = 0;
295
297 public $_scroll_table = 0;
298
300 public $_class_haeder = array();
301
303 public $_style_haeder = array();
304
306 public $_class_body = array();
307
309 public $_count_selects = -1;
310
312 public $_msg_confirm_delete = 'Datensatz löschen ?';
313
315 public $_msg_confirm_copy = 'Datensatz kopieren ?';
316
317 /* =====================================================
318 * GRID / TABULURATOR SUPPORT
319 * ===================================================== */
320
322 public $_grid_read_url = '';
323
325 public $_grid_save_url = '';
326
328 public $_grid_delete_url = '';
329
331 public $_grid_insert_url = '';
332
334 public $_grid_sort_url = '';
335
337 public $_grid_sync_url = '';
338
340 public $_grid_print_url = '';
341
343 public $_grid_export_url = '';
344
346 public $_grid_schema = '';
347
349 public $_grid_id = '';
350
352 public $_grid_cols = '';
353
355 public $_grid_layout = 'fitColumns';
356
359
362
365
368
371
373 public $_grid_synctime = '2';
374
380 public function clear() {
381 $this->_forward_clear();
382
383 $this->_rpt_format = array();
384 $this->_options_rsort = array();
385 $this->_options_rrows = array();
386 $this->_options_rdesc = array();
387 $this->_options_rselect = array();
388
389 $this->_style_haeder = array();
390 $this->_class_haeder = array();
391 $this->_class_body = array();
392
393 $this->_record = array();
394 $this->_rdata = array();
395
396 $this->_haeder = '';
397 $this->_body = '';
398 $this->_footer = '';
399
400 $this->_haeder_report = '';
401 $this->_footer_report = '';
402 $this->_haeder_page = '';
403 $this->_footer_page = '';
404 $this->_haeder_next_page = '';
405 $this->_footer_next_page = '';
406
407 $this->_table_col_count = 0;
408 $this->_count_selects = -1;
409 $this->_multi_select_work = '';
410
411 $this->_grid_read_url = '';
412 $this->_grid_save_url = '';
413 $this->_grid_delete_url = '';
414 $this->_grid_insert_url = '';
415 $this->_grid_sort_url = '';
416 $this->_grid_sync_url = '';
417 $this->_grid_print_url = '';
418 $this->_grid_export_url = '';
419 $this->_grid_schema = '';
420 $this->_grid_id = '';
421 $this->_grid_cols = '';
422 $this->_grid_layout = 'fitColumns';
423 $this->_grid_headerfilter = 1;
424 $this->_grid_headersort = 1;
425 $this->_grid_allow_delete = 1;
426 $this->_grid_allow_edit = 1;
427 $this->_grid_allow_insert = 1;
428 $this->_grid_synctime = '2';
429
430 $table = array();
431
432 $table['tpl_haeder_col'] = 'table_haeder_col';
433 $table['tpl_haeder_select'] = 'table_haeder_select';
434 $table['tpl_haeder_delte'] = 'table_haeder_delete';
435 $table['tpl_haeder_expand'] = 'table_haeder_expand';
436 $table['tpl_haeder_expander'] = 'table_haeder_expander';
437 $table['tpl_haeder_edit'] = 'table_haeder_edit';
438 $table['tpl_haeder_copy'] = 'table_haeder_copy';
439 $table['tpl_haeder_undo'] = 'table_haeder_undo';
440 $table['tpl_haeder_show'] = 'table_haeder_show';
441 $table['tpl_haeder_import'] = 'table_haeder_import';
442 $table['tpl_haeder_export'] = 'table_haeder_export';
443 $table['tpl_haeder_download'] = 'table_haeder_download';
444 $table['tpl_haeder_print'] = 'table_haeder_print';
445
446 $table['tpl_row_col'] = 'table_row_col';
447 $table['tpl_row_select'] = 'table_row_select';
448 $table['tpl_row_expand'] = 'table_row_expand';
449 $table['tpl_row_expander'] = 'table_row_expander';
450 $table['tpl_row_edit'] = 'table_row_edit';
451 $table['tpl_row_copy'] = 'table_row_copy';
452 $table['tpl_row_delete'] = 'table_row_delete';
453 $table['tpl_row_save'] = 'table_row_save';
454 $table['tpl_row_undo'] = 'table_row_undo';
455 $table['tpl_row_show'] = 'table_row_show';
456 $table['tpl_row_export'] = 'table_row_export';
457 $table['tpl_row_import'] = 'table_row_import';
458 $table['tpl_row_download'] = 'table_row_download';
459 $table['tpl_row_print'] = 'table_row_print';
460
461 if ($this->_multi_page_select) {
462 $table['tpl_haeder_select'] = 'table_haeder_select-multi';
463 $table['tpl_row_select'] = 'table_row_select-multi';
464 }
465
466 $this->_tabel_tpls = $table;
467 }
468
477 public function set_tabel_tpl($tid, $tpl) {
478 $this->_tabel_tpls[$tid] = $tpl;
479 }
480
490 protected function get_report_action_url() {
491 if ($this->_action) {
492 return $this->_action;
493 }
494
495 $modul = $this->_dbx_modul;
496 $run1 = $this->_dbx_action;
497 $run2 = $this->_dbx_work;
498
499 if (!$run1) {
500 $run1 = dbx()->get_modul_var('dbx_run1', 0);
501 }
502
503 if (!$run2) {
504 $run2 = dbx()->get_modul_var('dbx_run2', 0);
505 }
506
507 $url = '?dbx_modul=' . $modul;
508
509 if ($run1) {
510 $url .= '&dbx_run1=' . $run1;
511 }
512
513 if ($run2) {
514 $url .= '&dbx_run2=' . $run2;
515 }
516
517 return $url;
518 }
519
527 protected function normalize_multi_select_key($rid) {
528 if ($rid === null) {
529 return '';
530 }
531
532 $rid = trim((string) $rid);
533
534 if ($rid === '') {
535 return '';
536 }
537
538 return $rid;
539 }
540
556 protected function get_record_rid($record, $default = -1) {
557 if (!is_array($record)) {
558 return $default;
559 }
560
561 if ($this->_fld_id && array_key_exists($this->_fld_id, $record)) {
562 return $record[$this->_fld_id];
563 }
564
565 if (array_key_exists('rid', $record)) {
566 return $record['rid'];
567 }
568
569 if (array_key_exists('id', $record)) {
570 return $record['id'];
571 }
572
573 if (array_key_exists('recnum', $record)) {
574 return $record['recnum'];
575 }
576
577 return $default;
578 }
579
587 protected function get_record_select_key($record) {
588 $rid = $this->get_record_rid($record, '');
589
590 return $this->normalize_multi_select_key($rid);
591 }
592
606 protected function parse_multi_select_ids($raw) {
607 $ids = array();
608
609 if (is_array($raw)) {
610 foreach ($raw as $value) {
611 $key = $this->normalize_multi_select_key($value);
612
613 if ($key !== '') {
614 $ids[$key] = 1;
615 }
616 }
617
618 return array_keys($ids);
619 }
620
621 $raw = trim((string) $raw);
622
623 if ($raw === '') {
624 return array();
625 }
626
627 $parts = preg_split('/[|,\s;]+/', $raw);
628
629 if (!is_array($parts)) {
630 return array();
631 }
632
633 foreach ($parts as $value) {
634 $key = $this->normalize_multi_select_key($value);
635
636 if ($key !== '') {
637 $ids[$key] = 1;
638 }
639 }
640
641 return array_keys($ids);
642 }
643
651 public function set_multi_select_ids(array $ids) {
652 $selects = $this->get_multi_selects();
653
654 foreach ($ids as $rid) {
655 $key = $this->normalize_multi_select_key($rid);
656
657 if ($key !== '') {
658 $selects[$key] = 1;
659 }
660 }
661
662 $this->set_multi_selects($selects);
663 }
664
672 public function del_multi_select_ids(array $ids) {
673 $selects = $this->get_multi_selects();
674
675 foreach ($ids as $rid) {
676 $key = $this->normalize_multi_select_key($rid);
677
678 if ($key !== '' && isset($selects[$key])) {
679 unset($selects[$key]);
680 }
681 }
682
683 $this->set_multi_selects($selects);
684 }
685
692 $ids = array();
693
694 if (!is_array($this->_rdata)) {
695 return array();
696 }
697
698 foreach ($this->_rdata as $record) {
699 $key = $this->get_record_select_key($record);
700
701 if ($key !== '') {
702 $ids[$key] = 1;
703 }
704 }
705
706 return array_keys($ids);
707 }
708
716 public function get_visible_multi_select_state(array $visibleIds = array()) {
717 if (!$visibleIds) {
718 $visibleIds = $this->get_visible_multi_select_ids();
719 }
720
721 $selects = $this->get_multi_selects();
722 $selectedVisible = array();
723
724 foreach ($visibleIds as $rid) {
725 $key = $this->normalize_multi_select_key($rid);
726
727 if ($key !== '' && isset($selects[$key])) {
728 $selectedVisible[] = $key;
729 }
730 }
731
732 $visibleCount = count($visibleIds);
733 $selectedCount = count($selectedVisible);
734 $headerState = 'none';
735
736 if ($visibleCount > 0 && $selectedCount === $visibleCount) {
737 $headerState = 'all';
738 } elseif ($selectedCount > 0) {
739 $headerState = 'partial';
740 }
741
742 return array(
743 'visible_ids' => array_values($visibleIds),
744 'selected_ids_visible' => array_values($selectedVisible),
745 'visible_count' => $visibleCount,
746 'selected_count' => $selectedCount,
747 'header_state' => $headerState,
748 'header_checked' => ($headerState === 'all') ? 1 : 0,
749 );
750 }
751
760 protected function send_multi_select_json_response(array $visibleIds = array(), $dbx_do = '') {
761 $state = $this->get_visible_multi_select_state($visibleIds);
762
763 $response = array(
764 'ok' => 1,
765 'dbx_do' => $dbx_do,
766 'count_selects' => $this->get_count_selects(),
767 'visible_ids' => $state['visible_ids'],
768 'selected_ids_visible' => $state['selected_ids_visible'],
769 'visible_count' => $state['visible_count'],
770 'visible_selected_count' => $state['selected_count'],
771 'header_state' => $state['header_state'],
772 );
773
774 header('Content-Type: application/json; charset=utf-8');
775 echo json_encode($response, JSON_UNESCAPED_UNICODE);
776 exit;
777 }
778
786 protected function get_report_remember_key(string $suffix): string {
787 $modul = $this->_dbx_modul ?: 'dbx';
788 $fid = $this->_fid ?: 'report';
789
790 return 'dbx.report.' . $modul . '.' . $fid . '.' . $suffix;
791 }
792
802 public function get_sys($name, $default = '', $validate = 'parameter') {
803 if (isset($this->_data[$name])) {
804 $default = $this->_data[$name];
805 }
806
807 if (isset($this->_sys[$name])) {
808 $default = $this->_sys[$name];
809 }
810
811 $value = dbx()->get_request_var($name, $default, $validate);
812
813 return $value;
814 }
815
823 public function check_is_multiselect($rid) {
824 $checked = '';
825 $key = $this->normalize_multi_select_key($rid);
826 $selects = $this->get_multi_selects();
827
828 if ($key !== '' && isset($selects[$key])) {
829 $checked = 'checked="checked"';
830 }
831
832 return $checked;
833 }
834
842 public function set_multi_select($rid) {
843 $selects = $this->get_multi_selects();
844
845 if ($rid == '*') {
846 foreach ($this->_rdata as $record) {
847 $key = $this->get_record_select_key($record);
848
849 if ($key !== '') {
850 $selects[$key] = 1;
851 }
852 }
853 } else {
854 $key = $this->normalize_multi_select_key($rid);
855
856 if ($key !== '') {
857 $selects[$key] = 1;
858 }
859 }
860
861 $this->set_multi_selects($selects);
862 }
863
871 public function del_multi_select($rid) {
872 $selects = $this->get_multi_selects();
873
874 if ($rid != '*') {
875 $key = $this->normalize_multi_select_key($rid);
876
877 if ($key !== '' && isset($selects[$key])) {
878 unset($selects[$key]);
879 }
880 } else {
881 $selects = array();
882 }
883
884 $this->set_multi_selects($selects);
885 }
886
894 public function set_multi_selects($selects) {
895 $normalized = array();
896
897 if (is_array($selects)) {
898 foreach ($selects as $rid => $value) {
899 $key = $this->normalize_multi_select_key($rid);
900
901 if ($key !== '') {
902 $normalized[$key] = 1;
903 }
904 }
905 }
906
907 $key = $this->get_report_remember_key('multi_select');
908 dbx()->set_remember_var($key, $normalized, 'dbx');
909 $this->_count_selects = -1;
910 }
911
919 public function del_multi_selects($id) {
920 if ($id == '*') {
921 $this->set_multi_selects(array());
922 return;
923 }
924
925 $ids = $this->get_multi_selects();
926 $key = $this->normalize_multi_select_key($id);
927
928 if ($key !== '' && isset($ids[$key])) {
929 unset($ids[$key]);
930 }
931
932 $this->set_multi_selects($ids);
933 }
934
940 public function get_multi_selects(): array {
941 $key = $this->get_report_remember_key('multi_select');
942 $selects = dbx()->get_remember_var($key, array(), 'dbx');
943
944 if (!is_array($selects)) {
945 $selects = array();
946 }
947
948 $normalized = array();
949
950 foreach ($selects as $rid => $value) {
951 $key = $this->normalize_multi_select_key($rid);
952
953 if ($key !== '') {
954 $normalized[$key] = 1;
955 }
956 }
957
958 return $normalized;
959 }
960
966 public function get_count_selects() {
967 $count = $this->_count_selects;
968
969 if ($count == -1) {
970 $selects = $this->get_multi_selects();
971 $count = is_array($selects) ? count($selects) : 0;
972 $this->_count_selects = $count;
973 }
974
975 return $count;
976 }
977
986 public function del_selected($dd, $rid = 0) {
987 $ok = 0;
988 $err = 0;
989 dbx()->set_modul_var('dbx_no_reset', 1);
990 $db = dbx()->get_system_obj('dbxDB');
991
992 if ($rid == '*') {
993 $selected = $this->get_multi_selects();
994
995 foreach ($selected as $id => $sel) {
996 $ok = $db->delete($dd, $id);
997
998 if (!$ok) {
999 $err++;
1000 }
1001
1002 $this->del_multi_select($id);
1003 }
1004
1005 if ($err) {
1006 $ok = ($err * -1);
1007 }
1008 } else {
1009 if ($rid) {
1010 $ok = $db->delete($dd, $rid);
1011 $this->del_multi_select($rid);
1012 }
1013 }
1014
1015 return $ok;
1016 }
1017
1025 public function add_rwhere_select($rwhere) {
1026 $selects = $this->get_multi_selects();
1027 $fld_id = $this->_fld_id ? $this->_fld_id : 'id';
1028
1029 if (!is_array($selects) || !count($selects)) {
1030 if ($rwhere > '') {
1031 $rwhere .= ' and (1=0)';
1032 }
1033
1034 if ($rwhere == '') {
1035 $rwhere .= '1=0';
1036 }
1037
1038 return $rwhere;
1039 }
1040
1041 $values = array();
1042
1043 foreach ($selects as $id => $sel) {
1044 $key = $this->normalize_multi_select_key($id);
1045
1046 if ($key === '') {
1047 continue;
1048 }
1049
1050 if (preg_match('/^-?\d+$/', $key)) {
1051 $values[] = (string) ((int) $key);
1052 } else {
1053 $values[] = "'" . addslashes($key) . "'";
1054 }
1055 }
1056
1057 if (!count($values)) {
1058 if ($rwhere > '') {
1059 $rwhere .= ' and (1=0)';
1060 }
1061
1062 if ($rwhere == '') {
1063 $rwhere .= '1=0';
1064 }
1065
1066 return $rwhere;
1067 }
1068
1069 $selectWhere = $fld_id . ' IN (' . implode(',', $values) . ')';
1070
1071 if ($rwhere > '') {
1072 $rwhere .= ' and (' . $selectWhere . ')';
1073 } else {
1074 $rwhere = $selectWhere;
1075 }
1076
1077 return $rwhere;
1078 }
1079
1089 public function add_rwhere_search($sql, $suchWert, $feldListe) {
1090 if ($suchWert === null) {
1091 $suchWert = '';
1092 }
1093
1094 $suchWert = str_replace(array('\'', '"', '\\', '%'), '', $suchWert);
1095 $suchWert = filter_var($suchWert, FILTER_SANITIZE_SPECIAL_CHARS);
1096
1097 $datum = DateTime::createFromFormat('d.m.Y', $suchWert);
1098
1099 if ($datum && $datum->format('d.m.Y') === $suchWert) {
1100 $suchWert = $datum->format('Y-m-d');
1101 }
1102
1103 $felder = explode(',', $feldListe);
1104 $sql .= ' AND (';
1105 $bedingungen = array();
1106
1107 foreach ($felder as $feld) {
1108 $feld = trim($feld);
1109
1110 if ($feld === '') {
1111 continue;
1112 }
1113
1114 $bedingungen[] = "$feld LIKE '$suchWert%'";
1115 }
1116
1117 $sql .= implode(' OR ', $bedingungen);
1118 $sql .= ')';
1119
1120 return $sql;
1121 }
1122
1139 public function set_form_selects() {
1140 $dbx_do = dbx()->get_request_var('dbx_do', '', 'parameter');
1141 $dbx_mode = dbx()->get_request_var('dbx_mode', '', 'parameter');
1142 $checked = dbx()->get_request_var('dbx_checked', '', 'parameter');
1143 $value = dbx()->get_request_var('dbx_value', 0, 'parameter+.');
1144 $ajax = dbx()->get_request_var('dbx_ajax', 0, 'int');
1145 $nor = dbx()->get_modul_var('dbx_no_reset', 0, 'int');
1146
1147 if ($dbx_do === '' && $dbx_mode !== '') {
1148 $dbx_do = $dbx_mode;
1149 }
1150
1151 if ($dbx_do === 'row_select') {
1152 $state = dbx()->get_request_var('dbx_select_state', 0, 'int');
1153 $rid = dbx()->get_request_var('rid', '', 'parameter+.');
1154 $selectId = dbx()->get_request_var('dbx_select_id', '', 'parameter+.');
1155 $visibleIds = dbx()->get_request_var('dbx_select_visible_ids', '', '*');
1156
1157 if ($selectId !== '') {
1158 $rid = $selectId;
1159 }
1160
1161 $rid = $this->normalize_multi_select_key($rid);
1162
1163 if ($rid !== '') {
1164 if ($state) {
1165 $this->set_multi_select($rid);
1166 } else {
1167 $this->del_multi_select($rid);
1168 }
1169 }
1170
1171 if ($ajax) {
1173 $this->parse_multi_select_ids($visibleIds),
1174 $dbx_do
1175 );
1176 }
1177
1178 return 'handled';
1179 }
1180
1181 if ($dbx_do === 'rows_select') {
1182 $state = dbx()->get_request_var('dbx_select_state', 0, 'int');
1183 $idsRaw = dbx()->get_request_var('dbx_select_ids', '', '*');
1184 $visibleRaw = dbx()->get_request_var('dbx_select_visible_ids', '', '*');
1185 $ids = $this->parse_multi_select_ids($idsRaw);
1186 $visibleIds = $this->parse_multi_select_ids($visibleRaw);
1187
1188 if (!$visibleIds) {
1189 $visibleIds = $ids;
1190 }
1191
1192 if ($state) {
1193 $this->set_multi_select_ids($ids);
1194 } else {
1195 $this->del_multi_select_ids($ids);
1196 }
1197
1198 if ($ajax) {
1199 $this->send_multi_select_json_response($visibleIds, $dbx_do);
1200 }
1201
1202 return 'handled';
1203 }
1204
1205 if ($dbx_do === 'clear_selects') {
1206 $this->set_multi_selects(array());
1207
1208 if ($ajax) {
1209 $this->send_multi_select_json_response(array(), $dbx_do);
1210 }
1211
1212 return 'handled';
1213 }
1214
1215 if (!$nor) {
1216 if ($dbx_mode == 'reset_form_select') {
1217 $this->set_multi_selects(array());
1218 return 'count_response';
1219 }
1220
1221 if ($dbx_mode == 'save_form_select' && $value && $ajax) {
1222 $selects = $this->get_multi_selects();
1223 $value = $this->normalize_multi_select_key($value);
1224
1225 if ($value !== '') {
1226 if (!$checked || $checked == 'false') {
1227 if (isset($selects[$value])) {
1228 unset($selects[$value]);
1229 }
1230 } else {
1231 $selects[$value] = 1;
1232 }
1233
1234 $this->set_multi_selects($selects);
1235 }
1236
1237 return 'count_response';
1238 }
1239 } else {
1240 if ($checked) {
1241 return 'add';
1242 }
1243
1244 if (!$checked || $checked == 'false') {
1245 return 'rem';
1246 }
1247 }
1248
1249 return 0;
1250 }
1251
1260 public function rpt_format($key, $value) {
1261 $format = $this->_rpt_format;
1262
1263 if (is_array($format)) {
1264 if (isset($format[$key])) {
1265 $reform = $format[$key];
1266
1267 if ($reform == 'php-date-usr') {
1268 $value = $this->php_date_usr($value);
1269 }
1270
1271 if ($reform == 'php-datetime-usr') {
1272 $value = $this->php_datetime_usr($value);
1273 }
1274
1275 if ($reform == 'html-chars') {
1276 $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
1277 }
1278 }
1279 } else {
1280 if ($value === null) {
1281 $value = '';
1282 }
1283
1284 if ($format == 'html-chars' && $value) {
1285 $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
1286 }
1287 }
1288
1289 if ($value === null) {
1290 $value = '';
1291 }
1292
1293 return $value;
1294 }
1295
1303 public function rpt_merge_obj($content) {
1304 $count_select = $this->get_count_selects();
1305 $count_cols = $this->_table_col_count;
1306 $page = $this->_current_page;
1307 $page_break = $this->_page_break;
1308
1309 $content = str_replace('{rpt:count_sel}', $count_select, $content);
1310 $content = str_replace('{rpt:col_count}', $count_cols, $content);
1311 $content = str_replace('{rpt:page}', $page, $content);
1312 $content = str_replace('{rpt:pagebrak}', $page_break, $content);
1313
1314 if (is_array($this->_obj)) {
1315 foreach ($this->_obj as $key => $value) {
1316 $xkey = '{obj:' . $key . '}';
1317
1318 if ($value === null) {
1319 $value = '';
1320 }
1321
1322 $content = str_replace($xkey, $value, $content);
1323 }
1324 }
1325
1326 return $content;
1327 }
1328
1329 public function forward_run_report_haeder($content) {
1330 return $this->rpt_merge_obj($content);
1331 }
1332
1333 public function forward_run_page_haeder($content) {
1334 return $this->rpt_merge_obj($content);
1335 }
1336
1337 public function forward_run_page_footer($content) {
1338 return $this->rpt_merge_obj($content);
1339 }
1340
1341 public function run_report_haeder($content) {
1342 return $this->forward_run_report_haeder($content);
1343 }
1344
1345 public function run_page_haeder($content) {
1346 return $this->forward_run_page_haeder($content);
1347 }
1348
1349 public function run_page_footer($content) {
1350 return $this->forward_run_page_footer($content);
1351 }
1352
1353 public function forward_run_report_footer($content) {
1354 return $this->rpt_merge_obj($content);
1355 }
1356
1357 public function run_report_footer($content) {
1358 return $this->forward_run_report_footer($content);
1359 }
1360
1361 public function run_haeder($content) {
1362 return $this->forward_run_haeder($content);
1363 }
1364
1365 public function run_body($content) {
1366 return $this->forward_run_body($content);
1367 }
1368
1369 public function run_footer($content) {
1370 return $this->forward_run_footer($content);
1371 }
1372
1373 public function forward_run_haeder($content) {
1374 return $this->rpt_merge_obj($content);
1375 }
1376
1377 public function forward_get_footer_page() {
1378 $footer = $this->_footer_next_page;
1379 $footer .= $this->_footer_page;
1380 $footer = $this->rpt_merge_obj($footer);
1381
1382 return $footer;
1383 }
1384
1385 public function forward_get_haeder_page() {
1386 $haeder = $this->_haeder_page;
1387 $haeder .= $this->_haeder_next_page;
1388 $haeder = $this->get_report_haeder($haeder);
1389 $haeder = $this->rpt_merge_obj($haeder);
1390
1391 return $haeder;
1392 }
1393
1394 public function get_footer_page() {
1395 return $this->forward_get_footer_page();
1396 }
1397
1398 public function get_haeder_page() {
1399 return $this->forward_get_haeder_page();
1400 }
1401
1409 private function get_class_body($xkey) {
1410 $class = $xkey;
1411
1412 if (isset($this->_class_body[$xkey])) {
1413 $class = $this->_class_body[$xkey];
1414 }
1415
1416 return $class;
1417 }
1418
1419 public function forward_run_body($content) {
1420 $page_footer = '';
1421 $page_haeder = '';
1422 $rpt = $this->_fid;
1423
1424 if ($rpt != 'pagination') {
1425 $this->_current_report_ln++;
1426 $this->_current_page_ln++;
1427
1428 $pn = $this->_current_page;
1429 $ln = $this->_current_page_ln;
1430
1431 if ($pn == 1) {
1432 $max = $this->_first_page_lines;
1433 } else {
1434 $max = $this->_next_page_lines;
1435 }
1436
1437 if ($ln > $max) {
1438 $page_footer = $this->get_footer_page();
1439 $this->_current_page_ln = 1;
1440 $page_haeder = $this->get_haeder_page();
1441 }
1442
1443 $content = $this->rpt_merge_obj($content);
1444 }
1445
1446 return $page_footer . $page_haeder . $content;
1447 }
1448
1449 public function forward_run_footer($content) {
1450 return $this->rpt_merge_obj($content);
1451 }
1452
1453 public function set_class_haeder($key, $class = '') {
1454 if (!$class) {
1455 $class = 'th-' . $key;
1456 }
1457
1458 $this->_class_haeder[$key] = $class;
1459 }
1460
1461 private function get_class_haeder($key) {
1462 $class = '';
1463
1464 if (is_array($this->_class_haeder)) {
1465 if (isset($this->_class_haeder[$key])) {
1466 $class = $this->_class_haeder[$key];
1467 }
1468 }
1469
1470 if (!$class) {
1471 $class = 'th-' . $key;
1472 }
1473
1474 return $class;
1475 }
1476
1477 public function set_style_haeder($key, $style) {
1478 $this->_style_haeder[$key] = $style;
1479 }
1480
1481 private function get_style_haeder($key) {
1482 $style = '';
1483
1484 if (is_array($this->_style_haeder)) {
1485 if (isset($this->_style_haeder[$key])) {
1486 $style = $this->_style_haeder[$key];
1487 }
1488 }
1489
1490 return $style;
1491 }
1492
1501 protected function get_table_action_definitions() {
1502 return array(
1503 array(
1504 'type' => 'expander',
1505 'enabled' => (bool) $this->_data_table,
1506 'header_tpl' => 'tpl_haeder_expander',
1507 'row_tpl' => 'tpl_row_expander',
1508 ),
1509 array(
1510 'type' => 'edit',
1511 'enabled' => (bool) $this->_create_row_edit,
1512 'header_tpl' => 'tpl_haeder_edit',
1513 'row_tpl' => 'tpl_row_edit',
1514 ),
1515 array(
1516 'type' => 'copy',
1517 'enabled' => (bool) $this->_create_row_copy,
1518 'header_tpl' => 'tpl_haeder_copy',
1519 'row_tpl' => 'tpl_row_copy',
1520 ),
1521 array(
1522 'type' => 'show',
1523 'enabled' => (bool) $this->_create_row_show,
1524 'header_tpl' => 'tpl_haeder_show',
1525 'row_tpl' => 'tpl_row_show',
1526 ),
1527 array(
1528 'type' => 'export',
1529 'enabled' => (bool) $this->_create_row_export,
1530 'header_tpl' => 'tpl_haeder_export',
1531 'row_tpl' => 'tpl_row_export',
1532 ),
1533 array(
1534 'type' => 'import',
1535 'enabled' => (bool) $this->_create_row_import,
1536 'header_tpl' => 'tpl_haeder_import',
1537 'row_tpl' => 'tpl_row_import',
1538 ),
1539 array(
1540 'type' => 'download',
1541 'enabled' => (bool) $this->_create_row_download,
1542 'header_tpl' => 'tpl_haeder_download',
1543 'row_tpl' => 'tpl_row_download',
1544 ),
1545 array(
1546 'type' => 'delete',
1547 'enabled' => (bool) $this->_create_row_delete,
1548 'header_tpl' => 'tpl_haeder_delte',
1549 'row_tpl' => 'tpl_row_delete',
1550 ),
1551 array(
1552 'type' => 'print',
1553 'enabled' => (bool) $this->_create_row_print,
1554 'header_tpl' => 'tpl_haeder_print',
1555 'row_tpl' => 'tpl_row_print',
1556 ),
1557 );
1558 }
1559
1566 $html = '';
1567 $count = 0;
1568
1569 foreach ($this->get_table_action_definitions() as $def) {
1570 if (!$def['enabled']) {
1571 continue;
1572 }
1573
1574 $file = $this->_tabel_tpls[$def['header_tpl']];
1575 $tpl = $this->get_tpl($file, array(
1576 'name' => 'ID',
1577 'class' => 'no-sort',
1578 ));
1579
1580 $html .= $tpl . "\n";
1581 $count++;
1582 }
1583
1584 return array(
1585 'html' => $html,
1586 'count' => $count,
1587 );
1588 }
1589
1598 protected function get_table_row_action_data($type, array $record) {
1599 $rid = $this->get_record_rid($record, -1);
1600 $dat = array(
1601 'rid' => $rid,
1602 'value' => $rid,
1603 'action' => $this->get_report_action_url(),
1604 'class' => 'no-sort',
1605 'tooltip' => '',
1606 );
1607
1608 if ($type === 'download') {
1609 $dat['href_dir_file'] = dbx()->get_modul_var('href_dir_file', '', '*');
1610 }
1611
1612 if ($type === 'copy') {
1613 $dat['confirm'] = $this->_msg_confirm_copy;
1614 }
1615
1616 if ($type === 'delete') {
1617 $dat['confirm'] = $this->_msg_confirm_delete;
1618 }
1619
1620 return $dat;
1621 }
1622
1630 protected function render_table_row_action_block(array $record) {
1631 $html = '';
1632
1633 foreach ($this->get_table_action_definitions() as $def) {
1634 if (!$def['enabled']) {
1635 continue;
1636 }
1637
1638 $file = $this->_tabel_tpls[$def['row_tpl']];
1639 $dat = $this->get_table_row_action_data($def['type'], $record);
1640 $tpl = $this->get_tpl($file, $dat);
1641
1642 $html .= $tpl . "\n";
1643 }
1644
1645 return $html;
1646 }
1647
1658 protected function render_table_header_select(array $auto_flds, $fld_id, $class, array $select_state) {
1659 $file = $this->_tabel_tpls['tpl_haeder_select'];
1660 $name = isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] : 'xID';
1661 $checked = '';
1662
1663 if (!empty($select_state['header_checked'])) {
1664 $checked = 'checked="checked"';
1665 }
1666
1667 return $this->get_tpl($file, array(
1668 'name' => $name,
1669 'checked' => $checked,
1670 'class' => $class,
1671 'header_state' => isset($select_state['header_state']) ? $select_state['header_state'] : 'none',
1672 ));
1673 }
1674
1683 protected function render_table_row_select(array $record, $class) {
1684 $file = $this->_tabel_tpls['tpl_row_select'];
1685 $name = $this->_fid . '_select';
1686 $rid = $this->get_record_rid($record, -1);
1687 $checked = $this->check_is_multiselect($rid);
1688
1689 if ($checked) {
1690 $this->_post[$name] = 1;
1691 }
1692
1693 return $this->get_tpl($file, array(
1694 'name' => $name,
1695 'value' => $rid,
1696 'rid' => $rid,
1697 'checked' => $checked,
1698 'class' => $class,
1699 'tooltip' => '',
1700 ));
1701 }
1702
1711 protected function render_table_header_data_columns(array $auto_flds, $fld_id) {
1712 $html = '';
1713 $count = 0;
1714
1715 foreach ($auto_flds as $key => $value) {
1716 $skip = 0;
1717
1718 if ($this->_create_row_select && $key == $fld_id) {
1719 $skip = 1;
1720 }
1721
1722 if (!$skip && $value > '') {
1723 $file = $this->_tabel_tpls['tpl_haeder_col'];
1724 $class = $this->get_class_haeder($key);
1725 $style = $this->get_style_haeder($key);
1726
1727 $tpl = $this->get_tpl($file, array(
1728 'value' => $value,
1729 'name' => $key,
1730 'class' => $class,
1731 'style' => $style,
1732 ));
1733
1734 $html .= $tpl . "\n";
1735 $count++;
1736 }
1737 }
1738
1739 return array(
1740 'html' => $html,
1741 'count' => $count,
1742 );
1743 }
1744
1755 protected function render_table_row_data_columns(array $record, array $auto_flds, $fld_id, $defaultClass = 'auto-fld') {
1756 $html = '';
1757
1758 foreach ($auto_flds as $no => $key) {
1759 $xkey = '';
1760 $value = '-?-';
1761 $label = $auto_flds[$no];
1762 $skip = 0;
1763
1764 if (isset($record[$key])) {
1765 $xkey = $key;
1766 } elseif (isset($record[$no])) {
1767 $xkey = $no;
1768 }
1769
1770 if ($this->_create_row_select && $xkey == $fld_id) {
1771 $skip = 1;
1772 }
1773
1774 if (!$skip && $label > '') {
1775 if ($xkey) {
1776 $value = $record[$xkey];
1777 $value = $this->rpt_format($xkey, $value);
1778 }
1779
1780 $class = $defaultClass;
1781
1782 if ($defaultClass !== 'auto-fld') {
1783 $class = $this->get_class_body($xkey);
1784 }
1785
1786 $tpl = $this->get_tpl($this->_tabel_tpls['tpl_row_col'], array(
1787 'value' => $value,
1788 'class' => $class,
1789 'tooltip' => '',
1790 ));
1791
1792 $html .= $tpl . "\n";
1793 }
1794 }
1795
1796 return $html;
1797 }
1798
1806 public function get_report_haeder($content = '') {
1807 if (!$content) {
1808 $content = $this->_haeder;
1809 }
1810
1811 $this->_current_page++;
1812 $col_count = 0;
1813 $auto_flds = $this->_auto_flds;
1814 $auto_mode = $this->_auto_mode;
1815 $select_state = $this->get_visible_multi_select_state();
1816
1817 if (!is_array($auto_flds)) {
1818 if (is_string($auto_flds) && $auto_flds !== '') {
1819 $auto_flds = explode(',', $auto_flds);
1820 } else {
1821 $auto_flds = array();
1822 }
1823 }
1824
1825 $pos = strpos($content, '[rpt:row]');
1826
1827 if ($pos !== false) {
1828 $row = '';
1829 $fld_id = $this->_fld_id;
1830
1831 if ($auto_mode == 'table' && is_array($auto_flds)) {
1832 $buttonBlock = $this->render_table_header_action_block();
1833 $columnBlock = $this->render_table_header_data_columns($auto_flds, $fld_id);
1834
1835 if ($this->_table_buttons != 'left') {
1836 if ($this->_create_row_select) {
1837 $row .= $this->render_table_header_select(
1838 $auto_flds,
1839 $fld_id,
1840 $this->get_class_haeder(isset($auto_flds[$fld_id]) ? $auto_flds[$fld_id] : 'xID'),
1841 $select_state
1842 ) . "\n";
1843 $col_count++;
1844 }
1845
1846 $row .= $columnBlock['html'];
1847 $col_count += $columnBlock['count'];
1848
1849 $row .= $buttonBlock['html'];
1850 $col_count += $buttonBlock['count'];
1851 } else {
1852 $row .= $buttonBlock['html'];
1853 $col_count += $buttonBlock['count'];
1854
1855 if ($this->_create_row_select) {
1856 $row .= $this->render_table_header_select(
1857 $auto_flds,
1858 $fld_id,
1859 'no-sort',
1860 $select_state
1861 ) . "\n";
1862 $col_count++;
1863 }
1864
1865 $row .= $columnBlock['html'];
1866 $col_count += $columnBlock['count'];
1867 }
1868
1869 $this->_table_col_count = $col_count;
1870 }
1871
1872 $content = str_replace('[rpt:row]', $row, $content);
1873 }
1874
1875 $content = $this->run_haeder($content);
1876
1877 return $content;
1878 }
1879
1885 public function get_report_body(): string {
1886 $content = '';
1887 $line = '';
1888 $loop = 0;
1889
1890 $auto_flds = $this->_auto_flds;
1891 $auto_mode = $this->_auto_mode;
1892
1893 if (!is_array($auto_flds)) {
1894 if (is_string($auto_flds) && $auto_flds !== '') {
1895 $auto_flds = explode(',', $auto_flds);
1896 } else {
1897 $auto_flds = array();
1898 }
1899 }
1900
1901 if (is_array($this->_rdata)) {
1902 foreach ($this->_rdata as $recnum => $record) {
1903 $loop++;
1904 $line = $this->_body;
1905
1906 $this->_record = $record;
1907 $line = $this->run_body($line);
1908 $record = $this->_record;
1909
1910 $fld_id = $this->_fld_id;
1911 $pos = strpos($line, '[rpt:row]');
1912
1913 if ($pos !== false && $this->_rdata_inline) {
1914 $inline = $this->_body_inline;
1915 return str_replace('[rpt:row]', $inline, $line);
1916 }
1917
1918 if ($pos !== false) {
1919 $row = '';
1920
1921 if ($auto_mode == 'table' && is_array($auto_flds)) {
1922 $buttonBlock = $this->render_table_row_action_block($record);
1923
1924 if ($this->_table_buttons != 'left') {
1925 if ($this->_create_row_select) {
1926 $row .= $this->render_table_row_select($record, 'no-sort') . "\n";
1927 }
1928
1929 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id, 'auto-fld');
1930 $row .= $buttonBlock;
1931 } else {
1932 $row .= $buttonBlock;
1933
1934 if ($this->_create_row_select) {
1935 $row .= $this->render_table_row_select($record, 'no-sort') . "\n";
1936 }
1937
1938 $row .= $this->render_table_row_data_columns($record, $auto_flds, $fld_id, 'body');
1939 }
1940 }
1941
1942 $line = str_replace('[rpt:row]', $row, $line);
1943 }
1944
1945 $tr_class = $this->get_class_tr($record);
1946 $tr_class .= ($loop % 2 != 0) ? ' odd' : ' even';
1947
1948 $line = str_replace('{tr-class}', $tr_class, $line);
1949 $pos = strpos($line, '{');
1950
1951 if ($pos !== false && is_array($record)) {
1952 foreach ($record as $field => $value) {
1953 $field_name = '{' . $field . '}';
1954 $value = $this->rpt_format($field, $value);
1955
1956 if (!is_array($value)) {
1957 if ($value === null) {
1958 $value = '';
1959 }
1960
1961 $line = str_replace($field_name, $value, $line);
1962 }
1963 }
1964 }
1965
1966 $col_count = $this->_table_col_count;
1967 $line = str_replace('{rpt:col_count}', $col_count, $line);
1968
1969 if (strpos($line, '{r}') !== false) {
1970 $r = dbx()->next_id(1);
1971 $line = str_replace('{r}', $r, $line);
1972 }
1973
1974 $content .= $line;
1975
1976 if ($this->_rdata_inline) {
1977 break;
1978 }
1979 }
1980 }
1981
1982 return $content;
1983 }
1984
1985 public function get_class_tr($record) {
1986 $class = '';
1987 $activ_id = $this->_activ_id;
1988
1989 if (!$activ_id) {
1990 $activ_id = $this->get_activ_id();
1991 }
1992
1993 if ($activ_id) {
1994 $key = $this->_fld_id;
1995
1996 if ($key && isset($record[$key])) {
1997 if ($activ_id == $record[$key]) {
1998 $class = 'table-active';
1999 }
2000 }
2001 }
2002
2003 return $class;
2004 }
2005
2006 public function get_report_footer() {
2007 $content = $this->_footer;
2008 $col_count = $this->_table_col_count;
2009
2010 $content = str_replace('{rpt:col_count}', $col_count, $content);
2011 $content = $this->run_footer($content);
2012
2013 return $content;
2014 }
2015
2016 public function split_tpl($report) {
2017 $report_part = explode('<hr class="dbx_split">', $report);
2018 $report_header = '';
2019 $report_body = '';
2020 $report_footer = '';
2021 $next_haeder_page = '';
2022 $next_footer_page = '';
2023 $count = count($report_part);
2024
2025 if ($count > 0) {
2026 $report_body = $report_part[0];
2027 }
2028
2029 if ($count > 1) {
2030 $report_header = $report_part[0];
2031 $report_body = $report_part[1];
2032 }
2033
2034 if ($count > 2) {
2035 $report_header = $report_part[0];
2036 $report_body = $report_part[1];
2037 $report_footer = $report_part[2];
2038 $next_haeder_page = $report_part[0];
2039 $next_footer_page = $report_part[2];
2040 }
2041
2042 if ($count > 5) {
2043 $next_haeder_page = $report_part[3];
2044 $next_footer_page = $report_part[5];
2045 }
2046
2047 $this->_haeder = $report_header;
2048 $this->_body = $report_body;
2049 $this->_footer = $report_footer;
2050 $this->_footer_next_page = $next_footer_page;
2051 $this->_haeder_next_page = $next_haeder_page;
2052 }
2053
2054 public function get_report_pages() {
2055 $content = '';
2056 $modul = $this->_dbx_modul;
2057 $action = $this->_dbx_action;
2058 $rcount = $this->_rcount;
2059 $link = $this->_pagelink;
2060 $tpl = $this->_tpl_pagination;
2061
2062 $rpos = $this->get_sel('dbx_rpos', 0, 'int');
2063 $rrows = $this->get_sel('dbx_rrows', 10, 'int');
2064
2065 if (!$link) {
2066 $link = '?dbx_modul=' . $modul . '&dbx_run1=' . $action;
2067 }
2068
2069 $link = $this->_action ?: $link;
2070 $content = $this->pagination($tpl, $link, $rpos, $rrows, $rcount);
2071
2072 return $content;
2073 }
2074
2075 private function lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount, $target) {
2076 $active = '';
2077 $class = '';
2078 $current = '';
2079 $p_active = '';
2080 $s_active = '';
2081
2082 if ($p == $akt_page) {
2083 $p_active = ' aria-current="page"';
2084 $active = ' active';
2085 $current = ' aria-current="page" ';
2086 }
2087
2088 $rec = array();
2089 $rec['p'] = $p . $s_active;
2090 $rec['href_page'] = $link . '&dbx_rrows=' . $rrows . '&dbx_rpos=' . (($p - 1) * $rrows) . '&dbx_target=' . $target;
2091 $rec['p_active'] = $p_active;
2092 $rec['active'] = $active;
2093 $rec['current'] = $current;
2094 $rec['class'] = $class . ' dbxAjax';
2095
2096 return $rec;
2097 }
2098
2099 private function pagination($tpl, $link, $rpos, $rrows, $rcount) {
2100 if ($rcount == 0 || $rrows == 0 || $rcount <= $rrows) {
2101 return '';
2102 }
2103
2104 $pages = intval($rcount / $rrows);
2105
2106 if ($rcount % $rrows) {
2107 $pages++;
2108 }
2109
2110 if ($pages == 0 && $rcount > 0) {
2111 $pages = 1;
2112 }
2113
2114 $pmax = $this->_but_pagination;
2115 $akt_page = intval($rpos / $rrows) + 1;
2116
2117 if ($akt_page < 1) {
2118 $akt_page = 1;
2119 }
2120
2121 if ($akt_page > $pages) {
2122 $akt_page = $pages;
2123 }
2124
2125 $half = intval($pmax / 2);
2126 $p_s = $akt_page - $half;
2127 $p_e = $akt_page + $half;
2128
2129 if ($p_s < 1) {
2130 $p_s = 1;
2131 $p_e = $pmax;
2132 }
2133
2134 if ($p_e > $pages) {
2135 $p_e = $pages;
2136 $p_s = $pages - $pmax + 1;
2137
2138 if ($p_s < 1) {
2139 $p_s = 1;
2140 }
2141 }
2142
2143 $last_pos = ($pages - 1) * $rrows;
2144 $prev = ($akt_page - 2) * $rrows;
2145 $next = ($akt_page) * $rrows;
2146
2147 if ($prev < 0) {
2148 $prev = 0;
2149 }
2150
2151 if ($next > $last_pos) {
2152 $next = $last_pos;
2153 }
2154
2155 $i = $this->_next_i;
2156 $target = 'dbx_target_' . $i;
2157
2158 $href_first = $link . '&dbx_rpos=0&dbx_rrows=' . $rrows . '&dbx_target=' . $target;
2159 $href_last = $link . '&dbx_rpos=' . $last_pos . '&dbx_rrows=' . $rrows . '&dbx_target=' . $target;
2160 $href_prev = $link . '&dbx_rpos=' . $prev . '&dbx_rrows=' . $rrows . '&dbx_target=' . $target;
2161 $href_next = $link . '&dbx_rpos=' . $next . '&dbx_rrows=' . $rrows . '&dbx_target=' . $target;
2162
2163 $this->_sys['dbx_rpos'] = $rpos;
2164 $this->_sys['dbx_rrows'] = $rrows;
2165
2166 $dv = array();
2167 $dv['dbx_rpos'] = $rpos;
2168 $dv['dbx_rrows'] = $rrows;
2169 $rdata = array();
2170
2171 for ($p = $p_s; $p <= $p_e; $p++) {
2172 $rdata[] = $this->lnk_page($p, $akt_page, $link, $rpos, $rrows, $rcount, $target);
2173
2174 if ($p >= $pages) {
2175 break;
2176 }
2177 }
2178
2179 $oReport = dbx()->get_system_obj('dbxReport');
2180
2181 $oReport->init('pagination');
2182 $oReport->_data = $dv;
2183 $oReport->_dbx_modul = 'dbx';
2184 $oReport->_dbx_action = 'pagination';
2185 $oReport->_dbx_modul_id = 888;
2186 $oReport->_rdata = $rdata;
2187 $oReport->_rcount = $rcount;
2188 $oReport->_rrows = $rrows;
2189 $oReport->_rpos = $rpos;
2190 $oReport->_action = $link;
2191 $oReport->_tpl = $tpl;
2192 $oReport->_pages = 0;
2193 $oReport->_body_inline = false;
2194 $oReport->_create_sel_flds = 0;
2195
2196 $content = $oReport->run(0, '', 'table');
2197
2198 $content = str_replace('{href_first}', $href_first, $content);
2199 $content = str_replace('{href_last}', $href_last, $content);
2200 $content = str_replace('{href_prev}', $href_prev, $content);
2201 $content = str_replace('{href_next}', $href_next, $content);
2202
2203 return $content;
2204 }
2205
2206 public function data_rows($data, $rpos, $rrows) {
2207 $rdata = array();
2208
2209 for ($i = $rpos; $i < ($rpos + $rrows); $i++) {
2210 if (isset($data[$i])) {
2211 $rdata[] = $data[$i];
2212 } else {
2213 break;
2214 }
2215 }
2216
2217 return $rdata;
2218 }
2219
2220 public function add_where($mode, $select, $where = '') {
2221 if ($select) {
2222 if ($where) {
2223 $where .= " $mode (";
2224 $where .= $select;
2225 $where .= ') ';
2226 } else {
2227 $where = $select;
2228 }
2229 }
2230
2231 return $where;
2232 }
2233
2234 public function no_page_reset() {
2235 $this->_page_reset = 0;
2236 }
2237
2238 public function submit() {
2239 $submit = 0;
2240 $nor = dbx()->get_modul_var('dbx_no_reset', 0, 'int');
2241 if (!$nor) {
2242 $submit = $this->forward_submit();
2243 }
2244
2245 return $submit;
2246 }
2247
2248 public function set_sel($name, $value) {
2249 $_POST[$name] = $value;
2250 $this->_data[$name] = $value;
2251 $this->_sys[$name] = $value;
2252 }
2253
2254 public function get_sel($name, $default = '', $rules = 'parameter') {
2255 $submit = $this->submit();
2256 $page_reset = $this->_page_reset ? 1 : 0;
2257 $xdefault = $default;
2258 $nor = dbx()->get_modul_var('dbx_nor', 0, 'int');
2259
2260 if ($submit && $page_reset && !$nor) {
2261 $this->_sys['dbx_rpos'] = 0;
2262 }
2263
2264 if (isset($this->_data[$name])) {
2265 $xdefault = $this->_data[$name];
2266 }
2267
2268 if (isset($this->_sys[$name])) {
2269 $xdefault = $this->_sys[$name];
2270 }
2271
2272 if ($page_reset) {
2273 $danger_value = $this->get_post($name, $xdefault, '*');
2274 $ok = $this->oValidator->validate($danger_value, $rules, $name);
2275
2276 if (!$ok) {
2277 $danger_value = $default;
2278 }
2279
2280 $value = $danger_value;
2281 } else {
2282 $value = $xdefault;
2283 }
2284
2285 $this->_sys[$name] = $value;
2286
2287 return $value;
2288 }
2289
2290 protected function get_grid_replaces(): array {
2291 $gridId = $this->_grid_id;
2292
2293 if (!$gridId) {
2294 $gridId = $this->_fid . '_grid';
2295 }
2296
2297 $cols = $this->_grid_cols;
2298
2299 if (!$cols && $this->_dd) {
2300 $oDB = dbx()->get_system_obj('dbxDB');
2301 $cols = $oDB->get_dd_grid_cols($this->_dd);
2302 }
2303
2304 return array(
2305 'read_url' => $this->_grid_read_url,
2306 'save_url' => $this->_grid_save_url,
2307 'delete_url' => $this->_grid_delete_url,
2308 'insert_url' => $this->_grid_insert_url,
2309 'sort_url' => $this->_grid_sort_url,
2310 'sync_url' => $this->_grid_sync_url,
2311 'print_url' => $this->_grid_print_url,
2312 'export_url' => $this->_grid_export_url,
2313 'grid_id' => $gridId,
2314 'grid_cols' => $cols,
2315 'grid_schema' => $this->_grid_schema,
2316 'grid_layout' => $this->_grid_layout,
2317 'grid_height' => $this->_rrows,
2318 'grid_synctime' => $this->_grid_synctime,
2319 );
2320 }
2321
2322 public function apply_tabulurator_request() {
2323 $page = dbx()->get_request_var('page', 0, 'int');
2324 $size = dbx()->get_request_var('size', 0, 'int');
2325 $limit = dbx()->get_request_var('limit', 0, 'int');
2326 $offset = dbx()->get_request_var('offset', -1, 'int');
2327
2328 if ($size > 0) {
2329 $this->_rrows = $size;
2330 } elseif ($limit > 0) {
2331 $this->_rrows = $limit;
2332 }
2333
2334 if ($offset >= 0) {
2335 $this->_rpos = $offset;
2336 } elseif ($page > 0 && $this->_rrows > 0) {
2337 $this->_rpos = (($page - 1) * $this->_rrows);
2338 }
2339 }
2340
2341 public function get_report_rows_array(): array {
2342 $rows = array();
2343
2344 if (!is_array($this->_rdata)) {
2345 return $rows;
2346 }
2347
2348 foreach ($this->_rdata as $record) {
2349 $this->_record = $record;
2350 $dummy = '';
2351 $this->run_body($dummy);
2352 $record = $this->_record;
2353
2354 if (!is_array($record)) {
2355 $record = array();
2356 }
2357
2358 $row = array();
2359
2360 foreach ($record as $field => $value) {
2361 if (is_array($value)) {
2362 $row[$field] = $value;
2363 } else {
2364 $row[$field] = $this->rpt_format($field, $value);
2365 }
2366 }
2367
2368 $rows[] = $row;
2369 }
2370
2371 return $rows;
2372 }
2373
2374 public function fast_response_rows_json() {
2375 $rows = $this->get_report_rows_array();
2376 $count = (int) $this->_rcount;
2377 $rrows = (int) $this->_rrows;
2378 $rpos = (int) $this->_rpos;
2379 $pages = 0;
2380 $page = 1;
2381
2382 if ($rrows > 0) {
2383 $pages = (int) ceil($count / $rrows);
2384 $page = (int) floor($rpos / $rrows) + 1;
2385 }
2386
2387 header('Content-Type: application/json; charset=utf-8');
2388
2389 echo json_encode(array(
2390 'ok' => 1,
2391 'count' => $count,
2392 'rows' => array_values($rows),
2393 'rpos' => $rpos,
2394 'rrows' => $rrows,
2395 'page' => $page,
2396 'pages' => $pages,
2397 ), JSON_UNESCAPED_UNICODE);
2398
2399 exit;
2400 }
2401
2402 public function init($fid, $tpl = '', $first_page_lines = -1, $next_page_lines = -1, $current_line = -1) {
2403 $this->forward_init($fid, $tpl);
2404
2405 if ($fid == 'pagination') {
2406 return;
2407 }
2408
2409 if ($first_page_lines < 0) {
2410 $first_page_lines = 999999;
2411 }
2412
2413 if ($next_page_lines < 0) {
2414 $next_page_lines = 999999;
2415 }
2416
2417 if ($current_line < 0) {
2418 $current_line = 0;
2419 }
2420
2421 $current_page_line = 0;
2422 $current_page = 0;
2423
2424 if ($current_line >= 0) {
2425 if ($current_line < $first_page_lines) {
2426 $current_page = 1;
2427 $current_page_line = $current_line;
2428 } else {
2429 $remaining_lines = $current_line - $first_page_lines;
2430 $current_page = 2 + intval($remaining_lines / $next_page_lines);
2431 $current_page_line = ($remaining_lines % $next_page_lines);
2432 }
2433
2434 $current_page--;
2435 }
2436
2437 $this->_current_page = $current_page;
2438 $this->_current_report_ln = $current_line;
2439 $this->_current_page_ln = $current_page_line;
2440 $this->_first_page_lines = $first_page_lines;
2441 $this->_next_page_lines = $next_page_lines;
2442
2443 $this->_fld_haeder = '';
2444 $this->_haeder_report = '';
2445 $this->_footer_report = '';
2446 $this->_haeder_page = '';
2447 $this->_footer_page = '';
2448 $this->_haeder_next_page = '';
2449 $this->_footer_next_page = '';
2450
2451 dbx()->set_remember_var('last_report_i', $this->_next_i, 'dbx');
2452
2453 $retval = $this->set_form_selects();
2454
2455 if ($retval === 'count_response') {
2456 $response = $this->get_count_selects();
2457 $this->fast_response($response);
2458 }
2459
2460 if ($retval === 'add' || $retval === 'rem') {
2461 $this->_multi_select_work = $retval;
2462
2463 $submitField = $fid . '_select';
2464 $selects = $this->get_post($submitField, '', 'array|parameter');
2465
2466 if (is_array($selects)) {
2467 foreach ($selects as $id => $sel) {
2468 if ($retval == 'add') {
2469 $this->set_multi_select($sel);
2470 }
2471 }
2472 } else {
2473 if ($retval == 'rem') {
2474 $selects = $this->get_post('dbx_add', '', 'parameter');
2475 $deselects = explode('|', $selects);
2476
2477 foreach ($deselects as $id => $sel) {
2478 if ($sel) {
2479 $this->del_multi_select($sel);
2480 }
2481 }
2482 }
2483 }
2484 } else {
2485 $this->_multi_select_work = '';
2486 }
2487 }
2488
2489 public function run($pages = 0, $flds = '', $mode = '') {
2490 $content = '';
2491 $msg = '';
2492 $msg_class = 'info';
2493 $norep = '';
2494
2495 if (!$pages) {
2496 $pages = $this->_pages;
2497 }
2498
2499 if (!$mode) {
2500 $mode = $this->_mode;
2501 }
2502
2503 $this->_pages = $pages;
2504 $this->_mode = $mode;
2505
2506 if (!is_array($flds)) {
2507 $flds = $this->_rflds;
2508 }
2509
2510 $submit = $this->submit();
2511
2512 $nor = dbx()->get_modul_var('dbx_no_reset', 0,'int');
2513
2514
2515 $this->_auto_flds = $flds;
2516 $this->_auto_mode = $mode;
2517
2518 $rrows = $this->_rrows;
2519 $count = $this->_rcount;
2520
2521 if (isset($this->_sys['dbx_rrows'])) {
2522 $rrows = $this->_sys['dbx_rrows'];
2523 }
2524
2525 if ($this->_data_table == 'auto') {
2526 if ($count > $rrows) {
2527 $this->_data_table = 0;
2528 } else {
2529 $this->_data_table = 1;
2530 }
2531 }
2532
2533 $i = $this->_next_i;
2534 $fid = $this->_fid;
2535 $tpl = $this->_tpl;
2536 $msg = $this->_msg_info;
2537 $create_sel_flds = $this->_create_sel_flds;
2538
2539 if ($fid != 'pagination') {
2540 if (!is_array($this->_options_rsort) || empty($this->_options_rsort)) {
2541 $this->_options_rsort['id'] = 'ID';
2542 }
2543
2544 $this->_options_rrows['1'] = 1;
2545 $this->_options_rrows['5'] = 5;
2546 $this->_options_rrows['10'] = 10;
2547 $this->_options_rrows['15'] = 15;
2548 $this->_options_rrows['20'] = 20;
2549 $this->_options_rrows['25'] = 25;
2550 $this->_options_rrows['50'] = 50;
2551 $this->_options_rrows['100'] = 100;
2552 $this->_options_rrows['1000'] = 1000;
2553
2554 $this->_options_rdesc['ASC'] = 'Aufsteigend';
2555 $this->_options_rdesc['DESC'] = 'Absteigend';
2556
2557 $this->_options_rselect['0'] = '*Alle*';
2558 $this->_options_rselect['1'] = 'Ausgewählte';
2559
2560 $count = $this->_rcount;
2561
2562 if ($count != -88) {
2563 if ($submit && !$nor) {
2564 $this->_sys['dbx_rpos'] = 0;
2565 }
2566
2567 if (isset($this->_sys['dbx_rrows'])) {
2568 $this->_rrows = $this->_sys['dbx_rrows'];
2569 } else {
2570 $this->_rrows = $count;
2571 }
2572
2573 if (isset($this->_sys['dbx_rpos'])) {
2574 $this->_rpos = $this->_sys['dbx_rpos'];
2575 } else {
2576 $this->_rpos = 0;
2577 }
2578 }
2579 }
2580
2581 if ($fid != 'pagination' && $create_sel_flds == 1) {
2582 if ($this->_data_table == 88) {
2583 $next_val = 0;
2584
2585 foreach ($this->_options_rrows as $key => $nam) {
2586 if ($this->_rcount <= $key) {
2587 $next_val = $key;
2588 }
2589
2590 if ($next_val) {
2591 break;
2592 }
2593 }
2594
2595 if ($next_val) {
2596 $this->_sys['dbx_rrows'] = $next_val;
2597 }
2598 }
2599
2600 $this->add_fld('dbx_rrows', 'select-single-label', options: $this->_options_rrows, rules: 'int', label: 'Anz.Seite');
2601 $this->add_fld('dbx_rsort', 'select-single-label', options: $this->_options_rsort, rules: 'parameter', label: 'Sortierung');
2602 $this->add_fld('dbx_rdesc', 'select-single-label', options: $this->_options_rdesc, rules: 'parameter', label: 'Auf/Ab');
2603 $this->add_fld('dbx_rwhere', 'dbx|search', options: '', rules: '*', label: 'Suchen', class: 'input-reset');
2604 $this->add_fld('dbx_rselect', 'select-single-label', options: $this->_options_rselect, rules: 'parameter', label: 'Ausgewählte');
2605 }
2606
2607 if ($this->submit()) {
2608 $now = microtime(true);
2609
2610 if (!isset($this->_sys['try_first'])) {
2611 $this->_sys['try_first'] = $now;
2612 }
2613
2614 if (!isset($this->_sys['try_count'])) {
2615 $this->_sys['try_count'] = 0;
2616 }
2617
2618 if (!isset($this->_sys['try_error'])) {
2619 $this->_sys['try_error'] = 0;
2620 }
2621
2622 $this->_sys['try_last'] = $now;
2623 $this->_sys['try_count'] = ($this->_sys['try_count'] + 1);
2624
2625 if ($this->errors()) {
2626 $this->_sys['status'] = -1;
2627 $this->_sys['try_error'] = ($this->_sys['try_error'] + 1);
2628 $msg_class = 'error';
2629 $msg = $this->_msg_error;
2630 } else {
2631 $this->_sys['status'] = 1;
2632 $this->_sys['try_error'] = 0;
2633 $msg_class = 'success';
2634 $msg = $this->_msg_success;
2635 }
2636 } else {
2637 $msg_class = 'init';
2638 $msg = $this->_msg_info;
2639 }
2640
2641 $replaces = $this->_replaces;
2642 $replaces['dbx:select'] = $this->_create_sel_flds;
2643 $replaces['dbx:data_table'] = $this->_data_table;
2644
2645 if ($mode == 'tabulurator') {
2646 $replaces = array_merge($replaces, $this->get_grid_replaces());
2647 }
2648
2649 if (strpos($tpl, '|') === false) {
2650 $tpl = $this->_dbx_modul . '|' . $tpl;
2651 }
2652
2653 $report_tpl = $this->get_tpl($tpl, $replaces, 'htm', $i);
2654 $report_tpl = $this->merge_tpl_data($report_tpl, $i);
2655 $report_tpl = $this->merge_fld_data($report_tpl, $i);
2656 $report_tpl = $this->merge_obj($report_tpl, $i);
2657
2658 if ($mode == 'tabulurator') {
2659 $content = $report_tpl;
2660
2661 if ($fid != 'pagination') {
2662 $this->store_sysdata();
2663 }
2664
2665 $content = str_replace('{i}', $i, $content);
2666
2667 $msg_tpl = $this->get_form_msg($msg_class, $msg);
2668 $content = str_replace('{obj:form_msg}', $msg_tpl, $content);
2669
2670 $content = str_replace('[dbx:pagination]', '', $content);
2671 $content = str_replace('{rpt:pages}', (string) $this->_current_page, $content);
2672
2673 $norep_ids = '';
2674 $js = $this->_js;
2675
2676 if (is_array($js)) {
2677 foreach ($js as $javascript) {
2678 $javascript = str_replace('{i}', $i, $javascript);
2679 $norep_ids .= dbx()->norep("\n" . '<script type="text/javascript">' . $javascript . '</script>' . "\n", $i);
2680 }
2681 }
2682
2683 if ($norep_ids) {
2684 $norep = '<div class="norep">' . $norep_ids . '</div>';
2685 }
2686
2687 $content = str_replace('[dbx:js]', $norep, $content);
2688
2689 return $content;
2690 }
2691
2692 $this->split_tpl($report_tpl);
2693
2694 $haeder = $this->get_report_haeder();
2695 $body = $this->get_report_body();
2696 $footer = $this->get_report_footer();
2697
2698 $content = $haeder . $body . $footer;
2699
2700 if ($fid != 'pagination') {
2701 $this->store_sysdata();
2702 }
2703
2704 if ($fid != 'pagination') {
2705 if ($pages) {
2706 $ReportPages = $this->get_report_pages();
2707 $content = str_replace('[dbx:pagination]', $ReportPages, $content);
2708 }
2709
2710 $haeder_report = $this->_haeder_report;
2711 $haeder_page = $this->_haeder_page;
2712 $footer_page = $this->_footer_page;
2713 $footer_report = $this->_footer_report;
2714
2715 $content = str_replace('{i}', $i, $content);
2716
2717 $msg_tpl = $this->get_form_msg($msg_class, $msg);
2718 $content = str_replace('{obj:form_msg}', $msg_tpl, $content);
2719
2720 $haeder_report = $this->run_report_haeder($haeder_report);
2721 $haeder_page = $this->run_page_haeder($haeder_page);
2722 $footer_page = $this->run_page_footer($footer_page);
2723 $footer_report = $this->run_report_footer($footer_report);
2724
2725 $content = str_replace('[rpt:haeder_report]', $haeder_report, $content);
2726 $content = str_replace('[rpt:haeder_page]', $haeder_page, $content);
2727 $content = str_replace('[rpt:footer_page]', $footer_page, $content);
2728 $content = str_replace('[rpt:footer_report]', $footer_report, $content);
2729 }
2730
2731 $norep_ids = '';
2732 $js = $this->_js;
2733
2734 if (is_array($js)) {
2735 $count = count($js);
2736
2737 if ($count) {
2738 foreach ($js as $javascript) {
2739 $javascript = str_replace('{i}', $i, $javascript);
2740 $norep_ids .= dbx()->norep("\n" . '<script type="text/javascript">' . $javascript . '</script>' . "\n", $i);
2741 }
2742 }
2743 }
2744
2745 $content = str_replace('{i}', $i, $content);
2746
2747 if ($norep_ids) {
2748 $norep = '<div class="norep">' . $norep_ids . '</div>';
2749 }
2750
2751 $content = str_replace('[dbx:js]', $norep, $content);
2752 $content = str_replace('[dbx:pagination]', '', $content);
2753 $content = str_replace('{rpt:pages}', $this->_current_page, $content);
2754
2755 return $content;
2756 }
2757}
$table['server']
Definition .dd.php:6
get_activ_id($key='')
Liefert die aktive Remember-ID des aktuellen DD-Kontexts.
$_dbx_action
Aktive DBX-Aktion.
add_fld($name, $tpl='fd::', $label='fd::', $rules='fd::', $class='fd::', $data='fd::', $options='fd::', $tooltip='fd::', $placeholder='fd::', $errormsg='fd::', $dd='fd::', $remap='fd::')
Fügt ein Feld zur Formular-Definition hinzu.
forward_submit()
Gibt zurück, ob das Formular abgesendet wurde.
$_fld_id
Primärschlüsselfeld.
$_action
Formular-Action.
$_dbx_modul
Aktives Modul.
php_date_usr($value)
Wandelt Datumswerte in deutsches Format um.
fast_response($response, $interpreter=0)
Sendet eine direkte Fast-Response.
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.
merge_obj($content, $i=0)
Ersetzt {obj:*}-Platzhalter.
_forward_clear()
Setzt den internen Formularzustand zurück.
php_datetime_usr($value)
Wandelt Datums-/Zeitwerte in deutsches Format um.
errors()
Gibt die Anzahl der Fehler zurück.
get_post($name, $default='', $rules='alphanum')
Liest POST/GET-Daten mit Default-Rules alphanum.
$_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.
send_multi_select_json_response(array $visibleIds=array(), $dbx_do='')
Sendet einen JSON-Response für Multi-Select-AJAX.
$_create_row_undo
Zeilen-Undo aktiv.
$_grid_cols
Grid-Spalten-Definition.
get_sys($name, $default='', $validate='parameter')
Liest einen Systemwert aus Data/Sys/PostGet.
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.
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.
$_rflds
Report-Feldliste.
clear()
Löscht den kompletten Report-Zustand und setzt saubere Defaultwerte.
run_page_haeder($content)
$_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.
$_create_row_show
Zeilen-Show aktiv.
$_add_action
Zusatzparameter an Row-Aktionen.
get_record_rid($record, $default=-1)
Liefert die sauber ermittelte Record-ID eines Datensatzes.
$_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.
$_current_page_ln
Aktuelle Zeile auf aktueller Seite.
$_table_buttons
Buttons links oder rechts.
$_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.
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.
run_page_footer($content)
$_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.
run($pages=0, $flds='', $mode='')
render_table_header_select(array $auto_flds, $fld_id, $class, array $select_state)
Rendert die Header-Checkbox für die sichtbaren Rows.
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.
get_sel($name, $default='', $rules='parameter')
get_report_remember_key(string $suffix)
Liefert einen stabilen Remember-Key für reportbezogene Zustände.
$_grid_allow_delete
Delete im Grid erlaubt.
$_rdata_inline
Inline-Modus: Daten werden nur einmal in Body eingefügt.
$_create_sel_flds
Selektionsfelder erstellen.
$_grid_schema
Schema-Name für Grid.
rpt_merge_obj($content)
Fügt reportweite Platzhalter und Report-Objekte in einen String ein.
$_rrows
Datensätze pro Seite.
get_record_select_key($record)
Liefert den reportbezogenen Select-Key eines Datensatzes.
forward_run_report_haeder($content)
$_grid_print_url
Print-URL für Grid/Shell.
$_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)
$_create_row_copy
Zeilen-Copy aktiv.
$_grid_sync_url
Sync-URL für Grid.
$_rdata
Report-Daten.
$_table_col_count
Anzahl sichtbarer Tabellen-Spalten.
run_report_haeder($content)
$_tpl_pagination
Pagination-Template.
$_next_page_lines
Maximale Zeilen auf Folgeseiten.
set_sel($name, $value)
set_class_haeder($key, $class='')
set_multi_select($rid)
Fügt eine ID oder alle aktuell geladenen Reportzeilen zur Mehrfachauswahl hinzu.
$_multi_select_work
Interner Multi-Select-Arbeitsmodus.
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_form_selects()
Verarbeitet AJAX-/Select-Aktionen für Report-Mehrfachauswahl.
$_pagelink
Pagination-Link.
set_multi_selects($selects)
Speichert die komplette Mehrfachauswahl per Remember.
normalize_multi_select_key($rid)
Normalisiert einen Multi-Select-Key.
$_create_row_edit
Zeilen-Edit aktiv.
$_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.
$_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
$response
Definition index.php:518
DBX schema administration.