<?php

namespace Tables;

class Aufgabe {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function repeatCron() { 
    
    
    // --- BLOCK: main ---
    
		$advance = function ($item, $diff) {
			// copy ticket
			$data = self::getDefaults();
			foreach ($item AS $k => $v) {
				if ($k != 'state') {
					// copy data except state
					$data[$k] = $v;
				}
			}
			// advance timestamps
			$data['creation'] = strtotime($diff, $data['creation']);
			$data['deadline'] = strtotime($diff, $data['deadline']);
			$data['start'] = strtotime($diff, $data['start']);
			self::sanitizeDefaults($data, false);
			$id = self::create($data, true, false);

			// attachments, properties
			$old_id = $item['ID'];
			
		// deep clone `aufgabeAnhang`
		if (!isset($_POST['aufgabeAnhang_parent'])) { // ignore if WFL is filled
			\Tables\AufgabeAnhang::cloneParent($old_id, $id);
		}
	
		// deep clone `aufgabeProperty`
		if (!isset($_POST['aufgabeProperty_parent'])) { // ignore if WFL is filled
			\Tables\AufgabeProperty::cloneParent($old_id, $id);
		}
	

			// mark old ticket as no-repeat; the new ticket will be repeated
			self::edit($old_id, ['repeat' => 0], false, true);
		};
		foreach (\FOP\Database::query('SELECT * FROM '.qi('aufgabe').' WHERE '.qi('repeat').' = 11 AND '.qi('creation').' < ' . (time() - 7*24*60*60))->fetchAll(\PDO::FETCH_ASSOC) AS $item) {
			$advance($item, '+7 day');
		}
		foreach (\FOP\Database::query('SELECT * FROM '.qi('aufgabe').' WHERE '.qi('repeat').' = 12 AND '.qi('creation').' < ' . (time() - 30*24*60*60))->fetchAll(\PDO::FETCH_ASSOC) AS $item) {
			$advance($item, '+1 month');
		}
		foreach (\FOP\Database::query('SELECT * FROM '.qi('aufgabe').' WHERE '.qi('repeat').' = 13 AND '.qi('creation').' < ' . (time() - 90*24*60*60))->fetchAll(\PDO::FETCH_ASSOC) AS $item) {
			$advance($item, '+3 month');
		}
		foreach (\FOP\Database::query('SELECT * FROM '.qi('aufgabe').' WHERE '.qi('repeat').' = 14 AND '.qi('creation').' < ' . (time() - 360*24*60*60))->fetchAll(\PDO::FETCH_ASSOC) AS $item) {
			$advance($item, '+1 year');
		}
	
    
  }

