<?php

namespace DataView;

class Protokoll {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function renderScript() { 
    
    
    // --- BLOCK: main ---
    
								\FOP\I18n::ensureIsLoaded();
								?>
								<script type="text/javascript">
									
    function changefilter_protokoll_leiterListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_protokoll_leiter', val, cb.checked);
		  } else {
			  delete query['filter_protokoll_leiter'];
		  }reloadprotokoll();
        
    }

		var ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout = null;
		function changefilter_protokoll_leiterSearchFilter(val, callback) {
			if(ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout) clearTimeout(ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout);

			ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout = setTimeout(function() {
				$.getJSON(reloadprotokoll({action: 'getfilter_protokoll_leiterItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_protokoll_leiter_orig'] = val;
				});
			}, 300);
		}

	function getfilter_protokoll_leiterListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_protokoll_leiter_orig']) ? json_encode($_GET['filter_protokoll_leiter_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="c58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473" type="text">' +
			'<label class="mdl-textfield__label" for="c58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473">Filter...</label>' +
			'</div>');
		search.find('input').val(fstr).keyup(function (event) {
			var self = this;
			if ((event.keyCode || e.which) == 13) {
				var hasChecked = false;
				if (this.value) {
					// search value + tick all search results
					checkboxes.find('input').each(function (i, inp) {
						if (!inp.checked && $(inp).data('value')) {
							inp.checked = true;
							querySet('filter_protokoll_leiter', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_protokoll_leiter_orig'] = '';
					delete query['filter_protokoll_leiter'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadprotokoll();
					
				} else {
					$('#table_protokoll').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_protokoll_leiterSearchFilter(this.value, function (result) {
					reload(self.value, result);
				});
			}
		});
		gui.append(search);

		var checkboxes = $("<div></div>").css({maxHeight: '200px', overflow: 'auto'});
		var items = <?php
			// TODO: deps-Variable füllen mit DV-Parametern vom DataView id
			echo json_encode(\DataView\Protokoll::getfilter_protokoll_leiterItemsByStringAction(''));
		?>;

		function reload(fstr, items) {
			// rerender checkbox list
			checkboxes.empty();
			checkboxes.append($('<i style="cursor: pointer;"><?php echo _('show all'); ?></i>').click(function () {
				search.find('input').val('');
				query['filter_protokoll_leiter_orig'] = '';
				delete query['filter_protokoll_leiter'];
				reload('', items);reloadprotokoll();
				
			})).append('<br/>');
			// NULL-Wert auch suchbar #2057 (kommt als ID=0 an, muss für die idlist in _null geändert werden)
			for (var i = 0; i < items.length; i++) {
				let value = (items[i].ID === '0' ? '_null' : items[i].ID);
				let descr = items[i].description;
				let checked = querySet('filter_protokoll_leiter', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_protokoll_leiterListMultiFilter("' + value + '", this)\' ' + (checked ? ' checked>': '> ')).data('value', value)).append($('<span></span>').text(descr).prepend('&nbsp;')).append('<br/>');
				}
			 }
		}
		reload(fstr, items);
		gui.append(checkboxes);

		return gui;
	}
    function changefilter_protokoll_creatorListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_protokoll_creator', val, cb.checked);
		  } else {
			  delete query['filter_protokoll_creator'];
		  }reloadprotokoll();
        
    }

		var ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout = null;
		function changefilter_protokoll_creatorSearchFilter(val, callback) {
			if(ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout) clearTimeout(ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout);

			ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout = setTimeout(function() {
				$.getJSON(reloadprotokoll({action: 'getfilter_protokoll_creatorItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_protokoll_creator_orig'] = val;
				});
			}, 300);
		}

	function getfilter_protokoll_creatorListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_protokoll_creator_orig']) ? json_encode($_GET['filter_protokoll_creator_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="ca90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785a" type="text">' +
			'<label class="mdl-textfield__label" for="ca90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785a">Filter...</label>' +
			'</div>');
		search.find('input').val(fstr).keyup(function (event) {
			var self = this;
			if ((event.keyCode || e.which) == 13) {
				var hasChecked = false;
				if (this.value) {
					// search value + tick all search results
					checkboxes.find('input').each(function (i, inp) {
						if (!inp.checked && $(inp).data('value')) {
							inp.checked = true;
							querySet('filter_protokoll_creator', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_protokoll_creator_orig'] = '';
					delete query['filter_protokoll_creator'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadprotokoll();
					
				} else {
					$('#table_protokoll').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_protokoll_creatorSearchFilter(this.value, function (result) {
					reload(self.value, result);
				});
			}
		});
		gui.append(search);

		var checkboxes = $("<div></div>").css({maxHeight: '200px', overflow: 'auto'});
		var items = <?php
			// TODO: deps-Variable füllen mit DV-Parametern vom DataView id
			echo json_encode(\DataView\Protokoll::getfilter_protokoll_creatorItemsByStringAction(''));
		?>;

		function reload(fstr, items) {
			// rerender checkbox list
			checkboxes.empty();
			checkboxes.append($('<i style="cursor: pointer;"><?php echo _('show all'); ?></i>').click(function () {
				search.find('input').val('');
				query['filter_protokoll_creator_orig'] = '';
				delete query['filter_protokoll_creator'];
				reload('', items);reloadprotokoll();
				
			})).append('<br/>');
			// NULL-Wert auch suchbar #2057 (kommt als ID=0 an, muss für die idlist in _null geändert werden)
			for (var i = 0; i < items.length; i++) {
				let value = (items[i].ID === '0' ? '_null' : items[i].ID);
				let descr = items[i].description;
				let checked = querySet('filter_protokoll_creator', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_protokoll_creatorListMultiFilter("' + value + '", this)\' ' + (checked ? ' checked>': '> ')).data('value', value)).append($('<span></span>').text(descr).prepend('&nbsp;')).append('<br/>');
				}
			 }
		}
		reload(fstr, items);
		gui.append(checkboxes);

		return gui;
	}
									
    function changefilter_protokoll_leiterListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_protokoll_leiter', val, cb.checked);
		  } else {
			  delete query['filter_protokoll_leiter'];
		  }reloadprotokoll();
        
    }

		var ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout = null;
		function changefilter_protokoll_leiterSearchFilter(val, callback) {
			if(ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout) clearTimeout(ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout);

			ic58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473timeout = setTimeout(function() {
				$.getJSON(reloadprotokoll({action: 'getfilter_protokoll_leiterItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_protokoll_leiter_orig'] = val;
				});
			}, 300);
		}

	function getfilter_protokoll_leiterListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_protokoll_leiter_orig']) ? json_encode($_GET['filter_protokoll_leiter_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="c58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473" type="text">' +
			'<label class="mdl-textfield__label" for="c58b7544fd70d0a815b49f7a01a2397954f78ef8f5eec3fbfc0bab93130df473">Filter...</label>' +
			'</div>');
		search.find('input').val(fstr).keyup(function (event) {
			var self = this;
			if ((event.keyCode || e.which) == 13) {
				var hasChecked = false;
				if (this.value) {
					// search value + tick all search results
					checkboxes.find('input').each(function (i, inp) {
						if (!inp.checked && $(inp).data('value')) {
							inp.checked = true;
							querySet('filter_protokoll_leiter', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_protokoll_leiter_orig'] = '';
					delete query['filter_protokoll_leiter'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadprotokoll();
					
				} else {
					$('#table_protokoll').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_protokoll_leiterSearchFilter(this.value, function (result) {
					reload(self.value, result);
				});
			}
		});
		gui.append(search);

		var checkboxes = $("<div></div>").css({maxHeight: '200px', overflow: 'auto'});
		var items = <?php
			// TODO: deps-Variable füllen mit DV-Parametern vom DataView id
			echo json_encode(\DataView\Protokoll::getfilter_protokoll_leiterItemsByStringAction(''));
		?>;

		function reload(fstr, items) {
			// rerender checkbox list
			checkboxes.empty();
			checkboxes.append($('<i style="cursor: pointer;"><?php echo _('show all'); ?></i>').click(function () {
				search.find('input').val('');
				query['filter_protokoll_leiter_orig'] = '';
				delete query['filter_protokoll_leiter'];
				reload('', items);reloadprotokoll();
				
			})).append('<br/>');
			// NULL-Wert auch suchbar #2057 (kommt als ID=0 an, muss für die idlist in _null geändert werden)
			for (var i = 0; i < items.length; i++) {
				let value = (items[i].ID === '0' ? '_null' : items[i].ID);
				let descr = items[i].description;
				let checked = querySet('filter_protokoll_leiter', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_protokoll_leiterListMultiFilter("' + value + '", this)\' ' + (checked ? ' checked>': '> ')).data('value', value)).append($('<span></span>').text(descr).prepend('&nbsp;')).append('<br/>');
				}
			 }
		}
		reload(fstr, items);
		gui.append(checkboxes);

		return gui;
	}
    function changefilter_protokoll_creatorListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_protokoll_creator', val, cb.checked);
		  } else {
			  delete query['filter_protokoll_creator'];
		  }reloadprotokoll();
        
    }

		var ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout = null;
		function changefilter_protokoll_creatorSearchFilter(val, callback) {
			if(ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout) clearTimeout(ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout);

			ica90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785atimeout = setTimeout(function() {
				$.getJSON(reloadprotokoll({action: 'getfilter_protokoll_creatorItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_protokoll_creator_orig'] = val;
				});
			}, 300);
		}

	function getfilter_protokoll_creatorListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_protokoll_creator_orig']) ? json_encode($_GET['filter_protokoll_creator_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="ca90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785a" type="text">' +
			'<label class="mdl-textfield__label" for="ca90cdb2978046835e1b39e14c679edb0cdad6eb334899faf3b1ff286316785a">Filter...</label>' +
			'</div>');
		search.find('input').val(fstr).keyup(function (event) {
			var self = this;
			if ((event.keyCode || e.which) == 13) {
				var hasChecked = false;
				if (this.value) {
					// search value + tick all search results
					checkboxes.find('input').each(function (i, inp) {
						if (!inp.checked && $(inp).data('value')) {
							inp.checked = true;
							querySet('filter_protokoll_creator', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_protokoll_creator_orig'] = '';
					delete query['filter_protokoll_creator'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadprotokoll();
					
				} else {
					$('#table_protokoll').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_protokoll_creatorSearchFilter(this.value, function (result) {
					reload(self.value, result);
				});
			}
		});
		gui.append(search);

		var checkboxes = $("<div></div>").css({maxHeight: '200px', overflow: 'auto'});
		var items = <?php
			// TODO: deps-Variable füllen mit DV-Parametern vom DataView id
			echo json_encode(\DataView\Protokoll::getfilter_protokoll_creatorItemsByStringAction(''));
		?>;

		function reload(fstr, items) {
			// rerender checkbox list
			checkboxes.empty();
			checkboxes.append($('<i style="cursor: pointer;"><?php echo _('show all'); ?></i>').click(function () {
				search.find('input').val('');
				query['filter_protokoll_creator_orig'] = '';
				delete query['filter_protokoll_creator'];
				reload('', items);reloadprotokoll();
				
			})).append('<br/>');
			// NULL-Wert auch suchbar #2057 (kommt als ID=0 an, muss für die idlist in _null geändert werden)
			for (var i = 0; i < items.length; i++) {
				let value = (items[i].ID === '0' ? '_null' : items[i].ID);
				let descr = items[i].description;
				let checked = querySet('filter_protokoll_creator', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_protokoll_creatorListMultiFilter("' + value + '", this)\' ' + (checked ? ' checked>': '> ')).data('value', value)).append($('<span></span>').text(descr).prepend('&nbsp;')).append('<br/>');
				}
			 }
		}
		reload(fstr, items);
		gui.append(checkboxes);

		return gui;
	}
									function updateNumberprotokoll(col) {
										//var checklist = window.DataViewChecked['protokoll'][col];
										//if (checklist.id) {
											// checklist is online
											// TODO: check if cache is alive, otherwise reload from ajax, delay execution and return now
											//checklist.ranges = [[1,10000000]]; // mostly we use indirect idlists to tick all marks; so this is an approximation
										//}
										// checkboxes aktualisieren
										if (window.DataViewChecked && window.DataViewChecked['protokoll'] && window.DataViewChecked['protokoll'][col].ranges.length > 0) {
											$('.protokoll__mass-action').css('visibility', 'visible');
											$('.protokoll__action').css('visibility', 'hidden');
										} else {
											$('.protokoll__mass-action').css('visibility', 'hidden');
											$('.protokoll__action').css('visibility', 'visible');
										}
										$('.protokoll__checkbox').each(function (idx, x) {
											for (var cssclass of x.classList) {
												if (cssclass.startsWith('protokoll__checkbox-'+col+'-')) {
													var my_id = cssclass.substr(('protokoll__checkbox-'+col+'-').length);
													if (window.DataViewChecked) {
														x.MaterialCheckbox[checklist.has(my_id) ? 'check' : 'uncheck']();
													}
												}
											}
										});
									}
									function reloadprotokoll (params, returnUrl, onlyScroll, addPadding = 0) {
										// copy query
										let nq = JSON.parse(JSON.stringify(query));
										nq['parent_request'] = <?php echo json_encode(strtok(\FOP\Util::getBackUrl(), '?')); ?>;
										<?php if (isset($_GET['select'])) { ?>nq['select'] = 'select';<?php } ?>
										
										if (params) {
											for (var i in params) nq[i] = params[i];
											var action = nq['action'];
											delete nq['action'];
											let querystr = "DataView/Protokoll/" + action + "?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// direkt aufrufen (ist wohl ein Download oder so)
											if (returnUrl) return querystr;
											window.location.href = querystr;
										} else {
											let querystr;
											
											
											<?php if (((\FOP\User::getProtokoll())) && (!\FOP\User::getIsGuest())) { ?>
											delete nq['action'];
											querystr = "DataView/Protokoll/renderTabTable?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#protokoll-table")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#protokoll-table")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#protokoll-table");
												var top = tab.find('.fop-table-body-inner');
												var el;
												if (onlyScroll && (el = $('<div class="tabcontent">' + data + '</div>').find('.fop-table-body-inner'))) {
													// nur Scroll-Bereich ersetzen
													var paddingTop = parseInt(el.css('paddingTop') || '0px', 10);
													var minHeight = parseInt(el.css('minHeight'), 10)
													paddingTop += addPadding;
													minHeight += addPadding;
													top.css({paddingTop: paddingTop.toString()+'px', minHeight: minHeight.toString()+'px'}); // Offset
													el = el.children();
													top.empty();
													top.append(el);
													el = top; // top-upgrade doppelt machen, dadurch vermeiden wir das Array-upgrade => Performance
												} else {
													// gesamten Tab ersetzen
													tab.children().remove();
													el = tab.html('<div class="tabcontent">' + data + '</div>');
												}
												try {
													for (var i = 0; i < el.length; i++) upgradeDOM(el[i]);
												} catch (e) {
													console.log(e);
												}
												upgradeTable(el.find('.fop-table .fop-table-header')); // Falls es Tabellen-Layout ist: Spalten-Order anpassen
												flushURL(); // Neue URL in Titelleiste eintragen

												// Checkbox-Auswahl ankreuzen
												updateNumberprotokoll('ID');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#protokoll-table");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadprotokoll()"></div>');
											}
											<?php } ?>
											
										}
									}
									function checkprotokoll (id, col, checked) {
										// ID-Liste aufbauen
										if (!window.DataViewChecked) window.DataViewChecked = {};
										if (!window.DataViewChecked['protokoll']) window.DataViewChecked['protokoll'] = {};
										if (!window.DataViewChecked['protokoll'][col]) window.DataViewChecked['protokoll'][col] = new IDList();

										// Abfrage aller gecheckten IDs für eine Tabelle
										if (!id) {
											return window.DataViewChecked['protokoll'][col].toString();
										}

										// check all, check id
										if (id == 'all') {
											// TODO: umbauen #1289: 'all' auch nur auf ne idlist reduzieren
											if (checked) {
												$.get(reloadprotokoll({action: 'getids', col: col}, true), function (ids) {
													window.DataViewChecked['protokoll'][col] = new IDList(ids);
													updateNumberprotokoll(col);
												});
											} else {
												window.DataViewChecked['protokoll'][col] = new IDList();
												updateNumberprotokoll(col);
											}
										} else {
											var ids = new IDList(id);
											var allcb = $('#protokoll__all-checkbox');
											if (allcb[0]) {
												allcb[0].parentElement.MaterialCheckbox.uncheck(); // TODO: prüfen, ob Gruppen-CBs voll werden
											}
											if (checked == 'set') {
												window.DataViewChecked['protokoll'][col] = ids;
											} else for (id of ids.all()) {
												if (checked) {
													window.DataViewChecked['protokoll'][col].push(id);
												} else {
													window.DataViewChecked['protokoll'][col].remove(id);
												}
											}
											updateNumberprotokoll(col);
										}
									}
								</script><?php

    
  }

  public static function renderSpecialFilters() { 
    
    
    // --- BLOCK: main ---
    ?>
	
	<script type"text/javascript">
		function updateSpecialFilter(param, val) {
			query[param] = val.toString();reloadprotokoll();
			
		}

	</script>
	<?php
	
    
  }

  public static function renderTabTableAction() { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php if(((\FOP\User::getProtokoll()))) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onclick="
		var self = this;
		event.preventDefault();
		$.get(reloadprotokoll({action: 'open', fop_table: 'protokoll', fop_id: '_', fop_from: location.href}, true))
		.then(function () {
			window.open_url(self.href, false);
		});" href="<?php echo htmlentities(\TablesRouter\Protokoll::createURL2(['from' => $_GET['from'] ?? null, 'popup' => $_GET['popup'] ?? null])); ?>"><i class="material-icons">add</i> <?php echo(sprintf(_('create %s'), _('Protokoll'))); ?></a><?php } ?></div><?php 
								\FOP\User::getIsGuest();
								$itemheight = 32;
								$itemsperpage = ceil(1080 / $itemheight * 0.8);
								$page = (isset($_GET['page_protokoll']) ? intval($_GET['page_protokoll']) : 0);
								$addlines = (isset($_GET['addlines_protokoll']) ? intval($_GET['addlines_protokoll']) : 0);
								$firstitem = $page * $itemsperpage;
								$sqladdon = ' LIMIT ' . ($itemsperpage * 2) . ' OFFSET ' . ($firstitem);
								$data = self::getData($sqladdon, $_GET);
								$arr = $data["items"];
								$itemcount = $data["itemcount"];
								$lastPage = ceil($itemcount/$itemsperpage-1);
								// calculate width of first column: 67px + 32px for each shortcut
								$firstColumnWidth = 66 + 34 + 34;
								$additionalLines = 0;

									// Spaltenliste zuerst aufbauen, damit sie noch umsortiert werden kann
									$order = 1000;
									$columns = [];
									
										if(true){
											$col = [
												'id' => 'date',
												'desc' => _('Datum'),
												'order' => ++$order,
												'width' => 100, // default value
												'collapsed' => 0

											];
											$columns['date'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'bez',
												'desc' => _('Bezeichnung'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['bez'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'leiter',
												'desc' => _('Versammlungsleiter'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['leiter'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'creator',
												'desc' => _('Protokollant'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['creator'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'count',
												'desc' => _('Anzahl Anwesende'),
												'order' => ++$order,
												'width' => 60, // default value
												'collapsed' => 0

											];
											$columns['count'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'content',
												'desc' => _('Text'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['content'] = $col;
										}
									

									// gespeicherte Spaltenanordnung
									foreach (\FOP\Database::query('SELECT * FROM fop_dataview WHERE '.qi('user').' = ' . \FOP\Database::quote(\FOP\User::getID()) . ' AND dataview = ' . \FOP\Database::quote('protokoll'))->fetchAll(\PDO::FETCH_ASSOC) AS $column => $c) {
										if (isset($columns[$c['column']])) {
											$columns[$c['column']]['order'] = $c['order']; // order, width, collapsed
											$columns[$c['column']]['width'] = $c['width']; // order, width, collapsed
											$columns[$c['column']]['collapsed'] = $c['collapsed']; // order, width, collapsed
										}
									}

									// DOM vor-rendern
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='date'
												data-order='<?php echo intval($columns['date']['order']); ?>'
												data-width='<?php echo intval($columns['date']['width']); ?>'
												data-collapsed='<?php echo intval($columns['date']['collapsed']); ?>'
												style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}}, 600);
		date_filter(win, 'protokoll', 'date', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadprotokoll();  reloadprotokoll(); });
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'date ASC') {
			query['sort_protokoll'] = 'date DESC';
		 } else if (query['sort_protokoll'] == 'date DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'date ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Datum')); ?>'><?php echo(_('Datum')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'date ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'date DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_date']) || isset($_GET['range_max_protokoll_date']) || isset($_GET['deps_protokoll_date']) || isset($_GET['fullsearch_protokoll_date']) || isset($_GET['dynamic_protokoll_date']) || isset($_GET['search_protokoll_date']) || isset($_GET['searchnot_protokoll_date']) || isset($_GET['filter_protokoll_date'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['date']['header'] = ob_get_contents(); ob_end_clean();
											$columns['date']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='date'><span class='overflow-text' title="<?php echo htmlentities(($item['date']) ? strftime(_('dateformat_php2'), intval($item['date'])) : ''); ?>"><?php echo htmlentities(($item['date']) ? strftime(_('dateformat_php2'), intval($item['date'])) : ''); ?></span></div><?php
											};
											$columns['date']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='date'
													data-order='<?php echo intval($columns['date']['order']); ?>'
													data-width='<?php echo intval($columns['date']['width']); ?>'
													data-collapsed='<?php echo intval($columns['date']['collapsed']); ?>'
													style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='bez'
												data-order='<?php echo intval($columns['bez']['order']); ?>'
												data-width='<?php echo intval($columns['bez']['width']); ?>'
												data-collapsed='<?php echo intval($columns['bez']['collapsed']); ?>'
												style='width: <?php echo intval($columns['bez']['width']); ?>px; <?php if ($columns['bez']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}});
		
		var el = $('<div class=\'mdl-textfield mdl-js-textfield mdl-textfield--floating-label fop-floatsorter\' style=\'width: calc(100% - 42px);\'><input class=\'mdl-textfield__input\' style=\'display: inline-block;\' type=\'text\'><label class=\'mdl-textfield__input\'><?php echo(_('search')); ?></label></div>');
		win.append(el);
		var text = el.find('input');
		text.val(query['search_protokoll_bez'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_protokoll_bez'] = text.val(); } else { delete query['search_protokoll_bez']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_protokoll').find('.fop-table-row:first').click();} if (event.key === 'Escape') { win.close(); }});

		var el2 = $('<div class=\'mdl-textfield mdl-js-textfield mdl-textfield--floating-label\'><input class=\'mdl-textfield__input\' style=\'display: inline-block;\' type=\'text\'><label class=\'mdl-textfield__input\'><?php echo(htmlentities(htmlentities(_('filter_contains_not')))); ?></label></div>');
		win.append(el2);
		var text2 = el2.find('input');
		text2.val(query['searchnot_protokoll_bez'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_protokoll_bez'] = text2.val(); } else { delete query['searchnot_protokoll_bez']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_protokoll').find('.fop-table-row:first').click();} if (event.key === 'Escape') { win.close(); }});
	
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'bez ASC') {
			query['sort_protokoll'] = 'bez DESC';
		 } else if (query['sort_protokoll'] == 'bez DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'bez ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Bezeichnung')); ?>'><?php echo(_('Bezeichnung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'bez ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'bez DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_bez']) || isset($_GET['range_max_protokoll_bez']) || isset($_GET['deps_protokoll_bez']) || isset($_GET['fullsearch_protokoll_bez']) || isset($_GET['dynamic_protokoll_bez']) || isset($_GET['search_protokoll_bez']) || isset($_GET['searchnot_protokoll_bez']) || isset($_GET['filter_protokoll_bez'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['bez']['header'] = ob_get_contents(); ob_end_clean();
											$columns['bez']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['bez']['width']); ?>px; <?php if ($columns['bez']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='bez'><span class='overflow-text' title="<?php echo htmlentities($item['bez']); ?>"><?php echo htmlentities($item['bez']); ?></span></div><?php
											};
											$columns['bez']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='bez'
													data-order='<?php echo intval($columns['bez']['order']); ?>'
													data-width='<?php echo intval($columns['bez']['width']); ?>'
													data-collapsed='<?php echo intval($columns['bez']['collapsed']); ?>'
													style='width: <?php echo intval($columns['bez']['width']); ?>px; <?php if ($columns['bez']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='leiter'
												data-order='<?php echo intval($columns['leiter']['order']); ?>'
												data-width='<?php echo intval($columns['leiter']['width']); ?>'
												data-collapsed='<?php echo intval($columns['leiter']['collapsed']); ?>'
												style='width: <?php echo intval($columns['leiter']['width']); ?>px; <?php if ($columns['leiter']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}});
		
		win.append(getfilter_protokoll_leiterListMultiFilter()); win.find('input').first().focus();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'leiter ASC') {
			query['sort_protokoll'] = 'leiter DESC';
		 } else if (query['sort_protokoll'] == 'leiter DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'leiter ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Versammlungsleiter')); ?>'><?php echo(_('Versammlungsleiter')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'leiter ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'leiter DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_leiter']) || isset($_GET['range_max_protokoll_leiter']) || isset($_GET['deps_protokoll_leiter']) || isset($_GET['fullsearch_protokoll_leiter']) || isset($_GET['dynamic_protokoll_leiter']) || isset($_GET['search_protokoll_leiter']) || isset($_GET['searchnot_protokoll_leiter']) || isset($_GET['filter_protokoll_leiter'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['leiter']['header'] = ob_get_contents(); ob_end_clean();
											$columns['leiter']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['leiter']['width']); ?>px; <?php if ($columns['leiter']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='leiter'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['leiter'];
	$val = $item['leiter::description'];
	$canView = $item['leiter::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>
</div><?php
											};
											$columns['leiter']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='leiter'
													data-order='<?php echo intval($columns['leiter']['order']); ?>'
													data-width='<?php echo intval($columns['leiter']['width']); ?>'
													data-collapsed='<?php echo intval($columns['leiter']['collapsed']); ?>'
													style='width: <?php echo intval($columns['leiter']['width']); ?>px; <?php if ($columns['leiter']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='creator'
												data-order='<?php echo intval($columns['creator']['order']); ?>'
												data-width='<?php echo intval($columns['creator']['width']); ?>'
												data-collapsed='<?php echo intval($columns['creator']['collapsed']); ?>'
												style='width: <?php echo intval($columns['creator']['width']); ?>px; <?php if ($columns['creator']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}});
		
		win.append(getfilter_protokoll_creatorListMultiFilter()); win.find('input').first().focus();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'creator ASC') {
			query['sort_protokoll'] = 'creator DESC';
		 } else if (query['sort_protokoll'] == 'creator DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'creator ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Protokollant')); ?>'><?php echo(_('Protokollant')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'creator ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'creator DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_creator']) || isset($_GET['range_max_protokoll_creator']) || isset($_GET['deps_protokoll_creator']) || isset($_GET['fullsearch_protokoll_creator']) || isset($_GET['dynamic_protokoll_creator']) || isset($_GET['search_protokoll_creator']) || isset($_GET['searchnot_protokoll_creator']) || isset($_GET['filter_protokoll_creator'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['creator']['header'] = ob_get_contents(); ob_end_clean();
											$columns['creator']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['creator']['width']); ?>px; <?php if ($columns['creator']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='creator'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['creator'];
	$val = $item['creator::description'];
	$canView = $item['creator::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>
</div><?php
											};
											$columns['creator']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='creator'
													data-order='<?php echo intval($columns['creator']['order']); ?>'
													data-width='<?php echo intval($columns['creator']['width']); ?>'
													data-collapsed='<?php echo intval($columns['creator']['collapsed']); ?>'
													style='width: <?php echo intval($columns['creator']['width']); ?>px; <?php if ($columns['creator']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='count'
												data-order='<?php echo intval($columns['count']['order']); ?>'
												data-width='<?php echo intval($columns['count']['width']); ?>'
												data-collapsed='<?php echo intval($columns['count']['collapsed']); ?>'
												style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}});
		var von, bis; win.append('<div class=\'fop-floatsorter\'>' + window.i18n_von + '</div>').append(von = $('<input type=\'number\' step=\'any\'><br>').val(query['range_min_protokoll_count']).on('change keyup paste', function () { query['range_min_protokoll_count'] = von.val(); delete query['page_protokoll']; changed = true; }))
.append('<div>' + window.i18n_bis + '</div>').append(bis = $('<input type=\'number\' step=\'any\'>').val(query['range_max_protokoll_count']).on('change keyup paste', function () { query['range_max_protokoll_count'] = bis.val(); delete query['page_protokoll']; changed = true; }))
; von.focus(); von.select();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'count ASC') {
			query['sort_protokoll'] = 'count DESC';
		 } else if (query['sort_protokoll'] == 'count DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'count ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	" style='text-align: right;'>
													<span class='title-title' title='<?php echo(_('Anzahl Anwesende')); ?>'><?php echo(_('Anzahl Anwesende')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'count ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'count DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_count']) || isset($_GET['range_max_protokoll_count']) || isset($_GET['deps_protokoll_count']) || isset($_GET['fullsearch_protokoll_count']) || isset($_GET['dynamic_protokoll_count']) || isset($_GET['search_protokoll_count']) || isset($_GET['searchnot_protokoll_count']) || isset($_GET['filter_protokoll_count'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['count']['header'] = ob_get_contents(); ob_end_clean();
											$columns['count']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='count'><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($item['count'])); ?>
	</span></div><?php
											};
											$columns['count']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='count'
													data-order='<?php echo intval($columns['count']['order']); ?>'
													data-width='<?php echo intval($columns['count']['width']); ?>'
													data-collapsed='<?php echo intval($columns['count']['collapsed']); ?>'
													style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='content'
												data-order='<?php echo intval($columns['content']['order']); ?>'
												data-width='<?php echo intval($columns['content']['width']); ?>'
												data-collapsed='<?php echo intval($columns['content']['collapsed']); ?>'
												style='width: <?php echo intval($columns['content']['width']); ?>px; <?php if ($columns['content']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadprotokoll(); 
		}});
		
		var el = $('<div class=\'mdl-textfield mdl-js-textfield mdl-textfield--floating-label fop-floatsorter\' style=\'width: calc(100% - 42px);\'><input class=\'mdl-textfield__input\' style=\'display: inline-block;\' type=\'text\'><label class=\'mdl-textfield__input\'><?php echo(_('search')); ?></label></div>');
		win.append(el);
		var text = el.find('input');
		text.val(query['search_protokoll_content'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_protokoll_content'] = text.val(); } else { delete query['search_protokoll_content']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_protokoll').find('.fop-table-row:first').click();} if (event.key === 'Escape') { win.close(); }});

		var el2 = $('<div class=\'mdl-textfield mdl-js-textfield mdl-textfield--floating-label\'><input class=\'mdl-textfield__input\' style=\'display: inline-block;\' type=\'text\'><label class=\'mdl-textfield__input\'><?php echo(htmlentities(htmlentities(_('filter_contains_not')))); ?></label></div>');
		win.append(el2);
		var text2 = el2.find('input');
		text2.val(query['searchnot_protokoll_content'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_protokoll_content'] = text2.val(); } else { delete query['searchnot_protokoll_content']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_protokoll').find('.fop-table-row:first').click();} if (event.key === 'Escape') { win.close(); }});
	
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_protokoll'] == 'content ASC') {
			query['sort_protokoll'] = 'content DESC';
		 } else if (query['sort_protokoll'] == 'content DESC') {
		 	delete query['sort_protokoll'];
		 } else {
			query['sort_protokoll'] = 'content ASC';
		 }
		 reloadprotokoll();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Text')); ?>'><?php echo(_('Text')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'content ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_protokoll']) && $_GET['sort_protokoll'] == 'content DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_protokoll_content']) || isset($_GET['range_max_protokoll_content']) || isset($_GET['deps_protokoll_content']) || isset($_GET['fullsearch_protokoll_content']) || isset($_GET['dynamic_protokoll_content']) || isset($_GET['search_protokoll_content']) || isset($_GET['searchnot_protokoll_content']) || isset($_GET['filter_protokoll_content'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['content']['header'] = ob_get_contents(); ob_end_clean();
											$columns['content']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['content']['width']); ?>px; <?php if ($columns['content']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='content'><?php 
	$html = preg_replace('/^<!DOCTYPE.+?>/m', '', \FOP\Sanitizers::htmlentities_decode($item['content'])); ?>
	<span style="display: block;" onmouseenter='handleHTMLOverlay(event, &apos;#overlayFormcontent<?php echo htmlentities($item['ID'] ?? 'fail'); ?>&apos;);' onmouseleave='handleHTMLOverlayFade(event, &apos;#overlayFormcontent<?php echo htmlentities($item['ID'] ?? 'fail'); ?>&apos;);' ng-non-bindable><?php echo htmlentities(mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($item['content'])))), 0, 50) . (strlen(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($item['content']))))) >= 50 ? '...' : ''));  ?></span>
	<div class="overlay-iframe" id="overlayFormcontent<?php echo $item['ID'] ?? 'fail'; ?>">
		<div class="iframe-container" id="iframecontainer">
			<?php echo \FOP\Util::SanitizeUserHtml($html); ?>
		</div>
	</div>
