<?php

namespace Tables;

class Protokoll {
  
  

  
  

    // --- Statische Methoden ---
  
  public static function getDefaults() { 
    
    
    // --- BLOCK: main ---
    
	// erstellt ein leeres Objekt zum Befüllen mit Daten oder als Default fürs Create-Formular
	$data = ['date' => null,
		'bez' => '',
		'count' => 0,
		'content' => '',
		'leiter' => \FOP\User::getID(),
		'creator' => \FOP\User::getID()];
	return $data;
	
    
  }

  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::getProtokoll())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		

		
		/* Sanitizer */

		

		
	}
	
    // --- BLOCK: access-itemlist-protokoll-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('protokoll').' WHERE (('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) 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_doc_to-protokoll ---
    
		if (isset($_POST['move_doc_to-protokoll'])) {
			\Types\ProtokollNullDMS::validate($_POST['value_doc_to-protokoll']);
			$_POST['value_doc_to-protokoll'] = \FOP\Sanitizers::null_filter($_POST['value_doc_to-protokoll']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('doc').' SET '.qi('to-protokoll').' = ' . \FOP\Database::quote($_POST['value_doc_to-protokoll']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('to-protokoll').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('doc').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('to-protokoll').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\Doc::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_protokollPunkt_protokoll ---
    
		if (isset($_POST['move_protokollPunkt_protokoll'])) {
			\Types\Protokoll::validate($_POST['value_protokollPunkt_protokoll']);
			$_POST['value_protokollPunkt_protokoll'] = \FOP\Sanitizers::null_filter($_POST['value_protokollPunkt_protokoll']);
			
			// ignore duplicate entries
			\FOP\Database::query('UPDATE IGNORE '.qi('protokollPunkt').' SET '.qi('protokoll').' = ' . \FOP\Database::quote($_POST['value_protokollPunkt_protokoll']) . ' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('protokoll').''));
			// iterate over remaining
			\FOP\Database::commitTransaction();
			$remaining = \FOP\Database::query('SELECT '.qi('ID').' FROM '.qi('protokollPunkt').' WHERE ' . (new \FOP\IDList($id))->toSQL(''.qi('protokoll').''))->fetchAll(\PDO::FETCH_COLUMN);
			if ($remaining) {
				// ask to delete remaining
				// TODO: I18n
				header('Location: ' . \TablesRouter\ProtokollPunkt::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\Protokoll::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\Protokoll::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\Protokoll::deleteConfirmURL2(['popup' => $_GET['popup'] ?? null, 'id' => $id]); ?>"
									method="post"
									enctype="multipart/form-data" ng-submit='submit($event)'
								 
								id="cardform-wf_protokoll_deleteConfirm"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_protokoll_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:protokoll: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('protokollPunkt').' WHERE ' . $id->toSQL(''.qi('protokoll').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletiondeniedcascade') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\ProtokollPunkt::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Protokoll-Punkt')) . ' ' . $item['desc'])) . '</a>';
				if (\TablesRouter\ProtokollPunkt::deleteAccess($item['ID'])) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\ProtokollPunkt::deleteConfirmURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])) . '">' . htmlentities(_('delete')) . '</a>';
				}
			echo '<br>';
		}
		if (count($items)) {
			$foundProblems = true;
			
				echo htmlentities(_('deletemove'));
				?>: <div style="display: inline-block;" class="novalidate"><div style='display: flex; flex-direction: row; align-items: center; width: 100%;'><?php
	\Tables\Protokoll::renderEditprotokollPunkt_protokoll_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Protokoll::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\Protokoll::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=protokoll%26colinsert=value_protokollPunkt_protokoll%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\Protokoll::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=protokoll%26colinsert=value_protokollPunkt_protokoll%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=protokoll", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_protokollPunkt_protokoll" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			if (count($items) > 1) {
				// use array of IDs as parameter since deleteAccess calls them with new \FOP\IDList()
				if (\TablesRouter\ProtokollPunkt::deleteAccess(array_map(function ($item) {return $item['ID'];}, $items))) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\ProtokollPunkt::deleteConfirmURL((new \FOP\IDList(array_map(function ($item) {return $item['ID'];}, $items)))->toString(), ['from' => \FOP\Util::getBackUrl()])) . '">' . count($items) . '× ' . htmlentities(_('delete')) . '</a>';
				}
			}
			echo '<hr><br>';
		}
	
		$items = \FOP\Database::query('SELECT '.qi('ID').' AS '.qi('ID').', '.qi('ID').' AS '.qi('desc').' FROM '.qi('doc').' WHERE ' . $id->toSQL(''.qi('to-protokoll').''))->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($items AS $item) {
			echo _('deletionsetnull') . '
				<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Doc::viewURL($item['ID'])) . '">' . htmlentities(sprintf(_('view %s'), htmlentities(_('Dokument')) . ' ' . $item['desc'])) . '</a>';
				if (\TablesRouter\Doc::deleteAccess($item['ID'])) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Doc::deleteConfirmURL($item['ID'], ['from' => \FOP\Util::getBackUrl()])) . '">' . htmlentities(_('delete')) . '</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\Protokoll::renderEditdoc_to_protokoll_deletecascadeAction(null, [], '');
?> &nbsp;	<?php if (\TablesRouter\Protokoll::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\Protokoll::createURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=protokollNullDMS%26colinsert=value_doc_to-protokoll%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\Protokoll::indexURL2([
			'popup' => true]
		)); ?> + "&from=<?php echo urlencode(\FOP\Util::getCurrentBaseurl()); ?>jscloser.php?action=popup%26type=protokollNullDMS%26colinsert=value_doc_to-protokoll%26el=" + encodeURIComponent(id) + "%26insert_param=colvalue&select=protokollNullDMS", "_blank", "width=739, height=395"); return false;'><i class="material-icons">search</i></a>
	</div></div>
				<button type="submit" name="move_doc_to-protokoll" class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised"><?php echo count($items) . '× ' . htmlentities(_('deletemove')); ?></button>&nbsp;&nbsp;
			<?php 
			if (count($items) > 1) {
				// use array of IDs as parameter since deleteAccess calls them with new \FOP\IDList()
				if (\TablesRouter\Doc::deleteAccess(array_map(function ($item) {return $item['ID'];}, $items))) {
					echo '<a class="mdl-button mdl-js-button mdl-button--colored mdl-button--raised" href="' . htmlentities(\TablesRouter\Doc::deleteConfirmURL((new \FOP\IDList(array_map(function ($item) {return $item['ID'];}, $items)))->toString(), ['from' => \FOP\Util::getBackUrl()])) . '">' . count($items) . '× ' . htmlentities(_('delete')) . '</a>';
				}
			}
			echo '<hr><br>';
		}
	
