<?php

namespace DataView;

class GruppeItem {
  
  

  
  

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

		var i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout = null;
		function changefilter_gruppeItem_listSearchFilter(val, callback) {
			if(i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout) clearTimeout(i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout);

			i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout = setTimeout(function() {
				$.getJSON(reloadgruppeItem({action: 'getfilter_gruppeItem_listItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_gruppeItem_list_orig'] = val;
				});
			}, 300);
		}

	function getfilter_gruppeItem_listListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_gruppeItem_list_orig']) ? json_encode($_GET['filter_gruppeItem_list_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1" type="text">' +
			'<label class="mdl-textfield__label" for="209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1">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_gruppeItem_list', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_gruppeItem_list_orig'] = '';
					delete query['filter_gruppeItem_list'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadgruppeItem();
					
				} else {
					$('#table_gruppeItem').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_gruppeItem_listSearchFilter(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\GruppeItem::getfilter_gruppeItem_listItemsByStringAction(''));
		?>;

		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_gruppeItem_list_orig'] = '';
				delete query['filter_gruppeItem_list'];
				reload('', items);reloadgruppeItem();
				
			})).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_gruppeItem_list', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_gruppeItem_listListMultiFilter("' + 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_gruppeItem_itemListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_gruppeItem_item', val, cb.checked);
		  } else {
			  delete query['filter_gruppeItem_item'];
		  }reloadgruppeItem();
        
    }

		var i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout = null;
		function changefilter_gruppeItem_itemSearchFilter(val, callback) {
			if(i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout) clearTimeout(i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout);

			i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout = setTimeout(function() {
				$.getJSON(reloadgruppeItem({action: 'getfilter_gruppeItem_itemItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_gruppeItem_item_orig'] = val;
				});
			}, 300);
		}

	function getfilter_gruppeItem_itemListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_gruppeItem_item_orig']) ? json_encode($_GET['filter_gruppeItem_item_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5" type="text">' +
			'<label class="mdl-textfield__label" for="05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5">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_gruppeItem_item', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_gruppeItem_item_orig'] = '';
					delete query['filter_gruppeItem_item'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadgruppeItem();
					
				} else {
					$('#table_gruppeItem').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_gruppeItem_itemSearchFilter(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\GruppeItem::getfilter_gruppeItem_itemItemsByStringAction(''));
		?>;

		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_gruppeItem_item_orig'] = '';
				delete query['filter_gruppeItem_item'];
				reload('', items);reloadgruppeItem();
				
			})).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_gruppeItem_item', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_gruppeItem_itemListMultiFilter("' + 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_gruppeItem_listListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_gruppeItem_list', val, cb.checked);
		  } else {
			  delete query['filter_gruppeItem_list'];
		  }reloadgruppeItem();
        
    }

		var i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout = null;
		function changefilter_gruppeItem_listSearchFilter(val, callback) {
			if(i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout) clearTimeout(i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout);

			i209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1timeout = setTimeout(function() {
				$.getJSON(reloadgruppeItem({action: 'getfilter_gruppeItem_listItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_gruppeItem_list_orig'] = val;
				});
			}, 300);
		}

	function getfilter_gruppeItem_listListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_gruppeItem_list_orig']) ? json_encode($_GET['filter_gruppeItem_list_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1" type="text">' +
			'<label class="mdl-textfield__label" for="209291e82e8ff47dc15b6c543bc233d12e6d49a4cb9f3f7fca0f806dd0f0baf1">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_gruppeItem_list', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_gruppeItem_list_orig'] = '';
					delete query['filter_gruppeItem_list'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadgruppeItem();
					
				} else {
					$('#table_gruppeItem').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_gruppeItem_listSearchFilter(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\GruppeItem::getfilter_gruppeItem_listItemsByStringAction(''));
		?>;

		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_gruppeItem_list_orig'] = '';
				delete query['filter_gruppeItem_list'];
				reload('', items);reloadgruppeItem();
				
			})).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_gruppeItem_list', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_gruppeItem_listListMultiFilter("' + 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_gruppeItem_itemListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_gruppeItem_item', val, cb.checked);
		  } else {
			  delete query['filter_gruppeItem_item'];
		  }reloadgruppeItem();
        
    }

		var i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout = null;
		function changefilter_gruppeItem_itemSearchFilter(val, callback) {
			if(i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout) clearTimeout(i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout);

			i05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5timeout = setTimeout(function() {
				$.getJSON(reloadgruppeItem({action: 'getfilter_gruppeItem_itemItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_gruppeItem_item_orig'] = val;
				});
			}, 300);
		}

	function getfilter_gruppeItem_itemListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_gruppeItem_item_orig']) ? json_encode($_GET['filter_gruppeItem_item_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5" type="text">' +
			'<label class="mdl-textfield__label" for="05228b8214c9cd85ec40cb1c95ef0c25ba1b44104e3499bf347afd9d6b347ca5">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_gruppeItem_item', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_gruppeItem_item_orig'] = '';
					delete query['filter_gruppeItem_item'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadgruppeItem();
					
				} else {
					$('#table_gruppeItem').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_gruppeItem_itemSearchFilter(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\GruppeItem::getfilter_gruppeItem_itemItemsByStringAction(''));
		?>;

		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_gruppeItem_item_orig'] = '';
				delete query['filter_gruppeItem_item'];
				reload('', items);reloadgruppeItem();
				
			})).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_gruppeItem_item', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_gruppeItem_itemListMultiFilter("' + 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 updateNumbergruppeItem(col) {
										//var checklist = window.DataViewChecked['gruppeItem'][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['gruppeItem'] && window.DataViewChecked['gruppeItem'][col].ranges.length > 0) {
											$('.gruppeItem__mass-action').css('visibility', 'visible');
											$('.gruppeItem__action').css('visibility', 'hidden');
										} else {
											$('.gruppeItem__mass-action').css('visibility', 'hidden');
											$('.gruppeItem__action').css('visibility', 'visible');
										}
										$('.gruppeItem__checkbox').each(function (idx, x) {
											for (var cssclass of x.classList) {
												if (cssclass.startsWith('gruppeItem__checkbox-'+col+'-')) {
													var my_id = cssclass.substr(('gruppeItem__checkbox-'+col+'-').length);
													if (window.DataViewChecked) {
														x.MaterialCheckbox[checklist.has(my_id) ? 'check' : 'uncheck']();
													}
												}
											}
										});
									}
									function reloadgruppeItem (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/GruppeItem/" + 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::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
											delete nq['action'];
											querystr = "DataView/GruppeItem/renderTabTable?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#gruppeItem-table")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#gruppeItem-table")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#gruppeItem-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
												updateNumbergruppeItem('ID');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#gruppeItem-table");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadgruppeItem()"></div>');
											}
											<?php } ?>
											
										}
									}
									function checkgruppeItem (id, col, checked) {
										// ID-Liste aufbauen
										if (!window.DataViewChecked) window.DataViewChecked = {};
										if (!window.DataViewChecked['gruppeItem']) window.DataViewChecked['gruppeItem'] = {};
										if (!window.DataViewChecked['gruppeItem'][col]) window.DataViewChecked['gruppeItem'][col] = new IDList();

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

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

    
  }

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

	</script>
	<?php
	
    
  }

  public static function renderTabTableAction() { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php if(((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onclick="
		var self = this;
		event.preventDefault();
		$.get(reloadgruppeItem({action: 'open', fop_table: 'gruppeItem', fop_id: '_', fop_from: location.href}, true))
		.then(function () {
			window.open_url(self.href, false);
		});" href="<?php echo htmlentities(\TablesRouter\GruppeItem::createURL2(['from' => $_GET['from'] ?? null, 'popup' => $_GET['popup'] ?? null])); ?>"><i class="material-icons">add</i> <?php echo(sprintf(_('create %s'), _('Gruppenmitglied'))); ?></a><?php }if((!\FOP\User::getIsGuest())) { ?>
	<span style ="margin-left: 20px">
		<?php echo htmlentities(_('Betrachtungszeitpunkt'));?>:
		<input type='text' class="mdl-textfield__input" style="width: 160px; display: inline-block; " id="gruppeItem-dynamic-filter" value='<?php echo date(_('dateformat_php')); ?>'>
		<script type='text/javascript'>
			$(function () {
				$('#gruppeItem-dynamic-filter')
				.datetimepicker({locale: <?php echo (json_encode(\FOP\I18n::getShortLocale())); ?>, format: <?php echo (json_encode(_('datetimeformat_moment'))); ?>})
				.on('dp.change', function (e) {
					if (!e.date) {
						// filter all times
						query['dynamic_gruppeItem'] = 0;
					} else {
						// filter a certain time
						query['dynamic_gruppeItem'] = e.date.unix();
					}
					delete query['page_gruppeItem'];
					reloadgruppeItem();
				});
			});
		</script>
	</span>
	<?php } ?></div><?php 
								\FOP\User::getIsGuest();
								$itemheight = 32;
								$itemsperpage = ceil(1080 / $itemheight * 0.8);
								$page = (isset($_GET['page_gruppeItem']) ? intval($_GET['page_gruppeItem']) : 0);
								$addlines = (isset($_GET['addlines_gruppeItem']) ? intval($_GET['addlines_gruppeItem']) : 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' => 'list',
												'desc' => _('Gruppe'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

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

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

											];
											$columns['note'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'eintritt',
												'desc' => _('Eintritt in Gruppe'),
												'order' => ++$order,
												'width' => 100, // default value
												'collapsed' => 0

											];
											$columns['eintritt'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'austritt',
												'desc' => _('Austritt aus Gruppe'),
												'order' => ++$order,
												'width' => 100, // default value
												'collapsed' => 0

											];
											$columns['austritt'] = $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('gruppeItem'))->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='list'
												data-order='<?php echo intval($columns['list']['order']); ?>'
												data-width='<?php echo intval($columns['list']['width']); ?>'
												data-collapsed='<?php echo intval($columns['list']['collapsed']); ?>'
												style='width: <?php echo intval($columns['list']['width']); ?>px; <?php if ($columns['list']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadgruppeItem(); 
		}});
		
		win.append(getfilter_gruppeItem_listListMultiFilter()); win.find('input').first().focus();
		return false;
	">
													<span class='title-title' title='<?php echo(_('Gruppe')); ?>'><?php echo(_('Gruppe')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'list ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'list DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_gruppeItem_list']) || isset($_GET['range_max_gruppeItem_list']) || isset($_GET['deps_gruppeItem_list']) || isset($_GET['fullsearch_gruppeItem_list']) || isset($_GET['dynamic_gruppeItem_list']) || isset($_GET['search_gruppeItem_list']) || isset($_GET['searchnot_gruppeItem_list']) || isset($_GET['filter_gruppeItem_list'])) {
															// 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['list']['header'] = ob_get_contents(); ob_end_clean();
											$columns['list']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['list']['width']); ?>px; <?php if ($columns['list']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='list'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['list'];
	$val = $item['list::description'];
	$canView = $item['list::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"gruppe\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Gruppe::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>
</div><?php
											};
											$columns['list']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='list'
													data-order='<?php echo intval($columns['list']['order']); ?>'
													data-width='<?php echo intval($columns['list']['width']); ?>'
													data-collapsed='<?php echo intval($columns['list']['collapsed']); ?>'
													style='width: <?php echo intval($columns['list']['width']); ?>px; <?php if ($columns['list']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='item'
												data-order='<?php echo intval($columns['item']['order']); ?>'
												data-width='<?php echo intval($columns['item']['width']); ?>'
												data-collapsed='<?php echo intval($columns['item']['collapsed']); ?>'
												style='width: <?php echo intval($columns['item']['width']); ?>px; <?php if ($columns['item']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadgruppeItem(); 
		}});
		
		win.append(getfilter_gruppeItem_itemListMultiFilter()); 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_gruppeItem'] == 'item ASC') {
			query['sort_gruppeItem'] = 'item DESC';
		 } else if (query['sort_gruppeItem'] == 'item DESC') {
		 	delete query['sort_gruppeItem'];
		 } else {
			query['sort_gruppeItem'] = 'item ASC';
		 }
		 reloadgruppeItem();
		 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(_('Gruppenmitglied')); ?>'><?php echo(_('Gruppenmitglied')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'item ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'item DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_gruppeItem_item']) || isset($_GET['range_max_gruppeItem_item']) || isset($_GET['deps_gruppeItem_item']) || isset($_GET['fullsearch_gruppeItem_item']) || isset($_GET['dynamic_gruppeItem_item']) || isset($_GET['search_gruppeItem_item']) || isset($_GET['searchnot_gruppeItem_item']) || isset($_GET['filter_gruppeItem_item'])) {
															// 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['item']['header'] = ob_get_contents(); ob_end_clean();
											$columns['item']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['item']['width']); ?>px; <?php if ($columns['item']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='item'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['item'];
	$val = $item['item::description'];
	$canView = $item['item::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['item']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='item'
													data-order='<?php echo intval($columns['item']['order']); ?>'
													data-width='<?php echo intval($columns['item']['width']); ?>'
													data-collapsed='<?php echo intval($columns['item']['collapsed']); ?>'
													style='width: <?php echo intval($columns['item']['width']); ?>px; <?php if ($columns['item']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='note'
												data-order='<?php echo intval($columns['note']['order']); ?>'
												data-width='<?php echo intval($columns['note']['width']); ?>'
												data-collapsed='<?php echo intval($columns['note']['collapsed']); ?>'
												style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadgruppeItem(); 
		}});
		
		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_gruppeItem_note'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_gruppeItem_note'] = text.val(); } else { delete query['search_gruppeItem_note']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_gruppeItem').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_gruppeItem_note'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_gruppeItem_note'] = text2.val(); } else { delete query['searchnot_gruppeItem_note']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_gruppeItem').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_gruppeItem'] == 'note ASC') {
			query['sort_gruppeItem'] = 'note DESC';
		 } else if (query['sort_gruppeItem'] == 'note DESC') {
		 	delete query['sort_gruppeItem'];
		 } else {
			query['sort_gruppeItem'] = 'note ASC';
		 }
		 reloadgruppeItem();
		 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(_('Notiz')); ?>'><?php echo(_('Notiz')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'note ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'note DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_gruppeItem_note']) || isset($_GET['range_max_gruppeItem_note']) || isset($_GET['deps_gruppeItem_note']) || isset($_GET['fullsearch_gruppeItem_note']) || isset($_GET['dynamic_gruppeItem_note']) || isset($_GET['search_gruppeItem_note']) || isset($_GET['searchnot_gruppeItem_note']) || isset($_GET['filter_gruppeItem_note'])) {
															// 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['note']['header'] = ob_get_contents(); ob_end_clean();
											$columns['note']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; cursor: text;' data-column='note' onclick='
															event.preventDefault();
															event.stopPropagation();
															var div = get_overlay(this, function () {
																// submit the form in overlay
																div.find(&apos;form&apos;).submit();
															});
															$.get(&apos;Tables/GruppeItem/noteEdit?id=&apos; + <?php echo json_encode($item['ID']); ?>).then(function (html) {
																div.html(html);
																var iframe = div.find(&apos;iframe&apos;)[0];
																if (iframe) iframe.onload = function () {
																	this.onload = function () {
																		div.close();
																		reloadgruppeItem();
																	}
																};
																div.find(&apos;input[type=text], input[type=checkbox], textarea&apos;).select().focus().keydown(function (event) {
																	if ([13/*, 37, 39, 38, 40*/, 9].includes(event.keyCode)) { // ENTER, left, right, up, down, tab
																		$(this).closest(&apos;form&apos;).submit();
																		event.preventDefault();
																		event.stopPropagation();
																	}
																});
															});
															div.text(&apos;🗘&apos;);
															return true;'><span class='overflow-text' title="<?php echo htmlentities($item['note']); ?>"><?php echo htmlentities($item['note']); ?></span></div><?php
											};
											$columns['note']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='note'
													data-order='<?php echo intval($columns['note']['order']); ?>'
													data-width='<?php echo intval($columns['note']['width']); ?>'
													data-collapsed='<?php echo intval($columns['note']['collapsed']); ?>'
													style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='eintritt'
												data-order='<?php echo intval($columns['eintritt']['order']); ?>'
												data-width='<?php echo intval($columns['eintritt']['width']); ?>'
												data-collapsed='<?php echo intval($columns['eintritt']['collapsed']); ?>'
												style='width: <?php echo intval($columns['eintritt']['width']); ?>px; <?php if ($columns['eintritt']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadgruppeItem(); 
		}}, 600);
		date_filter(win, 'gruppeItem', 'eintritt', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadgruppeItem();  reloadgruppeItem(); });
	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_gruppeItem'] == 'eintritt ASC') {
			query['sort_gruppeItem'] = 'eintritt DESC';
		 } else if (query['sort_gruppeItem'] == 'eintritt DESC') {
		 	delete query['sort_gruppeItem'];
		 } else {
			query['sort_gruppeItem'] = 'eintritt ASC';
		 }
		 reloadgruppeItem();
		 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(_('Eintritt in Gruppe')); ?>'><?php echo(_('Eintritt in Gruppe')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'eintritt ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'eintritt DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_gruppeItem_eintritt']) || isset($_GET['range_max_gruppeItem_eintritt']) || isset($_GET['deps_gruppeItem_eintritt']) || isset($_GET['fullsearch_gruppeItem_eintritt']) || isset($_GET['dynamic_gruppeItem_eintritt']) || isset($_GET['search_gruppeItem_eintritt']) || isset($_GET['searchnot_gruppeItem_eintritt']) || isset($_GET['filter_gruppeItem_eintritt'])) {
															// 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['eintritt']['header'] = ob_get_contents(); ob_end_clean();
											$columns['eintritt']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['eintritt']['width']); ?>px; <?php if ($columns['eintritt']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='eintritt'><span class='overflow-text' title="<?php echo htmlentities(($item['eintritt']) ? strftime(_('dateformat_php2'), intval($item['eintritt'])) : ''); ?>"><?php echo htmlentities(($item['eintritt']) ? strftime(_('dateformat_php2'), intval($item['eintritt'])) : ''); ?></span></div><?php
											};
											$columns['eintritt']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='eintritt'
													data-order='<?php echo intval($columns['eintritt']['order']); ?>'
													data-width='<?php echo intval($columns['eintritt']['width']); ?>'
													data-collapsed='<?php echo intval($columns['eintritt']['collapsed']); ?>'
													style='width: <?php echo intval($columns['eintritt']['width']); ?>px; <?php if ($columns['eintritt']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='austritt'
												data-order='<?php echo intval($columns['austritt']['order']); ?>'
												data-width='<?php echo intval($columns['austritt']['width']); ?>'
												data-collapsed='<?php echo intval($columns['austritt']['collapsed']); ?>'
												style='width: <?php echo intval($columns['austritt']['width']); ?>px; <?php if ($columns['austritt']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadgruppeItem(); 
		}}, 600);
		date_filter(win, 'gruppeItem', 'austritt', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadgruppeItem();  reloadgruppeItem(); });
	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_gruppeItem'] == 'austritt ASC') {
			query['sort_gruppeItem'] = 'austritt DESC';
		 } else if (query['sort_gruppeItem'] == 'austritt DESC') {
		 	delete query['sort_gruppeItem'];
		 } else {
			query['sort_gruppeItem'] = 'austritt ASC';
		 }
		 reloadgruppeItem();
		 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(_('Austritt aus Gruppe')); ?>'><?php echo(_('Austritt aus Gruppe')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'austritt ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_gruppeItem']) && $_GET['sort_gruppeItem'] == 'austritt DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_gruppeItem_austritt']) || isset($_GET['range_max_gruppeItem_austritt']) || isset($_GET['deps_gruppeItem_austritt']) || isset($_GET['fullsearch_gruppeItem_austritt']) || isset($_GET['dynamic_gruppeItem_austritt']) || isset($_GET['search_gruppeItem_austritt']) || isset($_GET['searchnot_gruppeItem_austritt']) || isset($_GET['filter_gruppeItem_austritt'])) {
															// 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['austritt']['header'] = ob_get_contents(); ob_end_clean();
											$columns['austritt']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['austritt']['width']); ?>px; <?php if ($columns['austritt']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='austritt'><span class='overflow-text' title="<?php echo htmlentities(($item['austritt']) ? strftime(_('dateformat_php2'), intval($item['austritt'])) : ''); ?>"><?php echo htmlentities(($item['austritt']) ? strftime(_('dateformat_php2'), intval($item['austritt'])) : ''); ?></span></div><?php
											};
											$columns['austritt']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='austritt'
													data-order='<?php echo intval($columns['austritt']['order']); ?>'
													data-width='<?php echo intval($columns['austritt']['width']); ?>'
													data-collapsed='<?php echo intval($columns['austritt']['collapsed']); ?>'
													style='width: <?php echo intval($columns['austritt']['width']); ?>px; <?php if ($columns['austritt']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									

									// sort by order
									uasort($columns, function ($a, $b) {
										return $a['order'] - $b['order'];
									});
									?>
									<style type='text/css'>
										#gruppeItem-table .fop-table-header {
											height: <?php echo 32; ?>px;
										}
										#gruppeItem-table .fop-table-header .fop-table-column .title,
										#gruppeItem-table .fop-column-handle,
										#gruppeItem-table .fop-table-row,
										#gruppeItem-table .fop-table-row .fop-table-column,
										#gruppeItem-table .fop-table-column-multicontrol,
										#gruppeItem-table .fop-filter-button {
											height: 32px;
											line-height: 32px;
										}
										</style>
											<div class="fop-table" data-table-id="gruppeItem">
											<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="gruppeItem__all-checkbox">
														<input class="mdl-checkbox__input" id="gruppeItem__all-checkbox" type="checkbox" onchange="checkgruppeItem('all', 'ID', this.checked);checkgruppeItem('all', 'item', this.checked);">
														</label>
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon gruppeItem__mass-action" style='visibility: hidden;' onclick="$.get('DataView/GruppeItem/permissions?id=' + checkgruppeItem(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]); }; });$.get('DataView/GruppeItem/permissions?id=' + checkgruppeItem(null, 'item'), 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_gruppeItem_') == 0 || key.indexOf('range_max_gruppeItem_') == 0 || key.indexOf('deps_gruppeItem_') == 0 || key.indexOf('fullsearch_gruppeItem_') == 0 || key.indexOf('dynamic_gruppeItem_') == 0 || key.indexOf('search_gruppeItem_') == 0 || key.indexOf('searchnot_gruppeItem_') == 0 || key.indexOf('filter_gruppeItem_') == 0) delete query[key]; reloadgruppeItem(); $(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_gruppeItem_ID'] = checkgruppeItem(null, 'ID'); delete query['page_gruppeItem']; reloadgruppeItem(); $(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(checkgruppeItem(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;
			}
			checkgruppeItem(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::getIsGuest()) && ((\FOP\User::getGruppe()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/GruppeItem/lifecycleEnd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkgruppeItem(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austritt aus Gruppe'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austritt aus Gruppe'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getGruppe()))) { ?>
			<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/GruppeItem/delete?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkgruppeItem(null, 'ID'))).then(function () { reloadgruppeItem(); }, 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 } ?>
		<div class=mdl-list__item style='border-top: medium solid; text-decoration: underline;'><?php echo(_('Mitglieder')); ?></div><?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_gruppeItem_item'] = checkgruppeItem(null, 'item'); delete query['page_gruppeItem']; reloadgruppeItem(); $(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(checkgruppeItem(null, 'item'));
		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;
			}
			checkgruppeItem(newticks, 'item', '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::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="campaignTargetAdd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/multiadd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&column_target=' + escape(checkgruppeItem(null, 'item')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getGruppe()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="gruppeItemAdd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/GruppeItem/multiadd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&column_item=' + escape(checkgruppeItem(null, 'item')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && (!\FOP\User::getIsGuest()) && ((\FOP\User::getGruppe()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/Mitglied/lifecycleEnd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkgruppeItem(null, 'item')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?> (<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('gruppeItem', <?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: 'gruppeItem', 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_gruppeItem" <?php \EasyEditor\Navigation::printScroll('dv.GruppeItem', '/* 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_gruppeItem\'] || 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_gruppeItem\'] = wantedPage;
														reloadgruppeItem(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-gruppeItem-id="<?php echo htmlentities($item['ID']); ?>" data-mitglied-id="<?php echo htmlentities($item['item']); ?>"<?php if (isset($item['item'])){
														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['item']))) . ';" ';
														} else {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) open_url(reloadgruppeItem({action: \'open\', fop_table: \'mitglied\', fop_id: ' .  htmlentities(json_encode($item['item'])) . ', fop_from: location.href}, true), true);"';
														}
													}?> >

													<?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 gruppeItem__checkbox gruppeItem__checkbox gruppeItem__checkbox-ID-<?php echo htmlentities($item['ID']); ?> gruppeItem__checkbox-item-<?php echo htmlentities($item['item']); ?>" style="width: auto;" for="gruppeItem__<?php echo htmlentities($itempos); ?>-checkbox">
													<input class="mdl-checkbox__input" id="gruppeItem__<?php echo htmlentities($itempos); ?>-checkbox" type="checkbox" onchange="<?php if (isset($item['ID'])) echo 'checkgruppeItem(' . htmlentities(json_encode($item['ID'])) . ', \'ID\', this.checked); ' ?><?php if (isset($item['item'])) echo 'checkgruppeItem(' . htmlentities(json_encode($item['item'])) . ', \'item\', this.checked); ' ?>">
													</label><button type="button" class="mdl-button mdl-js-button mdl-button--icon gruppeItem__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-gruppeItem-action-<?php echo $item['ID'] ?? 0; ?>">
														<?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\GruppeItem::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']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\GruppeItem::lifecycleEndURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austritt aus Gruppe'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austritt aus Gruppe'))); ?></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/GruppeItem/delete?ajax&id=<?php echo htmlentities($item['ID']);?>&from=<?php echo htmlentities(\FOP\Util::getBackUrl());?>').then(function () { reloadgruppeItem(); }, 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 } ?><?php
		if(isset($item['item'])){ ?>
			<div class=mdl-list__item style='border-top: medium solid; text-decoration: underline;'><?php echo(_('Mitglied')); ?></div>
		<?php } ?> <?php
		if(isset($item['item']) && $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\Mitglied::viewURL($item['item'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick=" if (!event.ctrlKey) { open_url(reloadgruppeItem({action: 'open', fop_table: 'mitglied', fop_id: <?php echo htmlentities(json_encode($item['item'])); ?>, fop_from: location.href}, true), true); return false; } $(this).closest('.overlay').click(); return false;  
					open_url(this.href, true);
					$(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['item']) && $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\Mitglied::editURL($item['item'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, true);
					$(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['item']) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="campaignTargetAdd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::multiaddURL2(['column_target' => $item['item'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_ansprechpartner_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Ansprechpartner::createURL2(['column_mitglied' => $item['item'], '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'), _('Kontaktperson'))); ?>"><?php echo(sprintf(_('create %s'), _('Kontaktperson'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\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_campaignTarget_target" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::createURL2(['column_target' => $item['item'], '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'), _('Empfänger'))); ?>"><?php echo(sprintf(_('create %s'), _('Empfänger'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getDokument())) && (!\FOP\User::getIsGuest()) && (!\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-mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Doc::createURL2(['column_to-mitglied' => $item['item'], '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['item']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_gruppeItem_item" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\GruppeItem::createURL2(['column_item' => $item['item'], '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'), _('Gruppenmitglied'))); ?>"><?php echo(sprintf(_('create %s'), _('Gruppenmitglied'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedBuchung_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedBuchung::createURL2(['column_mitglied' => $item['item'], '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'), _('Beitrag'))); ?>"><?php echo(sprintf(_('create %s'), _('Beitrag'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((false))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedDynamicMonthyear_dynamic:parent" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedDynamicMonthyear::createURL2(['column_dynamic:parent' => $item['item'], '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'), sprintf(_('versions of %s'), _('Mitglied')))); ?>"><?php echo(sprintf(_('create %s'), sprintf(_('versions of %s'), _('Mitglied')))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedPassnummer_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedPassnummer::createURL2(['column_mitglied' => $item['item'], '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'), _('Passnummer'))); ?>"><?php echo(sprintf(_('create %s'), _('Passnummer'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_sammlungMitglied_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\SammlungMitglied::createURL2(['column_mitglied' => $item['item'], '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'), _('Sammlungs-Mitglied'))); ?>"><?php echo(sprintf(_('create %s'), _('Sammlungs-Mitglied'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && ((\FOP\User::getGruppe()))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="gruppeItemAdd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\GruppeItem::multiaddURL2(['column_item' => $item['item'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['item']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Mitglied::lifecycleEndURL2(['id' => $item['item'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?></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="gruppeItem" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="edit" href="<?php echo htmlentities(\TablesRouter\GruppeItem::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();    reloadgruppeItem();
					$(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 } ?>
													</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 ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT ((('.qi('gruppeItem').'.'.qi('item').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT ((SELECT ('.qi('M9cJxzyc').'.'.qi('memberVisibility').') FROM '.qi('gruppe').' '.qi('M9cJxzyc').' WHERE '.qi('M9cJxzyc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1)))) END) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('hX7wRx63').' WHERE '.qi('hX7wRx63').'.'.qi('list').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('hX7wRx63').'.'.qi('item').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('yvRIjwTv').' WHERE '.qi('yvRIjwTv').'.'.qi('gruppe').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('yvRIjwTv').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT ('.qi('3Qd01Ooc').'.'.qi('public').'))) END) FROM '.qi('gruppe').' '.qi('3Qd01Ooc').' WHERE '.qi('3Qd01Ooc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE))) AND ((COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('Wk3yjwJT').' WHERE '.qi('Wk3yjwJT').'.'.qi('gruppe').' = '.qi('D1f71D3k').'.'.qi('ID').' AND (('.qi('Wk3yjwJT').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1) END) FROM '.qi('gruppe').' '.qi('D1f71D3k').' WHERE '.qi('D1f71D3k').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getGruppe()).') FROM '.qi('gruppe').' '.qi('RXSVEgHm').' WHERE '.qi('RXSVEgHm').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getGruppe()).')) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('lifecycleEnd').', 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 ((COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('Wk3yjwJT').' WHERE '.qi('Wk3yjwJT').'.'.qi('gruppe').' = '.qi('RJ9cGEjL').'.'.qi('ID').' AND (('.qi('Wk3yjwJT').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1) END) FROM '.qi('gruppe').' '.qi('RJ9cGEjL').' WHERE '.qi('RJ9cGEjL').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getGruppe()).') FROM '.qi('gruppe').' '.qi('Qi9mKudl').' WHERE '.qi('Qi9mKudl').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getGruppe()).')) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('delete').' FROM '.qi('gruppeItem').' WHERE ' . $ids->toSQL(qi('ID')))->fetch(\PDO::FETCH_ASSOC);
		
		return $perms;
	
    
  }

  public static function getSQL($params) { 
    
    
    // --- 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').',
									/* austritt */ '.qi('austritt').' AS '.qi('austritt').',
									/* eintritt */ '.qi('eintritt').' AS '.qi('eintritt').',
									/* item */ '.qi('item').' AS '.qi('item').',
									/* item::canView */ '.qi('ref:item').'.'.qi('item:canView').' AS '.qi('item::canView').',
									/* item::description */ '.qi('ref:item').'.'.qi('item:description').' AS '.qi('item::description').',
									/* list */ '.qi('list').' AS '.qi('list').',
									/* list::canView */ '.qi('ref:list').'.'.qi('list:canView').' AS '.qi('list::canView').',
									/* list::description */ '.qi('ref:list').'.'.qi('list:description').' AS '.qi('list::description').',
									/* note */ '.qi('note').' AS '.qi('note').',
									/* operation::create */ (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('Wk3yjwJT').' WHERE '.qi('Wk3yjwJT').'.'.qi('gruppe').' = '.qi('WoNKw4Oa').'.'.qi('ID').' AND (('.qi('Wk3yjwJT').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1) END) FROM '.qi('gruppe').' '.qi('WoNKw4Oa').' WHERE '.qi('WoNKw4Oa').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getGruppe()).') FROM '.qi('gruppe').' '.qi('GM2ROBSz').' WHERE '.qi('GM2ROBSz').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getGruppe()).') AS '.qi('operation::create').',
									/* operation::delete */ (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('Wk3yjwJT').' WHERE '.qi('Wk3yjwJT').'.'.qi('gruppe').' = '.qi('RJ9cGEjL').'.'.qi('ID').' AND (('.qi('Wk3yjwJT').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1) END) FROM '.qi('gruppe').' '.qi('RJ9cGEjL').' WHERE '.qi('RJ9cGEjL').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getGruppe()).') FROM '.qi('gruppe').' '.qi('Qi9mKudl').' WHERE '.qi('Qi9mKudl').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getGruppe()).') AS '.qi('operation::delete').',
									/* operation::edit */ (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('Wk3yjwJT').' WHERE '.qi('Wk3yjwJT').'.'.qi('gruppe').' = '.qi('D1f71D3k').'.'.qi('ID').' AND (('.qi('Wk3yjwJT').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1) END) FROM '.qi('gruppe').' '.qi('D1f71D3k').' WHERE '.qi('D1f71D3k').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getGruppe()).') FROM '.qi('gruppe').' '.qi('RXSVEgHm').' WHERE '.qi('RXSVEgHm').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getGruppe()).') AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT ((('.qi('gruppeItem').'.'.qi('item').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT ((SELECT ('.qi('M9cJxzyc').'.'.qi('memberVisibility').') FROM '.qi('gruppe').' '.qi('M9cJxzyc').' WHERE '.qi('M9cJxzyc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1)))) END) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('hX7wRx63').' WHERE '.qi('hX7wRx63').'.'.qi('list').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('hX7wRx63').'.'.qi('item').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('yvRIjwTv').' WHERE '.qi('yvRIjwTv').'.'.qi('gruppe').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('yvRIjwTv').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT ('.qi('3Qd01Ooc').'.'.qi('public').'))) END) FROM '.qi('gruppe').' '.qi('3Qd01Ooc').' WHERE '.qi('3Qd01Ooc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE)) AS '.qi('operation::view').',
									1
								FROM '.qi('gruppeItem').' '.qi('gruppeItem').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('list:ID').', '.qi('gruppe').'.'.qi('name').' AS '.qi('list:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('hX7wRx63').' WHERE '.qi('hX7wRx63').'.'.qi('list').' = '.qi('gruppe').'.'.qi('ID').' AND (('.qi('hX7wRx63').'.'.qi('item').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('yvRIjwTv').' WHERE '.qi('yvRIjwTv').'.'.qi('gruppe').' = '.qi('gruppe').'.'.qi('ID').' AND (('.qi('yvRIjwTv').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT ('.qi('gruppe').'.'.qi('public').'))) END)) AS '.qi('list:canView').' FROM '.qi('gruppe').') '.qi('ref:list').' ON '.qi('ref:list').'.'.qi('list:ID').' = '.qi('list').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('item:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('item: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('item:canView').' FROM '.qi('mitglied').') '.qi('ref:item').' ON '.qi('ref:item').'.'.qi('item:ID').' = '.qi('item').'
								WHERE (((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT ((('.qi('gruppeItem').'.'.qi('item').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT ((SELECT ('.qi('M9cJxzyc').'.'.qi('memberVisibility').') FROM '.qi('gruppe').' '.qi('M9cJxzyc').' WHERE '.qi('M9cJxzyc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1)))) END) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('hX7wRx63').' WHERE '.qi('hX7wRx63').'.'.qi('list').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('hX7wRx63').'.'.qi('item').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('yvRIjwTv').' WHERE '.qi('yvRIjwTv').'.'.qi('gruppe').' = '.qi('3Qd01Ooc').'.'.qi('ID').' AND (('.qi('yvRIjwTv').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1))) AND (NOT ('.qi('3Qd01Ooc').'.'.qi('public').'))) END) FROM '.qi('gruppe').' '.qi('3Qd01Ooc').' WHERE '.qi('3Qd01Ooc').'.'.qi('ID').' = '.qi('gruppeItem').'.'.qi('list').' LIMIT 1), FALSE))))) AS t
								LEFT JOIN '.qi('mitglied').' AS '.qi('sorter-item').' ON t.'.qi('item').' = '.qi('sorter-item').'.'.qi('ID').'
								WHERE ' . (isset($params['range_min_gruppeItem_eintritt']) ? ($params['range_min_gruppeItem_eintritt'] !== '' && is_numeric($params['range_min_gruppeItem_eintritt']) ? 't.'.qi('eintritt').' >= ' . \FOP\Database::quote($params['range_min_gruppeItem_eintritt']) . ' AND ' : '') : '') . 
								(isset($params['range_min_gruppeItem_austritt']) ? ($params['range_min_gruppeItem_austritt'] !== '' && is_numeric($params['range_min_gruppeItem_austritt']) ? 't.'.qi('austritt').' >= ' . \FOP\Database::quote($params['range_min_gruppeItem_austritt']) . ' AND ' : '') : '') . 
								(isset($params['range_max_gruppeItem_eintritt']) ? ($params['range_max_gruppeItem_eintritt'] !== '' && is_numeric($params['range_max_gruppeItem_eintritt']) ? 't.'.qi('eintritt').' <= ' . \FOP\Database::quote($params['range_max_gruppeItem_eintritt']) . ' AND ' : '') : '') . 
								(isset($params['range_max_gruppeItem_austritt']) ? ($params['range_max_gruppeItem_austritt'] !== '' && is_numeric($params['range_max_gruppeItem_austritt']) ? 't.'.qi('austritt').' <= ' . \FOP\Database::quote($params['range_max_gruppeItem_austritt']) . ' AND ' : '') : '') . 
								(isset($params['filter_gruppeItem_eintritt']) ? ($params['filter_gruppeItem_eintritt'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_eintritt']))->toSQL('t.'.qi('eintritt').'') . ') AND ') : '') : '') . 
								(isset($params['filter_gruppeItem_austritt']) ? ($params['filter_gruppeItem_austritt'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_austritt']))->toSQL('t.'.qi('austritt').'') . ') AND ') : '') : '') . 
								(isset($params['filter_gruppeItem_list']) ? ($params['filter_gruppeItem_list'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_list']))->toSQL('t.'.qi('list').'') . ') AND ') : '') : '') . 
								(isset($params['filter_gruppeItem_item']) ? ($params['filter_gruppeItem_item'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_item']))->toSQL('t.'.qi('item').'') . ') AND ') : '') : '') . 
								(isset($params['filter_gruppeItem_note']) ? ($params['filter_gruppeItem_note'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_note']))->toSQL('t.'.qi('note').'') . ') AND ') : '') : '') . 
								(isset($params['filter_gruppeItem_ID']) ? ($params['filter_gruppeItem_ID'] !== '' ? ('(' . (new \FOP\IDList($params['filter_gruppeItem_ID']))->toSQL('t.'.qi('ID').'') . ') AND ') : '') : '') . 
								(isset($params['search_gruppeItem_note']) ? 't.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_gruppeItem_note'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_gruppeItem_note']) ? 'NOT t.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_gruppeItem_note'] . '%') . ' AND ' : '') . 
								(isset($params['search_gruppeItem']) ? '(' . 't.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_gruppeItem'] . '%') . ') AND ' : '') . 
								'
								(' . (isset($params['dynamic_gruppeItem']) ? ($params['dynamic_gruppeItem'] == 0 ? '1' : '(t.'.qi('eintritt').' IS NULL OR t.'.qi('eintritt').' <= ' . intval($params['dynamic_gruppeItem']) . ') AND (t.'.qi('austritt').' IS NULL OR t.'.qi('austritt').' >= ' . intval($params['dynamic_gruppeItem']) . ')') : '(t.'.qi('eintritt').' IS NULL OR t.'.qi('eintritt').' <= UNIX_TIMESTAMP()) AND (t.'.qi('austritt').' IS NULL OR t.'.qi('austritt').' >= UNIX_TIMESTAMP())') . ') AND  TRUE ';
								return $sql;
	
    
  }

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

    
  }

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

    
  }

  public static function getData($sqladdon, $params, $stream = false ) { 
    
    
    // --- BLOCK: before-DynamicTime ---
    
// dynamische Zeit für Datenbankaufrufe setzen, wenn eine übergeben wurde
        if (isset($params['dynamic_gruppeItem']))
                \FOP\Database::setTime($params['dynamic_gruppeItem']);
        
    // --- BLOCK: main ---
    
								$sql = self::getSQL($params);

								$order = (\FOP\Util::array_value(array(
									'item ASC' => 'ORDER BY '.qi('sorter-item').'.'.qi('name').' , '.qi('sorter-item').'.'.qi('name').' , '.qi('sorter-item').'.'.qi('name').' , '.qi('sorter-item').'.'.qi('vorname').' , '.qi('sorter-item').'.'.qi('vorname').' , '.qi('sorter-item').'.'.qi('vorname').' ',
									'item DESC' => 'ORDER BY '.qi('sorter-item').'.'.qi('name').' DESC, '.qi('sorter-item').'.'.qi('name').' DESC, '.qi('sorter-item').'.'.qi('name').' DESC, '.qi('sorter-item').'.'.qi('vorname').' DESC, '.qi('sorter-item').'.'.qi('vorname').' DESC, '.qi('sorter-item').'.'.qi('vorname').' DESC',
									'note ASC' => 'ORDER BY t.'.qi('note').' ASC',
									'eintritt ASC' => 'ORDER BY t.'.qi('eintritt').' ASC',
									'austritt ASC' => 'ORDER BY t.'.qi('austritt').' ASC',
									'note DESC' => 'ORDER BY t.'.qi('note').' DESC',
									'eintritt DESC' => 'ORDER BY t.'.qi('eintritt').' DESC',
									'austritt DESC' => 'ORDER BY t.'.qi('austritt').' DESC',
									'' => ''), isset($params['sort_gruppeItem']) ? $params['sort_gruppeItem'] : '') ?: '');
								// 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['eintritt'] = intval($item['eintritt']);
											$item['austritt'] = intval($item['austritt']);
											$item['list'] = \FOP\Sanitizers::null_converter($item['list']);
											$item['item'] = \FOP\Sanitizers::null_converter($item['item']);
											
											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['eintritt'] = intval($item['eintritt']);
										$item['austritt'] = intval($item['austritt']);
										$item['list'] = \FOP\Sanitizers::null_converter($item['list']);
										$item['item'] = \FOP\Sanitizers::null_converter($item['item']);
										
									}
									unset($item);

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

									
								}

								return $result;
	
    // --- BLOCK: main-DynamicTime ---
    
// ggf. dynamische Zeit zurücksetzen
        if (isset($params['dynamic_gruppeItem']))
                \FOP\Database::setTime(time());
        
    
  }

  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 ( // Corner Case: Monat
		isset($params['range_min_gruppeItem_eintritt'])
		&& isset($params['range_max_gruppeItem_eintritt'])
		&& (date('d', $params['range_min_gruppeItem_eintritt']) == '01') //check first day of month
		&& (date('d', $params['range_max_gruppeItem_eintritt']) == date('t', $params['range_max_gruppeItem_eintritt'])) //check last day of month
		&& (date('Y-m', $params['range_min_gruppeItem_eintritt']) == date('Y-m', $params['range_max_gruppeItem_eintritt'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Eintritt in Gruppe') . ': ' . strftime('%B', $params['range_min_gruppeItem_eintritt']) . ' ' . date('Y', $params['range_min_gruppeItem_eintritt']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_gruppeItem_eintritt'])
		&& isset($params['range_max_gruppeItem_eintritt'])
		&& (date('Y-m-d', $params['range_min_gruppeItem_eintritt']) == (date('Y-m-d', $params['range_max_gruppeItem_eintritt'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('next day', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('next day', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Eintritt in Gruppe') . ': ' . date('d.m.Y', $params['range_min_gruppeItem_eintritt']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_gruppeItem_eintritt'])
		&& isset($params['range_max_gruppeItem_eintritt'])
		&& (date('Y', $params['range_min_gruppeItem_eintritt']) == (date('Y', $params['range_max_gruppeItem_eintritt'])))
		&& ((date('m-d', $params['range_min_gruppeItem_eintritt']) == '01-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_eintritt']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Eintritt in Gruppe') . ': ' . date('Y', $params['range_min_gruppeItem_eintritt']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_gruppeItem_eintritt'])
		&& isset($params['range_max_gruppeItem_eintritt'])
		&& ( (
		 ((date('m-d', $params['range_min_gruppeItem_eintritt']) == '01-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_eintritt']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_eintritt']) == '04-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_eintritt']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_eintritt']) == '07-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_eintritt']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_eintritt']) == '10-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_eintritt']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_gruppeItem_eintritt']).'&apos;;
					query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_gruppeItem_eintritt']).'&apos;;
					reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_eintritt&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_gruppeItem_eintritt']).'&apos;;
				query[&apos;range_max_gruppeItem_eintritt&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_gruppeItem_eintritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Eintritt in Gruppe') . ': Q' . (ceil((date('m', $params['range_min_gruppeItem_eintritt']))/3)) . ' (' . date('d.m.', $params['range_min_gruppeItem_eintritt']) . ' - ' . date('d.m.Y', $params['range_max_gruppeItem_eintritt']) . ')')
		]);
	}
	else if (isset($params['range_min_gruppeItem_eintritt']) && isset($params['range_max_gruppeItem_eintritt'])) {
		array_push($filters, _('Eintritt in Gruppe') . ': ' . (($params['range_min_gruppeItem_eintritt']) ? strftime(_('dateformat_php2'), intval($params['range_min_gruppeItem_eintritt'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_gruppeItem_eintritt']) ? strftime(_('dateformat_php2'), intval($params['range_max_gruppeItem_eintritt'])) : ''));
	} else if (isset($params['range_min_gruppeItem_eintritt'])) {
		array_push($filters, _('Eintritt in Gruppe') . ': ' . _('filters_from') . ' ' . (($params['range_min_gruppeItem_eintritt']) ? strftime(_('dateformat_php2'), intval($params['range_min_gruppeItem_eintritt'])) : ''));
	} else if (isset($params['range_max_gruppeItem_eintritt'])) {
		array_push($filters, _('Eintritt in Gruppe') . ': ' . _('filters_to') . ' ' . (($params['range_max_gruppeItem_eintritt']) ? strftime(_('dateformat_php2'), intval($params['range_max_gruppeItem_eintritt'])) : ''));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_gruppeItem_austritt'])
		&& isset($params['range_max_gruppeItem_austritt'])
		&& (date('d', $params['range_min_gruppeItem_austritt']) == '01') //check first day of month
		&& (date('d', $params['range_max_gruppeItem_austritt']) == date('t', $params['range_max_gruppeItem_austritt'])) //check last day of month
		&& (date('Y-m', $params['range_min_gruppeItem_austritt']) == date('Y-m', $params['range_max_gruppeItem_austritt'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Austritt aus Gruppe') . ': ' . strftime('%B', $params['range_min_gruppeItem_austritt']) . ' ' . date('Y', $params['range_min_gruppeItem_austritt']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_gruppeItem_austritt'])
		&& isset($params['range_max_gruppeItem_austritt'])
		&& (date('Y-m-d', $params['range_min_gruppeItem_austritt']) == (date('Y-m-d', $params['range_max_gruppeItem_austritt'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('next day', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('next day', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Austritt aus Gruppe') . ': ' . date('d.m.Y', $params['range_min_gruppeItem_austritt']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_gruppeItem_austritt'])
		&& isset($params['range_max_gruppeItem_austritt'])
		&& (date('Y', $params['range_min_gruppeItem_austritt']) == (date('Y', $params['range_max_gruppeItem_austritt'])))
		&& ((date('m-d', $params['range_min_gruppeItem_austritt']) == '01-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_austritt']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Austritt aus Gruppe') . ': ' . date('Y', $params['range_min_gruppeItem_austritt']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_gruppeItem_austritt'])
		&& isset($params['range_max_gruppeItem_austritt'])
		&& ( (
		 ((date('m-d', $params['range_min_gruppeItem_austritt']) == '01-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_austritt']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_austritt']) == '04-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_austritt']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_austritt']) == '07-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_austritt']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_gruppeItem_austritt']) == '10-01'))
		&& ((date('m-d', $params['range_max_gruppeItem_austritt']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_gruppeItem_austritt']).'&apos;;
					query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_gruppeItem_austritt']).'&apos;;
					reloadgruppeItem(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_gruppeItem_austritt&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_gruppeItem_austritt']).'&apos;;
				query[&apos;range_max_gruppeItem_austritt&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_gruppeItem_austritt']).'&apos;;
				reloadgruppeItem(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Austritt aus Gruppe') . ': Q' . (ceil((date('m', $params['range_min_gruppeItem_austritt']))/3)) . ' (' . date('d.m.', $params['range_min_gruppeItem_austritt']) . ' - ' . date('d.m.Y', $params['range_max_gruppeItem_austritt']) . ')')
		]);
	}
	else if (isset($params['range_min_gruppeItem_austritt']) && isset($params['range_max_gruppeItem_austritt'])) {
		array_push($filters, _('Austritt aus Gruppe') . ': ' . (($params['range_min_gruppeItem_austritt']) ? strftime(_('dateformat_php2'), intval($params['range_min_gruppeItem_austritt'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_gruppeItem_austritt']) ? strftime(_('dateformat_php2'), intval($params['range_max_gruppeItem_austritt'])) : ''));
	} else if (isset($params['range_min_gruppeItem_austritt'])) {
		array_push($filters, _('Austritt aus Gruppe') . ': ' . _('filters_from') . ' ' . (($params['range_min_gruppeItem_austritt']) ? strftime(_('dateformat_php2'), intval($params['range_min_gruppeItem_austritt'])) : ''));
	} else if (isset($params['range_max_gruppeItem_austritt'])) {
		array_push($filters, _('Austritt aus Gruppe') . ': ' . _('filters_to') . ' ' . (($params['range_max_gruppeItem_austritt']) ? strftime(_('dateformat_php2'), intval($params['range_max_gruppeItem_austritt'])) : ''));
	}if (isset($params['filter_gruppeItem_eintritt'])) {
		if ($params['filter_gruppeItem_eintritt'] == '_null') {
			array_push($filters, _('Eintritt in Gruppe') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_gruppeItem_eintritt']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Eintritt in Gruppe') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_gruppeItem_austritt'])) {
		if ($params['filter_gruppeItem_austritt'] == '_null') {
			array_push($filters, _('Austritt aus Gruppe') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_gruppeItem_austritt']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Austritt aus Gruppe') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_gruppeItem_note'])) {
		if ($params['filter_gruppeItem_note'] == '_null') {
			array_push($filters, _('Notiz') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_gruppeItem_note']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Notiz') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_gruppeItem_list'])) {
		if ($params['filter_gruppeItem_list'] == '_null') {
			array_push($filters, _('Gruppe') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_gruppeItem_list']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT '.qi('gruppe').'.'.qi('name').' AS description FROM '.qi('gruppe').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Gruppe') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_gruppeItem_item'])) {
		if ($params['filter_gruppeItem_item'] == '_null') {
			array_push($filters, _('Gruppenmitglied') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_gruppeItem_item']))->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, _('Gruppenmitglied') . ': ' . implode(', ', $values));
		}
	}if (isset($params['search_gruppeItem_note'])) {
		array_push($filters, _('note') . ' ' . _('filter_contains') . ' ' . $params['search_gruppeItem_note']);
	}if (isset($params['searchnot_gruppeItem_note'])) {
		array_push($filters, _('note') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_gruppeItem_note']);
	}
		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(\'_gruppeItem_\')) delete query[q];} reloadgruppeItem(); ">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 == 'gruppeItem') {
	\FOP\Session::setPayload('dv-gruppeItem', [
		'id' => 'gruppeItem',
		'tbl' => 'gruppeItem',
		'idcol' => 'ID',
		'prev' => \DataViewRouter\GruppeItem::stepURL('gruppeItem', 'XXX', -1),
		'next' => \DataViewRouter\GruppeItem::stepURL('gruppeItem', '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\GruppeItem::viewURL2($params);
	header('Location: ' . $url);
}

if ($fop_table == 'mitglied') {
	\FOP\Session::setPayload('dv-mitglied', [
		'id' => 'gruppeItem',
		'tbl' => 'mitglied',
		'idcol' => 'item',
		'prev' => \DataViewRouter\GruppeItem::stepURL('mitglied', 'XXX', -1),
		'next' => \DataViewRouter\GruppeItem::stepURL('mitglied', '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\Mitglied::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();

    
  }


  
  

  
  
}



