<?php

namespace DataView;

class Fop_chat__chatflow {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function renderScript() { 
    
    
    // --- BLOCK: main ---
    
								\FOP\I18n::ensureIsLoaded();
								?>
								<script type="text/javascript">
									
									
									function updateNumberfop_chat__chatflow(col) {
										//var checklist = window.DataViewChecked['fop_chat__chatflow'][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['fop_chat__chatflow'] && window.DataViewChecked['fop_chat__chatflow'][col].ranges.length > 0) {
											$('.fop_chat__chatflow__mass-action').css('visibility', 'visible');
											$('.fop_chat__chatflow__action').css('visibility', 'hidden');
										} else {
											$('.fop_chat__chatflow__mass-action').css('visibility', 'hidden');
											$('.fop_chat__chatflow__action').css('visibility', 'visible');
										}
										$('.fop_chat__chatflow__checkbox').each(function (idx, x) {
											for (var cssclass of x.classList) {
												if (cssclass.startsWith('fop_chat__chatflow__checkbox-'+col+'-')) {
													var my_id = cssclass.substr(('fop_chat__chatflow__checkbox-'+col+'-').length);
													if (window.DataViewChecked) {
														x.MaterialCheckbox[checklist.has(my_id) ? 'check' : 'uncheck']();
													}
												}
											}
										});
									}
									function reloadfop_chat__chatflow (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/Fop_chat__chatflow/" + 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::getMitglied()))) { ?>
											delete nq['action'];
											querystr = "DataView/Fop_chat__chatflow/renderTabTable?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#fop_chat__chatflow-table")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#fop_chat__chatflow-table")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#fop_chat__chatflow-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
												updateNumberfop_chat__chatflow('ID');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#fop_chat__chatflow-table");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadfop_chat__chatflow()"></div>');
											}
											<?php } ?>
											
										}
									}
									function checkfop_chat__chatflow (id, col, checked) {
										// ID-Liste aufbauen
										if (!window.DataViewChecked) window.DataViewChecked = {};
										if (!window.DataViewChecked['fop_chat__chatflow']) window.DataViewChecked['fop_chat__chatflow'] = {};
										if (!window.DataViewChecked['fop_chat__chatflow'][col]) window.DataViewChecked['fop_chat__chatflow'][col] = new IDList();

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

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

    
  }

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

	</script>
	<?php
	
    
  }

  public static function renderTabTableAction() { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php  ?></div><?php 
								\FOP\User::getIsGuest();
								$itemheight = 32;
								$itemsperpage = ceil(1080 / $itemheight * 0.8);
								$page = (isset($_GET['page_fop_chat__chatflow']) ? intval($_GET['page_fop_chat__chatflow']) : 0);
								$addlines = (isset($_GET['addlines_fop_chat__chatflow']) ? intval($_GET['addlines_fop_chat__chatflow']) : 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' => 'ItemId',
												'desc' => _('ItemID'),
												'order' => ++$order,
												'width' => 60, // default value
												'collapsed' => 0

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

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

											];
											$columns['Message'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'ReportCount',
												'desc' => _('Report-Count'),
												'order' => ++$order,
												'width' => 60, // default value
												'collapsed' => 0

											];
											$columns['ReportCount'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'Timestamp',
												'desc' => _('Zeit'),
												'order' => ++$order,
												'width' => 160, // default value
												'collapsed' => 0

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

											];
											$columns['table'] = $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('fop_chat__chatflow'))->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='ItemId'
												data-order='<?php echo intval($columns['ItemId']['order']); ?>'
												data-width='<?php echo intval($columns['ItemId']['width']); ?>'
												data-collapsed='<?php echo intval($columns['ItemId']['collapsed']); ?>'
												style='width: <?php echo intval($columns['ItemId']['width']); ?>px; <?php if ($columns['ItemId']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}});
		var von, bis; win.append('<div class=\'fop-floatsorter\'>' + window.i18n_von + '</div>').append(von = $('<input type=\'number\' step=\'any\'><br>').val(query['range_min_fop_chat__chatflow_ItemId']).on('change keyup paste', function () { query['range_min_fop_chat__chatflow_ItemId'] = von.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
.append('<div>' + window.i18n_bis + '</div>').append(bis = $('<input type=\'number\' step=\'any\'>').val(query['range_max_fop_chat__chatflow_ItemId']).on('change keyup paste', function () { query['range_max_fop_chat__chatflow_ItemId'] = bis.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
; von.focus(); von.select();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_fop_chat__chatflow'] == 'ItemId ASC') {
			query['sort_fop_chat__chatflow'] = 'ItemId DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'ItemId DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'ItemId ASC';
		 }
		 reloadfop_chat__chatflow();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	" style='text-align: right;'>
													<span class='title-title' title='<?php echo(_('ItemID')); ?>'><?php echo(_('ItemID')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'ItemId ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'ItemId DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_ItemId']) || isset($_GET['range_max_fop_chat__chatflow_ItemId']) || isset($_GET['deps_fop_chat__chatflow_ItemId']) || isset($_GET['fullsearch_fop_chat__chatflow_ItemId']) || isset($_GET['dynamic_fop_chat__chatflow_ItemId']) || isset($_GET['search_fop_chat__chatflow_ItemId']) || isset($_GET['searchnot_fop_chat__chatflow_ItemId']) || isset($_GET['filter_fop_chat__chatflow_ItemId'])) {
															// 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['ItemId']['header'] = ob_get_contents(); ob_end_clean();
											$columns['ItemId']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['ItemId']['width']); ?>px; <?php if ($columns['ItemId']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='ItemId'><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($item['ItemId'])); ?>
	</span></div><?php
											};
											$columns['ItemId']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='ItemId'
													data-order='<?php echo intval($columns['ItemId']['order']); ?>'
													data-width='<?php echo intval($columns['ItemId']['width']); ?>'
													data-collapsed='<?php echo intval($columns['ItemId']['collapsed']); ?>'
													style='width: <?php echo intval($columns['ItemId']['width']); ?>px; <?php if ($columns['ItemId']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='Sender'
												data-order='<?php echo intval($columns['Sender']['order']); ?>'
												data-width='<?php echo intval($columns['Sender']['width']); ?>'
												data-collapsed='<?php echo intval($columns['Sender']['collapsed']); ?>'
												style='width: <?php echo intval($columns['Sender']['width']); ?>px; <?php if ($columns['Sender']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}});
		var von, bis; win.append('<div class=\'fop-floatsorter\'>' + window.i18n_von + '</div>').append(von = $('<input type=\'number\' step=\'any\'><br>').val(query['range_min_fop_chat__chatflow_Sender']).on('change keyup paste', function () { query['range_min_fop_chat__chatflow_Sender'] = von.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
.append('<div>' + window.i18n_bis + '</div>').append(bis = $('<input type=\'number\' step=\'any\'>').val(query['range_max_fop_chat__chatflow_Sender']).on('change keyup paste', function () { query['range_max_fop_chat__chatflow_Sender'] = bis.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
; von.focus(); von.select();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_fop_chat__chatflow'] == 'Sender ASC') {
			query['sort_fop_chat__chatflow'] = 'Sender DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'Sender DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'Sender ASC';
		 }
		 reloadfop_chat__chatflow();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	" style='text-align: right;'>
													<span class='title-title' title='<?php echo(_('Sender')); ?>'><?php echo(_('Sender')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Sender ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Sender DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_Sender']) || isset($_GET['range_max_fop_chat__chatflow_Sender']) || isset($_GET['deps_fop_chat__chatflow_Sender']) || isset($_GET['fullsearch_fop_chat__chatflow_Sender']) || isset($_GET['dynamic_fop_chat__chatflow_Sender']) || isset($_GET['search_fop_chat__chatflow_Sender']) || isset($_GET['searchnot_fop_chat__chatflow_Sender']) || isset($_GET['filter_fop_chat__chatflow_Sender'])) {
															// 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['Sender']['header'] = ob_get_contents(); ob_end_clean();
											$columns['Sender']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['Sender']['width']); ?>px; <?php if ($columns['Sender']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='Sender'><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($item['Sender'])); ?>
	</span></div><?php
											};
											$columns['Sender']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='Sender'
													data-order='<?php echo intval($columns['Sender']['order']); ?>'
													data-width='<?php echo intval($columns['Sender']['width']); ?>'
													data-collapsed='<?php echo intval($columns['Sender']['collapsed']); ?>'
													style='width: <?php echo intval($columns['Sender']['width']); ?>px; <?php if ($columns['Sender']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='Message'
												data-order='<?php echo intval($columns['Message']['order']); ?>'
												data-width='<?php echo intval($columns['Message']['width']); ?>'
												data-collapsed='<?php echo intval($columns['Message']['collapsed']); ?>'
												style='width: <?php echo intval($columns['Message']['width']); ?>px; <?php if ($columns['Message']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}});
		
		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_fop_chat__chatflow_Message'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_fop_chat__chatflow_Message'] = text.val(); } else { delete query['search_fop_chat__chatflow_Message']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_fop_chat__chatflow').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_fop_chat__chatflow_Message'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_fop_chat__chatflow_Message'] = text2.val(); } else { delete query['searchnot_fop_chat__chatflow_Message']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_fop_chat__chatflow').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_fop_chat__chatflow'] == 'Message ASC') {
			query['sort_fop_chat__chatflow'] = 'Message DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'Message DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'Message ASC';
		 }
		 reloadfop_chat__chatflow();
		 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(_('Nachricht')); ?>'><?php echo(_('Nachricht')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Message ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Message DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_Message']) || isset($_GET['range_max_fop_chat__chatflow_Message']) || isset($_GET['deps_fop_chat__chatflow_Message']) || isset($_GET['fullsearch_fop_chat__chatflow_Message']) || isset($_GET['dynamic_fop_chat__chatflow_Message']) || isset($_GET['search_fop_chat__chatflow_Message']) || isset($_GET['searchnot_fop_chat__chatflow_Message']) || isset($_GET['filter_fop_chat__chatflow_Message'])) {
															// 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['Message']['header'] = ob_get_contents(); ob_end_clean();
											$columns['Message']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['Message']['width']); ?>px; <?php if ($columns['Message']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='Message'><span class='overflow-text' title="<?php echo htmlentities($item['Message']); ?>"><?php echo htmlentities($item['Message']); ?></span></div><?php
											};
											$columns['Message']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='Message'
													data-order='<?php echo intval($columns['Message']['order']); ?>'
													data-width='<?php echo intval($columns['Message']['width']); ?>'
													data-collapsed='<?php echo intval($columns['Message']['collapsed']); ?>'
													style='width: <?php echo intval($columns['Message']['width']); ?>px; <?php if ($columns['Message']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='ReportCount'
												data-order='<?php echo intval($columns['ReportCount']['order']); ?>'
												data-width='<?php echo intval($columns['ReportCount']['width']); ?>'
												data-collapsed='<?php echo intval($columns['ReportCount']['collapsed']); ?>'
												style='width: <?php echo intval($columns['ReportCount']['width']); ?>px; <?php if ($columns['ReportCount']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}});
		var von, bis; win.append('<div class=\'fop-floatsorter\'>' + window.i18n_von + '</div>').append(von = $('<input type=\'number\' step=\'any\'><br>').val(query['range_min_fop_chat__chatflow_ReportCount']).on('change keyup paste', function () { query['range_min_fop_chat__chatflow_ReportCount'] = von.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
.append('<div>' + window.i18n_bis + '</div>').append(bis = $('<input type=\'number\' step=\'any\'>').val(query['range_max_fop_chat__chatflow_ReportCount']).on('change keyup paste', function () { query['range_max_fop_chat__chatflow_ReportCount'] = bis.val(); delete query['page_fop_chat__chatflow']; changed = true; }))
; von.focus(); von.select();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_fop_chat__chatflow'] == 'ReportCount ASC') {
			query['sort_fop_chat__chatflow'] = 'ReportCount DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'ReportCount DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'ReportCount ASC';
		 }
		 reloadfop_chat__chatflow();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	" style='text-align: right;'>
													<span class='title-title' title='<?php echo(_('Report-Count')); ?>'><?php echo(_('Report-Count')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'ReportCount ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'ReportCount DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_ReportCount']) || isset($_GET['range_max_fop_chat__chatflow_ReportCount']) || isset($_GET['deps_fop_chat__chatflow_ReportCount']) || isset($_GET['fullsearch_fop_chat__chatflow_ReportCount']) || isset($_GET['dynamic_fop_chat__chatflow_ReportCount']) || isset($_GET['search_fop_chat__chatflow_ReportCount']) || isset($_GET['searchnot_fop_chat__chatflow_ReportCount']) || isset($_GET['filter_fop_chat__chatflow_ReportCount'])) {
															// 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['ReportCount']['header'] = ob_get_contents(); ob_end_clean();
											$columns['ReportCount']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['ReportCount']['width']); ?>px; <?php if ($columns['ReportCount']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='ReportCount'><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($item['ReportCount'])); ?>
	</span></div><?php
											};
											$columns['ReportCount']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='ReportCount'
													data-order='<?php echo intval($columns['ReportCount']['order']); ?>'
													data-width='<?php echo intval($columns['ReportCount']['width']); ?>'
													data-collapsed='<?php echo intval($columns['ReportCount']['collapsed']); ?>'
													style='width: <?php echo intval($columns['ReportCount']['width']); ?>px; <?php if ($columns['ReportCount']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='Timestamp'
												data-order='<?php echo intval($columns['Timestamp']['order']); ?>'
												data-width='<?php echo intval($columns['Timestamp']['width']); ?>'
												data-collapsed='<?php echo intval($columns['Timestamp']['collapsed']); ?>'
												style='width: <?php echo intval($columns['Timestamp']['width']); ?>px; <?php if ($columns['Timestamp']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}}, 600);
		date_filter(win, 'fop_chat__chatflow', 'Timestamp', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadfop_chat__chatflow();  reloadfop_chat__chatflow(); });
	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_fop_chat__chatflow'] == 'Timestamp ASC') {
			query['sort_fop_chat__chatflow'] = 'Timestamp DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'Timestamp DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'Timestamp ASC';
		 }
		 reloadfop_chat__chatflow();
		 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(_('Zeit')); ?>'><?php echo(_('Zeit')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Timestamp ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'Timestamp DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_Timestamp']) || isset($_GET['range_max_fop_chat__chatflow_Timestamp']) || isset($_GET['deps_fop_chat__chatflow_Timestamp']) || isset($_GET['fullsearch_fop_chat__chatflow_Timestamp']) || isset($_GET['dynamic_fop_chat__chatflow_Timestamp']) || isset($_GET['search_fop_chat__chatflow_Timestamp']) || isset($_GET['searchnot_fop_chat__chatflow_Timestamp']) || isset($_GET['filter_fop_chat__chatflow_Timestamp'])) {
															// 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['Timestamp']['header'] = ob_get_contents(); ob_end_clean();
											$columns['Timestamp']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['Timestamp']['width']); ?>px; <?php if ($columns['Timestamp']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='Timestamp'><span class='overflow-text' title="<?php echo htmlentities(($item['Timestamp']) ? strftime(_('datetimeformat_php2'), intval($item['Timestamp'])) : ''); ?>"><?php echo htmlentities(($item['Timestamp']) ? strftime(_('datetimeformat_php2'), intval($item['Timestamp'])) : ''); ?></span></div><?php
											};
											$columns['Timestamp']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='Timestamp'
													data-order='<?php echo intval($columns['Timestamp']['order']); ?>'
													data-width='<?php echo intval($columns['Timestamp']['width']); ?>'
													data-collapsed='<?php echo intval($columns['Timestamp']['collapsed']); ?>'
													style='width: <?php echo intval($columns['Timestamp']['width']); ?>px; <?php if ($columns['Timestamp']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='table'
												data-order='<?php echo intval($columns['table']['order']); ?>'
												data-width='<?php echo intval($columns['table']['width']); ?>'
												data-collapsed='<?php echo intval($columns['table']['collapsed']); ?>'
												style='width: <?php echo intval($columns['table']['width']); ?>px; <?php if ($columns['table']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadfop_chat__chatflow(); 
		}});
		
		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_fop_chat__chatflow_table'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_fop_chat__chatflow_table'] = text.val(); } else { delete query['search_fop_chat__chatflow_table']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_fop_chat__chatflow').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_fop_chat__chatflow_table'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_fop_chat__chatflow_table'] = text2.val(); } else { delete query['searchnot_fop_chat__chatflow_table']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_fop_chat__chatflow').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_fop_chat__chatflow'] == 'table ASC') {
			query['sort_fop_chat__chatflow'] = 'table DESC';
		 } else if (query['sort_fop_chat__chatflow'] == 'table DESC') {
		 	delete query['sort_fop_chat__chatflow'];
		 } else {
			query['sort_fop_chat__chatflow'] = 'table ASC';
		 }
		 reloadfop_chat__chatflow();
		 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(_('Tabelle')); ?>'><?php echo(_('Tabelle')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'table ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_fop_chat__chatflow']) && $_GET['sort_fop_chat__chatflow'] == 'table DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_fop_chat__chatflow_table']) || isset($_GET['range_max_fop_chat__chatflow_table']) || isset($_GET['deps_fop_chat__chatflow_table']) || isset($_GET['fullsearch_fop_chat__chatflow_table']) || isset($_GET['dynamic_fop_chat__chatflow_table']) || isset($_GET['search_fop_chat__chatflow_table']) || isset($_GET['searchnot_fop_chat__chatflow_table']) || isset($_GET['filter_fop_chat__chatflow_table'])) {
															// 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['table']['header'] = ob_get_contents(); ob_end_clean();
											$columns['table']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['table']['width']); ?>px; <?php if ($columns['table']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='table'><span class='overflow-text' title="<?php echo htmlentities($item['table']); ?>"><?php echo htmlentities($item['table']); ?></span></div><?php
											};
											$columns['table']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='table'
													data-order='<?php echo intval($columns['table']['order']); ?>'
													data-width='<?php echo intval($columns['table']['width']); ?>'
													data-collapsed='<?php echo intval($columns['table']['collapsed']); ?>'
													style='width: <?php echo intval($columns['table']['width']); ?>px; <?php if ($columns['table']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									

									// sort by order
									uasort($columns, function ($a, $b) {
										return $a['order'] - $b['order'];
									});
									?>
									<style type='text/css'>
										#fop_chat__chatflow-table .fop-table-header {
											height: <?php echo 32; ?>px;
										}
										#fop_chat__chatflow-table .fop-table-header .fop-table-column .title,
										#fop_chat__chatflow-table .fop-column-handle,
										#fop_chat__chatflow-table .fop-table-row,
										#fop_chat__chatflow-table .fop-table-row .fop-table-column,
										#fop_chat__chatflow-table .fop-table-column-multicontrol,
										#fop_chat__chatflow-table .fop-filter-button {
											height: 32px;
											line-height: 32px;
										}
										</style>
											<div class="fop-table" data-table-id="fop_chat__chatflow">
											<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="fop_chat__chatflow__all-checkbox">
														<input class="mdl-checkbox__input" id="fop_chat__chatflow__all-checkbox" type="checkbox" onchange="checkfop_chat__chatflow('all', 'ID', this.checked);">
														</label>
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon fop_chat__chatflow__mass-action" style='visibility: hidden;' onclick="$.get('DataView/Fop_chat__chatflow/permissions?id=' + checkfop_chat__chatflow(null, 'ID'), function (data) { for (var method in data) if (method != '__cnt') { var btn = $('[data-interaction-name=&quot;' + method + '&quot;]'); if (data[method] >= 1) btn.show(); else btn.hide(); btn.find('.cnt').text(data[method]); }; }); dropDownFixPosition($(this), $(this).next())">
															<i class="material-icons">more_vert</i>
														</button>
														<ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu">
															<?php
		if(true) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="filterall" style="margin-right:auto; text-align:left;"
					onclick="for (key in query) if (key.indexOf('range_min_fop_chat__chatflow_') == 0 || key.indexOf('range_max_fop_chat__chatflow_') == 0 || key.indexOf('deps_fop_chat__chatflow_') == 0 || key.indexOf('fullsearch_fop_chat__chatflow_') == 0 || key.indexOf('dynamic_fop_chat__chatflow_') == 0 || key.indexOf('search_fop_chat__chatflow_') == 0 || key.indexOf('searchnot_fop_chat__chatflow_') == 0 || key.indexOf('filter_fop_chat__chatflow_') == 0) delete query[key]; reloadfop_chat__chatflow(); $(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_fop_chat__chatflow_ID'] = checkfop_chat__chatflow(null, 'ID'); delete query['page_fop_chat__chatflow']; reloadfop_chat__chatflow(); $(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(checkfop_chat__chatflow(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;
			}
			checkfop_chat__chatflow(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 && ((false) && (\FOP\User::getMitglied()))) { ?>
			<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/Fop_chat/delete?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkfop_chat__chatflow(null, 'ID'))).then(function () { reloadfop_chat__chatflow(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?>
														</ul>
														<!-- column hide -->
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon" onclick="dropDownFixPosition($(this), $(this).next())">
															<i class="material-icons">visibility</i>
														</button>
														<ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu">
															<?php foreach ($columns AS $col) { ?>
																<li class="mdl-list__item mdl-button" onclick="
																	var isVisible = this.firstElementChild.innerText !== 'clear';
																	this.firstElementChild.innerText = isVisible ? 'clear' : 'visibility'; // switch icon
																	tableColumnVisibility('fop_chat__chatflow', <?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: 'fop_chat__chatflow', 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_fop_chat__chatflow" <?php \EasyEditor\Navigation::printScroll('dv.Fop_chat__chatflow', '/* 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_fop_chat__chatflow\'] || 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_fop_chat__chatflow\'] = wantedPage;
														reloadfop_chat__chatflow(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-fop_chat-id="<?php echo htmlentities($item['ID']); ?>"<?php if (isset($item['ID'])){
														if (isset($_GET['select']) && isset($_GET['from'])) {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) window.location.href=' . htmlentities(json_encode($_GET['from'] . '&colvalue=' . urlencode($item['ID']))) . ';" ';
														} else {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) open_url(reloadfop_chat__chatflow({action: \'open\', fop_table: \'fop_chat\', fop_id: ' .  htmlentities(json_encode($item['ID'])) . ', fop_from: location.href}, true), false);"';
														}
													}?> >

													<?php if (!isset($_GET['select'])) { ?>
													<div class='fop-table-column noprint' style="width: <?php echo json_encode($firstColumnWidth); ?>px;" onclick="$(this).find('input[type=checkbox]').first().click(); event.stopPropagation();">
													<label onclick="event.stopPropagation();" class="mdl-checkbox mdl-js-checkbox fop_chat__chatflow__checkbox fop_chat__chatflow__checkbox fop_chat__chatflow__checkbox-ID-<?php echo htmlentities($item['ID']); ?>" style="width: auto;" for="fop_chat__chatflow__<?php echo htmlentities($itempos); ?>-checkbox">
													<input class="mdl-checkbox__input" id="fop_chat__chatflow__<?php echo htmlentities($itempos); ?>-checkbox" type="checkbox" onchange="<?php if (isset($item['ID'])) echo 'checkfop_chat__chatflow(' . htmlentities(json_encode($item['ID'])) . ', \'ID\', this.checked); ' ?>">
													</label><button type="button" class="mdl-button mdl-js-button mdl-button--icon fop_chat__chatflow__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-fop_chat__chatflow-action-<?php echo $item['ID'] ?? 0; ?>">
														<?php
		if(isset($item['ID']) && $item['operation::view']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="view" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Fop_chat::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick=" if (!event.ctrlKey) { open_url(reloadfop_chat__chatflow({action: 'open', fop_table: 'fop_chat', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), false); return false; } $(this).closest('.overlay').click(); return false;  
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">find_in_page</i></span><span class="fop-menu-caption" title="<?php echo(_('open')); ?>"><?php echo(_('open')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="edit" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Fop_chat::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::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/Fop_chat/delete?ajax&id=<?php echo htmlentities($item['ID']);?>&from=<?php echo htmlentities(\FOP\Util::getBackUrl());?>').then(function () { reloadfop_chat__chatflow(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?></span>
			</a>
		<?php } ?>
													</ul><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) {
			?><a class="mdl-button mdl-js-button mdl-button--icon tbl-link" data-tbl="fop_chat" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="edit" href="<?php echo htmlentities(\TablesRouter\Fop_chat::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();    reloadfop_chat__chatflow();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, false);
					}
					event.preventDefault();"
				title="<?php echo(_('edit')); ?>">
				<i class="material-icons">edit</i>
			</a><?php } ?><?php
		if(isset($item['ID']) && $item['operation::view']) {
			?><a class="mdl-button mdl-js-button mdl-button--icon tbl-link" data-tbl="fop_chat" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="view" href="<?php echo htmlentities(\TablesRouter\Fop_chat::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();  if (!event.ctrlKey) { open_url(reloadfop_chat__chatflow({action: 'open', fop_table: 'fop_chat', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), false); return false; }  reloadfop_chat__chatflow();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, false);
					}
					event.preventDefault();"
				title="<?php echo(_('open')); ?>">
				<i class="material-icons">find_in_page</i>
			</a><?php } ?>
													</div><?php } ?><?php
													
													foreach ($columns AS $col) {
														$col['render']($item);
													}
													?></div>
												 <?php }?>

													</div>
												</div>

												
												
												</div><?php
												
	
    
  }

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

    
  }

  public static function permissionsAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
		$ids = new \FOP\IDList($id);
		header('Content-Type: application/json');
		
		$perms = \FOP\Database::query('SELECT COUNT(*) AS __cnt, SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filteronly').', SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filterrange').', SUM(CASE (TRUE) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('filterall').', SUM(CASE ((FALSE) AND ('.\FOP\Database::quote(\FOP\User::getMitglied()).')) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('delete').' FROM '.qi('fop_chat').' 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').',
									/* ItemId */ '.qi('ItemId').' AS '.qi('ItemId').',
									/* Message */ '.qi('Message').' AS '.qi('Message').',
									/* ReportCount */ '.qi('ReportCount').' AS '.qi('ReportCount').',
									/* Sender */ '.qi('Sender').' AS '.qi('Sender').',
									/* Timestamp */ '.qi('Timestamp').' AS '.qi('Timestamp').',
									/* operation::5a81af87737a91fddc7e5ca3b6e5661f1118a77b491f64f5e16676d1448b78b1 */ (('.qi('fop_chat').'.'.qi('ReportCount').') > (0)) AS '.qi('operation::5a81af87737a91fddc7e5ca3b6e5661f1118a77b491f64f5e16676d1448b78b1').',
									/* operation::create */ ' . ((\FOP\User::getMitglied()) ? 1 : 0) . ' AS '.qi('operation::create').',
									/* operation::delete */ (FALSE) AND ('.\FOP\Database::quote(\FOP\User::getMitglied()).') AS '.qi('operation::delete').',
									/* operation::edit */ (FALSE) AND ('.\FOP\Database::quote(\FOP\User::getMitglied()).') AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getMitglied()).') AS '.qi('operation::view').',
									/* table */ '.qi('table').' AS '.qi('table').',
									1
								FROM '.qi('fop_chat').' '.qi('fop_chat').'
								WHERE ((('.\FOP\Database::quote(\FOP\User::getMitglied()).')))) AS t
								WHERE ' . (isset($params['range_min_fop_chat__chatflow_ItemId']) ? ($params['range_min_fop_chat__chatflow_ItemId'] !== '' && is_numeric($params['range_min_fop_chat__chatflow_ItemId']) ? 't.'.qi('ItemId').' >= ' . \FOP\Database::quote($params['range_min_fop_chat__chatflow_ItemId']) . ' AND ' : '') : '') . 
								(isset($params['range_min_fop_chat__chatflow_Sender']) ? ($params['range_min_fop_chat__chatflow_Sender'] !== '' && is_numeric($params['range_min_fop_chat__chatflow_Sender']) ? 't.'.qi('Sender').' >= ' . \FOP\Database::quote($params['range_min_fop_chat__chatflow_Sender']) . ' AND ' : '') : '') . 
								(isset($params['range_min_fop_chat__chatflow_ReportCount']) ? ($params['range_min_fop_chat__chatflow_ReportCount'] !== '' && is_numeric($params['range_min_fop_chat__chatflow_ReportCount']) ? 't.'.qi('ReportCount').' >= ' . \FOP\Database::quote($params['range_min_fop_chat__chatflow_ReportCount']) . ' AND ' : '') : '') . 
								(isset($params['range_min_fop_chat__chatflow_Timestamp']) ? ($params['range_min_fop_chat__chatflow_Timestamp'] !== '' && is_numeric($params['range_min_fop_chat__chatflow_Timestamp']) ? 't.'.qi('Timestamp').' >= ' . \FOP\Database::quote($params['range_min_fop_chat__chatflow_Timestamp']) . ' AND ' : '') : '') . 
								(isset($params['range_max_fop_chat__chatflow_ItemId']) ? ($params['range_max_fop_chat__chatflow_ItemId'] !== '' && is_numeric($params['range_max_fop_chat__chatflow_ItemId']) ? 't.'.qi('ItemId').' <= ' . \FOP\Database::quote($params['range_max_fop_chat__chatflow_ItemId']) . ' AND ' : '') : '') . 
								(isset($params['range_max_fop_chat__chatflow_Sender']) ? ($params['range_max_fop_chat__chatflow_Sender'] !== '' && is_numeric($params['range_max_fop_chat__chatflow_Sender']) ? 't.'.qi('Sender').' <= ' . \FOP\Database::quote($params['range_max_fop_chat__chatflow_Sender']) . ' AND ' : '') : '') . 
								(isset($params['range_max_fop_chat__chatflow_ReportCount']) ? ($params['range_max_fop_chat__chatflow_ReportCount'] !== '' && is_numeric($params['range_max_fop_chat__chatflow_ReportCount']) ? 't.'.qi('ReportCount').' <= ' . \FOP\Database::quote($params['range_max_fop_chat__chatflow_ReportCount']) . ' AND ' : '') : '') . 
								(isset($params['range_max_fop_chat__chatflow_Timestamp']) ? ($params['range_max_fop_chat__chatflow_Timestamp'] !== '' && is_numeric($params['range_max_fop_chat__chatflow_Timestamp']) ? 't.'.qi('Timestamp').' <= ' . \FOP\Database::quote($params['range_max_fop_chat__chatflow_Timestamp']) . ' AND ' : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_ItemId']) ? ($params['filter_fop_chat__chatflow_ItemId'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_ItemId']))->toSQL('t.'.qi('ItemId').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_Sender']) ? ($params['filter_fop_chat__chatflow_Sender'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_Sender']))->toSQL('t.'.qi('Sender').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_Message']) ? ($params['filter_fop_chat__chatflow_Message'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_Message']))->toSQL('t.'.qi('Message').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_ReportCount']) ? ($params['filter_fop_chat__chatflow_ReportCount'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_ReportCount']))->toSQL('t.'.qi('ReportCount').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_Timestamp']) ? ($params['filter_fop_chat__chatflow_Timestamp'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_Timestamp']))->toSQL('t.'.qi('Timestamp').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_table']) ? ($params['filter_fop_chat__chatflow_table'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_table']))->toSQL('t.'.qi('table').'') . ') AND ') : '') : '') . 
								(isset($params['filter_fop_chat__chatflow_ID']) ? ($params['filter_fop_chat__chatflow_ID'] !== '' ? ('(' . (new \FOP\IDList($params['filter_fop_chat__chatflow_ID']))->toSQL('t.'.qi('ID').'') . ') AND ') : '') : '') . 
								(isset($params['search_fop_chat__chatflow_Message']) ? 't.'.qi('Message').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_fop_chat__chatflow_Message'] . '%') . ' AND ' : '') . 
								(isset($params['search_fop_chat__chatflow_table']) ? 't.'.qi('table').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_fop_chat__chatflow_table'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_fop_chat__chatflow_Message']) ? 'NOT t.'.qi('Message').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_fop_chat__chatflow_Message'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_fop_chat__chatflow_table']) ? 'NOT t.'.qi('table').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_fop_chat__chatflow_table'] . '%') . ' AND ' : '') . 
								(isset($params['search_fop_chat__chatflow']) ? '(' . 't.'.qi('Message').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_fop_chat__chatflow'] . '%') . ' OR ' . 't.'.qi('table').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_fop_chat__chatflow'] . '%') . ') AND ' : '') . 
								'
								(('.qi('t').'.'.qi('ReportCount').') > (0)) AND  TRUE ';
								return $sql;
	
    
  }

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

								$order = (\FOP\Util::array_value(array(
									'Message ASC' => 'ORDER BY t.'.qi('Message').' ASC',
									'table ASC' => 'ORDER BY t.'.qi('table').' ASC',
									'ItemId ASC' => 'ORDER BY t.'.qi('ItemId').' ASC',
									'Sender ASC' => 'ORDER BY t.'.qi('Sender').' ASC',
									'ReportCount ASC' => 'ORDER BY t.'.qi('ReportCount').' ASC',
									'Timestamp ASC' => 'ORDER BY t.'.qi('Timestamp').' ASC',
									'Message DESC' => 'ORDER BY t.'.qi('Message').' DESC',
									'table DESC' => 'ORDER BY t.'.qi('table').' DESC',
									'ItemId DESC' => 'ORDER BY t.'.qi('ItemId').' DESC',
									'Sender DESC' => 'ORDER BY t.'.qi('Sender').' DESC',
									'ReportCount DESC' => 'ORDER BY t.'.qi('ReportCount').' DESC',
									'Timestamp DESC' => 'ORDER BY t.'.qi('Timestamp').' DESC',
									'' => ''), isset($params['sort_fop_chat__chatflow']) ? $params['sort_fop_chat__chatflow'] : '') ?: '');
								// 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['ItemId'] = \Types\Integer::unpack($item['ItemId']);
											$item['Sender'] = \Types\Integer::unpack($item['Sender']);
											$item['ReportCount'] = \Types\Integer::unpack($item['ReportCount']);
											$item['Timestamp'] = intval($item['Timestamp']);
											
											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['ItemId'] = \Types\Integer::unpack($item['ItemId']);
										$item['Sender'] = \Types\Integer::unpack($item['Sender']);
										$item['ReportCount'] = \Types\Integer::unpack($item['ReportCount']);
										$item['Timestamp'] = intval($item['Timestamp']);
										
									}
									unset($item);

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

									
								}

								return $result;
	
    
  }

  public static function getFilterHTML($params, $delimiter = ', ' , $showButton = true ) { 
    
    
    // --- BLOCK: main ---
    
		// Contract: ist showButton == false, sollten keine HTML-Tags im Output enthalten sein (Verwendung in Dateinamen!!)
		$filters = [];
		
	if (isset($params['range_min_fop_chat__chatflow_ItemId']) && isset($params['range_max_fop_chat__chatflow_ItemId'])) {
		array_push($filters, _('ItemID') . ': ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_ItemId'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_ItemId'])
	));
	} else if (isset($params['range_min_fop_chat__chatflow_ItemId'])) {
		array_push($filters, _('ItemID') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_ItemId'])
	));
	} else if (isset($params['range_max_fop_chat__chatflow_ItemId'])) {
		array_push($filters, _('ItemID') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_ItemId'])
	));
	}
	if (isset($params['range_min_fop_chat__chatflow_Sender']) && isset($params['range_max_fop_chat__chatflow_Sender'])) {
		array_push($filters, _('Sender') . ': ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_Sender'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_Sender'])
	));
	} else if (isset($params['range_min_fop_chat__chatflow_Sender'])) {
		array_push($filters, _('Sender') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_Sender'])
	));
	} else if (isset($params['range_max_fop_chat__chatflow_Sender'])) {
		array_push($filters, _('Sender') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_Sender'])
	));
	}
	if (isset($params['range_min_fop_chat__chatflow_ReportCount']) && isset($params['range_max_fop_chat__chatflow_ReportCount'])) {
		array_push($filters, _('Report-Count') . ': ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_ReportCount'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_ReportCount'])
	));
	} else if (isset($params['range_min_fop_chat__chatflow_ReportCount'])) {
		array_push($filters, _('Report-Count') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_fop_chat__chatflow_ReportCount'])
	));
	} else if (isset($params['range_max_fop_chat__chatflow_ReportCount'])) {
		array_push($filters, _('Report-Count') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_fop_chat__chatflow_ReportCount'])
	));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_fop_chat__chatflow_Timestamp'])
		&& isset($params['range_max_fop_chat__chatflow_Timestamp'])
		&& (date('d', $params['range_min_fop_chat__chatflow_Timestamp']) == '01') //check first day of month
		&& (date('d', $params['range_max_fop_chat__chatflow_Timestamp']) == date('t', $params['range_max_fop_chat__chatflow_Timestamp'])) //check last day of month
		&& (date('Y-m', $params['range_min_fop_chat__chatflow_Timestamp']) == date('Y-m', $params['range_max_fop_chat__chatflow_Timestamp'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Zeit') . ': ' . strftime('%B', $params['range_min_fop_chat__chatflow_Timestamp']) . ' ' . date('Y', $params['range_min_fop_chat__chatflow_Timestamp']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_fop_chat__chatflow_Timestamp'])
		&& isset($params['range_max_fop_chat__chatflow_Timestamp'])
		&& (date('Y-m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == (date('Y-m-d', $params['range_max_fop_chat__chatflow_Timestamp'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('next day', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('next day', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Zeit') . ': ' . date('d.m.Y', $params['range_min_fop_chat__chatflow_Timestamp']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_fop_chat__chatflow_Timestamp'])
		&& isset($params['range_max_fop_chat__chatflow_Timestamp'])
		&& (date('Y', $params['range_min_fop_chat__chatflow_Timestamp']) == (date('Y', $params['range_max_fop_chat__chatflow_Timestamp'])))
		&& ((date('m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == '01-01'))
		&& ((date('m-d', $params['range_max_fop_chat__chatflow_Timestamp']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Zeit') . ': ' . date('Y', $params['range_min_fop_chat__chatflow_Timestamp']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_fop_chat__chatflow_Timestamp'])
		&& isset($params['range_max_fop_chat__chatflow_Timestamp'])
		&& ( (
		 ((date('m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == '01-01'))
		&& ((date('m-d', $params['range_max_fop_chat__chatflow_Timestamp']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == '04-01'))
		&& ((date('m-d', $params['range_max_fop_chat__chatflow_Timestamp']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == '07-01'))
		&& ((date('m-d', $params['range_max_fop_chat__chatflow_Timestamp']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_fop_chat__chatflow_Timestamp']) == '10-01'))
		&& ((date('m-d', $params['range_max_fop_chat__chatflow_Timestamp']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
					query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_fop_chat__chatflow_Timestamp']).'&apos;;
					reloadfop_chat__chatflow(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_fop_chat__chatflow_Timestamp']).'&apos;;
				query[&apos;range_max_fop_chat__chatflow_Timestamp&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_fop_chat__chatflow_Timestamp']).'&apos;;
				reloadfop_chat__chatflow(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Zeit') . ': Q' . (ceil((date('m', $params['range_min_fop_chat__chatflow_Timestamp']))/3)) . ' (' . date('d.m.', $params['range_min_fop_chat__chatflow_Timestamp']) . ' - ' . date('d.m.Y', $params['range_max_fop_chat__chatflow_Timestamp']) . ')')
		]);
	}
	else if (isset($params['range_min_fop_chat__chatflow_Timestamp']) && isset($params['range_max_fop_chat__chatflow_Timestamp'])) {
		array_push($filters, _('Zeit') . ': ' . (($params['range_min_fop_chat__chatflow_Timestamp']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_fop_chat__chatflow_Timestamp'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_fop_chat__chatflow_Timestamp']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_fop_chat__chatflow_Timestamp'])) : ''));
	} else if (isset($params['range_min_fop_chat__chatflow_Timestamp'])) {
		array_push($filters, _('Zeit') . ': ' . _('filters_from') . ' ' . (($params['range_min_fop_chat__chatflow_Timestamp']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_fop_chat__chatflow_Timestamp'])) : ''));
	} else if (isset($params['range_max_fop_chat__chatflow_Timestamp'])) {
		array_push($filters, _('Zeit') . ': ' . _('filters_to') . ' ' . (($params['range_max_fop_chat__chatflow_Timestamp']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_fop_chat__chatflow_Timestamp'])) : ''));
	}if (isset($params['filter_fop_chat__chatflow_ItemId'])) {
		if ($params['filter_fop_chat__chatflow_ItemId'] == '_null') {
			array_push($filters, _('ItemID') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_ItemId']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('ItemID') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_fop_chat__chatflow_Sender'])) {
		if ($params['filter_fop_chat__chatflow_Sender'] == '_null') {
			array_push($filters, _('Sender') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_Sender']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Sender') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_fop_chat__chatflow_Message'])) {
		if ($params['filter_fop_chat__chatflow_Message'] == '_null') {
			array_push($filters, _('Nachricht') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_Message']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Nachricht') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_fop_chat__chatflow_ReportCount'])) {
		if ($params['filter_fop_chat__chatflow_ReportCount'] == '_null') {
			array_push($filters, _('Report-Count') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_ReportCount']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Report-Count') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_fop_chat__chatflow_Timestamp'])) {
		if ($params['filter_fop_chat__chatflow_Timestamp'] == '_null') {
			array_push($filters, _('Zeit') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_Timestamp']))->all() AS $val) {
				$value = ($val) ? strftime(_('datetimeformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Zeit') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_fop_chat__chatflow_table'])) {
		if ($params['filter_fop_chat__chatflow_table'] == '_null') {
			array_push($filters, _('Tabelle') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_fop_chat__chatflow_table']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Tabelle') . ': ' . implode(', ', $values));
		}
	}if (isset($params['search_fop_chat__chatflow_Message'])) {
		array_push($filters, _('Message') . ' ' . _('filter_contains') . ' ' . $params['search_fop_chat__chatflow_Message']);
	}if (isset($params['search_fop_chat__chatflow_table'])) {
		array_push($filters, _('table') . ' ' . _('filter_contains') . ' ' . $params['search_fop_chat__chatflow_table']);
	}if (isset($params['searchnot_fop_chat__chatflow_Message'])) {
		array_push($filters, _('Message') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_fop_chat__chatflow_Message']);
	}if (isset($params['searchnot_fop_chat__chatflow_table'])) {
		array_push($filters, _('table') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_fop_chat__chatflow_table']);
	}
		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(\'_fop_chat__chatflow_\')) delete query[q];} reloadfop_chat__chatflow(); ">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 == 'fop_chat') {
	\FOP\Session::setPayload('dv-fop_chat', [
		'id' => 'fop_chat__chatflow',
		'tbl' => 'fop_chat',
		'idcol' => 'ID',
		'prev' => \DataViewRouter\Fop_chat__chatflow::stepURL('fop_chat', 'XXX', -1),
		'next' => \DataViewRouter\Fop_chat__chatflow::stepURL('fop_chat', '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\Fop_chat::chatflowURL2($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();

    
  }

  public static function viewAction() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getMitglied())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


		?><!DOCTYPE html><html><head><title><?php echo(_('gemeldete Chat-Nachrichten')); ?></title><base href='<?php echo \FOP\Util::getCurrentBaseurl(); ?>'><meta name="google" content="notranslate"><meta http-equiv="Content-Language" content="<?php echo htmlentities(\FOP\I18n::getLocale()); ?>"><meta charset="utf-8"><link rel="stylesheet" type="text/css" href="style_dependencies.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><link rel="stylesheet" type="text/css" href="style.css?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"><script type="text/javascript" src="js/script_dependencies.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="mobile-web-app-capable" content="yes"><link rel="manifest" href="manifest.webmanifest"><script type="text/javascript">moment.locale('<?php echo(\FOP\I18n::getShortLocale()); ?>');</script><script type="text/javascript" src="js/form.js"></script><script type="text/javascript">window.globals = <?php
	echo json_encode(['user:superadmin' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSuperadmin(), 'user:mitglied' => /* TODO: resanitizer später mal */(integer) \FOP\User::getMitglied(), 'user:gruppe' => /* TODO: resanitizer später mal */(integer) \FOP\User::getGruppe(), 'user:campaign' => /* TODO: resanitizer später mal */(integer) \FOP\User::getCampaign(), 'user:sammlung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getSammlung(), 'user:protokoll' => /* TODO: resanitizer später mal */(integer) \FOP\User::getProtokoll(), 'user:ID' => /* TODO: resanitizer später mal */(integer) \FOP\User::getID(), 'user:buchhaltung' => /* TODO: resanitizer später mal */(integer) \FOP\User::getBuchhaltung()]);
?>;</script><script type="text/javascript" src="angular/<?php echo(\FOP\I18n::getShortLocale()); ?>/js/alltypes.js?v=<?php echo(\FOP\Util::getVersionAppendix()); ?>"></script><script type="text/javascript" src="angular/angular-i18n/angular-locale_<?php echo \FOP\I18n::getAngularLocale(); ?>.js"></script><script type="text/javascript" src="js/date-filter.js"></script><script type="text/javascript" src="js/dropdown.js"></script><script type="text/javascript" src="js/numeric.js"></script><script type="text/javascript" src="js/getparam.js"></script><script type="text/javascript" src="js/tables.js"></script>
		<script type="text/javascript" src="js/parsehash.js"></script><script type="text/javascript">
		window.query = <?php echo json_encode($_GET, JSON_FORCE_OBJECT); ?>;
		window.baseurl = <?php echo json_encode(\FOP\Util::getCurrentBaseurl()); ?>;

		window.i18n_weiter = <?php echo json_encode(_('Weiter'));?>;
		//Filter I18n:
		window.i18n_quartal = <?php echo json_encode(_('Quarter'));?>;
		window.i18n_alle = <?php echo json_encode(_('All'));?>;
		window.i18n_leere = <?php echo json_encode(_('Empty'));?>;
		window.i18n_tag = <?php echo json_encode(_('Tag'));?>;
		window.i18n_woche = <?php echo json_encode(_('Woche'));?>;
		window.i18n_zeitraum = <?php echo json_encode(_('Period'));?>;
		window.i18n_monat = <?php echo json_encode(_('Monat'));?>;
		window.i18n_jahr = <?php echo json_encode(_('Jahr'));?>;
		window.i18n_von = <?php echo json_encode(_('filters_from'));?>;
		window.i18n_bis = <?php echo json_encode(_('filters_to'));?>;
		window.i18n_tabButton = <?php echo json_encode(_('open_in_new_tab'));?>;
		window.i18n_closeButton = <?php echo json_encode(_('close'));?>;
		</script></head><script type="text/javascript">const fopPushPublicKey = '<?php echo(addslashes(\FOP\Configuration::getFOPPushPublicKey())); ?>';
        const fopUserID = <?php echo(intval(\FOP\User::getID())); ?>;
        var fopPushDisabled = false;
    </script><script type="text/javascript" src="js/serviceworkersetup.js"></script><body ng-app='app'>
		<div class='mdl-js-snackbar mdl-snackbar' id='snackbar'>
			<div class='mdl-snackbar__text'></div>
			<button class='mdl-snackbar__action' type='button'></button>
		</div>
		<script>
			var snackbar = document.querySelector('#snackbar');
			componentHandler.upgradeElement(snackbar, 'MaterialSnackbar');
			$(function () {
				setTimeout(function () {
					$('.fop-layout').scrollTop(0);
				}, 0);
			});
		</script>

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('gemeldete Chat-Nachrichten')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<span class="mdl-layout-title"><?php echo(_('gemeldete Chat-Nachrichten')); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


				<?php  \EasyEditor\Navigation::render(); ?>
      
				<main class="mdl-layout__content" id="content">
					<div class="fop-content">
						<?php } ?>
						
							<div class="content" id="1">
								

								<div
								 
								id="cardform-fop_chat__chatflow"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormFop_chat__chatflow" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\Fop_chat__chatflow::renderScript(); ?>
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'main_table',
										'title' => _('table'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'area', // area (51) / tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									

									
									/* load order from database
										schema: fop_form_feature(user, form, subid, key, value)
										key = (order, mode, position, collapsed)
									*/
									$upbar_collapsed = false;
									// default values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', (SELECT '.qi('value').' FROM fop_form_feature b WHERE a.subid = b.subid AND a.'.qi('key').' = b.'.qi('key').' AND '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY '.qi('value').' ORDER BY COUNT(*) DESC LIMIT 1) AS '.qi('value').' FROM fop_form_feature a WHERE '.qi('user').' = '.intval(\FOP\User::getID()).' GROUP BY subid, '.qi('key'))->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										}
									}
									// form specific special values
									foreach (\FOP\Database::query('SELECT subid, '.qi('key').', '.qi('value').' FROM fop_form_feature a WHERE form = \'fop_chat__chatflow\' AND '.qi('user').' = '.intval(\FOP\User::getID()).'')->fetchAll(\PDO::FETCH_ASSOC) AS $setting) {
										if (isset($features[$setting['subid']])) {
											$features[$setting['subid']][$setting['key']] = $setting['value'];
										} else if ($setting['subid'] == 'upbar' && $setting['key'] == 'collapsed') {
											$upbar_collapsed = (bool) $setting['value'];
										}
									}

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main_table']);
										?>
	<?php if (((\FOP\User::getMitglied()))) { ?>
	<div id="fop_chat__chatflow-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadfop_chat__chatflow()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Fop_chat__chatflow::renderTabTableAction();
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['main_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										$(function(){
											// bei Änderungen: prüfen, ob Form geändert wurde
											var formData = $('#cardform-fop_chat__chatflow').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-fop_chat__chatflow').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-fop_chat__chatflow').on('submit', function () {
												document.body.onbeforeunload = undefined;
											});
											<?php if ($upbar_collapsed) {
												?>$('#fop-bar-mainbutton').click();<?php
											} ?>
											$('#fop-bar-mainbutton').click(function () {
												setTimeout(function () {
													setCFF('upbar', 'collapsed', $('#fop-bar-container').is(':visible') ? 0 : 1);
												}, 440); /* perfect timing for fadeOut */
											});
										});
										
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=fop_chat__chatflow&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=fop_chat__chatflow&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-fop_chat__chatflow')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-fop_chat__chatflow input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

										$(window).keydown(function(event) {
											 if (event.ctrlKey && String.fromCharCode(event.which).toLowerCase() == 's') {
												 event.preventDefault();
												 $('button[type=submit]').click();
												 return false;
											 }
										});

										
										$(document).on('keyup',function(evt) {
										   if (evt.keyCode == 27) {
												if (window.parent) {
													window.close(); // iframe:close
												} else {
													window.history.back();
												}
											}
												});
										
									</script>

							</div>
							

							</div>
							<div class="content" id="focus-supersearch">
		<script type='text/javascript'>
			$(function () {
				var focusfield = $('#supersearch');
				
				if (focusfield.length) {
					focusfield[0].focus();
					focusfield[0].select();
				}
			});
		</script>
	
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    
  }


  
  

  
  
}