</div><?php
											};
											$columns['content']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='content'
													data-order='<?php echo intval($columns['content']['order']); ?>'
													data-width='<?php echo intval($columns['content']['width']); ?>'
													data-collapsed='<?php echo intval($columns['content']['collapsed']); ?>'
													style='width: <?php echo intval($columns['content']['width']); ?>px; <?php if ($columns['content']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									

									// sort by order
									uasort($columns, function ($a, $b) {
										return $a['order'] - $b['order'];
									});
									?>
									<style type='text/css'>
										#protokoll-table .fop-table-header {
											height: <?php echo 32; ?>px;
										}
										#protokoll-table .fop-table-header .fop-table-column .title,
										#protokoll-table .fop-column-handle,
										#protokoll-table .fop-table-row,
										#protokoll-table .fop-table-row .fop-table-column,
										#protokoll-table .fop-table-column-multicontrol,
										#protokoll-table .fop-filter-button {
											height: 32px;
											line-height: 32px;
										}
										</style>
											<div class="fop-table" data-table-id="protokoll">
											<div class="fop-legend"></div>
											<div class="fop-filter-string-wrapper"><div class="fop-filter-string"><label>Filter:</label> <span><?php echo self::getFilterHTML($_GET); ?></span></div></div>
											
											<?php if (isset($_GET['select'])) { echo '<br>'; } ?>
											<div class="fop-table-header">
											<?php if (!isset($_GET['select'])) { ?>
												<div class="fop-table-column noprint" style="width: <?php echo json_encode($firstColumnWidth); ?>px;">
													
													<div class="fop-table-column-multicontrol">
													<label class="mdl-checkbox mdl-js-checkbox"  style='width: auto;' for="protokoll__all-checkbox">
														<input class="mdl-checkbox__input" id="protokoll__all-checkbox" type="checkbox" onchange="checkprotokoll('all', 'ID', this.checked);">
														</label>
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon protokoll__mass-action" style='visibility: hidden;' onclick="$.get('DataView/Protokoll/permissions?id=' + checkprotokoll(null, 'ID'), function (data) { for (var method in data) if (method != '__cnt') { var btn = $('[data-interaction-name=&quot;' + method + '&quot;]'); if (data[method] >= 1) btn.show(); else btn.hide(); btn.find('.cnt').text(data[method]); }; }); dropDownFixPosition($(this), $(this).next())">
															<i class="material-icons">more_vert</i>
														</button>
														<ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu">
															<?php
		if(true) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="filterall" style="margin-right:auto; text-align:left;"
					onclick="for (key in query) if (key.indexOf('range_min_protokoll_') == 0 || key.indexOf('range_max_protokoll_') == 0 || key.indexOf('deps_protokoll_') == 0 || key.indexOf('fullsearch_protokoll_') == 0 || key.indexOf('dynamic_protokoll_') == 0 || key.indexOf('search_protokoll_') == 0 || key.indexOf('searchnot_protokoll_') == 0 || key.indexOf('filter_protokoll_') == 0) delete query[key]; reloadprotokoll(); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">list</i></span><span class="fop-menu-caption" title="<?php echo(_('view all elements')); ?>"><?php echo(_('view all elements')); ?> 
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="filteronly" style="margin-right:auto; text-align:left;"
					onclick="query['filter_protokoll_ID'] = checkprotokoll(null, 'ID'); delete query['page_protokoll']; reloadprotokoll(); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">arrow_forward</i></span><span class="fop-menu-caption" title="<?php echo(_('view only these elements')); ?>"><?php echo(_('view only these elements')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="filterrange" style="margin-right:auto; text-align:left;"
					onclick="
		var ticks = new IDList(checkprotokoll(null, 'ID'));
		var range = prompt('Bitte geben Sie den Bereich ein', '1-' + ticks.count());
		var newticks = new IDList();
		if (range) {
			range = range.split('-');
			if (range.length == 1) {
				range.push(range[0]);
			}
			var skip = (range[0] || 1) - 1;
			var take = (range[1] || Infinity) - skip;
			for (var item of ticks.all()) {
				if (skip > 0) {
					skip--;
				} else if (take > 0) {
					newticks.push(item);
					take--;
				} else break;
			}
			checkprotokoll(newticks, 'ID', 'set');
		} $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">colorize</i></span><span class="fop-menu-caption" title="<?php echo(_('limit range')); ?>"><?php echo(_('limit range')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getProtokoll()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="delete" style="margin-right:auto; text-align:left;"
					onclick="if(!confirm(<?php echo htmlentities(json_encode(_('confirmdelete'))); ?>)) return;$.get('Tables/Protokoll/delete?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkprotokoll(null, 'ID'))).then(function () { reloadprotokoll(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?>
														</ul>
														<!-- column hide -->
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon" onclick="dropDownFixPosition($(this), $(this).next())">
															<i class="material-icons">visibility</i>
														</button>
														<ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu">
															<?php foreach ($columns AS $col) { ?>
																<li class="mdl-list__item mdl-button" onclick="
																	var isVisible = this.firstElementChild.innerText !== 'clear';
																	this.firstElementChild.innerText = isVisible ? 'clear' : 'visibility'; // switch icon
																	tableColumnVisibility('protokoll', <?php echo htmlentities(json_encode($col['id'])); ?>, !isVisible); // the rest is up to a helper function in layout/tables.fop
																	">
																	<i class="material-icons"><?php if ($col['collapsed']) { echo 'clear'; } else { echo 'visibility'; }?></i>
																	<?php echo htmlentities($col['desc']); ?>
																</li>
															<?php } ?>
															<li class="mdl-list__item mdl-button" onclick="
																$.get('FOP/Index/dataview?data='+encodeURIComponent(JSON.stringify({dataview: 'protokoll', reset: true}))).then(function () { location.reload(); });
																">
																<i class="material-icons">refresh</i>
																<?php echo _('reset all'); ?>
															</li>
														</ul>
													</div>
												</div><?php }
												
												foreach ($columns AS $col) {
													// Spalten-Überschrift rendern
													echo $col['header'];
												} ?>
											 </div>
											
											<div class="fop-table-body" id="table_protokoll" <?php \EasyEditor\Navigation::printScroll('dv.Protokoll', '/* scroll horiz */ this.previousElementSibling.firstElementChild.style.marginLeft = \'-\' + this.scrollLeft + \'px\';
												/* scroll verti */
												var self = this;
												if (window.DataViewScrollReloadTimeout) clearTimeout(window.DataViewScrollReloadTimeout);
												window.DataViewScrollReloadTimeout = setTimeout(function () {
													var currentPage = parseInt(query[\'page_protokoll\'] || 0);
													var paddingTop = parseInt( self.lastElementChild.style.paddingTop, 10);
													var wantedPage = Math.max(0, currentPage + Math.floor((self.scrollTop - paddingTop) / ' . ($itemheight * $itemsperpage) . '));
													if (wantedPage != currentPage) {
														query[\'page_protokoll\'] = wantedPage;
														reloadprotokoll(undefined, undefined, true);
													}
												}, 50);
											'); ?>>
												<div class="fop-table-body-inner" style="min-height: <?php echo 12 + $itemheight * ($itemcount + $additionalLines); ?>px; padding-top: <?php echo $itemheight * $itemsperpage * $page; ?>px;">
												<?php foreach($arr as $itempos => $item) {
													?>
													<div class="fop-table-row" style="" data-protokoll-id="<?php echo htmlentities($item['ID']); ?>"<?php if (isset($item['ID'])){
														if (isset($_GET['select']) && isset($_GET['from'])) {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) window.location.href=' . htmlentities(json_encode($_GET['from'] . '&colvalue=' . urlencode($item['ID']))) . ';" ';
														} else {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) open_url(reloadprotokoll({action: \'open\', fop_table: \'protokoll\', fop_id: ' .  htmlentities(json_encode($item['ID'])) . ', fop_from: location.href}, true), false);"';
														}
													}?> >

													<?php if (!isset($_GET['select'])) { ?>
													<div class='fop-table-column noprint' style="width: <?php echo json_encode($firstColumnWidth); ?>px;" onclick="$(this).find('input[type=checkbox]').first().click(); event.stopPropagation();">
													<label onclick="event.stopPropagation();" class="mdl-checkbox mdl-js-checkbox protokoll__checkbox protokoll__checkbox protokoll__checkbox-ID-<?php echo htmlentities($item['ID']); ?>" style="width: auto;" for="protokoll__<?php echo htmlentities($itempos); ?>-checkbox">
													<input class="mdl-checkbox__input" id="protokoll__<?php echo htmlentities($itempos); ?>-checkbox" type="checkbox" onchange="<?php if (isset($item['ID'])) echo 'checkprotokoll(' . htmlentities(json_encode($item['ID'])) . ', \'ID\', this.checked); ' ?>">
													</label><button type="button" class="mdl-button mdl-js-button mdl-button--icon protokoll__action" onclick="
														event.stopPropagation();
														dropDownFixPosition($(this), $(this).next());
														">
														<i class="material-icons">more_vert</i>
													</button><ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu" id="fop-scroll-menu-protokoll-action-<?php echo $item['ID'] ?? 0; ?>">
														<?php
		if(isset($item['ID']) && $item['operation::view']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="view" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Protokoll::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick=" if (!event.ctrlKey) { open_url(reloadprotokoll({action: 'open', fop_table: 'protokoll', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), false); return false; } $(this).closest('.overlay').click(); return false;  
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">find_in_page</i></span><span class="fop-menu-caption" title="<?php echo(_('open')); ?>"><?php echo(_('open')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="edit" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Protokoll::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">edit</i></span><span class="fop-menu-caption" title="<?php echo(_('edit')); ?>"><?php echo(_('edit')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && ((\FOP\User::getDokument())) && $item['operation::0a198a3b3385f8f2e55d32198f62adfc8843fdf576fc6bbe768a3ce7a6fe462c'] && $item['operation::DF38Sz26'] && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_doc_to-protokoll" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Doc::createURL2(['column_to-protokoll' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, true);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Dokument'))); ?>"><?php echo(sprintf(_('create %s'), _('Dokument'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && ((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll())) && $item['operation::8a32b22975ac7c6317b1f45149bc390684b38614fdf46d4c34cba92526aef946'] && $item['operation::DF38Sz26']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_protokollPunkt_protokoll" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\ProtokollPunkt::createURL2(['column_protokoll' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Protokoll-Punkt'))); ?>"><?php echo(sprintf(_('create %s'), _('Protokoll-Punkt'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::delete']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="delete" style="margin-right:auto; text-align:left;" href="#"
				onclick="if(!confirm(<?php echo htmlentities(json_encode(_('confirmdelete'))); ?>)) return false;   $.get('Tables/Protokoll/delete?ajax&id=<?php echo htmlentities($item['ID']);?>&from=<?php echo htmlentities(\FOP\Util::getBackUrl());?>').then(function () { reloadprotokoll(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?></span>
			</a>
		<?php } ?>
													</ul><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) {
			?><a class="mdl-button mdl-js-button mdl-button--icon tbl-link" data-tbl="protokoll" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="edit" href="<?php echo htmlentities(\TablesRouter\Protokoll::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();    reloadprotokoll();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, false);
					}
					event.preventDefault();"
				title="<?php echo(_('edit')); ?>">
				<i class="material-icons">edit</i>
			</a><?php } ?><?php
		if(isset($item['ID']) && $item['operation::view']) {
			?><a class="mdl-button mdl-js-button mdl-button--icon tbl-link" data-tbl="protokoll" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="view" href="<?php echo htmlentities(\TablesRouter\Protokoll::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();  if (!event.ctrlKey) { open_url(reloadprotokoll({action: 'open', fop_table: 'protokoll', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), false); return false; }  reloadprotokoll();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, false);
					}
					event.preventDefault();"
				title="<?php echo(_('open')); ?>">
				<i class="material-icons">find_in_page</i>
			</a><?php } ?>
													</div><?php } ?><?php
													
													foreach ($columns AS $col) {
														$col['render']($item);
													}
													?></div>
												 <?php }?>

													</div>
												</div>

												
												
												</div><?php
												
	
    
  }

  public static function getidsAction($col) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
			$q = \FOP\Database::query('SELECT t.'.qi($col).' '.self::getSQL($_GET));
			$result = new \FOP\IDList();
			while ($item = $q->fetchColumn()) {
				$result->push($item);
			}
			die($result->toString());

    
  }

  public static function permissionsAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
		$ids = new \FOP\IDList($id);
		header('Content-Type: application/json');
		
		$perms = \FOP\Database::query('SELECT COUNT(*) AS __cnt, SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filteronly').', SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filterrange').', SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filterall').', SUM(CASE (('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('delete').' FROM '.qi('protokoll').' WHERE ' . $ids->toSQL(qi('ID')))->fetch(\PDO::FETCH_ASSOC);
		
		return $perms;
	
    
  }

  public static function getSQL($params) { 
    
    
    // --- BLOCK: dependency-protokoll ---
    
		if (isset($params['select']) && $params['select'] == 'protokoll') {
			$deps = [];
		}
	
    // --- BLOCK: dependency-protokollNullDMS ---
    
		if (isset($params['select']) && $params['select'] == 'protokollNullDMS') {
			$deps = [];
		}
	
    // --- BLOCK: main ---
    
								// returns a sql snippet 'FROM (...) AS t WHERE' where you can prepend your select clauses and append your ORDER LIMIT
								$sql = 'FROM (SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* bez */ '.qi('bez').' AS '.qi('bez').',
									/* content */ '.qi('content').' AS '.qi('content').',
									/* count */ '.qi('count').' AS '.qi('count').',
									/* creator */ '.qi('creator').' AS '.qi('creator').',
									/* creator::canView */ '.qi('ref:creator').'.'.qi('creator:canView').' AS '.qi('creator::canView').',
									/* creator::description */ '.qi('ref:creator').'.'.qi('creator:description').' AS '.qi('creator::description').',
									/* date */ '.qi('date').' AS '.qi('date').',
									/* leiter */ '.qi('leiter').' AS '.qi('leiter').',
									/* leiter::canView */ '.qi('ref:leiter').'.'.qi('leiter:canView').' AS '.qi('leiter::canView').',
									/* leiter::description */ '.qi('ref:leiter').'.'.qi('leiter:description').' AS '.qi('leiter::description').',
									/* operation::0a198a3b3385f8f2e55d32198f62adfc8843fdf576fc6bbe768a3ce7a6fe462c */ '.\FOP\Database::quote(\FOP\User::getProtokoll()).' AS '.qi('operation::0a198a3b3385f8f2e55d32198f62adfc8843fdf576fc6bbe768a3ce7a6fe462c').',
									/* operation::8a32b22975ac7c6317b1f45149bc390684b38614fdf46d4c34cba92526aef946 */ '.\FOP\Database::quote(\FOP\User::getProtokoll()).' AS '.qi('operation::8a32b22975ac7c6317b1f45149bc390684b38614fdf46d4c34cba92526aef946').',
									/* operation::DF38Sz26 */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::DF38Sz26').',
									/* operation::create */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::create').',
									/* operation::delete */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::delete').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::view').',
									1
								FROM '.qi('protokoll').' '.qi('protokoll').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('leiter:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('leiter:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('leiter:canView').' FROM '.qi('mitglied').') '.qi('ref:leiter').' ON '.qi('ref:leiter').'.'.qi('leiter:ID').' = '.qi('leiter').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('creator:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('creator:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('creator:canView').' FROM '.qi('mitglied').') '.qi('ref:creator').' ON '.qi('ref:creator').'.'.qi('creator:ID').' = '.qi('creator').'
								WHERE ((('.\FOP\Database::quote(\FOP\User::getProtokoll()).')))
									AND (' . (isset($_GET['select']) && $_GET['select'] == 'protokoll' ? 'TRUE' : 'TRUE') . ')
									AND (' . (isset($_GET['select']) && $_GET['select'] == 'protokollNullDMS' ? 'TRUE' : 'TRUE') . ')) AS t
								LEFT JOIN '.qi('mitglied').' AS '.qi('sorter-leiter').' ON t.'.qi('leiter').' = '.qi('sorter-leiter').'.'.qi('ID').'
								LEFT JOIN '.qi('mitglied').' AS '.qi('sorter-creator').' ON t.'.qi('creator').' = '.qi('sorter-creator').'.'.qi('ID').'
								WHERE ' . (isset($params['range_min_protokoll_count']) ? ($params['range_min_protokoll_count'] !== '' && is_numeric($params['range_min_protokoll_count']) ? 't.'.qi('count').' >= ' . \FOP\Database::quote($params['range_min_protokoll_count']) . ' AND ' : '') : '') . 
								(isset($params['range_min_protokoll_date']) ? ($params['range_min_protokoll_date'] !== '' && is_numeric($params['range_min_protokoll_date']) ? 't.'.qi('date').' >= ' . \FOP\Database::quote($params['range_min_protokoll_date']) . ' AND ' : '') : '') . 
								(isset($params['range_max_protokoll_count']) ? ($params['range_max_protokoll_count'] !== '' && is_numeric($params['range_max_protokoll_count']) ? 't.'.qi('count').' <= ' . \FOP\Database::quote($params['range_max_protokoll_count']) . ' AND ' : '') : '') . 
								(isset($params['range_max_protokoll_date']) ? ($params['range_max_protokoll_date'] !== '' && is_numeric($params['range_max_protokoll_date']) ? 't.'.qi('date').' <= ' . \FOP\Database::quote($params['range_max_protokoll_date']) . ' AND ' : '') : '') . 
								(isset($params['filter_protokoll_date']) ? ($params['filter_protokoll_date'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_date']))->toSQL('t.'.qi('date').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_bez']) ? ($params['filter_protokoll_bez'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_bez']))->toSQL('t.'.qi('bez').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_leiter']) ? ($params['filter_protokoll_leiter'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_leiter']))->toSQL('t.'.qi('leiter').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_creator']) ? ($params['filter_protokoll_creator'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_creator']))->toSQL('t.'.qi('creator').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_count']) ? ($params['filter_protokoll_count'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_count']))->toSQL('t.'.qi('count').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_content']) ? ($params['filter_protokoll_content'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_content']))->toSQL('t.'.qi('content').'') . ') AND ') : '') : '') . 
								(isset($params['filter_protokoll_ID']) ? ($params['filter_protokoll_ID'] !== '' ? ('(' . (new \FOP\IDList($params['filter_protokoll_ID']))->toSQL('t.'.qi('ID').'') . ') AND ') : '') : '') . 
								(isset($params['search_protokoll_bez']) ? 't.'.qi('bez').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_protokoll_bez'] . '%') . ' AND ' : '') . 
								(isset($params['search_protokoll_content']) ? 't.'.qi('content').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_protokoll_content'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_protokoll_bez']) ? 'NOT t.'.qi('bez').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_protokoll_bez'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_protokoll_content']) ? 'NOT t.'.qi('content').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_protokoll_content'] . '%') . ' AND ' : '') . 
								(isset($params['search_protokoll']) ? '(' . 't.'.qi('bez').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_protokoll'] . '%') . ' OR ' . 't.'.qi('content').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_protokoll'] . '%') . ') AND ' : '') . 
								'
								 TRUE ';
								return $sql;
	
    
  }

  public static function getfilter_protokoll_leiterItemsByStringAction($fstr) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
		// Auf aktive DataView-Items einschränken
		$params = $_GET;
		unset($params['filter_protokoll_leiter']);
		return \Types\Mitglied::getItems(null, -1, $fstr, ''.qi('ID').' IN (SELECT DISTINCT t.'.qi('leiter').''.self::getSQL($params).')');
	

    
  }

  public static function getfilter_protokoll_creatorItemsByStringAction($fstr) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
		// Auf aktive DataView-Items einschränken
		$params = $_GET;
		unset($params['filter_protokoll_creator']);
		return \Types\Mitglied::getItems(null, -1, $fstr, ''.qi('ID').' IN (SELECT DISTINCT t.'.qi('creator').''.self::getSQL($params).')');
	

    
  }

  public static function getData($sqladdon, $params, $stream = false ) { 
    
    
    // --- BLOCK: main ---
    
								$sql = self::getSQL($params);

								$order = (\FOP\Util::array_value(array(
									'leiter ASC' => 'ORDER BY '.qi('sorter-leiter').'.'.qi('name').' , '.qi('sorter-leiter').'.'.qi('vorname').' ',
									'creator ASC' => 'ORDER BY '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('name').' , '.qi('sorter-creator').'.'.qi('vorname').' , '.qi('sorter-creator').'.'.qi('vorname').' , '.qi('sorter-creator').'.'.qi('vorname').' , '.qi('sorter-creator').'.'.qi('vorname').' , '.qi('sorter-creator').'.'.qi('vorname').' , '.qi('sorter-creator').'.'.qi('vorname').' ',
									'leiter DESC' => 'ORDER BY '.qi('sorter-leiter').'.'.qi('name').' DESC, '.qi('sorter-leiter').'.'.qi('vorname').' DESC',
									'creator DESC' => 'ORDER BY '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('name').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC, '.qi('sorter-creator').'.'.qi('vorname').' DESC',
									'content ASC' => 'ORDER BY t.'.qi('content').' ASC',
									'bez ASC' => 'ORDER BY t.'.qi('bez').' ASC',
									'count ASC' => 'ORDER BY t.'.qi('count').' ASC',
									'date ASC' => 'ORDER BY t.'.qi('date').' ASC',
									'content DESC' => 'ORDER BY t.'.qi('content').' DESC',
									'bez DESC' => 'ORDER BY t.'.qi('bez').' DESC',
									'count DESC' => 'ORDER BY t.'.qi('count').' DESC',
									'date DESC' => 'ORDER BY t.'.qi('date').' DESC',
									'' => ''), isset($params['sort_protokoll']) ? $params['sort_protokoll'] : '') ?: '');
								// wenn sqladdon bereits ein ORDER enthält, kein order aufbauen
								if (strpos($sqladdon, 'ORDER') !== false) {
									$order = '';
								}
								if ($stream) {
									// als Stream (währenddessen darf keine weitere SQL-Query laufen) für große Datenmengen und Statistiken
									$result = (function () use ($sql, $order, $sqladdon) {
										$stream = \FOP\Database::query('SELECT t.* ' . $sql . $order . $sqladdon);
										while ($item = $stream->fetch(\PDO::FETCH_ASSOC)) {
											$item['date'] = intval($item['date']);
											$item['leiter'] = \FOP\Sanitizers::null_converter($item['leiter']);
											$item['creator'] = \FOP\Sanitizers::null_converter($item['creator']);
											$item['count'] = \Types\Integer::unpack($item['count']);
											
											yield $item;
										}
									})();
								} else {
									// als RAM-Array
									$result = \FOP\Database::query('SELECT t.* ' . $sql . $order . $sqladdon);
									$arr = $result->fetchAll(\PDO::FETCH_ASSOC);
									$itemcount = count($arr);

									foreach($arr as $i => &$item){
										$item['date'] = intval($item['date']);
										$item['leiter'] = \FOP\Sanitizers::null_converter($item['leiter']);
										$item['creator'] = \FOP\Sanitizers::null_converter($item['creator']);
										$item['count'] = \Types\Integer::unpack($item['count']);
										
									}
									unset($item);

									$result = ["items" => $arr, "itemcount" => $itemcount];

									
								}

								return $result;
	
    
  }

  public static function getFilterHTML($params, $delimiter = ', ' , $showButton = true ) { 
    
    
    // --- BLOCK: main ---
    
		// Contract: ist showButton == false, sollten keine HTML-Tags im Output enthalten sein (Verwendung in Dateinamen!!)
		$filters = [];
		
	if (isset($params['range_min_protokoll_count']) && isset($params['range_max_protokoll_count'])) {
		array_push($filters, _('Anzahl Anwesende') . ': ' . (\Types\Integer::print($params['range_min_protokoll_count'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_protokoll_count'])
	));
	} else if (isset($params['range_min_protokoll_count'])) {
		array_push($filters, _('Anzahl Anwesende') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_protokoll_count'])
	));
	} else if (isset($params['range_max_protokoll_count'])) {
		array_push($filters, _('Anzahl Anwesende') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_protokoll_count'])
	));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_protokoll_date'])
		&& isset($params['range_max_protokoll_date'])
		&& (date('d', $params['range_min_protokoll_date']) == '01') //check first day of month
		&& (date('d', $params['range_max_protokoll_date']) == date('t', $params['range_max_protokoll_date'])) //check last day of month
		&& (date('Y-m', $params['range_min_protokoll_date']) == date('Y-m', $params['range_max_protokoll_date'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Datum') . ': ' . strftime('%B', $params['range_min_protokoll_date']) . ' ' . date('Y', $params['range_min_protokoll_date']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_protokoll_date'])
		&& isset($params['range_max_protokoll_date'])
		&& (date('Y-m-d', $params['range_min_protokoll_date']) == (date('Y-m-d', $params['range_max_protokoll_date'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('last day', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('next day', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('next day', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Datum') . ': ' . date('d.m.Y', $params['range_min_protokoll_date']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_protokoll_date'])
		&& isset($params['range_max_protokoll_date'])
		&& (date('Y', $params['range_min_protokoll_date']) == (date('Y', $params['range_max_protokoll_date'])))
		&& ((date('m-d', $params['range_min_protokoll_date']) == '01-01'))
		&& ((date('m-d', $params['range_max_protokoll_date']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_protokoll_date']).'&apos;;
				reloadprotokoll(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Datum') . ': ' . date('Y', $params['range_min_protokoll_date']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_protokoll_date'])
		&& isset($params['range_max_protokoll_date'])
		&& ( (
		 ((date('m-d', $params['range_min_protokoll_date']) == '01-01'))
		&& ((date('m-d', $params['range_max_protokoll_date']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_protokoll_date']) == '04-01'))
		&& ((date('m-d', $params['range_max_protokoll_date']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_protokoll_date']) == '07-01'))
		&& ((date('m-d', $params['range_max_protokoll_date']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_protokoll_date']) == '10-01'))
		&& ((date('m-d', $params['range_max_protokoll_date']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_protokoll_date']).'&apos;;
					query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_protokoll_date']).'&apos;;
					reloadprotokoll(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_protokoll_date&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_protokoll_date']).'&apos;;
				query[&apos;range_max_protokoll_date&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_protokoll_date']).'&apos;;
				reloadprotokoll(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Datum') . ': Q' . (ceil((date('m', $params['range_min_protokoll_date']))/3)) . ' (' . date('d.m.', $params['range_min_protokoll_date']) . ' - ' . date('d.m.Y', $params['range_max_protokoll_date']) . ')')
		]);
	}
	else if (isset($params['range_min_protokoll_date']) && isset($params['range_max_protokoll_date'])) {
		array_push($filters, _('Datum') . ': ' . (($params['range_min_protokoll_date']) ? strftime(_('dateformat_php2'), intval($params['range_min_protokoll_date'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_protokoll_date']) ? strftime(_('dateformat_php2'), intval($params['range_max_protokoll_date'])) : ''));
	} else if (isset($params['range_min_protokoll_date'])) {
		array_push($filters, _('Datum') . ': ' . _('filters_from') . ' ' . (($params['range_min_protokoll_date']) ? strftime(_('dateformat_php2'), intval($params['range_min_protokoll_date'])) : ''));
	} else if (isset($params['range_max_protokoll_date'])) {
		array_push($filters, _('Datum') . ': ' . _('filters_to') . ' ' . (($params['range_max_protokoll_date']) ? strftime(_('dateformat_php2'), intval($params['range_max_protokoll_date'])) : ''));
	}if (isset($params['filter_protokoll_date'])) {
		if ($params['filter_protokoll_date'] == '_null') {
			array_push($filters, _('Datum') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_date']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Datum') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_protokoll_bez'])) {
		if ($params['filter_protokoll_bez'] == '_null') {
			array_push($filters, _('Bezeichnung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_bez']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Bezeichnung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_protokoll_count'])) {
		if ($params['filter_protokoll_count'] == '_null') {
			array_push($filters, _('Anzahl Anwesende') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_count']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Anzahl Anwesende') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_protokoll_content'])) {
		if ($params['filter_protokoll_content'] == '_null') {
			array_push($filters, _('Text') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_content']))->all() AS $val) {
				$value = mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($val)))), 0, 20) . (strlen($val) >= 20 ? '...' : '');
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Text') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_protokoll_leiter'])) {
		if ($params['filter_protokoll_leiter'] == '_null') {
			array_push($filters, _('Versammlungsleiter') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_leiter']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Versammlungsleiter') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_protokoll_creator'])) {
		if ($params['filter_protokoll_creator'] == '_null') {
			array_push($filters, _('Protokollant') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_protokoll_creator']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Protokollant') . ': ' . implode(', ', $values));
		}
	}if (isset($params['search_protokoll_bez'])) {
		array_push($filters, _('bez') . ' ' . _('filter_contains') . ' ' . $params['search_protokoll_bez']);
	}if (isset($params['search_protokoll_content'])) {
		array_push($filters, _('content') . ' ' . _('filter_contains') . ' ' . $params['search_protokoll_content']);
	}if (isset($params['searchnot_protokoll_bez'])) {
		array_push($filters, _('bez') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_protokoll_bez']);
	}if (isset($params['searchnot_protokoll_content'])) {
		array_push($filters, _('content') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_protokoll_content']);
	}
		if (count($filters)) {
			$result = implode($delimiter, array_map(function ($filter) {
				if (is_array($filter)) {
					return implode('', $filter);
				}
				return htmlentities($filter);
			}, $filters))
			// Button, um Filter zu entfernen
			. ($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="for (var q in query) {if (q.includes(\'_protokoll_\')) delete query[q];} reloadprotokoll(); ">clear</i>' : '');
		} else {
			$result = _('no_filter');
		}
		return $result;
	
    
  }

  public static function openAction($fop_table, $fop_id, $fop_from) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    

if ($fop_table == 'protokoll') {
	\FOP\Session::setPayload('dv-protokoll', [
		'id' => 'protokoll',
		'tbl' => 'protokoll',
		'idcol' => 'ID',
		'prev' => \DataViewRouter\Protokoll::stepURL('protokoll', 'XXX', -1),
		'next' => \DataViewRouter\Protokoll::stepURL('protokoll', 'XXX',  1),
		'from' => $fop_from
	]);
	
	if ($fop_id == '_') return; // nur Rückreferenz setzen, nicht öffnen
	$params = [];
	if (isset($_GET['popup'])) $params['popup'] = true;
	if (isset($_GET['from'])) $params['from'] = $_GET['from'];
	$params['id'] = $fop_id;
	
	$url = \TablesRouter\Protokoll::viewURL2($params);
	header('Location: ' . $url);
}

die();
    
  }

  public static function stepAction($tbl, $id, $step) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	$dv = \FOP\Session::getPayload('dv-'.$tbl);
	$url = $dv['from'];
	$parts = parse_url($url);
	parse_str($parts['query'], $query);
	$data = self::getData('', $query);
	$col = $dv['idcol'];
	$ids = array_map(function ($x) use ($col) {return $x[$col];}, $data['items']);
	if (!count($ids)) {
		header('Location: ' . \FOP\Util::getCurrentBaseurl() . 'Tables/' . preg_replace('/[^a-zA-Z0-9_]/', '_', ucfirst($dv['tbl'])));
		die();
	}
	$idx = array_search($id, $ids);
	$idx += count($ids) + $step;
	$idx = $idx % count($ids);
	header('Location: ' . \FOP\Util::getCurrentBaseurl() . 'Tables/' . preg_replace('/[^a-zA-Z0-9_]/', '_', ucfirst($dv['tbl'])) . '/view?id=' . urlencode($ids[$idx]));
	die();

    
  }


  
  

  
  
}



