<?php

namespace DataView;

class Campaign {
  
  

  
  

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

		var iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout = null;
		function changefilter_campaign_email_interact1_stateSearchFilter(val, callback) {
			if(iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout) clearTimeout(iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout);

			iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout = setTimeout(function() {
				$.getJSON(reloadcampaign({action: 'getfilter_campaign_email_interact1_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaign_email_interact1_state_orig'] = val;
				});
			}, 300);
		}

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

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

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

		return gui;
	}
    function changefilter_campaign_email_interact2_stateListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaign_email_interact2_state', val, cb.checked);
		  } else {
			  delete query['filter_campaign_email_interact2_state'];
		  }reloadcampaign();
        
    }

		var i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout = null;
		function changefilter_campaign_email_interact2_stateSearchFilter(val, callback) {
			if(i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout) clearTimeout(i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout);

			i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout = setTimeout(function() {
				$.getJSON(reloadcampaign({action: 'getfilter_campaign_email_interact2_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaign_email_interact2_state_orig'] = val;
				});
			}, 300);
		}

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

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

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

		return gui;
	}
									
    function changefilter_campaign_email_interact1_stateListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaign_email_interact1_state', val, cb.checked);
		  } else {
			  delete query['filter_campaign_email_interact1_state'];
		  }reloadcampaign();
        
    }

		var iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout = null;
		function changefilter_campaign_email_interact1_stateSearchFilter(val, callback) {
			if(iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout) clearTimeout(iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout);

			iceda76e3a56bf92bef89e28e4902686020ec8faea2f0b88750721eada8d6926btimeout = setTimeout(function() {
				$.getJSON(reloadcampaign({action: 'getfilter_campaign_email_interact1_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaign_email_interact1_state_orig'] = val;
				});
			}, 300);
		}

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

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

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

		return gui;
	}
    function changefilter_campaign_email_interact2_stateListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaign_email_interact2_state', val, cb.checked);
		  } else {
			  delete query['filter_campaign_email_interact2_state'];
		  }reloadcampaign();
        
    }

		var i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout = null;
		function changefilter_campaign_email_interact2_stateSearchFilter(val, callback) {
			if(i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout) clearTimeout(i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout);

			i49243e0ae48c9db111e35d00da14cf6ae24ff19ae361d5d0fe6ff7e15c8df5a1timeout = setTimeout(function() {
				$.getJSON(reloadcampaign({action: 'getfilter_campaign_email_interact2_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaign_email_interact2_state_orig'] = val;
				});
			}, 300);
		}

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

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

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

		return gui;
	}
									function updateNumbercampaign(col) {
										//var checklist = window.DataViewChecked['campaign'][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['campaign'] && window.DataViewChecked['campaign'][col].ranges.length > 0) {
											$('.campaign__mass-action').css('visibility', 'visible');
											$('.campaign__action').css('visibility', 'hidden');
										} else {
											$('.campaign__mass-action').css('visibility', 'hidden');
											$('.campaign__action').css('visibility', 'visible');
										}
										$('.campaign__checkbox').each(function (idx, x) {
											for (var cssclass of x.classList) {
												if (cssclass.startsWith('campaign__checkbox-'+col+'-')) {
													var my_id = cssclass.substr(('campaign__checkbox-'+col+'-').length);
													if (window.DataViewChecked) {
														x.MaterialCheckbox[checklist.has(my_id) ? 'check' : 'uncheck']();
													}
												}
											}
										});
									}
									function reloadcampaign (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/Campaign/" + 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::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
											delete nq['action'];
											querystr = "DataView/Campaign/renderTabTable?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#campaign-table")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#campaign-table")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#campaign-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
												updateNumbercampaign('ID');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#campaign-table");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadcampaign()"></div>');
											}
											<?php } ?>
											
										}
									}
									function checkcampaign (id, col, checked) {
										// ID-Liste aufbauen
										if (!window.DataViewChecked) window.DataViewChecked = {};
										if (!window.DataViewChecked['campaign']) window.DataViewChecked['campaign'] = {};
										if (!window.DataViewChecked['campaign'][col]) window.DataViewChecked['campaign'][col] = new IDList();

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

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

    
  }

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

	</script>
	<?php
	
    
  }

  public static function renderTabTableAction() { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php if(((\FOP\User::getCampaign()))) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onclick="
		var self = this;
		event.preventDefault();
		$.get(reloadcampaign({action: 'open', fop_table: 'campaign', fop_id: '_', fop_from: location.href}, true))
		.then(function () {
			window.open_url(self.href, true);
		});" href="<?php echo htmlentities(\TablesRouter\Campaign::createURL2(['from' => $_GET['from'] ?? null, 'popup' => $_GET['popup'] ?? null])); ?>"><i class="material-icons">add</i> <?php echo(sprintf(_('create %s'), _('Aktion'))); ?></a><?php } ?></div><?php 
								\FOP\User::getIsGuest();
								$itemheight = 32;
								$itemsperpage = ceil(1080 / $itemheight * 0.8);
								$page = (isset($_GET['page_campaign']) ? intval($_GET['page_campaign']) : 0);
								$addlines = (isset($_GET['addlines_campaign']) ? intval($_GET['addlines_campaign']) : 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' => 'name',
												'desc' => _('Bezeichnung'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

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

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

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

											];
											$columns['count'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'email_campaign',
												'desc' => _('Email'),
												'order' => ++$order,
												'width' => 40, // default value
												'collapsed' => 1

											];
											$columns['email_campaign'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'post_campaign',
												'desc' => _('campaignPost'),
												'order' => ++$order,
												'width' => 40, // default value
												'collapsed' => 1

											];
											$columns['post_campaign'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'phone_campaign',
												'desc' => _('campaignPhone'),
												'order' => ++$order,
												'width' => 40, // default value
												'collapsed' => 1

											];
											$columns['phone_campaign'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'pdf_type',
												'desc' => _('PDF-Layout'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['pdf_type'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'pinned',
												'desc' => _('angepinnt'),
												'order' => ++$order,
												'width' => 40, // default value
												'collapsed' => 0

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

											];
											$columns['color'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'creation',
												'desc' => _('Erstellung'),
												'order' => ++$order,
												'width' => 100, // default value
												'collapsed' => 1

											];
											$columns['creation'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'lastUpdate',
												'desc' => _('Letzte Änderung'),
												'order' => ++$order,
												'width' => 100, // default value
												'collapsed' => 1

											];
											$columns['lastUpdate'] = $col;
										}
									
										if(true){
											$col = [
												'id' => 'mode',
												'desc' => _('neue %s|Mitglieder'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

											];
											$columns['mode'] = $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('campaign'))->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='name'
												data-order='<?php echo intval($columns['name']['order']); ?>'
												data-width='<?php echo intval($columns['name']['width']); ?>'
												data-collapsed='<?php echo intval($columns['name']['collapsed']); ?>'
												style='width: <?php echo intval($columns['name']['width']); ?>px; <?php if ($columns['name']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		
		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_campaign_name'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_campaign_name'] = text.val(); } else { delete query['search_campaign_name']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign_name'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_campaign_name'] = text2.val(); } else { delete query['searchnot_campaign_name']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign'] == 'name ASC') {
			query['sort_campaign'] = 'name DESC';
		 } else if (query['sort_campaign'] == 'name DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'name ASC';
		 }
		 reloadcampaign();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Bezeichnung')); ?>'><?php echo(_('Bezeichnung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'name ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'name DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_name']) || isset($_GET['range_max_campaign_name']) || isset($_GET['deps_campaign_name']) || isset($_GET['fullsearch_campaign_name']) || isset($_GET['dynamic_campaign_name']) || isset($_GET['search_campaign_name']) || isset($_GET['searchnot_campaign_name']) || isset($_GET['filter_campaign_name'])) {
															// 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['name']['header'] = ob_get_contents(); ob_end_clean();
											$columns['name']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['name']['width']); ?>px; <?php if ($columns['name']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='name'><span class='overflow-text' title="<?php echo htmlentities($item['name']); ?>"><?php echo htmlentities($item['name']); ?></span></div><?php
											};
											$columns['name']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='name'
													data-order='<?php echo intval($columns['name']['order']); ?>'
													data-width='<?php echo intval($columns['name']['width']); ?>'
													data-collapsed='<?php echo intval($columns['name']['collapsed']); ?>'
													style='width: <?php echo intval($columns['name']['width']); ?>px; <?php if ($columns['name']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='date'
												data-order='<?php echo intval($columns['date']['order']); ?>'
												data-width='<?php echo intval($columns['date']['width']); ?>'
												data-collapsed='<?php echo intval($columns['date']['collapsed']); ?>'
												style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}}, 600);
		date_filter(win, 'campaign', 'date', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadcampaign();  reloadcampaign(); });
	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_campaign'] == 'date ASC') {
			query['sort_campaign'] = 'date DESC';
		 } else if (query['sort_campaign'] == 'date DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'date ASC';
		 }
		 reloadcampaign();
		 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(_('Start')); ?>'><?php echo(_('Start')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'date ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'date DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_date']) || isset($_GET['range_max_campaign_date']) || isset($_GET['deps_campaign_date']) || isset($_GET['fullsearch_campaign_date']) || isset($_GET['dynamic_campaign_date']) || isset($_GET['search_campaign_date']) || isset($_GET['searchnot_campaign_date']) || isset($_GET['filter_campaign_date'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['date']['header'] = ob_get_contents(); ob_end_clean();
											$columns['date']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='date'><span class='overflow-text' title="<?php echo htmlentities(($item['date']) ? strftime(_('dateformat_php2'), intval($item['date'])) : ''); ?>"><?php echo htmlentities(($item['date']) ? strftime(_('dateformat_php2'), intval($item['date'])) : ''); ?></span></div><?php
											};
											$columns['date']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='date'
													data-order='<?php echo intval($columns['date']['order']); ?>'
													data-width='<?php echo intval($columns['date']['width']); ?>'
													data-collapsed='<?php echo intval($columns['date']['collapsed']); ?>'
													style='width: <?php echo intval($columns['date']['width']); ?>px; <?php if ($columns['date']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='desc'
												data-order='<?php echo intval($columns['desc']['order']); ?>'
												data-width='<?php echo intval($columns['desc']['width']); ?>'
												data-collapsed='<?php echo intval($columns['desc']['collapsed']); ?>'
												style='width: <?php echo intval($columns['desc']['width']); ?>px; <?php if ($columns['desc']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		
		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_campaign_desc'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_campaign_desc'] = text.val(); } else { delete query['search_campaign_desc']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign_desc'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_campaign_desc'] = text2.val(); } else { delete query['searchnot_campaign_desc']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign'] == 'desc ASC') {
			query['sort_campaign'] = 'desc DESC';
		 } else if (query['sort_campaign'] == 'desc DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'desc ASC';
		 }
		 reloadcampaign();
		 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(_('Beschreibung')); ?>'><?php echo(_('Beschreibung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'desc ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'desc DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_desc']) || isset($_GET['range_max_campaign_desc']) || isset($_GET['deps_campaign_desc']) || isset($_GET['fullsearch_campaign_desc']) || isset($_GET['dynamic_campaign_desc']) || isset($_GET['search_campaign_desc']) || isset($_GET['searchnot_campaign_desc']) || isset($_GET['filter_campaign_desc'])) {
															// 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['desc']['header'] = ob_get_contents(); ob_end_clean();
											$columns['desc']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['desc']['width']); ?>px; <?php if ($columns['desc']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='desc'><span class='overflow-text' title="<?php echo htmlentities($item['desc']); ?>"><?php echo (str_replace("\n", "&#x23ce;", htmlentities(mb_substr($item['desc'], 0, 40)))) . (strlen($item['desc']) >= 40 ? '…' : ''); ?></span></div><?php
											};
											$columns['desc']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='desc'
													data-order='<?php echo intval($columns['desc']['order']); ?>'
													data-width='<?php echo intval($columns['desc']['width']); ?>'
													data-collapsed='<?php echo intval($columns['desc']['collapsed']); ?>'
													style='width: <?php echo intval($columns['desc']['width']); ?>px; <?php if ($columns['desc']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='count'
												data-order='<?php echo intval($columns['count']['order']); ?>'
												data-width='<?php echo intval($columns['count']['width']); ?>'
												data-collapsed='<?php echo intval($columns['count']['collapsed']); ?>'
												style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		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_campaign_count']).on('change keyup paste', function () { query['range_min_campaign_count'] = von.val(); delete query['page_campaign']; changed = true; }))