  public static function getDefaults() { 
    
    
    // --- BLOCK: main ---
    
	// erstellt ein leeres Objekt zum Befüllen mit Daten oder als Default fürs Create-Formular
	$data = ['repeat' => '0',
		'assigned' => null,
		'typ' => null,
		'title' => '',
		'state' => null,
		'deadline' => null,
		'details' => '',
		'creation' => time(),
		'start' => time(),
		'creator' => (\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.qi('3rcBmoN5').'.'.qi('ID').') FROM '.qi('mitglied').' '.qi('3rcBmoN5').' WHERE TRUE AND ((SELECT (('.qi('Wc5gFFoq').'.'.qi('ID').') = ('.\FOP\Database::sessionVarSQL('user').')) FROM '.qi('mitglied').' '.qi('Wc5gFFoq').' WHERE '.qi('Wc5gFFoq').'.'.qi('ID').' = '.qi('3rcBmoN5').'.'.qi('ID').' LIMIT 1))')->fetchColumn()))];
	return $data;
	
    
  }

  public static function assignAction($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: _split-IDs ---
    
		/* do not stress the idlist budget */
		$max_items = intdiv(ini_get('max_input_vars') - 30 /* Reserve für feste Spalten */, 3);
		$id = new \FOP\IDList($id);
		$rest = $id->splice($max_items);
		if ($rest) {
			$_GET['from'] = \TablesRouter\Aufgabe::assignURL2(['id' => $rest, 'from' => $_GET['from'] ?? null]);
		}
	
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		\Types\MitgliedNullAssigned::validate($_POST['assigned']);

		
		/* Sanitizer */

		$_POST['assigned'] = \FOP\Sanitizers::null_filter($_POST['assigned']);

		
	}
	
    // --- BLOCK: access-itemlist-aufgabe-edit ---
    
		// 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('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND ' . $id_->toSQL(qi('ID')))->fetchAll(\PDO::FETCH_COLUMN) AS $id_sub) {
			$id->push($id_sub);
		}
	
    // --- BLOCK: access-itemlist-aufgabe-view ---
    
		// 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('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') 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-main ---
    /* Multi */ $result = new \FOP\IDList();
    // --- BLOCK: main-2:save-main-list-fop_list ---
    
		// List Save
		if (isset($_POST['fop_list_ID'])) foreach ($_POST['fop_list_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['fop_list'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\Aufgabe::getDefaults();
				\Tables\Aufgabe::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
				$subdata['ID'] = $_POST['fop_list_ID'][$i];
				$subdata['assigned'] = $_POST['assigned'];
			if ($subid) {
				// existierendes Element
				if ($_POST['fop_list'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\Aufgabe::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\Aufgabe::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['fop_list'][$i] != '0') {
				// noch keine ID: erstellen
				if ((!\FOP\User::getIsGuest())) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\Aufgabe::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-3 ---
    
			\FOP\Database::commitTransaction();
			
		}
		
		if (isset($_POST['Tables:Aufgabe:index'])) {
			
			
			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\Aufgabe::indexURL2(['popup' => $_GET['popup'] ?? null, 'filter_aufgabe_ID' => $result->toString()]));
			}
			die();
	
		}
		die(json_encode($_POST));
	} else {
    // --- BLOCK: main-4:load-main ---
    
		$data = \Tables\Aufgabe::getDefaults();
	
    // --- BLOCK: main-4:load-main-default-assigned ---
    $data['assigned'] = (\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.qi('TrNsF1F7').'.'.qi('ID').') FROM '.qi('mitglied').' '.qi('TrNsF1F7').' WHERE TRUE AND ((SELECT (('.qi('in3H62mG').'.'.qi('ID').') = ('.\FOP\Database::sessionVarSQL('user').')) FROM '.qi('mitglied').' '.qi('in3H62mG').' WHERE '.qi('in3H62mG').'.'.qi('ID').' = '.qi('TrNsF1F7').'.'.qi('ID').' LIMIT 1))')->fetchColumn()));
	
    // --- BLOCK: main-4:load-main-list-fop_list ---
    
		$fop_list = [];
		array_push($fop_list, ...\Tables\Aufgabe::loadAssignFop_listItems($id));
	
    // --- BLOCK: main-4:load-~sanitize ---
    
		\Tables\Aufgabe::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(_('Zuweisen')); ?></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(_('Zuweisen')); ?></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(_('Zuweisen')); ?></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="0-rest">
		<?php
		if (isset($rest)) {
			echo sprintf(_('Formular auf %d Einträge beschränkt, %d verbleiben'), $id->count(), $rest->count());
		}
		?>
	
							</div>
							<div class="content" id="1">
								

								<form
									
									action="<?php echo \TablesRouter\Aufgabe::assignURL2(['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_aufgabe_assign"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_aufgabe_assign" 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' => 'fop_list',
										'title' => _(''),
										'order' => 'z-fop_list', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || true)) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '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:aufgabe:assign\' 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_aufgabe_assign_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="Tables:Aufgabe:index" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" ><i class="material-icons">save</i><?php echo(_('Speichern')); ?></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_aufgabe_assign_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['fop_list']);
										?><span id='fop_list' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card">
	<div class="mdl-cell mdl-cell--12-col" style="align-items: start; overflow: auto; max-height: calc(100vh - 300px); 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'>-</th>
					
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('ID')); ?></th>
						<?php } ?>
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Betreff')); ?></th>
						<?php } ?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ($fop_list AS $row) {
					self::assignListFop_listAction($row, $data);
				}
				if (false) { ?>
				<tr class='wfl-create'>
					<td colspan='42' class='mdl-data-table__cell--non-numeric'>
					  
				<button type='button' class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var tr = $(this).closest(".wfl-create"); $.get("Tables/Aufgabe/assignListFop_list?_&id=<?php echo htmlentities(\FOP\Util::urlencode($id)); ?>", function (html) { var h = $(html).insertBefore(tr); upgradeDOM(h); h.find("input:not([type=hidden]),textarea").first().focus(); }); event.stopPropagation();'><i class="material-icons">add</i> <?php echo(sprintf(_('add %s'), _('Aufgabe'))); ?></button>
					  
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	</div>
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['fop_list']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_assigned" id="column_assigned">
		<!-- Feld "zugewiesen an": assigned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="assigned"><?php echo(_('zugewiesen an')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditform_wf_aufgabe_assign_assignedAction($data['assigned'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::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\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%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\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitgliedNullAssigned", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</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_aufgabe_assign').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_aufgabe_assign').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_aufgabe_assign').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%3Aaufgabe%3Aassign&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%3Aaufgabe%3Aassign&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_aufgabe_assign')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_aufgabe_assign 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::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: access-itemlist-aufgabe-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('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') 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_aufgabeAnhang_parent ---
    
		if (isset($_POST['move_aufgabeAnhang_parent'])) {
			\Types\Aufgabe::validate($_POST['value_aufgabeAnhang_parent']);
			$_POST['value_aufgabeAnhang_parent'] = \FOP\Sanitizers::null_filter($_POST['value_aufgabeAnhang_parent']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('aufgabeAnhang').' SET '.qi('parent').' = ' . \FOP\Database::quote($_POST['value_aufgabeAnhang_parent']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('parent').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('aufgabeAnhang').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('parent').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\AufgabeAnhang::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_aufgabeEvent_ticket ---
    
		if (isset($_POST['move_aufgabeEvent_ticket'])) {
			\Types\Aufgabe::validate($_POST['value_aufgabeEvent_ticket']);
			$_POST['value_aufgabeEvent_ticket'] = \FOP\Sanitizers::null_filter($_POST['value_aufgabeEvent_ticket']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('aufgabeEvent').' SET '.qi('ticket').' = ' . \FOP\Database::quote($_POST['value_aufgabeEvent_ticket']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ticket').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('aufgabeEvent').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('ticket').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\AufgabeEvent::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_aufgabeProperty_parent ---
    
		if (isset($_POST['move_aufgabeProperty_parent'])) {
			\Types\Aufgabe::validate($_POST['value_aufgabeProperty_parent']);
			$_POST['value_aufgabeProperty_parent'] = \FOP\Sanitizers::null_filter($_POST['value_aufgabeProperty_parent']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('aufgabeProperty').' SET '.qi('parent').' = ' . \FOP\Database::quote($_POST['value_aufgabeProperty_parent']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('parent').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('aufgabeProperty').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('parent').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\AufgabeProperty::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\Aufgabe::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\Aufgabe::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\Aufgabe::deleteConfirmURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
								 
								id="cardform-wf_aufgabe_deleteConfirm"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_aufgabe_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:aufgabe: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('aufgabeEvent').' WHERE ' . $id->toSQL(''.qi('ticket').''))->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\AufgabeEvent::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(sprintf(_('%s-Ereignis'), _('Aufgabe'))) . ' ' . $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\Aufgabe::renderEditaufgabeEvent_ticket_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Aufgabe::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\Aufgabe::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeEvent_ticket%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\Aufgabe::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeEvent_ticket%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabe", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_aufgabeEvent_ticket" 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('aufgabeAnhang').' WHERE ' . $id->toSQL(''.qi('parent').''))->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\AufgabeAnhang::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Datei-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\Aufgabe::renderEditaufgabeAnhang_parent_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Aufgabe::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\Aufgabe::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeAnhang_parent%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\Aufgabe::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeAnhang_parent%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabe", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_aufgabeAnhang_parent" 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('aufgabeProperty').' WHERE ' . $id->toSQL(''.qi('parent').''))->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\AufgabeProperty::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Eigenschaft')) . ' ' . $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\Aufgabe::renderEditaufgabeProperty_parent_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Aufgabe::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\Aufgabe::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeProperty_parent%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\Aufgabe::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabe%26colinsert=value_aufgabeProperty_parent%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabe", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_aufgabeProperty_parent" 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_aufgabe_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_aufgabe_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() . '× ' . _('Aufgabe') . ')'; ?><?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%3Aaufgabe%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%3Aaufgabe%3AdeleteConfirm&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_aufgabe_deleteConfirm')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_aufgabe_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-aufgabe')['from'] ?? null)) {
					header('Location: ' . $to);
					die();
				}
				if (!\TablesRouter\Aufgabe::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\Aufgabe::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-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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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-aufgabe')) { ?>
	<?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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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-aufgabe')) { ?>
	<?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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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\Aufgabe::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_aufgabe_view"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_aufgabe_view" 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 \DataView\AufgabeAnhang_parent::renderScript($id); ?><?php \DataView\AufgabeEvent_ticket::renderScript($id); ?><?php \DataView\AufgabeProperty_parent::renderScript($id); ?>
									<?php
									$features = [];
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
									$feature = [
										'id' => 'aufgabeAnhang_parent_table',
										'title' => _('Datei-Anhänge'),
										'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 ((true) && (!\FOP\User::getIsGuest()) && (true)) {
									$feature = [
										'id' => 'aufgabeEvent_ticket_table',
										'title' => _('Ereignisse'),
										'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 ((true) && (!\FOP\User::getIsGuest()) && (true)) {
									$feature = [
										'id' => 'aufgabeProperty_parent_table',
										'title' => _('Eigenschaften'),
										'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 (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 || true || true || true || true || true || true || true || true || true || true || 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')
											 .'||'. (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')
											 .'||'. (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:aufgabe: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::getIsGuest()) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['aufgabeAnhang_parent_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="aufgabeAnhang_parent-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadaufgabeAnhang_parent()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\AufgabeAnhang_parent::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['aufgabeAnhang_parent_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['aufgabeEvent_ticket_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="aufgabeEvent_ticket-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadaufgabeEvent_ticket()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\AufgabeEvent_ticket::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['aufgabeEvent_ticket_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if ((true) && (!\FOP\User::getIsGuest()) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['aufgabeProperty_parent_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="aufgabeProperty_parent-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadaufgabeProperty_parent()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\AufgabeProperty_parent::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['aufgabeProperty_parent_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_aufgabe_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::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('editbtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Aufgabe::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 && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('Ereignis')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\AufgabeEvent::createURL2(['column_ticket' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>keyboard_arrow_right</i> <?php echo(_('Ereignis')); ?></a><?php } ?>&nbsp;
		<?php if ($data['operation::view'] == 1 && $data['operation::edit'] == 1 && $data['operation::view'] == 1 && $data['operation::edit'] == 1 && (!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('Zuweisen')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Aufgabe::assignURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null])); ?>"><i class='material-icons'>person</i> <?php echo(_('Zuweisen')); ?></a><?php } ?>&nbsp;
		<?php if ($data['operation::delete'] == 1 && $data['operation::delete'] == 1 && (!\FOP\User::getIsGuest())) { ?><a title="<?php echo(_('deletebtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Aufgabe::deleteConfirmURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null, 'from' => $_GET['from'] ?? \FOP\Session::getPayload('dv-aufgabe')['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_aufgabe_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 || true || true || true || true || true || true || true || true || true || true || true || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column__ID" id="column__ID">
		<!-- Feld "ID": _ID -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="_ID"><?php echo(_('ID')); ?>: </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['_ID'])); ?>
	</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column__anhang" id="column__anhang">
		<!-- Feld "Anhang": _anhang -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="_anhang"><?php echo(_('Anhang')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php if($data['_anhang'] == 1){ ?>✓<?php }else{ ?>✗<?php }?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_typ" id="column_typ">
		<!-- Feld "Typ": typ -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="typ"><?php echo(_('Typ')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('aufgabeType').'.'.qi('name').' AS description, ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canView').' FROM '.qi('aufgabeType').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['typ']);
	$aufgabeType_result = \FOP\Database::query($sql);
	if ($aufgabeType_row = $aufgabeType_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($aufgabeType_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\AufgabeType::viewURL($data['typ'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"aufgabeType\" data-id=\"".htmlentities($aufgabeType_row['ID'])."\">";echo htmlentities($aufgabeType_row['description']);if ($aufgabeType_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_title" id="column_title">
		<!-- Feld "Betreff": title -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="title"><?php echo(_('Betreff')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['title']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_state" id="column_state">
		<!-- Feld "Zustand": state -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="state"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span class='fop-editable' style='width: 100%;<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && $data['operation::view'] == 1 && $data['operation::edit'] == 1) {?> cursor: pointer;' onclick='
		event.preventDefault();
		event.stopPropagation();
		var cell = $(this).closest(&apos;.mdl-cell&apos;).parent(&apos;.mdl-cell&apos;);
		var div = get_overlay(this, function () {
			// submit the form in overlay
			div.find(&apos;form&apos;).submit();
		});
		$.get(&apos;Tables/Aufgabe/stateEdit?id=&apos; + <?php echo htmlentities($id); ?>).then(function (html) {
			div.html(html);
			var iframe = div.find(&apos;iframe&apos;)[0];
			if (iframe) iframe.onload = function () {
				this.onload = function () {
					div.close();
					if (!window.noreload) location.reload(); // TODO: evtl. Ajax
					window.noreload = false;
				}
			};
			div.find(&apos;input[type=text], input[type=checkbox], textarea&apos;).select().focus().keydown(function (event) {
				if ([13/*, 38, 40*/, 9].includes(event.keyCode)) { // ENTER, up, down, tab
					$(this).closest(&apos;form&apos;).submit();
					event.preventDefault();
					event.stopPropagation();
					if (/*event.keyCode == 40 ||*/ event.keyCode == 9 && !event.shiftKey) {
						var n = cell.next(&apos;.mdl-cell:has(.fop-editable)&apos;).find(&apos;.fop-editable&apos;);
						if (n.length) {
							window.noreload = true;
							n.click();
						}
					}
					if (/*event.keyCode == 38 ||*/ event.keyCode == 9 && event.shiftKey) {
						var n = cell.prev(&apos;.mdl-cell:has(.fop-editable)&apos;).find(&apos;.fop-editable&apos;);
						if (n.length) {
							window.noreload = true;
							n.click();
						}
					}
				}
			});
		});
		div.text(&apos;🗘&apos;);
		return true;'<?php } else { ?>'<?php } ?>><?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', '.qi('aufgabeState').'.'.qi('name').' AS description, ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canView').' FROM '.qi('aufgabeState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['state']);
	$aufgabeState_result = \FOP\Database::query($sql);
	if ($aufgabeState_row = $aufgabeState_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($aufgabeState_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\AufgabeState::viewURL($data['state'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"aufgabeState\" data-id=\"".htmlentities($aufgabeState_row['ID'])."\">";echo htmlentities($aufgabeState_row['description']);if ($aufgabeState_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>
</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_deadline" id="column_deadline">
		<!-- Feld "Deadline": deadline -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="deadline"><?php echo(_('Deadline')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span class='fop-editable' style='width: 100%;<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()) && $data['operation::view'] == 1 && $data['operation::edit'] == 1) {?> cursor: pointer;' onclick='
		event.preventDefault();
		event.stopPropagation();
		var cell = $(this).closest(&apos;.mdl-cell&apos;).parent(&apos;.mdl-cell&apos;);
		var div = get_overlay(this, function () {
			// submit the form in overlay
			div.find(&apos;form&apos;).submit();
		});
		$.get(&apos;Tables/Aufgabe/deadlineEdit?id=&apos; + <?php echo htmlentities($id); ?>).then(function (html) {
			div.html(html);
			var iframe = div.find(&apos;iframe&apos;)[0];
			if (iframe) iframe.onload = function () {
				this.onload = function () {
					div.close();
					if (!window.noreload) location.reload(); // TODO: evtl. Ajax
					window.noreload = false;
				}
			};
			div.find(&apos;input[type=text], input[type=checkbox], textarea&apos;).select().focus().keydown(function (event) {
				if ([13/*, 38, 40*/, 9].includes(event.keyCode)) { // ENTER, up, down, tab
					$(this).closest(&apos;form&apos;).submit();
					event.preventDefault();
					event.stopPropagation();
					if (/*event.keyCode == 40 ||*/ event.keyCode == 9 && !event.shiftKey) {
						var n = cell.next(&apos;.mdl-cell:has(.fop-editable)&apos;).find(&apos;.fop-editable&apos;);
						if (n.length) {
							window.noreload = true;
							n.click();
						}
					}
					if (/*event.keyCode == 38 ||*/ event.keyCode == 9 && event.shiftKey) {
						var n = cell.prev(&apos;.mdl-cell:has(.fop-editable)&apos;).find(&apos;.fop-editable&apos;);
						if (n.length) {
							window.noreload = true;
							n.click();
						}
					}
				}
			});
		});
		div.text(&apos;🗘&apos;);
		return true;'<?php } else { ?>'<?php } ?>>
	<?php echo htmlentities(($data['deadline']) ? strftime(_('dateformat_php2'), intval($data['deadline'])) : ''); ?></span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_assigned" id="column_assigned">
		<!-- Feld "zugewiesen an": assigned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="assigned"><?php echo(_('zugewiesen an')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description, ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('canView').' FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['assigned']);
	$mitglied_result = \FOP\Database::query($sql);
	if ($mitglied_row = $mitglied_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($mitglied_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($data['assigned'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($mitglied_row['ID'])."\">";echo htmlentities($mitglied_row['description']);if ($mitglied_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('Niemand zugewiesen') ?: '-');
	}
	
?>

	</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_creator" id="column_creator">
		<!-- Feld "Ersteller": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Ersteller')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php
	
	$sql = 'SELECT '.qi('ID').' AS '.qi('ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description, ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('canView').' FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($data['creator']);
	$mitglied_result = \FOP\Database::query($sql);
	if ($mitglied_row = $mitglied_result->fetch(\PDO::FETCH_ASSOC)) {
		if ($mitglied_row['canView']) echo "<a onclick=\"event.preventDefault(); open_url(this.href, true);\" href=\"" . \TablesRouter\Mitglied::viewURL($data['creator'], ['from' => \FOP\Util::getBackURL()]) . "\" class=\"tbl-link\" data-tbl=\"mitglied\" data-id=\"".htmlentities($mitglied_row['ID'])."\">";echo htmlentities($mitglied_row['description']);if ($mitglied_row['canView']) echo "</a>";
	} else {
		echo htmlentities(_('') ?: '-');
	}
	
?>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_details" id="column_details">
		<!-- Feld "Details": details -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="details"><?php echo(_('Details')); ?>: </label>
	</div>
	<div	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['details']); ?>
</div>

	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_start" id="column_start">
		<!-- Feld "Geplante Umsetzung": start -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="start"><?php echo(_('Geplante Umsetzung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['start']) ? strftime(_('dateformat_php2'), intval($data['start'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_repeat" id="column_repeat">
		<!-- Feld "Wiederholung": repeat -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="repeat"><?php echo(_('Wiederholung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<?php echo htmlentities(\Types\AufgabeRepeat::toString($data['repeat'])); ?>
	</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 setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Aaufgabe%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%3Aaufgabe%3Aview&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_aufgabe_view')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_aufgabe_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 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::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\MitgliedNullAssigned::validate($_POST['assigned']);
		if (((false)) && (!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['creator']);
		if ((!isset($_POST['cancel']))) \Types\AufgabeType::validate($_POST['typ']);
		if ((!isset($_POST['cancel']))) \Types\AufgabeState::validate($_POST['state']);

		if (isset($_POST['aufgabeAnhang_parent_file'])) foreach ($_POST['aufgabeAnhang_parent_file'] AS $i => $val)
			if ($_POST['aufgabeAnhang_parent'][$i] != '0') \FOP\Files::validate($val);
		if (((false))) if (isset($_POST['aufgabeAnhang_parent_parent'])) foreach ($_POST['aufgabeAnhang_parent_parent'] AS $i => $val)
			if ($_POST['aufgabeAnhang_parent'][$i] != '0') \Types\Aufgabe::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\AufgabePropertyDropdown2::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_parent'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_parent'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\Aufgabe::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_type'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\AufgabePropertyType::validate($val);
		/* Sanitizer */

		if ((!isset($_POST['cancel']))) $_POST['assigned'] = \FOP\Sanitizers::null_filter($_POST['assigned']);
		if (((false)) && (!isset($_POST['cancel']))) $_POST['creator'] = \FOP\Sanitizers::null_filter($_POST['creator']);
		if ((!isset($_POST['cancel']))) $_POST['typ'] = \FOP\Sanitizers::null_filter($_POST['typ']);
		if ((!isset($_POST['cancel']))) $_POST['state'] = \FOP\Sanitizers::null_filter($_POST['state']);
		$_POST['deadline'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['deadline']);
		if (((false))) $_POST['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['creation']);
		$_POST['details'] = \FOP\Sanitizers::htmlentities_decode($_POST['details']);
		$_POST['start'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['start']);

		if (isset($_POST['aufgabeAnhang_parent_file'])) foreach ($_POST['aufgabeAnhang_parent_file'] AS $idx => $val) $_POST['aufgabeAnhang_parent_file'][$idx] = \FOP\Files::sanitizeUpload($val);
		if (((false))) if (isset($_POST['aufgabeAnhang_parent_parent'])) foreach ($_POST['aufgabeAnhang_parent_parent'] AS $idx => $val) $_POST['aufgabeAnhang_parent_parent'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_dateValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_dateValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_dateValue'][$idx] = \FOP\Sanitizers::convert_date_to_unix_timestamp($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_doubleValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_doubleValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_doubleValue'][$idx] = \Types\Double::parse($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_htmlValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_htmlValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_htmlValue'][$idx] = \FOP\Sanitizers::htmlentities_decode($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_parent'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_parent'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_parent'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_type'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_type'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- 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\Aufgabe::getDefaults();
		$defaults['repeat'] = $_POST['repeat'];
		$defaults['title'] = $_POST['title'];
		$defaults['deadline'] = $_POST['deadline'];
		$defaults['details'] = $_POST['details'];
		$defaults['start'] = $_POST['start'];
		if ((!isset($_POST['cancel']))) $defaults['assigned'] = $_POST['assigned'];
		if (((false)) && (!isset($_POST['cancel']))) $defaults['creator'] = $_POST['creator'];
		if ((!isset($_POST['cancel']))) $defaults['typ'] = $_POST['typ'];
		if ((!isset($_POST['cancel']))) $defaults['state'] = $_POST['state'];
		if (((false))) $defaults['creation'] = $_POST['creation'];
		// TableItemAccess für PHP auswerten
		
		$id = \Tables\Aufgabe::create($defaults);
	
    // --- BLOCK: main-2:save-main-list-aufgabeAnhang_parent ---
    
		// List Save
		if (isset($_POST['aufgabeAnhang_parent_ID'])) foreach ($_POST['aufgabeAnhang_parent_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['aufgabeAnhang_parent'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\AufgabeAnhang::getDefaults();
				\Tables\AufgabeAnhang::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['parent'] = $id;
				$subdata['file'] = $_POST['aufgabeAnhang_parent_file'][$i];
				$subdata['vermerk'] = $_POST['aufgabeAnhang_parent_vermerk'][$i];
				$subdata['ID'] = $_POST['aufgabeAnhang_parent_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['aufgabeAnhang_parent'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\AufgabeAnhang::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\AufgabeAnhang::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['aufgabeAnhang_parent'][$i] != '0') {
				// noch keine ID: erstellen
				if ((!\FOP\User::getIsGuest())) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\AufgabeAnhang::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-2:save-main-matrix-matrix_aufgabeProperty_parent_type ---
    if ((!\FOP\User::getIsGuest())) {
	if (isset($_POST['matrix_aufgabeProperty_parent_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type'] AS $i => $subid) {
		$parent = $defaults;
		$deps = [];
		
		$deps['typ'] = $defaults['typ'];
		
		if (!isset($_POST['matrix_aufgabeProperty_parent_type__' . preg_replace('/[^a-zA-Z_0-9]/', '', $subid)])) {
			// nicht angetickt: evtl. löschen
			if ($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]) {
				\Tables\AufgabeProperty::delete($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]);
			}
		} else {
			// angetickt: Erstellen oder bearbeiten
			$subdata = [];
			$subdata['parent'] = $id;
			$subdata['type'] = $_POST['matrix_aufgabeProperty_parent_type_type'][$i];
			$subdata['textValue'] = $_POST['matrix_aufgabeProperty_parent_type_textValue'][$i];
			$subdata['dateValue'] = $_POST['matrix_aufgabeProperty_parent_type_dateValue'][$i];
			$subdata['doubleValue'] = $_POST['matrix_aufgabeProperty_parent_type_doubleValue'][$i];
			$subdata['htmlValue'] = $_POST['matrix_aufgabeProperty_parent_type_htmlValue'][$i];
			$subdata['aufgabePropertyDropdown2Value'] = $_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'][$i];
			if ($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]) {
				\Tables\AufgabeProperty::edit($_POST['matrix_aufgabeProperty_parent_type_ID'][$i], $subdata);
			} else {
				\Tables\AufgabeProperty::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\Aufgabe::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\Aufgabe::viewAccess($id)) {
					if (!\TablesRouter\Aufgabe::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
						die();
					}
					header('Location: ' . \TablesRouter\Aufgabe::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Aufgabe::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\Aufgabe::getDefaults();
	
    // --- BLOCK: main-4:load-main-list-aufgabeAnhang_parent ---
    
		$aufgabeAnhang_parent = [];
		
	
    // --- BLOCK: main-4:load-main-matrix-matrix_aufgabeProperty_parent_type ---
    
		
		$deps['typ'] = $data['typ'];
		$matrix_aufgabeProperty_parent_type = [];
	
    // --- BLOCK: main-4:load-~sanitize ---
    
		\Tables\Aufgabe::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'), _('Aufgabe'))); ?></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'), _('Aufgabe'))); ?></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'), _('Aufgabe'))); ?></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\Aufgabe::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_aufgabe_create"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_aufgabe_create" ng-init="form = <?php echo htmlentities(json_encode(['deadline' => $data['deadline'], 'typ' => $data['typ']]));
									?>;"
								>
								<?php
								 if (isset($_GET['email'])) echo '<input type="hidden" name="email" value="' . htmlentities($_GET['email']) . '">';
								 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 && (!\FOP\User::getIsGuest()) && (false || true)) {
									$feature = [
										'id' => 'matrix_aufgabeProperty_parent_type',
										'title' => _('Eigenschaften'),
										'order' => 'z-matrix_aufgabeProperty_parent_type', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || true || true || true || ((false)) || true || true || false || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])))) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && (!isset($_POST['cancel'])) ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (!\FOP\User::getIsGuest()) && (false || true)) {
									$feature = [
										'id' => 'aufgabeAnhang_parent',
										'title' => _('Datei-Anhänge'),
										'order' => 'z-aufgabeAnhang_parent', // 
										'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:aufgabe: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_aufgabe_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_aufgabe_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 && (!\FOP\User::getIsGuest()) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['matrix_aufgabeProperty_parent_type']);
										?><?php
	if ((!\FOP\User::getIsGuest())) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card" id='matrix_aufgabeProperty_parent_type'  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(_('Eigenschaften')); ?></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'>
						<?php echo(_('Eigenschaft')); ?>
					</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Text')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Datum')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Zahl')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Großer Text')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Auswahl')); ?>
						</th>
				</tr>
			</thead>
			<tbody class='cm-matrix_aufgabeProperty_parent_type'>
			<?php
					// renderAction!
					self::createMatrixMatrix_aufgabeProperty_parent_typeAction(null, $matrix_aufgabeProperty_parent_type, /* typ */ $data['typ']);
			?>
			</tbody>
		</table>
	</div>
	</div>
	<?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['matrix_aufgabeProperty_parent_type']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || true || true || true || ((false)) || true || true || false || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || ((false)) && (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_typ" id="column_typ">
		<!-- Feld "Typ": typ -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="typ"><?php echo(_('Typ')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\AufgabeType::renderEditform_wf_aufgabe_create_typAction($data['typ'], [], '');
?> &nbsp;	<?php if (\TablesRouter\AufgabeType::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\AufgabeType::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'typ\']'); ?>%26type=aufgabeType%26colinsert=typ%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\AufgabeType::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'typ\']'); ?>%26type=aufgabeType%26colinsert=typ%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabeType", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_title" id="column_title">
		<!-- Feld "Betreff": title -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="title"><?php echo(_('Betreff')); ?>: </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="title"  value="<?php echo htmlentities($data['title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_state" id="column_state">
		<!-- Feld "Zustand": state -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="state"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\AufgabeState::renderEditform_wf_aufgabe_create_stateAction($data['state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\AufgabeState::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\AufgabeState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=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\AufgabeState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabeState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_deadline" id="column_deadline">
		<!-- Feld "Deadline": deadline -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="deadline"><?php echo(_('Deadline')); ?>: </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')); ?>' ts-model='form[&apos;deadline&apos;]' class="mdl-textfield__input picker_date" id="deadline" type="text" name="deadline" value="<?php echo ($data['deadline']) ? strftime(_('dateformat_php2'), intval($data['deadline'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_assigned" id="column_assigned">
		<!-- Feld "zugewiesen an": assigned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="assigned"><?php echo(_('zugewiesen an')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditform_wf_aufgabe_create_assignedAction($data['assigned'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::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\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%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\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitgliedNullAssigned", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?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)) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creator" id="column_creator">
		<!-- Feld "Ersteller": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Ersteller')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditform_wf_aufgabe_create_creatorAction($data['creator'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::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\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=creator%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\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=creator%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitglied", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_details" id="column_details">
		<!-- Feld "Details": details -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="details"><?php echo(_('Details')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="details" class="html-html"><?php echo htmlentities($data['details']); ?></textarea>
	</div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_start" id="column_start">
		<!-- Feld "Geplante Umsetzung": start -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="start"><?php echo(_('Geplante Umsetzung')); ?>: </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="start" type="text" name="start" value="<?php echo ($data['start']) ? strftime(_('dateformat_php2'), intval($data['start'])) : ''; ?>"/><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_repeat" id="column_repeat">
		<!-- Feld "Wiederholung": repeat -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="repeat"><?php echo(_('Wiederholung')); ?>: </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='repeat' id='repeat'><option value='0'<?php if ($data['repeat'] == 0) {echo " selected";}?>><?php echo(_('keine Wiederholung')); ?></option><option value='11'<?php if ($data['repeat'] == 11) {echo " selected";}?>><?php echo(_('Wöchentlich')); ?></option><option value='12'<?php if ($data['repeat'] == 12) {echo " selected";}?>><?php echo(_('Monatlich')); ?></option><option value='13'<?php if ($data['repeat'] == 13) {echo " selected";}?>><?php echo(_('Quartärlich')); ?></option><option value='14'<?php if ($data['repeat'] == 14) {echo " selected";}?>><?php echo(_('Jährlich')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>&nbsp;
			<div id="inforepeat" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="inforepeat"><?php echo(_('Wiederholte Tickets werden immer wieder neu erstellt - jeweils verschoben um den eingestellten Wert. Deadline, Erstellung, Geplante Umsetzung werden jeweils verschoben.')); ?></div>
		
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (!\FOP\User::getIsGuest()) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['aufgabeAnhang_parent']);
										?><span id='aufgabeAnhang_parent' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card">
	
	<div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Datei-Anhänge')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: calc(100vh - 300px)">
		<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'>-</th>
					
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Datei')); ?></th>
						<?php } ?>
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Vermerk')); ?></th>
						<?php } ?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ($aufgabeAnhang_parent AS $row) {
					self::createListAufgabeAnhang_parentAction($row, $data);
				}
				if (!\FOP\User::getIsGuest()) { ?>
				<tr class='wfl-create'>
					<td colspan='42' class='mdl-data-table__cell--non-numeric'>
					  
		

	
		<div>

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

?>
<div class="fop-file-upload dropzone dropzone-file_preview" 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/Aufgabe/createListAufgabeAnhang_parent?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_preview').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/Aufgabe/createListAufgabeAnhang_parent?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>
		
	
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	</div>
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['aufgabeAnhang_parent']['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_aufgabe_create').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_aufgabe_create').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_aufgabe_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%3Aaufgabe%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%3Aaufgabe%3Acreate&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_aufgabe_create')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_aufgabe_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::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		$data = self::view($id);
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\MitgliedNullAssigned::validate($_POST['assigned']);
		if (((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['creator']);
		if ((!isset($_POST['cancel']))) \Types\AufgabeType::validate($_POST['typ']);
		if ((!isset($_POST['cancel']))) \Types\AufgabeState::validate($_POST['state']);

		if (isset($_POST['aufgabeAnhang_parent_file'])) foreach ($_POST['aufgabeAnhang_parent_file'] AS $i => $val)
			if ($_POST['aufgabeAnhang_parent'][$i] != '0') \FOP\Files::validate($val);
		if (((false))) if (isset($_POST['aufgabeAnhang_parent_parent'])) foreach ($_POST['aufgabeAnhang_parent_parent'] AS $i => $val)
			if ($_POST['aufgabeAnhang_parent'][$i] != '0') \Types\Aufgabe::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\AufgabePropertyDropdown2::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_parent'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_parent'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\Aufgabe::validate($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_type'] AS $i => $val)
			if (isset($_POST['matrix_aufgabeProperty_parent_type__'.preg_replace('/[^a-zA-Z_0-9]/', '', $POST['matrix_aufgabeProperty_parent_type'][$i])])) \Types\AufgabePropertyType::validate($val);
		/* Sanitizer */

		if ((!isset($_POST['cancel']))) $_POST['assigned'] = \FOP\Sanitizers::null_filter($_POST['assigned']);
		if (((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel']))) $_POST['creator'] = \FOP\Sanitizers::null_filter($_POST['creator']);
		if ((!isset($_POST['cancel']))) $_POST['typ'] = \FOP\Sanitizers::null_filter($_POST['typ']);
		if ((!isset($_POST['cancel']))) $_POST['state'] = \FOP\Sanitizers::null_filter($_POST['state']);
		$_POST['deadline'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['deadline']);
		if (((false)) && ($data['creation::canEdit'] == 1)) $_POST['creation'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['creation']);
		$_POST['details'] = \FOP\Sanitizers::htmlentities_decode($_POST['details']);
		$_POST['start'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['start']);

		if (isset($_POST['aufgabeAnhang_parent_file'])) foreach ($_POST['aufgabeAnhang_parent_file'] AS $idx => $val) $_POST['aufgabeAnhang_parent_file'][$idx] = \FOP\Files::sanitizeUpload($val);
		if (((false))) if (isset($_POST['aufgabeAnhang_parent_parent'])) foreach ($_POST['aufgabeAnhang_parent_parent'] AS $idx => $val) $_POST['aufgabeAnhang_parent_parent'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_dateValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_dateValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_dateValue'][$idx] = \FOP\Sanitizers::convert_date_to_unix_timestamp($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_doubleValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_doubleValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_doubleValue'][$idx] = \Types\Double::parse($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_htmlValue'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_htmlValue'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_htmlValue'][$idx] = \FOP\Sanitizers::htmlentities_decode($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_parent'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_parent'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_parent'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['matrix_aufgabeProperty_parent_type_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type_type'] AS $idx => $val) $_POST['matrix_aufgabeProperty_parent_type_type'][$idx] = \FOP\Sanitizers::null_filter($val);
	}
	
    // --- BLOCK: access-item-aufgabe-edit ---
    
		if ($id !== null && \FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('aufgabe').' 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['repeat'] = $_POST['repeat'];
		$data_edit['title'] = $_POST['title'];
		$data_edit['deadline'] = $_POST['deadline'];
		$data_edit['details'] = $_POST['details'];
		$data_edit['start'] = $_POST['start'];
		if ((!isset($_POST['cancel']))) $data_edit['assigned'] = $_POST['assigned'];
		if (((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel']))) $data_edit['creator'] = $_POST['creator'];
		if ((!isset($_POST['cancel']))) $data_edit['typ'] = $_POST['typ'];
		if ((!isset($_POST['cancel']))) $data_edit['state'] = $_POST['state'];
		if (((false)) && ($data['creation::canEdit'] == 1)) $data_edit['creation'] = $_POST['creation'];
		self::edit($id, $data_edit);
		if (isset($data_edit['ID'])) {
			$id = $data_edit['ID'];
		}
	
    // --- BLOCK: main-2:save-main-list-aufgabeAnhang_parent ---
    
		// List Save
		if (isset($_POST['aufgabeAnhang_parent_ID'])) foreach ($_POST['aufgabeAnhang_parent_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['aufgabeAnhang_parent'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\AufgabeAnhang::getDefaults();
				\Tables\AufgabeAnhang::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['parent'] = $id;
				$subdata['file'] = $_POST['aufgabeAnhang_parent_file'][$i];
				$subdata['vermerk'] = $_POST['aufgabeAnhang_parent_vermerk'][$i];
				$subdata['ID'] = $_POST['aufgabeAnhang_parent_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['aufgabeAnhang_parent'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\AufgabeAnhang::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\AufgabeAnhang::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['aufgabeAnhang_parent'][$i] != '0') {
				// noch keine ID: erstellen
				if ((!\FOP\User::getIsGuest())) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\AufgabeAnhang::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- BLOCK: main-2:save-main-matrix-matrix_aufgabeProperty_parent_type ---
    if ((!\FOP\User::getIsGuest())) {
	if (isset($_POST['matrix_aufgabeProperty_parent_type'])) foreach ($_POST['matrix_aufgabeProperty_parent_type'] AS $i => $subid) {
		$parent = array_merge($data, $data_edit);
		$deps = [];
		
		$deps['typ'] = $data_edit['typ'];
		
		if (!isset($_POST['matrix_aufgabeProperty_parent_type__' . preg_replace('/[^a-zA-Z_0-9]/', '', $subid)])) {
			// nicht angetickt: evtl. löschen
			if ($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]) {
				\Tables\AufgabeProperty::delete($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]);
			}
		} else {
			// angetickt: Erstellen oder bearbeiten
			$subdata = [];
			$subdata['parent'] = $id;
			$subdata['type'] = $_POST['matrix_aufgabeProperty_parent_type_type'][$i];
			$subdata['textValue'] = $_POST['matrix_aufgabeProperty_parent_type_textValue'][$i];
			$subdata['dateValue'] = $_POST['matrix_aufgabeProperty_parent_type_dateValue'][$i];
			$subdata['doubleValue'] = $_POST['matrix_aufgabeProperty_parent_type_doubleValue'][$i];
			$subdata['htmlValue'] = $_POST['matrix_aufgabeProperty_parent_type_htmlValue'][$i];
			$subdata['aufgabePropertyDropdown2Value'] = $_POST['matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value'][$i];
			if ($_POST['matrix_aufgabeProperty_parent_type_ID'][$i]) {
				\Tables\AufgabeProperty::edit($_POST['matrix_aufgabeProperty_parent_type_ID'][$i], $subdata);
			} else {
				\Tables\AufgabeProperty::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\Aufgabe::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\Aufgabe::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-aufgabeAnhang_parent ---
    
		$aufgabeAnhang_parent = [];
		array_push($aufgabeAnhang_parent, ...\Tables\Aufgabe::loadEditAufgabeAnhang_parentItems($id ?? null));
	
    // --- BLOCK: main-4:load-main-matrix-matrix_aufgabeProperty_parent_type ---
    
		
		$deps['typ'] = $data['typ'];
		$matrix_aufgabeProperty_parent_type = \FOP\Database::query('SELECT /* ID */ '.qi('ID').' AS '.qi('ID').',
									/* _checked */ 1 AS '.qi('_checked').',
									/* aufgabePropertyDropdown2Value */ '.qi('aufgabePropertyDropdown2Value').' AS '.qi('aufgabePropertyDropdown2Value').',
									/* dateValue */ '.qi('dateValue').' AS '.qi('dateValue').',
									/* doubleValue */ '.qi('doubleValue').' AS '.qi('doubleValue').',
									/* htmlValue */ '.qi('htmlValue').' AS '.qi('htmlValue').',
									/* parent */ '.qi('parent').' AS '.qi('parent').',
									/* textValue */ '.qi('textValue').' AS '.qi('textValue').',
									/* type */ '.qi('type').' AS '.qi('type').',
									1
								FROM '.qi('aufgabeProperty').' '.qi('aufgabeProperty').'
								WHERE ('.qi('parent').' = ' . \FOP\Database::quote($data['ID']) . ')')->fetchAll(\PDO::FETCH_ASSOC);
	
    // --- 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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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 CONCAT(\'#\', '.qi('aufgabe').'.'.qi('ID').', \': \', '.qi('aufgabe').'.'.qi('title').') AS description FROM '.qi('aufgabe').' 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\Aufgabe::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_aufgabe_edit"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_aufgabe_edit" ng-init="form = <?php echo htmlentities(json_encode(['deadline' => $data['deadline'], 'typ' => $data['typ']]));
									?>;"
								>
								<?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' => 'matrix_aufgabeProperty_parent_type',
										'title' => _('Eigenschaften'),
										'order' => 'z-matrix_aufgabeProperty_parent_type', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || false || true || true || true || ((false)) && ($data['creation::canEdit'] == 1) || true || true || false || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || ((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel'])))) {
									$feature = [
										'id' => 'main',
										'title' => _('Daten'),
										'order' => '100', // 100 (20)
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. '0' .'||'. '0' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (((false)) && ($data['creation::canEdit'] == 1) ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. (((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel'])) ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || true)) {
									$feature = [
										'id' => 'aufgabeAnhang_parent',
										'title' => _('Datei-Anhänge'),
										'order' => 'z-aufgabeAnhang_parent', // 
										'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:aufgabe: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_aufgabe_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_aufgabe_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 || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['matrix_aufgabeProperty_parent_type']);
										?><?php
	if ((!\FOP\User::getIsGuest())) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card" id='matrix_aufgabeProperty_parent_type'  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(_('Eigenschaften')); ?></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'>
						<?php echo(_('Eigenschaft')); ?>
					</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Text')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Datum')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Zahl')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Großer Text')); ?>
						</th><th class='mdl-data-table__cell--non-numeric'>
							<?php echo(_('Auswahl')); ?>
						</th>
				</tr>
			</thead>
			<tbody class='cm-matrix_aufgabeProperty_parent_type'>
			<?php
					// renderAction!
					self::editMatrixMatrix_aufgabeProperty_parent_typeAction($id, $matrix_aufgabeProperty_parent_type, /* typ */ $data['typ']);
			?>
			</tbody>
		</table>
	</div>
	</div>
	<?php } ?><?php
										\EasyEditor\FormFeature::pop();
										$features['matrix_aufgabeProperty_parent_type']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || false || true || true || true || ((false)) && ($data['creation::canEdit'] == 1) || true || true || false || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])) || ((false)) && ($data['creator::canEdit'] == 1) && (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_typ" id="column_typ">
		<!-- Feld "Typ": typ -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="typ"><?php echo(_('Typ')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\AufgabeType::renderEditform_wf_aufgabe_edit_typAction($data['typ'], [], '');
?> &nbsp;	<?php if (\TablesRouter\AufgabeType::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\AufgabeType::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'typ\']'); ?>%26type=aufgabeType%26colinsert=typ%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\AufgabeType::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26ng=<?php echo urlencode('form[\'typ\']'); ?>%26type=aufgabeType%26colinsert=typ%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabeType", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_title" id="column_title">
		<!-- Feld "Betreff": title -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="title"><?php echo(_('Betreff')); ?>: </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="title"  value="<?php echo htmlentities($data['title']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('requiredinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_state" id="column_state">
		<!-- Feld "Zustand": state -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="state"><?php echo(_('Zustand')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\AufgabeState::renderEditform_wf_aufgabe_edit_stateAction($data['state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\AufgabeState::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\AufgabeState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=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\AufgabeState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=state%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabeState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_deadline" id="column_deadline">
		<!-- Feld "Deadline": deadline -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="deadline"><?php echo(_('Deadline')); ?>: </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')); ?>' ts-model='form[&apos;deadline&apos;]' class="mdl-textfield__input picker_date" id="deadline" type="text" name="deadline" value="<?php echo ($data['deadline']) ? strftime(_('dateformat_php2'), intval($data['deadline'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	</div>
	</div><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_assigned" id="column_assigned">
		<!-- Feld "zugewiesen an": assigned -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="assigned"><?php echo(_('zugewiesen an')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditform_wf_aufgabe_edit_assignedAction($data['assigned'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::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\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%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\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitgliedNullAssigned%26colinsert=assigned%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitgliedNullAssigned", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?><?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['creator::canEdit'] == 1) && (!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creator" id="column_creator">
		<!-- Feld "Ersteller": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Ersteller')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Mitglied::renderEditform_wf_aufgabe_edit_creatorAction($data['creator'], [], '');
?> &nbsp;	<?php if (\TablesRouter\Mitglied::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\Mitglied::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=creator%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\Mitglied::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=mitglied%26colinsert=creator%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=mitglied", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div>
	</div>
	</div><?php } ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_details" id="column_details">
		<!-- Feld "Details": details -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="details"><?php echo(_('Details')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="details" class="html-html"><?php echo htmlentities($data['details']); ?></textarea>
	</div>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_start" id="column_start">
		<!-- Feld "Geplante Umsetzung": start -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="start"><?php echo(_('Geplante Umsetzung')); ?>: </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="start" type="text" name="start" value="<?php echo ($data['start']) ? strftime(_('dateformat_php2'), intval($data['start'])) : ''; ?>"/><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_repeat" id="column_repeat">
		<!-- Feld "Wiederholung": repeat -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="repeat"><?php echo(_('Wiederholung')); ?>: </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='repeat' id='repeat'><option value='0'<?php if ($data['repeat'] == 0) {echo " selected";}?>><?php echo(_('keine Wiederholung')); ?></option><option value='11'<?php if ($data['repeat'] == 11) {echo " selected";}?>><?php echo(_('Wöchentlich')); ?></option><option value='12'<?php if ($data['repeat'] == 12) {echo " selected";}?>><?php echo(_('Monatlich')); ?></option><option value='13'<?php if ($data['repeat'] == 13) {echo " selected";}?>><?php echo(_('Quartärlich')); ?></option><option value='14'<?php if ($data['repeat'] == 14) {echo " selected";}?>><?php echo(_('Jährlich')); ?></option></select></div>
		<br><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>&nbsp;
			<div id="inforepeat" class="cardforminfo icon material-icons">info</div>
			<div class="mdl-tooltip" for="inforepeat"><?php echo(_('Wiederholte Tickets werden immer wieder neu erstellt - jeweils verschoben um den eingestellten Wert. Deadline, Erstellung, Geplante Umsetzung werden jeweils verschoben.')); ?></div>
		
	</div>
	</div><?php
										\EasyEditor\FormFeature::pop();
										$features['main']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['aufgabeAnhang_parent']);
										?><span id='aufgabeAnhang_parent' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card">
	
	<div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Datei-Anhänge')); ?></div>
	<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone" style="overflow: auto; max-height: calc(100vh - 300px)">
		<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'>-</th>
					
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Datei')); ?></th>
						<?php } ?>
						<?php if (true || true) { ?>
							<th class='mdl-data-table__cell--non-numeric'><?php echo(_('Vermerk')); ?></th>
						<?php } ?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ($aufgabeAnhang_parent AS $row) {
					self::editListAufgabeAnhang_parentAction($row, $data);
				}
				if (!\FOP\User::getIsGuest()) { ?>
				<tr class='wfl-create'>
					<td colspan='42' class='mdl-data-table__cell--non-numeric'>
					  
		

	
		<div>

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

?>
<div class="fop-file-upload dropzone dropzone-file_preview" 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/Aufgabe/editListAufgabeAnhang_parent?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_preview').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/Aufgabe/editListAufgabeAnhang_parent?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>
		
	
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	</div>
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['aufgabeAnhang_parent']['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_aufgabe_edit').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_aufgabe_edit').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_aufgabe_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%3Aaufgabe%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%3Aaufgabe%3Aedit&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_aufgabe_edit')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_aufgabe_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 stateEditAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-aufgabe-edit ---
    
		if (\FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('aufgabe').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// abgespecktes CardForm
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			\Types\AufgabeState::validate($_POST['value']);

			$_POST['value'] = \FOP\Sanitizers::null_filter($_POST['value']);

			self::edit($id, ['state' => $_POST['value']]);
			echo 'OK';
		} else {
			$frameid = 'temp_'.time();
			$data = self::view($id, false, true);
			?><form style="display: block; margin: 0px; padding: 0px;" method="POST" action="<?php echo \TablesRouter\Aufgabe::stateEditURL($id); ?>" target="<?php echo $frameid; ?>" enctype="multipart/form-data"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\AufgabeState::renderEditaufgabe_state_singleAction($data['state'], [], '');
?> &nbsp;	<?php if (\TablesRouter\AufgabeState::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\AufgabeState::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=value%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\AufgabeState::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabeState%26colinsert=value%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabeState", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></form><iframe name="<?php echo $frameid; ?>" style="display: none;"></iframe><?php
		}
	
    
  }

  public static function deadlineEditAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-item-aufgabe-edit ---
    
		if (\FOP\Database::query('SELECT '.(\FOP\User::getIsGuest() ? 'false' : 'true').' FROM '.qi('aufgabe').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id))->fetchColumn() != 1) {
			throw new \FOP\AccessDeniedException();
		}
	
    // --- BLOCK: main ---
    
		// abgespecktes CardForm
		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
			

			$_POST['value'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['value']);

			self::edit($id, ['deadline' => $_POST['value']]);
			echo 'OK';
		} else {
			$frameid = 'temp_'.time();
			$data = self::view($id, false, true);
			?><form style="display: block; margin: 0px; padding: 0px;" method="POST" action="<?php echo \TablesRouter\Aufgabe::deadlineEditURL($id); ?>" target="<?php echo $frameid; ?>" enctype="multipart/form-data"><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="value" type="text" name="value" value="<?php echo ($data['deadline']) ? strftime(_('dateformat_php2'), intval($data['deadline'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></form><iframe name="<?php echo $frameid; ?>" style="display: none;"></iframe><?php
		}
	
    
  }

  public static function loadAssignFop_listItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT '.qi('aufgabe').'.'.qi('ID').' AS '.qi('ID').', '.qi('aufgabe').'.'.qi('repeat').', '.qi('aufgabe').'.'.qi('assigned').', '.qi('aufgabe').'.'.qi('creator').', '.qi('aufgabe').'.'.qi('typ').', '.qi('aufgabe').'.'.qi('title').', '.qi('aufgabe').'.'.qi('state').', '.qi('aufgabe').'.'.qi('deadline').', '.qi('aufgabe').'.'.qi('creation').', '.qi('aufgabe').'.'.qi('details').', '.qi('aufgabe').'.'.qi('start').', '.qi('aufgabe').'.'.qi('ID').' AS '.qi('_ID').', EXISTS (SELECT (TRUE) FROM '.qi('aufgabeAnhang').' '.qi('XuVoGrVc').' WHERE '.qi('XuVoGrVc').'.'.qi('parent').' = '.qi('aufgabe').'.'.qi('ID').' LIMIT 1) AS '.qi('_anhang').',
			('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canDelete').'
			FROM '.qi('aufgabe').' 
			WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND (' . (new \FOP\IDList($id))->toSQL(qi('aufgabe').'.'.qi('ID')) . ') ORDER BY '.qi('aufgabe').'.'.qi('ID').' DESC')->fetchAll(\PDO::FETCH_ASSOC);

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

  public static function loadCreateAufgabeAnhang_parentItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT \'\' AS '.qi('ID').', '.qi('aufgabeAnhang').'.'.qi('file').', '.qi('aufgabeAnhang').'.'.qi('vermerk').', '.qi('aufgabeAnhang').'.'.qi('parent').',
			('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canDelete').'
			FROM '.qi('aufgabeAnhang').' 
			WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND '.qi('aufgabeAnhang').'.'.qi('parent').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

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

  public static function loadEditAufgabeAnhang_parentItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT '.qi('aufgabeAnhang').'.'.qi('ID').' AS '.qi('ID').', '.qi('aufgabeAnhang').'.'.qi('file').', '.qi('aufgabeAnhang').'.'.qi('vermerk').', '.qi('aufgabeAnhang').'.'.qi('parent').',
			('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('canDelete').'
			FROM '.qi('aufgabeAnhang').' 
			WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND '.qi('aufgabeAnhang').'.'.qi('parent').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

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

  public static function fetchAufgabeEvent_create_state_defaultDynamicwf_aufgabeEvent_create_state_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('aufgabe').'.'.qi('state').') FROM '.qi('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AND '.qi('ID').' = ' . \FOP\Database::quote($id) . '')->fetchColumn();
		return $value === false ? null : $value;
	
    
  }

  public static function fetchAufgabeEvent_edit_state_defaultDynamicwf_aufgabeEvent_edit_state_defaultDynamicAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: main ---
    
	  header('Content-Type: application/json');
		// TODO: Komplexere Expressions brauchen ein Typsystem
		$value = \FOP\Database::query('SELECT ('.qi('aufgabe').'.'.qi('state').') FROM '.qi('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : '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\User::getIsGuest() ? 'false' : 'true').'') . ' FROM '.qi('aufgabe').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			if (\FOP\Database::query($sql)->fetchColumn() != 1) {
				return false;
			}
			
			$sql = 'DELETE FROM  '.qi('aufgabe').'  WHERE '.qi('ID').' = ' . \FOP\Database::quote($id);
			$result = \FOP\Database::query($sql);
			
			return true;
	
    
  }

  public static function assignListFop_listAction($row = null , $parent = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: before-prepare-parent ---
    
		if (!isset($parent)) $parent = [];
	
    // --- BLOCK: before-prepare-row ---
    
		if (!is_array($row)) {
			$parentrow = [];
			$row = \Tables\Aufgabe::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\Aufgabe::sanitizeDefaults($row, true, 'aufgabe', $parentrow);
		} else {
			
			$row['_ID'] = \Types\Integer::unpack($row['_ID']);			
			$row['canDelete'] = false;
		}
		
		
    // --- BLOCK: main ---
    
		?>
		<tr class='wfl-item'>
					<td class='mdl-data-table__cell--non-numeric'>
						<div>
							<?php if ($row['canDelete']) { ?>
							<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='$(this).closest("tr").fadeOut().find("input[name=&apos;fop_list[]&apos;]").val("0");'>
								<i class="material-icons">remove</i>
							</div>
							<?php } ?>
							<input type='hidden' name='fop_list[]' value='1'>
							<input type='hidden' name='fop_list_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
						</div>
					</td><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "ID": _ID
			--><td class='mdl-data-table__cell--non-numeric'><span><span style="white-space: nowrap; width: 100%; display: inline-block; text-align: right;"><?php echo htmlentities(\Types\Integer::print($row['_ID'])); ?>
	</span></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Betreff": title
			--><td class='mdl-data-table__cell--non-numeric'><span><span class='overflow-text' title="<?php echo htmlentities($row['title']); ?>"><?php echo htmlentities($row['title']); ?></span></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?></tr><?php
	
    
  }

  public static function createListAufgabeAnhang_parentAction($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\AufgabeAnhang::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\AufgabeAnhang::sanitizeDefaults($row, true, 'aufgabe', $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 ---
    
		?>
		<tr class='wfl-item'>
					<td class='mdl-data-table__cell--non-numeric'>
						<div>
							<?php if ($row['canDelete']) { ?>
							<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='$(this).closest("tr").fadeOut().find("input[name=&apos;aufgabeAnhang_parent[]&apos;]").val("0");'>
								<i class="material-icons">remove</i>
							</div>
							<?php } ?>
							<input type='hidden' name='aufgabeAnhang_parent[]' value='1'>
							<input type='hidden' name='aufgabeAnhang_parent_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
						</div>
					</td><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Datei": file
			--><td class='mdl-data-table__cell--non-numeric'><span>

	
		<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="aufgabeAnhang_parent_file[]" value="<?php echo htmlentities(\FOP\Files::getNextDummyCounter($row['file'])); ?>">
	</span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Vermerk": vermerk
			--><td class='mdl-data-table__cell--non-numeric'><span><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="aufgabeAnhang_parent_vermerk[]"  value="<?php echo htmlentities($row['vermerk']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?></tr><?php
	
    
  }

  public static function editListAufgabeAnhang_parentAction($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\AufgabeAnhang::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\AufgabeAnhang::sanitizeDefaults($row, true, 'aufgabe', $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 ---
    
		?>
		<tr class='wfl-item'>
					<td class='mdl-data-table__cell--non-numeric'>
						<div>
							<?php if ($row['canDelete']) { ?>
							<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='$(this).closest("tr").fadeOut().find("input[name=&apos;aufgabeAnhang_parent[]&apos;]").val("0");'>
								<i class="material-icons">remove</i>
							</div>
							<?php } ?>
							<input type='hidden' name='aufgabeAnhang_parent[]' value='1'>
							<input type='hidden' name='aufgabeAnhang_parent_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
						</div>
					</td><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Datei": file
			--><td class='mdl-data-table__cell--non-numeric'><span>

	
		<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="aufgabeAnhang_parent_file[]" value="<?php echo htmlentities(\FOP\Files::getNextDummyCounter($row['file'])); ?>">
	</span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?><?php
        // Unterscheidung Create/Edit
        if ($row['ID'] ? true : true) {
        	?><!-- Spalte "Vermerk": vermerk
			--><td class='mdl-data-table__cell--non-numeric'><span><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="aufgabeAnhang_parent_vermerk[]"  value="<?php echo htmlentities($row['vermerk']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span>
			</td><?php } else if (/* Create aber nicht edit: leere Zelle
			*/true || true) { ?><td>&nbsp;</td><?php } ?></tr><?php
	
    
  }

  public static function createMatrixMatrix_aufgabeProperty_parent_typeAction($id, $values, $typ) { 
    
    
    // --- 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['dateValue'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($item['dateValue']);
				$item['doubleValue'] = \Types\Double::parse($item['doubleValue']);
				$item['htmlValue'] = \FOP\Sanitizers::htmlentities_decode($item['htmlValue']);
				$item['aufgabePropertyDropdown2Value'] = \FOP\Sanitizers::null_filter($item['aufgabePropertyDropdown2Value']);
			});
		}
		// Aufbau: 1. options suchen
		if (isset($id) && $id != 'null') $parent = \Tables\Aufgabe::view($id, false, true);
		$deps = [];
		$deps['typ'] = $typ;
		$options = \FOP\Database::query('SELECT /* type */ '.qi('options').'.'.qi('ID').' AS '.qi('type').',
									/* type::canView */ '.qi('ref:type').'.'.qi('type:canView').' AS '.qi('type::canView').',
									/* type::description */ '.qi('ref:type').'.'.qi('type:description').' AS '.qi('type::description').',
									1
								FROM '.qi('aufgabePropertyType').' '.qi('options').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('type:ID').', '.qi('aufgabePropertyType').'.'.qi('name').' AS '.qi('type:description').', ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('type:canView').' FROM '.qi('aufgabePropertyType').') '.qi('ref:type').' ON '.qi('ref:type').'.'.qi('type:ID').' = '.qi('options').'.'.qi('ID').'
								WHERE ((('.qi('restrict').' = ' . intval($typ) . ')))')->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['dateValue'] = intval($value['dateValue']);
			$value['doubleValue'] = \Types\Double::unpack($value['doubleValue']);
			$value['aufgabePropertyDropdown2Value'] = \FOP\Sanitizers::null_converter($value['aufgabePropertyDropdown2Value']);
			$ticks[$value['type']] = $value;
		}
		// 3. options rendern (dabei ggf. Werte verarbeiten, wenn values dabei ist)
		$i = 0;
		foreach ($options AS $option) {
			

			if (isset($ticks[$option['type']])) {
				// getickt -> merge option + customvalues
				$value = $option + $ticks[$option['type']];
				unset($ticks[$option['type']]);
			} else {
				// ungetickt
				$value = \Tables\AufgabeProperty::getDefaults();
				if (isset($parent)) $value['parent'] = $parent['ID'];
				$value = array_merge($value, $option); // add option dimensions with descriptions
				$value['ID'] = '';
				\Tables\AufgabeProperty::sanitizeDefaults($value, true);
			}
			$value['_checked'] = true;
			?><tr ng-controller='FormGroupWf_aufgabe_createMatrix_aufgabeProperty_parent_type'
				ng-init="item=<?php echo htmlentities(json_encode(['checked' => true,
					'type' => $value['type']])); ?>;
				matrixRegisterMatrix_aufgabeProperty_parent_type(<?php echo htmlentities(json_encode($option['type'])); ?>, item)">
				<td class='mdl-data-table__cell--non-numeric'  style='display: none;'>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type[]' value="<?php echo htmlentities(($value['type'] ?? '')); ?>">
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='hidden' name="matrix_aufgabeProperty_parent_type__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $option['type'])); ?>" value='on'>
				</td>
				<td class='mdl-data-table__cell--non-numeric'>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_type[]' class='fop-dimension' value="<?php echo htmlentities($value['type'] ?? ''); ?>">
					<?php
	
	call_user_func(function () use ($value) {
	$id = $value['type'];
	$val = $value['type::description'];
	$canView = $value['type::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"aufgabePropertyType\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\AufgabePropertyType::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>

				</td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;text&apos;) == (item[&apos;DesVaCQB&apos;]))"><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="matrix_aufgabeProperty_parent_type_textValue[]"  value="<?php echo htmlentities($value['textValue']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;date&apos;) == (item[&apos;qlmkLYxD&apos;]))"><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="matrix_aufgabeProperty_parent_type_dateValue[]" type="text" name="matrix_aufgabeProperty_parent_type_dateValue[]" value="<?php echo ($value['dateValue']) ? strftime(_('dateformat_php2'), intval($value['dateValue'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;double&apos;) == (item[&apos;W8Efbkfa&apos;]))"><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Double::pattern()); ?>' class="mdl-textfield__input" name="matrix_aufgabeProperty_parent_type_doubleValue[]"  value="<?php echo \Types\Double::print($value['doubleValue']); ?>" fop-numeric='-1' fop-numeric-decimal='<?php echo htmlentities(\Types\Double::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Double::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 && ((&apos;html&apos;) == (item[&apos;GIuNXQJJ&apos;]))">
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="matrix_aufgabeProperty_parent_type_htmlValue[]" class="html-html"><?php echo htmlentities($value['htmlValue']); ?></textarea>
	</div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;aufgabePropertyDropdown2&apos;) == (item[&apos;zxF57KrA&apos;]))"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"property": item[&apos;type&apos;]}' endpoint='Tables/AufgabePropertyDropdown/renderEditformarray_wf_aufgabe_create_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value' condition=''><?php
	\Tables\AufgabePropertyDropdown::renderEditformarray_wf_aufgabe_create_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2ValueAction($value['aufgabePropertyDropdown2Value'], ['property' => $row['type'], 'property' => $value['type']], '');
?></span> &nbsp;	<?php if (\TablesRouter\AufgabePropertyDropdown::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\AufgabePropertyDropdown::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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\AufgabePropertyDropdown::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabePropertyDropdown2&deps_aufgabePropertyDropdown_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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_aufgabe_createMatrix_aufgabeProperty_parent_type' style='display: none;' ng-init="item =<?php echo htmlentities(json_encode(['checked' => true,
					'type' => $value['type']])); ?>;
				"><td>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type[]' value="<?php echo htmlentities(($value['type'] ?? '')); ?>">
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='checkbox' name='matrix_aufgabeProperty_parent_type__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $value['type'])); ?>' class='matrix_checkbox' <?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_type[]' value="<?php echo htmlentities($value['type'] ?? ''); ?>">
				</td>
				
					<td class='mdl-data-table__cell--non-numeric'><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="matrix_aufgabeProperty_parent_type_textValue[]"  value="<?php echo htmlentities($value['textValue']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></td>
					<td class='mdl-data-table__cell--non-numeric'><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="matrix_aufgabeProperty_parent_type_dateValue[]" type="text" name="matrix_aufgabeProperty_parent_type_dateValue[]" value="<?php echo ($value['dateValue']) ? strftime(_('dateformat_php2'), intval($value['dateValue'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></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\Double::pattern()); ?>' class="mdl-textfield__input" name="matrix_aufgabeProperty_parent_type_doubleValue[]"  value="<?php echo \Types\Double::print($value['doubleValue']); ?>" fop-numeric='-1' fop-numeric-decimal='<?php echo htmlentities(\Types\Double::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Double::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 tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="matrix_aufgabeProperty_parent_type_htmlValue[]" class="html-html"><?php echo htmlentities($value['htmlValue']); ?></textarea>
	</div></td>
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"property": item[&apos;type&apos;]}' endpoint='Tables/AufgabePropertyDropdown/renderEditformarray_wf_aufgabe_create_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value' condition=''><?php
	\Tables\AufgabePropertyDropdown::renderEditformarray_wf_aufgabe_create_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2ValueAction($value['aufgabePropertyDropdown2Value'], ['property' => $row['type'], 'property' => $value['type']], '');
?></span> &nbsp;	<?php if (\TablesRouter\AufgabePropertyDropdown::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\AufgabePropertyDropdown::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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\AufgabePropertyDropdown::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabePropertyDropdown2&deps_aufgabePropertyDropdown_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></td>
			</tr><?php
		}
	
    
  }

  public static function editMatrixMatrix_aufgabeProperty_parent_typeAction($id, $values, $typ) { 
    
    
    // --- 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['dateValue'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($item['dateValue']);
				$item['doubleValue'] = \Types\Double::parse($item['doubleValue']);
				$item['htmlValue'] = \FOP\Sanitizers::htmlentities_decode($item['htmlValue']);
				$item['aufgabePropertyDropdown2Value'] = \FOP\Sanitizers::null_filter($item['aufgabePropertyDropdown2Value']);
			});
		}
		// Aufbau: 1. options suchen
		if (isset($id) && $id != 'null') $parent = \Tables\Aufgabe::view($id, false, true);
		$deps = [];
		$deps['typ'] = $typ;
		$options = \FOP\Database::query('SELECT /* type */ '.qi('options').'.'.qi('ID').' AS '.qi('type').',
									/* type::canView */ '.qi('ref:type').'.'.qi('type:canView').' AS '.qi('type::canView').',
									/* type::description */ '.qi('ref:type').'.'.qi('type:description').' AS '.qi('type::description').',
									1
								FROM '.qi('aufgabePropertyType').' '.qi('options').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('type:ID').', '.qi('aufgabePropertyType').'.'.qi('name').' AS '.qi('type:description').', ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('type:canView').' FROM '.qi('aufgabePropertyType').') '.qi('ref:type').' ON '.qi('ref:type').'.'.qi('type:ID').' = '.qi('options').'.'.qi('ID').'
								WHERE ((('.qi('restrict').' = ' . intval($typ) . ')))')->fetchAll(\PDO::FETCH_ASSOC);
		// 2. values resanitizen und umschaufeln in ein asso-Array, aus dem man herausstreichen kann
		$ticks = [];
		foreach ($values AS $value) {
			
			$value['dateValue'] = intval($value['dateValue']);
			$value['doubleValue'] = \Types\Double::unpack($value['doubleValue']);
			$value['aufgabePropertyDropdown2Value'] = \FOP\Sanitizers::null_converter($value['aufgabePropertyDropdown2Value']);
			$ticks[$value['type']] = $value;
		}
		// 3. options rendern (dabei ggf. Werte verarbeiten, wenn values dabei ist)
		$i = 0;
		foreach ($options AS $option) {
			

			if (isset($ticks[$option['type']])) {
				// getickt -> merge option + customvalues
				$value = $option + $ticks[$option['type']];
				unset($ticks[$option['type']]);
			} else {
				// ungetickt
				$value = \Tables\AufgabeProperty::getDefaults();
				if (isset($parent)) $value['parent'] = $parent['ID'];
				$value = array_merge($value, $option); // add option dimensions with descriptions
				$value['ID'] = '';
				\Tables\AufgabeProperty::sanitizeDefaults($value, true);
			}
			$value['_checked'] = true;
			?><tr ng-controller='FormGroupWf_aufgabe_editMatrix_aufgabeProperty_parent_type'
				ng-init="item=<?php echo htmlentities(json_encode(['checked' => true,
					'type' => $value['type']])); ?>;
				matrixRegisterMatrix_aufgabeProperty_parent_type(<?php echo htmlentities(json_encode($option['type'])); ?>, item)">
				<td class='mdl-data-table__cell--non-numeric'  style='display: none;'>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type[]' value="<?php echo htmlentities(($value['type'] ?? '')); ?>">
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='hidden' name="matrix_aufgabeProperty_parent_type__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $option['type'])); ?>" value='on'>
				</td>
				<td class='mdl-data-table__cell--non-numeric'>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_type[]' class='fop-dimension' value="<?php echo htmlentities($value['type'] ?? ''); ?>">
					<?php
	
	call_user_func(function () use ($value) {
	$id = $value['type'];
	$val = $value['type::description'];
	$canView = $value['type::canView'];
	if ($val !== null) {
		if ($canView) echo "<a tabindex=\"-1\" class=\"mdl-button mdl-button-small tbl-link\" data-tbl=\"aufgabePropertyType\" data-id=\"".htmlentities($id)."\" onclick=\"event.stopPropagation(); event.preventDefault(); open_url(this.href, false);\" href=\"" . \TablesRouter\AufgabePropertyType::viewURL($id, ['from' => \FOP\Util::getBackURL()]) . "\">(…)</a>";echo htmlentities($val);
	} else {
		echo htmlentities(_('') ?: '-');
	}
	});
	
?>

				</td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;text&apos;) == (item[&apos;DesVaCQB&apos;]))"><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="matrix_aufgabeProperty_parent_type_textValue[]"  value="<?php echo htmlentities($value['textValue']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;date&apos;) == (item[&apos;qlmkLYxD&apos;]))"><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="matrix_aufgabeProperty_parent_type_dateValue[]" type="text" name="matrix_aufgabeProperty_parent_type_dateValue[]" value="<?php echo ($value['dateValue']) ? strftime(_('dateformat_php2'), intval($value['dateValue'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;double&apos;) == (item[&apos;W8Efbkfa&apos;]))"><div class="mdl-textfield mdl-js-textfield fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Double::pattern()); ?>' class="mdl-textfield__input" name="matrix_aufgabeProperty_parent_type_doubleValue[]"  value="<?php echo \Types\Double::print($value['doubleValue']); ?>" fop-numeric='-1' fop-numeric-decimal='<?php echo htmlentities(\Types\Double::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Double::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 && ((&apos;html&apos;) == (item[&apos;GIuNXQJJ&apos;]))">
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="matrix_aufgabeProperty_parent_type_htmlValue[]" class="html-html"><?php echo htmlentities($value['htmlValue']); ?></textarea>
	</div></span></td><td class='mdl-data-table__cell--non-numeric'><span ng-show="item.checked && ((&apos;aufgabePropertyDropdown2&apos;) == (item[&apos;zxF57KrA&apos;]))"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"property": item[&apos;type&apos;]}' endpoint='Tables/AufgabePropertyDropdown/renderEditformarray_wf_aufgabe_edit_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value' condition=''><?php
	\Tables\AufgabePropertyDropdown::renderEditformarray_wf_aufgabe_edit_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2ValueAction($value['aufgabePropertyDropdown2Value'], ['property' => $row['type'], 'property' => $value['type']], '');
?></span> &nbsp;	<?php if (\TablesRouter\AufgabePropertyDropdown::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\AufgabePropertyDropdown::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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\AufgabePropertyDropdown::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabePropertyDropdown2&deps_aufgabePropertyDropdown_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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_aufgabe_editMatrix_aufgabeProperty_parent_type' style='display: none;' ng-init="item =<?php echo htmlentities(json_encode(['checked' => true,
					'type' => $value['type']])); ?>;
				"><td>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type[]' value="<?php echo htmlentities(($value['type'] ?? '')); ?>">
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_ID[]' value="<?php echo htmlentities($value['ID']); ?>">
					<input type='checkbox' name='matrix_aufgabeProperty_parent_type__<?php echo htmlentities(preg_replace('/[^a-zA-Z_0-9]/', '', $value['type'])); ?>' class='matrix_checkbox' <?php if (isset($value['_checked'])) { echo ' checked'; } ?>>
					<input type='hidden' name='matrix_aufgabeProperty_parent_type_type[]' value="<?php echo htmlentities($value['type'] ?? ''); ?>">
				</td>
				
					<td class='mdl-data-table__cell--non-numeric'><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="matrix_aufgabeProperty_parent_type_textValue[]"  value="<?php echo htmlentities($value['textValue']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div></td>
					<td class='mdl-data-table__cell--non-numeric'><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="matrix_aufgabeProperty_parent_type_dateValue[]" type="text" name="matrix_aufgabeProperty_parent_type_dateValue[]" value="<?php echo ($value['dateValue']) ? strftime(_('dateformat_php2'), intval($value['dateValue'])) : ''; ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></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\Double::pattern()); ?>' class="mdl-textfield__input" name="matrix_aufgabeProperty_parent_type_doubleValue[]"  value="<?php echo \Types\Double::print($value['doubleValue']); ?>" fop-numeric='-1' fop-numeric-decimal='<?php echo htmlentities(\Types\Double::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Double::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 tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	
	<textarea ng-non-bindable rows="22" cols="50" name="matrix_aufgabeProperty_parent_type_htmlValue[]" class="html-html"><?php echo htmlentities($value['htmlValue']); ?></textarea>
	</div></td>
					<td class='mdl-data-table__cell--non-numeric'><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><span style="width: 100%; max-width: 300px;" value='' select-updater='{"property": item[&apos;type&apos;]}' endpoint='Tables/AufgabePropertyDropdown/renderEditformarray_wf_aufgabe_edit_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value' condition=''><?php
	\Tables\AufgabePropertyDropdown::renderEditformarray_wf_aufgabe_edit_matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2ValueAction($value['aufgabePropertyDropdown2Value'], ['property' => $row['type'], 'property' => $value['type']], '');
?></span> &nbsp;	<?php if (\TablesRouter\AufgabePropertyDropdown::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\AufgabePropertyDropdown::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26close%26insert_param=colvalue&column_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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\AufgabePropertyDropdown::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=aufgabePropertyDropdown2%26colinsert=matrix_aufgabeProperty_parent_type_aufgabePropertyDropdown2Value[]%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=aufgabePropertyDropdown2&deps_aufgabePropertyDropdown_property=" + encodeURIComponent($(this).scope().$eval("item[\&apos;type\&apos;]")) + "", "_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('aufgabe').'(';
				
				$set = [];
				
					
					$set[qi('repeat')] = \FOP\Database::quote($data['repeat']);
					
				
					
					$set[qi('assigned')] = \FOP\Database::quote($data['assigned']);
					
				
					if ($disregardPermissions || (((false)))) {
					
					$set[qi('creator')] = \FOP\Database::quote($data['creator']);
					} else {
						$set[qi('creator')] = \FOP\Database::quote(\FOP\Sanitizers::null_filter((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.qi('3rcBmoN5').'.'.qi('ID').') FROM '.qi('mitglied').' '.qi('3rcBmoN5').' WHERE TRUE AND ((SELECT (('.qi('Wc5gFFoq').'.'.qi('ID').') = ('.\FOP\Database::sessionVarSQL('user').')) FROM '.qi('mitglied').' '.qi('Wc5gFFoq').' WHERE '.qi('Wc5gFFoq').'.'.qi('ID').' = '.qi('3rcBmoN5').'.'.qi('ID').' LIMIT 1))')->fetchColumn()))));
					}
				
					
					$set[qi('typ')] = \FOP\Database::quote($data['typ']);
					
				
					
					$set[qi('title')] = \FOP\Database::quote($data['title']);
					
				
					
					$set[qi('state')] = \FOP\Database::quote($data['state']);
					
				
					
					$set[qi('deadline')] = \FOP\Database::quote($data['deadline']);
					
				
					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()));
					}
				
					
					$set[qi('details')] = \FOP\Database::quote($data['details']);
					
				
					
					$set[qi('start')] = \FOP\Database::quote($data['start']);
					
				
				$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('aufgabe').'.'.qi('ID').' AS '.qi('ID').',
									/* _ID */ '.qi('aufgabe').'.'.qi('ID').' AS '.qi('_ID').',
									/* _anhang */ EXISTS (SELECT (TRUE) FROM '.qi('aufgabeAnhang').' '.qi('XuVoGrVc').' WHERE '.qi('XuVoGrVc').'.'.qi('parent').' = '.qi('aufgabe').'.'.qi('ID').' LIMIT 1) AS '.qi('_anhang').',
									/* assigned */ '.qi('aufgabe').'.'.qi('assigned').' AS '.qi('assigned').',
									/* assigned::canView */ '.qi('ref:assigned').'.'.qi('assigned:canView').' AS '.qi('assigned::canView').',
									/* assigned::description */ '.qi('ref:assigned').'.'.qi('assigned:description').' AS '.qi('assigned::description').',
									/* creation */ '.qi('aufgabe').'.'.qi('creation').' AS '.qi('creation').',
									/* creation::canEdit */ (FALSE) AS '.qi('creation::canEdit').',
									/* creator */ '.qi('aufgabe').'.'.qi('creator').' AS '.qi('creator').',
									/* creator::canEdit */ (FALSE) AS '.qi('creator::canEdit').',
									/* creator::canView */ '.qi('ref:creator').'.'.qi('creator:canView').' AS '.qi('creator::canView').',
									/* creator::description */ '.qi('ref:creator').'.'.qi('creator:description').' AS '.qi('creator::description').',
									/* deadline */ '.qi('aufgabe').'.'.qi('deadline').' AS '.qi('deadline').',
									/* details */ '.qi('aufgabe').'.'.qi('details').' AS '.qi('details').',
									/* operation::create */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::create').',
									/* operation::delete */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::delete').',
									/* operation::edit */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ '.(\FOP\User::getIsGuest() ? 'false' : 'true').' AS '.qi('operation::view').',
									/* repeat */ '.qi('aufgabe').'.'.qi('repeat').' AS '.qi('repeat').',
									/* start */ '.qi('aufgabe').'.'.qi('start').' AS '.qi('start').',
									/* state */ '.qi('aufgabe').'.'.qi('state').' AS '.qi('state').',
									/* state::canView */ '.qi('ref:state').'.'.qi('state:canView').' AS '.qi('state::canView').',
									/* state::description */ '.qi('ref:state').'.'.qi('state:description').' AS '.qi('state::description').',
									/* title */ '.qi('aufgabe').'.'.qi('title').' AS '.qi('title').',
									/* typ */ '.qi('aufgabe').'.'.qi('typ').' AS '.qi('typ').',
									/* typ::canView */ '.qi('ref:typ').'.'.qi('typ:canView').' AS '.qi('typ::canView').',
									/* typ::description */ '.qi('ref:typ').'.'.qi('typ:description').' AS '.qi('typ::description').',
									1
								FROM '.qi('aufgabe').' '.qi('aufgabe').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('typ:ID').', '.qi('aufgabeType').'.'.qi('name').' AS '.qi('typ:description').', ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('typ:canView').' FROM '.qi('aufgabeType').') '.qi('ref:typ').' ON '.qi('ref:typ').'.'.qi('typ:ID').' = '.qi('aufgabe').'.'.qi('typ').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('state:ID').', '.qi('aufgabeState').'.'.qi('name').' AS '.qi('state:description').', ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') AS '.qi('state:canView').' FROM '.qi('aufgabeState').') '.qi('ref:state').' ON '.qi('ref:state').'.'.qi('state:ID').' = '.qi('aufgabe').'.'.qi('state').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('creator:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('creator:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('creator:canView').' FROM '.qi('mitglied').') '.qi('ref:creator').' ON '.qi('ref:creator').'.'.qi('creator:ID').' = '.qi('aufgabe').'.'.qi('creator').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('assigned:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('assigned:description').', ((CASE WHEN '.\FOP\Database::quote(\FOP\User::getGruppe()).' THEN TRUE ELSE NOT (('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getMitglied()).' THEN TRUE ELSE NOT ((('.qi('mitglied').'.'.qi('ID').') <> ('.\FOP\Database::sessionVarSQL('user').')) AND (NOT (EXISTS (SELECT (TRUE) FROM '.qi('gruppeItem').' '.qi('7sncgH3z').' WHERE '.qi('7sncgH3z').'.'.qi('item').' = '.qi('mitglied').'.'.qi('ID').' AND (EXISTS (SELECT (TRUE) FROM '.qi('gruppeVerantwortlich').' '.qi('eHueOsQC').' WHERE '.qi('eHueOsQC').'.'.qi('gruppe').' = '.qi('7sncgH3z').'.'.qi('list').' AND (('.qi('eHueOsQC').'.'.qi('mitglied').') = ('.\FOP\Database::sessionVarSQL('user').')) LIMIT 1)) LIMIT 1)))) END) AND (CASE WHEN '.\FOP\Database::quote(\FOP\User::getSuperadmin()).' THEN TRUE ELSE NOT ('.qi('mitglied').'.'.qi('superadmin').') END)) AS '.qi('assigned:canView').' FROM '.qi('mitglied').') '.qi('ref:assigned').' ON '.qi('ref:assigned').'.'.qi('assigned:ID').' = '.qi('aufgabe').'.'.qi('assigned').'
								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['repeat'] = \FOP\Util::IntStringNull($row['repeat']);
		$row['assigned'] = \FOP\Sanitizers::null_converter($row['assigned']);
		$row['creator'] = \FOP\Sanitizers::null_converter($row['creator']);
		$row['_ID'] = \Types\Integer::unpack($row['_ID']);
		$row['_anhang'] = \FOP\Util::BoolSanitizer($row['_anhang']);
		$row['typ'] = \FOP\Sanitizers::null_converter($row['typ']);
		$row['state'] = \FOP\Sanitizers::null_converter($row['state']);
		$row['deadline'] = intval($row['deadline']);
		$row['creation'] = intval($row['creation']);
		$row['start'] = intval($row['start']);
		

		if($snippet){
			$row['repeat'] = (\Types\AufgabeRepeat::toString($row['repeat']));
			$row['assigned'] = (
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['assigned']))->fetchColumn() ?: _('Niemand zugewiesen')
);
			$row['creator'] = (
  \FOP\Database::query('SELECT CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS description FROM '.qi('mitglied').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['creator']))->fetchColumn() ?: _('')
);
			$row['_ID'] = (\Types\Integer::print($row['_ID'])
	);
			$row['_anhang'] = ($row['_anhang']);
			$row['typ'] = (
  \FOP\Database::query('SELECT '.qi('aufgabeType').'.'.qi('name').' AS description FROM '.qi('aufgabeType').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['typ']))->fetchColumn() ?: _('')
);
			$row['title'] = ($row['title']);
			$row['state'] = (
  \FOP\Database::query('SELECT '.qi('aufgabeState').'.'.qi('name').' AS description FROM '.qi('aufgabeState').' WHERE '.qi('ID').' = ' . \FOP\Database::quote($row['state']))->fetchColumn() ?: _('')
);
			$row['deadline'] = (($row['deadline']) ? strftime(_('dateformat_php2'), intval($row['deadline'])) : '');
			$row['creation'] = (($row['creation']) ? strftime(_('dateformat_php2'), intval($row['creation'])) : '');
			$row['details'] = (mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($row['details'])))), 0, 20) . (strlen($row['details']) >= 20 ? '...' : ''));
			$row['start'] = (($row['start']) ? strftime(_('dateformat_php2'), intval($row['start'])) : '');
			
		}


		return $row;

    
  }

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

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

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

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

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

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

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

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

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

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

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

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

  public static function searchOptionsform_wf_aufgabeProperty_edit_parentAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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: assigned
			if (!$data['assigned']) {
				$data['assigned'] = $sanitizeForForms ? '0' : null;
			}
		
		// column: creation
		
		// column: creator
			if (!$data['creator']) {
				// replace forbidden NULL values
				$items = \Types\Mitglied::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['creator'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: details
		
		// column: repeat
		
		// column: start
		
		// column: state
			if (!$data['state']) {
				// replace forbidden NULL values
				$items = \Types\AufgabeState::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['state'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: title
		
		// column: typ
			if (!$data['typ']) {
				// replace forbidden NULL values
				$items = \Types\AufgabeType::getItems([], null);
				$best = -INF;
				foreach ($items as $item) /* TODO: InputFieldLoadCondition: if (!$condition || $item[$condition]) */ {
					if ($item['priority'] > $best) {
						$data['typ'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		// column: deadline
			// set DefaultDynamic value
			if ($data['deadline'] == $virginData['deadline']) {
				$data['deadline'] = ((0) == ((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.qi('XVA7KFaU').'.'.qi('deadline').') FROM '.qi('aufgabeType').' '.qi('XVA7KFaU').' WHERE '.qi('XVA7KFaU').'.'.qi('ID').' = ' . \FOP\Database::quote($data['typ']) . '')->fetchColumn())))) ? (NULL) : ((round((time()) / 86400) * 86400) + ((((24) * (60)) * (60)) * ((\FOP\Util::FalseToNull(\FOP\Database::query('SELECT ('.qi('g3zTeQ0S').'.'.qi('deadline').') FROM '.qi('aufgabeType').' '.qi('g3zTeQ0S').' WHERE '.qi('g3zTeQ0S').'.'.qi('ID').' = ' . \FOP\Database::quote($data['typ']) . '')->fetchColumn())))));
			}
			
		
		if ($sanitizeForForms) {
			
			$data['repeat'] = \FOP\Util::IntStringNull($data['repeat']);
			$data['assigned'] = \FOP\Sanitizers::null_converter($data['assigned']);
			$data['creator'] = \FOP\Sanitizers::null_converter($data['creator']);
			$data['typ'] = \FOP\Sanitizers::null_converter($data['typ']);
			$data['state'] = \FOP\Sanitizers::null_converter($data['state']);
			$data['deadline'] = intval($data['deadline']);
			$data['creation'] = intval($data['creation']);
			$data['start'] = intval($data['start']);
		}
	
    
  }

  public static function edit($id, $data, $ignoreUniqueConstraints = false , $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
				
				$set = [];
				
					
					if (array_key_exists('repeat', $data)) {
						array_push($set, qi('repeat').' = ' . \FOP\Database::quote($data['repeat']));
					}
				
					
					if (array_key_exists('assigned', $data)) {
						array_push($set, qi('assigned').' = ' . \FOP\Database::quote($data['assigned']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('creator', $data)) {
						array_push($set, qi('creator').' = ' . \FOP\Database::quote($data['creator']));
					}
				
					
					if (array_key_exists('typ', $data)) {
						array_push($set, qi('typ').' = ' . \FOP\Database::quote($data['typ']));
					}
				
					
					if (array_key_exists('title', $data)) {
						array_push($set, qi('title').' = ' . \FOP\Database::quote($data['title']));
					}
				
					if ($disregardPermissions || (!\FOP\User::getIsGuest()))
					
					if (array_key_exists('state', $data)) {
						array_push($set, qi('state').' = ' . \FOP\Database::quote($data['state']));
					}
				
					if ($disregardPermissions || (!\FOP\User::getIsGuest()))
					
					if (array_key_exists('deadline', $data)) {
						array_push($set, qi('deadline').' = ' . \FOP\Database::quote($data['deadline']));
					}
				
					if ($disregardPermissions || ((false)))
					
					if (array_key_exists('creation', $data)) {
						array_push($set, qi('creation').' = ' . \FOP\Database::quote($data['creation']));
					}
				
					
					if (array_key_exists('details', $data)) {
						array_push($set, qi('details').' = ' . \FOP\Database::quote($data['details']));
					}
				
					
					if (array_key_exists('start', $data)) {
						array_push($set, qi('start').' = ' . \FOP\Database::quote($data['start']));
					}
				;
				
				if (count($set)) {
					try {
						\FOP\Database::query('UPDATE '.qi('aufgabe').' 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 renderEditaufgabeEvent_ticket_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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_aufgabeEvent_ticket" 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/Aufgabe/searchOptionsaufgabeEvent_ticket_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 renderEditaufgabeAnhang_parent_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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_aufgabeAnhang_parent" 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/Aufgabe/searchOptionsaufgabeAnhang_parent_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 renderEditaufgabeProperty_parent_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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_aufgabeProperty_parent" 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/Aufgabe/searchOptionsaufgabeProperty_parent_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_aufgabe_create_matrix_aufgabeProperty_parent_type_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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_aufgabeProperty_parent_type_parent[]" 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/Aufgabe/searchOptionsformarray_wf_aufgabe_create_matrix_aufgabeProperty_parent_type_parent?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_aufgabe_edit_matrix_aufgabeProperty_parent_type_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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_aufgabeProperty_parent_type_parent[]" 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/Aufgabe/searchOptionsformarray_wf_aufgabe_edit_matrix_aufgabeProperty_parent_type_parent?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_aufgabe_create_aufgabeAnhang_parent_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="aufgabeAnhang_parent_parent[]" 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/Aufgabe/searchOptionsformarray_wf_aufgabe_create_aufgabeAnhang_parent_parent?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_aufgabe_edit_aufgabeAnhang_parent_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="aufgabeAnhang_parent_parent[]" 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/Aufgabe/searchOptionsformarray_wf_aufgabe_edit_aufgabeAnhang_parent_parent?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 renderEditform_wf_aufgabeEvent_create_ticketAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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;ticket&apos;]' class="selectdropdown mdlext-selectfield__select" name="ticket" 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;ticket&apos;]' fop-type='Aufgabe' 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/Aufgabe/searchOptionsform_wf_aufgabeEvent_create_ticket?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 renderEditform_wf_aufgabeAnhang_create_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="parent" 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/Aufgabe/searchOptionsform_wf_aufgabeAnhang_create_parent?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 renderEditform_wf_aufgabeProperty_create_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="parent" 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/Aufgabe/searchOptionsform_wf_aufgabeProperty_create_parent?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 renderEditform_wf_aufgabeEvent_edit_ticketAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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;ticket&apos;]' class="selectdropdown mdlext-selectfield__select" name="ticket" 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;ticket&apos;]' fop-type='Aufgabe' 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/Aufgabe/searchOptionsform_wf_aufgabeEvent_edit_ticket?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 renderEditform_wf_aufgabeAnhang_edit_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="parent" 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/Aufgabe/searchOptionsform_wf_aufgabeAnhang_edit_parent?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 renderEditform_wf_aufgabeProperty_edit_parentAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Aufgabe::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="parent" 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/Aufgabe/searchOptionsform_wf_aufgabeProperty_edit_parent?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 deleteAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-itemlist-aufgabe-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('aufgabe').' WHERE ('.(\FOP\User::getIsGuest() ? 'false' : 'true').') 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\Aufgabe::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null])); // open delete confirm window when something went wrong
					}
					// TODO: I18n
					header('Location: ' . \TablesRouter\Aufgabe::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\Aufgabe::indexURL()) . $addition);
		die();
	
    
  }

  public static function indexAction() { 
    
    
    // --- BLOCK: access ---
    if(!((!\FOP\User::getIsGuest()) && (!\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(_('Aufgaben')); ?></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(_('Aufgaben')); ?></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(_('Aufgaben')); ?></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-aufgabe"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormAufgabe" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\AufgabeProperty::renderScript(); ?><?php \DataView\Aufgabe::renderScript(); ?>
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'main_properties_table',
										'title' => _('Eigenschaften'),
										'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 (true && (true)) {
									$feature = [
										'id' => 'main_table',
										'title' => _('Aufgaben'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'tab', // tab (52) / 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 = \'aufgabe\' 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_properties_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="aufgabeProperty-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadaufgabeProperty()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\AufgabeProperty::renderTabTableAction();
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['main_properties_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main_table']);
										?>
	<?php if ((!\FOP\User::getIsGuest()) && (!\FOP\User::getIsGuest())) { ?>
	<div id="aufgabe-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadaufgabe()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Aufgabe::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-aufgabe').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-aufgabe').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-aufgabe').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=aufgabe&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=aufgabe&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-aufgabe')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-aufgabe 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
    
  }


  
  

  
  
}



