<?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 "tbl_ruuning_characterinfo.php" ?>
<?php include "tbl_admininfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$tbl_ruuning_character_list = new ctbl_ruuning_character_list();
$Page =& $tbl_ruuning_character_list;

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

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

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

// page properties
tbl_ruuning_character_list.PageID = "list"; // page ID
tbl_ruuning_character_list.FormID = "ftbl_ruuning_characterlist"; // form ID
var EW_PAGE_ID = tbl_ruuning_character_list.PageID; // for backward compatibility

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

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

//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</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 } ?>
<?php if ($tbl_ruuning_character->Export == "") { ?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$tbl_ruuning_character_list->lTotalRecs = $tbl_ruuning_character->SelectRecordCount();
	} else {
		if ($rs = $tbl_ruuning_character_list->LoadRecordset())
			$tbl_ruuning_character_list->lTotalRecs = $rs->RecordCount();
	}
	$tbl_ruuning_character_list->lStartRec = 1;
	if ($tbl_ruuning_character_list->lDisplayRecs <= 0 || ($tbl_ruuning_character->Export <> "" && $tbl_ruuning_character->ExportAll)) // Display all records
		$tbl_ruuning_character_list->lDisplayRecs = $tbl_ruuning_character_list->lTotalRecs;
	if (!($tbl_ruuning_character->Export <> "" && $tbl_ruuning_character->ExportAll))
		$tbl_ruuning_character_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $tbl_ruuning_character_list->LoadRecordset($tbl_ruuning_character_list->lStartRec-1, $tbl_ruuning_character_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $tbl_ruuning_character->TableCaption() ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$tbl_ruuning_character_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<form name="ftbl_ruuning_characterlist" id="ftbl_ruuning_characterlist" class="ewForm" action="" method="post">
<div id="gmp_tbl_ruuning_character" class="ewGridMiddlePanel">
<?php if ($tbl_ruuning_character_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $tbl_ruuning_character->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$tbl_ruuning_character_list->RenderListOptions();

// Render list options (header, left)
$tbl_ruuning_character_list->ListOptions->Render("header", "left");
?>
<?php if ($tbl_ruuning_character->language_id->Visible) { // language_id ?>
	<?php if ($tbl_ruuning_character->SortUrl($tbl_ruuning_character->language_id) == "") { ?>
		<td><?php echo $tbl_ruuning_character->language_id->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $tbl_ruuning_character->SortUrl($tbl_ruuning_character->language_id) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $tbl_ruuning_character->language_id->FldCaption() ?></td><td style="width: 10px;"><?php if ($tbl_ruuning_character->language_id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($tbl_ruuning_character->language_id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$tbl_ruuning_character_list->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<?php
if ($tbl_ruuning_character->ExportAll && $tbl_ruuning_character->Export <> "") {
	$tbl_ruuning_character_list->lStopRec = $tbl_ruuning_character_list->lTotalRecs;
} else {
	$tbl_ruuning_character_list->lStopRec = $tbl_ruuning_character_list->lStartRec + $tbl_ruuning_character_list->lDisplayRecs - 1; // Set the last record to display
}
$tbl_ruuning_character_list->lRecCount = $tbl_ruuning_character_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
	$rs->MoveFirst();
	if (!$bSelectLimit && $tbl_ruuning_character_list->lStartRec > 1)
		$rs->Move($tbl_ruuning_character_list->lStartRec - 1);
}

// Initialize aggregate
$tbl_ruuning_character->RowType = EW_ROWTYPE_AGGREGATEINIT;
$tbl_ruuning_character_list->RenderRow();
$tbl_ruuning_character_list->lRowCnt = 0;
while (($tbl_ruuning_character->CurrentAction == "gridadd" || !$rs->EOF) &&
	$tbl_ruuning_character_list->lRecCount < $tbl_ruuning_character_list->lStopRec) {
	$tbl_ruuning_character_list->lRecCount++;
	if (intval($tbl_ruuning_character_list->lRecCount) >= intval($tbl_ruuning_character_list->lStartRec)) {
		$tbl_ruuning_character_list->lRowCnt++;

	// Init row class and style
	$tbl_ruuning_character->CssClass = "";
	$tbl_ruuning_character->CssStyle = "";
	$tbl_ruuning_character->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
	if ($tbl_ruuning_character->CurrentAction == "gridadd") {
		$tbl_ruuning_character_list->LoadDefaultValues(); // Load default values
	} else {
		$tbl_ruuning_character_list->LoadRowValues($rs); // Load row values
	}
	$tbl_ruuning_character->RowType = EW_ROWTYPE_VIEW; // Render view

	// Render row
	$tbl_ruuning_character_list->RenderRow();

	// Render list options
	$tbl_ruuning_character_list->RenderListOptions();
?>
	<tr<?php echo $tbl_ruuning_character->RowAttributes() ?>>
<?php

// Render list options (body, left)
$tbl_ruuning_character_list->ListOptions->Render("body", "left");
?>
	<?php if ($tbl_ruuning_character->language_id->Visible) { // language_id ?>
		<td<?php echo $tbl_ruuning_character->language_id->CellAttributes() ?>>
<div<?php echo $tbl_ruuning_character->language_id->ViewAttributes() ?>><?php echo $tbl_ruuning_character->language_id->ListViewValue() ?></div>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$tbl_ruuning_character_list->ListOptions->Render("body", "right");
?>
	</tr>
<?php
	}
	if ($tbl_ruuning_character->CurrentAction <> "gridadd")
		$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($tbl_ruuning_character->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($tbl_ruuning_character->CurrentAction <> "gridadd" && $tbl_ruuning_character->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<span class="phpmaker">
<?php if (!isset($tbl_ruuning_character_list->Pager)) $tbl_ruuning_character_list->Pager = new cNumericPager($tbl_ruuning_character_list->lStartRec, $tbl_ruuning_character_list->lDisplayRecs, $tbl_ruuning_character_list->lTotalRecs, $tbl_ruuning_character_list->lRecRange) ?>
<?php if ($tbl_ruuning_character_list->Pager->RecordCount > 0) { ?>
	<?php if ($tbl_ruuning_character_list->Pager->FirstButton->Enabled) { ?>
	<a href="<?php echo $tbl_ruuning_character_list->PageUrl() ?>start=<?php echo $tbl_ruuning_character_list->Pager->FirstButton->Start ?>"><b><?php echo $Language->Phrase("PagerFirst") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_ruuning_character_list->Pager->PrevButton->Enabled) { ?>
	<a href="<?php echo $tbl_ruuning_character_list->PageUrl() ?>start=<?php echo $tbl_ruuning_character_list->Pager->PrevButton->Start ?>"><b><?php echo $Language->Phrase("PagerPrevious") ?></b></a>&nbsp;
	<?php } ?>
	<?php foreach ($tbl_ruuning_character_list->Pager->Items as $PagerItem) { ?>
		<?php if ($PagerItem->Enabled) { ?><a href="<?php echo $tbl_ruuning_character_list->PageUrl() ?>start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?>&nbsp;
	<?php } ?>
	<?php if ($tbl_ruuning_character_list->Pager->NextButton->Enabled) { ?>
	<a href="<?php echo $tbl_ruuning_character_list->PageUrl() ?>start=<?php echo $tbl_ruuning_character_list->Pager->NextButton->Start ?>"><b><?php echo $Language->Phrase("PagerNext") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_ruuning_character_list->Pager->LastButton->Enabled) { ?>
	<a href="<?php echo $tbl_ruuning_character_list->PageUrl() ?>start=<?php echo $tbl_ruuning_character_list->Pager->LastButton->Start ?>"><b><?php echo $Language->Phrase("PagerLast") ?></b></a>&nbsp;
	<?php } ?>
	<?php if ($tbl_ruuning_character_list->Pager->ButtonCount > 0) { ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php } ?>
	<?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $tbl_ruuning_character_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $tbl_ruuning_character_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $tbl_ruuning_character_list->Pager->RecordCount ?>
<?php } else { ?>	
	<?php if ($tbl_ruuning_character_list->sSrchWhere == "0=101") { ?>
	<?php echo $Language->Phrase("EnterSearchCriteria") ?>
	<?php } else { ?>
	<?php echo $Language->Phrase("NoRecord") ?>
	<?php } ?>
<?php } ?>
</span>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<?php //if ($tbl_ruuning_character_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
</span>
<?php //} ?>
</div>
<?php } ?>
</td></tr></table>
<?php if ($tbl_ruuning_character->Export == "" && $tbl_ruuning_character->CurrentAction == "") { ?>
<?php } ?>
<?php if ($tbl_ruuning_character->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
$tbl_ruuning_character_list->Page_Terminate();
?>
<?php

//
// Page class
//
class ctbl_ruuning_character_list {

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

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

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

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

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $tbl_ruuning_character;
		if ($tbl_ruuning_character->UseTokenInUrl) $PageUrl .= "t=" . $tbl_ruuning_character->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, $tbl_ruuning_character;
		if ($tbl_ruuning_character->UseTokenInUrl) {
			if ($objForm)
				return ($tbl_ruuning_character->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($tbl_ruuning_character->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

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

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

		// Table object (tbl_ruuning_character)
		$GLOBALS["tbl_ruuning_character"] = new ctbl_ruuning_character();

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
		$this->ExportWordUrl = $this->PageUrl() . "export=word";
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
		$this->AddUrl = $GLOBALS["tbl_ruuning_character"]->AddUrl();
		$this->InlineAddUrl = $this->PageUrl() . "a=add";
		$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
		$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
		$this->MultiDeleteUrl = "tbl_ruuning_characterdelete.php";
		$this->MultiUpdateUrl = "tbl_ruuning_characterupdate.php";

		// Table object (tbl_admin)
		$GLOBALS['tbl_admin'] = new ctbl_admin();

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

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

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

		// Open connection
		$conn = ew_Connect();

		// List options
		$this->ListOptions = new cListOptions();
	}

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

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$tbl_ruuning_character->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$tbl_ruuning_character->Export = $_POST["exporttype"];
		} else {
			$tbl_ruuning_character->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $tbl_ruuning_character->Export; // Get export parameter, used in header
		$gsExportFile = $tbl_ruuning_character->TableVar; // Get export file, used in header

		// 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();
	}

	// Class variables
	var $ListOptions; // List options
	var $lDisplayRecs = 15;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $sSrchWhere = ""; // Search WHERE clause
	var $lRecCnt = 0; // Record count
	var $lEditRowCnt;
	var $lRowCnt;
	var $lRowIndex; // Row index
	var $lRecPerRow = 0;
	var $lColCnt = 0;
	var $sDbMasterFilter = ""; // Master filter
	var $sDbDetailFilter = ""; // Detail filter
	var $bMasterRecordExists;	
	var $sMultiSelectKey;
	var $RestoreSearch;

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError, $Security, $tbl_ruuning_character;

		// Search filters
		$sSrchAdvanced = ""; // Advanced search filter
		$sSrchBasic = ""; // Basic search filter
		$sFilter = "";
		if ($this->IsPageRequest()) { // Validate request

			// Handle reset command
			$this->ResetCmd();

			// Set up list options
			$this->SetupListOptions();

			// Set up sorting order
			$this->SetUpSortOrder();
		}

		// Restore display records
		if ($tbl_ruuning_character->getRecordsPerPage() <> "") {
			$this->lDisplayRecs = $tbl_ruuning_character->getRecordsPerPage(); // Restore from Session
		} else {
			$this->lDisplayRecs = 15; // Load default
		}

		// Load Sorting Order
		$this->LoadSortOrder();

		// Build filter
		$sFilter = "";
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

		// Set up filter in session
		$tbl_ruuning_character->setSessionWhere($sFilter);
		$tbl_ruuning_character->CurrentFilter = "";
	}

	// Set up sort parameters
	function SetUpSortOrder() {
		global $tbl_ruuning_character;

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$tbl_ruuning_character->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$tbl_ruuning_character->CurrentOrderType = @$_GET["ordertype"];
			$tbl_ruuning_character->UpdateSort($tbl_ruuning_character->language_id); // language_id
			$tbl_ruuning_character->setStartRecordNumber(1); // Reset start position
		}
	}

	// Load sort order parameters
	function LoadSortOrder() {
		global $tbl_ruuning_character;
		$sOrderBy = $tbl_ruuning_character->getSessionOrderBy(); // Get ORDER BY from Session
		if ($sOrderBy == "") {
			if ($tbl_ruuning_character->SqlOrderBy() <> "") {
				$sOrderBy = $tbl_ruuning_character->SqlOrderBy();
				$tbl_ruuning_character->setSessionOrderBy($sOrderBy);
			}
		}
	}

	// Reset command
	// cmd=reset (Reset search parameters)
	// cmd=resetall (Reset search and master/detail parameters)
	// cmd=resetsort (Reset sort parameters)
	function ResetCmd() {
		global $tbl_ruuning_character;

		// Get reset command
		if (@$_GET["cmd"] <> "") {
			$sCmd = $_GET["cmd"];

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$tbl_ruuning_character->setSessionOrderBy($sOrderBy);
				$tbl_ruuning_character->language_id->setSort("");
			}

			// Reset start position
			$this->lStartRec = 1;
			$tbl_ruuning_character->setStartRecordNumber($this->lStartRec);
		}
	}

	// Set up list options
	function SetupListOptions() {
		global $Security, $tbl_ruuning_character;

		// "view"
		$this->ListOptions->Add("view");
		$item =& $this->ListOptions->Items["view"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// "edit"
		$this->ListOptions->Add("edit");
		$item =& $this->ListOptions->Items["edit"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// Call ListOptions_Load event
		$this->ListOptions_Load();
		if ($tbl_ruuning_character->Export <> "" ||
			$tbl_ruuning_character->CurrentAction == "gridadd" ||
			$tbl_ruuning_character->CurrentAction == "gridedit")
			$this->ListOptions->HideAllOptions();
	}

	// Render list options
	function RenderListOptions() {
		global $Security, $Language, $tbl_ruuning_character;
		$this->ListOptions->LoadDefault();

		// "view"
		$oListOpt =& $this->ListOptions->Items["view"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible)
			$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . $Language->Phrase("ViewLink") . "</a>";

		// "edit"
		$oListOpt =& $this->ListOptions->Items["edit"];
		if ($Security->IsLoggedIn() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . $Language->Phrase("EditLink") . "</a>";
		}
		$this->RenderListOptionsExt();

		// Call ListOptions_Rendered event
		$this->ListOptions_Rendered();
	}

	function RenderListOptionsExt() {
		global $Security, $Language, $tbl_ruuning_character;
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $tbl_ruuning_character;
		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];
				$tbl_ruuning_character->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;
					}
					$tbl_ruuning_character->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $tbl_ruuning_character->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
			$tbl_ruuning_character->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
			$tbl_ruuning_character->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
			$tbl_ruuning_character->setStartRecordNumber($this->lStartRec);
		}
	}

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $tbl_ruuning_character;
		$tbl_ruuning_character->run_id->setDbValue($rs->fields('run_id'));
		$tbl_ruuning_character->language_id->setDbValue($rs->fields('language_id'));
		$tbl_ruuning_character->description->setDbValue($rs->fields('description'));
	}

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

		// Initialize URLs
		$this->ViewUrl = $tbl_ruuning_character->ViewUrl();
		$this->EditUrl = $tbl_ruuning_character->EditUrl();
		$this->InlineEditUrl = $tbl_ruuning_character->InlineEditUrl();
		$this->CopyUrl = $tbl_ruuning_character->CopyUrl();
		$this->InlineCopyUrl = $tbl_ruuning_character->InlineCopyUrl();
		$this->DeleteUrl = $tbl_ruuning_character->DeleteUrl();

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

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

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

			// run_id
			$tbl_ruuning_character->run_id->ViewValue = $tbl_ruuning_character->run_id->CurrentValue;
			$tbl_ruuning_character->run_id->CssStyle = "";
			$tbl_ruuning_character->run_id->CssClass = "";
			$tbl_ruuning_character->run_id->ViewCustomAttributes = "";

			// language_id
			if (strval($tbl_ruuning_character->language_id->CurrentValue) <> "") {
				$sFilterWrk = "`language_id` = " . ew_AdjustSql($tbl_ruuning_character->language_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `language` FROM `tbl_language`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$tbl_ruuning_character->language_id->ViewValue = $rswrk->fields('language');
					$rswrk->Close();
				} else {
					$tbl_ruuning_character->language_id->ViewValue = $tbl_ruuning_character->language_id->CurrentValue;
				}
			} else {
				$tbl_ruuning_character->language_id->ViewValue = NULL;
			}
			$tbl_ruuning_character->language_id->CssStyle = "";
			$tbl_ruuning_character->language_id->CssClass = "";
			$tbl_ruuning_character->language_id->ViewCustomAttributes = "";

			// language_id
			$tbl_ruuning_character->language_id->HrefValue = "";
			$tbl_ruuning_character->language_id->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($tbl_ruuning_character->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$tbl_ruuning_character->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";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}

	// ListOptions Load event
	function ListOptions_Load() {

		// Example: 
		//$this->ListOptions->Add("new");
		//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
		//$this->ListOptions->MoveItem("new", 0); // Move to first column

	}

	// ListOptions Rendered event
	function ListOptions_Rendered() {

		// Example: 
		//$this->ListOptions->Items["new"]->Body = "xxx";

	}
}
?>