?></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_protokoll_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_protokoll_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() . '× ' . _('Protokoll') . ')'; ?><?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%3Aprotokoll%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%3Aprotokoll%3AdeleteConfirm&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_protokoll_deleteConfirm')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_protokoll_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-protokoll')['from'] ?? null)) {
					header('Location: ' . $to);
					die();
				}
				if (!\TablesRouter\Protokoll::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\Protokoll::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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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-protokoll')) { ?>
	<?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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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-protokoll')) { ?>
	<?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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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\Protokoll::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_protokoll_view"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_protokoll_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\Doc_to_protokoll::renderScript($id); ?><?php \DataView\ProtokollPunkt_protokoll::renderScript($id); ?>
									<?php
									$features = [];
									if ((true) && ((\FOP\User::getDokument())) && (true)) {
									$feature = [
										'id' => 'doc_to_protokoll_table',
										'title' => _('Dokumente'),
										'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::getProtokoll()) && (\FOP\User::getProtokoll())) && (true)) {
									$feature = [
										'id' => 'protokollPunkt_protokoll_table',
										'title' => _('Protokoll-Punkte'),
										'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)) {
									$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')
											
									];
									$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:protokoll: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::getDokument())) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['doc_to_protokoll_table']);
										?>
	<?php if (((\FOP\User::getDokument())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="doc_to_protokoll-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloaddoc_to_protokoll()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Doc_to_protokoll::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['doc_to_protokoll_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if ((true) && ((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll())) && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['protokollPunkt_protokoll_table']);
										?>
	<?php if (((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="protokollPunkt_protokoll-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadprotokollPunkt_protokoll()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\ProtokollPunkt_protokoll::renderTabTableAction($id);
		}
	?></div>
	<?php } ?>
	<?php
										\EasyEditor\FormFeature::pop();
										$features['protokollPunkt_protokoll_table']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['buttons']);
										?><div id='wf_protokoll_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::getProtokoll())) && ((\FOP\User::getProtokoll()))) { ?><a title="<?php echo(_('editbtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Protokoll::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 ($data['operation::delete'] == 1 && $data['operation::delete'] == 1 && ((\FOP\User::getProtokoll()))) { ?><a title="<?php echo(_('deletebtn')); ?>" class="detailbtn mdl-button mdl-js-button mdl-button--raised mdl-button--colored" href="<?php echo htmlentities(\TablesRouter\Protokoll::deleteConfirmURL2(['id' => $data['ID'], 'popup' => $_GET['popup'] ?? null, 'from' => $_GET['from'] ?? \FOP\Session::getPayload('dv-protokoll')['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_protokoll_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)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Datum": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Datum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities(($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_bez" id="column_bez">
		<!-- Feld "Bezeichnung": bez -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="bez"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		
	<?php echo htmlentities($data['bez']); ?>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_leiter" id="column_leiter">
		<!-- Feld "Versammlungsleiter": leiter -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="leiter"><?php echo(_('Versammlungsleiter')); ?>: </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['leiter']);
	$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['leiter'], ['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_creator" id="column_creator">
		<!-- Feld "Protokollant": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Protokollant')); ?>: </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_count" id="column_count">
		<!-- Feld "Anzahl Anwesende": count -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="count"><?php echo(_('Anzahl Anwesende')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<span style="white-space: nowrap; width: 100%; display: inline-block; "><?php echo htmlentities(\Types\Integer::print($data['count'])); ?>
	</span>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_content" id="column_content">
		<!-- Feld "Text": content -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="content"><?php echo(_('Text')); ?>: </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['content']); ?>
</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 setCFF(id, key, value) {
											<?php if(!\FOP\User::getIsGuest()) { ?>
											$.get('FOP/Index/setCFF?form=wf%3Aprotokoll%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%3Aprotokoll%3Aview&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_protokoll_view')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_protokoll_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::getProtokoll())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['leiter']);
		if ((!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['creator']);

		if (((false))) if (isset($_POST['protokollPunkt_protokoll_protokoll'])) foreach ($_POST['protokollPunkt_protokoll_protokoll'] AS $i => $val)
			if ($_POST['protokollPunkt_protokoll'][$i] != '0') \Types\Protokoll::validate($val);
		/* Sanitizer */

		$_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		if ((!isset($_POST['cancel']))) $_POST['leiter'] = \FOP\Sanitizers::null_filter($_POST['leiter']);
		if ((!isset($_POST['cancel']))) $_POST['creator'] = \FOP\Sanitizers::null_filter($_POST['creator']);
		$_POST['count'] = \Types\Integer::parse($_POST['count']);
		$_POST['content'] = \FOP\Sanitizers::htmlentities_decode($_POST['content']);

		if (((false))) if (isset($_POST['protokollPunkt_protokoll_protokoll'])) foreach ($_POST['protokollPunkt_protokoll_protokoll'] AS $idx => $val) $_POST['protokollPunkt_protokoll_protokoll'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['protokollPunkt_protokoll_content'])) foreach ($_POST['protokollPunkt_protokoll_content'] AS $idx => $val) $_POST['protokollPunkt_protokoll_content'][$idx] = \FOP\Sanitizers::htmlentities_decode($val);
		if (isset($_POST['protokollPunkt_protokoll_ergebnis'])) foreach ($_POST['protokollPunkt_protokoll_ergebnis'] AS $idx => $val) $_POST['protokollPunkt_protokoll_ergebnis'][$idx] = \FOP\Sanitizers::htmlentities_decode($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\Protokoll::getDefaults();
		$defaults['date'] = $_POST['date'];
		$defaults['bez'] = $_POST['bez'];
		$defaults['count'] = $_POST['count'];
		$defaults['content'] = $_POST['content'];
		if ((!isset($_POST['cancel']))) $defaults['leiter'] = $_POST['leiter'];
		if ((!isset($_POST['cancel']))) $defaults['creator'] = $_POST['creator'];
		// TableItemAccess für PHP auswerten
		if (!((\FOP\User::getProtokoll()))) throw new \FOP\AccessDeniedException('accessdenied');
		$id = \Tables\Protokoll::create($defaults);
	
    // --- BLOCK: main-2:save-main-list-protokollPunkt_protokoll ---
    
		// List Save
		if (isset($_POST['protokollPunkt_protokoll_ID'])) foreach ($_POST['protokollPunkt_protokoll_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['protokollPunkt_protokoll'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\ProtokollPunkt::getDefaults();
				\Tables\ProtokollPunkt::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['protokoll'] = $id;
				$subdata['nummer'] = $_POST['protokollPunkt_protokoll_nummer'][$i];
				$subdata['content'] = $_POST['protokollPunkt_protokoll_content'][$i];
				$subdata['ergebnis'] = $_POST['protokollPunkt_protokoll_ergebnis'][$i];
				$subdata['ID'] = $_POST['protokollPunkt_protokoll_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['protokollPunkt_protokoll'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\ProtokollPunkt::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\ProtokollPunkt::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['protokollPunkt_protokoll'][$i] != '0') {
				// noch keine ID: erstellen
				if (((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll()))) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\ProtokollPunkt::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- 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\Protokoll::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\Protokoll::viewAccess($id)) {
					if (!\TablesRouter\Protokoll::indexAccess()) {
						header('Location: ' . \FOPRouter\Index::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
						die();
					}
					header('Location: ' . \TablesRouter\Protokoll::indexURL2(['popup' => $_GET['popup'] ?? null, 'from' => $_POST['fop-from'] ?? null]));
					die();
				}
				header('Location: ' . \TablesRouter\Protokoll::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\Protokoll::getDefaults();
	
    // --- BLOCK: main-4:load-main-list-protokollPunkt_protokoll ---
    
		$protokollPunkt_protokoll = [];
		
	
    // --- BLOCK: main-4:load-~sanitize ---
    
		\Tables\Protokoll::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'), _('Protokoll'))); ?></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'), _('Protokoll'))); ?></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'), _('Protokoll'))); ?></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\Protokoll::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_protokoll_create"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_protokoll_create" 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 && ((\FOP\User::getProtokoll())) && (false || true)) {
									$feature = [
										'id' => 'protokollPunkt_protokoll',
										'title' => _('Protokoll-Punkte'),
										'order' => 'z-protokollPunkt_protokoll', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || true || true || true || true || false || (!isset($_POST['cancel'])) || (!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' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? '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:protokoll: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_protokoll_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_protokoll_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::getProtokoll())) && (false || true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['protokollPunkt_protokoll']);
										?><span id='protokollPunkt_protokoll' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
				<?php
				foreach ($protokollPunkt_protokoll AS $row) {
					self::createListProtokollPunkt_protokollAction($row, $data);
				}
				if ((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll())) { ?>
         <div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-create">
             
             <div class="mdl-cell mdl-cell--3-col mdl-cell--2-col-phone fop-form-label"><?php echo(_('Protokoll-Punkte')); ?></div>
             <div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					  
			<button type='button' class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var tr = $(this).closest(".wfl-create"); $.get("Tables/Protokoll/createListProtokollPunkt_protokoll?_", 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'), _('Protokoll-Punkt'))); ?></button>
					  
             </div>
         </div>
			<?php } ?>
	
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['protokollPunkt_protokoll']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || true || true || true || true || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Datum": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Datum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><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_bez" id="column_bez">
		<!-- Feld "Bezeichnung": bez -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="bez"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="bez"  value="<?php echo htmlentities($data['bez']); ?>"/><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_leiter" id="column_leiter">
		<!-- Feld "Versammlungsleiter": leiter -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="leiter"><?php echo(_('Versammlungsleiter')); ?>: </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_protokoll_create_leiterAction($data['leiter'], [], '');
?> &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=leiter%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=leiter%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 } ?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creator" id="column_creator">
		<!-- Feld "Protokollant": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Protokollant')); ?>: </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_protokoll_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_count" id="column_count">
		<!-- Feld "Anzahl Anwesende": count -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="count"><?php echo(_('Anzahl Anwesende')); ?>: </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 fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="count"  value="<?php echo \Types\Integer::print($data['count']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_content" id="column_content">
		<!-- Feld "Text": content -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="content"><?php echo(_('Text')); ?>: </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(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="content" class="html-html_protokoll"><?php echo htmlentities($data['content']); ?></textarea>
	</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_protokoll_create').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_protokoll_create').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_protokoll_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%3Aprotokoll%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%3Aprotokoll%3Acreate&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_protokoll_create')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_protokoll_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::getProtokoll())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access+validators ---
    
	if ($_SERVER['REQUEST_METHOD'] === 'POST') {
		
		/* Validatoren */
		
		if ((!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['leiter']);
		if ((!isset($_POST['cancel']))) \Types\Mitglied::validate($_POST['creator']);

		if (((false))) if (isset($_POST['protokollPunkt_protokoll_protokoll'])) foreach ($_POST['protokollPunkt_protokoll_protokoll'] AS $i => $val)
			if ($_POST['protokollPunkt_protokoll'][$i] != '0') \Types\Protokoll::validate($val);
		/* Sanitizer */

		$_POST['date'] = \FOP\Sanitizers::convert_date_to_unix_timestamp($_POST['date']);
		if ((!isset($_POST['cancel']))) $_POST['leiter'] = \FOP\Sanitizers::null_filter($_POST['leiter']);
		if ((!isset($_POST['cancel']))) $_POST['creator'] = \FOP\Sanitizers::null_filter($_POST['creator']);
		$_POST['count'] = \Types\Integer::parse($_POST['count']);
		$_POST['content'] = \FOP\Sanitizers::htmlentities_decode($_POST['content']);

		if (((false))) if (isset($_POST['protokollPunkt_protokoll_protokoll'])) foreach ($_POST['protokollPunkt_protokoll_protokoll'] AS $idx => $val) $_POST['protokollPunkt_protokoll_protokoll'][$idx] = \FOP\Sanitizers::null_filter($val);
		if (isset($_POST['protokollPunkt_protokoll_content'])) foreach ($_POST['protokollPunkt_protokoll_content'] AS $idx => $val) $_POST['protokollPunkt_protokoll_content'][$idx] = \FOP\Sanitizers::htmlentities_decode($val);
		if (isset($_POST['protokollPunkt_protokoll_ergebnis'])) foreach ($_POST['protokollPunkt_protokoll_ergebnis'] AS $idx => $val) $_POST['protokollPunkt_protokoll_ergebnis'][$idx] = \FOP\Sanitizers::htmlentities_decode($val);
	}
	
    // --- BLOCK: access-item-protokoll-edit ---
    
		if ($id !== null && \FOP\Database::query('SELECT ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') FROM '.qi('protokoll').' 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['date'] = $_POST['date'];
		$data_edit['bez'] = $_POST['bez'];
		$data_edit['count'] = $_POST['count'];
		$data_edit['content'] = $_POST['content'];
		if ((!isset($_POST['cancel']))) $data_edit['leiter'] = $_POST['leiter'];
		if ((!isset($_POST['cancel']))) $data_edit['creator'] = $_POST['creator'];
		self::edit($id, $data_edit);
		if (isset($data_edit['ID'])) {
			$id = $data_edit['ID'];
		}
	
    // --- BLOCK: main-2:save-main-list-protokollPunkt_protokoll ---
    
		// List Save
		if (isset($_POST['protokollPunkt_protokoll_ID'])) foreach ($_POST['protokollPunkt_protokoll_ID'] AS $i => $subid) {
			// Subdaten extrahieren
			if (!$subid && $_POST['protokollPunkt_protokoll'][$i] != '0') {
				// es wird ein Create
				$subdata = \Tables\ProtokollPunkt::getDefaults();
				\Tables\ProtokollPunkt::sanitizeDefaults($subdata, false);
			} else {
				// es ist ein Edit
				$subdata = [];
			}
			
			$subdata['protokoll'] = $id;
				$subdata['nummer'] = $_POST['protokollPunkt_protokoll_nummer'][$i];
				$subdata['content'] = $_POST['protokollPunkt_protokoll_content'][$i];
				$subdata['ergebnis'] = $_POST['protokollPunkt_protokoll_ergebnis'][$i];
				$subdata['ID'] = $_POST['protokollPunkt_protokoll_ID'][$i];
			if ($subid) {
				// existierendes Element
				if ($_POST['protokollPunkt_protokoll'][$i] == '0') {
					// zur Löschung markiert
					// achtet selbst auf Permissions
					\Tables\ProtokollPunkt::delete($subid);
				} else {
					// achtet selbst auf Permissions
					\Tables\ProtokollPunkt::edit($subid, $subdata);
					
					
				}
			} else if ($_POST['protokollPunkt_protokoll'][$i] != '0') {
				// noch keine ID: erstellen
				if (((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll()))) {
					// TODO: TIAR-Create prüfen
					try {
						$subid = \Tables\ProtokollPunkt::create($subdata);
						
						
					} catch (\FOP\AccessDeniedException $e) {
						// ignore duplicate
						if ($e->getMessage() != 'duplicateinsert') {
							throw $e;
						}
					}
				}
			}
		}
	
    // --- 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\Protokoll::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\Protokoll::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-protokollPunkt_protokoll ---
    
		$protokollPunkt_protokoll = [];
		array_push($protokollPunkt_protokoll, ...\Tables\Protokoll::loadEditProtokollPunkt_protokollItems($id ?? null));
	
    // --- 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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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('.(\FOP\Database::getDriver() == 'mysql' ? 'DATE_FORMAT(FROM_UNIXTIME' : 'to_char(to_timestamp') . '('.qi('protokoll').'.'.qi('date').')'.(\FOP\Database::getDriver() == 'mysql' ? '' : '::date') . ', '.\FOP\Database::sessionVarSQL('dateformat').'), \': \', '.qi('protokoll').'.'.qi('bez').') AS description FROM '.qi('protokoll').' 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\Protokoll::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_protokoll_edit"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormWf_protokoll_edit" 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' => 'protokollPunkt_protokoll',
										'title' => _('Protokoll-Punkte'),
										'order' => 'z-protokollPunkt_protokoll', // 
										'mode' => 'area', // 
										'position' => 'full', // 
										'collapsed' => 0, // 
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => '0' .'||'. (true ? 'true' : '0')
											
									];
									$features[$feature['id']] = $feature;
									}
									
									if (true && (false || false || true || true || true || true || false || (!isset($_POST['cancel'])) || (!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' .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. (true ? 'true' : '0')
											 .'||'. '0' .'||'. ((!isset($_POST['cancel'])) ? 'true' : '0')
											 .'||'. ((!isset($_POST['cancel'])) ? '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:protokoll: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_protokoll_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_protokoll_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['protokollPunkt_protokoll']);
										?><span id='protokollPunkt_protokoll' class='mdl-cell mdl-cell--12-col mdl-grid' >
	
				<?php
				foreach ($protokollPunkt_protokoll AS $row) {
					self::editListProtokollPunkt_protokollAction($row, $data);
				}
				if ((\FOP\User::getProtokoll()) && (\FOP\User::getProtokoll())) { ?>
         <div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-create">
             
             <div class="mdl-cell mdl-cell--3-col mdl-cell--2-col-phone fop-form-label"><?php echo(_('Protokoll-Punkte')); ?></div>
             <div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					  
			<button type='button' class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var tr = $(this).closest(".wfl-create"); $.get("Tables/Protokoll/editListProtokollPunkt_protokoll?_&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'), _('Protokoll-Punkt'))); ?></button>
					  
             </div>
         </div>
			<?php } ?>
	
	</span><?php
										\EasyEditor\FormFeature::pop();
										$features['protokollPunkt_protokoll']['html'] = ob_get_contents();
										ob_end_clean();
									}
									
									if (true && (false || false || true || true || true || true || false || (!isset($_POST['cancel'])) || (!isset($_POST['cancel'])))) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main']);
										?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_date" id="column_date">
		<!-- Feld "Datum": date -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="date"><?php echo(_('Datum')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	" ts-locale='<?php echo (\FOP\I18n::getShortLocale()); ?>' ts-format='<?php echo (_('dateformat_moment')); ?>' class="mdl-textfield__input picker_date" id="date" type="text" name="date" value="<?php echo ($data['date']) ? strftime(_('dateformat_php2'), intval($data['date'])) : ''; ?>"/><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_bez" id="column_bez">
		<!-- Feld "Bezeichnung": bez -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="bez"><?php echo(_('Bezeichnung')); ?>: </label>
	</div>
	<div	class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone fop-form-content">
		<div class="mdl-textfield mdl-js-textfield"><input onkeydown="
		if (event.keyCode == 13) {
			event.preventDefault();
			event.stopPropagation();
			tabNext(this);
			return false;
		}
	"  class="mdl-textfield__input"  type="text" name="bez"  value="<?php echo htmlentities($data['bez']); ?>"/><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_leiter" id="column_leiter">
		<!-- Feld "Versammlungsleiter": leiter -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="leiter"><?php echo(_('Versammlungsleiter')); ?>: </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_protokoll_edit_leiterAction($data['leiter'], [], '');
?> &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=leiter%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=leiter%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 } ?><?php if ((!isset($_POST['cancel']))) { ?>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_creator" id="column_creator">
		<!-- Feld "Protokollant": creator -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="creator"><?php echo(_('Protokollant')); ?>: </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_protokoll_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_count" id="column_count">
		<!-- Feld "Anzahl Anwesende": count -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="count"><?php echo(_('Anzahl Anwesende')); ?>: </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 fop-numeric">
		<input onfocus='this.select()' style='text-align: right;' type='text' pattern='<?php echo htmlentities(\Types\Integer::pattern()); ?>' class="mdl-textfield__input" name="count"  value="<?php echo \Types\Integer::print($data['count']); ?>" fop-numeric='0' fop-numeric-decimal='<?php echo htmlentities(\Types\Integer::decimalSeparator()); ?>' fop-numeric-thousands='<?php echo htmlentities(\Types\Integer::thousandsSeparator()); ?>' /><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
	<script type='text/javascript'>$(function () {bindNumericFields(); });</script>
	</div>
	</div>
	<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card column_content" id="column_content">
		<!-- Feld "Text": content -->
	<div	class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label">
		<label for="content"><?php echo(_('Text')); ?>: </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(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="content" class="html-html_protokoll"><?php echo htmlentities($data['content']); ?></textarea>
	</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_protokoll_edit').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-wf_protokoll_edit').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-wf_protokoll_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%3Aprotokoll%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%3Aprotokoll%3Aedit&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-wf_protokoll_edit')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-wf_protokoll_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 loadCreateProtokollPunkt_protokollItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT \'\' AS '.qi('ID').', '.qi('protokollPunkt').'.'.qi('protokoll').', '.qi('protokollPunkt').'.'.qi('nummer').', '.qi('protokollPunkt').'.'.qi('content').', '.qi('protokollPunkt').'.'.qi('ergebnis').',
			(('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') FROM '.qi('protokoll').' '.qi('sgt3BpgQ').' WHERE '.qi('sgt3BpgQ').'.'.qi('ID').' = '.qi('protokollPunkt').'.'.qi('protokoll').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) AS '.qi('canDelete').'
			FROM '.qi('protokollPunkt').' 
			WHERE (('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') FROM '.qi('protokoll').' '.qi('IifUUeVT').' WHERE '.qi('IifUUeVT').'.'.qi('ID').' = '.qi('protokollPunkt').'.'.qi('protokoll').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) AND '.qi('protokollPunkt').'.'.qi('protokoll').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

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

  public static function loadEditProtokollPunkt_protokollItems($id) { 
    
    
    // --- BLOCK: main ---
    
		/* TODO: SQL Query bauen mit SQLQuery-Fakten */
		$items =
		\FOP\Database::query('SELECT '.qi('protokollPunkt').'.'.qi('ID').' AS '.qi('ID').', '.qi('protokollPunkt').'.'.qi('protokoll').', '.qi('protokollPunkt').'.'.qi('nummer').', '.qi('protokollPunkt').'.'.qi('content').', '.qi('protokollPunkt').'.'.qi('ergebnis').',
			(('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') FROM '.qi('protokoll').' '.qi('sgt3BpgQ').' WHERE '.qi('sgt3BpgQ').'.'.qi('ID').' = '.qi('protokollPunkt').'.'.qi('protokoll').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) AS '.qi('canDelete').'
			FROM '.qi('protokollPunkt').' 
			WHERE (('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AND (COALESCE((SELECT ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') FROM '.qi('protokoll').' '.qi('IifUUeVT').' WHERE '.qi('IifUUeVT').'.'.qi('ID').' = '.qi('protokollPunkt').'.'.qi('protokoll').' LIMIT 1), FALSE)) AND ('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) AND '.qi('protokollPunkt').'.'.qi('protokoll').' = ' . \FOP\Database::quote($id) . '')->fetchAll(\PDO::FETCH_ASSOC);

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

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

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

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

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

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

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

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

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

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

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

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

  public static function createListProtokollPunkt_protokollAction($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\ProtokollPunkt::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\ProtokollPunkt::sanitizeDefaults($row, true, 'protokoll', $parentrow);
		} else {
						
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: main ---
    
		?>
		<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-item" ng-controller='FormGroupWf_protokoll_createProtokollPunkt_protokoll' ng-init='item = <?php
				echo htmlentities(json_encode(['protokoll' => null, 'O3t2RXGP' => null]));
			?>;
			form[&apos;protokollPunkt_protokoll&apos;] = (form[&apos;protokollPunkt_protokoll&apos;] || []); form[&apos;protokollPunkt_protokoll&apos;].push(item);'>
				<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
					<h4><?php echo(_('Protokoll-Punkt')); ?></h4>
				</div>
			
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone">
			<div class="mdl-grid grid-card" style="width: 100%;">
			<input type='hidden' name='protokollPunkt_protokoll[]' value='1'>
			<input type='hidden' name='protokollPunkt_protokoll_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
		<!-- Spalte nummer
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Tagesordnungspunkt')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					<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="protokollPunkt_protokoll_nummer[]"  value="<?php echo htmlentities($row['nummer']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?><!-- Spalte content
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Beschreibung')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="protokollPunkt_protokoll_content[]" class="html-html_protokoll"><?php echo htmlentities($row['content']); ?></textarea>
	</div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?><!-- Spalte ergebnis
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Ergebnis')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="protokollPunkt_protokoll_ergebnis[]" class="html-html_protokoll"><?php echo htmlentities($row['ergebnis']); ?></textarea>
	</div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?>
			<?php if ($row['canDelete']) { ?><!-- Delete Button -->
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
				<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var item = $(this).closest("div.mdl-cell.wfl-item"); item.fadeOut(); item.find("input[name=&apos;protokollPunkt_protokoll[]&apos;]").val("0"); item.find("[required]").removeAttr("required");var s = $(this).scope(); var a = s.$eval(&apos;form[\&apos;protokollPunkt_protokoll\&apos;]&apos;); var i = a.indexOf(s.item); if (i != -1) {a.splice(i, 1); s.$apply();}'>
				<i class="material-icons">remove</i>
				<?php echo(_('delete')); ?>
				</div>
			</div>
			<?php } ?>
		</div></div></div><?php
	
    
  }

  public static function editListProtokollPunkt_protokollAction($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\ProtokollPunkt::getDefaults();
			$row['ID'] = '';
			$row['canDelete'] = true;
			\Tables\ProtokollPunkt::sanitizeDefaults($row, true, 'protokoll', $parentrow);
		} else {
						
			$row['canDelete'] = $row['canDelete'] ?? false;
		}
		
		
    // --- BLOCK: main ---
    
		?>
		<div class="mdl-cell mdl-cell--12-col mdl-grid grid-card wfl-item" ng-controller='FormGroupWf_protokoll_editProtokollPunkt_protokoll' ng-init='item = <?php
				echo htmlentities(json_encode(['protokoll' => null, 'O3t2RXGP' => null]));
			?>;
			form[&apos;protokollPunkt_protokoll&apos;] = (form[&apos;protokollPunkt_protokoll&apos;] || []); form[&apos;protokollPunkt_protokoll&apos;].push(item);'>
				<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
					<h4><?php echo(_('Protokoll-Punkt')); ?></h4>
				</div>
			
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone">
			<div class="mdl-grid grid-card" style="width: 100%;">
			<input type='hidden' name='protokollPunkt_protokoll[]' value='1'>
			<input type='hidden' name='protokollPunkt_protokoll_ID[]' value='<?php echo htmlentities($row['ID']); ?>'>
		<!-- Spalte nummer
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Tagesordnungspunkt')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					<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="protokollPunkt_protokoll_nummer[]"  value="<?php echo htmlentities($row['nummer']); ?>"/><span class="mdl-textfield__error"><div><?php echo(_('invalidinput')) ?></div></span></div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?><!-- Spalte content
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Beschreibung')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="protokollPunkt_protokoll_content[]" class="html-html_protokoll"><?php echo htmlentities($row['content']); ?></textarea>
	</div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?><!-- Spalte ergebnis
			--><?php
			if ($row['ID'] ? true : true) {
				?><?php // Unterscheidung Create/Edit
			if ($row['ID'] ? true : true) {
				?><div class="mdl-cell mdl-cell--3-col mdl-cell--4-col-phone fop-form-label"><?php echo(_('Ergebnis')); ?></div>
				<div class="mdl-cell mdl-cell--9-col mdl-cell--4-col-phone">
					
	<div tinymce-locale="<?php echo \FOP\I18n::getShortLocale(); ?>">
	<div  style='margin-bottom: 10px;'><select style='maxwidth: 60%;' onchange='if (!this.selectedIndex) return; $(this).closest("[tinymce-locale]")[0].insertContent(this.options[this.selectedIndex].dataset["template"]); this.selectedIndex = 0;'><option data-template=''><?php echo htmlentities(_('Vorlage einfügen'));?></option><?php
		$templates = \FOP\Database::query('SELECT '.qi('title').' AS header, '.qi('content').' AS content FROM '.qi('protokollVorlage').' WHERE '.(\FOP\User::getIsGuest() ? 'false' : 'true').' ORDER BY '.qi('sortableOrder').'')->fetchAll(\PDO::FETCH_ASSOC);
		foreach ($templates AS $template) { ?>
      	<option data-template='<?php echo htmlentities($template['content']); ?>'>
      	    <?php echo substr(\FOP\Util::SanitizeUserHtml(strip_tags($template['header'])), 0, 100); ?>
      	</option>
		<?php }
	?></select></div>
	<textarea ng-non-bindable rows="22" cols="50" name="protokollPunkt_protokoll_ergebnis[]" class="html-html_protokoll"><?php echo htmlentities($row['ergebnis']); ?></textarea>
	</div>
				</div>
			<?php } else { // kein Access: leere Zelle
				?><div class="mdl-cell mdl-cell--6-col"></div><?php
			} ?><?php
			}?>
			<?php if ($row['canDelete']) { ?><!-- Delete Button -->
			<div class="mdl-cell mdl-cell--12-col mdl-cell--4-col-phone" style="align-items: start; flex-direction: column;">
				<div class='mdl-button mdl-js-button mdl-button--colored mdl-button--raised' onclick='var item = $(this).closest("div.mdl-cell.wfl-item"); item.fadeOut(); item.find("input[name=&apos;protokollPunkt_protokoll[]&apos;]").val("0"); item.find("[required]").removeAttr("required");var s = $(this).scope(); var a = s.$eval(&apos;form[\&apos;protokollPunkt_protokoll\&apos;]&apos;); var i = a.indexOf(s.item); if (i != -1) {a.splice(i, 1); s.$apply();}'>
				<i class="material-icons">remove</i>
				<?php echo(_('delete')); ?>
				</div>
			</div>
			<?php } ?>
		</div></div></div><?php
	
    
  }

  public static function create($data, $disregardPermissions = false , $updateOnDuplicate = false ) { 
    
    
    // --- BLOCK: main ---
    
				$sql = 'INSERT INTO '.qi('protokoll').'(';
				
				$set = [];
				
					
					$set[qi('date')] = \FOP\Database::quote($data['date']);
					
				
					
					$set[qi('bez')] = \FOP\Database::quote($data['bez']);
					
				
					
					$set[qi('leiter')] = \FOP\Database::quote($data['leiter']);
					
				
					
					$set[qi('creator')] = \FOP\Database::quote($data['creator']);
					
				
					
					$set[qi('count')] = \FOP\Database::quote($data['count']);
					
				
					
					$set[qi('content')] = \FOP\Database::quote($data['content']);
					
				
				$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('protokoll').'.'.qi('ID').' AS '.qi('ID').',
									/* bez */ '.qi('protokoll').'.'.qi('bez').' AS '.qi('bez').',
									/* content */ '.qi('protokoll').'.'.qi('content').' AS '.qi('content').',
									/* count */ '.qi('protokoll').'.'.qi('count').' AS '.qi('count').',
									/* creator */ '.qi('protokoll').'.'.qi('creator').' AS '.qi('creator').',
									/* creator::canView */ '.qi('ref:creator').'.'.qi('creator:canView').' AS '.qi('creator::canView').',
									/* creator::description */ '.qi('ref:creator').'.'.qi('creator:description').' AS '.qi('creator::description').',
									/* date */ '.qi('protokoll').'.'.qi('date').' AS '.qi('date').',
									/* leiter */ '.qi('protokoll').'.'.qi('leiter').' AS '.qi('leiter').',
									/* leiter::canView */ '.qi('ref:leiter').'.'.qi('leiter:canView').' AS '.qi('leiter::canView').',
									/* leiter::description */ '.qi('ref:leiter').'.'.qi('leiter:description').' AS '.qi('leiter::description').',
									/* operation::0a198a3b3385f8f2e55d32198f62adfc8843fdf576fc6bbe768a3ce7a6fe462c */ '.\FOP\Database::quote(\FOP\User::getProtokoll()).' AS '.qi('operation::0a198a3b3385f8f2e55d32198f62adfc8843fdf576fc6bbe768a3ce7a6fe462c').',
									/* operation::8a32b22975ac7c6317b1f45149bc390684b38614fdf46d4c34cba92526aef946 */ '.\FOP\Database::quote(\FOP\User::getProtokoll()).' AS '.qi('operation::8a32b22975ac7c6317b1f45149bc390684b38614fdf46d4c34cba92526aef946').',
									/* operation::DF38Sz26 */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::DF38Sz26').',
									/* operation::create */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::create').',
									/* operation::delete */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::delete').',
									/* operation::edit */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::edit').',
									/* operation::index */ ' . (!\FOP\User::getIsGuest() ? 1 : 0) . ' AS '.qi('operation::index').',
									/* operation::view */ ('.\FOP\Database::quote(\FOP\User::getProtokoll()).') AS '.qi('operation::view').',
									1
								FROM '.qi('protokoll').' '.qi('protokoll').'
								LEFT JOIN (SELECT '.qi('ID').' AS '.qi('leiter:ID').', CONCAT('.qi('mitglied').'.'.qi('vorname').', \' \', '.qi('mitglied').'.'.qi('name').') AS '.qi('leiter: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('leiter:canView').' FROM '.qi('mitglied').') '.qi('ref:leiter').' ON '.qi('ref:leiter').'.'.qi('leiter:ID').' = '.qi('protokoll').'.'.qi('leiter').'
								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('protokoll').'.'.qi('creator').'
								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['date'] = intval($row['date']);
		$row['leiter'] = \FOP\Sanitizers::null_converter($row['leiter']);
		$row['creator'] = \FOP\Sanitizers::null_converter($row['creator']);
		$row['count'] = \Types\Integer::unpack($row['count']);
		

		if($snippet){
			$row['date'] = (($row['date']) ? strftime(_('dateformat_php2'), intval($row['date'])) : '');
			$row['bez'] = ($row['bez']);
			$row['leiter'] = (
  \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['leiter']))->fetchColumn() ?: _('')
);
			$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['count'] = (\Types\Integer::print($row['count'])
	);
			$row['content'] = (mb_substr(preg_replace('/[ \t\r\n]+/', ' ', strip_tags(preg_replace('/<style.*?\/style>/s', '', html_entity_decode($row['content'])))), 0, 20) . (strlen($row['content']) >= 20 ? '...' : ''));
			
		}


		return $row;

    
  }

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

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

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

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

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

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

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

  public static function searchOptionsform_wf_doc_edit_to_protokollAction($value, $str, $deps) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\ProtokollNullDMS::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: bez
		
		// column: content
		
		// column: count
		
		// 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: date
		
		// column: leiter
			if (!$data['leiter']) {
				// 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['leiter'] = $item['ID'];
						$best = $item['priority'];
					}
				}
			}
		
		if ($sanitizeForForms) {
			
			$data['date'] = intval($data['date']);
			$data['leiter'] = \FOP\Sanitizers::null_converter($data['leiter']);
			$data['creator'] = \FOP\Sanitizers::null_converter($data['creator']);
			$data['count'] = \Types\Integer::unpack($data['count']);
		}
	
    
  }

  public static function edit($id, $data, $ignoreUniqueConstraints = false , $disregardPermissions = false ) { 
    
    
    // --- BLOCK: main ---
    
				
				$set = [];
				
					
					if (array_key_exists('date', $data)) {
						array_push($set, qi('date').' = ' . \FOP\Database::quote($data['date']));
					}
				
					
					if (array_key_exists('bez', $data)) {
						array_push($set, qi('bez').' = ' . \FOP\Database::quote($data['bez']));
					}
				
					
					if (array_key_exists('leiter', $data)) {
						array_push($set, qi('leiter').' = ' . \FOP\Database::quote($data['leiter']));
					}
				
					
					if (array_key_exists('creator', $data)) {
						array_push($set, qi('creator').' = ' . \FOP\Database::quote($data['creator']));
					}
				
					
					if (array_key_exists('count', $data)) {
						array_push($set, qi('count').' = ' . \FOP\Database::quote($data['count']));
					}
				
					
					if (array_key_exists('content', $data)) {
						array_push($set, qi('content').' = ' . \FOP\Database::quote($data['content']));
					}
				;
				
				if (count($set)) {
					try {
						\FOP\Database::query('UPDATE '.qi('protokoll').' 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 renderEditprotokollPunkt_protokoll_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Protokoll::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_protokollPunkt_protokoll" 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/Protokoll/searchOptionsprotokollPunkt_protokoll_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_protokoll_create_protokollPunkt_protokoll_protokollAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Protokoll::getItems($deps, $value); // Annahme: getItems prüft je Item die Zugriffsregeln und gibt notfalls [] zurück
	?>
<div class="mdlext-selectfield mdlext-js-selectfield" style="max-width:  300px;">
	<select tabindex='-1' xng-model='item[&apos;protokoll&apos;]' class="selectdropdown mdlext-selectfield__select" name="protokollPunkt_protokoll_protokoll[]" data-default="<?php echo htmlentities($value ?: 0); ?>" style="color: rgba(0,0,0,0);" onchange="
		var val = this.value;
		if (val == '_more') {
			$(this.parentNode.parentNode).find('.fop-ddt-search').click();
			return;
		}
		this.nextElementSibling.value = this.options[this.selectedIndex].text;
		this.nextElementSibling.focus();
		this.nextElementSibling.select();
		$(this.parentElement).find('.fop-remove-after-change').remove();
		this.value = val;

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;protokoll&apos;]' fop-type='Protokoll' 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/Protokoll/searchOptionsformarray_wf_protokoll_create_protokollPunkt_protokoll_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

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

		var model = this.getAttribute('xng-model');
		if (model) {
			$(this).scope().$eval(model + '=' + JSON.stringify(this.value));
			$(this).scope().$apply();
		}
	">
		<?php $text = ''; ?><?php
			$isLong = count($items) && $items[count($items) - 1]['ID'] == '_more';
			foreach ($items AS $item) if (!$condition || $item[$condition]) {
				?><option value="<?php echo htmlentities($item['ID'])?>" <?php
					if ($item['ID'] == $value) {
						// Wert ist gewählt
						echo "selected";
						$text = $item['description'];
						if (isset($item['forbidden'])) {
							$isForbidden = true;
							echo ' class="fop-remove-after-change"';
						}
					}?>><?php echo htmlentities($item['description']); ?></option>
		<?php
			}
		?>
	</select>
	<input ng-trigger-change='item[&apos;protokoll&apos;]' fop-type='Protokoll' 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/Protokoll/searchOptionsformarray_wf_protokoll_edit_protokollPunkt_protokoll_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function renderEditform_wf_protokollPunkt_create_protokollAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Protokoll::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;protokoll&apos;]' class="selectdropdown mdlext-selectfield__select" name="protokoll" 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;protokoll&apos;]' fop-type='Protokoll' 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/Protokoll/searchOptionsform_wf_protokollPunkt_create_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function renderEditform_wf_protokollPunkt_edit_protokollAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\Protokoll::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;protokoll&apos;]' class="selectdropdown mdlext-selectfield__select" name="protokoll" 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;protokoll&apos;]' fop-type='Protokoll' 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/Protokoll/searchOptionsform_wf_protokollPunkt_edit_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function renderEditdoc_to_protokoll_deletecascadeAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\ProtokollNullDMS::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_doc_to-protokoll" 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/Protokoll/searchOptionsdoc_to_protokoll_deletecascade?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function renderEditform_wf_doc_create_to_protokollAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\ProtokollNullDMS::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;to-protokoll&apos;]' class="selectdropdown mdlext-selectfield__select" name="to-protokoll" 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;to-protokoll&apos;]' fop-type='ProtokollNullDMS' 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/Protokoll/searchOptionsform_wf_doc_create_to_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function renderEditform_wf_doc_edit_to_protokollAction($value, $deps, $condition, $fop_field_name = null ) { 
    
    
    // --- BLOCK: access ---
    
    // --- BLOCK: main ---
    
	if (is_string($deps)) $deps = json_decode($deps, true);
	$items = \Types\ProtokollNullDMS::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;to-protokoll&apos;]' class="selectdropdown mdlext-selectfield__select" name="to-protokoll" 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;to-protokoll&apos;]' fop-type='ProtokollNullDMS' 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/Protokoll/searchOptionsform_wf_doc_edit_to_protokoll?value=' + encodeURIComponent(self.parentNode.firstElementChild.options[self.parentNode.firstElementChild.selectedIndex].value) + '&deps=' + <?php echo htmlentities(json_encode(urlencode(json_encode($deps)))); ?> + '&str=' + encodeURIComponent(value)).then(function (result) {
					self.setAttribute('data-lastsearch', value);
					// Options eintragen
					$(self.parentNode.firstElementChild).empty();
					if (self.list) {
						$(self.list).empty();
					} else {
						var list = document.createElement('datalist');
						self.parentNode.appendChild(list);
						list.id = 'datalist' + String(Math.random()).substr(2);
						self.setAttribute('list', list.id);
						self.list = list;
					}
					for (var i = 0; i < result.length; i++) {
						var option = document.createElement('option');
						option.value = result[i].ID;
						option.text = result[i].description;
						self.parentNode.firstElementChild.appendChild(option);
						if (option.textContent == value) {
							option.selected = i;
							$(self.parentElement).find('.fop-remove-after-change').remove();
						}

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

<?php

    
  }

  public static function deleteAction($id) { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getProtokoll())))) throw new \FOP\AccessDeniedException();
    // --- BLOCK: access-itemlist-protokoll-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('protokoll').' WHERE (('.\FOP\Database::quote(\FOP\User::getProtokoll()).')) 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\Protokoll::deleteConfirmURL($ids->toString(), ['from' => $_GET['from'] ?? null])); // open delete confirm window when something went wrong
					}
					// TODO: I18n
					header('Location: ' . \TablesRouter\Protokoll::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\Protokoll::indexURL()) . $addition);
		die();
	
    
  }

  public static function indexAction() { 
    
    
    // --- BLOCK: access ---
    if(!(((\FOP\User::getProtokoll())) && (!\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(_('Protokolle')); ?></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(_('Protokolle')); ?></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(_('Protokolle')); ?></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-protokoll"
								style="width: 100%; height: 100%;"
								class='mdl-grid'
									ng-controller="FormProtokoll" ng-init="form = <?php echo htmlentities(json_encode([]));
									?>;"
								>
								<?php
								 ?>
								<div id='fop-upbar'></div>
								<?php \DataView\Protokoll::renderScript(); ?>
									<?php
									$features = [];
									if (true && (true)) {
									$feature = [
										'id' => 'main_table',
										'title' => _('table'),
										'order' => '500-100', // 500-100 (50)
										'mode' => 'area', // area (51) / tab (50)
										'position' => 'full', // 
										'collapsed' => 0, // 0 (51) / 1 (50)
										'canEdit' => !\FOP\User::getIsGuest(),
										'visibility' => null
									];
									$features[$feature['id']] = $feature;
									}
									

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

									/* fill in the content of the features */
									if (true && (true)) {
										ob_start();
										\EasyEditor\FormFeature::push($features['main_table']);
										?>
	<?php if (((\FOP\User::getProtokoll())) && (!\FOP\User::getIsGuest())) { ?>
	<div id="protokoll-table" class="fop-dv"><?php
		if (\EasyEditor\FormFeature::isCollapsed()) {
			// #3198 lazy rendering:
			echo '<div class="fop-lazy-reload" onclick="reloadprotokoll()"></div>'; // CSS class .fop-lazy-reload will be clicked after being showed
		} else {
			\DataView\Protokoll::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-protokoll').serialize();
											document.body.onbeforeunload = function () {
												if (formData != $('#cardform-protokoll').serialize()) {
													return 'Form data has changed - are you sure??';
												}
											};
											$('#cardform-protokoll').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=protokoll&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=protokoll&fids=' + encodeURIComponent(JSON.stringify(fids)));
											<?php } /* EditAccess */ ?>
										}
										$(function () {
											refreshTabHeaders($('#cardform-protokoll')); /* provided in js/form.js */
											// preselection
											if (location.hash.startsWith('#select:')) {
												$('[name="' + window.location.hash.slice(8) + '"]').focus().select();
											} else {
												$('#cardform-protokoll 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
    
  }


  
  

  
  
}