.append('<div>' + window.i18n_bis + '</div>').append(bis = $('<input type=\'number\' step=\'any\'>').val(query['range_max_campaign_count']).on('change keyup paste', function () { query['range_max_campaign_count'] = bis.val(); delete query['page_campaign']; 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_campaign'] == 'count ASC') {
			query['sort_campaign'] = 'count DESC';
		 } else if (query['sort_campaign'] == 'count DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'count ASC';
		 }
		 reloadcampaign();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	" style='text-align: right;'>
													<span class='title-title' title='<?php echo(_('Anzahl der Teilnehmer')); ?>'><?php echo(_('Anzahl der Teilnehmer')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'count ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'count DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_count']) || isset($_GET['range_max_campaign_count']) || isset($_GET['deps_campaign_count']) || isset($_GET['fullsearch_campaign_count']) || isset($_GET['dynamic_campaign_count']) || isset($_GET['search_campaign_count']) || isset($_GET['searchnot_campaign_count']) || isset($_GET['filter_campaign_count'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['count']['header'] = ob_get_contents(); ob_end_clean();
											$columns['count']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='count'><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($item['count'])); ?>
	</span></div><?php
											};
											$columns['count']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='count'
													data-order='<?php echo intval($columns['count']['order']); ?>'
													data-width='<?php echo intval($columns['count']['width']); ?>'
													data-collapsed='<?php echo intval($columns['count']['collapsed']); ?>'
													style='width: <?php echo intval($columns['count']['width']); ?>px; <?php if ($columns['count']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='email_campaign'
												data-order='<?php echo intval($columns['email_campaign']['order']); ?>'
												data-width='<?php echo intval($columns['email_campaign']['width']); ?>'
												data-collapsed='<?php echo intval($columns['email_campaign']['collapsed']); ?>'
												style='width: <?php echo intval($columns['email_campaign']['width']); ?>px; <?php if ($columns['email_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_email_campaign', '0') ? ' checked>': '>')).change(function (){querySet('filter_campaign_email_campaign', '0', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('off')); ?><br/>')
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_email_campaign', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_email_campaign', '1', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('on')); ?><br/>')
;
		return false;
	">
													<span class='title-title' title='<?php echo(_('Email')); ?>'><?php echo(_('Email')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'email_campaign ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'email_campaign DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_email_campaign']) || isset($_GET['range_max_campaign_email_campaign']) || isset($_GET['deps_campaign_email_campaign']) || isset($_GET['fullsearch_campaign_email_campaign']) || isset($_GET['dynamic_campaign_email_campaign']) || isset($_GET['search_campaign_email_campaign']) || isset($_GET['searchnot_campaign_email_campaign']) || isset($_GET['filter_campaign_email_campaign'])) {
															// 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['email_campaign']['header'] = ob_get_contents(); ob_end_clean();
											$columns['email_campaign']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['email_campaign']['width']); ?>px; <?php if ($columns['email_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='email_campaign'><?php if($item['email_campaign'] == 1){ ?>✓<?php }else{ ?><?php }?></div><?php
											};
											$columns['email_campaign']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='email_campaign'
													data-order='<?php echo intval($columns['email_campaign']['order']); ?>'
													data-width='<?php echo intval($columns['email_campaign']['width']); ?>'
													data-collapsed='<?php echo intval($columns['email_campaign']['collapsed']); ?>'
													style='width: <?php echo intval($columns['email_campaign']['width']); ?>px; <?php if ($columns['email_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='post_campaign'
												data-order='<?php echo intval($columns['post_campaign']['order']); ?>'
												data-width='<?php echo intval($columns['post_campaign']['width']); ?>'
												data-collapsed='<?php echo intval($columns['post_campaign']['collapsed']); ?>'
												style='width: <?php echo intval($columns['post_campaign']['width']); ?>px; <?php if ($columns['post_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_post_campaign', '0') ? ' checked>': '>')).change(function (){querySet('filter_campaign_post_campaign', '0', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('off')); ?><br/>')
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_post_campaign', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_post_campaign', '1', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('on')); ?><br/>')
;
		return false;
	">
													<span class='title-title' title='<?php echo(_('campaignPost')); ?>'><?php echo(_('campaignPost')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'post_campaign ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'post_campaign DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_post_campaign']) || isset($_GET['range_max_campaign_post_campaign']) || isset($_GET['deps_campaign_post_campaign']) || isset($_GET['fullsearch_campaign_post_campaign']) || isset($_GET['dynamic_campaign_post_campaign']) || isset($_GET['search_campaign_post_campaign']) || isset($_GET['searchnot_campaign_post_campaign']) || isset($_GET['filter_campaign_post_campaign'])) {
															// 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['post_campaign']['header'] = ob_get_contents(); ob_end_clean();
											$columns['post_campaign']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['post_campaign']['width']); ?>px; <?php if ($columns['post_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='post_campaign'><?php if($item['post_campaign'] == 1){ ?>✓<?php }else{ ?><?php }?></div><?php
											};
											$columns['post_campaign']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='post_campaign'
													data-order='<?php echo intval($columns['post_campaign']['order']); ?>'
													data-width='<?php echo intval($columns['post_campaign']['width']); ?>'
													data-collapsed='<?php echo intval($columns['post_campaign']['collapsed']); ?>'
													style='width: <?php echo intval($columns['post_campaign']['width']); ?>px; <?php if ($columns['post_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='phone_campaign'
												data-order='<?php echo intval($columns['phone_campaign']['order']); ?>'
												data-width='<?php echo intval($columns['phone_campaign']['width']); ?>'
												data-collapsed='<?php echo intval($columns['phone_campaign']['collapsed']); ?>'
												style='width: <?php echo intval($columns['phone_campaign']['width']); ?>px; <?php if ($columns['phone_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_phone_campaign', '0') ? ' checked>': '>')).change(function (){querySet('filter_campaign_phone_campaign', '0', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('off')); ?><br/>')
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_phone_campaign', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_phone_campaign', '1', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('on')); ?><br/>')
;
		return false;
	">
													<span class='title-title' title='<?php echo(_('campaignPhone')); ?>'><?php echo(_('campaignPhone')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'phone_campaign ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'phone_campaign DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_phone_campaign']) || isset($_GET['range_max_campaign_phone_campaign']) || isset($_GET['deps_campaign_phone_campaign']) || isset($_GET['fullsearch_campaign_phone_campaign']) || isset($_GET['dynamic_campaign_phone_campaign']) || isset($_GET['search_campaign_phone_campaign']) || isset($_GET['searchnot_campaign_phone_campaign']) || isset($_GET['filter_campaign_phone_campaign'])) {
															// 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['phone_campaign']['header'] = ob_get_contents(); ob_end_clean();
											$columns['phone_campaign']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['phone_campaign']['width']); ?>px; <?php if ($columns['phone_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='phone_campaign'><?php if($item['phone_campaign'] == 1){ ?>✓<?php }else{ ?><?php }?></div><?php
											};
											$columns['phone_campaign']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='phone_campaign'
													data-order='<?php echo intval($columns['phone_campaign']['order']); ?>'
													data-width='<?php echo intval($columns['phone_campaign']['width']); ?>'
													data-collapsed='<?php echo intval($columns['phone_campaign']['collapsed']); ?>'
													style='width: <?php echo intval($columns['phone_campaign']['width']); ?>px; <?php if ($columns['phone_campaign']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='pdf_type'
												data-order='<?php echo intval($columns['pdf_type']['order']); ?>'
												data-width='<?php echo intval($columns['pdf_type']['width']); ?>'
												data-collapsed='<?php echo intval($columns['pdf_type']['collapsed']); ?>'
												style='width: <?php echo intval($columns['pdf_type']['width']); ?>px; <?php if ($columns['pdf_type']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_pdf_type', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_pdf_type', '1', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('Briefkopf mit Standardvorlage')); ?><br/>').append($('<input type=\'checkbox\'' + (querySet('filter_campaign_pdf_type', '2') ? ' checked>': '>')).change(function (){querySet('filter_campaign_pdf_type', '2', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('Briefkopf auf benutzerdefiniertem Hintergrund')); ?><br/>').append($('<input type=\'checkbox\'' + (querySet('filter_campaign_pdf_type', '3') ? ' checked>': '>')).change(function (){querySet('filter_campaign_pdf_type', '3', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('Briefkopf mit Launix-Brief und benutzerdefinierten Zusatzseiten')); ?><br/>');
		return false;
	">
													<span class='title-title' title='<?php echo(_('PDF-Layout')); ?>'><?php echo(_('PDF-Layout')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'pdf_type ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'pdf_type DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_pdf_type']) || isset($_GET['range_max_campaign_pdf_type']) || isset($_GET['deps_campaign_pdf_type']) || isset($_GET['fullsearch_campaign_pdf_type']) || isset($_GET['dynamic_campaign_pdf_type']) || isset($_GET['search_campaign_pdf_type']) || isset($_GET['searchnot_campaign_pdf_type']) || isset($_GET['filter_campaign_pdf_type'])) {
															// 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['pdf_type']['header'] = ob_get_contents(); ob_end_clean();
											$columns['pdf_type']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['pdf_type']['width']); ?>px; <?php if ($columns['pdf_type']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; <?php if (($item['pdf_type::vis'] ?? '0') == '0') { echo 'visibility: hidden;'; } ?>' data-column='pdf_type'><?php echo htmlentities(\Types\CampaignPDFType::toStringShort($item['pdf_type'])); ?></div><?php
											};
											$columns['pdf_type']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='pdf_type'
													data-order='<?php echo intval($columns['pdf_type']['order']); ?>'
													data-width='<?php echo intval($columns['pdf_type']['width']); ?>'
													data-collapsed='<?php echo intval($columns['pdf_type']['collapsed']); ?>'
													style='width: <?php echo intval($columns['pdf_type']['width']); ?>px; <?php if ($columns['pdf_type']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='pinned'
												data-order='<?php echo intval($columns['pinned']['order']); ?>'
												data-width='<?php echo intval($columns['pinned']['width']); ?>'
												data-collapsed='<?php echo intval($columns['pinned']['collapsed']); ?>'
												style='width: <?php echo intval($columns['pinned']['width']); ?>px; <?php if ($columns['pinned']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_pinned', '0') ? ' checked>': '>')).change(function (){querySet('filter_campaign_pinned', '0', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('off')); ?><br/>')
	.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_pinned', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_pinned', '1', $(this).prop('checked')); delete query['page_campaign']; changed=true;})).append(' <?php echo(_('on')); ?><br/>')
