Location: PHPKode > projects > Science Lab Inventory & Order Management > sciencelabinv/storesview.php
<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "storesinfo.php" ?>
<?php include "roomsinfo.php" ?>
<?php include "useraccountsinfo.php" ?>
<?php include "userfn7.php" ?>
<?php

// Create page object
$stores_view = new cstores_view();
$Page =& $stores_view;

// Page init
$stores_view->Page_Init();

// Page main
$stores_view->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($stores->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var stores_view = new ew_Page("stores_view");

// page properties
stores_view.PageID = "view"; // page ID
stores_view.FormID = "fstoresview"; // form ID
var EW_PAGE_ID = stores_view.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
stores_view.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
stores_view.SelectAllKey = function(elem) {
	ew_SelectAll(elem);
	ew_ClickAll(elem);
}
<?php if (EW_CLIENT_VALIDATE) { ?>
stores_view.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
stores_view.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<p><span class="phpmaker"><?php echo $Language->Phrase("View") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $stores->TableCaption() ?>
<br><br>
<?php if ($stores->Export == "") { ?>
<a href="<?php echo $stores_view->ListUrl ?>"><?php echo $Language->Phrase("BackToList") ?></a>&nbsp;
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $stores_view->AddUrl ?>"><?php echo $Language->Phrase("ViewPageAddLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<a href="<?php echo $stores_view->EditUrl ?>"><?php echo $Language->Phrase("ViewPageEditLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $stores_view->CopyUrl ?>"><?php echo $Language->Phrase("ViewPageCopyLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanDelete()) { ?>
<a href="<?php echo $stores_view->DeleteUrl ?>"><?php echo $Language->Phrase("ViewPageDeleteLink") ?></a>&nbsp;
<?php } ?>
<a href="itemslist.php?<?php echo EW_TABLE_SHOW_MASTER ?>=stores&id=<?php echo urlencode(strval($stores->id->CurrentValue)) ?>"><?php echo $Language->Phrase("ViewPageDetailLink") ?><?php echo $Language->TablePhrase("items", "TblCaption") ?>
</a>
&nbsp;
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$stores_view->ShowMessage();
?>
<p>
<?php if ($stores->Export == "") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($stores_view->Pager)) $stores_view->Pager = new cPrevNextPager($stores_view->lStartRec, $stores_view->lDisplayRecs, $stores_view->lTotalRecs) ?>
<?php if ($stores_view->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($stores_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($stores_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $stores_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($stores_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($stores_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $stores_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($stores_view->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<br>
<?php } ?>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($stores->id->Visible) { // id ?>
	<tr<?php echo $stores->id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $stores->id->FldCaption() ?></td>
		<td<?php echo $stores->id->CellAttributes() ?>>
<div<?php echo $stores->id->ViewAttributes() ?>><?php echo $stores->id->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($stores->name->Visible) { // name ?>
	<tr<?php echo $stores->name->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $stores->name->FldCaption() ?></td>
		<td<?php echo $stores->name->CellAttributes() ?>>
<div<?php echo $stores->name->ViewAttributes() ?>><?php echo $stores->name->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($stores->lock_no->Visible) { // lock_no ?>
	<tr<?php echo $stores->lock_no->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $stores->lock_no->FldCaption() ?></td>
		<td<?php echo $stores->lock_no->CellAttributes() ?>>
<div<?php echo $stores->lock_no->ViewAttributes() ?>><?php echo $stores->lock_no->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($stores->room_id->Visible) { // room_id ?>
	<tr<?php echo $stores->room_id->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $stores->room_id->FldCaption() ?></td>
		<td<?php echo $stores->room_id->CellAttributes() ?>>
<div<?php echo $stores->room_id->ViewAttributes() ?>><?php echo $stores->room_id->ViewValue ?></div></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<?php if ($stores->Export == "") { ?>
<br>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($stores_view->Pager)) $stores_view->Pager = new cPrevNextPager($stores_view->lStartRec, $stores_view->lDisplayRecs, $stores_view->lTotalRecs) ?>
<?php if ($stores_view->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($stores_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($stores_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $stores_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($stores_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($stores_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $stores_view->PageUrl() ?>start=<?php echo $stores_view->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $stores_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($stores_view->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<p>
<?php if ($stores->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

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

</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$stores_view->Page_Terminate();
?>
<?php

//
// Page class
//
class cstores_view {

	// Page ID
	var $PageID = 'view';

	// Table name
	var $TableName = 'stores';

	// Page object name
	var $PageObjName = 'stores_view';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $stores;
		if ($stores->UseTokenInUrl) $PageUrl .= "t=" . $stores->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $stores;
		if ($stores->UseTokenInUrl) {
			if ($objForm)
				return ($stores->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($stores->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function cstores_view() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (stores)
		$GLOBALS["stores"] = new cstores();

		// Table object (rooms)
		$GLOBALS['rooms'] = new crooms();

		// Table object (useraccounts)
		$GLOBALS['useraccounts'] = new cuseraccounts();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'view', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'stores', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $stores;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->TableName);
		$Security->TablePermission_Loaded();
		$Security->UserID_Loading();
		if ($Security->IsLoggedIn()) $Security->LoadUserID();
		$Security->UserID_Loaded();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $lDisplayRecs = 1;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $lRecCnt;
	var $arRecKey = array();

	//
	// Page main
	//
	function Page_Main() {
		global $Language, $stores;

		// Load current record
		$bLoadCurrentRecord = FALSE;
		$sReturnUrl = "";
		$bMatchRecord = FALSE;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET["id"] <> "") {
				$stores->id->setQueryStringValue($_GET["id"]);
				$this->arRecKey["id"] = $stores->id->QueryStringValue;
			} else {
				$bLoadCurrentRecord = TRUE;
			}

			// Get action
			$stores->CurrentAction = "I"; // Display form
			switch ($stores->CurrentAction) {
				case "I": // Get a record to display
					$this->lStartRec = 1; // Initialize start position
					if ($rs = $this->LoadRecordset()) // Load records
						$this->lTotalRecs = $rs->RecordCount(); // Get record count
					if ($this->lTotalRecs <= 0) { // No record found
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$this->Page_Terminate("storeslist.php"); // Return to list page
					} elseif ($bLoadCurrentRecord) { // Load current record position
						$this->SetUpStartRec(); // Set up start record position

						// Point to current record
						if (intval($this->lStartRec) <= intval($this->lTotalRecs)) {
							$bMatchRecord = TRUE;
							$rs->Move($this->lStartRec-1);
						}
					} else { // Match key values
						while (!$rs->EOF) {
							if (strval($stores->id->CurrentValue) == strval($rs->fields('id'))) {
								$stores->setStartRecordNumber($this->lStartRec); // Save record position
								$bMatchRecord = TRUE;
								break;
							} else {
								$this->lStartRec++;
								$rs->MoveNext();
							}
						}
					}
					if (!$bMatchRecord) {
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$sReturnUrl = "storeslist.php"; // No matching record, return to list
					} else {
						$this->LoadRowValues($rs); // Load row values
					}
			}
		} else {
			$sReturnUrl = "storeslist.php"; // Not page request, return to list
		}
		if ($sReturnUrl <> "")
			$this->Page_Terminate($sReturnUrl);

		// Render row
		$stores->RowType = EW_ROWTYPE_VIEW;
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $stores;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$stores->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$stores->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $stores->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$stores->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$stores->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$stores->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $stores;

		// Call Recordset Selecting event
		$stores->Recordset_Selecting($stores->CurrentFilter);

		// Load List page SQL
		$sSql = $stores->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $offset, $rowcnt";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$stores->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $stores;
		$sFilter = $stores->KeyFilter();

		// Call Row Selecting event
		$stores->Row_Selecting($sFilter);

		// Load SQL based on filter
		$stores->CurrentFilter = $sFilter;
		$sSql = $stores->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$stores->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $stores;
		$stores->id->setDbValue($rs->fields('id'));
		$stores->name->setDbValue($rs->fields('name'));
		$stores->lock_no->setDbValue($rs->fields('lock_no'));
		$stores->room_id->setDbValue($rs->fields('room_id'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $stores;

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->ExportWordUrl = $this->PageUrl() . "export=word&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv&" . "id=" . urlencode($stores->id->CurrentValue);
		$this->AddUrl = $stores->AddUrl();
		$this->EditUrl = $stores->EditUrl();
		$this->CopyUrl = $stores->CopyUrl();
		$this->DeleteUrl = $stores->DeleteUrl();
		$this->ListUrl = $stores->ListUrl();

		// Call Row_Rendering event
		$stores->Row_Rendering();

		// Common render codes for all row types
		// id

		$stores->id->CellCssStyle = ""; $stores->id->CellCssClass = "";
		$stores->id->CellAttrs = array(); $stores->id->ViewAttrs = array(); $stores->id->EditAttrs = array();

		// name
		$stores->name->CellCssStyle = ""; $stores->name->CellCssClass = "";
		$stores->name->CellAttrs = array(); $stores->name->ViewAttrs = array(); $stores->name->EditAttrs = array();

		// lock_no
		$stores->lock_no->CellCssStyle = ""; $stores->lock_no->CellCssClass = "";
		$stores->lock_no->CellAttrs = array(); $stores->lock_no->ViewAttrs = array(); $stores->lock_no->EditAttrs = array();

		// room_id
		$stores->room_id->CellCssStyle = ""; $stores->room_id->CellCssClass = "";
		$stores->room_id->CellAttrs = array(); $stores->room_id->ViewAttrs = array(); $stores->room_id->EditAttrs = array();
		if ($stores->RowType == EW_ROWTYPE_VIEW) { // View row

			// id
			$stores->id->ViewValue = $stores->id->CurrentValue;
			$stores->id->CssStyle = "";
			$stores->id->CssClass = "";
			$stores->id->ViewCustomAttributes = "";

			// name
			$stores->name->ViewValue = $stores->name->CurrentValue;
			$stores->name->CssStyle = "";
			$stores->name->CssClass = "";
			$stores->name->ViewCustomAttributes = "";

			// lock_no
			$stores->lock_no->ViewValue = $stores->lock_no->CurrentValue;
			$stores->lock_no->CssStyle = "";
			$stores->lock_no->CssClass = "";
			$stores->lock_no->ViewCustomAttributes = "";

			// room_id
			if (strval($stores->room_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = '" . ew_AdjustSql($stores->room_id->CurrentValue) . "'";
			$sSqlWrk = "SELECT `name` FROM `rooms`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `name` Asc";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$stores->room_id->ViewValue = $rswrk->fields('name');
					$rswrk->Close();
				} else {
					$stores->room_id->ViewValue = $stores->room_id->CurrentValue;
				}
			} else {
				$stores->room_id->ViewValue = NULL;
			}
			$stores->room_id->CssStyle = "";
			$stores->room_id->CssClass = "";
			$stores->room_id->ViewCustomAttributes = "";

			// id
			$stores->id->HrefValue = "";
			$stores->id->TooltipValue = "";

			// name
			$stores->name->HrefValue = "";
			$stores->name->TooltipValue = "";

			// lock_no
			$stores->lock_no->HrefValue = "";
			$stores->lock_no->TooltipValue = "";

			// room_id
			$stores->room_id->HrefValue = "";
			$stores->room_id->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($stores->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$stores->Row_Rendered();
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}
}
?>
Return current item: Science Lab Inventory & Order Management