<?php

namespace DataView;

class CampaignTarget_campaign {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function exportCSVAction($id, $attachTo = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-header ---
    
		$data = self::getData('', $_GET, $id);
	
    // --- BLOCK: before-header-filename ---
    
	$filename = preg_replace('/[~"#%&\*:<>\?\/\\\{|\}]/', '_', _('Empfänger') . ' ' . self::getFilterHTML($_GET, ', ', false) . '.csv'); // sanitize
    // --- BLOCK: before-main ---
    
	if (!$attachTo) {
		header('Content-Type: ' . 'text/csv');
		header('Content-Disposition: attachment; filename="'.$filename.'"');
	} else if ($attachTo === 'string') {
		
	ob_start();
	} else if ($attachTo === 'file') {
		
		$ob_tmp = tempnam(sys_get_temp_dir(), 'fop-file');
		$ob_tmp_handle = fopen($ob_tmp, 'w');
		ob_start(function ($data) use ($ob_tmp_handle) {
			fwrite($ob_tmp_handle, $data);
			return '';
		}, 1024*1024);
	} else if ($attachTo instanceof \PHPMailer\PHPMailer\PHPMailer) {
		
		ob_start();
	} else if ($attachTo instanceof \ZipArchive) {
		
		ob_start();
	} else {
		throw new \FOP\AccessDeniedException('unknown attachment object');
	}
    // --- BLOCK: main ---
    
		?>"Ziel";"Ziel-Link";"Status";"Status-Link";"Notiz";"Erstellung";"letzte Aktualisierung"<?php
		echo "\n";
		$sums = [];
		foreach ($data['items'] AS $item) {
			$val = $item['target'];
			$val = 
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
			if (is_numeric($val)) {
				echo $val;
			} else {
				echo '"' . str_replace("\n", "\\n", str_replace('"', '""', $val)) . '"';
			}
			$val = $item['target'];
			echo ';' . '"' . str_replace("\n", "\\n", str_replace('"', '""', (\TablesRouter\Mitglied::viewURL($val)))) . '"';
			echo ';';
			$val = $item['state'];
			$val = 
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
			if (is_numeric($val)) {
				echo $val;
			} else {
				echo '"' . str_replace("\n", "\\n", str_replace('"', '""', $val)) . '"';
			}
			$val = $item['state'];
			echo ';' . '"' . str_replace("\n", "\\n", str_replace('"', '""', (\TablesRouter\CampaignState::viewURL($val)))) . '"';
			echo ';';
			$val = $item['note'];
			$val = $val;
			if (is_numeric($val)) {
				echo $val;
			} else {
				echo '"' . str_replace("\n", "\\n", str_replace('"', '""', $val)) . '"';
			}
			echo ';';
			$val = $item['creation'];
			$val = ($val) ? strftime(_('datetimeformat_php2'), intval($val)) : '';
			if (is_numeric($val)) {
				echo $val;
			} else {
				echo '"' . str_replace("\n", "\\n", str_replace('"', '""', $val)) . '"';
			}
			echo ';';
			$val = $item['lastUpdate'];
			$val = ($val) ? strftime(_('datetimeformat_php2'), intval($val)) : '';
			if (is_numeric($val)) {
				echo $val;
			} else {
				echo '"' . str_replace("\n", "\\n", str_replace('"', '""', $val)) . '"';
			}
			
			echo "\n";
		}
		
	
    // --- BLOCK: main-~method ---
    
	if (!$attachTo) { ;
	} else if ($attachTo === 'string') {
		
	$content = ob_get_clean();
	return $content;
	} else if ($attachTo === 'file') {
		
		ob_end_flush();
		fclose($ob_tmp_handle);
		return \FOP\Files::uploadFromFile($ob_tmp, $filename);
	} else if ($attachTo instanceof \PHPMailer\PHPMailer\PHPMailer) {
		
		$content = ob_get_clean();
		$attachTo->AddStringAttachment($content, $filename);

	} else if ($attachTo instanceof \ZipArchive) {
		
		$content = ob_get_clean();
		$attachTo->addFromString($filename, $content);
	
	}
    
  }

  public static function renderTabStatAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php if(((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><?php if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() == 1) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onclick="var self = this; $.get(reloadcampaignTarget_campaign({action: 'open', fop_table: 'campaignTarget', fop_id: '_', fop_from: location.href}, true)).then(function () { open_url(self.href, false);}); return false;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::createURL2(['from' => \FOP\Util::getBackUrl(), 'column_campaign' => $id])); ?>"><i class="material-icons">add</i> <?php echo(sprintf(_('create %s'), _('Empfänger'))); ?></a><?php } ?><?php }if(((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="#" onclick="reloadcampaignTarget_campaign({action: 'exportCSV'}); return false;">
		<i class="material-icons">view_comfy</i>
		<?php echo(_('CSV-Export')); ?>
	</a><?php } ?></div><?php 
$data = self::getData('', $_GET, $id, true);
$aggregation = [];
$order = [];
$count = 0;
foreach ($data AS $row) {
	$k = $row['state'];
	if (isset($aggregation[$k])) {
		$aggregation[$k]++;
	} else {
		$aggregation[$k] = 1;
		array_push($order, $k);
	}
	$count++;
}
sort($order, SORT_NATURAL);
$sum_down_i = 0;
$sum_down = [];
$sum_up_i = $count;
$sum_up = [];
foreach ($order AS $i) {
	$sum_down_i += $aggregation[$i];
	$sum_down[$i] = $sum_down_i;

	$sum_up[$i] = $sum_up_i;
	$sum_up_i -= $aggregation[$i];
}
?>
<div class="fop-filter-string-wrapper"><div class="fop-filter-string"><label>Filter:</label> <span><?php echo self::getFilterHTML($_GET); ?></span></div></div>
<div style='width: 100%; height: 60vh; overflow: hidden;'>
<canvas id='hist_campaignTarget_campaign_stat' style='width: 100%; height: 100%;'></canvas>
</div>
<script type='text/javascript'>
$(function () {
	var config = {
		type: 'bar',
		data: {
			datasets: [{
				data: <?php echo json_encode(array_map(function ($k) use ($aggregation) { return $aggregation[$k]; }, $order)); ?>,
				label: 'Statistik'
			}],
			labels: <?php echo json_encode(array_map(function ($k) { return 
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($k))->fetchColumn() ?: _('')
; }, $order)); ?>
		},
		options: {
			responsive: true
		}
	};
	new Chart($('#hist_campaignTarget_campaign_stat')[0].getContext('2d'), config);
});
</script>
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
 <thead>
	<tr>
		<th><?php echo _('Status'); ?></th>
		<th><?php echo _('count'); ?></th>
		<th><?php echo _('count'); ?>-%</th>
		<th>Σ🠫</th>
		<th>%</th>
		<th>Σ🠩</th>
		<th>%</th>
	</tr>
 </thead>
 <tbody>
 	<?php foreach($order AS $k) { ?><tr>
		<td style='max-width: 50vw;'><?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('campaignState').'.'.qi('desc').' AS description, (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('canView').' FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($k);
	$campaignState_result = \FOP\Database::query($sql);
	if ($campaignState_row = $campaignState_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($campaignState_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\CampaignState::viewURL($k, ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"campaignState\" data-id=\"".htmlentities($campaignState_row['ID'])."\">";echo htmlentities($campaignState_row['description']);if ($campaignState_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>
</td>
		<td><?php echo $aggregation[$k]; ?></td>
		<td><?php echo number_format(100.0 * $aggregation[$k] / $count, 2, '.', ''); ?> %</td>
		<td><?php echo $sum_down[$k]; ?></td>
		<td><?php echo number_format(100.0 * $sum_down[$k] / $count, 2, '.', ''); ?> %</td>
		<td><?php echo $sum_up[$k]; ?></td>
		<td><?php echo number_format(100.0 * $sum_up[$k] / $count, 2, '.', ''); ?> %</td>
	</tr><?php } ?>
 </tbody>
 <tbody>
 	<tr style='font-weight: bold;'>
		<td><?php echo _('Summe'); ?></td>
		<td><?php echo $count; ?></td>
		<td>-</td>
		<td>-</td>
		<td>-</td>
		<td>-</td>
		<td>100.00 %</td>
	</tr>
 </tbody>
</table>
<?php
	
    
  }

  public static function renderTabTableAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
     ?><div class='fop-dv-buttonbar'><?php if(((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><?php if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() == 1) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onclick="var self = this; $.get(reloadcampaignTarget_campaign({action: 'open', fop_table: 'campaignTarget', fop_id: '_', fop_from: location.href}, true)).then(function () { open_url(self.href, false);}); return false;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::createURL2(['from' => \FOP\Util::getBackUrl(), 'column_campaign' => $id])); ?>"><i class="material-icons">add</i> <?php echo(sprintf(_('create %s'), _('Empfänger'))); ?></a><?php } ?><?php }if(((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="#" onclick="reloadcampaignTarget_campaign({action: 'exportCSV'}); return false;">
		<i class="material-icons">view_comfy</i>
		<?php echo(_('CSV-Export')); ?>
	</a><?php } ?></div><?php 
								\FOP\User::getIsGuest();
								$itemheight = 32;
								$itemsperpage = ceil(1080 / $itemheight * 0.8);
								$page = (isset($_GET['page_campaignTarget_campaign']) ? intval($_GET['page_campaignTarget_campaign']) : 0);
								$addlines = (isset($_GET['addlines_campaignTarget_campaign']) ? intval($_GET['addlines_campaignTarget_campaign']) : 0);
								$firstitem = $page * $itemsperpage;
								$sqladdon = ' LIMIT ' . ($itemsperpage * 2) . ' OFFSET ' . ($firstitem);
								$data = self::getData($sqladdon, $_GET, $id);
								$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' => 'target',
												'desc' => _('Ziel'),
												'order' => ++$order,
												'width' => 180, // default value
												'collapsed' => 0

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

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

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

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

											];
											$columns['lastUpdate'] = $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('campaignTarget_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='target'
												data-order='<?php echo intval($columns['target']['order']); ?>'
												data-width='<?php echo intval($columns['target']['width']); ?>'
												data-collapsed='<?php echo intval($columns['target']['collapsed']); ?>'
												style='width: <?php echo intval($columns['target']['width']); ?>px; <?php if ($columns['target']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaignTarget_campaign(); 
		}});
		
		win.append(getfilter_campaignTarget_campaign_targetListMultiFilter()); win.find('input').first().focus();
	var icon, sortbtn	= $('<a class=\'mdl-button mdl-js-button mdl-button--icon mdl-button--colored\' style=\'display: inline-block;\'></a>')
		.append(icon = $('<i class=\'material-icons\'></i>').text('unfold_more'))
		.click(function() {
		 if (query['sort_campaignTarget_campaign'] == 'target ASC') {
			query['sort_campaignTarget_campaign'] = 'target DESC';
		 } else if (query['sort_campaignTarget_campaign'] == 'target DESC') {
		 	delete query['sort_campaignTarget_campaign'];
		 } else {
			query['sort_campaignTarget_campaign'] = 'target ASC';
		 }
		 reloadcampaignTarget_campaign();
		 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(_('Ziel')); ?>'><?php echo(_('Ziel')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'target ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'target DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaignTarget_campaign_target']) || isset($_GET['range_max_campaignTarget_campaign_target']) || isset($_GET['deps_campaignTarget_campaign_target']) || isset($_GET['fullsearch_campaignTarget_campaign_target']) || isset($_GET['dynamic_campaignTarget_campaign_target']) || isset($_GET['search_campaignTarget_campaign_target']) || isset($_GET['searchnot_campaignTarget_campaign_target']) || isset($_GET['filter_campaignTarget_campaign_target'])) {
															// 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['target']['header'] = ob_get_contents(); ob_end_clean();
											$columns['target']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['target']['width']); ?>px; <?php if ($columns['target']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; ' data-column='target'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['target'];
	$val = $item['target::description'];
	$canView = $item['target::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>
</div><?php
											};
											$columns['target']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='target'
													data-order='<?php echo intval($columns['target']['order']); ?>'
													data-width='<?php echo intval($columns['target']['width']); ?>'
													data-collapsed='<?php echo intval($columns['target']['collapsed']); ?>'
													style='width: <?php echo intval($columns['target']['width']); ?>px; <?php if ($columns['target']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='state'
												data-order='<?php echo intval($columns['state']['order']); ?>'
												data-width='<?php echo intval($columns['state']['width']); ?>'
												data-collapsed='<?php echo intval($columns['state']['collapsed']); ?>'
												style='width: <?php echo intval($columns['state']['width']); ?>px; <?php if ($columns['state']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaignTarget_campaign(); 
		}});
		
