<?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
$floor_list = new floor_list();

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

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

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

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

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

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

	// Dynamic selection lists
	// Filters

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

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

});
</script>
<?php } ?>
<?php if (!$floor_list->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php if ($floor_list->TotalRecords > 0 && $floor_list->ExportOptions->visible()) { ?>
<?php $floor_list->ExportOptions->render("body") ?>
<?php } ?>
<?php if ($floor_list->ImportOptions->visible()) { ?>
<?php $floor_list->ImportOptions->render("body") ?>
<?php } ?>
<?php if ($floor_list->SearchOptions->visible()) { ?>
<?php $floor_list->SearchOptions->render("body") ?>
<?php } ?>
<?php if ($floor_list->FilterOptions->visible()) { ?>
<?php $floor_list->FilterOptions->render("body") ?>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php
$floor_list->renderOtherOptions();
?>
<?php if ($Security->CanSearch()) { ?>
<?php if (!$floor_list->isExport() && !$floor->CurrentAction) { ?>
<form name="ffloorlistsrch" id="ffloorlistsrch" class="form-inline ew-form ew-ext-search-form" action="<?php echo CurrentPageName() ?>">
<div id="ffloorlistsrch-search-panel" class="<?php echo $floor_list->SearchPanelClass ?>">
<input type="hidden" name="cmd" value="search">
<input type="hidden" name="t" value="floor">
	<div class="ew-extended-search">
<div id="xsr_<?php echo $floor_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($floor_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($floor_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 $floor_list->BasicSearch->getTypeNameShort() ?></span></button>
			<div class="dropdown-menu dropdown-menu-right">
				<a class="dropdown-item<?php if ($floor_list->BasicSearch->getType() == "") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this);"><?php echo $Language->phrase("QuickSearchAuto") ?></a>
				<a class="dropdown-item<?php if ($floor_list->BasicSearch->getType() == "=") { ?> active<?php } ?>" href="#" onclick="return ew.setSearchType(this, '=');"><?php echo $Language->phrase("QuickSearchExact") ?></a>
				<a class="dropdown-item<?php if ($floor_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 ($floor_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 $floor_list->showPageHeader(); ?>
<?php
$floor_list->showMessage();
?>
<?php if ($floor_list->TotalRecords > 0 || $floor->CurrentAction) { ?>
<div class="card ew-card ew-grid<?php if ($floor_list->isAddOrEdit()) { ?> ew-grid-add-edit<?php } ?> floor">
<?php if (!$floor_list->isExport()) { ?>
<div class="card-header ew-grid-upper-panel">
<?php if (!$floor_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $floor_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $floor_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
<form name="ffloorlist" id="ffloorlist" 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="floor">
<div id="gmp_floor" class="<?php echo ResponsiveTableClass() ?>card-body ew-grid-middle-panel">
<?php if ($floor_list->TotalRecords > 0 || $floor_list->isGridEdit()) { ?>
<table id="tbl_floorlist" class="table ew-table"><!-- .ew-table -->
<thead>
	<tr class="ew-table-header">
<?php

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

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

// Render list options (header, left)
$floor_list->ListOptions->render("header", "left");
?>
<?php if ($floor_list->id->Visible) { // id ?>
	<?php if ($floor_list->SortUrl($floor_list->id) == "") { ?>
		<th data-name="id" class="<?php echo $floor_list->id->headerCellClass() ?>"><div id="elh_floor_id" class="floor_id"><div class="ew-table-header-caption"><?php echo $floor_list->id->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="id" class="<?php echo $floor_list->id->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $floor_list->SortUrl($floor_list->id) ?>', 1);"><div id="elh_floor_id" class="floor_id">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $floor_list->id->caption() ?></span><span class="ew-table-header-sort"><?php if ($floor_list->id->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($floor_list->id->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($floor_list->Hostel_Name->Visible) { // Hostel_Name ?>
	<?php if ($floor_list->SortUrl($floor_list->Hostel_Name) == "") { ?>
		<th data-name="Hostel_Name" class="<?php echo $floor_list->Hostel_Name->headerCellClass() ?>"><div id="elh_floor_Hostel_Name" class="floor_Hostel_Name"><div class="ew-table-header-caption"><?php echo $floor_list->Hostel_Name->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Hostel_Name" class="<?php echo $floor_list->Hostel_Name->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $floor_list->SortUrl($floor_list->Hostel_Name) ?>', 1);"><div id="elh_floor_Hostel_Name" class="floor_Hostel_Name">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $floor_list->Hostel_Name->caption() ?></span><span class="ew-table-header-sort"><?php if ($floor_list->Hostel_Name->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($floor_list->Hostel_Name->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php if ($floor_list->Floor->Visible) { // Floor ?>
	<?php if ($floor_list->SortUrl($floor_list->Floor) == "") { ?>
		<th data-name="Floor" class="<?php echo $floor_list->Floor->headerCellClass() ?>"><div id="elh_floor_Floor" class="floor_Floor"><div class="ew-table-header-caption"><?php echo $floor_list->Floor->caption() ?></div></div></th>
	<?php } else { ?>
		<th data-name="Floor" class="<?php echo $floor_list->Floor->headerCellClass() ?>"><div class="ew-pointer" onclick="ew.sort(event, '<?php echo $floor_list->SortUrl($floor_list->Floor) ?>', 1);"><div id="elh_floor_Floor" class="floor_Floor">
			<div class="ew-table-header-btn"><span class="ew-table-header-caption"><?php echo $floor_list->Floor->caption() ?><?php echo $Language->phrase("SrchLegend") ?></span><span class="ew-table-header-sort"><?php if ($floor_list->Floor->getSort() == "ASC") { ?><i class="fas fa-sort-up"></i><?php } elseif ($floor_list->Floor->getSort() == "DESC") { ?><i class="fas fa-sort-down"></i><?php } ?></span></div>
		</div></div></th>
	<?php } ?>
<?php } ?>
<?php

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

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

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

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

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

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

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

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

// Render list options (body, left)
$floor_list->ListOptions->render("body", "left", $floor_list->RowCount);
?>
	<?php if ($floor_list->id->Visible) { // id ?>
		<td data-name="id" <?php echo $floor_list->id->cellAttributes() ?>>
<span id="el<?php echo $floor_list->RowCount ?>_floor_id">
<span<?php echo $floor_list->id->viewAttributes() ?>><?php echo $floor_list->id->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($floor_list->Hostel_Name->Visible) { // Hostel_Name ?>
		<td data-name="Hostel_Name" <?php echo $floor_list->Hostel_Name->cellAttributes() ?>>
<span id="el<?php echo $floor_list->RowCount ?>_floor_Hostel_Name">
<span<?php echo $floor_list->Hostel_Name->viewAttributes() ?>><?php echo $floor_list->Hostel_Name->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
	<?php if ($floor_list->Floor->Visible) { // Floor ?>
		<td data-name="Floor" <?php echo $floor_list->Floor->cellAttributes() ?>>
<span id="el<?php echo $floor_list->RowCount ?>_floor_Floor">
<span<?php echo $floor_list->Floor->viewAttributes() ?>><?php echo $floor_list->Floor->getViewValue() ?></span>
</span>
</td>
	<?php } ?>
<?php

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

// Close recordset
if ($floor_list->Recordset)
	$floor_list->Recordset->Close();
?>
<?php if (!$floor_list->isExport()) { ?>
<div class="card-footer ew-grid-lower-panel">
<?php if (!$floor_list->isGridAdd()) { ?>
<form name="ew-pager-form" class="form-inline ew-form ew-pager-form" action="<?php echo CurrentPageName() ?>">
<?php echo $floor_list->Pager->render() ?>
</form>
<?php } ?>
<div class="ew-list-other-options">
<?php $floor_list->OtherOptions->render("body", "bottom") ?>
</div>
<div class="clearfix"></div>
</div>
<?php } ?>
</div><!-- /.ew-grid -->
<?php } ?>
<?php if ($floor_list->TotalRecords == 0 && !$floor->CurrentAction) { // Show other options ?>
<div class="ew-list-other-options">
<?php $floor_list->OtherOptions->render("body") ?>
</div>
<div class="clearfix"></div>
<?php } ?>
<?php
$floor_list->showPageFooter();
if (Config("DEBUG"))
	echo GetDebugMessage();
?>
<?php if (!$floor_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
$floor_list->terminate();
?>