;
		return false;
	">
													<span class='title-title' title='<?php echo(_('angepinnt')); ?>'><?php echo(_('angepinnt')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'pinned ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'pinned DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_pinned']) || isset($_GET['range_max_campaign_pinned']) || isset($_GET['deps_campaign_pinned']) || isset($_GET['fullsearch_campaign_pinned']) || isset($_GET['dynamic_campaign_pinned']) || isset($_GET['search_campaign_pinned']) || isset($_GET['searchnot_campaign_pinned']) || isset($_GET['filter_campaign_pinned'])) {
															// 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['pinned']['header'] = ob_get_contents(); ob_end_clean();
											$columns['pinned']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['pinned']['width']); ?>px; <?php if ($columns['pinned']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='pinned'><?php if($item['pinned'] == 1){ ?>✓<?php }else{ ?><?php }?></div><?php
											};
											$columns['pinned']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='pinned'
													data-order='<?php echo intval($columns['pinned']['order']); ?>'
													data-width='<?php echo intval($columns['pinned']['width']); ?>'
													data-collapsed='<?php echo intval($columns['pinned']['collapsed']); ?>'
													style='width: <?php echo intval($columns['pinned']['width']); ?>px; <?php if ($columns['pinned']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='color'
												data-order='<?php echo intval($columns['color']['order']); ?>'
												data-width='<?php echo intval($columns['color']['width']); ?>'
												data-collapsed='<?php echo intval($columns['color']['collapsed']); ?>'
												style='width: <?php echo intval($columns['color']['width']); ?>px; <?php if ($columns['color']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		
		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_campaign_color'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_campaign_color'] = text.val(); } else { delete query['search_campaign_color']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign_color'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_campaign_color'] = text2.val(); } else { delete query['searchnot_campaign_color']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaign').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_campaign'] == 'color ASC') {
			query['sort_campaign'] = 'color DESC';
		 } else if (query['sort_campaign'] == 'color DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'color ASC';
		 }
		 reloadcampaign();
		 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(_('Farbe')); ?>'><?php echo(_('Farbe')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'color ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'color DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_color']) || isset($_GET['range_max_campaign_color']) || isset($_GET['deps_campaign_color']) || isset($_GET['fullsearch_campaign_color']) || isset($_GET['dynamic_campaign_color']) || isset($_GET['search_campaign_color']) || isset($_GET['searchnot_campaign_color']) || isset($_GET['filter_campaign_color'])) {
															// 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['color']['header'] = ob_get_contents(); ob_end_clean();
											$columns['color']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['color']['width']); ?>px; <?php if ($columns['color']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='color'><div style='display: inline-block; width: 32px; height: 1em; background-color: <?php echo ($item['color']) ? htmlentities($item['color']) : 'none'; ?>;'></div>&nbsp; <?php echo(htmlentities($item['color'])) ?></span></div><?php
											};
											$columns['color']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='color'
													data-order='<?php echo intval($columns['color']['order']); ?>'
													data-width='<?php echo intval($columns['color']['width']); ?>'
													data-collapsed='<?php echo intval($columns['color']['collapsed']); ?>'
													style='width: <?php echo intval($columns['color']['width']); ?>px; <?php if ($columns['color']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='creation'
												data-order='<?php echo intval($columns['creation']['order']); ?>'
												data-width='<?php echo intval($columns['creation']['width']); ?>'
												data-collapsed='<?php echo intval($columns['creation']['collapsed']); ?>'
												style='width: <?php echo intval($columns['creation']['width']); ?>px; <?php if ($columns['creation']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}}, 600);
		date_filter(win, 'campaign', 'creation', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadcampaign();  reloadcampaign(); });
	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_campaign'] == 'creation ASC') {
			query['sort_campaign'] = 'creation DESC';
		 } else if (query['sort_campaign'] == 'creation DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'creation ASC';
		 }
		 reloadcampaign();
		 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(_('Erstellung')); ?>'><?php echo(_('Erstellung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'creation ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'creation DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_creation']) || isset($_GET['range_max_campaign_creation']) || isset($_GET['deps_campaign_creation']) || isset($_GET['fullsearch_campaign_creation']) || isset($_GET['dynamic_campaign_creation']) || isset($_GET['search_campaign_creation']) || isset($_GET['searchnot_campaign_creation']) || isset($_GET['filter_campaign_creation'])) {
															// 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['creation']['header'] = ob_get_contents(); ob_end_clean();
											$columns['creation']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['creation']['width']); ?>px; <?php if ($columns['creation']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='creation'><span class='overflow-text' title="<?php echo htmlentities(($item['creation']) ? strftime(_('dateformat_php2'), intval($item['creation'])) : ''); ?>"><?php echo htmlentities(($item['creation']) ? strftime(_('dateformat_php2'), intval($item['creation'])) : ''); ?></span></div><?php
											};
											$columns['creation']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='creation'
													data-order='<?php echo intval($columns['creation']['order']); ?>'
													data-width='<?php echo intval($columns['creation']['width']); ?>'
													data-collapsed='<?php echo intval($columns['creation']['collapsed']); ?>'
													style='width: <?php echo intval($columns['creation']['width']); ?>px; <?php if ($columns['creation']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='lastUpdate'
												data-order='<?php echo intval($columns['lastUpdate']['order']); ?>'
												data-width='<?php echo intval($columns['lastUpdate']['width']); ?>'
												data-collapsed='<?php echo intval($columns['lastUpdate']['collapsed']); ?>'
												style='width: <?php echo intval($columns['lastUpdate']['width']); ?>px; <?php if ($columns['lastUpdate']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}}, 600);
		date_filter(win, 'campaign', 'lastUpdate', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadcampaign();  reloadcampaign(); });
	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_campaign'] == 'lastUpdate ASC') {
			query['sort_campaign'] = 'lastUpdate DESC';
		 } else if (query['sort_campaign'] == 'lastUpdate DESC') {
		 	delete query['sort_campaign'];
		 } else {
			query['sort_campaign'] = 'lastUpdate ASC';
		 }
		 reloadcampaign();
		 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(_('Letzte Änderung')); ?>'><?php echo(_('Letzte Änderung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'lastUpdate ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'lastUpdate DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_lastUpdate']) || isset($_GET['range_max_campaign_lastUpdate']) || isset($_GET['deps_campaign_lastUpdate']) || isset($_GET['fullsearch_campaign_lastUpdate']) || isset($_GET['dynamic_campaign_lastUpdate']) || isset($_GET['search_campaign_lastUpdate']) || isset($_GET['searchnot_campaign_lastUpdate']) || isset($_GET['filter_campaign_lastUpdate'])) {
															// 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['lastUpdate']['header'] = ob_get_contents(); ob_end_clean();
											$columns['lastUpdate']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['lastUpdate']['width']); ?>px; <?php if ($columns['lastUpdate']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='lastUpdate'><span class='overflow-text' title="<?php echo htmlentities(($item['lastUpdate']) ? strftime(_('dateformat_php2'), intval($item['lastUpdate'])) : ''); ?>"><?php echo htmlentities(($item['lastUpdate']) ? strftime(_('dateformat_php2'), intval($item['lastUpdate'])) : ''); ?></span></div><?php
											};
											$columns['lastUpdate']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='lastUpdate'
													data-order='<?php echo intval($columns['lastUpdate']['order']); ?>'
													data-width='<?php echo intval($columns['lastUpdate']['width']); ?>'
													data-collapsed='<?php echo intval($columns['lastUpdate']['collapsed']); ?>'
													style='width: <?php echo intval($columns['lastUpdate']['width']); ?>px; <?php if ($columns['lastUpdate']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='mode'
												data-order='<?php echo intval($columns['mode']['order']); ?>'
												data-width='<?php echo intval($columns['mode']['width']); ?>'
												data-collapsed='<?php echo intval($columns['mode']['collapsed']); ?>'
												style='width: <?php echo intval($columns['mode']['width']); ?>px; <?php if ($columns['mode']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaign(); 
		}});
		win.append($('<input type=\'checkbox\'' + (querySet('filter_campaign_mode', '0') ? ' checked>': '>')).change(function (){querySet('filter_campaign_mode', '0', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('nicht in Kampagne hinzufügen')); ?><br/>').append($('<input type=\'checkbox\'' + (querySet('filter_campaign_mode', '1') ? ' checked>': '>')).change(function (){querySet('filter_campaign_mode', '1', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('anbieten, in Kampagne hinzuzufügen')); ?><br/>').append($('<input type=\'checkbox\'' + (querySet('filter_campaign_mode', '2') ? ' checked>': '>')).change(function (){querySet('filter_campaign_mode', '2', $(this).prop('checked')); changed=true;})).append('<span> </span><?php echo(_('in Kampagne hinzufügen')); ?><br/>');
		return false;
	">
													<span class='title-title' title='<?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?>'><?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'mode ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaign']) && $_GET['sort_campaign'] == 'mode DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaign_mode']) || isset($_GET['range_max_campaign_mode']) || isset($_GET['deps_campaign_mode']) || isset($_GET['fullsearch_campaign_mode']) || isset($_GET['dynamic_campaign_mode']) || isset($_GET['search_campaign_mode']) || isset($_GET['searchnot_campaign_mode']) || isset($_GET['filter_campaign_mode'])) {
															// 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['mode']['header'] = ob_get_contents(); ob_end_clean();
											$columns['mode']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['mode']['width']); ?>px; <?php if ($columns['mode']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='mode'><?php echo htmlentities(\Types\CampaignMode::toStringShort($item['mode'])); ?></div><?php
											};
											$columns['mode']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='mode'
													data-order='<?php echo intval($columns['mode']['order']); ?>'
													data-width='<?php echo intval($columns['mode']['width']); ?>'
													data-collapsed='<?php echo intval($columns['mode']['collapsed']); ?>'
													style='width: <?php echo intval($columns['mode']['width']); ?>px; <?php if ($columns['mode']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									

									// sort by order
									uasort($columns, function ($a, $b) {
										return $a['order'] - $b['order'];
									});
									?>
									<style type='text/css'>
										#campaign-table .fop-table-header {
											height: <?php echo 32; ?>px;
										}
										#campaign-table .fop-table-header .fop-table-column .title,
										#campaign-table .fop-column-handle,
										#campaign-table .fop-table-row,
										#campaign-table .fop-table-row .fop-table-column,
										#campaign-table .fop-table-column-multicontrol,
										#campaign-table .fop-filter-button {
											height: 32px;
											line-height: 32px;
										}
										</style>
											<div class="fop-table" data-table-id="campaign">
											<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="campaign__all-checkbox">
														<input class="mdl-checkbox__input" id="campaign__all-checkbox" type="checkbox" onchange="checkcampaign('all', 'ID', this.checked);">
														</label>
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon campaign__mass-action" style='visibility: hidden;' onclick="$.get('DataView/Campaign/permissions?id=' + checkcampaign(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_campaign_') == 0 || key.indexOf('range_max_campaign_') == 0 || key.indexOf('deps_campaign_') == 0 || key.indexOf('fullsearch_campaign_') == 0 || key.indexOf('dynamic_campaign_') == 0 || key.indexOf('search_campaign_') == 0 || key.indexOf('searchnot_campaign_') == 0 || key.indexOf('filter_campaign_') == 0) delete query[key]; reloadcampaign(); $(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_campaign_ID'] = checkcampaign(null, 'ID'); delete query['page_campaign']; reloadcampaign(); $(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(checkcampaign(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;
			}
			checkcampaign(newticks, 'ID', 'set');
		} $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">colorize</i></span><span class="fop-menu-caption" title="<?php echo(_('limit range')); ?>"><?php echo(_('limit range')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()))) { ?>
			<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/Campaign/delete?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkcampaign(null, 'ID'))).then(function () { reloadcampaign(); }, 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('campaign', <?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: 'campaign', 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_campaign" <?php \EasyEditor\Navigation::printScroll('dv.Campaign', '/* 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_campaign\'] || 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_campaign\'] = wantedPage;
														reloadcampaign(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="<?php echo 'background: ' .htmlentities((function ($item) {return $item['color'] && $item['color'] != '#000000' ? $item['color'] . '20' : 'none';})($item)).'!important;'; ?> " data-campaign-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(reloadcampaign({action: \'open\', fop_table: \'campaign\', fop_id: ' .  htmlentities(json_encode($item['ID'])) . ', fop_from: location.href}, true), true);"';
														}
													}?> >

													<?php if (!isset($_GET['select'])) { ?>
													<div class='fop-table-column noprint' style="width: <?php echo json_encode($firstColumnWidth); ?>px;" onclick="$(this).find('input[type=checkbox]').first().click(); event.stopPropagation();">
													<label onclick="event.stopPropagation();" class="mdl-checkbox mdl-js-checkbox campaign__checkbox campaign__checkbox campaign__checkbox-ID-<?php echo htmlentities($item['ID']); ?>" style="width: auto;" for="campaign__<?php echo htmlentities($itempos); ?>-checkbox">
													<input class="mdl-checkbox__input" id="campaign__<?php echo htmlentities($itempos); ?>-checkbox" type="checkbox" onchange="<?php if (isset($item['ID'])) echo 'checkcampaign(' . htmlentities(json_encode($item['ID'])) . ', \'ID\', this.checked); ' ?>">
													</label><button type="button" class="mdl-button mdl-js-button mdl-button--icon campaign__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-campaign-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\Campaign::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick=" if (!event.ctrlKey) { open_url(reloadcampaign({action: 'open', fop_table: 'campaign', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), true); return false; } $(this).closest('.overlay').click(); return false;  
					open_url(this.href, true);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">find_in_page</i></span><span class="fop-menu-caption" title="<?php echo(_('open')); ?>"><?php echo(_('open')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['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\Campaign::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, true);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">edit</i></span><span class="fop-menu-caption" title="<?php echo(_('edit')); ?>"><?php echo(_('edit')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::is_mail']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="campaigncampaignInteraction" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Campaign::massMailURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">email</i></span><span class="fop-menu-caption" title="<?php echo(_('campaignMassMailBTN')); ?>"><?php echo(_('campaignMassMailBTN')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::is_post']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="campaigncampaignPost" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Campaign::mailPDFURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">mail</i></span><span class="fop-menu-caption" title="<?php echo(_('campaignPostalBTN')); ?>"><?php echo(_('campaignPostalBTN')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::create']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="clone" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Campaign::cloneURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">add_circle</i></span><span class="fop-menu-caption" title="<?php echo(_('copy')); ?>"><?php echo(_('copy')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && ((\FOP\User::getCampaign())) && $item['operation::dvia:campaignAttachment:campaign'] && $item['operation::7453e2de1ab4be4218c6ba7a6050dd059c049453d371fd5428d22e0bfbee424e'] && $item['operation::is_mail'] && $item['operation::PZzRYmSJ']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_campaignAttachment_campaign" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignAttachment::createURL2(['column_campaign' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Anhang'))); ?>"><?php echo(sprintf(_('create %s'), _('Anhang'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && $item['operation::fb3de81e616f834de1ac7d3a6c0dc5111693c79419c74a47950abd8a039025f5'] && $item['operation::PZzRYmSJ'] && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_campaignTarget_campaign" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::createURL2(['column_campaign' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Empfänger'))); ?>"><?php echo(sprintf(_('create %s'), _('Empfänger'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::is_phone']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="phone10" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Campaign::phone10URL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">call</i></span><span class="fop-menu-caption" title="<?php echo(_('10 neue Anrufe')); ?>"><?php echo(_('10 neue Anrufe')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::is_mail']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="singleMail" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Campaign::singleMailURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">email</i></span><span class="fop-menu-caption" title="<?php echo(_('campaignSingleMailBTN')); ?>"><?php echo(_('campaignSingleMailBTN')); ?></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/Campaign/delete?ajax&id=<?php echo htmlentities($item['ID']);?>&from=<?php echo htmlentities(\FOP\Util::getBackUrl());?>').then(function () { reloadcampaign(); }, 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, true);
					$(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="campaign" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="edit" href="<?php echo htmlentities(\TablesRouter\Campaign::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();    reloadcampaign();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, true);
					}
					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="campaign" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="view" href="<?php echo htmlentities(\TablesRouter\Campaign::viewURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();  if (!event.ctrlKey) { open_url(reloadcampaign({action: 'open', fop_table: 'campaign', fop_id: <?php echo htmlentities(json_encode($item['ID'])); ?>, fop_from: location.href}, true), true); return false; }  reloadcampaign();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, true);
					}
					event.preventDefault();"
				title="<?php echo(_('open')); ?>">
				<i class="material-icons">find_in_page</i>
			</a><?php } ?>
													</div><?php } ?><?php
													
													foreach ($columns AS $col) {
														$col['render']($item);
													}
													?></div>
												 <?php }?>

													</div>
												</div>

												
												
												</div><?php
												
	
    
  }

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

    
  }

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

  public static function getSQL($params) { 
    
    
    // --- BLOCK: dependency-campaign ---
    
		if (isset($params['select']) && $params['select'] == 'campaign') {
			$deps = [];
		}
	
    // --- BLOCK: dependency-campaignNoCustomer ---
    
		if (isset($params['select']) && $params['select'] == 'campaignNoCustomer') {
			$deps = [];
		}
	
    // --- BLOCK: dependency-campaignNullFollow ---
    
		if (isset($params['select']) && $params['select'] == 'campaignNullFollow') {
			$deps = [];
		}
	
    // --- BLOCK: main ---
    
								// returns a sql snippet 'FROM (...) AS t WHERE' where you can prepend your select clauses and append your ORDER LIMIT
								$sql = 'FROM (SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* color */ '.qi('color').' AS '.qi('color').',
									/* count */ (SELECT COUNT(1) FROM '.qi('campaignTarget').' '.qi('WPNPXqW1').' WHERE '.qi('WPNPXqW1').'.'.qi('campaign').' = '.qi('campaign').'.'.qi('ID').' LIMIT 1) AS '.qi('count').',
									/* creation */ '.qi('creation').' AS '.qi('creation').',
									/* date */ '.qi('date').' AS '.qi('date').',
									/* desc */ '.qi('desc').' AS '.qi('desc').',
									/* email_auto */ '.qi('email_auto').' AS '.qi('email_auto').',
									/* email_auto::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_auto::vis').',
									/* email_campaign */ '.qi('email_campaign').' AS '.qi('email_campaign').',
									/* email_delay */ '.qi('email_delay').' AS '.qi('email_delay').',
									/* email_delay::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_delay::vis').',
									/* email_interact1_state */ '.qi('email_interact1_state').' AS '.qi('email_interact1_state').',
									/* email_interact1_state::canView */ '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:canView').' AS '.qi('email_interact1_state::canView').',
									/* email_interact1_state::description */ '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:description').' AS '.qi('email_interact1_state::description').',
									/* email_interact1_state::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_state::vis').',
									/* email_interact1_title */ '.qi('email_interact1_title').' AS '.qi('email_interact1_title').',
									/* email_interact1_title::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_title::vis').',
									/* email_interact1_url */ '.qi('email_interact1_url').' AS '.qi('email_interact1_url').',
									/* email_interact1_url::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_url::vis').',
									/* email_interact2_state */ '.qi('email_interact2_state').' AS '.qi('email_interact2_state').',
									/* email_interact2_state::canView */ '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:canView').' AS '.qi('email_interact2_state::canView').',
									/* email_interact2_state::description */ '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:description').' AS '.qi('email_interact2_state::description').',
									/* email_interact2_state::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_state::vis').',
									/* email_interact2_title */ '.qi('email_interact2_title').' AS '.qi('email_interact2_title').',
									/* email_interact2_title::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_title::vis').',
									/* email_interact2_url */ '.qi('email_interact2_url').' AS '.qi('email_interact2_url').',
									/* email_interact2_url::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_url::vis').',
									/* email_reply */ '.qi('email_reply').' AS '.qi('email_reply').',
									/* email_reply::vis */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_reply::vis').',
									/* email_subject */ '.qi('email_subject').' AS '.qi('email_subject').',
									/* email_subject::vis */ ('.qi('campaign').'.'.qi('email_campaign').') OR (('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'1\', \'3\'))) AS '.qi('email_subject::vis').',
									/* email_text */ '.qi('email_text').' AS '.qi('email_text').',
									/* email_text::vis */ ('.qi('campaign').'.'.qi('email_campaign').') OR (('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'1\', \'3\'))) AS '.qi('email_text::vis').',
									/* lastUpdate */ '.qi('lastUpdate').' AS '.qi('lastUpdate').',
									/* lastVisit */ '.qi('lastVisit').' AS '.qi('lastVisit').',
									/* mode */ '.qi('mode').' AS '.qi('mode').',
									/* name */ '.qi('name').' AS '.qi('name').',
									/* operation::7453e2de1ab4be4218c6ba7a6050dd059c049453d371fd5428d22e0bfbee424e */ '.\FOP\Database::quote(\FOP\User::getCampaign()).' AS '.qi('operation::7453e2de1ab4be4218c6ba7a6050dd059c049453d371fd5428d22e0bfbee424e').',
									/* operation::PZzRYmSJ */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::PZzRYmSJ').',
									/* operation::create */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::create').',
									/* operation::delete */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::delete').',
									/* operation::dvia:campaignAttachment:campaign */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::dvia:campaignAttachment:campaign').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::edit').',
									/* operation::fb3de81e616f834de1ac7d3a6c0dc5111693c79419c74a47950abd8a039025f5 */ '.\FOP\Database::quote(\FOP\User::getCampaign()).' AS '.qi('operation::fb3de81e616f834de1ac7d3a6c0dc5111693c79419c74a47950abd8a039025f5').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::is_mail */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::is_mail').',
									/* operation::is_phone */ ('.qi('campaign').'.'.qi('phone_campaign').') AS '.qi('operation::is_phone').',
									/* operation::is_post */ ('.qi('campaign').'.'.qi('post_campaign').') AS '.qi('operation::is_post').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::view').',
									/* operation::wcgCtRIO */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::wcgCtRIO').',
									/* pdf_type */ '.qi('pdf_type').' AS '.qi('pdf_type').',
									/* pdf_type::vis */ '.qi('campaign').'.'.qi('post_campaign').' AS '.qi('pdf_type::vis').',
									/* phone_campaign */ '.qi('phone_campaign').' AS '.qi('phone_campaign').',
									/* pinned */ '.qi('pinned').' AS '.qi('pinned').',
									/* post_campaign */ '.qi('post_campaign').' AS '.qi('post_campaign').',
									/* post_template */ '.qi('post_template').' AS '.qi('post_template').',
									/* post_template::vis */ ('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'2\', \'3\')) AS '.qi('post_template::vis').',
									1
								FROM '.qi('campaign').' '.qi('campaign').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('email_interact1_state:ID').', '.qi('campaignState').'.'.qi('desc').' AS '.qi('email_interact1_state:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('email_interact1_state:canView').' FROM '.qi('campaignState').') '.qi('ref:email_interact1_state').' ON '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:ID').' = '.qi('email_interact1_state').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('email_interact2_state:ID').', '.qi('campaignState').'.'.qi('desc').' AS '.qi('email_interact2_state:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('email_interact2_state:canView').' FROM '.qi('campaignState').') '.qi('ref:email_interact2_state').' ON '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:ID').' = '.qi('email_interact2_state').'
								WHERE ((('.\FOP\Database::quote(\FOP\User::getCampaign()).')))
									AND (' . (isset($_GET['select']) && $_GET['select'] == 'campaign' ? 'TRUE' : 'TRUE') . ')
									AND (' . (isset($_GET['select']) && $_GET['select'] == 'campaignNoCustomer' ? 'TRUE' : 'TRUE') . ')
									AND (' . (isset($_GET['select']) && $_GET['select'] == 'campaignNullFollow' ? 'TRUE' : 'TRUE') . ')) AS t
								WHERE ' . (isset($params['range_min_campaign_count']) ? ($params['range_min_campaign_count'] !== '' && is_numeric($params['range_min_campaign_count']) ? 't.'.qi('count').' >= ' . \FOP\Database::quote($params['range_min_campaign_count']) . ' AND ' : '') : '') . 
								(isset($params['range_min_campaign_email_delay']) ? ($params['range_min_campaign_email_delay'] !== '' && is_numeric($params['range_min_campaign_email_delay']) ? 't.'.qi('email_delay').' >= ' . \FOP\Database::quote($params['range_min_campaign_email_delay']) . ' AND ' : '') : '') . 
								(isset($params['range_min_campaign_date']) ? ($params['range_min_campaign_date'] !== '' && is_numeric($params['range_min_campaign_date']) ? 't.'.qi('date').' >= ' . \FOP\Database::quote($params['range_min_campaign_date']) . ' AND ' : '') : '') . 
								(isset($params['range_min_campaign_creation']) ? ($params['range_min_campaign_creation'] !== '' && is_numeric($params['range_min_campaign_creation']) ? 't.'.qi('creation').' >= ' . \FOP\Database::quote($params['range_min_campaign_creation']) . ' AND ' : '') : '') . 
								(isset($params['range_min_campaign_lastUpdate']) ? ($params['range_min_campaign_lastUpdate'] !== '' && is_numeric($params['range_min_campaign_lastUpdate']) ? 't.'.qi('lastUpdate').' >= ' . \FOP\Database::quote($params['range_min_campaign_lastUpdate']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaign_count']) ? ($params['range_max_campaign_count'] !== '' && is_numeric($params['range_max_campaign_count']) ? 't.'.qi('count').' <= ' . \FOP\Database::quote($params['range_max_campaign_count']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaign_email_delay']) ? ($params['range_max_campaign_email_delay'] !== '' && is_numeric($params['range_max_campaign_email_delay']) ? 't.'.qi('email_delay').' <= ' . \FOP\Database::quote($params['range_max_campaign_email_delay']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaign_date']) ? ($params['range_max_campaign_date'] !== '' && is_numeric($params['range_max_campaign_date']) ? 't.'.qi('date').' <= ' . \FOP\Database::quote($params['range_max_campaign_date']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaign_creation']) ? ($params['range_max_campaign_creation'] !== '' && is_numeric($params['range_max_campaign_creation']) ? 't.'.qi('creation').' <= ' . \FOP\Database::quote($params['range_max_campaign_creation']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaign_lastUpdate']) ? ($params['range_max_campaign_lastUpdate'] !== '' && is_numeric($params['range_max_campaign_lastUpdate']) ? 't.'.qi('lastUpdate').' <= ' . \FOP\Database::quote($params['range_max_campaign_lastUpdate']) . ' AND ' : '') : '') . 
								(isset($params['fullsearch_campaign_post_template']) && $params['fullsearch_campaign_post_template'] ? 't.'.qi('post_template').' IN (SELECT '.qi('ID').' FROM fop_files WHERE filename LIKE '.\FOP\Database::quote('%' . $params['fullsearch_campaign_post_template'] . '%').') AND ' : '') . 
								(isset($params['filter_campaign_phone_campaign']) ? ($params['filter_campaign_phone_campaign'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_phone_campaign']))->toSQL('t.'.qi('phone_campaign').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_name']) ? ($params['filter_campaign_name'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_name']))->toSQL('t.'.qi('name').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_date']) ? ($params['filter_campaign_date'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_date']))->toSQL('t.'.qi('date').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_desc']) ? ($params['filter_campaign_desc'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_desc']))->toSQL('t.'.qi('desc').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_count']) ? ($params['filter_campaign_count'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_count']))->toSQL('t.'.qi('count').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_pinned']) ? ($params['filter_campaign_pinned'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_pinned']))->toSQL('t.'.qi('pinned').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_color']) ? ($params['filter_campaign_color'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_color']))->toSQL('t.'.qi('color').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_creation']) ? ($params['filter_campaign_creation'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_creation']))->toSQL('t.'.qi('creation').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_lastUpdate']) ? ($params['filter_campaign_lastUpdate'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_lastUpdate']))->toSQL('t.'.qi('lastUpdate').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_mode']) ? ($params['filter_campaign_mode'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_mode']))->toSQL('t.'.qi('mode').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact1_title']) ? ($params['filter_campaign_email_interact1_title'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact1_title']))->toSQL('t.'.qi('email_interact1_title').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact1_state']) ? ($params['filter_campaign_email_interact1_state'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact1_state']))->toSQL('t.'.qi('email_interact1_state').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact1_url']) ? ($params['filter_campaign_email_interact1_url'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact1_url']))->toSQL('t.'.qi('email_interact1_url').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact2_title']) ? ($params['filter_campaign_email_interact2_title'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact2_title']))->toSQL('t.'.qi('email_interact2_title').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact2_state']) ? ($params['filter_campaign_email_interact2_state'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact2_state']))->toSQL('t.'.qi('email_interact2_state').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_interact2_url']) ? ($params['filter_campaign_email_interact2_url'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_interact2_url']))->toSQL('t.'.qi('email_interact2_url').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_campaign']) ? ($params['filter_campaign_email_campaign'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_campaign']))->toSQL('t.'.qi('email_campaign').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_auto']) ? ($params['filter_campaign_email_auto'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_auto']))->toSQL('t.'.qi('email_auto').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_delay']) ? ($params['filter_campaign_email_delay'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_delay']))->toSQL('t.'.qi('email_delay').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_reply']) ? ($params['filter_campaign_email_reply'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_reply']))->toSQL('t.'.qi('email_reply').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_text']) ? ($params['filter_campaign_email_text'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_text']))->toSQL('t.'.qi('email_text').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_email_subject']) ? ($params['filter_campaign_email_subject'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_email_subject']))->toSQL('t.'.qi('email_subject').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_post_campaign']) ? ($params['filter_campaign_post_campaign'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_post_campaign']))->toSQL('t.'.qi('post_campaign').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_ID']) ? ($params['filter_campaign_ID'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_ID']))->toSQL('t.'.qi('ID').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_pdf_type']) ? ($params['filter_campaign_pdf_type'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_pdf_type']))->toSQL('t.'.qi('pdf_type').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaign_post_template']) ? ($params['filter_campaign_post_template'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaign_post_template']))->toSQL('t.'.qi('post_template').'') . ') AND ') : '') : '') . 
								(isset($params['search_campaign_name']) ? 't.'.qi('name').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_name'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_desc']) ? 't.'.qi('desc').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_desc'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_color']) ? 't.'.qi('color').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_color'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_interact1_title']) ? 't.'.qi('email_interact1_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_interact1_title'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_interact1_url']) ? 't.'.qi('email_interact1_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_interact1_url'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_interact2_title']) ? 't.'.qi('email_interact2_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_interact2_title'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_interact2_url']) ? 't.'.qi('email_interact2_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_interact2_url'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_reply']) ? 't.'.qi('email_reply').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_reply'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_text']) ? 't.'.qi('email_text').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_text'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign_email_subject']) ? 't.'.qi('email_subject').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign_email_subject'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_name']) ? 'NOT t.'.qi('name').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_name'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_desc']) ? 'NOT t.'.qi('desc').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_desc'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_color']) ? 'NOT t.'.qi('color').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_color'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_interact1_title']) ? 'NOT t.'.qi('email_interact1_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_interact1_title'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_interact1_url']) ? 'NOT t.'.qi('email_interact1_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_interact1_url'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_interact2_title']) ? 'NOT t.'.qi('email_interact2_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_interact2_title'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_interact2_url']) ? 'NOT t.'.qi('email_interact2_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_interact2_url'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_reply']) ? 'NOT t.'.qi('email_reply').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_reply'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_text']) ? 'NOT t.'.qi('email_text').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_text'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaign_email_subject']) ? 'NOT t.'.qi('email_subject').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaign_email_subject'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaign']) ? '(' . 't.'.qi('name').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('desc').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('color').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_interact1_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_interact1_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_interact2_title').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_interact2_url').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_reply').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_text').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ' OR ' . 't.'.qi('email_subject').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaign'] . '%') . ') AND ' : '') . 
								'
								 TRUE ';
								return $sql;
	
    
  }

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

    
  }

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

    
  }

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

								$order = (\FOP\Util::array_value(array(
									'desc ASC' => 'ORDER BY t.'.qi('desc').' ASC',
									'color ASC' => 'ORDER BY t.'.qi('color').' ASC',
									'email_reply ASC' => 'ORDER BY t.'.qi('email_reply').' ASC',
									'email_text ASC' => 'ORDER BY t.'.qi('email_text').' ASC',
									'name ASC' => 'ORDER BY t.'.qi('name').' ASC',
									'email_interact1_title ASC' => 'ORDER BY t.'.qi('email_interact1_title').' ASC',
									'email_interact2_title ASC' => 'ORDER BY t.'.qi('email_interact2_title').' ASC',
									'email_subject ASC' => 'ORDER BY t.'.qi('email_subject').' ASC',
									'email_interact1_url ASC' => 'ORDER BY t.'.qi('email_interact1_url').' ASC',
									'email_interact2_url ASC' => 'ORDER BY t.'.qi('email_interact2_url').' ASC',
									'count ASC' => 'ORDER BY t.'.qi('count').' ASC',
									'email_delay ASC' => 'ORDER BY t.'.qi('email_delay').' ASC',
									'date ASC' => 'ORDER BY t.'.qi('date').' ASC',
									'creation ASC' => 'ORDER BY t.'.qi('creation').' ASC',
									'lastUpdate ASC' => 'ORDER BY t.'.qi('lastUpdate').' ASC',
									'desc DESC' => 'ORDER BY t.'.qi('desc').' DESC',
									'color DESC' => 'ORDER BY t.'.qi('color').' DESC',
									'email_reply DESC' => 'ORDER BY t.'.qi('email_reply').' DESC',
									'email_text DESC' => 'ORDER BY t.'.qi('email_text').' DESC',
									'name DESC' => 'ORDER BY t.'.qi('name').' DESC',
									'email_interact1_title DESC' => 'ORDER BY t.'.qi('email_interact1_title').' DESC',
									'email_interact2_title DESC' => 'ORDER BY t.'.qi('email_interact2_title').' DESC',
									'email_subject DESC' => 'ORDER BY t.'.qi('email_subject').' DESC',
									'email_interact1_url DESC' => 'ORDER BY t.'.qi('email_interact1_url').' DESC',
									'email_interact2_url DESC' => 'ORDER BY t.'.qi('email_interact2_url').' DESC',
									'count DESC' => 'ORDER BY t.'.qi('count').' DESC',
									'email_delay DESC' => 'ORDER BY t.'.qi('email_delay').' DESC',
									'date DESC' => 'ORDER BY t.'.qi('date').' DESC',
									'creation DESC' => 'ORDER BY t.'.qi('creation').' DESC',
									'lastUpdate DESC' => 'ORDER BY t.'.qi('lastUpdate').' DESC',
									'' => ''), isset($params['sort_campaign']) ? $params['sort_campaign'] : '') ?: 'ORDER BY '.qi('t').'.'.qi('pinned').' DESC, '.qi('t').'.'.qi('lastUpdate').' DESC');
								// 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['phone_campaign'] = \FOP\Util::BoolSanitizer($item['phone_campaign']);
											$item['date'] = intval($item['date']);
											$item['count'] = \Types\Integer::unpack($item['count']);
											$item['pinned'] = \FOP\Util::BoolSanitizer($item['pinned']);
											$item['creation'] = intval($item['creation']);
											$item['lastUpdate'] = intval($item['lastUpdate']);
											$item['mode'] = \FOP\Util::IntStringNull($item['mode']);
											$item['email_interact1_state'] = \FOP\Sanitizers::null_converter($item['email_interact1_state']);
											$item['email_interact1_url'] = \FOP\Sanitizers::a_text($item['email_interact1_url']);
											$item['email_interact2_state'] = \FOP\Sanitizers::null_converter($item['email_interact2_state']);
											$item['email_interact2_url'] = \FOP\Sanitizers::a_text($item['email_interact2_url']);
											$item['email_campaign'] = \FOP\Util::BoolSanitizer($item['email_campaign']);
											$item['email_auto'] = \FOP\Util::BoolSanitizer($item['email_auto']);
											$item['email_delay'] = \Types\Integer::unpack($item['email_delay']);
											$item['email_reply'] = \FOP\Sanitizers::a_text($item['email_reply']);
											$item['post_campaign'] = \FOP\Util::BoolSanitizer($item['post_campaign']);
											$item['pdf_type'] = \FOP\Util::IntStringNull($item['pdf_type']);
											$item['post_template'] = intval($item['post_template']);
											
											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['phone_campaign'] = \FOP\Util::BoolSanitizer($item['phone_campaign']);
										$item['date'] = intval($item['date']);
										$item['count'] = \Types\Integer::unpack($item['count']);
										$item['pinned'] = \FOP\Util::BoolSanitizer($item['pinned']);
										$item['creation'] = intval($item['creation']);
										$item['lastUpdate'] = intval($item['lastUpdate']);
										$item['mode'] = \FOP\Util::IntStringNull($item['mode']);
										$item['email_interact1_state'] = \FOP\Sanitizers::null_converter($item['email_interact1_state']);
										$item['email_interact1_url'] = \FOP\Sanitizers::a_text($item['email_interact1_url']);
										$item['email_interact2_state'] = \FOP\Sanitizers::null_converter($item['email_interact2_state']);
										$item['email_interact2_url'] = \FOP\Sanitizers::a_text($item['email_interact2_url']);
										$item['email_campaign'] = \FOP\Util::BoolSanitizer($item['email_campaign']);
										$item['email_auto'] = \FOP\Util::BoolSanitizer($item['email_auto']);
										$item['email_delay'] = \Types\Integer::unpack($item['email_delay']);
										$item['email_reply'] = \FOP\Sanitizers::a_text($item['email_reply']);
										$item['post_campaign'] = \FOP\Util::BoolSanitizer($item['post_campaign']);
										$item['pdf_type'] = \FOP\Util::IntStringNull($item['pdf_type']);
										$item['post_template'] = intval($item['post_template']);
										
									}
									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_campaign_count']) && isset($params['range_max_campaign_count'])) {
		array_push($filters, _('Anzahl der Teilnehmer') . ': ' . (\Types\Integer::print($params['range_min_campaign_count'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_campaign_count'])
	));
	} else if (isset($params['range_min_campaign_count'])) {
		array_push($filters, _('Anzahl der Teilnehmer') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_campaign_count'])
	));
	} else if (isset($params['range_max_campaign_count'])) {
		array_push($filters, _('Anzahl der Teilnehmer') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_campaign_count'])
	));
	}
	if (isset($params['range_min_campaign_email_delay']) && isset($params['range_max_campaign_email_delay'])) {
		array_push($filters, _('campaignMassMailEmailDelay') . ': ' . (\Types\Integer::print($params['range_min_campaign_email_delay'])
	) . ' ' . _('filters_between') . ' ' . (\Types\Integer::print($params['range_max_campaign_email_delay'])
	));
	} else if (isset($params['range_min_campaign_email_delay'])) {
		array_push($filters, _('campaignMassMailEmailDelay') . ': ' . _('filters_from') . ' ' . (\Types\Integer::print($params['range_min_campaign_email_delay'])
	));
	} else if (isset($params['range_max_campaign_email_delay'])) {
		array_push($filters, _('campaignMassMailEmailDelay') . ': ' . _('filters_to') . ' ' . (\Types\Integer::print($params['range_max_campaign_email_delay'])
	));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_campaign_date'])
		&& isset($params['range_max_campaign_date'])
		&& (date('d', $params['range_min_campaign_date']) == '01') //check first day of month
		&& (date('d', $params['range_max_campaign_date']) == date('t', $params['range_max_campaign_date'])) //check last day of month
		&& (date('Y-m', $params['range_min_campaign_date']) == date('Y-m', $params['range_max_campaign_date'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Start') . ': ' . strftime('%B', $params['range_min_campaign_date']) . ' ' . date('Y', $params['range_min_campaign_date']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_campaign_date'])
		&& isset($params['range_max_campaign_date'])
		&& (date('Y-m-d', $params['range_min_campaign_date']) == (date('Y-m-d', $params['range_max_campaign_date'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Start') . ': ' . date('d.m.Y', $params['range_min_campaign_date']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_campaign_date'])
		&& isset($params['range_max_campaign_date'])
		&& (date('Y', $params['range_min_campaign_date']) == (date('Y', $params['range_max_campaign_date'])))
		&& ((date('m-d', $params['range_min_campaign_date']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_date']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_campaign_date']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Start') . ': ' . date('Y', $params['range_min_campaign_date']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_campaign_date'])
		&& isset($params['range_max_campaign_date'])
		&& ( (
		 ((date('m-d', $params['range_min_campaign_date']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_date']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_date']) == '04-01'))
		&& ((date('m-d', $params['range_max_campaign_date']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_date']) == '07-01'))
		&& ((date('m-d', $params['range_max_campaign_date']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_date']) == '10-01'))
		&& ((date('m-d', $params['range_max_campaign_date']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_campaign_date']).'&apos;;
					query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_campaign_date']).'&apos;;
					reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_date&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_campaign_date']).'&apos;;
				query[&apos;range_max_campaign_date&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_campaign_date']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Start') . ': Q' . (ceil((date('m', $params['range_min_campaign_date']))/3)) . ' (' . date('d.m.', $params['range_min_campaign_date']) . ' - ' . date('d.m.Y', $params['range_max_campaign_date']) . ')')
		]);
	}
	else if (isset($params['range_min_campaign_date']) && isset($params['range_max_campaign_date'])) {
		array_push($filters, _('Start') . ': ' . (($params['range_min_campaign_date']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_date'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_campaign_date']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_date'])) : ''));
	} else if (isset($params['range_min_campaign_date'])) {
		array_push($filters, _('Start') . ': ' . _('filters_from') . ' ' . (($params['range_min_campaign_date']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_date'])) : ''));
	} else if (isset($params['range_max_campaign_date'])) {
		array_push($filters, _('Start') . ': ' . _('filters_to') . ' ' . (($params['range_max_campaign_date']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_date'])) : ''));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_campaign_creation'])
		&& isset($params['range_max_campaign_creation'])
		&& (date('d', $params['range_min_campaign_creation']) == '01') //check first day of month
		&& (date('d', $params['range_max_campaign_creation']) == date('t', $params['range_max_campaign_creation'])) //check last day of month
		&& (date('Y-m', $params['range_min_campaign_creation']) == date('Y-m', $params['range_max_campaign_creation'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . strftime('%B', $params['range_min_campaign_creation']) . ' ' . date('Y', $params['range_min_campaign_creation']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_campaign_creation'])
		&& isset($params['range_max_campaign_creation'])
		&& (date('Y-m-d', $params['range_min_campaign_creation']) == (date('Y-m-d', $params['range_max_campaign_creation'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . date('d.m.Y', $params['range_min_campaign_creation']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_campaign_creation'])
		&& isset($params['range_max_campaign_creation'])
		&& (date('Y', $params['range_min_campaign_creation']) == (date('Y', $params['range_max_campaign_creation'])))
		&& ((date('m-d', $params['range_min_campaign_creation']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_creation']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_campaign_creation']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . date('Y', $params['range_min_campaign_creation']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_campaign_creation'])
		&& isset($params['range_max_campaign_creation'])
		&& ( (
		 ((date('m-d', $params['range_min_campaign_creation']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_creation']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_creation']) == '04-01'))
		&& ((date('m-d', $params['range_max_campaign_creation']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_creation']) == '07-01'))
		&& ((date('m-d', $params['range_max_campaign_creation']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_creation']) == '10-01'))
		&& ((date('m-d', $params['range_max_campaign_creation']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_campaign_creation']).'&apos;;
					query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_campaign_creation']).'&apos;;
					reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_creation&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_campaign_creation']).'&apos;;
				query[&apos;range_max_campaign_creation&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_campaign_creation']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Erstellung') . ': Q' . (ceil((date('m', $params['range_min_campaign_creation']))/3)) . ' (' . date('d.m.', $params['range_min_campaign_creation']) . ' - ' . date('d.m.Y', $params['range_max_campaign_creation']) . ')')
		]);
	}
	else if (isset($params['range_min_campaign_creation']) && isset($params['range_max_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . (($params['range_min_campaign_creation']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_creation'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_campaign_creation']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_creation'])) : ''));
	} else if (isset($params['range_min_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . _('filters_from') . ' ' . (($params['range_min_campaign_creation']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_creation'])) : ''));
	} else if (isset($params['range_max_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . _('filters_to') . ' ' . (($params['range_max_campaign_creation']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_creation'])) : ''));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_campaign_lastUpdate'])
		&& isset($params['range_max_campaign_lastUpdate'])
		&& (date('d', $params['range_min_campaign_lastUpdate']) == '01') //check first day of month
		&& (date('d', $params['range_max_campaign_lastUpdate']) == date('t', $params['range_max_campaign_lastUpdate'])) //check last day of month
		&& (date('Y-m', $params['range_min_campaign_lastUpdate']) == date('Y-m', $params['range_max_campaign_lastUpdate'])) //check if same year and month
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Letzte Änderung') . ': ' . strftime('%B', $params['range_min_campaign_lastUpdate']) . ' ' . date('Y', $params['range_min_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_campaign_lastUpdate'])
		&& isset($params['range_max_campaign_lastUpdate'])
		&& (date('Y-m-d', $params['range_min_campaign_lastUpdate']) == (date('Y-m-d', $params['range_max_campaign_lastUpdate'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('next day', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Letzte Änderung') . ': ' . date('d.m.Y', $params['range_min_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_campaign_lastUpdate'])
		&& isset($params['range_max_campaign_lastUpdate'])
		&& (date('Y', $params['range_min_campaign_lastUpdate']) == (date('Y', $params['range_max_campaign_lastUpdate'])))
		&& ((date('m-d', $params['range_min_campaign_lastUpdate']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_lastUpdate']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Letzte Änderung') . ': ' . date('Y', $params['range_min_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_campaign_lastUpdate'])
		&& isset($params['range_max_campaign_lastUpdate'])
		&& ( (
		 ((date('m-d', $params['range_min_campaign_lastUpdate']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaign_lastUpdate']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_lastUpdate']) == '04-01'))
		&& ((date('m-d', $params['range_max_campaign_lastUpdate']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_lastUpdate']) == '07-01'))
		&& ((date('m-d', $params['range_max_campaign_lastUpdate']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaign_lastUpdate']) == '10-01'))
		&& ((date('m-d', $params['range_max_campaign_lastUpdate']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_campaign_lastUpdate']).'&apos;;
					query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_campaign_lastUpdate']).'&apos;;
					reloadcampaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_campaign_lastUpdate']).'&apos;;
				reloadcampaign(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Letzte Änderung') . ': Q' . (ceil((date('m', $params['range_min_campaign_lastUpdate']))/3)) . ' (' . date('d.m.', $params['range_min_campaign_lastUpdate']) . ' - ' . date('d.m.Y', $params['range_max_campaign_lastUpdate']) . ')')
		]);
	}
	else if (isset($params['range_min_campaign_lastUpdate']) && isset($params['range_max_campaign_lastUpdate'])) {
		array_push($filters, _('Letzte Änderung') . ': ' . (($params['range_min_campaign_lastUpdate']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_lastUpdate'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_campaign_lastUpdate']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_lastUpdate'])) : ''));
	} else if (isset($params['range_min_campaign_lastUpdate'])) {
		array_push($filters, _('Letzte Änderung') . ': ' . _('filters_from') . ' ' . (($params['range_min_campaign_lastUpdate']) ? strftime(_('dateformat_php2'), intval($params['range_min_campaign_lastUpdate'])) : ''));
	} else if (isset($params['range_max_campaign_lastUpdate'])) {
		array_push($filters, _('Letzte Änderung') . ': ' . _('filters_to') . ' ' . (($params['range_max_campaign_lastUpdate']) ? strftime(_('dateformat_php2'), intval($params['range_max_campaign_lastUpdate'])) : ''));
	}if (isset($params['fullsearch_campaign_post_template'])) {
		array_push($filters, _('post_template') . ' ' . _('filter_contains') . ' ' . $params['fullsearch_campaign_post_template']);
	}if (isset($params['filter_campaign_phone_campaign'])) {
		if ($params['filter_campaign_phone_campaign'] == '_null') {
			array_push($filters, _('campaignPhone') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_phone_campaign']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignPhone') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_name'])) {
		if ($params['filter_campaign_name'] == '_null') {
			array_push($filters, _('Bezeichnung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_name']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Bezeichnung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_date'])) {
		if ($params['filter_campaign_date'] == '_null') {
			array_push($filters, _('Start') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_date']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Start') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_desc'])) {
		if ($params['filter_campaign_desc'] == '_null') {
			array_push($filters, _('Beschreibung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_desc']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Beschreibung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_count'])) {
		if ($params['filter_campaign_count'] == '_null') {
			array_push($filters, _('Anzahl der Teilnehmer') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_count']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Anzahl der Teilnehmer') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_pinned'])) {
		if ($params['filter_campaign_pinned'] == '_null') {
			array_push($filters, _('angepinnt') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_pinned']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('angepinnt') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_color'])) {
		if ($params['filter_campaign_color'] == '_null') {
			array_push($filters, _('Farbe') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_color']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Farbe') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_creation'])) {
		if ($params['filter_campaign_creation'] == '_null') {
			array_push($filters, _('Erstellung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_creation']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Erstellung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_lastUpdate'])) {
		if ($params['filter_campaign_lastUpdate'] == '_null') {
			array_push($filters, _('Letzte Änderung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_lastUpdate']))->all() AS $val) {
				$value = ($val) ? strftime(_('dateformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Letzte Änderung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_mode'])) {
		if ($params['filter_campaign_mode'] == '_null') {
			array_push($filters, _('neue %s|Mitglieder') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_mode']))->all() AS $val) {
				$value = \Types\CampaignMode::toString($val);
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('neue %s|Mitglieder') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact1_title'])) {
		if ($params['filter_campaign_email_interact1_title'] == '_null') {
			array_push($filters, _('Interaktion 1: Beschriftung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact1_title']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 1: Beschriftung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact1_url'])) {
		if ($params['filter_campaign_email_interact1_url'] == '_null') {
			array_push($filters, _('Interaktion 1: Ziel-URL') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact1_url']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 1: Ziel-URL') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact2_title'])) {
		if ($params['filter_campaign_email_interact2_title'] == '_null') {
			array_push($filters, _('Interaktion 2: Beschriftung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact2_title']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 2: Beschriftung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact2_url'])) {
		if ($params['filter_campaign_email_interact2_url'] == '_null') {
			array_push($filters, _('Interaktion 2: Ziel-URL') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact2_url']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 2: Ziel-URL') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_campaign'])) {
		if ($params['filter_campaign_email_campaign'] == '_null') {
			array_push($filters, _('Email') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_campaign']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Email') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_auto'])) {
		if ($params['filter_campaign_email_auto'] == '_null') {
			array_push($filters, _('campaignMassMailEmailAuto') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_auto']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignMassMailEmailAuto') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_delay'])) {
		if ($params['filter_campaign_email_delay'] == '_null') {
			array_push($filters, _('campaignMassMailEmailDelay') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_delay']))->all() AS $val) {
				$value = \Types\Integer::print($val)
	;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignMassMailEmailDelay') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_reply'])) {
		if ($params['filter_campaign_email_reply'] == '_null') {
			array_push($filters, _('campaignMassMailEmailReply') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_reply']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignMassMailEmailReply') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_text'])) {
		if ($params['filter_campaign_email_text'] == '_null') {
			array_push($filters, _('campaignText') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_text']))->all() AS $val) {
				$value = mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($val)))), 0, 20) . (strlen($val) >= 20 ? '...' : '');
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignText') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_subject'])) {
		if ($params['filter_campaign_email_subject'] == '_null') {
			array_push($filters, _('campaignSubject') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_subject']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignSubject') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_post_campaign'])) {
		if ($params['filter_campaign_post_campaign'] == '_null') {
			array_push($filters, _('campaignPost') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_post_campaign']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignPost') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_pdf_type'])) {
		if ($params['filter_campaign_pdf_type'] == '_null') {
			array_push($filters, _('PDF-Layout') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_pdf_type']))->all() AS $val) {
				$value = \Types\CampaignPDFType::toString($val);
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('PDF-Layout') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_post_template'])) {
		if ($params['filter_campaign_post_template'] == '_null') {
			array_push($filters, _('campaignPostTemplate') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_post_template']))->all() AS $val) {
				$value = \FOP\Database::query('SELECT filename FROM fop_files WHERE '.qi('ID').' = ' . intval($val))->fetchColumn();
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('campaignPostTemplate') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact1_state'])) {
		if ($params['filter_campaign_email_interact1_state'] == '_null') {
			array_push($filters, _('Interaktion 1: Zustand') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact1_state']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 1: Zustand') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaign_email_interact2_state'])) {
		if ($params['filter_campaign_email_interact2_state'] == '_null') {
			array_push($filters, _('Interaktion 2: Zustand') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaign_email_interact2_state']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Interaktion 2: Zustand') . ': ' . implode(', ', $values));
		}
	}if (isset($params['search_campaign_name'])) {
		array_push($filters, _('name') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_name']);
	}if (isset($params['search_campaign_desc'])) {
		array_push($filters, _('desc') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_desc']);
	}if (isset($params['search_campaign_color'])) {
		array_push($filters, _('color') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_color']);
	}if (isset($params['search_campaign_email_interact1_title'])) {
		array_push($filters, _('email_interact1_title') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_interact1_title']);
	}if (isset($params['search_campaign_email_interact1_url'])) {
		array_push($filters, _('email_interact1_url') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_interact1_url']);
	}if (isset($params['search_campaign_email_interact2_title'])) {
		array_push($filters, _('email_interact2_title') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_interact2_title']);
	}if (isset($params['search_campaign_email_interact2_url'])) {
		array_push($filters, _('email_interact2_url') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_interact2_url']);
	}if (isset($params['search_campaign_email_reply'])) {
		array_push($filters, _('email_reply') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_reply']);
	}if (isset($params['search_campaign_email_text'])) {
		array_push($filters, _('email_text') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_text']);
	}if (isset($params['search_campaign_email_subject'])) {
		array_push($filters, _('email_subject') . ' ' . _('filter_contains') . ' ' . $params['search_campaign_email_subject']);
	}if (isset($params['searchnot_campaign_name'])) {
		array_push($filters, _('name') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_name']);
	}if (isset($params['searchnot_campaign_desc'])) {
		array_push($filters, _('desc') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_desc']);
	}if (isset($params['searchnot_campaign_color'])) {
		array_push($filters, _('color') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_color']);
	}if (isset($params['searchnot_campaign_email_interact1_title'])) {
		array_push($filters, _('email_interact1_title') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_interact1_title']);
	}if (isset($params['searchnot_campaign_email_interact1_url'])) {
		array_push($filters, _('email_interact1_url') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_interact1_url']);
	}if (isset($params['searchnot_campaign_email_interact2_title'])) {
		array_push($filters, _('email_interact2_title') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_interact2_title']);
	}if (isset($params['searchnot_campaign_email_interact2_url'])) {
		array_push($filters, _('email_interact2_url') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_interact2_url']);
	}if (isset($params['searchnot_campaign_email_reply'])) {
		array_push($filters, _('email_reply') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_reply']);
	}if (isset($params['searchnot_campaign_email_text'])) {
		array_push($filters, _('email_text') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_text']);
	}if (isset($params['searchnot_campaign_email_subject'])) {
		array_push($filters, _('email_subject') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaign_email_subject']);
	}
		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(\'_campaign_\')) delete query[q];} reloadcampaign(); ">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 == 'campaign') {
	\FOP\Session::setPayload('dv-campaign', [
		'id' => 'campaign',
		'tbl' => 'campaign',
		'idcol' => 'ID',
		'prev' => \DataViewRouter\Campaign::stepURL('campaign', 'XXX', -1),
		'next' => \DataViewRouter\Campaign::stepURL('campaign', '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\Campaign::viewURL2($params);
	header('Location: ' . $url);
}

die();
    
  }

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

    
  }


  
  

  
  
}