		win.append(getfilter_campaignTarget_campaign_stateListMultiFilter()); win.find('input').first().focus();
		return false;
	">
													<span class='title-title' title='<?php echo(_('Status')); ?>'><?php echo(_('Status')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'state ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'state DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaignTarget_campaign_state']) || isset($_GET['range_max_campaignTarget_campaign_state']) || isset($_GET['deps_campaignTarget_campaign_state']) || isset($_GET['fullsearch_campaignTarget_campaign_state']) || isset($_GET['dynamic_campaignTarget_campaign_state']) || isset($_GET['search_campaignTarget_campaign_state']) || isset($_GET['searchnot_campaignTarget_campaign_state']) || isset($_GET['filter_campaignTarget_campaign_state'])) {
															// 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['state']['header'] = ob_get_contents(); ob_end_clean();
											$columns['state']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['state']['width']); ?>px; <?php if ($columns['state']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; cursor: text;' data-column='state' onclick='
															event.preventDefault();
															event.stopPropagation();
															var div = get_overlay(this, function () {
																// submit the form in overlay
																div.find(&apos;form&apos;).submit();
															});
															$.get(&apos;Tables/CampaignTarget/stateEdit?id=&apos; + <?php echo json_encode($item['ID']); ?>).then(function (html) {
																div.html(html);
																var iframe = div.find(&apos;iframe&apos;)[0];
																if (iframe) iframe.onload = function () {
																	this.onload = function () {
																		div.close();
																		reloadcampaignTarget_campaign();
																	}
																};
																div.find(&apos;input[type=text], input[type=checkbox], textarea&apos;).select().focus().keydown(function (event) {
																	if ([13/*, 37, 39, 38, 40*/, 9].includes(event.keyCode)) { // ENTER, left, right, up, down, tab
																		$(this).closest(&apos;form&apos;).submit();
																		event.preventDefault();
																		event.stopPropagation();
																	}
																});
															});
															div.text(&apos;🗘&apos;);
															return true;'><?php
	
	call_user_func(function () use ($item) {
	$id = $item['state'];
	$val = $item['state::description'];
	$canView = $item['state::canView'];
	if ($val !== null) {
		echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>
</div><?php
											};
											$columns['state']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='state'
													data-order='<?php echo intval($columns['state']['order']); ?>'
													data-width='<?php echo intval($columns['state']['width']); ?>'
													data-collapsed='<?php echo intval($columns['state']['collapsed']); ?>'
													style='width: <?php echo intval($columns['state']['width']); ?>px; <?php if ($columns['state']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='note'
												data-order='<?php echo intval($columns['note']['order']); ?>'
												data-width='<?php echo intval($columns['note']['width']); ?>'
												data-collapsed='<?php echo intval($columns['note']['collapsed']); ?>'
												style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
												<span class='title' onclick="
		var changed = false, win = dropDownFixPosition($(this), null, function() { if (changed) {
			
			reloadcampaignTarget_campaign(); 
		}});
		
		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_campaignTarget_campaign_note'])
		text.on('change keyup paste', function () { if (text.val()) { query['search_campaignTarget_campaign_note'] = text.val(); } else { delete query['search_campaignTarget_campaign_note']; } changed = true; });
		text.focus();
		text.select();
		text.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaignTarget_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_campaignTarget_campaign_note'])
		text2.on('change keyup paste', function () { if (text2.val()) { query['searchnot_campaignTarget_campaign_note'] = text2.val(); } else { delete query['searchnot_campaignTarget_campaign_note']; } changed = true; });
		text2.keydown(function (event) {if ((event.keyCode || event.which) == 13) {$('#table_campaignTarget_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_campaignTarget_campaign'] == 'note ASC') {
			query['sort_campaignTarget_campaign'] = 'note DESC';
		 } else if (query['sort_campaignTarget_campaign'] == 'note DESC') {
		 	delete query['sort_campaignTarget_campaign'];
		 } else {
			query['sort_campaignTarget_campaign'] = 'note ASC';
		 }
		 reloadcampaignTarget_campaign();
		 return false;
	});
	if (win.children().first().hasClass('fop-floatsorter')) {
		// floating layout
		win.prepend(sortbtn.css({float: 'right', margin: '0px'}));
	} else {
		// append to the end
		win.append(sortbtn);
	}
		return false;
	">
													<span class='title-title' title='<?php echo(_('Notiz')); ?>'><?php echo(_('Notiz')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'note ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'note DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaignTarget_campaign_note']) || isset($_GET['range_max_campaignTarget_campaign_note']) || isset($_GET['deps_campaignTarget_campaign_note']) || isset($_GET['fullsearch_campaignTarget_campaign_note']) || isset($_GET['dynamic_campaignTarget_campaign_note']) || isset($_GET['search_campaignTarget_campaign_note']) || isset($_GET['searchnot_campaignTarget_campaign_note']) || isset($_GET['filter_campaignTarget_campaign_note'])) {
															// filter indicator
															?><i class='material-icons fop-small'>filter_list</i><?php
														}
														// search indicator
														?><i class='material-icons fop-small'>search</i>
													</span>
												<div class='fop-column-handle'></div>
											</div><?php
											$columns['note']['header'] = ob_get_contents(); ob_end_clean();
											$columns['note']['render'] = function ($item) use (&$columns, $itemheight) {
												// Render-Callback für eine Zelle
												?><div class='fop-table-column'
													style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?> height: <?php echo $itemheight; ?>px; cursor: text;' data-column='note' onclick='
															event.preventDefault();
															event.stopPropagation();
															var div = get_overlay(this, function () {
																// submit the form in overlay
																div.find(&apos;form&apos;).submit();
															});
															$.get(&apos;Tables/CampaignTarget/noteEdit?id=&apos; + <?php echo json_encode($item['ID']); ?>).then(function (html) {
																div.html(html);
																var iframe = div.find(&apos;iframe&apos;)[0];
																if (iframe) iframe.onload = function () {
																	this.onload = function () {
																		div.close();
																		reloadcampaignTarget_campaign();
																	}
																};
																div.find(&apos;input[type=text], input[type=checkbox], textarea&apos;).select().focus().keydown(function (event) {
																	if ([13/*, 37, 39, 38, 40*/, 9].includes(event.keyCode)) { // ENTER, left, right, up, down, tab
																		$(this).closest(&apos;form&apos;).submit();
																		event.preventDefault();
																		event.stopPropagation();
																	}
																});
															});
															div.text(&apos;🗘&apos;);
															return true;'><span class='overflow-text' title="<?php echo htmlentities($item['note']); ?>"><?php echo (str_replace("\n", "&#x23ce;", htmlentities(mb_substr($item['note'], 0, 40)))) . (strlen($item['note']) >= 40 ? '…' : ''); ?></span></div><?php
											};
											$columns['note']['renderSum'] = function ($item) use (&$columns) {
												// Render-Callback Summe
												?><div class='fop-table-column fop-table-column-aggregate'
													data-column='note'
													data-order='<?php echo intval($columns['note']['order']); ?>'
													data-width='<?php echo intval($columns['note']['width']); ?>'
													data-collapsed='<?php echo intval($columns['note']['collapsed']); ?>'
													style='width: <?php echo intval($columns['note']['width']); ?>px; <?php if ($columns['note']['collapsed'] == 1) { echo ' display: none;'; } ?>'>
													</div><?php
											};
										}
										
									
										
										if(true){
											ob_start();
											?><div class="fop-table-column overlay"
												data-column='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) {
			
			reloadcampaignTarget_campaign(); 
		}}, 600);
		date_filter(win, 'campaignTarget_campaign', 'creation', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadcampaignTarget_campaign();  reloadcampaignTarget_campaign(); });
	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_campaignTarget_campaign'] == 'creation ASC') {
			query['sort_campaignTarget_campaign'] = 'creation DESC';
		 } else if (query['sort_campaignTarget_campaign'] == 'creation DESC') {
		 	delete query['sort_campaignTarget_campaign'];
		 } else {
			query['sort_campaignTarget_campaign'] = 'creation ASC';
		 }
		 reloadcampaignTarget_campaign();
		 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_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'creation ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'creation DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaignTarget_campaign_creation']) || isset($_GET['range_max_campaignTarget_campaign_creation']) || isset($_GET['deps_campaignTarget_campaign_creation']) || isset($_GET['fullsearch_campaignTarget_campaign_creation']) || isset($_GET['dynamic_campaignTarget_campaign_creation']) || isset($_GET['search_campaignTarget_campaign_creation']) || isset($_GET['searchnot_campaignTarget_campaign_creation']) || isset($_GET['filter_campaignTarget_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(_('datetimeformat_php2'), intval($item['creation'])) : ''); ?>"><?php echo htmlentities(($item['creation']) ? strftime(_('datetimeformat_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) {
			
			reloadcampaignTarget_campaign(); 
		}}, 600);
		date_filter(win, 'campaignTarget_campaign', 'lastUpdate', <?php echo htmlentities(json_encode(_('period'))); ?>, <?php echo htmlentities(json_encode(\FOP\I18n::getShortLocale())); ?>, <?php echo htmlentities(json_encode(_('dateformat_moment'))); ?>, function() { reloadcampaignTarget_campaign();  reloadcampaignTarget_campaign(); });
	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_campaignTarget_campaign'] == 'lastUpdate ASC') {
			query['sort_campaignTarget_campaign'] = 'lastUpdate DESC';
		 } else if (query['sort_campaignTarget_campaign'] == 'lastUpdate DESC') {
		 	delete query['sort_campaignTarget_campaign'];
		 } else {
			query['sort_campaignTarget_campaign'] = 'lastUpdate ASC';
		 }
		 reloadcampaignTarget_campaign();
		 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 Aktualisierung')); ?>'><?php echo(_('letzte Aktualisierung')); ?></span>
													<?php // sort indicator
														if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'lastUpdate ASC') {
															?><i class='material-icons fop-small'>keyboard_arrow_down</i><?php
														} else if (isset($_GET['sort_campaignTarget_campaign']) && $_GET['sort_campaignTarget_campaign'] == 'lastUpdate DESC') {
															?><i class='material-icons fop-small'>keyboard_arrow_up</i><?php
														}
														if (isset($_GET['range_min_campaignTarget_campaign_lastUpdate']) || isset($_GET['range_max_campaignTarget_campaign_lastUpdate']) || isset($_GET['deps_campaignTarget_campaign_lastUpdate']) || isset($_GET['fullsearch_campaignTarget_campaign_lastUpdate']) || isset($_GET['dynamic_campaignTarget_campaign_lastUpdate']) || isset($_GET['search_campaignTarget_campaign_lastUpdate']) || isset($_GET['searchnot_campaignTarget_campaign_lastUpdate']) || isset($_GET['filter_campaignTarget_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(_('datetimeformat_php2'), intval($item['lastUpdate'])) : ''); ?>"><?php echo htmlentities(($item['lastUpdate']) ? strftime(_('datetimeformat_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
											};
										}
										
									

									// sort by order
									uasort($columns, function ($a, $b) {
										return $a['order'] - $b['order'];
									});
									?>
									<style type='text/css'>
										#campaignTarget_campaign-table .fop-table-header {
											height: <?php echo 32; ?>px;
										}
										#campaignTarget_campaign-table .fop-table-header .fop-table-column .title,
										#campaignTarget_campaign-table .fop-column-handle,
										#campaignTarget_campaign-table .fop-table-row,
										#campaignTarget_campaign-table .fop-table-row .fop-table-column,
										#campaignTarget_campaign-table .fop-table-column-multicontrol,
										#campaignTarget_campaign-table .fop-filter-button {
											height: 32px;
											line-height: 32px;
										}
										</style>
											<div class="fop-table" data-table-id="campaignTarget_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="campaignTarget_campaign__all-checkbox">
														<input class="mdl-checkbox__input" id="campaignTarget_campaign__all-checkbox" type="checkbox" onchange="checkcampaignTarget_campaign('all', 'campaign', this.checked);checkcampaignTarget_campaign('all', 'target', this.checked);checkcampaignTarget_campaign('all', 'ID', this.checked);">
														</label>
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon campaignTarget_campaign__mass-action" style='visibility: hidden;' onclick="$.get('DataView/CampaignTarget_campaign/permissions?id=' + checkcampaignTarget_campaign(null, 'campaign'), function (data) { for (var method in data) if (method != '__cnt') { var btn = $('[data-interaction-name=&quot;' + method + '&quot;]'); if (data[method] >= 1) btn.show(); else btn.hide(); btn.find('.cnt').text(data[method]); }; });$.get('DataView/CampaignTarget_campaign/permissions?id=' + checkcampaignTarget_campaign(null, 'target'), function (data) { for (var method in data) if (method != '__cnt') { var btn = $('[data-interaction-name=&quot;' + method + '&quot;]'); if (data[method] >= 1) btn.show(); else btn.hide(); btn.find('.cnt').text(data[method]); }; });$.get('DataView/CampaignTarget_campaign/permissions?id=' + checkcampaignTarget_campaign(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_campaignTarget_campaign_') == 0 || key.indexOf('range_max_campaignTarget_campaign_') == 0 || key.indexOf('deps_campaignTarget_campaign_') == 0 || key.indexOf('fullsearch_campaignTarget_campaign_') == 0 || key.indexOf('dynamic_campaignTarget_campaign_') == 0 || key.indexOf('search_campaignTarget_campaign_') == 0 || key.indexOf('searchnot_campaignTarget_campaign_') == 0 || key.indexOf('filter_campaignTarget_campaign_') == 0) delete query[key]; reloadcampaignTarget_campaign(); $(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_campaignTarget_campaign_ID'] = checkcampaignTarget_campaign(null, 'ID'); delete query['page_campaignTarget_campaign']; reloadcampaignTarget_campaign(); $(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(checkcampaignTarget_campaign(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;
			}
			checkcampaignTarget_campaign(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()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="campaigncampaignEmail" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/massMailSend?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&idlist=' + escape(checkcampaignTarget_campaign(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">email</i></span><span class="fop-menu-caption" title="<?php echo(_('campaignMassMailBTN')); ?>"><?php echo(_('campaignMassMailBTN')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="multistatus" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/multistatus?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkcampaignTarget_campaign(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">edit</i></span><span class="fop-menu-caption" title="<?php echo(_('Daten nachtragen')); ?>"><?php echo(_('Daten nachtragen')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="multistatus2" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/multistatus2?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkcampaignTarget_campaign(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">star</i></span><span class="fop-menu-caption" title="<?php echo(_('Status setzen')); ?>"><?php echo(_('Status setzen')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="pdf_multipdf" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/pdfMultiPdf?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&ids=' + escape(checkcampaignTarget_campaign(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">print</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s (PDF)'), _('PDF Vorschau'))); ?>"><?php echo(sprintf(_('%s (PDF)'), _('PDF Vorschau'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="pdf_zip" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/pdfZip?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&ids=' + escape(checkcampaignTarget_campaign(null, 'ID')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">print</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s (ZIP)'), _('PDF Vorschau'))); ?>"><?php echo(sprintf(_('%s (ZIP)'), _('PDF Vorschau'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="delete" style="margin-right:auto; text-align:left;"
					onclick="if(!confirm(<?php echo htmlentities(json_encode(_('confirmdelete'))); ?>)) return;$.get('Tables/CampaignTarget/delete?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkcampaignTarget_campaign(null, 'ID'))).then(function () { reloadcampaignTarget_campaign(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?>
		<div class=mdl-list__item style='border-top: medium solid; text-decoration: underline;'><?php echo(_('Mitglieder')); ?></div><?php
		if(true) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="filteronly" style="margin-right:auto; text-align:left;"
					onclick="query['filter_campaignTarget_campaign_target'] = checkcampaignTarget_campaign(null, 'target'); delete query['page_campaignTarget_campaign']; reloadcampaignTarget_campaign(); $(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(checkcampaignTarget_campaign(null, 'target'));
		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;
			}
			checkcampaignTarget_campaign(newticks, 'target', 'set');
		} $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">colorize</i></span><span class="fop-menu-caption" title="<?php echo(_('limit range')); ?>"><?php echo(_('limit range')); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="campaignTargetAdd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/CampaignTarget/multiadd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&column_target=' + escape(checkcampaignTarget_campaign(null, 'target')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && ((\FOP\User::getGruppe()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="gruppeItemAdd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/GruppeItem/multiadd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&column_item=' + escape(checkcampaignTarget_campaign(null, 'target')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?><?php
		if(true && (!\FOP\User::getIsGuest()) && ((\FOP\User::getGruppe()))) { ?>
			<span class="mdl-list__item mdl-button">
				<span class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;"
					onclick="location.href = 'Tables/Mitglied/lifecycleEnd?ajax&from=<?php echo urlencode(\FOP\Util::getBackUrl()); ?>&id=' + escape(checkcampaignTarget_campaign(null, 'target')); $(this).closest('.overlay').click(); return false;">
					<span style="float:left;"><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?> (<span class='cnt'></span>)
					</span>
				</span>
			</span>
		<?php } ?>
														</ul>
														<!-- column hide -->
														<button type="button" class="mdl-button mdl-js-button mdl-button--icon" onclick="dropDownFixPosition($(this), $(this).next())">
															<i class="material-icons">visibility</i>
														</button>
														<ul class="mdl-list mdl-card mdl-shadow--4dp fop-scroll-menu">
															<?php foreach ($columns AS $col) { ?>
																<li class="mdl-list__item mdl-button" onclick="
																	var isVisible = this.firstElementChild.innerText !== 'clear';
																	this.firstElementChild.innerText = isVisible ? 'clear' : 'visibility'; // switch icon
																	tableColumnVisibility('campaignTarget_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: 'campaignTarget_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_campaignTarget_campaign" <?php \EasyEditor\Navigation::printScroll('dv.CampaignTarget_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_campaignTarget_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_campaignTarget_campaign\'] = wantedPage;
														reloadcampaignTarget_campaign(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)).'!important;'; ?> " data-campaign-id="<?php echo htmlentities($item['campaign']); ?>" data-mitglied-id="<?php echo htmlentities($item['target']); ?>" data-campaignTarget-id="<?php echo htmlentities($item['ID']); ?>"<?php if (isset($item['target'])){
														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['target']))) . ';" ';
														} else {
															echo 'onclick="event.preventDefault(); if (!window.getSelection().toString()) open_url(reloadcampaignTarget_campaign({action: \'open\', fop_table: \'mitglied\', fop_id: ' .  htmlentities(json_encode($item['target'])) . ', 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 campaignTarget_campaign__checkbox campaignTarget_campaign__checkbox campaignTarget_campaign__checkbox-campaign-<?php echo htmlentities($item['campaign']); ?> campaignTarget_campaign__checkbox-target-<?php echo htmlentities($item['target']); ?> campaignTarget_campaign__checkbox-ID-<?php echo htmlentities($item['ID']); ?>" style="width: auto;" for="campaignTarget_campaign__<?php echo htmlentities($itempos); ?>-checkbox">
													<input class="mdl-checkbox__input" id="campaignTarget_campaign__<?php echo htmlentities($itempos); ?>-checkbox" type="checkbox" onchange="<?php if (isset($item['campaign'])) echo 'checkcampaignTarget_campaign(' . htmlentities(json_encode($item['campaign'])) . ', \'campaign\', this.checked); ' ?><?php if (isset($item['target'])) echo 'checkcampaignTarget_campaign(' . htmlentities(json_encode($item['target'])) . ', \'target\', this.checked); ' ?><?php if (isset($item['ID'])) echo 'checkcampaignTarget_campaign(' . htmlentities(json_encode($item['ID'])) . ', \'ID\', this.checked); ' ?>">
													</label><button type="button" class="mdl-button mdl-js-button mdl-button--icon campaignTarget_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-campaignTarget_campaign-action-<?php echo $item['campaign'] ?? 0; ?>">
														<?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="edit" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">edit</i></span><span class="fop-menu-caption" title="<?php echo(_('edit')); ?>"><?php echo(_('edit')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::is_mail']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="campaigncampaignEmail" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::massMailSendURL2(['idlist' => $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::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="multistatus" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::multistatusURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">edit</i></span><span class="fop-menu-caption" title="<?php echo(_('Daten nachtragen')); ?>"><?php echo(_('Daten nachtragen')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="multistatus2" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::multistatus2URL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">star</i></span><span class="fop-menu-caption" title="<?php echo(_('Status setzen')); ?>"><?php echo(_('Status setzen')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['ID']) && $item['operation::view']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="pdf" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::pdfURL2(['id' => $item['ID'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">print</i></span><span class="fop-menu-caption" title="<?php echo(_('PDF Vorschau')); ?>"><?php echo(_('PDF Vorschau')); ?></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/CampaignTarget/delete?ajax&id=<?php echo htmlentities($item['ID']);?>&from=<?php echo htmlentities(\FOP\Util::getBackUrl());?>').then(function () { reloadcampaignTarget_campaign(); }, function (err) { if (err.responseText.startsWith('http')) { window.location.href = err.responseText; } else {alert(err.responseText); }}); $(this).closest('.overlay').click(); return false;
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">delete</i></span><span class="fop-menu-caption" title="<?php echo(_('delete')); ?>"><?php echo(_('delete')); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target'])){ ?>
			<div class=mdl-list__item style='border-top: medium solid; text-decoration: underline;'><?php echo(_('Mitglied')); ?></div>
		<?php } ?> <?php
		if(isset($item['target']) && $item['operation::view']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="view" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Mitglied::viewURL($item['target'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick=" if (!event.ctrlKey) { open_url(reloadcampaignTarget_campaign({action: 'open', fop_table: 'mitglied', fop_id: <?php echo htmlentities(json_encode($item['target'])); ?>, 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['target']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="edit" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Mitglied::editURL($item['target'], ['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['target']) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign()))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="campaignTargetAdd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::multiaddURL2(['column_target' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Aktion'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_ansprechpartner_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Ansprechpartner::createURL2(['column_mitglied' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Kontaktperson'))); ?>"><?php echo(sprintf(_('create %s'), _('Kontaktperson'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_campaignTarget_target" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::createURL2(['column_target' => $item['target'], '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['target']) && ((\FOP\User::getDokument())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_doc_to-mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Doc::createURL2(['column_to-mitglied' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, true);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Dokument'))); ?>"><?php echo(sprintf(_('create %s'), _('Dokument'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_gruppeItem_item" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\GruppeItem::createURL2(['column_item' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Gruppenmitglied'))); ?>"><?php echo(sprintf(_('create %s'), _('Gruppenmitglied'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getBuchhaltung()) && (\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedBuchung_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedBuchung::createURL2(['column_mitglied' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Beitrag'))); ?>"><?php echo(sprintf(_('create %s'), _('Beitrag'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((false))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedDynamicMonthyear_dynamic:parent" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedDynamicMonthyear::createURL2(['column_dynamic:parent' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), sprintf(_('versions of %s'), _('Mitglied')))); ?>"><?php echo(sprintf(_('create %s'), sprintf(_('versions of %s'), _('Mitglied')))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getGruppe())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_mitgliedPassnummer_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\MitgliedPassnummer::createURL2(['column_mitglied' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Passnummer'))); ?>"><?php echo(sprintf(_('create %s'), _('Passnummer'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getSammlung()) && (\FOP\User::getSammlung())) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="create_sammlungMitglied_mitglied" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\SammlungMitglied::createURL2(['column_mitglied' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">create</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('create %s'), _('Sammlungs-Mitglied'))); ?>"><?php echo(sprintf(_('create %s'), _('Sammlungs-Mitglied'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && ((\FOP\User::getGruppe()))) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="gruppeItemAdd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\GruppeItem::multiaddURL2(['column_item' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">add</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?>"><?php echo(sprintf(_('Zu %s hinzufügen'), _('Gruppe'))); ?></span>
			</a>
		<?php } ?><?php
		if(isset($item['target']) && $item['operation::view'] && $item['operation::edit']) { ?>
			<a class="mdl-list__item mdl-button" data-interaction-name="lifecycleEnd" style="margin-right:auto; text-align:left;" href="<?php echo htmlentities(\TablesRouter\Mitglied::lifecycleEndURL2(['id' => $item['target'], 'from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="   
					open_url(this.href, false);
					$(this).closest('.overlay').click();
					return false;">
				<span><i class="material-icons">stop</i></span><span class="fop-menu-caption" title="<?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?>"><?php echo(sprintf(_('%s setzen'), _('Austrittsdatum'))); ?></span>
			</a>
		<?php } ?>
													</ul><?php
		if(isset($item['ID']) && $item['operation::view'] && $item['operation::edit']) {
			?><a class="mdl-button mdl-js-button mdl-button--icon tbl-link" data-tbl="campaignTarget" data-id="<?php echo htmlentities($item['ID']); ?>" data-interaction-name="edit" href="<?php echo htmlentities(\TablesRouter\CampaignTarget::editURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])); ?>"
				onclick="event.stopPropagation();    reloadcampaignTarget_campaign();
					$(this).closest('.overlay').click();
					if (this.href != '#') {
						open_url(this.href, false);
					}
					event.preventDefault();"
				title="<?php echo(_('edit')); ?>">
				<i class="material-icons">edit</i>
			</a><?php } ?>
													</div><?php } ?><?php
													
													foreach ($columns AS $col) {
														$col['render']($item);
													}
													?></div>
												 <?php }?>

													</div>
												</div>

												
												
												</div><?php
												
	
    
  }

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

		var i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout = null;
		function changefilter_campaignTarget_campaign_campaignSearchFilter(val, callback) {
			if(i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout) clearTimeout(i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout);

			i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_campaignItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_campaign_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_campaignListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_campaignTarget_campaign_campaign_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_campaign_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8" type="text">' +
			'<label class="mdl-textfield__label" for="604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8">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_campaignTarget_campaign_campaign', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_campaign_orig'] = '';
					delete query['filter_campaignTarget_campaign_campaign'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_campaignSearchFilter(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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_campaignItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_campaign_orig'] = '';
				delete query['filter_campaignTarget_campaign_campaign'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_campaign', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_campaignListMultiFilter("' + 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_campaignTarget_campaign_stateListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaignTarget_campaign_state', val, cb.checked);
		  } else {
			  delete query['filter_campaignTarget_campaign_state'];
		  }reloadcampaignTarget_campaign();
        
    }

		var ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout = null;
		function changefilter_campaignTarget_campaign_stateSearchFilter(val, callback) {
			if(ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout) clearTimeout(ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout);

			ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_state_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_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_campaignTarget_campaign_state_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_state_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="c326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993ff" type="text">' +
			'<label class="mdl-textfield__label" for="c326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993ff">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_campaignTarget_campaign_state', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_state_orig'] = '';
					delete query['filter_campaignTarget_campaign_state'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_stateItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_state_orig'] = '';
				delete query['filter_campaignTarget_campaign_state'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_state', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_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_campaignTarget_campaign_targetListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaignTarget_campaign_target', val, cb.checked);
		  } else {
			  delete query['filter_campaignTarget_campaign_target'];
		  }reloadcampaignTarget_campaign();
        
    }

		var ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout = null;
		function changefilter_campaignTarget_campaign_targetSearchFilter(val, callback) {
			if(ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout) clearTimeout(ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout);

			ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_targetItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_target_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_targetListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_campaignTarget_campaign_target_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_target_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="a0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8c" type="text">' +
			'<label class="mdl-textfield__label" for="a0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8c">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_campaignTarget_campaign_target', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_target_orig'] = '';
					delete query['filter_campaignTarget_campaign_target'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_targetSearchFilter(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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_targetItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_target_orig'] = '';
				delete query['filter_campaignTarget_campaign_target'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_target', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_targetListMultiFilter("' + 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_campaignTarget_campaign_campaignListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaignTarget_campaign_campaign', val, cb.checked);
		  } else {
			  delete query['filter_campaignTarget_campaign_campaign'];
		  }reloadcampaignTarget_campaign();
        
    }

		var i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout = null;
		function changefilter_campaignTarget_campaign_campaignSearchFilter(val, callback) {
			if(i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout) clearTimeout(i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout);

			i604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8timeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_campaignItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_campaign_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_campaignListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_campaignTarget_campaign_campaign_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_campaign_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8" type="text">' +
			'<label class="mdl-textfield__label" for="604e08ca3792d718ea2920abc3b4e30be2d0a9ce21fad71ccfb833ed1a3807a8">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_campaignTarget_campaign_campaign', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_campaign_orig'] = '';
					delete query['filter_campaignTarget_campaign_campaign'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_campaignSearchFilter(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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_campaignItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_campaign_orig'] = '';
				delete query['filter_campaignTarget_campaign_campaign'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_campaign', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_campaignListMultiFilter("' + 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_campaignTarget_campaign_stateListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaignTarget_campaign_state', val, cb.checked);
		  } else {
			  delete query['filter_campaignTarget_campaign_state'];
		  }reloadcampaignTarget_campaign();
        
    }

		var ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout = null;
		function changefilter_campaignTarget_campaign_stateSearchFilter(val, callback) {
			if(ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout) clearTimeout(ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout);

			ic326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993fftimeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_stateItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_state_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_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_campaignTarget_campaign_state_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_state_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="c326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993ff" type="text">' +
			'<label class="mdl-textfield__label" for="c326232ae9f5452be820f12ca5a7c222885de866f6729f6a57d5f747858993ff">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_campaignTarget_campaign_state', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_state_orig'] = '';
					delete query['filter_campaignTarget_campaign_state'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_stateItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_state_orig'] = '';
				delete query['filter_campaignTarget_campaign_state'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_state', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_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_campaignTarget_campaign_targetListMultiFilter(val, cb) {
		  if (val) {
			  querySet('filter_campaignTarget_campaign_target', val, cb.checked);
		  } else {
			  delete query['filter_campaignTarget_campaign_target'];
		  }reloadcampaignTarget_campaign();
        
    }

		var ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout = null;
		function changefilter_campaignTarget_campaign_targetSearchFilter(val, callback) {
			if(ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout) clearTimeout(ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout);

			ia0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8ctimeout = setTimeout(function() {
				$.getJSON(reloadcampaignTarget_campaign({action: 'getfilter_campaignTarget_campaign_targetItemsByString', 'fstr': val}, true), function(r) {
					callback(r);
					query['filter_campaignTarget_campaign_target_orig'] = val;
				});
			}, 300);
		}

	function getfilter_campaignTarget_campaign_targetListMultiFilter() {
		var gui = $("<div class='fop-floatsorter'></div>");
		// TODO: usability #1866 auf ajax warten bevor ENTER behandelt wird
		var fstr = <?php echo(isset($_GET['filter_campaignTarget_campaign_target_orig']) ? json_encode($_GET['filter_campaignTarget_campaign_target_orig']) : '""') ?>;
		var search = $('<div class="mdl-textfield mdl-js-textfield">' + 
			'<input value="" class="mdl-textfield__input" id="a0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8c" type="text">' +
			'<label class="mdl-textfield__label" for="a0aadd08e0269169f12e9e022eb6a050f4ef4a096896dd2a65f9b48ef9b6de8c">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_campaignTarget_campaign_target', $(inp).data('value'), true);
							hasChecked = true;
						}
					});
				} else {
					// untick all
					search.find('input').val('');
					query['filter_campaignTarget_campaign_target_orig'] = '';
					delete query['filter_campaignTarget_campaign_target'];
					reload('', items);
					hasChecked = true;
				}
				if (hasChecked) {reloadcampaignTarget_campaign();
					
				} else {
					$('#table_campaignTarget_campaign').find('.fop-table-row:first').click();
				}
			} else {
				changefilter_campaignTarget_campaign_targetSearchFilter(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\CampaignTarget_campaign::getfilter_campaignTarget_campaign_targetItemsByStringAction('', $id));
		?>;

		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_campaignTarget_campaign_target_orig'] = '';
				delete query['filter_campaignTarget_campaign_target'];
				reload('', items);reloadcampaignTarget_campaign();
				
			})).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_campaignTarget_campaign_target', value);
				if (!fstr || checked || descr.toLowerCase().includes(fstr.toLowerCase())) {
					checkboxes.append($('<input type=\'checkbox\'  onclick=\'changefilter_campaignTarget_campaign_targetListMultiFilter("' + 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 updateNumbercampaignTarget_campaign(col) {
										//var checklist = window.DataViewChecked['campaignTarget_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['campaignTarget_campaign'] && window.DataViewChecked['campaignTarget_campaign'][col].ranges.length > 0) {
											$('.campaignTarget_campaign__mass-action').css('visibility', 'visible');
											$('.campaignTarget_campaign__action').css('visibility', 'hidden');
										} else {
											$('.campaignTarget_campaign__mass-action').css('visibility', 'hidden');
											$('.campaignTarget_campaign__action').css('visibility', 'visible');
										}
										$('.campaignTarget_campaign__checkbox').each(function (idx, x) {
											for (var cssclass of x.classList) {
												if (cssclass.startsWith('campaignTarget_campaign__checkbox-'+col+'-')) {
													var my_id = cssclass.substr(('campaignTarget_campaign__checkbox-'+col+'-').length);
													if (window.DataViewChecked) {
														x.MaterialCheckbox[checklist.has(my_id) ? 'check' : 'uncheck']();
													}
												}
											}
										});
									}
									function reloadcampaignTarget_campaign (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 } ?>
										nq["id"] = <?php echo json_encode($id); ?>; 
										if (params) {
											for (var i in params) nq[i] = params[i];
											var action = nq['action'];
											delete nq['action'];
											let querystr = "DataView/CampaignTarget_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::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
											delete nq['action'];
											querystr = "DataView/CampaignTarget_campaign/renderTabStat?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#campaignTarget_campaign-stat")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#campaignTarget_campaign-stat")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#campaignTarget_campaign-stat");
												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
												updateNumbercampaignTarget_campaign('campaign');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#campaignTarget_campaign-stat");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadcampaignTarget_campaign()"></div>');
											}
											<?php } ?>
											
											
											<?php if (((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
											delete nq['action'];
											querystr = "DataView/CampaignTarget_campaign/renderTabTable?" + Object.keys(nq).map(function(k){ return k + "=" +  encodeURIComponent(nq[k]); }).join("&");
											// per Ajax laden
											if(!$("#campaignTarget_campaign-table")?.parent()?.parent()?.hasClass('fop-form-feature-collapsed') || $("#campaignTarget_campaign-table")?.parent()?.parent()?.hasClass('fop-form-feature-mode-area')) {
											$.get(querystr, function(data){
												var tab = $("#campaignTarget_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
												updateNumbercampaignTarget_campaign('campaign');
											});
											} else {
												// gesamten Tab ersetzen
												var tab = $("#campaignTarget_campaign-table");
												tab.children().remove();
												el = tab.html('<div class="fop-lazy-reload" onclick="reloadcampaignTarget_campaign()"></div>');
											}
											<?php } ?>
											
										}
									}
									function checkcampaignTarget_campaign (id, col, checked) {
										// ID-Liste aufbauen
										if (!window.DataViewChecked) window.DataViewChecked = {};
										if (!window.DataViewChecked['campaignTarget_campaign']) window.DataViewChecked['campaignTarget_campaign'] = {};
										if (!window.DataViewChecked['campaignTarget_campaign'][col]) window.DataViewChecked['campaignTarget_campaign'][col] = new IDList();

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

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

    
  }

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

	</script>
	<?php
	
    
  }

  public static function getSQL($params, $id) { 
    
    
    // --- 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').',
									/* campaign */ '.qi('campaign').' AS '.qi('campaign').',
									/* campaign::canView */ '.qi('ref:campaign').'.'.qi('campaign:canView').' AS '.qi('campaign::canView').',
									/* campaign::description */ '.qi('ref:campaign').'.'.qi('campaign:description').' AS '.qi('campaign::description').',
									/* color */ (SELECT ' . qi('campaignState') . '.' . qi('color') . ' FROM ' . qi('campaignState') . ' WHERE '.qi('ID').' = ' . qi('campaignTarget') . '.' . qi('state').') AS '.qi('color').',
									/* creation */ '.qi('creation').' AS '.qi('creation').',
									/* lastUpdate */ '.qi('lastUpdate').' AS '.qi('lastUpdate').',
									/* note */ '.qi('note').' AS '.qi('note').',
									/* operation::create */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('CkHlp5PE').' WHERE '.qi('CkHlp5PE').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('gamUdXIr').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('gamUdXIr').' WHERE '.qi('gamUdXIr').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PW9rw6As').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PW9rw6As').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PW9rw6As').' WHERE '.qi('PW9rw6As').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('CoxcrW6l').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('CoxcrW6l').' WHERE '.qi('CoxcrW6l').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AS '.qi('operation::create').',
									/* operation::delete */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('hKxqI7xl').' WHERE '.qi('hKxqI7xl').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('qnAG6U6I').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('qnAG6U6I').' WHERE '.qi('qnAG6U6I').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('MQUST27S').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('MQUST27S').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('MQUST27S').' WHERE '.qi('MQUST27S').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('UZUFh6Y1').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('UZUFh6Y1').' WHERE '.qi('UZUFh6Y1').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AS '.qi('operation::delete').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('vOljclgU').' WHERE '.qi('vOljclgU').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('XXDtdS61').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('XXDtdS61').' WHERE '.qi('XXDtdS61').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('YOWPvw9s').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('YOWPvw9s').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('YOWPvw9s').' WHERE '.qi('YOWPvw9s').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Z2wISAZD').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Z2wISAZD').' WHERE '.qi('Z2wISAZD').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::is_mail */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::is_mail').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AS '.qi('operation::view').',
									/* order */ (SELECT ' . qi('campaignState') . '.' . qi('order') . ' FROM ' . qi('campaignState') . ' WHERE '.qi('ID').' = ' . qi('campaignTarget') . '.' . qi('state').') AS '.qi('order').',
									/* state */ '.qi('state').' AS '.qi('state').',
									/* state::canView */ '.qi('ref:state').'.'.qi('state:canView').' AS '.qi('state::canView').',
									/* state::description */ '.qi('ref:state').'.'.qi('state:description').' AS '.qi('state::description').',
									/* target */ '.qi('target').' AS '.qi('target').',
									/* target::canView */ '.qi('ref:target').'.'.qi('target:canView').' AS '.qi('target::canView').',
									/* target::description */ '.qi('ref:target').'.'.qi('target:description').' AS '.qi('target::description').',
									1
								FROM '.qi('campaignTarget').' '.qi('campaignTarget').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('campaign:ID').', '.qi('campaign').'.'.qi('name').' AS '.qi('campaign:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('campaign:canView').' FROM '.qi('campaign').') '.qi('ref:campaign').' ON '.qi('ref:campaign').'.'.qi('campaign:ID').' = '.qi('campaign').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('state:ID').', '.qi('campaignState').'.'.qi('desc').' AS '.qi('state:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('state:canView').' FROM '.qi('campaignState').') '.qi('ref:state').' ON '.qi('ref:state').'.'.qi('state:ID').' = '.qi('state').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('target:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('target:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('target:canView').' FROM '.qi('mitglied').') '.qi('ref:target').' ON '.qi('ref:target').'.'.qi('target:ID').' = '.qi('target').'
								WHERE ('.qi('campaign').' = ' . \FOP\Database::quote($id) . ')
									AND (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)))) AS t
								LEFT JOIN '.qi('mitglied').' AS '.qi('sorter-target').' ON t.'.qi('target').' = '.qi('sorter-target').'.'.qi('ID').'
								LEFT JOIN '.qi('campaign').' AS '.qi('sorter-campaign').' ON t.'.qi('campaign').' = '.qi('sorter-campaign').'.'.qi('ID').'
								WHERE ' . (isset($params['range_min_campaignTarget_campaign_creation']) ? ($params['range_min_campaignTarget_campaign_creation'] !== '' && is_numeric($params['range_min_campaignTarget_campaign_creation']) ? 't.'.qi('creation').' >= ' . \FOP\Database::quote($params['range_min_campaignTarget_campaign_creation']) . ' AND ' : '') : '') . 
								(isset($params['range_min_campaignTarget_campaign_lastUpdate']) ? ($params['range_min_campaignTarget_campaign_lastUpdate'] !== '' && is_numeric($params['range_min_campaignTarget_campaign_lastUpdate']) ? 't.'.qi('lastUpdate').' >= ' . \FOP\Database::quote($params['range_min_campaignTarget_campaign_lastUpdate']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaignTarget_campaign_creation']) ? ($params['range_max_campaignTarget_campaign_creation'] !== '' && is_numeric($params['range_max_campaignTarget_campaign_creation']) ? 't.'.qi('creation').' <= ' . \FOP\Database::quote($params['range_max_campaignTarget_campaign_creation']) . ' AND ' : '') : '') . 
								(isset($params['range_max_campaignTarget_campaign_lastUpdate']) ? ($params['range_max_campaignTarget_campaign_lastUpdate'] !== '' && is_numeric($params['range_max_campaignTarget_campaign_lastUpdate']) ? 't.'.qi('lastUpdate').' <= ' . \FOP\Database::quote($params['range_max_campaignTarget_campaign_lastUpdate']) . ' AND ' : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_campaign']) ? ($params['filter_campaignTarget_campaign_campaign'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_campaign']))->toSQL('t.'.qi('campaign').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_target']) ? ($params['filter_campaignTarget_campaign_target'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_target']))->toSQL('t.'.qi('target').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_state']) ? ($params['filter_campaignTarget_campaign_state'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_state']))->toSQL('t.'.qi('state').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_note']) ? ($params['filter_campaignTarget_campaign_note'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_note']))->toSQL('t.'.qi('note').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_creation']) ? ($params['filter_campaignTarget_campaign_creation'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_creation']))->toSQL('t.'.qi('creation').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_lastUpdate']) ? ($params['filter_campaignTarget_campaign_lastUpdate'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_lastUpdate']))->toSQL('t.'.qi('lastUpdate').'') . ') AND ') : '') : '') . 
								(isset($params['filter_campaignTarget_campaign_ID']) ? ($params['filter_campaignTarget_campaign_ID'] !== '' ? ('(' . (new \FOP\IDList($params['filter_campaignTarget_campaign_ID']))->toSQL('t.'.qi('ID').'') . ') AND ') : '') : '') . 
								(isset($params['search_campaignTarget_campaign_note']) ? 't.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaignTarget_campaign_note'] . '%') . ' AND ' : '') . 
								(isset($params['searchnot_campaignTarget_campaign_note']) ? 'NOT t.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['searchnot_campaignTarget_campaign_note'] . '%') . ' AND ' : '') . 
								(isset($params['search_campaignTarget_campaign']) ? '(' . 't.'.qi('note').' '.(\FOP\Database::getDriver() == 'pgsql' ? 'ILIKE' : 'LIKE').' ' . \FOP\Database::quote('%' . $params['search_campaignTarget_campaign'] . '%') . ') AND ' : '') . 
								'
								 TRUE ';
								return $sql;
	
    
  }

  public static function getidsAction($col, $id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
			$q = \FOP\Database::query('SELECT t.'.qi($col).' '.self::getSQL($_GET, $id));
			$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 (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) AND ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('campaigncampaignEmail').', SUM(CASE (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) AND (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('vOljclgU').' WHERE '.qi('vOljclgU').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('XXDtdS61').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('XXDtdS61').' WHERE '.qi('XXDtdS61').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('YOWPvw9s').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('YOWPvw9s').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('YOWPvw9s').' WHERE '.qi('YOWPvw9s').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Z2wISAZD').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Z2wISAZD').' WHERE '.qi('Z2wISAZD').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('multistatus').', SUM(CASE (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) AND (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('vOljclgU').' WHERE '.qi('vOljclgU').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('XXDtdS61').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('XXDtdS61').' WHERE '.qi('XXDtdS61').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('YOWPvw9s').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('YOWPvw9s').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('YOWPvw9s').' WHERE '.qi('YOWPvw9s').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Z2wISAZD').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Z2wISAZD').' WHERE '.qi('Z2wISAZD').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('multistatus2').', SUM(CASE (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('pdf_zip').', SUM(CASE (('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('dHL279iX').' WHERE '.qi('dHL279iX').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('fbT2x3zb').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('fbT2x3zb').' WHERE '.qi('fbT2x3zb').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('PmLIw5tN').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('PmLIw5tN').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('PmLIw5tN').' WHERE '.qi('PmLIw5tN').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('Ffzcl8KY').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('Ffzcl8KY').' WHERE '.qi('Ffzcl8KY').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('pdf_multipdf').', 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()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('hKxqI7xl').' WHERE '.qi('hKxqI7xl').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('qnAG6U6I').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) FROM '.qi('mitglied').' '.qi('qnAG6U6I').' WHERE '.qi('qnAG6U6I').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('MQUST27S').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('MQUST27S').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) FROM '.qi('mitglied').' '.qi('MQUST27S').' WHERE '.qi('MQUST27S').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AND (COALESCE((SELECT (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('UZUFh6Y1').'.'.qi('superadmin').') END) FROM '.qi('mitglied').' '.qi('UZUFh6Y1').' WHERE '.qi('UZUFh6Y1').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('target').' LIMIT 1), FALSE))) WHEN TRUE THEN 1 ELSE 0 END) AS '.qi('delete').' FROM '.qi('campaignTarget').' WHERE ' . $ids->toSQL(qi('ID')))->fetch(\PDO::FETCH_ASSOC);
		
		return $perms;
	
    
  }

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

    
  }

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

    
  }

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

    
  }

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

								$order = (\FOP\Util::array_value(array(
									'target ASC' => 'ORDER BY '.qi('sorter-target').'.'.qi('name').' , '.qi('sorter-target').'.'.qi('name').' , '.qi('sorter-target').'.'.qi('name').' , '.qi('sorter-target').'.'.qi('vorname').' , '.qi('sorter-target').'.'.qi('vorname').' , '.qi('sorter-target').'.'.qi('vorname').' ',
									'campaign ASC' => 'ORDER BY '.qi('sorter-campaign').'.'.qi('pinned').' DESC, '.qi('sorter-campaign').'.'.qi('pinned').' DESC, '.qi('sorter-campaign').'.'.qi('pinned').' DESC, '.qi('sorter-campaign').'.'.qi('pinned').' DESC, '.qi('sorter-campaign').'.'.qi('pinned').' DESC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' DESC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' DESC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' DESC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' DESC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' DESC',
									'target DESC' => 'ORDER BY '.qi('sorter-target').'.'.qi('name').' DESC, '.qi('sorter-target').'.'.qi('name').' DESC, '.qi('sorter-target').'.'.qi('name').' DESC, '.qi('sorter-target').'.'.qi('vorname').' DESC, '.qi('sorter-target').'.'.qi('vorname').' DESC, '.qi('sorter-target').'.'.qi('vorname').' DESC',
									'campaign DESC' => 'ORDER BY '.qi('sorter-campaign').'.'.qi('pinned').' ASC, '.qi('sorter-campaign').'.'.qi('pinned').' ASC, '.qi('sorter-campaign').'.'.qi('pinned').' ASC, '.qi('sorter-campaign').'.'.qi('pinned').' ASC, '.qi('sorter-campaign').'.'.qi('pinned').' ASC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' ASC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' ASC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' ASC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' ASC, '.qi('sorter-campaign').'.'.qi('lastUpdate').' ASC',
									'note ASC' => 'ORDER BY t.'.qi('note').' ASC',
									'creation ASC' => 'ORDER BY t.'.qi('creation').' ASC',
									'lastUpdate ASC' => 'ORDER BY t.'.qi('lastUpdate').' ASC',
									'note DESC' => 'ORDER BY t.'.qi('note').' DESC',
									'creation DESC' => 'ORDER BY t.'.qi('creation').' DESC',
									'lastUpdate DESC' => 'ORDER BY t.'.qi('lastUpdate').' DESC',
									'' => ''), isset($params['sort_campaignTarget_campaign']) ? $params['sort_campaignTarget_campaign'] : '') ?: 'ORDER BY '.qi('t').'.'.qi('order').' ASC');
								// 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['campaign'] = \FOP\Sanitizers::null_converter($item['campaign']);
											$item['target'] = \FOP\Sanitizers::null_converter($item['target']);
											$item['state'] = \FOP\Sanitizers::null_converter($item['state']);
											$item['creation'] = intval($item['creation']);
											$item['lastUpdate'] = intval($item['lastUpdate']);
											
											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['campaign'] = \FOP\Sanitizers::null_converter($item['campaign']);
										$item['target'] = \FOP\Sanitizers::null_converter($item['target']);
										$item['state'] = \FOP\Sanitizers::null_converter($item['state']);
										$item['creation'] = intval($item['creation']);
										$item['lastUpdate'] = intval($item['lastUpdate']);
										
									}
									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 ( // Corner Case: Monat
		isset($params['range_min_campaignTarget_campaign_creation'])
		&& isset($params['range_max_campaignTarget_campaign_creation'])
		&& (date('d', $params['range_min_campaignTarget_campaign_creation']) == '01') //check first day of month
		&& (date('d', $params['range_max_campaignTarget_campaign_creation']) == date('t', $params['range_max_campaignTarget_campaign_creation'])) //check last day of month
		&& (date('Y-m', $params['range_min_campaignTarget_campaign_creation']) == date('Y-m', $params['range_max_campaignTarget_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_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . strftime('%B', $params['range_min_campaignTarget_campaign_creation']) . ' ' . date('Y', $params['range_min_campaignTarget_campaign_creation']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_campaignTarget_campaign_creation'])
		&& isset($params['range_max_campaignTarget_campaign_creation'])
		&& (date('Y-m-d', $params['range_min_campaignTarget_campaign_creation']) == (date('Y-m-d', $params['range_max_campaignTarget_campaign_creation'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('next day', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('next day', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . date('d.m.Y', $params['range_min_campaignTarget_campaign_creation']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_campaignTarget_campaign_creation'])
		&& isset($params['range_max_campaignTarget_campaign_creation'])
		&& (date('Y', $params['range_min_campaignTarget_campaign_creation']) == (date('Y', $params['range_max_campaignTarget_campaign_creation'])))
		&& ((date('m-d', $params['range_min_campaignTarget_campaign_creation']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_creation']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('Erstellung') . ': ' . date('Y', $params['range_min_campaignTarget_campaign_creation']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_campaignTarget_campaign_creation'])
		&& isset($params['range_max_campaignTarget_campaign_creation'])
		&& ( (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_creation']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_creation']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_creation']) == '04-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_creation']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_creation']) == '07-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_creation']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_creation']) == '10-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_creation']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
					query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_campaignTarget_campaign_creation']).'&apos;;
					reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_campaignTarget_campaign_creation']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_creation&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_campaignTarget_campaign_creation']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('Erstellung') . ': Q' . (ceil((date('m', $params['range_min_campaignTarget_campaign_creation']))/3)) . ' (' . date('d.m.', $params['range_min_campaignTarget_campaign_creation']) . ' - ' . date('d.m.Y', $params['range_max_campaignTarget_campaign_creation']) . ')')
		]);
	}
	else if (isset($params['range_min_campaignTarget_campaign_creation']) && isset($params['range_max_campaignTarget_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . (($params['range_min_campaignTarget_campaign_creation']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_campaignTarget_campaign_creation'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_campaignTarget_campaign_creation']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_campaignTarget_campaign_creation'])) : ''));
	} else if (isset($params['range_min_campaignTarget_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . _('filters_from') . ' ' . (($params['range_min_campaignTarget_campaign_creation']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_campaignTarget_campaign_creation'])) : ''));
	} else if (isset($params['range_max_campaignTarget_campaign_creation'])) {
		array_push($filters, _('Erstellung') . ': ' . _('filters_to') . ' ' . (($params['range_max_campaignTarget_campaign_creation']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_campaignTarget_campaign_creation'])) : ''));
	}
	
	if ( // Corner Case: Monat
		isset($params['range_min_campaignTarget_campaign_lastUpdate'])
		&& isset($params['range_max_campaignTarget_campaign_lastUpdate'])
		&& (date('d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '01') //check first day of month
		&& (date('d', $params['range_max_campaignTarget_campaign_lastUpdate']) == date('t', $params['range_max_campaignTarget_campaign_lastUpdate'])) //check last day of month
		&& (date('Y-m', $params['range_min_campaignTarget_campaign_lastUpdate']) == date('Y-m', $params['range_max_campaignTarget_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_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of last month', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of last month', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of next month', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of next month', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('letzte Aktualisierung') . ': ' . strftime('%B', $params['range_min_campaignTarget_campaign_lastUpdate']) . ' ' . date('Y', $params['range_min_campaignTarget_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Tag
		isset($params['range_min_campaignTarget_campaign_lastUpdate'])
		&& isset($params['range_max_campaignTarget_campaign_lastUpdate'])
		&& (date('Y-m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == (date('Y-m-d', $params['range_max_campaignTarget_campaign_lastUpdate'])))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('next day', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('next day', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('letzte Aktualisierung') . ': ' . date('d.m.Y', $params['range_min_campaignTarget_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Jahr
		isset($params['range_min_campaignTarget_campaign_lastUpdate'])
		&& isset($params['range_max_campaignTarget_campaign_lastUpdate'])
		&& (date('Y', $params['range_min_campaignTarget_campaign_lastUpdate']) == (date('Y', $params['range_max_campaignTarget_campaign_lastUpdate'])))
		&& ((date('m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_lastUpdate']) == '12-31'))
	) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of January last year', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of December last year', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of January next year', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of December next year', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),
			htmlentities(_('letzte Aktualisierung') . ': ' . date('Y', $params['range_min_campaignTarget_campaign_lastUpdate']))
		]);
	} else if ( // Corner Case: Quartal
		isset($params['range_min_campaignTarget_campaign_lastUpdate'])
		&& isset($params['range_max_campaignTarget_campaign_lastUpdate'])
		&& ( (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '01-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_lastUpdate']) == '03-31')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '04-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_lastUpdate']) == '06-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '07-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_lastUpdate']) == '09-30')) )
		|| (
		 ((date('m-d', $params['range_min_campaignTarget_campaign_lastUpdate']) == '10-01'))
		&& ((date('m-d', $params['range_max_campaignTarget_campaign_lastUpdate']) == '12-31')) )
	) ) {
		array_push($filters, [
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
					query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of -3 months', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
					query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of -3 months', $params['range_max_campaignTarget_campaign_lastUpdate']).'&apos;;
					reloadcampaignTarget_campaign(); ">remove_circle_outline</i>' : ''),
			($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="
				query[&apos;range_min_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('first day of +3 months', $params['range_min_campaignTarget_campaign_lastUpdate']).'&apos;;
				query[&apos;range_max_campaignTarget_campaign_lastUpdate&apos;] = &apos;'.strtotime('last day of +3 months', $params['range_max_campaignTarget_campaign_lastUpdate']).'&apos;;
				reloadcampaignTarget_campaign(); ">add_circle_outline</i>' : ''),	
			htmlentities(_('letzte Aktualisierung') . ': Q' . (ceil((date('m', $params['range_min_campaignTarget_campaign_lastUpdate']))/3)) . ' (' . date('d.m.', $params['range_min_campaignTarget_campaign_lastUpdate']) . ' - ' . date('d.m.Y', $params['range_max_campaignTarget_campaign_lastUpdate']) . ')')
		]);
	}
	else if (isset($params['range_min_campaignTarget_campaign_lastUpdate']) && isset($params['range_max_campaignTarget_campaign_lastUpdate'])) {
		array_push($filters, _('letzte Aktualisierung') . ': ' . (($params['range_min_campaignTarget_campaign_lastUpdate']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_campaignTarget_campaign_lastUpdate'])) : '') . ' ' . _('filters_between') . ' ' . (($params['range_max_campaignTarget_campaign_lastUpdate']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_campaignTarget_campaign_lastUpdate'])) : ''));
	} else if (isset($params['range_min_campaignTarget_campaign_lastUpdate'])) {
		array_push($filters, _('letzte Aktualisierung') . ': ' . _('filters_from') . ' ' . (($params['range_min_campaignTarget_campaign_lastUpdate']) ? strftime(_('datetimeformat_php2'), intval($params['range_min_campaignTarget_campaign_lastUpdate'])) : ''));
	} else if (isset($params['range_max_campaignTarget_campaign_lastUpdate'])) {
		array_push($filters, _('letzte Aktualisierung') . ': ' . _('filters_to') . ' ' . (($params['range_max_campaignTarget_campaign_lastUpdate']) ? strftime(_('datetimeformat_php2'), intval($params['range_max_campaignTarget_campaign_lastUpdate'])) : ''));
	}if (isset($params['filter_campaignTarget_campaign_note'])) {
		if ($params['filter_campaignTarget_campaign_note'] == '_null') {
			array_push($filters, _('Notiz') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_note']))->all() AS $val) {
				$value = $val;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Notiz') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaignTarget_campaign_creation'])) {
		if ($params['filter_campaignTarget_campaign_creation'] == '_null') {
			array_push($filters, _('Erstellung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_creation']))->all() AS $val) {
				$value = ($val) ? strftime(_('datetimeformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Erstellung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaignTarget_campaign_lastUpdate'])) {
		if ($params['filter_campaignTarget_campaign_lastUpdate'] == '_null') {
			array_push($filters, _('letzte Aktualisierung') . ': ' . 'NULL');
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_lastUpdate']))->all() AS $val) {
				$value = ($val) ? strftime(_('datetimeformat_php2'), intval($val)) : '';
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('letzte Aktualisierung') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaignTarget_campaign_campaign'])) {
		if ($params['filter_campaignTarget_campaign_campaign'] == '_null') {
			array_push($filters, _('Aktion') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_campaign']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT '.qi('campaign').'.'.qi('name').' AS description FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Aktion') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaignTarget_campaign_state'])) {
		if ($params['filter_campaignTarget_campaign_state'] == '_null') {
			array_push($filters, _('Status') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_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, _('Status') . ': ' . implode(', ', $values));
		}
	}if (isset($params['filter_campaignTarget_campaign_target'])) {
		if ($params['filter_campaignTarget_campaign_target'] == '_null') {
			array_push($filters, _('Ziel') . ': ' . _(''));
		} else {
			$values = [];
			foreach ((new \FOP\IDList($params['filter_campaignTarget_campaign_target']))->all() AS $val) {
				$value = 
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($val))->fetchColumn() ?: _('')
;
				if ($value) array_push($values, $value);
			}
			array_push($filters, _('Ziel') . ': ' . implode(', ', $values));
		}
	}if (isset($params['search_campaignTarget_campaign_note'])) {
		array_push($filters, _('note') . ' ' . _('filter_contains') . ' ' . $params['search_campaignTarget_campaign_note']);
	}if (isset($params['searchnot_campaignTarget_campaign_note'])) {
		array_push($filters, _('note') . ' ' . _('filter_contains_not') . ' ' . $params['searchnot_campaignTarget_campaign_note']);
	}
		if (count($filters)) {
			$result = implode($delimiter, array_map(function ($filter) {
				if (is_array($filter)) {
					return implode('', $filter);
				}
				return htmlentities($filter);
			}, $filters))
			// Button, um Filter zu entfernen
			. ($showButton ? '<i class="material-icons fop-small" style="cursor: pointer;" onclick="for (var q in query) {if (q.includes(\'_campaignTarget_campaign_\')) delete query[q];} reloadcampaignTarget_campaign(); ">clear</i>' : '');
		} else {
			$result = _('no_filter');
		}
		return $result;
	
    
  }

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

if ($fop_table == 'campaign') {
	\FOP\Session::setPayload('dv-campaign', [
		'id' => 'campaignTarget_campaign',
		'tbl' => 'campaign',
		'idcol' => 'campaign',
		'prev' => \DataViewRouter\CampaignTarget_campaign::stepURL('campaign', 'XXX', -1),
		'next' => \DataViewRouter\CampaignTarget_campaign::stepURL('campaign', 'XXX',  1),
		'from' => $fop_from,
		'param_id' => $id
	]);
	
	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);
}

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

if ($fop_table == 'campaignTarget') {
	\FOP\Session::setPayload('dv-campaignTarget', [
		'id' => 'campaignTarget_campaign',
		'tbl' => 'campaignTarget',
		'idcol' => 'ID',
		'prev' => \DataViewRouter\CampaignTarget_campaign::stepURL('campaignTarget', 'XXX', -1),
		'next' => \DataViewRouter\CampaignTarget_campaign::stepURL('campaignTarget', 'XXX',  1),
		'from' => $fop_from,
		'param_id' => $id
	]);
	
	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\CampaignTarget::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, $dv['param_id']);
	$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();

    
  }


  
  

  
  
}



