<?php

namespace Tables;

class Campaign {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function getDefaults() { 
    
    
    // --- BLOCK: main ---
    
	// erstellt ein leeres Objekt zum Befüllen mit Daten oder als Default fürs Create-Formular
	$data = ['email_interact1_title' => '',
		'email_interact1_state' => null,
		'email_interact1_url' => null,
		'email_interact2_title' => '',
		'email_interact2_state' => null,
		'email_interact2_url' => null,
		'email_campaign' => FALSE,
		'email_auto' => FALSE,
		'email_reply' => null,
		'email_text' => '',
		'email_subject' => '',
		'pdf_type' => '1',
		'post_template' => null,
		'phone_campaign' => FALSE,
		'post_campaign' => FALSE,
		'name' => '',
		'date' => time(),
		'desc' => '',
		'pinned' => FALSE,
		'color' => 'none',
		'creation' => time(),
		'lastUpdate' => time(),
		'mode' => '0',
		'email_delay' => 300];
	return $data;
	
    
  }

  public static function cloneAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		\Types\CampaignState::validate($_POST['email_interact1_state']);
		\Types\CampaignState::validate($_POST['email_interact2_state']);
		\FOP\Files::validate($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \Types\Campaign::validate($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \FOP\Files::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		/* Sanitizer */

		$_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		$_POST['color'] = \FOP\Sanitizers::color_filter($_POST['color']);
		if (((false))) $_POST['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['creation']);
		if (((false))) $_POST['lastUpdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['lastUpdate']);
		$_POST['email_interact1_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact1_state']);
		$_POST['email_interact1_url'] = \FOP\Sanitizers::no_text($_POST['email_interact1_url']);
		$_POST['email_interact2_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact2_state']);
		$_POST['email_interact2_url'] = \FOP\Sanitizers::no_text($_POST['email_interact2_url']);
		$_POST['email_delay'] = \Types\Integer::parse($_POST['email_delay']);
		$_POST['email_reply'] = \FOP\Sanitizers::no_text($_POST['email_reply']);
		$_POST['email_text'] = \FOP\Sanitizers::htmlentities_decode($_POST['email_text']);
		$_POST['post_template'] = \FOP\Files::sanitizeUpload($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $idx => $val) $_POST['campaignAttachment_campaign_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $idx => $val) $_POST['campaignAttachment_campaign_file'][$idx] = \FOP\Files::sanitizeUpload($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_state'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_timeout'])) foreach ($_POST['matrix_campaignFollow_campaign_state_timeout'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_timeout'][$idx] = \Types\Integer::parse($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextState'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access+~email_subject:4fc2424210cf8b37cebdaacbb1da5f64ece2709ce30b53f90fa3a0b77888b746 ---
    
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			if (!(($_POST['email_subject']) || (! (($_POST['email_campaign']) || (($_POST['post_campaign']) && (in_array($_POST['pdf_type'], ['1', '3']))))))) throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (true) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    $old_id = $id;
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    
		$defaults = \Tables\Campaign::getDefaults();
		$defaults['phone_campaign'] = $_POST['phone_campaign'];
		$defaults['name'] = $_POST['name'];
		$defaults['date'] = $_POST['date'];
		$defaults['desc'] = $_POST['desc'];
		$defaults['pinned'] = $_POST['pinned'];
		$defaults['color'] = $_POST['color'];
		$defaults['mode'] = $_POST['mode'];
		$defaults['email_interact1_title'] = $_POST['email_interact1_title'];
		$defaults['email_interact1_state'] = $_POST['email_interact1_state'];
		$defaults['email_interact1_url'] = $_POST['email_interact1_url'];
		$defaults['email_interact2_title'] = $_POST['email_interact2_title'];
		$defaults['email_interact2_state'] = $_POST['email_interact2_state'];
		$defaults['email_interact2_url'] = $_POST['email_interact2_url'];
		$defaults['email_campaign'] = $_POST['email_campaign'];
		$defaults['email_auto'] = $_POST['email_auto'];
		$defaults['email_delay'] = $_POST['email_delay'];
		$defaults['email_reply'] = $_POST['email_reply'];
		$defaults['email_text'] = $_POST['email_text'];
		$defaults['email_subject'] = $_POST['email_subject'];
		$defaults['post_campaign'] = $_POST['post_campaign'];
		$defaults['pdf_type'] = $_POST['pdf_type'];
		$defaults['post_template'] = $_POST['post_template'];
		if (((false))) $defaults['creation'] = $_POST['creation']; else $defaults['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($data['creation']);
		if (((false))) $defaults['lastUpdate'] = $_POST['lastUpdate']; else $defaults['lastUpdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($data['lastUpdate']);
		// TableItemAccess für PHP auswerten
		if (!((\FOP\User::getCampaign()))) throw new \FOP\AccessDeniedException('accessdenied');
		$id = \Tables\Campaign::create($defaults, true);
	
    // --- BLOCK: main-2:save-main-clone ---
    
		// deep clone `campaignTarget`
		if (!isset($_POST['campaignTarget_campaign'])) { // ignore if WFL is filled
			\Tables\CampaignTarget::cloneCampaign($old_id, $id);
		}
	
    // --- BLOCK: main-2:save-main-list-campaignAttachment_campaign ---
    
		// List Save
		if (isset($_POST['campaignAttachment_campaign_ID'])) foreach ($_POST['campaignAttachment_campaign_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['campaignAttachment_campaign'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\CampaignAttachment::getDefaults();
				\Tables\CampaignAttachment::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['campaign'] = $id;
				$subdata['file'] = $_POST['campaignAttachment_campaign_file'][$i];
				$subdata['ID'] = $_POST['campaignAttachment_campaign_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['campaignAttachment_campaign'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['campaignAttachment_campaign'][$i] != '0') {
				// noch keine ID: erstellen
				if (((\FOP\User::getCampaign()))) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\CampaignAttachment::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-2:save-main-matrix-matrix_campaignFollow_campaign_state ---
    if ((!\FOP\User::getIsGuest())) {
	if (isset($_POST['matrix_campaignFollow_campaign_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state'] AS $i => $subid) {
		$parent = $defaults;
		$deps = [];
		
		if (\FOP\Database::query('SELECT aftercontact IS NULL FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($subid))->fetchColumn() != '1') continue;
		if (!isset($_POST['matrix_campaignFollow_campaign_state__' . preg_replace('/[^a-zA-Z_0-9]/', '', $subid)])) {
			// nicht angetickt: evtl. löschen
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::delete($_POST['matrix_campaignFollow_campaign_state_ID'][$i]);
			}
		} else {
			// angetickt: Erstellen oder bearbeiten
			$subdata = [];
			$subdata['campaign'] = $id;
			$subdata['state'] = $_POST['matrix_campaignFollow_campaign_state_state'][$i];
			$subdata['nextCampaign'] = $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$i];
			$subdata['timeout'] = $_POST['matrix_campaignFollow_campaign_state_timeout'][$i];
			$subdata['nextState'] = $_POST['matrix_campaignFollow_campaign_state_nextState'][$i];
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::edit($_POST['matrix_campaignFollow_campaign_state_ID'][$i], $subdata);
			} else {
				\Tables\CampaignFollow::create($subdata);
			}
		}
	}
	}
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['Tables:Campaign:view:id'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-4:load-main-list-campaignAttachment_campaign ---
    
		$campaignAttachment_campaign = [];
		array_push($campaignAttachment_campaign, ...\Tables\Campaign::loadCloneCampaignAttachment_campaignItems($id ?? null));
	
    // --- BLOCK: main-4:load-main-matrix-matrix_campaignFollow_campaign_state ---
    
		
		$matrix_campaignFollow_campaign_state = \FOP\Database::query('SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* _checked */ 1 AS '.qi('_checked').',
									/* campaign */ '.qi('campaign').' AS '.qi('campaign').',
									/* nextCampaign */ '.qi('nextCampaign').' AS '.qi('nextCampaign').',
									/* nextState */ '.qi('nextState').' AS '.qi('nextState').',
									/* state */ '.qi('state').' AS '.qi('state').',
									/* timeout */ '.qi('timeout').' AS '.qi('timeout').',
									1
								FROM '.qi('campaignFollow').' '.qi('campaignFollow').'
								WHERE ('.qi('campaign').' = ' . \FOP\Database::quote($data['ID']) . ')
									AND ((SELECT aftercontact IS NULL FROM '.qi('campaignState').' WHERE '.qi('campaignState').'.'.qi('ID').' = '.qi('campaignFollow').'.'.qi('state').'))')->fetchAll(\PDO::FETCH_ASSOC);
	
    // --- BLOCK: main-4:load-main_Not Modified ---
    
		header_remove('Pragma');
		header_remove('Cache-Control');
		header_remove('Expires');
		header('Cache-Control: private');
		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $data['lastUpdate']) . ' GMT');
		header('ETag: "campaign:clone:' . $id . '"');
		if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $data['lastUpdate'] > 0 && $data['lastUpdate'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
			// cache ist noch aktuell
			header("HTTP/1.1 304 Not Modified");
			exit;
		}
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

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


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::cloneURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_campaign_clone"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_clone" ng-init="form = <?php echo htmlentities(json_encode(['email_campaign' => $data['email_campaign'], 'email_subject' => $data['email_subject'], 'post_campaign' => $data['post_campaign'], 'pdf_type' => $data['pdf_type']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || true || true || true || true || true || ((false)) || ((false)) || true || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0'
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
									$feature = [
										'id' => 'Interaktion',
										'title' => _('Interaktion'),
										'order' => '200-Interaktion', // 200-Interaktion (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (($data['operation::create'] == 1) && (false || true)) {
									$feature = [
										'id' => 'matrix_campaignFollow_campaign_state',
										'title' => _('Follow-Ups'),
										'order' => 'z-matrix_campaignFollow_campaign_state', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (($data['operation::create'] == 1) && (false || true)) {
									$feature = [
										'id' => 'campaignAttachment_campaign',
										'title' => _('Anhänge'),
										'order' => 'z-campaignAttachment_campaign', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true)) {
									$feature = [
										'id' => 'Inhalt',
										'title' => _('Inhalt'),
										'order' => '200-Inhalt', // 200-Inhalt (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '(form[\'post_campaign\'])' : '0')
											 .'||'. (true ? '((form[\'post_campaign\']) && ([\'2\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1))' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_clone_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if ((true)&&((\FOP\User::getCampaign()))) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="Tables:Campaign:view:id" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('create')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_clone_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || true || true || true || true || true || ((false)) || ((false)) || true || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name" id="column_name">
		<!-- Feld "Bezeichnung": name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  required='required'  type="text" name="name"  value="<?php echo htmlentities($data['name']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Start": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Start')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" required='required' value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_desc" id="column_desc">
		<!-- Feld "Beschreibung": desc -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="desc"><?php echo(_('Beschreibung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style="width: 100%;" class="mdl-textfield mdl-js-textfield"><textarea onkeydown='if (event.keyCode == 13 && event.ctrlKey) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="mdl-textfield__input" rows="8" cols="80" name="desc" id="desc" ><?php echo htmlentities($data['desc']); ?></textarea><label class="mdl-textfield__label" for="desc"><?php echo(_('text')); ?></label><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pinned" id="column_pinned">
		<!-- Feld "angepinnt": pinned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pinned"><?php echo(_('angepinnt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="pinned" id="pinned" value="<?php echo ($data['pinned']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="pinned__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['pinned']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>&nbsp;
			<div id="infopinned" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="infopinned"><?php echo(_('angepinnte Kampagnen werden immer oben angezeigt und können u.a. dazu verwendet werden, um Kunden in Kategorien einzuordnen')); ?></div>
		
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_color" id="column_color">
		<!-- Feld "Farbe": color -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="color"><?php echo(_('Farbe')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><input id="color" type="color"  name="color" value="<?php echo ($data['color']) ? $data['color'] : 'none'; ?>"/></div>
	</div>
	</div><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creation" id="column_creation">
		<!-- Feld "Erstellung": creation -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creation"><?php echo(_('Erstellung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="creation" type="text" name="creation" value="<?php echo ($data['creation']) ? strftime(_('dateformat_php2'), intval($data['creation'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_lastUpdate" id="column_lastUpdate">
		<!-- Feld "Letzte Änderung": lastUpdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="lastUpdate"><?php echo(_('Letzte Änderung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="lastUpdate" type="text" name="lastUpdate" value="<?php echo ($data['lastUpdate']) ? strftime(_('dateformat_php2'), intval($data['lastUpdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_mode" id="column_mode">
		<!-- Feld "neue %s|Mitglieder": mode -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="mode"><?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='mode' id='mode'><option value='0'<?php if ($data['mode'] == 0) {echo " selected";}?>><?php echo(_('nicht in Kampagne hinzufügen')); ?></option><option value='1'<?php if ($data['mode'] == 1) {echo " selected";}?>><?php echo(_('anbieten, in Kampagne hinzuzufügen')); ?></option><option value='2'<?php if ($data['mode'] == 2) {echo " selected";}?>><?php echo(_('in Kampagne hinzufügen')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Interaktion']);
										?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_title_email_interact2_title" id="column_email_interact1_title_email_interact2_title">
		<!-- Feld "Interaktion 1: Beschriftung": email_interact1_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_title"><?php echo(_('Interaktion 1: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact1_title"  value="<?php echo htmlentities($data['email_interact1_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Beschriftung": email_interact2_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_title"><?php echo(_('Interaktion 2: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact2_title"  value="<?php echo htmlentities($data['email_interact2_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_state_email_interact2_state" id="column_email_interact1_state_email_interact2_state">
		<!-- Feld "Interaktion 1: Zustand": email_interact1_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_state"><?php echo(_('Interaktion 1: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_clone_email_interact1_stateAction($data['email_interact1_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
		<!-- Feld "Interaktion 2: Zustand": email_interact2_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_state"><?php echo(_('Interaktion 2: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_clone_email_interact2_stateAction($data['email_interact2_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_url_email_interact2_url" id="column_email_interact1_url_email_interact2_url">
		<!-- Feld "Interaktion 1: Ziel-URL": email_interact1_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_url"><?php echo(_('Interaktion 1: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact1_url" id="email_interact1_url" value="<?php echo htmlentities($data['email_interact1_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Ziel-URL": email_interact2_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_url"><?php echo(_('Interaktion 2: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact2_url" id="email_interact2_url" value="<?php echo htmlentities($data['email_interact2_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['Interaktion']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (($data['operation::create'] == 1) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['matrix_campaignFollow_campaign_state']);
										?><?php
	if ((!\FOP\User::getIsGuest())) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card" id='matrix_campaignFollow_campaign_state'  ng-init='form["ID"] = form["ID"] || <?php echo htmlentities(json_encode($id ?? null)); ?>'><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Automatische Follow-Ups')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: 90vh; align-items: start;">
		<table class='mdl-data-table mdl-js-data-table mdl-shadow--2dp table-dense table-editable'>
			<thead>
				<tr>
					
					<th class='mdl-data-table__cell--non-numeric'>
						<label ng-click='cmMatrix_campaignFollow_campaign_stateAllSelectToggle()' class='mdl-checkbox mdl-js-checkbox mdl-js'>
							<input id='cm-matrix_campaignFollow_campaign_state-allselect' type='checkbox' class='mdl-checkbox__input'>
						</label>
					</th>
					<th class='mdl-data-table__cell--non-numeric'>
						<?php echo(_('Zustand')); ?>
					</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Nächste Kampagne')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Timeout / Tage')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Neuer Zustand')); ?>
						</th>
				</tr>
			</thead>
			<tbody class='cm-matrix_campaignFollow_campaign_state'>
			<?php
					// renderAction!
					self::cloneMatrixMatrix_campaignFollow_campaign_stateAction($id, $matrix_campaignFollow_campaign_state);
			?>
			</tbody>
		</table>
	</div>
	</div>
	<?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['matrix_campaignFollow_campaign_state']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (($data['operation::create'] == 1) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignAttachment_campaign']);
										?><span id='campaignAttachment_campaign' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
				<?php
				foreach ($campaignAttachment_campaign AS $row) {
					self::cloneListCampaignAttachment_campaignAction($row, $data);
				}
				if ((\FOP\User::getCampaign())) { ?>
         <div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-create">
             
             <div class="mdl-cell mdl-cell--3-col mdl-cell--2-col-phone fop-form-label"><?php echo(_('Anhänge')); ?></div>
             <div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					  
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter(null)); ?>"
<?php if (null) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote(null))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="uploads" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter(null)); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/cloneListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=uploads%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							event.stopPropagation();
						});

						this.on('success', function(f, file_id) {
							let self = this;
							
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/cloneListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
							self.removeFile(f);
						});

						this.on('removedfile', function(f) {
							$('[data-fopid=' + f.file_id + ']').remove();
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	
             </div>
         </div>
			<?php } ?>
	
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['campaignAttachment_campaign']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Inhalt']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_campaign" id="column_email_campaign">
		<!-- Feld "Email": email_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_campaign"><?php echo(_('Email')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_campaign" id="email_campaign" value="<?php echo ($data['email_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;email_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="email_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_auto" id="column_email_auto" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailAuto": email_auto -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_auto"><?php echo(_('campaignMassMailEmailAuto')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_auto" id="email_auto" value="<?php echo ($data['email_auto']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="email_auto__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_auto']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_delay" id="column_email_delay" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailDelay": email_delay -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_delay"><?php echo(_('campaignMassMailEmailDelay')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="email_delay"  value="<?php echo \Types\Integer::print($data['email_delay']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_reply" id="column_email_reply" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailReply": email_reply -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_reply"><?php echo(_('campaignMassMailEmailReply')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="email" name="email_reply"  id="email_reply" value="<?php echo htmlentities($data['email_reply']); ?>"/><label class="mdl-textfield__label" for="email_reply"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_campaign" id="column_post_campaign">
		<!-- Feld "campaignPost": post_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_campaign"><?php echo(_('campaignPost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="post_campaign" id="post_campaign" value="<?php echo ($data['post_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;post_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="post_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['post_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_phone_campaign" id="column_phone_campaign">
		<!-- Feld "campaignPhone": phone_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="phone_campaign"><?php echo(_('campaignPhone')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="phone_campaign" id="phone_campaign" value="<?php echo ($data['phone_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="phone_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['phone_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pdf_type" id="column_pdf_type" ng-show='form[&apos;post_campaign&apos;]'>
		<!-- Feld "PDF-Layout": pdf_type -->
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pdf_type"><?php echo(_('PDF-Layout')); ?>: </label>
	</div>
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' ng-model='form[&apos;pdf_type&apos;]' ng-revalidate class="selectdropdown mdlext-selectfield__select" name='pdf_type' id='pdf_type'><option value='1'<?php if ($data['pdf_type'] == 1) {echo " selected";}?>><?php echo(_('Briefkopf mit Standardvorlage')); ?></option><option value='2'<?php if ($data['pdf_type'] == 2) {echo " selected";}?>><?php echo(_('Briefkopf auf benutzerdefiniertem Hintergrund')); ?></option><option value='3'<?php if ($data['pdf_type'] == 3) {echo " selected";}?>><?php echo(_('Briefkopf mit Launix-Brief und benutzerdefinierten Zusatzseiten')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_subject" id="column_email_subject" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignSubject": email_subject -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_subject"><?php echo(_('campaignSubject')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;email_subject&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  type="text" name="email_subject"  value="<?php echo htmlentities($data['email_subject']); ?>"/><span class="mdl-textfield__error" style="{{(!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))'><?php echo(_('campaignSubjectRequired')); ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_text" id="column_email_text" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignText": email_text -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_text"><?php echo(_('campaignText')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-suggest="<?php echo htmlentities(json_encode(\Tables\Mitglied::suggestionsAction())); ?>" tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('text').' AS header, '.qi('text').' AS content FROM '.qi('briefVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="email_text" class="html-html_campaign"><?php echo htmlentities($data['email_text']); ?></textarea>
	</div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_template" id="column_post_template" ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'>
		<!-- Feld "campaignPostTemplate": post_template -->
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_template"><?php echo(_('campaignPostTemplate')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter($data['post_template'])); ?>"
<?php if ($data['post_template']) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['post_template']))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="post_template" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter($data['post_template'])); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					zone.find(".fileinput").val(file_id);
					zone.find(".fop-file-upload").hide();
					zone.append($("<div class=\"picker-remove\"></div>").text(title));
					zone.append($("<div class=\"picker-remove\" style=\"cursor: pointer;\"><i class=\"material-icons\">delete</i></div>").click(function () {
						// remove-Button -> val(0)
						zone.find(".fileinput").val(0);
						zone.find(".fop-file-upload").show();
						zone.find(".picker-remove").remove();
					}));
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=post_template%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				maxFiles: 1,
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							if (prevfile) self.removeFile(prevfile);
						});

						this.on('success', function(file, file_id) {
							prevfile = file;
							file.file_id = file_id;
							$(zone).find('.fileinput').val(file_id);
						});

						this.on('removedfile', function(file) {
							$(zone).find('.fileinput').val('0');
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['Inhalt']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

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

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

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

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function deleteConfirmAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: access-itemlist-campaign-delete ---
    
		// ID-Liste neu aufbauen und nur die übrig lassen, die auch erlaubt sind
		$id_ = new \FOP\IDList($id);
		$id = new \FOP\IDList();
		foreach (\FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaign').' WHERE (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AND ' . $id_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $id_sub) {
			$id->push($id_sub);
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (true) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-a-move_campaignAttachment_campaign ---
    
		if (isset($_POST['move_campaignAttachment_campaign'])) {
			\Types\Campaign::validate($_POST['value_campaignAttachment_campaign']);
			$_POST['value_campaignAttachment_campaign'] = \FOP\Sanitizers::null_filter($_POST['value_campaignAttachment_campaign']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('campaignAttachment').' SET '.qi('campaign').' = ' . \FOP\Database::quote($_POST['value_campaignAttachment_campaign']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaignAttachment').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\CampaignAttachment::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-a-move_campaignFollow_campaign ---
    
		if (isset($_POST['move_campaignFollow_campaign'])) {
			\Types\CampaignNullFollow::validate($_POST['value_campaignFollow_campaign']);
			$_POST['value_campaignFollow_campaign'] = \FOP\Sanitizers::null_filter($_POST['value_campaignFollow_campaign']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('campaignFollow').' SET '.qi('campaign').' = ' . \FOP\Database::quote($_POST['value_campaignFollow_campaign']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaignFollow').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\CampaignFollow::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-a-move_campaignFollow_nextCampaign ---
    
		if (isset($_POST['move_campaignFollow_nextCampaign'])) {
			\Types\CampaignNullFollow::validate($_POST['value_campaignFollow_nextCampaign']);
			$_POST['value_campaignFollow_nextCampaign'] = \FOP\Sanitizers::null_filter($_POST['value_campaignFollow_nextCampaign']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('campaignFollow').' SET '.qi('nextCampaign').' = ' . \FOP\Database::quote($_POST['value_campaignFollow_nextCampaign']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('nextCampaign').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaignFollow').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('nextCampaign').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\CampaignFollow::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-a-move_campaignTarget_campaign ---
    
		if (isset($_POST['move_campaignTarget_campaign'])) {
			\Types\Campaign::validate($_POST['value_campaignTarget_campaign']);
			$_POST['value_campaignTarget_campaign'] = \FOP\Sanitizers::null_filter($_POST['value_campaignTarget_campaign']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('campaignTarget').' SET '.qi('campaign').' = ' . \FOP\Database::quote($_POST['value_campaignTarget_campaign']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaignTarget').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\CampaignTarget::deleteConfirmURL2(['id' => new \FOP\IDList($remaining), 'from' => $_POST['from']]) . '#snack:Einige Elemente waren nicht verschiebbar');
			} else {
				header('Location: ' . $_POST['from']);
			}
			die();
		}
	
    // --- BLOCK: main-2:save-main ---
    /* view */
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['no'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['yes'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from'] && strrpos($_POST['fop-from'], 'insert_param') !== false) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::deleteURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = [];
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

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


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::deleteConfirmURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
								 
								id="cardform-wf_campaign_deleteConfirm"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_deleteConfirm" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'constraints',
										'title' => _(''),
										'order' => '200', // 200 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['constraints']);
										?><div class='fop-delete-constraints'><?php
	$foundProblems = false;
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('campaignTarget').' WHERE ' . $id->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignTarget::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Empfänger')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditcampaignTarget_campaign_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaign%26colinsert=value_campaignTarget_campaign%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaign%26colinsert=value_campaignTarget_campaign%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaign", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_campaignTarget_campaign" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('campaignFollow').' WHERE ' . $id->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignFollow::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Follow-Up')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditcampaignFollow_campaign_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignNullFollow%26colinsert=value_campaignFollow_campaign%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignNullFollow%26colinsert=value_campaignFollow_campaign%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_campaignFollow_campaign" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('campaignFollow').' WHERE ' . $id->toSQL(''.qi('nextCampaign').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletiondeniedcascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignFollow::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Follow-Up')) . ' ' . $item['desc'])) . '</a>';
				if (\TablesRouter\CampaignFollow::deleteAccess($item['ID'])) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignFollow::deleteConfirmURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])) . '">' . htmlentities(_('delete')) . '</a>';
				}
			echo '<br>';
		}
		if (count($items)) {
			$foundProblems = true;
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditcampaignFollow_nextCampaign_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignNullFollow%26colinsert=value_campaignFollow_nextCampaign%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignNullFollow%26colinsert=value_campaignFollow_nextCampaign%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_campaignFollow_nextCampaign" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			if (count($items) > 1) {
				// use array of IDs as parameter since deleteAccess calls them with new \FOP\IDList()
				if (\TablesRouter\CampaignFollow::deleteAccess(array_map(function ($item) {return $item['ID'];}, $items))) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignFollow::deleteConfirmURL((new \FOP\IDList(array_map(function ($item) {return $item['ID'];}, $items)))->toString(), ['from' => \FOP\Util::getBackUrl()])) . '">' . count($items) . '× ' . htmlentities(_('delete')) . '</a>';
				}
			}
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('campaignAttachment').' WHERE ' . $id->toSQL(''.qi('campaign').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletioncascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\CampaignAttachment::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Anhang')) . ' ' . $item['desc'])) . '</a>';
				
			echo '<br>';
		}
		if (count($items)) {
			
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditcampaignAttachment_campaign_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaign%26colinsert=value_campaignAttachment_campaign%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaign%26colinsert=value_campaignAttachment_campaign%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaign", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_campaignAttachment_campaign" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			
			echo '<hr><br>';
		}
	
?></div><?php
										\EasyEditor\FormFeature::pop();
										$features['constraints']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_deleteConfirm_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="no" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('no')); ?></button><?php } ?>
									&nbsp;<?php if ((!$foundProblems)) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="yes" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">delete</i><?php echo(_('yes')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_deleteConfirm_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?><?php echo htmlentities(_('confirmdelete')) . ' (' . $id->count() . '× ' . _('Aktion') . ')'; ?><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Acampaign%3AdeleteConfirm&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Acampaign%3AdeleteConfirm&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_campaign_deleteConfirm')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_campaign_deleteConfirm input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

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

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

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function viewAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(!\FOP\User::getIsGuest())) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: fetch ---
    
	\FOP\I18n::ensureIsLoaded();
	$row = self::view($id);

    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['ok'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    /* view */
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['ok'])) {
			
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . (isset($id) && is_string($id) ? preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']) : $_POST['fop-from']));
			} else {
				if ($to = (isset($_GET['popup']) ? \FOP\Util::getCurrentBaseurl().'jscloser.php?action=popup' : \FOP\Session::getPayload('dv-campaign')['from'] ?? null)) {
					header('Location: ' . $to);
					die();
				}
				if (!\TablesRouter\Campaign::indexAccess()) {
					if (!\FOPRouter\Index::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
						die();
					}
					header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Campaign::indexURL2(['popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-4:load-main_Not Modified ---
    
		header_remove('Pragma');
		header_remove('Cache-Control');
		header_remove('Expires');
		header('Cache-Control: private');
		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $data['lastUpdate']) . ' GMT');
		header('ETag: "campaign:view:' . $id . '"');
		if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $data['lastUpdate'] > 0 && $data['lastUpdate'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
			// cache ist noch aktuell
			header("HTTP/1.1 304 Not Modified");
			exit;
		}
	
    // --- BLOCK: main-4:load-visit ---
    
	\FOP\Database::query('UPDATE '.qi('campaign').' SET '.qi('lastVisit').' = '.\FOP\Database::sessionVarSQL('time').' WHERE '.qi('ID').' = ' . intval($id));

    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

		<?php if (isset($_GET['popup'])) { ?>
		<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-campaign')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('campaign').'.'.qi('name').' AS description FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      	</header>
			<style>
				.content {
					margin-top: 0px !important;
				}
			</style>
			<div id='content' class='popup' >
		<?php } else { ?>
			<div class="fop-layout mdl-layout mdl-js-layout mdl-layout--fixed-drawer mdl-layout--fixed-header">
			<header class="fop-header mdl-layout__header mdl-layout__header mdl-layout__header--scroll">
				<div class="mdl-layout__header-row">
					<?php
	if ($dv = \FOP\Session::getPayload('dv-campaign')) { ?>
	<?php if (isset($dv['prev'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['prev'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_left</i>
	</a><?php } ?>
	<a href="<?php echo htmlentities($dv['from']); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">view_list</i>
	</a>
	<?php if (isset($dv['next'])) {?><a href="<?php echo htmlentities(str_replace('XXX', urlencode($id), $dv['next'])); ?>" class="mdl-button mdl-js-button mdl-button--icon">
		<i class="material-icons">keyboard_arrow_right</i>
	</a><?php } ?><?php } ?><span class="mdl-layout-title"><?php echo htmlentities(str_replace('%s', \FOP\Database::query('SELECT '.qi('campaign').'.'.qi('name').' AS description FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() ?: '', _('%s'))); ?></span><div class="mdl-layout-spacer"></div><span class="noprint mdl-layout-title mdl-layout--large-screen-only"><div class="mdl-textfield mdl-js-textfield"><input id="supersearch" accesskey="f" class="mdl-textfield__input" type="text" onkeydown="if (event.keyCode == 13 && this.value) window.location.href = 'FOP/Index/searchURL?q=' + encodeURIComponent(this.value) + '&from=<?php echo htmlentities(urlencode(\FOP\Util::getBackUrl())); ?>';" value="<?php echo htmlentities($_GET['q'] ?? ''); ?>" style="border-bottom: 1px solid white;"/><label class="mdl-textfield__label" style="color: inherit"><?php echo(_('search')); ?> - <?php
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
			// MAC: Control+ davor
			echo 'Control + ';
		}
		if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
			// Firefox
			if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
				// MAC: Control + Alt + key
				echo 'Alt + F';
			} else {
				echo 'Alt + Shift + F';
			}
		} else {
			// Internet Explorer, Chrome, Safari, Opera
			echo 'Alt + F';
		}
	?></label></div></span><i onclick='addFav(null)' class='material-icons fop-favorites' id='favorites_button'>star_border</i>
				</div>
      		</header>


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::viewURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_campaign_view"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_view" ng-init="form = <?php echo htmlentities(json_encode(['email_campaign' => $data['email_campaign'], 'post_campaign' => $data['post_campaign'], 'pdf_type' => $data['pdf_type']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\CampaignTarget_campaign::renderScript($id); ?><?php \DataView\CampaignAttachment_campaign::renderScript($id); ?>
									<?php
									$features = [];
									if ((true) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (true)) {
									$feature = [
										'id' => 'campaignTarget_campaign_stat',
										'title' => _('Statistik'),
										'order' => '500-stat', // 500-stat (50)
										'mode' => 'tab', // tab (50)
										'position' => 'full', // 
										'collapsed' => 1, // 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if ((true) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (true)) {
									$feature = [
										'id' => 'campaignTarget_campaign_table',
										'title' => _('Empfänger'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'tab', // tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (($data['operation::wcgCtRIO'] == 1) && ((\FOP\User::getCampaign())) && (true)) {
									$feature = [
										'id' => 'campaignAttachment_campaign_table',
										'title' => _('Anhänge'),
										'order' => '1106-100', // 1106-100 (50)
										'mode' => 'tab', // tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || ($data['email_campaign']) || false || true || true || true || true || true || true || true || true || true || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'half', // half (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (($data['email_campaign']) ? 'true' : '0')
											 .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0'
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
									$feature = [
										'id' => 'Interaktion',
										'title' => _('Interaktion'),
										'order' => '200-Interaktion', // 200-Interaktion (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true)) {
									$feature = [
										'id' => 'Inhalt',
										'title' => _('Inhalt'),
										'order' => '200-Inhalt', // 200-Inhalt (10-50)
										'mode' => 'region', // region (50)
										'position' => 'half', // half (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '(form[\'post_campaign\'])' : '0')
											 .'||'. (true ? '((form[\'post_campaign\']) && ([\'2\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1))' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if ((true) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignTarget_campaign_stat']);
										?>
	<?php if (((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="campaignTarget_campaign-stat" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadcampaignTarget_campaign()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\CampaignTarget_campaign::renderTabStatAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['campaignTarget_campaign_stat']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if ((true) && ((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignTarget_campaign_table']);
										?>
	<?php if (((\FOP\User::getCampaign()) && (\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="campaignTarget_campaign-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadcampaignTarget_campaign()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\CampaignTarget_campaign::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['campaignTarget_campaign_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (($data['operation::wcgCtRIO'] == 1) && ((\FOP\User::getCampaign())) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignAttachment_campaign_table']);
										?>
	<?php if (((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="campaignAttachment_campaign-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadcampaignAttachment_campaign()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\CampaignAttachment_campaign::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['campaignAttachment_campaign_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_view_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'>
		<?php if (true && $data['operation::view'] == 1 && $data['operation::edit'] == 1 && ((\FOP\User::getCampaign())) && ((\FOP\User::getCampaign()))) { ?><a title="<?php echo(_('editbtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::editURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>mode_edit</i> <?php echo(_('editbtn')); ?></a><?php } ?>&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="ok" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">check</i><?php echo(_('ok')); ?></button><?php } ?>
									&nbsp;
		<?php if (true && $data['operation::view'] == 1 && $data['operation::is_phone'] == 1 && ((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('10 neue Anrufe')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::phone10URL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>call</i> <?php echo(_('10 neue Anrufe')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::view'] == 1 && $data['operation::create'] == 1 && ((\FOP\User::getCampaign())) && ((\FOP\User::getCampaign()))) { ?><a title="<?php echo(_('copy')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::cloneURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>add_circle</i> <?php echo(_('copy')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::view'] == 1 && $data['operation::is_mail'] == 1 && ((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('campaignMassMailBTN')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::massMailURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>email</i> <?php echo(_('campaignMassMailBTN')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::view'] == 1 && $data['operation::is_post'] == 1 && ((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('campaignPostalBTN')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::mailPDFURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>mail</i> <?php echo(_('campaignPostalBTN')); ?></a><?php } ?>&nbsp;
		<?php if (true && $data['operation::view'] == 1 && $data['operation::is_mail'] == 1 && ((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('campaignSingleMailBTN')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::singleMailURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>email</i> <?php echo(_('campaignSingleMailBTN')); ?></a><?php } ?>&nbsp;
		<?php if ($data['operation::delete'] == 1 && $data['operation::delete'] == 1 && ((\FOP\User::getCampaign()))) { ?><a title="<?php echo(_('deletebtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::deleteConfirmURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null, 'from' => $_GET['from'] ?? \FOP\Session::getPayload('dv-campaign')['from'] ?? null])); ?>"><i class='material-icons'>delete</i> <?php echo(_('deletebtn')); ?></a><?php } ?></div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_view_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || ($data['email_campaign']) || false || true || true || true || true || true || true || true || true || true || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name" id="column_name">
		<!-- Feld "Bezeichnung": name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['name']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Start": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Start')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_desc" id="column_desc">
		<!-- Feld "Beschreibung": desc -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="desc"><?php echo(_('Beschreibung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span><?php echo nl2br(htmlentities($data['desc'])); ?></span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_count" id="column_count">
		<!-- Feld "Anzahl der Teilnehmer": count -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="count"><?php echo(_('Anzahl der Teilnehmer')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span style="white-space: nowrap; width: 100%; display: inline-block; "><?php echo htmlentities(\Types\Integer::print($data['count'])); ?>
	</span>
	</div>
	</div><?php if (($data['email_campaign'])) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_stat" id="column_email_stat">
		<!-- Feld "Versand-Fortschritt": email_stat -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_stat"><?php echo(_('Versand-Fortschritt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='width: 100%;'><?php
$max_start = \FOP\Database::query('SELECT MAX(start) FROM '.qi('delayedmethods').' WHERE method = '.\FOP\Database::quote('\Tables\CampaignTarget::sendMail').' AND parameter IN (SELECT CONCAT(\'[\', '.qi('ID').', \']\') FROM '.qi('campaignTarget').' WHERE campaign = '.intval($id).')')->fetchColumn();
$num_pending = \FOP\Database::query('SELECT COUNT(*) FROM '.qi('delayedmethods').' WHERE method = '.\FOP\Database::quote('\Tables\CampaignTarget::sendMail').' AND parameter IN (SELECT CONCAT(\'[\', '.qi('ID').', \']\') FROM '.qi('campaignTarget').' WHERE campaign = '.intval($id).')')->fetchColumn();
$num_waiting = \FOP\Database::query('SELECT COUNT(*) FROM '.qi('campaignTarget').' WHERE state IN (SELECT '.qi('ID').' FROM '.qi('campaignState').' WHERE aftercontact IS NOT NULL) AND campaign = '.intval($id))->fetchColumn();
$num_total = \FOP\Database::query('SELECT COUNT(*) FROM '.qi('campaignTarget').' WHERE campaign = '.intval($id))->fetchColumn();
echo '<div style="display: inline-block; height: 18px; position: relative; width: 100%; background: linear-gradient(0deg, rgba(66,66,66,0.5) 0%, rgba(205,205,205,1) 18%, rgba(205,205,205,1) 79%, rgba(66,66,66,0.5) 100%);">';

$green = ($num_total - $num_waiting) / $num_total; // green -> number of items in a final state
$red = ($num_pending) / $num_total; // red -> number of items currently in the email queue

echo '<div style="display: inline-block; height: 18px; position: relative; width: '.round((100*$green)).'%; background: linear-gradient(0deg, rgba(66,66,66,0.5) 0%, rgba(97,150,80,1) 18%, rgba(30,120,0,1) 79%, rgba(66,66,66,0.5) 100%);"></div>'; // green
echo '<div style="display: inline-block; height: 18px; position: relative; width: '.round((100*$red)).'%; background: linear-gradient(0deg, rgba(66,66,66,0.5) 0%, rgba(210,77,77,1) 18%, rgba(187,2,2,1) 79%, rgba(66,66,66,0.5) 100%);"></div>'; // red
echo '</div>';
if ($num_pending) {
	?><br>
	Voraussichtlich bis: <?php echo date(_('datetimeformat_php'), $max_start); ?>
	<a title="Versand Stoppen" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Campaign::stopEmailURL($id, ['from' => \FOP\Util::getBackUrl()])); ?>"><i class="material-icons">stop</i> Versand stoppen</a><?php
} ?></div>

	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pinned" id="column_pinned">
		<!-- Feld "angepinnt": pinned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pinned"><?php echo(_('angepinnt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['pinned'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_color" id="column_color">
		<!-- Feld "Farbe": color -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="color"><?php echo(_('Farbe')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: inline-block; width: 32px; height: 1em; background-color: <?php echo ($data['color']) ? htmlentities($data['color']) : 'none'; ?>;'></div>&nbsp; <?php echo(htmlentities($data['color'])) ?></span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creation" id="column_creation">
		<!-- Feld "Erstellung": creation -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creation"><?php echo(_('Erstellung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['creation']) ? strftime(_('dateformat_php2'), intval($data['creation'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_lastUpdate" id="column_lastUpdate">
		<!-- Feld "Letzte Änderung": lastUpdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="lastUpdate"><?php echo(_('Letzte Änderung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['lastUpdate']) ? strftime(_('dateformat_php2'), intval($data['lastUpdate'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_mode" id="column_mode">
		<!-- Feld "neue %s|Mitglieder": mode -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="mode"><?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php echo htmlentities(\Types\CampaignMode::toString($data['mode'])); ?>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Interaktion']);
										?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_title_email_interact2_title" id="column_email_interact1_title_email_interact2_title">
		<!-- Feld "Interaktion 1: Beschriftung": email_interact1_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_title"><?php echo(_('Interaktion 1: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['email_interact1_title']); ?>
	</div>
		<!-- Feld "Interaktion 2: Beschriftung": email_interact2_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_title"><?php echo(_('Interaktion 2: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['email_interact2_title']); ?>
	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_state_email_interact2_state" id="column_email_interact1_state_email_interact2_state">
		<!-- Feld "Interaktion 1: Zustand": email_interact1_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_state"><?php echo(_('Interaktion 1: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<?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($data['email_interact1_state']);
	$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($data['email_interact1_state'], ['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(_('') ?: '-');
	}
	
?>

	</div>
		<!-- Feld "Interaktion 2: Zustand": email_interact2_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_state"><?php echo(_('Interaktion 2: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<?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($data['email_interact2_state']);
	$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($data['email_interact2_state'], ['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(_('') ?: '-');
	}
	
?>

	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_url_email_interact2_url" id="column_email_interact1_url_email_interact2_url">
		<!-- Feld "Interaktion 1: Ziel-URL": email_interact1_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_url"><?php echo(_('Interaktion 1: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<a target="_blank" onclick="event.stopPropagation();" href="<?php if(!preg_match('/^https:\/\/|http:\/\/*/', $data['email_interact1_url'])) { echo "http://"; }?><?php echo htmlentities($data['email_interact1_url']);?>"><?php echo htmlentities($data['email_interact1_url']);?></a>
	</div>
		<!-- Feld "Interaktion 2: Ziel-URL": email_interact2_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_url"><?php echo(_('Interaktion 2: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<a target="_blank" onclick="event.stopPropagation();" href="<?php if(!preg_match('/^https:\/\/|http:\/\/*/', $data['email_interact2_url'])) { echo "http://"; }?><?php echo htmlentities($data['email_interact2_url']);?>"><?php echo htmlentities($data['email_interact2_url']);?></a>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['Interaktion']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Inhalt']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_campaign" id="column_email_campaign">
		<!-- Feld "Email": email_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_campaign"><?php echo(_('Email')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['email_campaign'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_auto" id="column_email_auto" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailAuto": email_auto -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_auto"><?php echo(_('campaignMassMailEmailAuto')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['email_auto'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_delay" id="column_email_delay" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailDelay": email_delay -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_delay"><?php echo(_('campaignMassMailEmailDelay')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span style="white-space: nowrap; width: 100%; display: inline-block; "><?php echo htmlentities(\Types\Integer::print($data['email_delay'])); ?>
	</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_reply" id="column_email_reply" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailReply": email_reply -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_reply"><?php echo(_('campaignMassMailEmailReply')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span class='overflow-text'><a onclick="event.stopPropagation();<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>event.preventDefault(); window.open_over(document.baseURI + 'Tables/Fop_mail_host_box_draft/create?to=' + encodeURIComponent(this.href.substr(7)) + '&popup&from=' + encodeURIComponent(document.baseURI + 'jscloser.php?action=popup&close')); <?php } ?>
" href="<?php echo ('mailto:' . htmlentities(($data['email_reply']))); ?>"><?php echo htmlentities($data['email_reply']); ?></a></span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_campaign" id="column_post_campaign">
		<!-- Feld "campaignPost": post_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_campaign"><?php echo(_('campaignPost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['post_campaign'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_phone_campaign" id="column_phone_campaign">
		<!-- Feld "campaignPhone": phone_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="phone_campaign"><?php echo(_('campaignPhone')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['phone_campaign'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pdf_type" id="column_pdf_type" ng-show='form[&apos;post_campaign&apos;]'>
		<!-- Feld "PDF-Layout": pdf_type -->
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pdf_type"><?php echo(_('PDF-Layout')); ?>: </label>
	</div>
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php echo htmlentities(\Types\CampaignPDFType::toString($data['pdf_type'])); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_subject" id="column_email_subject" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignSubject": email_subject -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_subject"><?php echo(_('campaignSubject')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['email_subject']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_text" id="column_email_text" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignText": email_text -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_text"><?php echo(_('campaignText')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
<div ng-non-bindable class='fop-textarea' >
<?php echo \FOP\Util::SanitizeUserHtml($data['email_text']); ?>
</div>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_template" id="column_post_template" ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'>
		<!-- Feld "campaignPostTemplate": post_template -->
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_template"><?php echo(_('campaignPostTemplate')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if ($data['post_template']) { ?><a target='_blank' onclick='event.stopPropagation()' href='fop-files/<?php echo urlencode(htmlentities($data['post_template'])); ?>/x'><?php call_user_func(function($v) { $result = \FOP\Database::query('SELECT filename FROM fop_files WHERE '.qi('ID').' = '.intval($v))->fetch(\PDO::FETCH_ASSOC); echo htmlentities($result['filename']); }, $data['post_template']); ?></a><?php } else { echo '-'; } ?>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['Inhalt']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

									uasort($features, function ($a, $b) {
										return strnatcmp($a['order'], $b['order']);
									});
									foreach ($features AS $feature) {
										\EasyEditor\FormFeature::render($feature);
									}
									?><script type='text/javascript'>
										function setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Acampaign%3Aview&subid=' + encodeURIComponent(id) + '&key=' + encodeURIComponent(key) + '&value=' + encodeURIComponent(value)).then(function () {
												if (key == 'reset') {
													location.reload();
												}
											});
											<?php } /* EditAccess */ ?>
										}
										function setCFFOrder(fids) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFFOrder?form=wf%3Acampaign%3Aview&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_campaign_view')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_campaign_view input[type!="hidden"],textarea,select[tabindex!="-1"]').not('.fop-disabled *').filter(':visible:first').focus().select();
											}
										});

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

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

							</form>
							

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

  public static function mailingCron() { 
    
    
    // --- BLOCK: main ---
    
	foreach (\FOP\Database::query('SELECT '.qi('campaignTarget').'.'.qi('ID').' FROM '.qi('campaign').', '.qi('campaignTarget').', '.qi('campaignState').' WHERE '.qi('campaignState').'.'.qi('aftercontact').' IS NOT NULL AND '.qi('campaignState').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('state').' AND '.qi('campaign').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('campaign').' AND '.qi('campaign').'.'.qi('email_campaign').' AND '.qi('campaign').'.'.qi('email_auto').' ORDER BY '.(\FOP\Database::getDriver() == 'mysql' ? 'RAND' : 'RANDOM').'() LIMIT ' . intval(2))->fetchAll(\PDO::FETCH_COLUMN) AS $id) {
		\Tables\CampaignTarget::sendMail($id);
	}

    
  }

  public static function singleMailAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		$_POST['email'] = \FOP\Sanitizers::no_text($_POST['email']);

		
	}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (true) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    
/* Achtung! Weitere Code Duplication in Target/Mass */
$target = \FOP\Database::query('SELECT
	email_text AS '.qi('campaignEmailText').',
	email_subject AS '.qi('campaignEmailSubject').',
	email_interact1_title,
	email_interact2_title,
	email_reply AS '.qi('replyTo').'
FROM '.qi('campaign').' WHERE '.qi('campaign').'.'.qi('ID').' = ' . intval($id))->fetch(\PDO::FETCH_ASSOC);
$target['campaignTargetEmail'] = $_POST['email'];
$target['campaign'] = $id;

$mail = \Mailer\Mails::getMailer();
if ($target['replyTo']) {
	$mail->AddReplyTo($target['replyTo']);
}

if (!$target['campaignTargetEmail']) return;
$mail->addAddress($target['campaignTargetEmail']);

$mail->Subject = $target['campaignEmailSubject'];
$html = \FOP\Util::SanitizeUserHtml($target['campaignEmailText']);
$html = \FOP\Util::SanitizeUserHtml($html, false, [
	'interaction1' => '<span><a href="#">'.htmlentities($target['email_interact1_title']).'</a></span>',
	'interaction2' => '<span><a href="#">'.htmlentities($target['email_interact2_title']).'</a></span>',
]);
$mail->msgHTML($html);
// Anhänge
\FOP\Files::attachFileToMail(\FOP\Database::query('SELECT '.qi('file').' FROM '.qi('campaignAttachment').' WHERE '.qi('campaign').' = ' . intval($target['campaign']))->fetchAll(\PDO::FETCH_COLUMN), $mail);

$mail->Timeout = 15; // tight timeout
if ($mail->send()) {
} else {
}

    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['Tables:Campaign:view:id'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-4:load-main-init-email ---
    $data['email'] = '';
	
    // --- BLOCK: main-4:load-main_Not Modified ---
    
		header_remove('Pragma');
		header_remove('Cache-Control');
		header_remove('Expires');
		header('Cache-Control: private');
		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $data['lastUpdate']) . ' GMT');
		header('ETag: "campaign:singleMail:' . $id . '"');
		if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $data['lastUpdate'] > 0 && $data['lastUpdate'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
			// cache ist noch aktuell
			header("HTTP/1.1 304 Not Modified");
			exit;
		}
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

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


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::singleMailURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_campaign_singleMail"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_singleMail" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_singleMail_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if ((true)&&((\FOP\User::getCampaign()))) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="Tables:Campaign:view:id" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">send</i><?php echo(_('send')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_singleMail_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email" id="column_email">
		<!-- Feld "campaignSingleRecipient": email -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email"><?php echo(_('campaignSingleRecipient')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="email" name="email"  id="email" value="<?php echo htmlentities($data['email']); ?>"/><label class="mdl-textfield__label" for="email"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

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

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

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

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function createAction() { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\CampaignState::validate($_POST['email_interact1_state']);
		if ((!isset($_POST['cancel']))) \Types\CampaignState::validate($_POST['email_interact2_state']);
		if ((!isset($_POST['cancel']))) \FOP\Files::validate($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \Types\Campaign::validate($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \FOP\Files::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		/* Sanitizer */

		if ((!isset($_POST['cancel']))) $_POST['email_interact1_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact1_state']);
		$_POST['email_interact1_url'] = \FOP\Sanitizers::no_text($_POST['email_interact1_url']);
		if ((!isset($_POST['cancel']))) $_POST['email_interact2_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact2_state']);
		$_POST['email_interact2_url'] = \FOP\Sanitizers::no_text($_POST['email_interact2_url']);
		$_POST['email_delay'] = \Types\Integer::parse($_POST['email_delay']);
		$_POST['email_reply'] = \FOP\Sanitizers::no_text($_POST['email_reply']);
		$_POST['email_text'] = \FOP\Sanitizers::htmlentities_decode($_POST['email_text']);
		$_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		$_POST['color'] = \FOP\Sanitizers::color_filter($_POST['color']);
		if (((false))) $_POST['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['creation']);
		if (((false))) $_POST['lastUpdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['lastUpdate']);
		if ((!isset($_POST['cancel']))) $_POST['post_template'] = \FOP\Files::sanitizeUpload($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $idx => $val) $_POST['campaignAttachment_campaign_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $idx => $val) $_POST['campaignAttachment_campaign_file'][$idx] = \FOP\Files::sanitizeUpload($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_state'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_timeout'])) foreach ($_POST['matrix_campaignFollow_campaign_state_timeout'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_timeout'][$idx] = \Types\Integer::parse($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextState'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access+~email_subject:4fc2424210cf8b37cebdaacbb1da5f64ece2709ce30b53f90fa3a0b77888b746 ---
    
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			if (!isset($_POST['cancel']) && !(($_POST['email_subject']) || (! (($_POST['email_campaign']) || (($_POST['post_campaign']) && (in_array($_POST['pdf_type'], ['1', '3']))))))) throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['cancel'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-main ---
    
		$defaults = \Tables\Campaign::getDefaults();
		$defaults['email_interact1_title'] = $_POST['email_interact1_title'];
		$defaults['email_interact1_url'] = $_POST['email_interact1_url'];
		$defaults['email_interact2_title'] = $_POST['email_interact2_title'];
		$defaults['email_interact2_url'] = $_POST['email_interact2_url'];
		$defaults['email_campaign'] = $_POST['email_campaign'];
		$defaults['email_auto'] = $_POST['email_auto'];
		$defaults['email_delay'] = $_POST['email_delay'];
		$defaults['email_reply'] = $_POST['email_reply'];
		$defaults['email_text'] = $_POST['email_text'];
		$defaults['email_subject'] = $_POST['email_subject'];
		$defaults['phone_campaign'] = $_POST['phone_campaign'];
		$defaults['post_campaign'] = $_POST['post_campaign'];
		$defaults['name'] = $_POST['name'];
		$defaults['date'] = $_POST['date'];
		$defaults['desc'] = $_POST['desc'];
		$defaults['pinned'] = $_POST['pinned'];
		$defaults['color'] = $_POST['color'];
		$defaults['mode'] = $_POST['mode'];
		$defaults['pdf_type'] = $_POST['pdf_type'];
		if ((!isset($_POST['cancel']))) $defaults['email_interact1_state'] = $_POST['email_interact1_state'];
		if ((!isset($_POST['cancel']))) $defaults['email_interact2_state'] = $_POST['email_interact2_state'];
		if (((false))) $defaults['creation'] = $_POST['creation'];
		if (((false))) $defaults['lastUpdate'] = $_POST['lastUpdate'];
		if ((!isset($_POST['cancel']))) $defaults['post_template'] = $_POST['post_template'];
		// TableItemAccess für PHP auswerten
		if (!((\FOP\User::getCampaign()))) throw new \FOP\AccessDeniedException('accessdenied');
		$id = \Tables\Campaign::create($defaults);
	
    // --- BLOCK: main-2:save-main-list-campaignAttachment_campaign ---
    
		// List Save
		if (isset($_POST['campaignAttachment_campaign_ID'])) foreach ($_POST['campaignAttachment_campaign_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['campaignAttachment_campaign'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\CampaignAttachment::getDefaults();
				\Tables\CampaignAttachment::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['campaign'] = $id;
				$subdata['file'] = $_POST['campaignAttachment_campaign_file'][$i];
				$subdata['ID'] = $_POST['campaignAttachment_campaign_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['campaignAttachment_campaign'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['campaignAttachment_campaign'][$i] != '0') {
				// noch keine ID: erstellen
				if (((\FOP\User::getCampaign()))) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\CampaignAttachment::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-2:save-main-matrix-matrix_campaignFollow_campaign_state ---
    if ((!\FOP\User::getIsGuest())) {
	if (isset($_POST['matrix_campaignFollow_campaign_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state'] AS $i => $subid) {
		$parent = $defaults;
		$deps = [];
		
		if (\FOP\Database::query('SELECT aftercontact IS NULL FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($subid))->fetchColumn() != '1') continue;
		if (!isset($_POST['matrix_campaignFollow_campaign_state__' . preg_replace('/[^a-zA-Z_0-9]/', '', $subid)])) {
			// nicht angetickt: evtl. löschen
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::delete($_POST['matrix_campaignFollow_campaign_state_ID'][$i]);
			}
		} else {
			// angetickt: Erstellen oder bearbeiten
			$subdata = [];
			$subdata['campaign'] = $id;
			$subdata['state'] = $_POST['matrix_campaignFollow_campaign_state_state'][$i];
			$subdata['nextCampaign'] = $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$i];
			$subdata['timeout'] = $_POST['matrix_campaignFollow_campaign_state_timeout'][$i];
			$subdata['nextState'] = $_POST['matrix_campaignFollow_campaign_state_nextState'][$i];
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::edit($_POST['matrix_campaignFollow_campaign_state_ID'][$i], $subdata);
			} else {
				\Tables\CampaignFollow::create($subdata);
			}
		}
	}
	}
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['cancel'])) {
			
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . (isset($id) && is_string($id) ? preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']) : $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::indexURL2(['popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['save'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from'] && strrpos($_POST['fop-from'], 'insert_param') !== false) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				if (!\TablesRouter\Campaign::viewAccess($id)) {
					if (!\TablesRouter\Campaign::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
						die();
					}
					header('Location: ' . \TablesRouter\Campaign::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = \Tables\Campaign::getDefaults();
	
    // --- BLOCK: main-4:load-main-list-campaignAttachment_campaign ---
    
		$campaignAttachment_campaign = [];
		
	
    // --- BLOCK: main-4:load-main-matrix-matrix_campaignFollow_campaign_state ---
    
		
		$matrix_campaignFollow_campaign_state = [];
	
    // --- BLOCK: main-4:load-~sanitize ---
    
		\Tables\Campaign::sanitizeDefaults($data, true);
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

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


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::createURL2(['popup' => $_GET['popup'] ?? null]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_campaign_create"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_create" ng-init="form = <?php echo htmlentities(json_encode(['email_campaign' => $data['email_campaign'], 'email_subject' => $data['email_subject'], 'post_campaign' => $data['post_campaign'], 'pdf_type' => $data['pdf_type']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || false || false || false || false || false || false || false || true || true || true || true || true || ((false)) || ((false)) || true || false || false || false || false || false || false || false || false || false || false || false || false)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0'
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
									$feature = [
										'id' => 'Interaktion',
										'title' => _('Interaktion'),
										'order' => '200-Interaktion', // 200-Interaktion (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && ((\FOP\User::getCampaign())) && (false || true)) {
									$feature = [
										'id' => 'matrix_campaignFollow_campaign_state',
										'title' => _('Follow-Ups'),
										'order' => 'z-matrix_campaignFollow_campaign_state', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && ((\FOP\User::getCampaign())) && (false || true)) {
									$feature = [
										'id' => 'campaignAttachment_campaign',
										'title' => _('Anhänge'),
										'order' => 'z-campaignAttachment_campaign', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? '(form[\'email_campaign\'])' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || (!isset($_POST['cancel'])) || true || true)) {
									$feature = [
										'id' => 'Inhalt',
										'title' => _('Inhalt'),
										'order' => '200-Inhalt', // 200-Inhalt (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '(form[\'post_campaign\'])' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? '((form[\'post_campaign\']) && ([\'2\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1))' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_create_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="save" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('save')); ?></button><?php } ?>
									&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="cancel" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('cancel')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_create_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || false || false || false || false || false || false || false || true || true || true || true || true || ((false)) || ((false)) || true || false || false || false || false || false || false || false || false || false || false || false || false)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name" id="column_name">
		<!-- Feld "Bezeichnung": name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  required='required'  type="text" name="name"  value="<?php echo htmlentities($data['name']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Start": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Start')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" required='required' value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_desc" id="column_desc">
		<!-- Feld "Beschreibung": desc -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="desc"><?php echo(_('Beschreibung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style="width: 100%;" class="mdl-textfield mdl-js-textfield"><textarea onkeydown='if (event.keyCode == 13 && event.ctrlKey) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="mdl-textfield__input" rows="8" cols="80" name="desc" id="desc" ><?php echo htmlentities($data['desc']); ?></textarea><label class="mdl-textfield__label" for="desc"><?php echo(_('text')); ?></label><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pinned" id="column_pinned">
		<!-- Feld "angepinnt": pinned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pinned"><?php echo(_('angepinnt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="pinned" id="pinned" value="<?php echo ($data['pinned']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="pinned__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['pinned']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>&nbsp;
			<div id="infopinned" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="infopinned"><?php echo(_('angepinnte Kampagnen werden immer oben angezeigt und können u.a. dazu verwendet werden, um Kunden in Kategorien einzuordnen')); ?></div>
		
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_color" id="column_color">
		<!-- Feld "Farbe": color -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="color"><?php echo(_('Farbe')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><input id="color" type="color"  name="color" value="<?php echo ($data['color']) ? $data['color'] : 'none'; ?>"/></div>
	</div>
	</div><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creation" id="column_creation">
		<!-- Feld "Erstellung": creation -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creation"><?php echo(_('Erstellung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="creation" type="text" name="creation" value="<?php echo ($data['creation']) ? strftime(_('dateformat_php2'), intval($data['creation'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_lastUpdate" id="column_lastUpdate">
		<!-- Feld "Letzte Änderung": lastUpdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="lastUpdate"><?php echo(_('Letzte Änderung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="lastUpdate" type="text" name="lastUpdate" value="<?php echo ($data['lastUpdate']) ? strftime(_('dateformat_php2'), intval($data['lastUpdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_mode" id="column_mode">
		<!-- Feld "neue %s|Mitglieder": mode -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="mode"><?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='mode' id='mode'><option value='0'<?php if ($data['mode'] == 0) {echo " selected";}?>><?php echo(_('nicht in Kampagne hinzufügen')); ?></option><option value='1'<?php if ($data['mode'] == 1) {echo " selected";}?>><?php echo(_('anbieten, in Kampagne hinzuzufügen')); ?></option><option value='2'<?php if ($data['mode'] == 2) {echo " selected";}?>><?php echo(_('in Kampagne hinzufügen')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Interaktion']);
										?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_title_email_interact2_title" id="column_email_interact1_title_email_interact2_title">
		<!-- Feld "Interaktion 1: Beschriftung": email_interact1_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_title"><?php echo(_('Interaktion 1: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact1_title"  value="<?php echo htmlentities($data['email_interact1_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Beschriftung": email_interact2_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_title"><?php echo(_('Interaktion 2: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact2_title"  value="<?php echo htmlentities($data['email_interact2_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?><?php } ?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_state_email_interact2_state" id="column_email_interact1_state_email_interact2_state">
		<!-- Feld "Interaktion 1: Zustand": email_interact1_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_state"><?php echo(_('Interaktion 1: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_create_email_interact1_stateAction($data['email_interact1_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
		<!-- Feld "Interaktion 2: Zustand": email_interact2_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_state"><?php echo(_('Interaktion 2: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_create_email_interact2_stateAction($data['email_interact2_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_url_email_interact2_url" id="column_email_interact1_url_email_interact2_url">
		<!-- Feld "Interaktion 1: Ziel-URL": email_interact1_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_url"><?php echo(_('Interaktion 1: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact1_url" id="email_interact1_url" value="<?php echo htmlentities($data['email_interact1_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Ziel-URL": email_interact2_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_url"><?php echo(_('Interaktion 2: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact2_url" id="email_interact2_url" value="<?php echo htmlentities($data['email_interact2_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['Interaktion']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && ((\FOP\User::getCampaign())) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['matrix_campaignFollow_campaign_state']);
										?><?php
	if ((!\FOP\User::getIsGuest())) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card" id='matrix_campaignFollow_campaign_state'  ng-init='form["ID"] = form["ID"] || <?php echo htmlentities(json_encode($id ?? null)); ?>'><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Automatische Follow-Ups')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: 90vh; align-items: start;">
		<table class='mdl-data-table mdl-js-data-table mdl-shadow--2dp table-dense table-editable'>
			<thead>
				<tr>
					
					<th class='mdl-data-table__cell--non-numeric'>
						<label ng-click='cmMatrix_campaignFollow_campaign_stateAllSelectToggle()' class='mdl-checkbox mdl-js-checkbox mdl-js'>
							<input id='cm-matrix_campaignFollow_campaign_state-allselect' type='checkbox' class='mdl-checkbox__input'>
						</label>
					</th>
					<th class='mdl-data-table__cell--non-numeric'>
						<?php echo(_('Zustand')); ?>
					</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Nächste Kampagne')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Timeout / Tage')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Neuer Zustand')); ?>
						</th>
				</tr>
			</thead>
			<tbody class='cm-matrix_campaignFollow_campaign_state'>
			<?php
					// renderAction!
					self::createMatrixMatrix_campaignFollow_campaign_stateAction(null, $matrix_campaignFollow_campaign_state);
			?>
			</tbody>
		</table>
	</div>
	</div>
	<?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['matrix_campaignFollow_campaign_state']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && ((\FOP\User::getCampaign())) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignAttachment_campaign']);
										?><span id='campaignAttachment_campaign' class='mdl-cell mdl-cell--12-col mdl-grid'  ng-show='form[&apos;email_campaign&apos;]'>
	
				<?php
				foreach ($campaignAttachment_campaign AS $row) {
					self::createListCampaignAttachment_campaignAction($row, $data);
				}
				if ((\FOP\User::getCampaign())) { ?>
         <div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-create">
             
             <div class="mdl-cell mdl-cell--3-col mdl-cell--2-col-phone fop-form-label"><?php echo(_('Anhänge')); ?></div>
             <div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					  
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter(null)); ?>"
<?php if (null) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote(null))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="uploads" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter(null)); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/createListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=uploads%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							event.stopPropagation();
						});

						this.on('success', function(f, file_id) {
							let self = this;
							
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/createListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
							self.removeFile(f);
						});

						this.on('removedfile', function(f) {
							$('[data-fopid=' + f.file_id + ']').remove();
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	
             </div>
         </div>
			<?php } ?>
	
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['campaignAttachment_campaign']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || (!isset($_POST['cancel'])) || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Inhalt']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_campaign" id="column_email_campaign">
		<!-- Feld "Email": email_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_campaign"><?php echo(_('Email')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_campaign" id="email_campaign" value="<?php echo ($data['email_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;email_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="email_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_auto" id="column_email_auto" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailAuto": email_auto -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_auto"><?php echo(_('campaignMassMailEmailAuto')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_auto" id="email_auto" value="<?php echo ($data['email_auto']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="email_auto__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_auto']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_delay" id="column_email_delay" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailDelay": email_delay -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_delay"><?php echo(_('campaignMassMailEmailDelay')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="email_delay"  value="<?php echo \Types\Integer::print($data['email_delay']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_reply" id="column_email_reply" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailReply": email_reply -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_reply"><?php echo(_('campaignMassMailEmailReply')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="email" name="email_reply"  id="email_reply" value="<?php echo htmlentities($data['email_reply']); ?>"/><label class="mdl-textfield__label" for="email_reply"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_campaign" id="column_post_campaign">
		<!-- Feld "campaignPost": post_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_campaign"><?php echo(_('campaignPost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="post_campaign" id="post_campaign" value="<?php echo ($data['post_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;post_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="post_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['post_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_phone_campaign" id="column_phone_campaign">
		<!-- Feld "campaignPhone": phone_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="phone_campaign"><?php echo(_('campaignPhone')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="phone_campaign" id="phone_campaign" value="<?php echo ($data['phone_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="phone_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['phone_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pdf_type" id="column_pdf_type" ng-show='form[&apos;post_campaign&apos;]'>
		<!-- Feld "PDF-Layout": pdf_type -->
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pdf_type"><?php echo(_('PDF-Layout')); ?>: </label>
	</div>
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' ng-model='form[&apos;pdf_type&apos;]' ng-revalidate class="selectdropdown mdlext-selectfield__select" name='pdf_type' id='pdf_type'><option value='1'<?php if ($data['pdf_type'] == 1) {echo " selected";}?>><?php echo(_('Briefkopf mit Standardvorlage')); ?></option><option value='2'<?php if ($data['pdf_type'] == 2) {echo " selected";}?>><?php echo(_('Briefkopf auf benutzerdefiniertem Hintergrund')); ?></option><option value='3'<?php if ($data['pdf_type'] == 3) {echo " selected";}?>><?php echo(_('Briefkopf mit Launix-Brief und benutzerdefinierten Zusatzseiten')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_subject" id="column_email_subject" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignSubject": email_subject -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_subject"><?php echo(_('campaignSubject')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;email_subject&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  type="text" name="email_subject"  value="<?php echo htmlentities($data['email_subject']); ?>"/><span class="mdl-textfield__error" style="{{(!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))'><?php echo(_('campaignSubjectRequired')); ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_text" id="column_email_text" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignText": email_text -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_text"><?php echo(_('campaignText')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-suggest="<?php echo htmlentities(json_encode(\Tables\Mitglied::suggestionsAction())); ?>" tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('text').' AS header, '.qi('text').' AS content FROM '.qi('briefVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="email_text" class="html-html_campaign"><?php echo htmlentities($data['email_text']); ?></textarea>
	</div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_template" id="column_post_template" ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'>
		<!-- Feld "campaignPostTemplate": post_template -->
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_template"><?php echo(_('campaignPostTemplate')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter($data['post_template'])); ?>"
<?php if ($data['post_template']) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['post_template']))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="post_template" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter($data['post_template'])); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					zone.find(".fileinput").val(file_id);
					zone.find(".fop-file-upload").hide();
					zone.append($("<div class=\"picker-remove\"></div>").text(title));
					zone.append($("<div class=\"picker-remove\" style=\"cursor: pointer;\"><i class=\"material-icons\">delete</i></div>").click(function () {
						// remove-Button -> val(0)
						zone.find(".fileinput").val(0);
						zone.find(".fop-file-upload").show();
						zone.find(".picker-remove").remove();
					}));
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=post_template%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				maxFiles: 1,
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							if (prevfile) self.removeFile(prevfile);
						});

						this.on('success', function(file, file_id) {
							prevfile = file;
							file.file_id = file_id;
							$(zone).find('.fileinput').val(file_id);
						});

						this.on('removedfile', function(file) {
							$(zone).find('.fileinput').val('0');
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['Inhalt']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

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

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

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

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function editAction($id = null ) { 
    
    
    // --- BLOCK: 0_CSRFValidate ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') \FOP\Session::validateCSRFToken(); else \FOP\Session::getCSRFToken();

    // --- BLOCK: 0_CSRF_ensure ---
    
	\FOP\Session::getCSRFToken();
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		$data = self::view($id);
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\CampaignState::validate($_POST['email_interact1_state']);
		if ((!isset($_POST['cancel']))) \Types\CampaignState::validate($_POST['email_interact2_state']);
		if ((!isset($_POST['cancel']))) \FOP\Files::validate($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \Types\Campaign::validate($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $i => $val)
			if ($_POST['campaignAttachment_campaign'][$i] != '0') \FOP\Files::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignNullFollow::validate($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $i => $val)
			if (isset($_POST['matrix_campaignFollow_campaign_state__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_campaignFollow_campaign_state'][$i])])) \Types\CampaignState::validate($val);
		/* Sanitizer */

		if ((!isset($_POST['cancel']))) $_POST['email_interact1_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact1_state']);
		$_POST['email_interact1_url'] = \FOP\Sanitizers::no_text($_POST['email_interact1_url']);
		if ((!isset($_POST['cancel']))) $_POST['email_interact2_state'] = \FOP\Sanitizers::null_filter($_POST['email_interact2_state']);
		$_POST['email_interact2_url'] = \FOP\Sanitizers::no_text($_POST['email_interact2_url']);
		$_POST['email_delay'] = \Types\Integer::parse($_POST['email_delay']);
		$_POST['email_reply'] = \FOP\Sanitizers::no_text($_POST['email_reply']);
		$_POST['email_text'] = \FOP\Sanitizers::htmlentities_decode($_POST['email_text']);
		$_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		$_POST['color'] = \FOP\Sanitizers::color_filter($_POST['color']);
		if (((false)) && ($data['creation::canEdit'] == 1)) $_POST['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['creation']);
		if (((false)) && ($data['lastUpdate::canEdit'] == 1)) $_POST['lastUpdate'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['lastUpdate']);
		if ((!isset($_POST['cancel']))) $_POST['post_template'] = \FOP\Files::sanitizeUpload($_POST['post_template']);

		if (((false))) if (isset($_POST['campaignAttachment_campaign_campaign'])) foreach ($_POST['campaignAttachment_campaign_campaign'] AS $idx => $val) $_POST['campaignAttachment_campaign_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['campaignAttachment_campaign_file'])) foreach ($_POST['campaignAttachment_campaign_file'] AS $idx => $val) $_POST['campaignAttachment_campaign_file'][$idx] = \FOP\Files::sanitizeUpload($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_campaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_campaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_campaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state_state'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_state'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextCampaign'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextCampaign'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_timeout'])) foreach ($_POST['matrix_campaignFollow_campaign_state_timeout'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_timeout'][$idx] = \Types\Integer::parse($val);
		if (isset($_POST['matrix_campaignFollow_campaign_state_nextState'])) foreach ($_POST['matrix_campaignFollow_campaign_state_nextState'] AS $idx => $val) $_POST['matrix_campaignFollow_campaign_state_nextState'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access+~email_subject:4fc2424210cf8b37cebdaacbb1da5f64ece2709ce30b53f90fa3a0b77888b746 ---
    
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			if (!isset($_POST['cancel']) && !(($_POST['email_subject']) || (! (($_POST['email_campaign']) || (($_POST['post_campaign']) && (in_array($_POST['pdf_type'], ['1', '3']))))))) throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access-item-campaign-edit ---
    
		if ($id !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// Main block
	
    // --- BLOCK: main-1 ---
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		if (!isset($_POST['cancel'])) {
			\FOP\Database::beginTransaction();
    // --- BLOCK: main-2:save-clone-prepare ---
    
		$data = self::view($id);
	
    // --- BLOCK: main-2:save-main ---
    
		$data_edit = [];
		$data_edit['email_interact1_title'] = $_POST['email_interact1_title'];
		$data_edit['email_interact1_url'] = $_POST['email_interact1_url'];
		$data_edit['email_interact2_title'] = $_POST['email_interact2_title'];
		$data_edit['email_interact2_url'] = $_POST['email_interact2_url'];
		$data_edit['email_campaign'] = $_POST['email_campaign'];
		$data_edit['email_auto'] = $_POST['email_auto'];
		$data_edit['email_delay'] = $_POST['email_delay'];
		$data_edit['email_reply'] = $_POST['email_reply'];
		$data_edit['email_text'] = $_POST['email_text'];
		$data_edit['email_subject'] = $_POST['email_subject'];
		$data_edit['phone_campaign'] = $_POST['phone_campaign'];
		$data_edit['post_campaign'] = $_POST['post_campaign'];
		$data_edit['name'] = $_POST['name'];
		$data_edit['date'] = $_POST['date'];
		$data_edit['desc'] = $_POST['desc'];
		$data_edit['pinned'] = $_POST['pinned'];
		$data_edit['color'] = $_POST['color'];
		$data_edit['mode'] = $_POST['mode'];
		$data_edit['pdf_type'] = $_POST['pdf_type'];
		if ((!isset($_POST['cancel']))) $data_edit['email_interact1_state'] = $_POST['email_interact1_state'];
		if ((!isset($_POST['cancel']))) $data_edit['email_interact2_state'] = $_POST['email_interact2_state'];
		if (((false)) && ($data['creation::canEdit'] == 1)) $data_edit['creation'] = $_POST['creation'];
		if (((false)) && ($data['lastUpdate::canEdit'] == 1)) $data_edit['lastUpdate'] = $_POST['lastUpdate'];
		if ((!isset($_POST['cancel']))) $data_edit['post_template'] = $_POST['post_template'];
		self::edit($id, $data_edit);
		if (isset($data_edit['ID'])) {
			$id = $data_edit['ID'];
		}
	
    // --- BLOCK: main-2:save-main-list-campaignAttachment_campaign ---
    
		// List Save
		if (isset($_POST['campaignAttachment_campaign_ID'])) foreach ($_POST['campaignAttachment_campaign_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['campaignAttachment_campaign'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\CampaignAttachment::getDefaults();
				\Tables\CampaignAttachment::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['campaign'] = $id;
				$subdata['file'] = $_POST['campaignAttachment_campaign_file'][$i];
				$subdata['ID'] = $_POST['campaignAttachment_campaign_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['campaignAttachment_campaign'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\CampaignAttachment::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['campaignAttachment_campaign'][$i] != '0') {
				// noch keine ID: erstellen
				if (((\FOP\User::getCampaign()))) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\CampaignAttachment::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-2:save-main-matrix-matrix_campaignFollow_campaign_state ---
    if ((!\FOP\User::getIsGuest())) {
	if (isset($_POST['matrix_campaignFollow_campaign_state'])) foreach ($_POST['matrix_campaignFollow_campaign_state'] AS $i => $subid) {
		$parent = array_merge($data, $data_edit);
		$deps = [];
		
		if (\FOP\Database::query('SELECT aftercontact IS NULL FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($subid))->fetchColumn() != '1') continue;
		if (!isset($_POST['matrix_campaignFollow_campaign_state__' . preg_replace('/[^a-zA-Z_0-9]/', '', $subid)])) {
			// nicht angetickt: evtl. löschen
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::delete($_POST['matrix_campaignFollow_campaign_state_ID'][$i]);
			}
		} else {
			// angetickt: Erstellen oder bearbeiten
			$subdata = [];
			$subdata['campaign'] = $id;
			$subdata['state'] = $_POST['matrix_campaignFollow_campaign_state_state'][$i];
			$subdata['nextCampaign'] = $_POST['matrix_campaignFollow_campaign_state_nextCampaign'][$i];
			$subdata['timeout'] = $_POST['matrix_campaignFollow_campaign_state_timeout'][$i];
			$subdata['nextState'] = $_POST['matrix_campaignFollow_campaign_state_nextState'][$i];
			if ($_POST['matrix_campaignFollow_campaign_state_ID'][$i]) {
				\Tables\CampaignFollow::edit($_POST['matrix_campaignFollow_campaign_state_ID'][$i], $subdata);
			} else {
				\Tables\CampaignFollow::create($subdata);
			}
		}
	}
	}
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['cancel'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		if (isset($_POST['save'])) {
			
			if (isset($_POST['fop-from']) && $_POST['fop-from']) {
				// Redirect zu fop-from
				header('Location: ' . preg_replace('/&insert_param=(.*)$/', '&$1=' . ($id instanceof \FOP\IDList ? $id->toString() : $id), $_POST['fop-from']));
			} else {
				header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => $id, 'popup' => $_GET['popup'] ?? null]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = self::view($id); // TODO: klären, wer die Funktion bereitstellt (momentan crud/view.fop)
	
    // --- BLOCK: main-4:load-main-list-campaignAttachment_campaign ---
    
		$campaignAttachment_campaign = [];
		array_push($campaignAttachment_campaign, ...\Tables\Campaign::loadEditCampaignAttachment_campaignItems($id ?? null));
	
    // --- BLOCK: main-4:load-main-matrix-matrix_campaignFollow_campaign_state ---
    
		
		$matrix_campaignFollow_campaign_state = \FOP\Database::query('SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* _checked */ 1 AS '.qi('_checked').',
									/* campaign */ '.qi('campaign').' AS '.qi('campaign').',
									/* nextCampaign */ '.qi('nextCampaign').' AS '.qi('nextCampaign').',
									/* nextState */ '.qi('nextState').' AS '.qi('nextState').',
									/* state */ '.qi('state').' AS '.qi('state').',
									/* timeout */ '.qi('timeout').' AS '.qi('timeout').',
									1
								FROM '.qi('campaignFollow').' '.qi('campaignFollow').'
								WHERE ('.qi('campaign').' = ' . \FOP\Database::quote($data['ID']) . ')
									AND ((SELECT aftercontact IS NULL FROM '.qi('campaignState').' WHERE '.qi('campaignState').'.'.qi('ID').' = '.qi('campaignFollow').'.'.qi('state').'))')->fetchAll(\PDO::FETCH_ASSOC);
	
    // --- BLOCK: main-4:load-main_Not Modified ---
    
		header_remove('Pragma');
		header_remove('Cache-Control');
		header_remove('Expires');
		header('Cache-Control: private');
		header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $data['lastUpdate']) . ' GMT');
		header('ETag: "campaign:edit:' . $id . '"');
		if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $data['lastUpdate'] > 0 && $data['lastUpdate'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
			// cache ist noch aktuell
			header("HTTP/1.1 304 Not Modified");
			exit;
		}
	
    // --- BLOCK: main-5 ---
    ?><?php
			header('Content-Type: text/html; charset=UTF-8');
			header('X-XSS-Protection: 1; mode=block');
			header('Strict-Transport-Security: max-age=63072000');
			header('X-Content-Type-Options: nosniff');
			header("Content-Security-Policy: default-src *  data: blob: 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * data: blob: 'unsafe-inline'; font-src * data: blob: 'unsafe-inline';");


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

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

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


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

								<form
									
									action="<?php echo \TablesRouter\Campaign::editURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
									onsubmit="
										if (window.running_uploads) {
											event.preventDefault();
											alert('<?php echo htmlentities(json_encode(_('fileUploadStillActive')));?>');
										}
									"
								 
								id="cardform-wf_campaign_edit"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_campaign_edit" ng-init="form = <?php echo htmlentities(json_encode(['email_campaign' => $data['email_campaign'], 'email_subject' => $data['email_subject'], 'post_campaign' => $data['post_campaign'], 'pdf_type' => $data['pdf_type']]));
									?>;"
								>
								<?php
								 echo '<input type="hidden" name="csrftoken" value="' . htmlentities(\FOP\Session::getCSRFToken()) . '">';
								 if (isset($_GET['from'])) echo '<input type="hidden" name="fop-from" value="' . htmlentities($_GET['from']) . '">';
								 ?>
								<div id='fop-upbar'></div>
								
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'buttons',
										'title' => _('Aktionen'),
										'order' => '300', // 300 (50)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || false || false || false || false || false || false || false || true || true || true || true || true || ((false)) && ($data['creation::canEdit'] == 1) || ((false)) && ($data['lastUpdate::canEdit'] == 1) || true || false || false || false || false || false || false || false || false || false || false || false || false)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) && ($data['creation::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (((false)) && ($data['lastUpdate::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0'
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
									$feature = [
										'id' => 'Interaktion',
										'title' => _('Interaktion'),
										'order' => '200-Interaktion', // 200-Interaktion (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. '0' .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											 .'||'. (true ? '(([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1) || ([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1))' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'matrix_campaignFollow_campaign_state',
										'title' => _('Follow-Ups'),
										'order' => 'z-matrix_campaignFollow_campaign_state', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'campaignAttachment_campaign',
										'title' => _('Anhänge'),
										'order' => 'z-campaignAttachment_campaign', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? '(form[\'email_campaign\'])' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true || true || true || true || true || true || true || (!isset($_POST['cancel'])) || true || true)) {
									$feature = [
										'id' => 'Inhalt',
										'title' => _('Inhalt'),
										'order' => '200-Inhalt', // 200-Inhalt (10-50)
										'mode' => 'region', // region (50)
										'position' => 'full', // full (50)
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '([\'1\', \'true\'].indexOf((form[\'email_campaign\']).toString()) != -1)' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '((form[\'email_campaign\']) || ((form[\'post_campaign\']) && ([\'1\', \'true\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1)))' : '0')
											 .'||'. (true ? '(form[\'post_campaign\'])' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? '((form[\'post_campaign\']) && ([\'2\', \'3\'].indexOf((form[\'pdf_type\']).toString()) != -1))' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_campaign_edit_buttons' class='mdl-cell mdl-cell--12-col' style='flex-wrap: wrap;'><?php if (true) { ?><button onclick="
		var errors = $(this).closest('form').find('.fop-form-error:visible, .is-invalid').filter((i, x) => $(x).parents('.novalidate').length ? false : true);
		if (errors.length) {
			event.preventDefault();
			alert(errors.closest('.fop-form-content').prev('.fop-form-label').text() + ' Es sind noch Fehler im Formular bei Feld');
			return;
		} /* TODO: i18n */
		
	" type="submit" name="save" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('save')); ?></button><?php } ?>
									&nbsp;<?php if (true) { ?><button onclick="$(this).closest('form').find('.mdl-textfield__error:visible').hide();
		$('[required]').removeAttr('required');
	" type="submit" name="cancel" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">cancel</i><?php echo(_('cancel')); ?></button><?php } ?>
									</div><script type='text/javascript'>
		// copy all buttons to #fop-upbar
		$(function () {
    var btn = document.getElementById("fop-bar-mainbutton");
    var upbar = $('#fop-upbar');
    var upbar_buttons = document.getElementById("fop-bar-container");

    // Check if the elements already exist
    if (!btn || !upbar_buttons) {
        if (!btn) {
            btn = $('<div id="fop-bar-mainbutton" class="mdl-button fop-button-half fop-button-margin mdl-button--raised"><i class="material-icons">keyboard_arrow_right</i></div>')
                .click(function () {
                    if (btn.find('i').text() == 'keyboard_arrow_right') {
                        upbar_buttons.fadeOut(400);
                        btn.find('i').text('keyboard_arrow_left');
                    } else {
                        upbar_buttons.fadeIn(400);
                        btn.find('i').text('keyboard_arrow_right');
                    }
                });
            upbar.append(btn);
        }

        if (!upbar_buttons) {
            upbar_buttons = $('<div id="fop-bar-container" style="max-width: 290px"></div>'); //dependant on the mdl-buttons width, caps of upbar buttons at exactly 4 buttons
            upbar.append(upbar_buttons);
        }

        var buttons = $('#wf_campaign_edit_buttons').find('.mdl-button');
        buttons.each(function (i, v) {
            var button = $(v);
            var newbutton = $('<div></div>');
            newbutton.attr('class', button.attr('class'));
            newbutton.attr('title', button.attr('title'));
            newbutton.append(button.find('.material-icons').clone(false));
            newbutton.click(function () {
                button[0].click();
            });
            upbar_buttons.append(newbutton);
        });
    }
});

	</script><?php
										\EasyEditor\FormFeature::pop();
										$features['buttons']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || false || false || false || false || false || false || false || true || true || true || true || true || ((false)) && ($data['creation::canEdit'] == 1) || ((false)) && ($data['lastUpdate::canEdit'] == 1) || true || false || false || false || false || false || false || false || false || false || false || false || false)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_name" id="column_name">
		<!-- Feld "Bezeichnung": name -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="name"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  required='required'  type="text" name="name"  value="<?php echo htmlentities($data['name']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Start": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Start')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" required='required' value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_desc" id="column_desc">
		<!-- Feld "Beschreibung": desc -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="desc"><?php echo(_('Beschreibung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style="width: 100%;" class="mdl-textfield mdl-js-textfield"><textarea onkeydown='if (event.keyCode == 13 && event.ctrlKey) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="mdl-textfield__input" rows="8" cols="80" name="desc" id="desc" ><?php echo htmlentities($data['desc']); ?></textarea><label class="mdl-textfield__label" for="desc"><?php echo(_('text')); ?></label><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pinned" id="column_pinned">
		<!-- Feld "angepinnt": pinned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pinned"><?php echo(_('angepinnt')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="pinned" id="pinned" value="<?php echo ($data['pinned']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="pinned__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['pinned']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>&nbsp;
			<div id="infopinned" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="infopinned"><?php echo(_('angepinnte Kampagnen werden immer oben angezeigt und können u.a. dazu verwendet werden, um Kunden in Kategorien einzuordnen')); ?></div>
		
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_color" id="column_color">
		<!-- Feld "Farbe": color -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="color"><?php echo(_('Farbe')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><input id="color" type="color"  name="color" value="<?php echo ($data['color']) ? $data['color'] : 'none'; ?>"/></div>
	</div>
	</div><?php if (((false)) && ($data['creation::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creation" id="column_creation">
		<!-- Feld "Erstellung": creation -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creation"><?php echo(_('Erstellung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="creation" type="text" name="creation" value="<?php echo ($data['creation']) ? strftime(_('dateformat_php2'), intval($data['creation'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?><?php if (((false)) && ($data['lastUpdate::canEdit'] == 1)) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_lastUpdate" id="column_lastUpdate">
		<!-- Feld "Letzte Änderung": lastUpdate -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="lastUpdate"><?php echo(_('Letzte Änderung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="lastUpdate" type="text" name="lastUpdate" value="<?php echo ($data['lastUpdate']) ? strftime(_('dateformat_php2'), intval($data['lastUpdate'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_mode" id="column_mode">
		<!-- Feld "neue %s|Mitglieder": mode -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="mode"><?php echo(sprintf(_('neue %s'), _('Mitglieder'))); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' class="selectdropdown mdlext-selectfield__select" name='mode' id='mode'><option value='0'<?php if ($data['mode'] == 0) {echo " selected";}?>><?php echo(_('nicht in Kampagne hinzufügen')); ?></option><option value='1'<?php if ($data['mode'] == 1) {echo " selected";}?>><?php echo(_('anbieten, in Kampagne hinzuzufügen')); ?></option><option value='2'<?php if ($data['mode'] == 2) {echo " selected";}?>><?php echo(_('in Kampagne hinzufügen')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || false || false || false || false || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Interaktion']);
										?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_title_email_interact2_title" id="column_email_interact1_title_email_interact2_title">
		<!-- Feld "Interaktion 1: Beschriftung": email_interact1_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_title"><?php echo(_('Interaktion 1: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact1_title"  value="<?php echo htmlentities($data['email_interact1_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Beschriftung": email_interact2_title -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_title"><?php echo(_('Interaktion 2: Beschriftung')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="email_interact2_title"  value="<?php echo htmlentities($data['email_interact2_title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?><?php } ?><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_state_email_interact2_state" id="column_email_interact1_state_email_interact2_state">
		<!-- Feld "Interaktion 1: Zustand": email_interact1_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_state"><?php echo(_('Interaktion 1: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_edit_email_interact1_stateAction($data['email_interact1_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact1_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
		<!-- Feld "Interaktion 2: Zustand": email_interact2_state -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_state"><?php echo(_('Interaktion 2: Zustand')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditform_wf_campaign_edit_email_interact2_stateAction($data['email_interact2_state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=email_interact2_state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_interact1_url_email_interact2_url" id="column_email_interact1_url_email_interact2_url">
		<!-- Feld "Interaktion 1: Ziel-URL": email_interact1_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact1_url"><?php echo(_('Interaktion 1: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact1_url" id="email_interact1_url" value="<?php echo htmlentities($data['email_interact1_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
		<!-- Feld "Interaktion 2: Ziel-URL": email_interact2_url -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_interact2_url"><?php echo(_('Interaktion 2: Ziel-URL')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input"  type="text" name="email_interact2_url" id="email_interact2_url" value="<?php echo htmlentities($data['email_interact2_url']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['Interaktion']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['matrix_campaignFollow_campaign_state']);
										?><?php
	if ((!\FOP\User::getIsGuest())) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card" id='matrix_campaignFollow_campaign_state'  ng-init='form["ID"] = form["ID"] || <?php echo htmlentities(json_encode($id ?? null)); ?>'><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Automatische Follow-Ups')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: 90vh; align-items: start;">
		<table class='mdl-data-table mdl-js-data-table mdl-shadow--2dp table-dense table-editable'>
			<thead>
				<tr>
					
					<th class='mdl-data-table__cell--non-numeric'>
						<label ng-click='cmMatrix_campaignFollow_campaign_stateAllSelectToggle()' class='mdl-checkbox mdl-js-checkbox mdl-js'>
							<input id='cm-matrix_campaignFollow_campaign_state-allselect' type='checkbox' class='mdl-checkbox__input'>
						</label>
					</th>
					<th class='mdl-data-table__cell--non-numeric'>
						<?php echo(_('Zustand')); ?>
					</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Nächste Kampagne')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Timeout / Tage')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Neuer Zustand')); ?>
						</th>
				</tr>
			</thead>
			<tbody class='cm-matrix_campaignFollow_campaign_state'>
			<?php
					// renderAction!
					self::editMatrixMatrix_campaignFollow_campaign_stateAction($id, $matrix_campaignFollow_campaign_state);
			?>
			</tbody>
		</table>
	</div>
	</div>
	<?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['matrix_campaignFollow_campaign_state']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['campaignAttachment_campaign']);
										?><span id='campaignAttachment_campaign' class='mdl-cell mdl-cell--12-col mdl-grid'  ng-show='form[&apos;email_campaign&apos;]'>
	
				<?php
				foreach ($campaignAttachment_campaign AS $row) {
					self::editListCampaignAttachment_campaignAction($row, $data);
				}
				if ((\FOP\User::getCampaign())) { ?>
         <div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-create">
             
             <div class="mdl-cell mdl-cell--3-col mdl-cell--2-col-phone fop-form-label"><?php echo(_('Anhänge')); ?></div>
             <div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					  
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter(null)); ?>"
<?php if (null) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote(null))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="uploads" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter(null)); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/editListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=uploads%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							event.stopPropagation();
						});

						this.on('success', function(f, file_id) {
							let self = this;
							
		var tr = $(zone).closest(".wfl-create");
		$.get("Tables/Campaign/editListCampaignAttachment_campaign?column_file=" +encodeURIComponent(file_id) + "<?php echo (isset($parent) ? "&parent=". htmlentities($parent) : "");?><?php echo (isset($column_file) ? "&column_file=". htmlentities($column_file) : "");?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); });
							self.removeFile(f);
						});

						this.on('removedfile', function(f) {
							$('[data-fopid=' + f.file_id + ']').remove();
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	
             </div>
         </div>
			<?php } ?>
	
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['campaignAttachment_campaign']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true || true || true || true || true || true || true || (!isset($_POST['cancel'])) || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['Inhalt']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_campaign" id="column_email_campaign">
		<!-- Feld "Email": email_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_campaign"><?php echo(_('Email')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_campaign" id="email_campaign" value="<?php echo ($data['email_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;email_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="email_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_auto" id="column_email_auto" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailAuto": email_auto -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_auto"><?php echo(_('campaignMassMailEmailAuto')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="email_auto" id="email_auto" value="<?php echo ($data['email_auto']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="email_auto__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['email_auto']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_delay" id="column_email_delay" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailDelay": email_delay -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_delay"><?php echo(_('campaignMassMailEmailDelay')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="email_delay"  value="<?php echo \Types\Integer::print($data['email_delay']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_reply" id="column_email_reply" ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'>
		<!-- Feld "campaignMassMailEmailReply": email_reply -->
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_reply"><?php echo(_('campaignMassMailEmailReply')); ?>: </label>
	</div>
	<div ng-show='[&apos;1&apos;, &apos;true&apos;].indexOf((form[&apos;email_campaign&apos;]).toString()) != -1'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input class="mdl-textfield__input" type="email" name="email_reply"  id="email_reply" value="<?php echo htmlentities($data['email_reply']); ?>"/><label class="mdl-textfield__label" for="email_reply"><?php echo(_('email')); ?></label>  <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_campaign" id="column_post_campaign">
		<!-- Feld "campaignPost": post_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_campaign"><?php echo(_('campaignPost')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="post_campaign" id="post_campaign" value="<?php echo ($data['post_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  ng-model='form[&apos;post_campaign&apos;]' ng-revalidate class="mdl-checkbox__input" id="post_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['post_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_phone_campaign" id="column_phone_campaign">
		<!-- Feld "campaignPhone": phone_campaign -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="phone_campaign"><?php echo(_('campaignPhone')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<input type="hidden" name="phone_campaign" id="phone_campaign" value="<?php echo ($data['phone_campaign']) ? '1' : '0'; ?>"/><label class="mdl-checkbox mdl-js-checkbox" style="width: unset;"><input onkeydown="
      if (event.keyCode == 13) {
         event.preventDefault();
         event.stopPropagation();
         tabNext(this);
         return false;
      }
   "  class="mdl-checkbox__input" id="phone_campaign__checkbox" type="checkbox" onchange="this.parentElement.previousElementSibling.value = this.checked ? 1 : 0;"<?php if ($data['phone_campaign']) echo ' checked'; ?>><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></label>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_pdf_type" id="column_pdf_type" ng-show='form[&apos;post_campaign&apos;]'>
		<!-- Feld "PDF-Layout": pdf_type -->
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="pdf_type"><?php echo(_('PDF-Layout')); ?>: </label>
	</div>
	<div ng-show='form[&apos;post_campaign&apos;]'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div><div class="mdlext-selectfield mdlext-js-selectfield"><select onkeydown='if (event.keyCode == 13) { event.preventDefault(); event.stopPropagation(); tabNext(this); return false; }' ng-model='form[&apos;pdf_type&apos;]' ng-revalidate class="selectdropdown mdlext-selectfield__select" name='pdf_type' id='pdf_type'><option value='1'<?php if ($data['pdf_type'] == 1) {echo " selected";}?>><?php echo(_('Briefkopf mit Standardvorlage')); ?></option><option value='2'<?php if ($data['pdf_type'] == 2) {echo " selected";}?>><?php echo(_('Briefkopf auf benutzerdefiniertem Hintergrund')); ?></option><option value='3'<?php if ($data['pdf_type'] == 3) {echo " selected";}?>><?php echo(_('Briefkopf mit Launix-Brief und benutzerdefinierten Zusatzseiten')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_subject" id="column_email_subject" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignSubject": email_subject -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_subject"><?php echo(_('campaignSubject')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  ng-model='form[&apos;email_subject&apos;]' ng-trim='false' ng-revalidate class="mdl-textfield__input"  type="text" name="email_subject"  value="<?php echo htmlentities($data['email_subject']); ?>"/><span class="mdl-textfield__error" style="{{(!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;email_subject&apos;]) || (! ((form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)))))'><?php echo(_('campaignSubjectRequired')); ?></div></span></div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_email_text" id="column_email_text" ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'>
		<!-- Feld "campaignText": email_text -->
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="email_text"><?php echo(_('campaignText')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;email_campaign&apos;]) || ((form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;1&apos;, &apos;true&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1))'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-suggest="<?php echo htmlentities(json_encode(\Tables\Mitglied::suggestionsAction())); ?>" tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('text').' AS header, '.qi('text').' AS content FROM '.qi('briefVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="email_text" class="html-html_campaign"><?php echo htmlentities($data['email_text']); ?></textarea>
	</div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_post_template" id="column_post_template" ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'>
		<!-- Feld "campaignPostTemplate": post_template -->
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="post_template"><?php echo(_('campaignPostTemplate')); ?>: </label>
	</div>
	<div ng-show='(form[&apos;post_campaign&apos;]) &amp;&amp; ([&apos;2&apos;, &apos;3&apos;].indexOf((form[&apos;pdf_type&apos;]).toString()) != -1)'	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		

	
		<div>

<?php
       $maxupload =  \FOP\Util::convertIniBytes(ini_get('upload_max_filesize'));

?>
<div class="fop-file-upload dropzone dropzone-file" id="zone<?php echo htmlentities(\FOP\Files::getNextDummyCounter($data['post_template'])); ?>"
<?php if ($data['post_template']) {
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['post_template']))->fetch(\PDO::FETCH_ASSOC);
						$fileInfo['accepted'] = true;
						echo ' data-fileinfo="' . htmlentities(json_encode($fileInfo)) . '"';
}
					?>>
  <div class="dz-message"><?php echo(_('dropfiles')); ?></div>
  <input type="hidden" class="fileinput" name="post_template" value="<?php echo htmlentities(\FOP\Files::getLastDummyCounter($data['post_template'])); ?>">
</div>

	<?php if ((\FOP\User::getDokument())) { ?>
	<div class="fop-file-upload dms-picker" onclick='var zone = $(this).parent(), id = "x"+Math.round(1000000*Math.random());
		zone.attr("id", id);
		zone[0].dataset.callback = id;
		window[id] = function (docid, title) {
			$.get("Tables/Doc/getFile?id=" + encodeURIComponent(docid)).then(function (file_id) {
				// file_id, title
				
					zone.find(".fileinput").val(file_id);
					zone.find(".fop-file-upload").hide();
					zone.append($("<div class=\"picker-remove\"></div>").text(title));
					zone.append($("<div class=\"picker-remove\" style=\"cursor: pointer;\"><i class=\"material-icons\">delete</i></div>").click(function () {
						// remove-Button -> val(0)
						zone.find(".fileinput").val(0);
						zone.find(".fop-file-upload").show();
						zone.find(".picker-remove").remove();
					}));
				
			});
		};
		window.open_over(<?php
		echo json_encode(\TablesRouter\Doc::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=doc%26colinsert=post_template%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=doc", "_blank", "width=739, height=395"); return false;'>
		<i class="material-icons">search</i> <?php echo(_('Dokumente')); ?>
	</div><?php } ?>
	

<script>
	Dropzone.autoDiscover = false;
   $(function (){
	   $('.dropzone-file').each(function(){
			var dropzoneElement = this;
		   if ($(this).attr('data-dropzone-attached')) return;
		   $(this).attr('data-dropzone-attached', true);

		   let dummycounter = $(dropzoneElement).find('input').val();
		   let zone = this;

		   $(this).dropzone({
				maxFiles: 1,
				addRemoveLinks: true,
				paramName: 'file_' + dummycounter,
				url: 'FOP/Files/upload?x=' + dummycounter,
				maxFilesize: <?php echo \FOP\Util::convertIniBytes(ini_get('upload_max_filesize')); ?> / 1000 / 1000,
				timeout: 30*60*1000,

				dictDefaultMessage: '<?php echo(addslashes(_('dropfiles'))) ?>',
				dictFallbackMessage: '<?php echo(addslashes(_('dropfiles_notpossible'))) ?>',
				dictFileTooBig: '<?php echo(addslashes(_('dropfiles_toobig'))) ?>',
				dictInvalidFileType: '<?php echo(addslashes(_('dropfiles_invalidtype'))) ?>',
				dictResponseError: '<?php echo(addslashes(_('dropfiles_responseerror'))) ?>',
				dictCancelUpload: '<?php echo(addslashes(_('dropfiles_cancelupload'))) ?>',
				dictUploadCanceled: '<?php echo(addslashes(_('dropfiles_uploadcanceled'))) ?>',
				dictCancelUploadConfirmation: '<?php echo(addslashes(_('dropfiles_cancelupload_confirmation'))) ?>',
				dictRemoveFile: '<?php echo(addslashes(_('dropfiles_removefile'))) ?>',
				dictRemoveFileConfirmation: '<?php echo(addslashes(_('dropfiles_removefile_confirmation'))) ?>',

				init: function(){
					let prevfile = null;
					let self = this;

					// Datei anzeigen, die schon hochgeladen wurde
					if (dropzoneElement.dataset['fileinfo']) {
						let f = JSON.parse(dropzoneElement.dataset['fileinfo']);
						self.files.push(f);
						self.emit('addedfile', f);
						self.emit('complete', f);
						prevfile = f;
					}

					/* keep track of uploads */
					this.on('sending', function () {
						window.running_uploads = (window.running_uploads || 0) + 1;
					});
					this.on('complete', function () {
						window.running_uploads = (window.running_uploads || 0) - 1;
					});
					
					
						this.on('addedfile', function() {
							if (prevfile) self.removeFile(prevfile);
						});

						this.on('success', function(file, file_id) {
							prevfile = file;
							file.file_id = file_id;
							$(zone).find('.fileinput').val(file_id);
						});

						this.on('removedfile', function(file) {
							$(zone).find('.fileinput').val('0');
						});
					
				}
		   });
	   });
    });
				</script>
		</div>
		
	</div>
	</div><?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['Inhalt']['html'] = ob_get_contents();
										ob_end_clean();
									}
									

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

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

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

							</form>
							

							</div>
							<div class="content" id="focus-supersearch">
							</div>
							<div class="content" id="~spacer"><?php if (!isset($_GET['popup'])) { ?><div style="padding-bottom: 10cm;"></div><?php } ?>
							</div>
						<?php if (!isset($_GET['popup'])) { ?>
					</div>
				</main>
				
			</div>
		<?php } else { ?></div><?php } ?>
<?php if (!isset($_GET['popup'])) { ?><div class='fop-seal'></div><?php } ?></body></html><?php
    // --- BLOCK: main-6 ---
    }
    
  }

  public static function phone10Action($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-campaign-is_phone ---
    
		if (\FOP\Database::query('SELECT ('.qi('campaign').'.'.qi('phone_campaign').') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access-item-campaign-view ---
    
		if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		$ids = \FOP\Database::query('SELECT '.qi('campaignTarget').'.'.qi('ID').' AS '.qi('ID').' FROM '.qi('campaignTarget').', '.qi('campaignState').' WHERE '.qi('campaignState').'.'.qi('aftercontact').' IS NOT NULL AND '.qi('campaignState').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('state').' AND '.qi('campaignTarget').'.'.qi('campaign').' = ' . intval($id) . ' ORDER BY '.(\FOP\Database::getDriver() == 'mysql' ? 'RAND' : 'RANDOM').'() LIMIT 10')->fetchAll(\PDO::FETCH_COLUMN);

		if (count($ids) < 1) {
			header('Location: ' . \TablesRouter\Campaign::viewURL($id) . '#snack:' . _('Keine Neu-Kontakte mehr vorhanden'));
			die();
		}

		header('Location: ' . \TablesRouter\CampaignTarget::multistatusURL2(['id' => implode(",", $ids), 'from' => \TablesRouter\Campaign::viewURL($id)]));
	
    
  }

  public static function stopEmailAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-campaign-edit ---
    
		if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
	\FOP\Database::query('DELETE FROM '.qi('delayedmethods').' WHERE method = '.\FOP\Database::quote('\Tables\CampaignTarget::sendMail').' AND parameter IN (SELECT CONCAT(\'[\', '.qi('ID').', \']\') FROM '.qi('campaignTarget').' WHERE campaign = '.intval($id).')');
	header('Location: ' . ($_GET['from'] ?? \TablesRouter\Campaign::viewURL($id)));

    
  }

  public static function massMailAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-campaign-is_mail ---
    
		if (\FOP\Database::query('SELECT ('.qi('campaign').'.'.qi('email_campaign').') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access-item-campaign-view ---
    
		if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    

$ids = new \FOP\IDList;
$q = \FOP\Database::query('SELECT '.qi('campaignTarget').'.'.qi('ID').' AS '.qi('ID').' FROM '.qi('campaignTarget').', '.qi('campaignState').' WHERE '.qi('campaignState').'.'.qi('aftercontact').' IS NOT NULL AND '.qi('campaignState').'.'.qi('ID').' = '.qi('campaignTarget').'.'.qi('state').' AND '.qi('campaignTarget').'.'.qi('campaign').' = ' . intval($id));

while ($item = $q->fetch(\PDO::FETCH_COLUMN)) {
	$ids->push($item);
}

if ($ids->count() < 1) {
	header('Location: ' . \TablesRouter\Campaign::viewURL($id) . '#snack:' . _('campaignMassMailSnackIdle'));
	die();
}

\Tables\CampaignTarget::massMailSendAction($ids);


    
  }

  public static function mailPDFAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-campaign-is_post ---
    
		if (\FOP\Database::query('SELECT ('.qi('campaign').'.'.qi('post_campaign').') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: access-item-campaign-view ---
    
		if (\FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
// Targets laden, als kontaktiert markieren, Massen-Operation singlePDF für die Liste redirecten
$ids = \FOP\Database::query('SELECT '.qi('campaignTarget').'.'.qi('ID').') AS '.qi('ID').'
FROM '.qi('campaignTarget').', '.qi('campaignState').' WHERE '.qi('campaignTarget').'.'.qi('state').' = '.qi('campaignState').'.aftercontact IS NOT NULL AND '.qi('campaignTarget').'.campaign = ' . intval($id))->fetchAll(\PDO::FETCH_COLUMN);

if (count($ids) < 1) {
	header('Location: ' . \TablesRouter\Campaign::viewURL2(['id' => intval($id)]) . '#snack:' . _('campaignPostSnackIdle'));
	die();
}

$idlist = new \FOP\IDList;
foreach ($ids AS $id) {
	$idlist->push($id);
}

// State updaten
\FOP\Database::query('UPDATE '.qi('campaignTarget').' SET '.qi('state').' = COALESCE((SELECT '.qi('campaignState').'.aftercontact FROM '.qi('campaignState').' WHERE '.qi('ID').' = '.qi('campaignTarget').'.'.qi('state').'), '.qi('state').') WHERE ' . $idlist->toSQL(qi('ID')));

// Action aufrufen
header('Location: ' . \TablesRouter\CampaignTarget::pdfMultiPdfURL($idlist->toString()));

    
  }

  public static function loadCloneCampaignAttachment_campaignItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT \'\' AS '.qi('ID').', '.qi('campaignAttachment').'.'.qi('campaign').', '.qi('campaignAttachment').'.'.qi('file').',
			((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('oWM7dTZG').' WHERE '.qi('oWM7dTZG').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('canDelete').'
			FROM '.qi('campaignAttachment').' 
			WHERE ((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('EEtY9tML').' WHERE '.qi('EEtY9tML').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AND '.qi('campaignAttachment').'.'.qi('campaign').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

		foreach($items as &$item) {
		}
		return $items;
	
    
  }

  public static function loadCreateCampaignAttachment_campaignItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT \'\' AS '.qi('ID').', '.qi('campaignAttachment').'.'.qi('campaign').', '.qi('campaignAttachment').'.'.qi('file').',
			((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('oWM7dTZG').' WHERE '.qi('oWM7dTZG').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('canDelete').'
			FROM '.qi('campaignAttachment').' 
			WHERE ((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('EEtY9tML').' WHERE '.qi('EEtY9tML').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AND '.qi('campaignAttachment').'.'.qi('campaign').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

		foreach($items as &$item) {
		}
		return $items;
	
    
  }

  public static function loadEditCampaignAttachment_campaignItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT '.qi('campaignAttachment').'.'.qi('ID').' AS '.qi('ID').', '.qi('campaignAttachment').'.'.qi('campaign').', '.qi('campaignAttachment').'.'.qi('file').',
			((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('oWM7dTZG').' WHERE '.qi('oWM7dTZG').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('canDelete').'
			FROM '.qi('campaignAttachment').' 
			WHERE ((COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' '.qi('EEtY9tML').' WHERE '.qi('EEtY9tML').'.'.qi('ID').' = '.qi('campaignAttachment').'.'.qi('campaign').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AND '.qi('campaignAttachment').'.'.qi('campaign').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

		foreach($items as &$item) {
		}
		return $items;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchconstr_formarray_wf_mitglied_create_matrix_campaignTarget_target_campaign_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchconstr_formarray_wf_mitglied_edit_matrix_campaignTarget_target_campaign_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchconstr_formarray_wf_campaign_clone_campaignAttachment_campaign_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchconstr_formarray_wf_campaign_create_campaignAttachment_campaign_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchconstr_formarray_wf_campaign_edit_campaignAttachment_campaign_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchformarray_wf_mitglied_create_matrix_campaignTarget_target_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchformarray_wf_mitglied_edit_matrix_campaignTarget_target_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchformAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchconstr_form_wf_campaignTarget_multiadd_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchconstr_form_wf_campaignTarget_create_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetch6c87eaeb3f27fd76105907c05088f0d75b563f0afda50359d692790806c0b7ed_fetchconstr_form_wf_campaignTarget_edit_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchformarray_wf_campaign_clone_campaignAttachment_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchformarray_wf_campaign_create_campaignAttachment_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchformarray_wf_campaign_edit_campaignAttachment_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchformAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchconstr_form_wf_campaignAttachment_create_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchB3bfb3b26e060a46c3be6517e62f85559c85e610384acfa0bf88acfa9b851dd3_fetchconstr_form_wf_campaignAttachment_edit_campaignAction($id) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getCampaign()).') FROM '.qi('campaign').' WHERE (TRUE) AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function delete($id, $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
			$sql = 'SELECT ' . ($disregardPermissions ? 1 : '('.\FOP\Database::quote(\FOP\User::getCampaign()).')') . ' FROM '.qi('campaign').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			if (\FOP\Database::query($sql)->fetchColumn() != 1) {
				return false;
			}
			
			$sql = 'DELETE FROM  '.qi('campaign').'  WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			$result = \FOP\Database::query($sql);
			
			return true;
	
    
  }

  public static function cloneListCampaignAttachment_campaignAction($row = null , $parent = null , $column_file = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\CampaignAttachment::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\CampaignAttachment::sanitizeDefaults($row, true, 'campaign', $parentrow);
		} else {
			
			$row['file'] = intval($row['file']);			
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: before-prepare-row-file ---
    
		if ($column_file) $row['file'] = $column_file;
	
    // --- BLOCK: main ---
    
		?>
		<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-item" ng-controller='FormGroupWf_campaign_cloneCampaignAttachment_campaign' ng-init='item = <?php
				echo htmlentities(json_encode(['campaign' => null, 'H4ulQMbq' => null]));
			?>;
			form[&apos;campaignAttachment_campaign&apos;] = (form[&apos;campaignAttachment_campaign&apos;] || []); form[&apos;campaignAttachment_campaign&apos;].push(item);'>
				<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
					<h4><?php echo(_('Anhang')); ?></h4>
				</div>
			
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone">
			<div class="mdl-grid grid-card" style="width: 100%;">
			<input type='hidden' name='campaignAttachment_campaign[]' value='1'>
			<input type='hidden' name='campaignAttachment_campaign_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
		<!-- Spalte file
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Anhang')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					

	
		<div class="namedisplay"><a href="<?php echo \FOPRouter\Files::downloadURL($row['file']); ?>" target="_blank"><?php
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['file']))->fetch(\PDO::FETCH_ASSOC);
						if ($fileInfo) echo htmlentities($fileInfo['name'] . ' (' . \FOP\Util::intbytestoreadable($fileInfo['size']) . ')');
		?></a></div>
		<input type="hidden" class="fileinput" name="campaignAttachment_campaign_file[]" value="<?php echo htmlentities(\FOP\Files::getNextDummyCounter($row['file'])); ?>">
	
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?>
			<?php if ($row['canDelete']) { ?><!-- Delete Button -->
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
				<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var item = $(this).closest("div.mdl-cell.wfl-item"); item.fadeOut(); item.find("input[name=&apos;campaignAttachment_campaign[]&apos;]").val("0"); item.find("[required]").removeAttr("required");var s = $(this).scope(); var a = s.$eval(&apos;form[\&apos;campaignAttachment_campaign\&apos;]&apos;); var i = a.indexOf(s.item); if (i != -1) {a.splice(i, 1); s.$apply();}'>
				<i class="material-icons">remove</i>
				<?php echo(_('delete')); ?>
				</div>
			</div>
			<?php } ?>
		</div></div></div><?php
	
    
  }

  public static function createListCampaignAttachment_campaignAction($row = null , $parent = null , $column_file = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\CampaignAttachment::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\CampaignAttachment::sanitizeDefaults($row, true, 'campaign', $parentrow);
		} else {
			
			$row['file'] = intval($row['file']);			
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: before-prepare-row-file ---
    
		if ($column_file) $row['file'] = $column_file;
	
    // --- BLOCK: main ---
    
		?>
		<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-item" ng-controller='FormGroupWf_campaign_createCampaignAttachment_campaign' ng-init='item = <?php
				echo htmlentities(json_encode(['campaign' => null, 'H4ulQMbq' => null]));
			?>;
			form[&apos;campaignAttachment_campaign&apos;] = (form[&apos;campaignAttachment_campaign&apos;] || []); form[&apos;campaignAttachment_campaign&apos;].push(item);'>
				<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
					<h4><?php echo(_('Anhang')); ?></h4>
				</div>
			
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone">
			<div class="mdl-grid grid-card" style="width: 100%;">
			<input type='hidden' name='campaignAttachment_campaign[]' value='1'>
			<input type='hidden' name='campaignAttachment_campaign_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
		<!-- Spalte file
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Anhang')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					

	
		<div class="namedisplay"><a href="<?php echo \FOPRouter\Files::downloadURL($row['file']); ?>" target="_blank"><?php
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['file']))->fetch(\PDO::FETCH_ASSOC);
						if ($fileInfo) echo htmlentities($fileInfo['name'] . ' (' . \FOP\Util::intbytestoreadable($fileInfo['size']) . ')');
		?></a></div>
		<input type="hidden" class="fileinput" name="campaignAttachment_campaign_file[]" value="<?php echo htmlentities(\FOP\Files::getNextDummyCounter($row['file'])); ?>">
	
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?>
			<?php if ($row['canDelete']) { ?><!-- Delete Button -->
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
				<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var item = $(this).closest("div.mdl-cell.wfl-item"); item.fadeOut(); item.find("input[name=&apos;campaignAttachment_campaign[]&apos;]").val("0"); item.find("[required]").removeAttr("required");var s = $(this).scope(); var a = s.$eval(&apos;form[\&apos;campaignAttachment_campaign\&apos;]&apos;); var i = a.indexOf(s.item); if (i != -1) {a.splice(i, 1); s.$apply();}'>
				<i class="material-icons">remove</i>
				<?php echo(_('delete')); ?>
				</div>
			</div>
			<?php } ?>
		</div></div></div><?php
	
    
  }

  public static function editListCampaignAttachment_campaignAction($row = null , $parent = null , $column_file = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\CampaignAttachment::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\CampaignAttachment::sanitizeDefaults($row, true, 'campaign', $parentrow);
		} else {
			
			$row['file'] = intval($row['file']);			
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: before-prepare-row-file ---
    
		if ($column_file) $row['file'] = $column_file;
	
    // --- BLOCK: main ---
    
		?>
		<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-item" ng-controller='FormGroupWf_campaign_editCampaignAttachment_campaign' ng-init='item = <?php
				echo htmlentities(json_encode(['campaign' => null, 'H4ulQMbq' => null]));
			?>;
			form[&apos;campaignAttachment_campaign&apos;] = (form[&apos;campaignAttachment_campaign&apos;] || []); form[&apos;campaignAttachment_campaign&apos;].push(item);'>
				<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
					<h4><?php echo(_('Anhang')); ?></h4>
				</div>
			
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone">
			<div class="mdl-grid grid-card" style="width: 100%;">
			<input type='hidden' name='campaignAttachment_campaign[]' value='1'>
			<input type='hidden' name='campaignAttachment_campaign_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
		<!-- Spalte file
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Anhang')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					

	
		<div class="namedisplay"><a href="<?php echo \FOPRouter\Files::downloadURL($row['file']); ?>" target="_blank"><?php
						$fileInfo = \FOP\Database::query('SELECT filename AS name, size FROM fop_files WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['file']))->fetch(\PDO::FETCH_ASSOC);
						if ($fileInfo) echo htmlentities($fileInfo['name'] . ' (' . \FOP\Util::intbytestoreadable($fileInfo['size']) . ')');
		?></a></div>
		<input type="hidden" class="fileinput" name="campaignAttachment_campaign_file[]" value="<?php echo htmlentities(\FOP\Files::getNextDummyCounter($row['file'])); ?>">
	
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?>
			<?php if ($row['canDelete']) { ?><!-- Delete Button -->
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
				<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var item = $(this).closest("div.mdl-cell.wfl-item"); item.fadeOut(); item.find("input[name=&apos;campaignAttachment_campaign[]&apos;]").val("0"); item.find("[required]").removeAttr("required");var s = $(this).scope(); var a = s.$eval(&apos;form[\&apos;campaignAttachment_campaign\&apos;]&apos;); var i = a.indexOf(s.item); if (i != -1) {a.splice(i, 1); s.$apply();}'>
				<i class="material-icons">remove</i>
				<?php echo(_('delete')); ?>
				</div>
			</div>
			<?php } ?>
		</div></div></div><?php
	
    
  }

  public static function cloneMatrixMatrix_campaignFollow_campaign_stateAction($id, $values) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
		if (isset($_POST['values'])) {
			$values = $_POST['values'];
		}
		if (is_string($values)) {
			$values = json_decode($values, true);
			array_walk($values, function (&$item) {
				$item['nextCampaign'] = \FOP\Sanitizers::null_filter($item['nextCampaign']);
				$item['timeout'] = \Types\Integer::parse($item['timeout']);
				$item['nextState'] = \FOP\Sanitizers::null_filter($item['nextState']);
			});
		}
		// Aufbau: 1. options suchen
		if (isset($id) && $id != 'null') $parent = \Tables\Campaign::view($id, false, true);
		$deps = [];
		$options = \FOP\Database::query('SELECT /* state */ '.qi('options').'.'.qi('ID').' 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').',
									1
								FROM '.qi('campaignState').' '.qi('options').'
								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('options').'.'.qi('ID').'
								WHERE ((aftercontact IS NULL))')->fetchAll(\PDO::FETCH_ASSOC);
		// 2. values resanitizen und umschaufeln in ein asso-Array, aus dem man herausstreichen kann
		$ticks = [];
		foreach ($values AS $value) {
			$value['ID'] = ''; // Klon-Formular: CM-Einträge neu anlegen
			$value['nextCampaign'] = \FOP\Sanitizers::null_converter($value['nextCampaign']);
			$value['timeout'] = \Types\Integer::unpack($value['timeout']);
			$value['nextState'] = \FOP\Sanitizers::null_converter($value['nextState']);
			$ticks[$value['state']] = $value;
		}
		// 3. options rendern (dabei ggf. Werte verarbeiten, wenn values dabei ist)
		$i = 0;
		foreach ($options AS $option) {
			

			if (isset($ticks[$option['state']])) {
				// getickt -> merge option + customvalues
				$value = $option + $ticks[$option['state']];
				unset($ticks[$option['state']]);
			} else {
				// ungetickt
				$value = \Tables\CampaignFollow::getDefaults();
				if (isset($parent)) $value['campaign'] = $parent['ID'];
				$value = array_merge($value, $option); // add option dimensions with descriptions
				$value['ID'] = '';
				\Tables\CampaignFollow::sanitizeDefaults($value, true);
			}
			?><tr ng-controller='FormGroupWf_campaign_cloneMatrix_campaignFollow_campaign_state'
				ng-init="item=<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				matrixRegisterMatrix_campaignFollow_campaign_state(<?php echo htmlentities(json_encode($option['state'])); ?>, item)">
				<td class='mdl-data-table__cell--non-numeric' >
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					
					<label class='mdl-checkbox mdl-js-checkbox'>
						<input type='checkbox' name="matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $option['state'])); ?>" class='mdl-checkbox__input matrix_checkbox' ng-model='item.checked'<?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					</label>
				</td>
				<td class='mdl-data-table__cell--non-numeric'>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' class='fop-dimension' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
					<?php
	
	call_user_func(function () use ($value) {
	$id = $value['state'];
	$val = $value['state::description'];
	$canView = $value['state::canView'];
	if ($val !== null) {
		echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>

				</td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && (((item[&apos;nextCampaign&apos;]) === null || (item[&apos;nextCampaign&apos;]) === &apos;0&apos; ? (0) : (item[&apos;nextCampaign&apos;])) == (0))"><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td>
			</tr><?php

			$i++;
		}
		// 4. nicht verwendete values hidden rausrendern
		foreach ($ticks AS $value) {
			$value['_checked'] = true;
			?><tr ng-controller='FormGroupWf_campaign_cloneMatrix_campaignFollow_campaign_state' style='display: none;' ng-init="item =<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				"><td>
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='checkbox' name='matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $value['state'])); ?>' class='matrix_checkbox' <?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
				</td>
				
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
					<td class='mdl-data-table__cell--non-numeric'><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></td>
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
			</tr><?php
		}
	
    
  }

  public static function createMatrixMatrix_campaignFollow_campaign_stateAction($id, $values) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
		if (isset($_POST['values'])) {
			$values = $_POST['values'];
		}
		if (is_string($values)) {
			$values = json_decode($values, true);
			array_walk($values, function (&$item) {
				$item['nextCampaign'] = \FOP\Sanitizers::null_filter($item['nextCampaign']);
				$item['timeout'] = \Types\Integer::parse($item['timeout']);
				$item['nextState'] = \FOP\Sanitizers::null_filter($item['nextState']);
			});
		}
		// Aufbau: 1. options suchen
		if (isset($id) && $id != 'null') $parent = \Tables\Campaign::view($id, false, true);
		$deps = [];
		$options = \FOP\Database::query('SELECT /* state */ '.qi('options').'.'.qi('ID').' 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').',
									1
								FROM '.qi('campaignState').' '.qi('options').'
								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('options').'.'.qi('ID').'
								WHERE ((aftercontact IS NULL))')->fetchAll(\PDO::FETCH_ASSOC);
		// 2. values resanitizen und umschaufeln in ein asso-Array, aus dem man herausstreichen kann
		$ticks = [];
		foreach ($values AS $value) {
			$value['ID'] = ''; // Klon-Formular: CM-Einträge neu anlegen
			$value['nextCampaign'] = \FOP\Sanitizers::null_converter($value['nextCampaign']);
			$value['timeout'] = \Types\Integer::unpack($value['timeout']);
			$value['nextState'] = \FOP\Sanitizers::null_converter($value['nextState']);
			$ticks[$value['state']] = $value;
		}
		// 3. options rendern (dabei ggf. Werte verarbeiten, wenn values dabei ist)
		$i = 0;
		foreach ($options AS $option) {
			

			if (isset($ticks[$option['state']])) {
				// getickt -> merge option + customvalues
				$value = $option + $ticks[$option['state']];
				unset($ticks[$option['state']]);
			} else {
				// ungetickt
				$value = \Tables\CampaignFollow::getDefaults();
				if (isset($parent)) $value['campaign'] = $parent['ID'];
				$value = array_merge($value, $option); // add option dimensions with descriptions
				$value['ID'] = '';
				\Tables\CampaignFollow::sanitizeDefaults($value, true);
			}
			?><tr ng-controller='FormGroupWf_campaign_createMatrix_campaignFollow_campaign_state'
				ng-init="item=<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				matrixRegisterMatrix_campaignFollow_campaign_state(<?php echo htmlentities(json_encode($option['state'])); ?>, item)">
				<td class='mdl-data-table__cell--non-numeric' >
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					
					<label class='mdl-checkbox mdl-js-checkbox'>
						<input type='checkbox' name="matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $option['state'])); ?>" class='mdl-checkbox__input matrix_checkbox' ng-model='item.checked'<?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					</label>
				</td>
				<td class='mdl-data-table__cell--non-numeric'>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' class='fop-dimension' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
					<?php
	
	call_user_func(function () use ($value) {
	$id = $value['state'];
	$val = $value['state::description'];
	$canView = $value['state::canView'];
	if ($val !== null) {
		echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>

				</td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && (((item[&apos;nextCampaign&apos;]) === null || (item[&apos;nextCampaign&apos;]) === &apos;0&apos; ? (0) : (item[&apos;nextCampaign&apos;])) == (0))"><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td>
			</tr><?php

			$i++;
		}
		// 4. nicht verwendete values hidden rausrendern
		foreach ($ticks AS $value) {
			$value['_checked'] = true;
			?><tr ng-controller='FormGroupWf_campaign_createMatrix_campaignFollow_campaign_state' style='display: none;' ng-init="item =<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				"><td>
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='checkbox' name='matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $value['state'])); ?>' class='matrix_checkbox' <?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
				</td>
				
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
					<td class='mdl-data-table__cell--non-numeric'><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></td>
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
			</tr><?php
		}
	
    
  }

  public static function editMatrixMatrix_campaignFollow_campaign_stateAction($id, $values) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
		if (isset($_POST['values'])) {
			$values = $_POST['values'];
		}
		if (is_string($values)) {
			$values = json_decode($values, true);
			array_walk($values, function (&$item) {
				$item['nextCampaign'] = \FOP\Sanitizers::null_filter($item['nextCampaign']);
				$item['timeout'] = \Types\Integer::parse($item['timeout']);
				$item['nextState'] = \FOP\Sanitizers::null_filter($item['nextState']);
			});
		}
		// Aufbau: 1. options suchen
		if (isset($id) && $id != 'null') $parent = \Tables\Campaign::view($id, false, true);
		$deps = [];
		$options = \FOP\Database::query('SELECT /* state */ '.qi('options').'.'.qi('ID').' 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').',
									1
								FROM '.qi('campaignState').' '.qi('options').'
								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('options').'.'.qi('ID').'
								WHERE ((aftercontact IS NULL))')->fetchAll(\PDO::FETCH_ASSOC);
		// 2. values resanitizen und umschaufeln in ein asso-Array, aus dem man herausstreichen kann
		$ticks = [];
		foreach ($values AS $value) {
			
			$value['nextCampaign'] = \FOP\Sanitizers::null_converter($value['nextCampaign']);
			$value['timeout'] = \Types\Integer::unpack($value['timeout']);
			$value['nextState'] = \FOP\Sanitizers::null_converter($value['nextState']);
			$ticks[$value['state']] = $value;
		}
		// 3. options rendern (dabei ggf. Werte verarbeiten, wenn values dabei ist)
		$i = 0;
		foreach ($options AS $option) {
			

			if (isset($ticks[$option['state']])) {
				// getickt -> merge option + customvalues
				$value = $option + $ticks[$option['state']];
				unset($ticks[$option['state']]);
			} else {
				// ungetickt
				$value = \Tables\CampaignFollow::getDefaults();
				if (isset($parent)) $value['campaign'] = $parent['ID'];
				$value = array_merge($value, $option); // add option dimensions with descriptions
				$value['ID'] = '';
				\Tables\CampaignFollow::sanitizeDefaults($value, true);
			}
			?><tr ng-controller='FormGroupWf_campaign_editMatrix_campaignFollow_campaign_state'
				ng-init="item=<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				matrixRegisterMatrix_campaignFollow_campaign_state(<?php echo htmlentities(json_encode($option['state'])); ?>, item)">
				<td class='mdl-data-table__cell--non-numeric' >
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					
					<label class='mdl-checkbox mdl-js-checkbox'>
						<input type='checkbox' name="matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $option['state'])); ?>" class='mdl-checkbox__input matrix_checkbox' ng-model='item.checked'<?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					</label>
				</td>
				<td class='mdl-data-table__cell--non-numeric'>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' class='fop-dimension' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
					<?php
	
	call_user_func(function () use ($value) {
	$id = $value['state'];
	$val = $value['state::description'];
	$canView = $value['state::canView'];
	if ($val !== null) {
		echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>

				</td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && (((item[&apos;nextCampaign&apos;]) === null || (item[&apos;nextCampaign&apos;]) === &apos;0&apos; ? (0) : (item[&apos;nextCampaign&apos;])) == (0))"><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></span></td>
			</tr><?php

			$i++;
		}
		// 4. nicht verwendete values hidden rausrendern
		foreach ($ticks AS $value) {
			$value['_checked'] = true;
			?><tr ng-controller='FormGroupWf_campaign_editMatrix_campaignFollow_campaign_state' style='display: none;' ng-init="item =<?php echo htmlentities(json_encode(['checked' => $value['_checked'] ? true : false,
					'state' => $value['state'],
					'nextCampaign' => $value['nextCampaign']])); ?>;
				"><td>
					<input type='hidden' name='matrix_campaignFollow_campaign_state[]' value="<?php echo htmlentities(($value['state'] ?? '')); ?>">
					<input type='hidden' name='matrix_campaignFollow_campaign_state_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='checkbox' name='matrix_campaignFollow_campaign_state__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $value['state'])); ?>' class='matrix_checkbox' <?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					<input type='hidden' name='matrix_campaignFollow_campaign_state_state[]' value="<?php echo htmlentities($value['state'] ?? ''); ?>">
				</td>
				
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Campaign::renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextCampaignAction($value['nextCampaign'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Campaign::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\Campaign::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('item[\'nextCampaign\']'); ?>%26type=campaignNullFollow%26colinsert=matrix_campaignFollow_campaign_state_nextCampaign[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignNullFollow", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
					<td class='mdl-data-table__cell--non-numeric'><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="matrix_campaignFollow_campaign_state_timeout[]"  value="<?php echo \Types\Integer::print($value['timeout']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script></td>
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\CampaignState::renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextStateAction($value['nextState'], [], '');
?> &nbsp;	<?php if (\TablesRouter\CampaignState::createAccess()) { ?>  <a tabindex='-1' class='unimportant button' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue", "_blank", "width=739, height=395"); return false;'><i class="material-icons">add</i></a> <?php } ?> &nbsp;	<a tabindex='-1' class='unimportant button fop-ddt-search' href="#" onclick='var p = $(this).parent(), id = "x"+Math.round(1000000*Math.random()); p.attr("id", id); window.open_over(<?php
		echo json_encode(\TablesRouter\CampaignState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=campaignState%26colinsert=matrix_campaignFollow_campaign_state_nextState[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=campaignState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
			</tr><?php
		}
	
    
  }

  public static function create($data, $disregardPermissions = false , $updateOnDuplicate = false ) { 
    
    
    // --- BLOCK: main ---
    
				$sql = 'INSERT INTO '.qi('campaign').'(';
				
				$set = [];
				
					
					$set[qi('email_interact1_title')] = \FOP\Database::quote($data['email_interact1_title']);
					
				
					
					$set[qi('email_interact1_state')] = \FOP\Database::quote($data['email_interact1_state']);
					
				
					
					$set[qi('email_interact1_url')] = \FOP\Database::quote($data['email_interact1_url']);
					
				
					
					$set[qi('email_interact2_title')] = \FOP\Database::quote($data['email_interact2_title']);
					
				
					
					$set[qi('email_interact2_state')] = \FOP\Database::quote($data['email_interact2_state']);
					
				
					
					$set[qi('email_interact2_url')] = \FOP\Database::quote($data['email_interact2_url']);
					
				
					
					$set[qi('email_campaign')] = \FOP\Database::quote($data['email_campaign']);
					
				
					
					$set[qi('email_auto')] = \FOP\Database::quote($data['email_auto']);
					
				
					
					$set[qi('email_delay')] = \FOP\Database::quote($data['email_delay']);
					
				
					
					$set[qi('email_reply')] = \FOP\Database::quote($data['email_reply']);
					
				
					
					$set[qi('email_text')] = \FOP\Database::quote($data['email_text']);
					
				
					
					$set[qi('email_subject')] = \FOP\Database::quote($data['email_subject']);
					
				
					
					$set[qi('pdf_type')] = \FOP\Database::quote($data['pdf_type']);
					
				
					
					$set[qi('post_template')] = \FOP\Database::quote($data['post_template']);
					
				
					
					$set[qi('phone_campaign')] = \FOP\Database::quote($data['phone_campaign']);
					
				
					
					$set[qi('post_campaign')] = \FOP\Database::quote($data['post_campaign']);
					
				
					
					$set[qi('name')] = \FOP\Database::quote($data['name']);
					
				
					
					$set[qi('date')] = \FOP\Database::quote($data['date']);
					
				
					
					$set[qi('desc')] = \FOP\Database::quote($data['desc']);
					
				
					
					$set[qi('pinned')] = \FOP\Database::quote($data['pinned']);
					
				
					
					$set[qi('color')] = \FOP\Database::quote($data['color']);
					
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('creation')] = \FOP\Database::quote($data['creation']);
					} else {
						$set[qi('creation')] = \FOP\Database::quote(\FOP\Sanitizers::convert_date_to_unix_timestamp(time()));
					}
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('lastUpdate')] = \FOP\Database::quote($data['lastUpdate']);
					} else {
						$set[qi('lastUpdate')] = \FOP\Database::quote(\FOP\Sanitizers::convert_date_to_unix_timestamp(time()));
					}
				
					
					$set[qi('mode')] = \FOP\Database::quote($data['mode']);
					
				
					$set[qi('lastVisit')] = ''.time().'';
				$id = 0;

				$sql = $sql . implode(', ', array_keys($set)) . ') VALUES (' . implode(', ', array_values($set)) . ')';
				if ($updateOnDuplicate){
					// TODO: Postgres ON CONFLICT(...) DO UPDATE SET ...
					$set2 = [];
					foreach ($set AS $k => $v) {
						array_push($set2, "$k = $v");
					}
					if (\FOP\Database::getDriver() == 'mysql') {
						$sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $set2);
					} else {
						
					}
				}

				try {
					\FOP\Database::query($sql);
					$id = \FOP\Database::getLastInsertId();
				} catch (\PDOException $e) {
					if ($e->errorInfo[1] == 1062) {
						throw new \FOP\AccessDeniedException('duplicateinsert');
					}
                    throw $e; // weiterwerfen
				}
				$data['fop-id'] = $id; // für Hooks
				
				return $id;

    
  }

  public static function view($id, $snippet = false , $ignoreAccess = false ) { 
    
    
    // --- BLOCK: main ---
    
		$sql = 'SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* ID */ '.qi('campaign').'.'.qi('ID').' AS '.qi('ID').',
									/* color */ '.qi('campaign').'.'.qi('color').' AS '.qi('color').',
									/* count */ (SELECT COUNT(1) FROM '.qi('campaignTarget').' '.qi('WPNPXqW1').' WHERE '.qi('WPNPXqW1').'.'.qi('campaign').' = '.qi('campaign').'.'.qi('ID').' LIMIT 1) AS '.qi('count').',
									/* creation */ '.qi('campaign').'.'.qi('creation').' AS '.qi('creation').',
									/* creation::canEdit */ (FALSE) AS '.qi('creation::canEdit').',
									/* date */ '.qi('campaign').'.'.qi('date').' AS '.qi('date').',
									/* desc */ '.qi('campaign').'.'.qi('desc').' AS '.qi('desc').',
									/* email_auto */ '.qi('campaign').'.'.qi('email_auto').' AS '.qi('email_auto').',
									/* email_auto::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_auto::canView').',
									/* email_campaign */ '.qi('campaign').'.'.qi('email_campaign').' AS '.qi('email_campaign').',
									/* email_delay */ '.qi('campaign').'.'.qi('email_delay').' AS '.qi('email_delay').',
									/* email_delay::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_delay::canView').',
									/* email_interact1_state */ '.qi('campaign').'.'.qi('email_interact1_state').' AS '.qi('email_interact1_state').',
									/* email_interact1_state::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_state::canView').',
									/* email_interact1_state::canView */ '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:canView').' AS '.qi('email_interact1_state::canView').',
									/* email_interact1_state::description */ '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:description').' AS '.qi('email_interact1_state::description').',
									/* email_interact1_title */ '.qi('campaign').'.'.qi('email_interact1_title').' AS '.qi('email_interact1_title').',
									/* email_interact1_title::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_title::canView').',
									/* email_interact1_url */ '.qi('campaign').'.'.qi('email_interact1_url').' AS '.qi('email_interact1_url').',
									/* email_interact1_url::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact1_url::canView').',
									/* email_interact2_state */ '.qi('campaign').'.'.qi('email_interact2_state').' AS '.qi('email_interact2_state').',
									/* email_interact2_state::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_state::canView').',
									/* email_interact2_state::canView */ '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:canView').' AS '.qi('email_interact2_state::canView').',
									/* email_interact2_state::description */ '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:description').' AS '.qi('email_interact2_state::description').',
									/* email_interact2_title */ '.qi('campaign').'.'.qi('email_interact2_title').' AS '.qi('email_interact2_title').',
									/* email_interact2_title::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_title::canView').',
									/* email_interact2_url */ '.qi('campaign').'.'.qi('email_interact2_url').' AS '.qi('email_interact2_url').',
									/* email_interact2_url::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_interact2_url::canView').',
									/* email_reply */ '.qi('campaign').'.'.qi('email_reply').' AS '.qi('email_reply').',
									/* email_reply::canView */ '.qi('campaign').'.'.qi('email_campaign').' IN (\'1\') AS '.qi('email_reply::canView').',
									/* email_subject */ '.qi('campaign').'.'.qi('email_subject').' AS '.qi('email_subject').',
									/* email_subject::canView */ ('.qi('campaign').'.'.qi('email_campaign').') OR (('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'1\', \'3\'))) AS '.qi('email_subject::canView').',
									/* email_text */ '.qi('campaign').'.'.qi('email_text').' AS '.qi('email_text').',
									/* email_text::canView */ ('.qi('campaign').'.'.qi('email_campaign').') OR (('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'1\', \'3\'))) AS '.qi('email_text::canView').',
									/* lastUpdate */ '.qi('campaign').'.'.qi('lastUpdate').' AS '.qi('lastUpdate').',
									/* lastUpdate::canEdit */ (FALSE) AS '.qi('lastUpdate::canEdit').',
									/* lastVisit */ '.qi('campaign').'.'.qi('lastVisit').' AS '.qi('lastVisit').',
									/* mode */ '.qi('campaign').'.'.qi('mode').' AS '.qi('mode').',
									/* name */ '.qi('campaign').'.'.qi('name').' AS '.qi('name').',
									/* operation::7453e2de1ab4be4218c6ba7a6050dd059c049453d371fd5428d22e0bfbee424e */ '.\FOP\Database::quote(\FOP\User::getCampaign()).' AS '.qi('operation::7453e2de1ab4be4218c6ba7a6050dd059c049453d371fd5428d22e0bfbee424e').',
									/* operation::PZzRYmSJ */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::PZzRYmSJ').',
									/* operation::create */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::create').',
									/* operation::delete */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::delete').',
									/* operation::dvia:campaignAttachment:campaign */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::dvia:campaignAttachment:campaign').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::edit').',
									/* operation::fb3de81e616f834de1ac7d3a6c0dc5111693c79419c74a47950abd8a039025f5 */ '.\FOP\Database::quote(\FOP\User::getCampaign()).' AS '.qi('operation::fb3de81e616f834de1ac7d3a6c0dc5111693c79419c74a47950abd8a039025f5').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::is_mail */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::is_mail').',
									/* operation::is_phone */ ('.qi('campaign').'.'.qi('phone_campaign').') AS '.qi('operation::is_phone').',
									/* operation::is_post */ ('.qi('campaign').'.'.qi('post_campaign').') AS '.qi('operation::is_post').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getCampaign()).') AS '.qi('operation::view').',
									/* operation::wcgCtRIO */ ('.qi('campaign').'.'.qi('email_campaign').') AS '.qi('operation::wcgCtRIO').',
									/* pdf_type */ '.qi('campaign').'.'.qi('pdf_type').' AS '.qi('pdf_type').',
									/* pdf_type::canView */ '.qi('campaign').'.'.qi('post_campaign').' AS '.qi('pdf_type::canView').',
									/* phone_campaign */ '.qi('campaign').'.'.qi('phone_campaign').' AS '.qi('phone_campaign').',
									/* pinned */ '.qi('campaign').'.'.qi('pinned').' AS '.qi('pinned').',
									/* post_campaign */ '.qi('campaign').'.'.qi('post_campaign').' AS '.qi('post_campaign').',
									/* post_template */ '.qi('campaign').'.'.qi('post_template').' AS '.qi('post_template').',
									/* post_template::canView */ ('.qi('campaign').'.'.qi('post_campaign').') AND ('.qi('campaign').'.'.qi('pdf_type').' IN (\'2\', \'3\')) AS '.qi('post_template::canView').',
									1
								FROM '.qi('campaign').' '.qi('campaign').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('email_interact1_state:ID').', '.qi('campaignState').'.'.qi('desc').' AS '.qi('email_interact1_state:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('email_interact1_state:canView').' FROM '.qi('campaignState').') '.qi('ref:email_interact1_state').' ON '.qi('ref:email_interact1_state').'.'.qi('email_interact1_state:ID').' = '.qi('campaign').'.'.qi('email_interact1_state').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('email_interact2_state:ID').', '.qi('campaignState').'.'.qi('desc').' AS '.qi('email_interact2_state:description').', (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AS '.qi('email_interact2_state:canView').' FROM '.qi('campaignState').') '.qi('ref:email_interact2_state').' ON '.qi('ref:email_interact2_state').'.'.qi('email_interact2_state:ID').' = '.qi('campaign').'.'.qi('email_interact2_state').'
								WHERE ('.qi('ID').' = ' . \FOP\Database::quote($id) . ')';
		$result = \FOP\Database::query($sql);
		if (!$row = $result->fetch(\PDO::FETCH_ASSOC)) {
			throw new \FOP\AccessDeniedException('notfoundread');
		} else if (!$ignoreAccess && !$row['operation::view']) {
			throw new \FOP\AccessDeniedException('accessdeniedread');
		}
		
		$row['email_interact1_state'] = \FOP\Sanitizers::null_converter($row['email_interact1_state']);
		$row['email_interact1_url'] = \FOP\Sanitizers::a_text($row['email_interact1_url']);
		$row['email_interact2_state'] = \FOP\Sanitizers::null_converter($row['email_interact2_state']);
		$row['email_interact2_url'] = \FOP\Sanitizers::a_text($row['email_interact2_url']);
		$row['email_campaign'] = \FOP\Util::BoolSanitizer($row['email_campaign']);
		$row['email_auto'] = \FOP\Util::BoolSanitizer($row['email_auto']);
		$row['email_delay'] = \Types\Integer::unpack($row['email_delay']);
		$row['email_reply'] = \FOP\Sanitizers::a_text($row['email_reply']);
		$row['pdf_type'] = \FOP\Util::IntStringNull($row['pdf_type']);
		$row['post_template'] = intval($row['post_template']);
		$row['phone_campaign'] = \FOP\Util::BoolSanitizer($row['phone_campaign']);
		$row['post_campaign'] = \FOP\Util::BoolSanitizer($row['post_campaign']);
		$row['date'] = intval($row['date']);
		$row['count'] = \Types\Integer::unpack($row['count']);
		$row['pinned'] = \FOP\Util::BoolSanitizer($row['pinned']);
		$row['creation'] = intval($row['creation']);
		$row['lastUpdate'] = intval($row['lastUpdate']);
		$row['mode'] = \FOP\Util::IntStringNull($row['mode']);
		

		if($snippet){
			$row['email_interact1_title'] = ($row['email_interact1_title']);
			$row['email_interact1_state'] = (
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['email_interact1_state']))->fetchColumn() ?: _('')
);
			$row['email_interact1_url'] = ($row['email_interact1_url']);
			$row['email_interact2_title'] = ($row['email_interact2_title']);
			$row['email_interact2_state'] = (
  \FOP\Database::query('SELECT '.qi('campaignState').'.'.qi('desc').' AS description FROM '.qi('campaignState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['email_interact2_state']))->fetchColumn() ?: _('')
);
			$row['email_interact2_url'] = ($row['email_interact2_url']);
			$row['email_campaign'] = ($row['email_campaign']);
			$row['email_auto'] = ($row['email_auto']);
			$row['email_delay'] = (\Types\Integer::print($row['email_delay'])
	);
			$row['email_reply'] = ($row['email_reply']);
			$row['email_text'] = (mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($row['email_text'])))), 0, 20) . (strlen($row['email_text']) >= 20 ? '...' : ''));
			$row['email_subject'] = ($row['email_subject']);
			$row['pdf_type'] = (\Types\CampaignPDFType::toString($row['pdf_type']));
			$row['post_template'] = (\FOP\Database::query('SELECT filename FROM fop_files WHERE '.qi('ID').' = ' . intval($row['post_template']))->fetchColumn());
			$row['phone_campaign'] = ($row['phone_campaign']);
			$row['post_campaign'] = ($row['post_campaign']);
			$row['name'] = ($row['name']);
			$row['date'] = (($row['date']) ? strftime(_('dateformat_php2'), intval($row['date'])) : '');
			$row['desc'] = ($row['desc']);
			$row['count'] = (\Types\Integer::print($row['count'])
	);
			$row['pinned'] = ($row['pinned']);
			$row['color'] = ($row['color']);
			$row['creation'] = (($row['creation']) ? strftime(_('dateformat_php2'), intval($row['creation'])) : '');
			$row['lastUpdate'] = (($row['lastUpdate']) ? strftime(_('dateformat_php2'), intval($row['lastUpdate'])) : '');
			$row['mode'] = (\Types\CampaignMode::toString($row['mode']));
			
		}


		return $row;

    
  }

  public static function searchOptionscampaignTarget_campaign_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionscampaignAttachment_campaign_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_mitglied_create_matrix_campaignTarget_target_campaign_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_mitglied_edit_matrix_campaignTarget_target_campaign_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_clone_campaignAttachment_campaign_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_create_campaignAttachment_campaign_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_edit_campaignAttachment_campaign_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignTarget_multiadd_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignTarget_create_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignTarget_edit_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignAttachment_create_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignAttachment_edit_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionscampaignFollow_campaign_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionscampaignFollow_nextCampaign_deletecascadeAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignFollow_create_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignFollow_create_nextCampaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignFollow_edit_campaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function searchOptionsform_wf_campaignFollow_edit_nextCampaignAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value, $str); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	return $items;
	
    
  }

  public static function sanitizeDefaults(&$data, $sanitizeForForms, $refcol = null , $parentdata = null ) { 
    
    
    // --- BLOCK: main ---
    
		$virginData = self::getDefaults();
		// column: color
		
		// column: creation
		
		// column: date
		
		// column: desc
		
		// column: email_auto
		
		// column: email_campaign
		
		// column: email_delay
		
		// column: email_interact1_state
			if (!$data['email_interact1_state']) {
				// replace forbidden NULL values
				$items = \Types\CampaignState::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['email_interact1_state'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: email_interact1_title
		
		// column: email_interact1_url
		
		// column: email_interact2_state
			if (!$data['email_interact2_state']) {
				// replace forbidden NULL values
				$items = \Types\CampaignState::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['email_interact2_state'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: email_interact2_title
		
		// column: email_interact2_url
		
		// column: email_reply
		
		// column: email_subject
		
		// column: email_text
		
		// column: lastUpdate
		
		// column: mode
		
		// column: name
		
		// column: pdf_type
		
		// column: phone_campaign
		
		// column: pinned
		
		// column: post_campaign
		
		// column: post_template
		
		if ($sanitizeForForms) {
			
			$data['email_interact1_state'] = \FOP\Sanitizers::null_converter($data['email_interact1_state']);
			$data['email_interact1_url'] = \FOP\Sanitizers::a_text($data['email_interact1_url']);
			$data['email_interact2_state'] = \FOP\Sanitizers::null_converter($data['email_interact2_state']);
			$data['email_interact2_url'] = \FOP\Sanitizers::a_text($data['email_interact2_url']);
			$data['email_campaign'] = \FOP\Util::BoolSanitizer($data['email_campaign']);
			$data['email_auto'] = \FOP\Util::BoolSanitizer($data['email_auto']);
			$data['email_delay'] = \Types\Integer::unpack($data['email_delay']);
			$data['email_reply'] = \FOP\Sanitizers::a_text($data['email_reply']);
			$data['pdf_type'] = \FOP\Util::IntStringNull($data['pdf_type']);
			$data['post_template'] = intval($data['post_template']);
			$data['phone_campaign'] = \FOP\Util::BoolSanitizer($data['phone_campaign']);
			$data['post_campaign'] = \FOP\Util::BoolSanitizer($data['post_campaign']);
			$data['date'] = intval($data['date']);
			$data['pinned'] = \FOP\Util::BoolSanitizer($data['pinned']);
			$data['creation'] = intval($data['creation']);
			$data['lastUpdate'] = intval($data['lastUpdate']);
			$data['mode'] = \FOP\Util::IntStringNull($data['mode']);
		}
	
    
  }

  public static function edit($id, $data, $ignoreUniqueConstraints = false , $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
				
				$set = [];
				
					
					if (array_key_exists('email_interact1_title', $data)) {
						array_push($set, qi('email_interact1_title').' = ' . \FOP\Database::quote($data['email_interact1_title']));
					}
				
					
					if (array_key_exists('email_interact1_state', $data)) {
						array_push($set, qi('email_interact1_state').' = ' . \FOP\Database::quote($data['email_interact1_state']));
					}
				
					
					if (array_key_exists('email_interact1_url', $data)) {
						array_push($set, qi('email_interact1_url').' = ' . \FOP\Database::quote($data['email_interact1_url']));
					}
				
					
					if (array_key_exists('email_interact2_title', $data)) {
						array_push($set, qi('email_interact2_title').' = ' . \FOP\Database::quote($data['email_interact2_title']));
					}
				
					
					if (array_key_exists('email_interact2_state', $data)) {
						array_push($set, qi('email_interact2_state').' = ' . \FOP\Database::quote($data['email_interact2_state']));
					}
				
					
					if (array_key_exists('email_interact2_url', $data)) {
						array_push($set, qi('email_interact2_url').' = ' . \FOP\Database::quote($data['email_interact2_url']));
					}
				
					
					if (array_key_exists('email_campaign', $data)) {
						array_push($set, qi('email_campaign').' = ' . \FOP\Database::quote($data['email_campaign']));
					}
				
					
					if (array_key_exists('email_auto', $data)) {
						array_push($set, qi('email_auto').' = ' . \FOP\Database::quote($data['email_auto']));
					}
				
					
					if (array_key_exists('email_delay', $data)) {
						array_push($set, qi('email_delay').' = ' . \FOP\Database::quote($data['email_delay']));
					}
				
					
					if (array_key_exists('email_reply', $data)) {
						array_push($set, qi('email_reply').' = ' . \FOP\Database::quote($data['email_reply']));
					}
				
					
					if (array_key_exists('email_text', $data)) {
						array_push($set, qi('email_text').' = ' . \FOP\Database::quote($data['email_text']));
					}
				
					
					if (array_key_exists('email_subject', $data)) {
						array_push($set, qi('email_subject').' = ' . \FOP\Database::quote($data['email_subject']));
					}
				
					
					if (array_key_exists('pdf_type', $data)) {
						array_push($set, qi('pdf_type').' = ' . \FOP\Database::quote($data['pdf_type']));
					}
				
					
					if (array_key_exists('post_template', $data)) {
						array_push($set, qi('post_template').' = ' . \FOP\Database::quote($data['post_template']));
					}
				
					
					if (array_key_exists('phone_campaign', $data)) {
						array_push($set, qi('phone_campaign').' = ' . \FOP\Database::quote($data['phone_campaign']));
					}
				
					
					if (array_key_exists('post_campaign', $data)) {
						array_push($set, qi('post_campaign').' = ' . \FOP\Database::quote($data['post_campaign']));
					}
				
					
					if (array_key_exists('name', $data)) {
						array_push($set, qi('name').' = ' . \FOP\Database::quote($data['name']));
					}
				
					
					if (array_key_exists('date', $data)) {
						array_push($set, qi('date').' = ' . \FOP\Database::quote($data['date']));
					}
				
					
					if (array_key_exists('desc', $data)) {
						array_push($set, qi('desc').' = ' . \FOP\Database::quote($data['desc']));
					}
				
					
					if (array_key_exists('pinned', $data)) {
						array_push($set, qi('pinned').' = ' . \FOP\Database::quote($data['pinned']));
					}
				
					
					if (array_key_exists('color', $data)) {
						array_push($set, qi('color').' = ' . \FOP\Database::quote($data['color']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('creation', $data)) {
						array_push($set, qi('creation').' = ' . \FOP\Database::quote($data['creation']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('lastUpdate', $data)) {
						array_push($set, qi('lastUpdate').' = ' . \FOP\Database::quote($data['lastUpdate']));
					}
				
					
					if (array_key_exists('mode', $data)) {
						array_push($set, qi('mode').' = ' . \FOP\Database::quote($data['mode']));
					}
				;
				
				if (count($set)) {
					try {
						\FOP\Database::query('UPDATE '.qi('campaign').' SET ' . implode(', ', $set) . ' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id));
						if (isset($data['ID'])) {
							$id = $data['ID'];
						}
					} catch (\PDOException $e) {
						if ($e->errorInfo[1] == 1062) {
							if ($ignoreUniqueConstraints) {
								return false;
							}
							throw new \FOP\AccessDeniedException('duplicateupdate');
						}
						throw $e; // weiterwerfen
					}
				}
				$data['fop-id'] = $id; // für Hooks
				
				return true;

    
  }

  public static function renderEditcampaignTarget_campaign_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_campaignTarget_campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionscampaignTarget_campaign_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditcampaignAttachment_campaign_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_campaignAttachment_campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionscampaignAttachment_campaign_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_mitglied_create_matrix_campaignTarget_target_campaign_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignTarget_target_campaign_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_mitglied_create_matrix_campaignTarget_target_campaign_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_mitglied_edit_matrix_campaignTarget_target_campaign_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignTarget_target_campaign_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_mitglied_edit_matrix_campaignTarget_target_campaign_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((item[&apos;CkHlp5PE&apos;]) === null || (item[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (item[&apos;CkHlp5PE&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_clone_campaignAttachment_campaign_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaignAttachment_campaign_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_clone_campaignAttachment_campaign_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_create_campaignAttachment_campaign_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaignAttachment_campaign_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_create_campaignAttachment_campaign_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_edit_campaignAttachment_campaign_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaignAttachment_campaign_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_edit_campaignAttachment_campaign_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((globals[&apos;user:campaign&apos;]) === null || (globals[&apos;user:campaign&apos;]) === &apos;0&apos; ? (false) : (globals[&apos;user:campaign&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignTarget_multiadd_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignTarget_multiadd_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignTarget_create_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignTarget_create_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignTarget_edit_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignTarget_edit_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;CkHlp5PE&apos;]) === null || (form[&apos;CkHlp5PE&apos;]) === &apos;0&apos; ? (false) : (form[&apos;CkHlp5PE&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignAttachment_create_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignAttachment_create_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignAttachment_edit_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Campaign::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;campaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;campaign&apos;]' fop-type='Campaign' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignAttachment_edit_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	<?php
		if (count($items) == 0) {
			?><span class="mdl-textfield__error fop-form-error" style="visibility: visible;"><?php echo(_('no_dropdown_values')) ?></span><?php
		}
	?>
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error" style="{{(!((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))) ? 'visibility: visible; position: relative;' : ''}}"><div ng-show="((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))"><?php echo(_('invalidinput')) ?></div><div ng-show='!((form[&apos;H4ulQMbq&apos;]) === null || (form[&apos;H4ulQMbq&apos;]) === &apos;0&apos; ? (false) : (form[&apos;H4ulQMbq&apos;]))'><?php echo(_('accessdenied')); ?></div></span>
</div>

<?php

    
  }

  public static function renderEditcampaignFollow_campaign_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_campaignFollow_campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionscampaignFollow_campaign_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditcampaignFollow_nextCampaign_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="value_campaignFollow_nextCampaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionscampaignFollow_nextCampaign_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;nextCampaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_nextCampaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;nextCampaign&apos;]' fop-type='CampaignNullFollow' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_clone_matrix_campaignFollow_campaign_state_nextCampaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;nextCampaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_nextCampaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;nextCampaign&apos;]' fop-type='CampaignNullFollow' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_create_matrix_campaignFollow_campaign_state_nextCampaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_campaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextCampaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;nextCampaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="matrix_campaignFollow_campaign_state_nextCampaign[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;nextCampaign&apos;]' fop-type='CampaignNullFollow' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsformarray_wf_campaign_edit_matrix_campaignFollow_campaign_state_nextCampaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignFollow_create_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignFollow_create_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignFollow_create_nextCampaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;nextCampaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="nextCampaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;nextCampaign&apos;]' fop-type='CampaignNullFollow' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignFollow_create_nextCampaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignFollow_edit_campaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' class="selectdropdown mdlext-selectfield__select" name="campaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignFollow_edit_campaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function renderEditform_wf_campaignFollow_edit_nextCampaignAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\CampaignNullFollow::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='form[&apos;nextCampaign&apos;]' class="selectdropdown mdlext-selectfield__select" name="nextCampaign" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='form[&apos;nextCampaign&apos;]' fop-type='CampaignNullFollow' class="mdl-textfield__input" value="<?php echo htmlentities($text); ?>" style="position: absolute; top: 20px; left: 4px; width: calc(100% - 32px);" type="text" data-lastsearch="" onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			// ENTER: erstbestes passendes Element zuweisen
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				if (this.parentNode.firstElementChild.options[x].text.includes(this.value)) { // Text (z.B. EAN) kommt darin vor:
					this.parentNode.firstElementChild.selectedIndex = x;
					this.value = this.parentNode.firstElementChild.options[x].text;
					var model = this.parentNode.firstElementChild.getAttribute('xng-model');
					if (model) {
						$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
						$(this).scope().$apply();
					}
					$(this.parentElement).find('.fop-remove-after-change').remove();
					tabNext(this);
					return false;
				}
			}
			return false;
		}
		if (!this.list) {
			var list = document.createElement('datalist');
			for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
				var option = document.createElement('option');
				option.value = this.parentNode.firstElementChild.options[x].text;
				list.appendChild(option);
			}
			this.parentNode.appendChild(list);
			list.id = 'datalist' + String(Math.random()).substr(2);
			this.setAttribute('list', list.id);
			this.setAttribute('onkeydown', this.getAttribute('onchange'));
			this.list = list;
		}
	" oninput="
		for (var x = 0; x < this.parentNode.firstElementChild.options.length; x++) {
			if (this.value == this.parentNode.firstElementChild.options[x].text) {
				var model = this.parentNode.firstElementChild.getAttribute('xng-model');
				if (model) {
					$(this).scope().$eval(model + '=' + JSON.stringify(this.parentNode.firstElementChild.options[x].value));
					$(this).scope().$apply();
				}
				this.parentNode.firstElementChild.selectedIndex = x;
				$(this.parentElement).find('.fop-remove-after-change').remove();
			}
		}
		<?php if ($isLong) { ?>
			// Ajax+SQL mit LIKE-Query LIMIT
			var self = this;
			function updateSuggestions() {
				var value = self.value; // save in variable to keep stable during ajax
				if (value == self.getAttribute('data-lastsearch') || value == self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].text) {
					$(self).removeClass('busy');
					$(self).removeClass('busy-dirty');
					return;
				}
				$(self).addClass('busy');
				$.get('Tables/Campaign/searchOptionsform_wf_campaignFollow_edit_nextCampaign?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

						var option = document.createElement('option');
						option.value = result[i].description;
						self.list.appendChild(option);
					}
					/* reset busy flag */
					$(self).removeClass('busy');
					if ($(self).hasClass('busy-dirty')) {
						$(self).removeClass('busy-dirty');
						updateSuggestions(); //
					}
				});
			};
			if ($(self).hasClass('busy')) {
				// busy: busy->dirty
				$(self).addClass('busy-dirty');
				$(self).removeClass('busy');
				// mark as busy-dirty; updateSuggestions will trigger itself again
			} else if ($(self).hasClass('busy-dirty')) {
				// already dirty - we can save one reload cycle
			} else {
				// no request pending yet
				updateSuggestions();
			}
		<?php } ?>
	" onclick="this.focus(); if (this.value == <?php echo (_('pSelect'));?>) this.select();">
	
	<?php if (isset($isForbidden) && $isForbidden) {
			?><span class="mdl-textfield__error fop-form-error fop-remove-after-change" style="visibility: visible;"><?php echo(_('invalid')) ?></span><?php
	} ?>
	 <span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span>
</div>

<?php

    
  }

  public static function deleteAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getCampaign())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-itemlist-campaign-delete ---
    
		// ID-Liste neu aufbauen und nur die übrig lassen, die auch erlaubt sind
		$id_ = new \FOP\IDList($id);
		$id = new \FOP\IDList();
		foreach (\FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('campaign').' WHERE (('.\FOP\Database::quote(\FOP\User::getCampaign()).')) AND ' . $id_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $id_sub) {
			$id->push($id_sub);
		}
	
    // --- BLOCK: main ---
    
		\FOP\Database::beginTransaction();
		$ids = new \FOP\IDList($id);
		foreach ($ids->all() AS $id) {
			try {
				$success = self::delete($id);
			} catch (\PDOException $e) {
				if (\FOP\Database::getDriver() == 'mysql' && $e->errorInfo[1] == 1451 /* mysql error code */ || \FOP\Database::getDriver() == 'pgsql' && $e->getCode() == 23503/* psql error code */) {
					// fail due to foreign key constraints (the GUI before should already handle this)
					\FOP\Database::rollbackTransaction();
					if (isset($_GET['ajax'])) {
						header('HTTP/1.0 403 Forbidden');
						die(\TablesRouter\Campaign::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null])); // open delete confirm window when something went wrong
					}
					// TODO: I18n
					header('Location: ' . \TablesRouter\Campaign::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null]) . '#snack:Eine Löschung ist noch nicht möglich'); // open delete confirm window when something went wrong
					die();
				}
				throw $e; // sonst: weiterwerfen
			}
			if (!$success) {
				// fail due to permission
				\FOP\Database::rollbackTransaction();
				if (isset($_GET['ajax'])) {
					header('HTTP/1.0 403 Forbidden');
					die(_('deletiondenied'));
				}
				throw new \FOP\AccessDeniedException('deletiondenied');
			}

			$addition = '#snack:' . _('delete successful');
		}
		\FOP\Database::commitTransaction();

		if (isset($_GET['ajax'])) die('');
		header("Location: " . (isset($_GET['from']) ? $_GET['from'] : \TablesRouter\Campaign::indexURL()) . $addition);
		die();
	
    
  }

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


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

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

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


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

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

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

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

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

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

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

							</div>
							

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


  
  

  
  
}



