<?php
namespace PHPMaker2019\project_germanos;

// Session
if (session_status() !== PHP_SESSION_ACTIVE)
	session_start(); // Init session data

// Output buffering
ob_start(); 

// Autoload
include_once "autoload.php";
?>
<?php

// Write header
WriteHeader(FALSE);

// Create page object
$users_access_add = new users_access_add();

// Run the page
$users_access_add->run();

// Setup login status
SetupLoginStatus();
SetClientVar("login", LoginStatus());

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$users_access_add->Page_Render();
?>
<?php include_once "header.php" ?>
<script>

// Form object
currentPageID = ew.PAGE_ID = "add";
var fusers_accessadd = currentForm = new ew.Form("fusers_accessadd", "add");

// Validate form
fusers_accessadd.validate = function() {
	if (!this.validateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.getForm(), $fobj = $(fobj);
	if ($fobj.find("#confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.formKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = ["insert", "gridinsert"].includes($fobj.find("#action").val()) && $k[0];
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
		<?php if ($users_access_add->user_id->Required) { ?>
			elm = this.getElements("x" + infix + "_user_id");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->user_id->caption(), $users_access->user_id->RequiredErrorMessage)) ?>");
		<?php } ?>
			elm = this.getElements("x" + infix + "_user_id");
			if (elm && !ew.checkInteger(elm.value))
				return this.onError(elm, "<?php echo JsEncode($users_access->user_id->errorMessage()) ?>");
		<?php if ($users_access_add->insert->Required) { ?>
			elm = this.getElements("x" + infix + "_insert[]");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->insert->caption(), $users_access->insert->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->update->Required) { ?>
			elm = this.getElements("x" + infix + "_update[]");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->update->caption(), $users_access->update->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->delete->Required) { ?>
			elm = this.getElements("x" + infix + "_delete[]");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->delete->caption(), $users_access->delete->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->view->Required) { ?>
			elm = this.getElements("x" + infix + "_view[]");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->view->caption(), $users_access->view->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->campus->Required) { ?>
			elm = this.getElements("x" + infix + "_campus");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->campus->caption(), $users_access->campus->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->school->Required) { ?>
			elm = this.getElements("x" + infix + "_school");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->school->caption(), $users_access->school->RequiredErrorMessage)) ?>");
		<?php } ?>
		<?php if ($users_access_add->department->Required) { ?>
			elm = this.getElements("x" + infix + "_department");
			if (elm && !ew.isHidden(elm) && !ew.hasValue(elm))
				return this.onError(elm, "<?php echo JsEncode(str_replace("%s", $users_access->department->caption(), $users_access->department->RequiredErrorMessage)) ?>");
		<?php } ?>

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ew.forms[val])
			if (!ew.forms[val].validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fusers_accessadd.Form_CustomValidate = function(fobj) { // DO NOT CHANGE THIS LINE!

	// Your custom validation code here, return false if invalid.
	return true;
}

// Use JavaScript validation or not
fusers_accessadd.validateRequired = <?php echo json_encode(CLIENT_VALIDATE) ?>;

// Dynamic selection lists
fusers_accessadd.lists["x_insert[]"] = <?php echo $users_access_add->insert->Lookup->toClientList() ?>;
fusers_accessadd.lists["x_insert[]"].options = <?php echo JsonEncode($users_access_add->insert->options(FALSE, TRUE)) ?>;
fusers_accessadd.lists["x_update[]"] = <?php echo $users_access_add->update->Lookup->toClientList() ?>;
fusers_accessadd.lists["x_update[]"].options = <?php echo JsonEncode($users_access_add->update->options(FALSE, TRUE)) ?>;
fusers_accessadd.lists["x_delete[]"] = <?php echo $users_access_add->delete->Lookup->toClientList() ?>;
fusers_accessadd.lists["x_delete[]"].options = <?php echo JsonEncode($users_access_add->delete->options(FALSE, TRUE)) ?>;
fusers_accessadd.lists["x_view[]"] = <?php echo $users_access_add->view->Lookup->toClientList() ?>;
fusers_accessadd.lists["x_view[]"].options = <?php echo JsonEncode($users_access_add->view->options(FALSE, TRUE)) ?>;

// Form object for search
</script>
<script>

// Write your client script here, no need to add script tags.
</script>
<?php $users_access_add->showPageHeader(); ?>
<?php
$users_access_add->showMessage();
?>
<form name="fusers_accessadd" id="fusers_accessadd" class="<?php echo $users_access_add->FormClassName ?>" action="<?php echo CurrentPageName() ?>" method="post">
<?php if ($users_access_add->CheckToken) { ?>
<input type="hidden" name="<?php echo TOKEN_NAME ?>" value="<?php echo $users_access_add->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="users_access">
<input type="hidden" name="action" id="action" value="insert">
<input type="hidden" name="modal" value="<?php echo (int)$users_access_add->IsModal ?>">
<?php if (!$users_access_add->IsMobileOrModal) { ?>
<div class="ew-desktop"><!-- desktop -->
<?php } ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
<div class="ew-add-div"><!-- page* -->
<?php } else { ?>
<table id="tbl_users_accessadd" class="table table-striped table-sm ew-desktop-table"><!-- table* -->
<?php } ?>
<?php if ($users_access->user_id->Visible) { // user_id ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_user_id" class="form-group row">
		<label id="elh_users_access_user_id" for="x_user_id" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->user_id->caption() ?><?php echo ($users_access->user_id->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->user_id->cellAttributes() ?>>
<span id="el_users_access_user_id">
<input type="text" data-table="users_access" data-field="x_user_id" name="x_user_id" id="x_user_id" size="30" placeholder="<?php echo HtmlEncode($users_access->user_id->getPlaceHolder()) ?>" value="<?php echo $users_access->user_id->EditValue ?>"<?php echo $users_access->user_id->editAttributes() ?>>
</span>
<?php echo $users_access->user_id->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_user_id">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_user_id"><?php echo $users_access->user_id->caption() ?><?php echo ($users_access->user_id->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->user_id->cellAttributes() ?>>
<span id="el_users_access_user_id">
<input type="text" data-table="users_access" data-field="x_user_id" name="x_user_id" id="x_user_id" size="30" placeholder="<?php echo HtmlEncode($users_access->user_id->getPlaceHolder()) ?>" value="<?php echo $users_access->user_id->EditValue ?>"<?php echo $users_access->user_id->editAttributes() ?>>
</span>
<?php echo $users_access->user_id->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->insert->Visible) { // insert ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_insert" class="form-group row">
		<label id="elh_users_access_insert" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->insert->caption() ?><?php echo ($users_access->insert->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->insert->cellAttributes() ?>>
<span id="el_users_access_insert">
<?php
$selwrk = (ConvertToBool($users_access->insert->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_insert" name="x_insert[]" id="x_insert[]" value="1"<?php echo $selwrk ?><?php echo $users_access->insert->editAttributes() ?>>
</span>
<?php echo $users_access->insert->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_insert">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_insert"><?php echo $users_access->insert->caption() ?><?php echo ($users_access->insert->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->insert->cellAttributes() ?>>
<span id="el_users_access_insert">
<?php
$selwrk = (ConvertToBool($users_access->insert->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_insert" name="x_insert[]" id="x_insert[]" value="1"<?php echo $selwrk ?><?php echo $users_access->insert->editAttributes() ?>>
</span>
<?php echo $users_access->insert->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->update->Visible) { // update ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_update" class="form-group row">
		<label id="elh_users_access_update" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->update->caption() ?><?php echo ($users_access->update->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->update->cellAttributes() ?>>
<span id="el_users_access_update">
<?php
$selwrk = (ConvertToBool($users_access->update->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_update" name="x_update[]" id="x_update[]" value="1"<?php echo $selwrk ?><?php echo $users_access->update->editAttributes() ?>>
</span>
<?php echo $users_access->update->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_update">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_update"><?php echo $users_access->update->caption() ?><?php echo ($users_access->update->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->update->cellAttributes() ?>>
<span id="el_users_access_update">
<?php
$selwrk = (ConvertToBool($users_access->update->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_update" name="x_update[]" id="x_update[]" value="1"<?php echo $selwrk ?><?php echo $users_access->update->editAttributes() ?>>
</span>
<?php echo $users_access->update->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->delete->Visible) { // delete ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_delete" class="form-group row">
		<label id="elh_users_access_delete" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->delete->caption() ?><?php echo ($users_access->delete->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->delete->cellAttributes() ?>>
<span id="el_users_access_delete">
<?php
$selwrk = (ConvertToBool($users_access->delete->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_delete" name="x_delete[]" id="x_delete[]" value="1"<?php echo $selwrk ?><?php echo $users_access->delete->editAttributes() ?>>
</span>
<?php echo $users_access->delete->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_delete">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_delete"><?php echo $users_access->delete->caption() ?><?php echo ($users_access->delete->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->delete->cellAttributes() ?>>
<span id="el_users_access_delete">
<?php
$selwrk = (ConvertToBool($users_access->delete->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_delete" name="x_delete[]" id="x_delete[]" value="1"<?php echo $selwrk ?><?php echo $users_access->delete->editAttributes() ?>>
</span>
<?php echo $users_access->delete->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->view->Visible) { // view ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_view" class="form-group row">
		<label id="elh_users_access_view" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->view->caption() ?><?php echo ($users_access->view->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->view->cellAttributes() ?>>
<span id="el_users_access_view">
<?php
$selwrk = (ConvertToBool($users_access->view->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_view" name="x_view[]" id="x_view[]" value="1"<?php echo $selwrk ?><?php echo $users_access->view->editAttributes() ?>>
</span>
<?php echo $users_access->view->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_view">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_view"><?php echo $users_access->view->caption() ?><?php echo ($users_access->view->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->view->cellAttributes() ?>>
<span id="el_users_access_view">
<?php
$selwrk = (ConvertToBool($users_access->view->CurrentValue)) ? " checked" : "";
?>
<input type="checkbox" data-table="users_access" data-field="x_view" name="x_view[]" id="x_view[]" value="1"<?php echo $selwrk ?><?php echo $users_access->view->editAttributes() ?>>
</span>
<?php echo $users_access->view->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->campus->Visible) { // campus ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_campus" class="form-group row">
		<label id="elh_users_access_campus" for="x_campus" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->campus->caption() ?><?php echo ($users_access->campus->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->campus->cellAttributes() ?>>
<span id="el_users_access_campus">
<input type="text" data-table="users_access" data-field="x_campus" name="x_campus" id="x_campus" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->campus->getPlaceHolder()) ?>" value="<?php echo $users_access->campus->EditValue ?>"<?php echo $users_access->campus->editAttributes() ?>>
</span>
<?php echo $users_access->campus->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_campus">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_campus"><?php echo $users_access->campus->caption() ?><?php echo ($users_access->campus->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->campus->cellAttributes() ?>>
<span id="el_users_access_campus">
<input type="text" data-table="users_access" data-field="x_campus" name="x_campus" id="x_campus" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->campus->getPlaceHolder()) ?>" value="<?php echo $users_access->campus->EditValue ?>"<?php echo $users_access->campus->editAttributes() ?>>
</span>
<?php echo $users_access->campus->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->school->Visible) { // school ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_school" class="form-group row">
		<label id="elh_users_access_school" for="x_school" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->school->caption() ?><?php echo ($users_access->school->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->school->cellAttributes() ?>>
<span id="el_users_access_school">
<input type="text" data-table="users_access" data-field="x_school" name="x_school" id="x_school" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->school->getPlaceHolder()) ?>" value="<?php echo $users_access->school->EditValue ?>"<?php echo $users_access->school->editAttributes() ?>>
</span>
<?php echo $users_access->school->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_school">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_school"><?php echo $users_access->school->caption() ?><?php echo ($users_access->school->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->school->cellAttributes() ?>>
<span id="el_users_access_school">
<input type="text" data-table="users_access" data-field="x_school" name="x_school" id="x_school" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->school->getPlaceHolder()) ?>" value="<?php echo $users_access->school->EditValue ?>"<?php echo $users_access->school->editAttributes() ?>>
</span>
<?php echo $users_access->school->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access->department->Visible) { // department ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
	<div id="r_department" class="form-group row">
		<label id="elh_users_access_department" for="x_department" class="<?php echo $users_access_add->LeftColumnClass ?>"><?php echo $users_access->department->caption() ?><?php echo ($users_access->department->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
		<div class="<?php echo $users_access_add->RightColumnClass ?>"><div<?php echo $users_access->department->cellAttributes() ?>>
<span id="el_users_access_department">
<input type="text" data-table="users_access" data-field="x_department" name="x_department" id="x_department" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->department->getPlaceHolder()) ?>" value="<?php echo $users_access->department->EditValue ?>"<?php echo $users_access->department->editAttributes() ?>>
</span>
<?php echo $users_access->department->CustomMsg ?></div></div>
	</div>
<?php } else { ?>
	<tr id="r_department">
		<td class="<?php echo $users_access_add->TableLeftColumnClass ?>"><span id="elh_users_access_department"><?php echo $users_access->department->caption() ?><?php echo ($users_access->department->Required) ? $Language->phrase("FieldRequiredIndicator") : "" ?></span></td>
		<td<?php echo $users_access->department->cellAttributes() ?>>
<span id="el_users_access_department">
<input type="text" data-table="users_access" data-field="x_department" name="x_department" id="x_department" size="30" maxlength="50" placeholder="<?php echo HtmlEncode($users_access->department->getPlaceHolder()) ?>" value="<?php echo $users_access->department->EditValue ?>"<?php echo $users_access->department->editAttributes() ?>>
</span>
<?php echo $users_access->department->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php } ?>
<?php if ($users_access_add->IsMobileOrModal) { ?>
</div><!-- /page* -->
<?php } else { ?>
</table><!-- /table* -->
<?php } ?>
<?php if (!$users_access_add->IsModal) { ?>
<div class="form-group row"><!-- buttons .form-group -->
	<div class="<?php echo $users_access_add->OffsetColumnClass ?>"><!-- buttons offset -->
<button class="btn btn-primary ew-btn" name="btn-action" id="btn-action" type="submit"><?php echo $Language->phrase("AddBtn") ?></button>
<button class="btn btn-default ew-btn" name="btn-cancel" id="btn-cancel" type="button" data-href="<?php echo $users_access_add->getReturnUrl() ?>"><?php echo $Language->phrase("CancelBtn") ?></button>
	</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<?php } ?>
<?php if (!$users_access_add->IsMobileOrModal) { ?>
</div><!-- /desktop -->
<?php } ?>
</form>
<?php
$users_access_add->showPageFooter();
if (DEBUG_ENABLED)
	echo GetDebugMessage();
?>
<script>

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$users_access_add->terminate();
?>
