<?php
namespace PHPMaker2020\hostelmgr20;

// 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
$staff_list = new staff_list();

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

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

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

// Page Rendering event
$staff_list->Page_Render();
?>
<?php include_once "header.php"; ?>
<?php if (!$staff_list->isExport()) { ?>
<script>
var fstafflist, currentPageID;
loadjs.ready("head", function() {

	// Form object
	currentPageID = ew.PAGE_ID = "list";
	fstafflist = currentForm = new ew.Form("fstafflist", "list");
	fstafflist.formKeyCountName = '<?php echo $staff_list->FormKeyCountName ?>';
	loadjs.done("fstafflist");
});
var fstafflistsrch;
loadjs.ready("head", function() {

	// Form object for search
	fstafflistsrch = currentSearchForm = new ew.Form("fstafflistsrch");

	// Dynamic selection lists
	// Filters

	fstafflistsrch.filterList = <?php echo $staff_list->getFilterList() ?>;
	loadjs.done("fstafflistsrch");
});
</script>
<script>
loadjs.ready("head", function() {

	// Client script
	// Write your client script here, no need to add script tags.

});
</script>
<?php } ?>
<?php if (!$staff_list->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($staff_list->TotalRecords > 0 && $staff_list->ExportOptions->visible()) { ?>
<?php $staff_list->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($staff_list->ImportOptions->visible()) { ?>
<?php $staff_list->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($staff_list->SearchOptions->visible()) { ?>
<?php $staff_list->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($staff_list->FilterOptions->visible()) { ?>
<?php $staff_list->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$staff_list->renderOtherOptions();
?>
<?php if ($Security->CanSearch()) { ?>
<?php if (!$staff_list->isExport() && !$staff->CurrentAction) { ?>
<form name="fstafflistsrch" id="fstafflistsrch" class="form-inline ew-form ew-ext-search-form" action="<?php echo CurrentPageName() ?>">
<div id="fstafflistsrch-search-panel" class="<?php echo $staff_list->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="staff">
	<div class="ew-extended-search">
<div id="xsr_<?php echo $staff_list->SearchRowCount + 1 ?>" class="ew-row d-sm-flex">
	<div class="ew-quick-search input-group">
		<input type="text" name="<?php echo Config("TABLE_BASIC_SEARCH") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH") ?>" class="form-control" value="<?php echo HtmlEncode($staff_list->BasicSearch->getKeyword()) ?>" placeholder="<?php echo HtmlEncode($Language->phrase("Search")) ?>">
		<input type="hidden" name="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" id="<?php echo Config("TABLE_BASIC_SEARCH_TYPE") ?>" value="<?php echo HtmlEncode($staff_list->BasicSearch->getType()) ?>">
		<div class="input-group-append">
			<button class="btn btn-primary" name="btn-submit" id="btn-submit" type="submit"><?php echo $Language->phrase("SearchBtn") ?></button>
			<button type="button" data-toggle="dropdown" class="btn btn-primary dropdown-toggle dropdown-toggle-split" aria-haspopup="true" aria-expanded="false"><span id="searchtype"><?php echo $staff_list->BasicSearch->getTypeNameShort() ?></span></button>
			<div class="dropdown-menu dropdown-menu-right">
				<a class="dropdown-item<?php if ($staff_list->BasicSearch->getType() == "") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this);"><?php echo $Language->phrase("QuickSearchAuto") ?></a>
				<a class="dropdown-item<?php if ($staff_list->BasicSearch->getType() == "=") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, '=');"><?php echo $Language->phrase("QuickSearchExact") ?></a>
				<a class="dropdown-item<?php if ($staff_list->BasicSearch->getType() == "AND") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'AND');"><?php echo $Language->phrase("QuickSearchAll") ?></a>
				<a class="dropdown-item<?php if ($staff_list->BasicSearch->getType() == "OR") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, 'OR');"><?php echo $Language->phrase("QuickSearchAny") ?></a>
			</div>
		</div>
	</div>
</div>
	</div><!-- /.ew-extended-search -->
</div><!-- /.ew-search-panel -->
</form>
<?php } ?>
<?php } ?>
<?php $staff_list->showPageHeader(); ?>
<?php
$staff_list->showMessage();
?>
<?php if ($staff_list->TotalRecords > 0 || $staff->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($staff_list->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> staff">
<?php if (!$staff_list->isExport()) { ?>
<div class="card-header ew-grid-upper-panel">
<?php if (!$staff_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $staff_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $staff_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
<form name="fstafflist" id="fstafflist" class="form-inline ew-form ew-list-form" action="<?php echo CurrentPageName() ?>" method="post">
<?php if ($Page->CheckToken) { ?>
<input type="hidden" name="<?php echo Config("TOKEN_NAME") ?>" value="<?php echo $Page->Token ?>">
<?php } ?>
<input type="hidden" name="t" value="staff">
<div id="gmp_staff" class="<?php echo ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($staff_list->TotalRecords > 0 || $staff_list->isGridEdit()) { ?>
<table id="tbl_stafflist" class="table ew-table"><!-- .ew-table -->
<thead>
	<tr class="ew-table-header">
<?php

// Header row
$staff->RowType = ROWTYPE_HEADER;

// Render list options
$staff_list->renderListOptions();

// Render list options (header, left)
$staff_list->ListOptions->render("header", "left");
?>
<?php if ($staff_list->id->Visible) { // id ?>
	<?php if ($staff_list->SortUrl($staff_list->id) == "") { ?>
		<th data-name="id" class="<?php echo $staff_list->id->headerCellClass() ?>"><div id="elh_staff_id" class="staff_id"><div class="ew-table-header-caption"><?php echo $staff_list->id->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="id" class="<?php echo $staff_list->id->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->id) ?>', 1);"><div id="elh_staff_id" class="staff_id">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->id->caption() ?></span><span class="ew-table-header-sort"><?php if ($staff_list->id->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->id->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->Staff_Name->Visible) { // Staff_Name ?>
	<?php if ($staff_list->SortUrl($staff_list->Staff_Name) == "") { ?>
		<th data-name="Staff_Name" class="<?php echo $staff_list->Staff_Name->headerCellClass() ?>"><div id="elh_staff_Staff_Name" class="staff_Staff_Name"><div class="ew-table-header-caption"><?php echo $staff_list->Staff_Name->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Staff_Name" class="<?php echo $staff_list->Staff_Name->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->Staff_Name) ?>', 1);"><div id="elh_staff_Staff_Name" class="staff_Staff_Name">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->Staff_Name->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($staff_list->Staff_Name->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->Staff_Name->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->ContactNo->Visible) { // ContactNo ?>
	<?php if ($staff_list->SortUrl($staff_list->ContactNo) == "") { ?>
		<th data-name="ContactNo" class="<?php echo $staff_list->ContactNo->headerCellClass() ?>"><div id="elh_staff_ContactNo" class="staff_ContactNo"><div class="ew-table-header-caption"><?php echo $staff_list->ContactNo->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="ContactNo" class="<?php echo $staff_list->ContactNo->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->ContactNo) ?>', 1);"><div id="elh_staff_ContactNo" class="staff_ContactNo">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->ContactNo->caption() ?></span><span class="ew-table-header-sort"><?php if ($staff_list->ContactNo->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->ContactNo->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->_email->Visible) { // email ?>
	<?php if ($staff_list->SortUrl($staff_list->_email) == "") { ?>
		<th data-name="_email" class="<?php echo $staff_list->_email->headerCellClass() ?>"><div id="elh_staff__email" class="staff__email"><div class="ew-table-header-caption"><?php echo $staff_list->_email->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="_email" class="<?php echo $staff_list->_email->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->_email) ?>', 1);"><div id="elh_staff__email" class="staff__email">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->_email->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($staff_list->_email->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->_email->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->password->Visible) { // password ?>
	<?php if ($staff_list->SortUrl($staff_list->password) == "") { ?>
		<th data-name="password" class="<?php echo $staff_list->password->headerCellClass() ?>"><div id="elh_staff_password" class="staff_password"><div class="ew-table-header-caption"><?php echo $staff_list->password->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="password" class="<?php echo $staff_list->password->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->password) ?>', 1);"><div id="elh_staff_password" class="staff_password">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->password->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($staff_list->password->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->password->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->userlevel->Visible) { // userlevel ?>
	<?php if ($staff_list->SortUrl($staff_list->userlevel) == "") { ?>
		<th data-name="userlevel" class="<?php echo $staff_list->userlevel->headerCellClass() ?>"><div id="elh_staff_userlevel" class="staff_userlevel"><div class="ew-table-header-caption"><?php echo $staff_list->userlevel->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="userlevel" class="<?php echo $staff_list->userlevel->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->userlevel) ?>', 1);"><div id="elh_staff_userlevel" class="staff_userlevel">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->userlevel->caption() ?></span><span class="ew-table-header-sort"><?php if ($staff_list->userlevel->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->userlevel->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($staff_list->profile->Visible) { // profile ?>
	<?php if ($staff_list->SortUrl($staff_list->profile) == "") { ?>
		<th data-name="profile" class="<?php echo $staff_list->profile->headerCellClass() ?>"><div id="elh_staff_profile" class="staff_profile"><div class="ew-table-header-caption"><?php echo $staff_list->profile->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="profile" class="<?php echo $staff_list->profile->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $staff_list->SortUrl($staff_list->profile) ?>', 1);"><div id="elh_staff_profile" class="staff_profile">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $staff_list->profile->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($staff_list->profile->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($staff_list->profile->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

// Render list options (header, right)
$staff_list->ListOptions->render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
if ($staff_list->ExportAll && $staff_list->isExport()) {
	$staff_list->StopRecord = $staff_list->TotalRecords;
} else {

	// Set the last record to display
	if ($staff_list->TotalRecords > $staff_list->StartRecord + $staff_list->DisplayRecords - 1)
		$staff_list->StopRecord = $staff_list->StartRecord + $staff_list->DisplayRecords - 1;
	else
		$staff_list->StopRecord = $staff_list->TotalRecords;
}
$staff_list->RecordCount = $staff_list->StartRecord - 1;
if ($staff_list->Recordset && !$staff_list->Recordset->EOF) {
	$staff_list->Recordset->moveFirst();
	$selectLimit = $staff_list->UseSelectLimit;
	if (!$selectLimit && $staff_list->StartRecord > 1)
		$staff_list->Recordset->move($staff_list->StartRecord - 1);
} elseif (!$staff->AllowAddDeleteRow && $staff_list->StopRecord == 0) {
	$staff_list->StopRecord = $staff->GridAddRowCount;
}

// Initialize aggregate
$staff->RowType = ROWTYPE_AGGREGATEINIT;
$staff->resetAttributes();
$staff_list->renderRow();
while ($staff_list->RecordCount < $staff_list->StopRecord) {
	$staff_list->RecordCount++;
	if ($staff_list->RecordCount >= $staff_list->StartRecord) {
		$staff_list->RowCount++;

		// Set up key count
		$staff_list->KeyCount = $staff_list->RowIndex;

		// Init row class and style
		$staff->resetAttributes();
		$staff->CssClass = "";
		if ($staff_list->isGridAdd()) {
		} else {
			$staff_list->loadRowValues($staff_list->Recordset); // Load row values
		}
		$staff->RowType = ROWTYPE_VIEW; // Render view

		// Set up row id / data-rowindex
		$staff->RowAttrs->merge(["data-rowindex" => $staff_list->RowCount, "id" => "r" . $staff_list->RowCount . "_staff", "data-rowtype" => $staff->RowType]);

		// Render row
		$staff_list->renderRow();

		// Render list options
		$staff_list->renderListOptions();
?>
	<tr <?php echo $staff->rowAttributes() ?>>
<?php

// Render list options (body, left)
$staff_list->ListOptions->render("body", "left", $staff_list->RowCount);
?>
	<?php if ($staff_list->id->Visible) { // id ?>
		<td data-name="id" <?php echo $staff_list->id->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_id">
<span<?php echo $staff_list->id->viewAttributes() ?>><?php echo $staff_list->id->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->Staff_Name->Visible) { // Staff_Name ?>
		<td data-name="Staff_Name" <?php echo $staff_list->Staff_Name->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_Staff_Name">
<span<?php echo $staff_list->Staff_Name->viewAttributes() ?>><?php echo $staff_list->Staff_Name->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->ContactNo->Visible) { // ContactNo ?>
		<td data-name="ContactNo" <?php echo $staff_list->ContactNo->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_ContactNo">
<span<?php echo $staff_list->ContactNo->viewAttributes() ?>><?php echo $staff_list->ContactNo->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->_email->Visible) { // email ?>
		<td data-name="_email" <?php echo $staff_list->_email->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff__email">
<span<?php echo $staff_list->_email->viewAttributes() ?>><?php echo $staff_list->_email->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->password->Visible) { // password ?>
		<td data-name="password" <?php echo $staff_list->password->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_password">
<span<?php echo $staff_list->password->viewAttributes() ?>><?php echo $staff_list->password->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->userlevel->Visible) { // userlevel ?>
		<td data-name="userlevel" <?php echo $staff_list->userlevel->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_userlevel">
<span<?php echo $staff_list->userlevel->viewAttributes() ?>><?php echo $staff_list->userlevel->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($staff_list->profile->Visible) { // profile ?>
		<td data-name="profile" <?php echo $staff_list->profile->cellAttributes() ?>>
<span id="el<?php echo $staff_list->RowCount ?>_staff_profile">
<span<?php echo $staff_list->profile->viewAttributes() ?>><?php echo $staff_list->profile->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$staff_list->ListOptions->render("body", "right", $staff_list->RowCount);
?>
	</tr>
<?php
	}
	if (!$staff_list->isGridAdd())
		$staff_list->Recordset->moveNext();
}
?>
</tbody>
</table><!-- /.ew-table -->
<?php } ?>
</div><!-- /.ew-grid-middle-panel -->
<?php if (!$staff->CurrentAction) { ?>
<input type="hidden" name="action" id="action" value="">
<?php } ?>
</form><!-- /.ew-list-form -->
<?php

// Close recordset
if ($staff_list->Recordset)
	$staff_list->Recordset->Close();
?>
<?php if (!$staff_list->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$staff_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $staff_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $staff_list->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($staff_list->TotalRecords == 0 && !$staff->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $staff_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$staff_list->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<?php if (!$staff_list->isExport()) { ?>
<script>
loadjs.ready("load", function() {

	// Startup script
	// Write your table-specific startup script here
	// console.log("page loaded");

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