PageRenderTime 85ms CodeModel.GetById 76ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/provinceadd.php

https://bitbucket.org/joemarmatulac/ebutton
PHP | 1132 lines | 760 code | 157 blank | 215 comment | 161 complexity | 3386f796db233219f41b1d763a71989a MD5 | raw file
   1<?php
   2if (session_id() == "") session_start(); // Initialize Session data
   3ob_start(); // Turn on output buffering
   4?>
   5<?php include_once "ewcfg8.php" ?>
   6<?php include_once "ewmysql8.php" ?>
   7<?php include_once "phpfn8.php" ?>
   8<?php include_once "provinceinfo.php" ?>
   9<?php include_once "userinfo.php" ?>
  10<?php include_once "userfn8.php" ?>
  11<?php ew_Header(FALSE) ?>
  12<?php
  13
  14// Create page object
  15$province_add = new cprovince_add();
  16$Page =& $province_add;
  17
  18// Page init
  19$province_add->Page_Init();
  20
  21// Page main
  22$province_add->Page_Main();
  23?>
  24<?php include_once "header.php" ?>
  25<script type="text/javascript">
  26<!--
  27
  28// Create page object
  29var province_add = new ew_Page("province_add");
  30
  31// page properties
  32province_add.PageID = "add"; // page ID
  33province_add.FormID = "fprovinceadd"; // form ID
  34var EW_PAGE_ID = province_add.PageID; // for backward compatibility
  35
  36// extend page with ValidateForm function
  37province_add.ValidateForm = function(fobj) {
  38	ew_PostAutoSuggest(fobj);
  39	if (!this.ValidateRequired)
  40		return true; // ignore validation
  41	if (fobj.a_confirm && fobj.a_confirm.value == "F")
  42		return true;
  43	var i, elm, aelm, infix;
  44	var rowcnt = 1;
  45	for (i=0; i<rowcnt; i++) {
  46		infix = "";
  47		elm = fobj.elements["x" + infix + "_province_1"];
  48		if (elm && !ew_HasValue(elm))
  49			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->province_1->FldCaption()) ?>");
  50		/*
  51		elm = fobj.elements["x" + infix + "_provcontact"];
  52		if (elm && !ew_HasValue(elm))
  53			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provcontact->FldCaption()) ?>");
  54		elm = fobj.elements["x" + infix + "_provhalladdress"];
  55		if (elm && !ew_HasValue(elm))
  56			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provhalladdress->FldCaption()) ?>");
  57		elm = fobj.elements["x" + infix + "_provtelno"];
  58		if (elm && !ew_HasValue(elm))
  59			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provtelno->FldCaption()) ?>");
  60		elm = fobj.elements["x" + infix + "_provlatitude"];
  61		if (elm && !ew_HasValue(elm))
  62			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provlatitude->FldCaption()) ?>");
  63		elm = fobj.elements["x" + infix + "_provlatitude"];
  64		if (elm && !ew_CheckNumber(elm.value))
  65			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($province->provlatitude->FldErrMsg()) ?>");
  66		elm = fobj.elements["x" + infix + "_provlongitude"];
  67		if (elm && !ew_HasValue(elm))
  68			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provlongitude->FldCaption()) ?>");
  69		elm = fobj.elements["x" + infix + "_provlongitude"];
  70		if (elm && !ew_CheckNumber(elm.value))
  71			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($province->provlongitude->FldErrMsg()) ?>");
  72		elm = fobj.elements["x" + infix + "_provaltitude"];
  73		if (elm && !ew_HasValue(elm))
  74			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provaltitude->FldCaption()) ?>");
  75		elm = fobj.elements["x" + infix + "_provaltitude"];
  76		if (elm && !ew_CheckNumber(elm.value))
  77			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($province->provaltitude->FldErrMsg()) ?>");
  78		elm = fobj.elements["x" + infix + "_countryid"];
  79		if (elm && !ew_HasValue(elm))
  80			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->countryid->FldCaption()) ?>");
  81		elm = fobj.elements["x" + infix + "_provincecode"];
  82		if (elm && !ew_HasValue(elm))
  83			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($province->provincecode->FldCaption()) ?>");
  84		elm = fobj.elements["x" + infix + "_provincecode"];
  85		if (elm && !ew_CheckInteger(elm.value))
  86			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($province->provincecode->FldErrMsg()) ?>");
  87		*/
  88		// Set up row object
  89		var row = {};
  90		row["index"] = infix;
  91		for (var j = 0; j < fobj.elements.length; j++) {
  92			var el = fobj.elements[j];
  93			var len = infix.length + 2;
  94			if (el.name.substr(0, len) == "x" + infix + "_") {
  95				var elname = "x_" + el.name.substr(len);
  96				if (ewLang.isObject(row[elname])) { // already exists
  97					if (ewLang.isArray(row[elname])) {
  98						row[elname][row[elname].length] = el; // add to array
  99					} else {
 100						row[elname] = [row[elname], el]; // convert to array
 101					}
 102				} else {
 103					row[elname] = el;
 104				}
 105			}
 106		}
 107		fobj.row = row;
 108
 109		// Call Form Custom Validate event
 110		if (!this.Form_CustomValidate(fobj)) return false;
 111	}
 112
 113	// Process detail page
 114	var detailpage = (fobj.detailpage) ? fobj.detailpage.value : "";
 115	if (detailpage != "") {
 116		return eval(detailpage+".ValidateForm(fobj)");
 117	}
 118	return true;
 119}
 120
 121// extend page with Form_CustomValidate function
 122province_add.Form_CustomValidate =  
 123 function(fobj) { // DO NOT CHANGE THIS LINE!
 124
 125 	// Your custom validation code here, return false if invalid. 
 126 	return true;
 127 }
 128<?php if (EW_CLIENT_VALIDATE) { ?>
 129province_add.ValidateRequired = true; // uses JavaScript validation
 130<?php } else { ?>
 131province_add.ValidateRequired = false; // no JavaScript validation
 132<?php } ?>
 133
 134//-->
 135</script>
 136<script language="JavaScript" type="text/javascript">
 137<!--
 138
 139// Write your client script here, no need to add script tags.
 140//-->
 141
 142</script>
 143<p class="phpmaker ewTitle"><?php echo $Language->Phrase("Add") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $province->TableCaption() ?></p>
 144<p class="phpmaker"><a href="<?php echo $province->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></p>
 145<?php $province_add->ShowPageHeader(); ?>
 146<?php
 147$province_add->ShowMessage();
 148?>
 149<form name="fprovinceadd" id="fprovinceadd" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return province_add.ValidateForm(this);">
 150<p>
 151<input type="hidden" name="t" id="t" value="province">
 152<input type="hidden" name="a_add" id="a_add" value="A">
 153<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
 154<div class="ewGridMiddlePanel">
 155<table cellspacing="0" class="ewTable">
 156<?php if ($province->province_1->Visible) { // province ?>
 157	<tr id="r_province_1"<?php echo $province->RowAttributes() ?>>
 158		<td class="ewTableHeader"><?php echo $province->province_1->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
 159		<td<?php echo $province->province_1->CellAttributes() ?>><span id="el_province_1">
 160<input type="text" name="x_province_1" id="x_province_1" size="30" maxlength="60" value="<?php echo $province->province_1->EditValue ?>"<?php echo $province->province_1->EditAttributes() ?>>
 161</span><?php echo $province->province_1->CustomMsg ?></td>
 162	</tr>
 163<?php } ?>
 164<?php if ($province->provcontact->Visible) { // provcontact ?>
 165	<tr id="r_provcontact"<?php echo $province->RowAttributes() ?>>
 166		<td class="ewTableHeader"><?php echo $province->provcontact->FldCaption() ?></td>
 167		<td<?php echo $province->provcontact->CellAttributes() ?>><span id="el_provcontact">
 168<input type="text" name="x_provcontact" id="x_provcontact" size="30" maxlength="20" value="<?php echo $province->provcontact->EditValue ?>"<?php echo $province->provcontact->EditAttributes() ?>>
 169</span><?php echo $province->provcontact->CustomMsg ?></td>
 170	</tr>
 171<?php } ?>
 172<?php if ($province->provhalladdress->Visible) { // provhalladdress ?>
 173	<tr id="r_provhalladdress"<?php echo $province->RowAttributes() ?>>
 174		<td class="ewTableHeader"><?php echo $province->provhalladdress->FldCaption() ?></td>
 175		<td<?php echo $province->provhalladdress->CellAttributes() ?>><span id="el_provhalladdress">
 176<textarea name="x_provhalladdress" id="x_provhalladdress" cols="35" rows="4"<?php echo $province->provhalladdress->EditAttributes() ?>><?php echo $province->provhalladdress->EditValue ?></textarea>
 177</span><?php echo $province->provhalladdress->CustomMsg ?></td>
 178	</tr>
 179<?php } ?>
 180<?php if ($province->provtelno->Visible) { // provtelno ?>
 181	<tr id="r_provtelno"<?php echo $province->RowAttributes() ?>>
 182		<td class="ewTableHeader"><?php echo $province->provtelno->FldCaption() ?></td>
 183		<td<?php echo $province->provtelno->CellAttributes() ?>><span id="el_provtelno">
 184<input type="text" name="x_provtelno" id="x_provtelno" size="30" maxlength="20" value="<?php echo $province->provtelno->EditValue ?>"<?php echo $province->provtelno->EditAttributes() ?>>
 185</span><?php echo $province->provtelno->CustomMsg ?></td>
 186	</tr>
 187<?php } ?>
 188<?php if ($province->provlatitude->Visible) { // provlatitude ?>
 189	<tr id="r_provlatitude"<?php echo $province->RowAttributes() ?>>
 190		<td class="ewTableHeader"><?php echo $province->provlatitude->FldCaption() ?></td>
 191		<td<?php echo $province->provlatitude->CellAttributes() ?>><span id="el_provlatitude">
 192<input type="text" name="x_provlatitude" id="x_provlatitude" size="30" value="<?php echo $province->provlatitude->EditValue ?>"<?php echo $province->provlatitude->EditAttributes() ?>>
 193</span><?php echo $province->provlatitude->CustomMsg ?></td>
 194	</tr>
 195<?php } ?>
 196<?php if ($province->provlongitude->Visible) { // provlongitude ?>
 197	<tr id="r_provlongitude"<?php echo $province->RowAttributes() ?>>
 198		<td class="ewTableHeader"><?php echo $province->provlongitude->FldCaption() ?></td>
 199		<td<?php echo $province->provlongitude->CellAttributes() ?>><span id="el_provlongitude">
 200<input type="text" name="x_provlongitude" id="x_provlongitude" size="30" value="<?php echo $province->provlongitude->EditValue ?>"<?php echo $province->provlongitude->EditAttributes() ?>>
 201</span><?php echo $province->provlongitude->CustomMsg ?></td>
 202	</tr>
 203<?php } ?>
 204<?php if ($province->provaltitude->Visible) { // provaltitude ?>
 205	<tr id="r_provaltitude"<?php echo $province->RowAttributes() ?>>
 206		<td class="ewTableHeader"><?php echo $province->provaltitude->FldCaption() ?></td>
 207		<td<?php echo $province->provaltitude->CellAttributes() ?>><span id="el_provaltitude">
 208<input type="text" name="x_provaltitude" id="x_provaltitude" size="30" value="<?php echo $province->provaltitude->EditValue ?>"<?php echo $province->provaltitude->EditAttributes() ?>>
 209</span><?php echo $province->provaltitude->CustomMsg ?></td>
 210	</tr>
 211<?php } ?>
 212<?php if ($province->countryid->Visible) { // countryid ?>
 213	<tr id="r_countryid"<?php echo $province->RowAttributes() ?>>
 214		<td class="ewTableHeader"><?php echo $province->countryid->FldCaption() ?></td>
 215		<td<?php echo $province->countryid->CellAttributes() ?>><span id="el_countryid">
 216<select id="x_countryid" name="x_countryid"<?php echo $province->countryid->EditAttributes() ?>>
 217<?php
 218if (is_array($province->countryid->EditValue)) {
 219	$arwrk = $province->countryid->EditValue;
 220	$rowswrk = count($arwrk);
 221	$emptywrk = TRUE;
 222	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
 223		$selwrk = (strval($province->countryid->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
 224		if ($selwrk <> "") $emptywrk = FALSE;
 225?>
 226<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
 227<?php echo $arwrk[$rowcntwrk][1] ?>
 228</option>
 229<?php
 230	}
 231}
 232?>
 233</select>
 234</span><?php echo $province->countryid->CustomMsg ?></td>
 235	</tr>
 236<?php } ?>
 237</table>
 238</div>
 239</td></tr></table>
 240<p>
 241<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("AddBtn")) ?>">
 242</form>
 243<?php
 244$province_add->ShowPageFooter();
 245if (EW_DEBUG_ENABLED)
 246	echo ew_DebugMsg();
 247?>
 248<script language="JavaScript" type="text/javascript">
 249<!--
 250
 251// Write your table-specific startup script here
 252// document.write("page loaded");
 253//-->
 254
 255</script>
 256<?php include_once "footer.php" ?>
 257<?php
 258$province_add->Page_Terminate();
 259?>
 260<?php
 261
 262//
 263// Page class
 264//
 265class cprovince_add {
 266
 267	// Page ID
 268	var $PageID = 'add';
 269
 270	// Table name
 271	var $TableName = 'province';
 272
 273	// Page object name
 274	var $PageObjName = 'province_add';
 275
 276	// Page name
 277	function PageName() {
 278		return ew_CurrentPage();
 279	}
 280
 281	// Page URL
 282	function PageUrl() {
 283		$PageUrl = ew_CurrentPage() . "?";
 284		global $province;
 285		if ($province->UseTokenInUrl) $PageUrl .= "t=" . $province->TableVar . "&"; // Add page token
 286		return $PageUrl;
 287	}
 288
 289	// Message
 290	function getMessage() {
 291		return @$_SESSION[EW_SESSION_MESSAGE];
 292	}
 293
 294	function setMessage($v) {
 295		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
 296	}
 297
 298	function getFailureMessage() {
 299		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
 300	}
 301
 302	function setFailureMessage($v) {
 303		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
 304	}
 305
 306	function getSuccessMessage() {
 307		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
 308	}
 309
 310	function setSuccessMessage($v) {
 311		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
 312	}
 313
 314	// Show message
 315	function ShowMessage() {
 316		$sMessage = $this->getMessage();
 317		$this->Message_Showing($sMessage, "");
 318		if ($sMessage <> "") { // Message in Session, display
 319			echo "<p class=\"ewMessage\">" . $sMessage . "</p>";
 320			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
 321		}
 322
 323		// Success message
 324		$sSuccessMessage = $this->getSuccessMessage();
 325		$this->Message_Showing($sSuccessMessage, "success");
 326		if ($sSuccessMessage <> "") { // Message in Session, display
 327			echo "<p class=\"ewSuccessMessage\">" . $sSuccessMessage . "</p>";
 328			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
 329		}
 330
 331		// Failure message
 332		$sErrorMessage = $this->getFailureMessage();
 333		$this->Message_Showing($sErrorMessage, "failure");
 334		if ($sErrorMessage <> "") { // Message in Session, display
 335			echo "<p class=\"ewErrorMessage\">" . $sErrorMessage . "</p>";
 336			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
 337		}
 338	}
 339	var $PageHeader;
 340	var $PageFooter;
 341
 342	// Show Page Header
 343	function ShowPageHeader() {
 344		$sHeader = $this->PageHeader;
 345		$this->Page_DataRendering($sHeader);
 346		if ($sHeader <> "") { // Header exists, display
 347			echo "<p class=\"phpmaker\">" . $sHeader . "</p>";
 348		}
 349	}
 350
 351	// Show Page Footer
 352	function ShowPageFooter() {
 353		$sFooter = $this->PageFooter;
 354		$this->Page_DataRendered($sFooter);
 355		if ($sFooter <> "") { // Fotoer exists, display
 356			echo "<p class=\"phpmaker\">" . $sFooter . "</p>";
 357		}
 358	}
 359
 360	// Validate page request
 361	function IsPageRequest() {
 362		global $objForm, $province;
 363		if ($province->UseTokenInUrl) {
 364			if ($objForm)
 365				return ($province->TableVar == $objForm->GetValue("t"));
 366			if (@$_GET["t"] <> "")
 367				return ($province->TableVar == $_GET["t"]);
 368		} else {
 369			return TRUE;
 370		}
 371	}
 372
 373	//
 374	// Page class constructor
 375	//
 376	function cprovince_add() {
 377		global $conn, $Language;
 378
 379		// Language object
 380		if (!isset($Language)) $Language = new cLanguage();
 381
 382		// Table object (province)
 383		if (!isset($GLOBALS["province"])) {
 384			$GLOBALS["province"] = new cprovince();
 385			$GLOBALS["Table"] =& $GLOBALS["province"];
 386		}
 387
 388		// Table object (user)
 389		if (!isset($GLOBALS['user'])) $GLOBALS['user'] = new cuser();
 390
 391		// Page ID
 392		if (!defined("EW_PAGE_ID"))
 393			define("EW_PAGE_ID", 'add', TRUE);
 394
 395		// Table name (for backward compatibility)
 396		if (!defined("EW_TABLE_NAME"))
 397			define("EW_TABLE_NAME", 'province', TRUE);
 398
 399		// Start timer
 400		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();
 401
 402		// Open connection
 403		if (!isset($conn)) $conn = ew_Connect();
 404	}
 405
 406	// 
 407	//  Page_Init
 408	//
 409	function Page_Init() {
 410		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
 411		global $province;
 412
 413		// Security
 414		$Security = new cAdvancedSecurity();
 415		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
 416		if (!$Security->IsLoggedIn()) {
 417			$Security->SaveLastUrl();
 418			$this->Page_Terminate("login.php");
 419		}
 420		$Security->TablePermission_Loading();
 421		$Security->LoadCurrentUserLevel($this->TableName);
 422		$Security->TablePermission_Loaded();
 423		if (!$Security->IsLoggedIn()) {
 424			$Security->SaveLastUrl();
 425			$this->Page_Terminate("login.php");
 426		}
 427		if (!$Security->CanAdd()) {
 428			$Security->SaveLastUrl();
 429			$this->Page_Terminate("provincelist.php");
 430		}
 431
 432		// Create form object
 433		$objForm = new cFormObj();
 434
 435		// Global Page Loading event (in userfn*.php)
 436		Page_Loading();
 437
 438		// Page Load event
 439		$this->Page_Load();
 440	}
 441
 442	//
 443	// Page_Terminate
 444	//
 445	function Page_Terminate($url = "") {
 446		global $conn;
 447
 448		// Page Unload event
 449		$this->Page_Unload();
 450
 451		// Global Page Unloaded event (in userfn*.php)
 452		Page_Unloaded();
 453		$this->Page_Redirecting($url);
 454
 455		 // Close connection
 456		$conn->Close();
 457
 458		// Go to URL if specified
 459		if ($url <> "") {
 460			if (!EW_DEBUG_ENABLED && ob_get_length())
 461				ob_end_clean();
 462			header("Location: " . $url);
 463		}
 464		exit();
 465	}
 466	var $DbMasterFilter = "";
 467	var $DbDetailFilter = "";
 468	var $Priv = 0;
 469	var $OldRecordset;
 470	var $CopyRecord;
 471
 472	// 
 473	// Page main
 474	//
 475	function Page_Main() {
 476		global $objForm, $Language, $gsFormError, $province;
 477
 478		// Process form if post back
 479		if (@$_POST["a_add"] <> "") {
 480			$province->CurrentAction = $_POST["a_add"]; // Get form action
 481			$this->CopyRecord = $this->LoadOldRecord(); // Load old recordset
 482			$this->LoadFormValues(); // Load form values
 483
 484			// Validate form
 485			if (!$this->ValidateForm()) {
 486				$province->CurrentAction = "I"; // Form error, reset action
 487				$province->EventCancelled = TRUE; // Event cancelled
 488				$this->RestoreFormValues(); // Restore form values
 489				$this->setFailureMessage($gsFormError);
 490			}
 491		} else { // Not post back
 492
 493			// Load key values from QueryString
 494			$this->CopyRecord = TRUE;
 495			if (@$_GET["id"] != "") {
 496				$province->id->setQueryStringValue($_GET["id"]);
 497				$province->setKey("id", $province->id->CurrentValue); // Set up key
 498			} else {
 499				$province->setKey("id", ""); // Clear key
 500				$this->CopyRecord = FALSE;
 501			}
 502			if ($this->CopyRecord) {
 503				$province->CurrentAction = "C"; // Copy record
 504			} else {
 505				$province->CurrentAction = "I"; // Display blank record
 506				$this->LoadDefaultValues(); // Load default values
 507			}
 508		}
 509
 510		// Perform action based on action code
 511		switch ($province->CurrentAction) {
 512			case "I": // Blank record, no action required
 513				break;
 514			case "C": // Copy an existing record
 515				if (!$this->LoadRow()) { // Load record based on key
 516					$this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
 517					$this->Page_Terminate("provincelist.php"); // No matching record, return to list
 518				}
 519				break;
 520			case "A": // ' Add new record
 521				$province->SendEmail = TRUE; // Send email on add success
 522				if ($this->AddRow($this->OldRecordset)) { // Add successful
 523					$this->setSuccessMessage($Language->Phrase("AddSuccess")); // Set up success message
 524					$sReturnUrl = $province->getReturnUrl();
 525					if (ew_GetPageName($sReturnUrl) == "provinceview.php")
 526						$sReturnUrl = $province->ViewUrl(); // View paging, return to view page with keyurl directly
 527					$this->Page_Terminate($sReturnUrl); // Clean up and return
 528				} else {
 529					$province->EventCancelled = TRUE; // Event cancelled
 530					$this->RestoreFormValues(); // Add failed, restore form values
 531				}
 532		}
 533
 534		// Render row based on row type
 535		$province->RowType = EW_ROWTYPE_ADD;  // Render add type
 536
 537		// Render row
 538		$province->ResetAttrs();
 539		$this->RenderRow();
 540	}
 541
 542	// Get upload files
 543	function GetUploadFiles() {
 544		global $objForm, $province;
 545
 546		// Get upload data
 547		$index = $objForm->Index; // Save form index
 548		$objForm->Index = 0;
 549		$confirmPage = (strval($objForm->GetValue("a_confirm")) <> "");
 550		$objForm->Index = $index; // Restore form index
 551	}
 552
 553	// Load default values
 554	function LoadDefaultValues() {
 555		global $province;
 556		$province->province_1->CurrentValue = NULL;
 557		$province->province_1->OldValue = $province->province_1->CurrentValue;
 558		$province->provcontact->CurrentValue = NULL;
 559		$province->provcontact->OldValue = $province->provcontact->CurrentValue;
 560		$province->provhalladdress->CurrentValue = NULL;
 561		$province->provhalladdress->OldValue = $province->provhalladdress->CurrentValue;
 562		$province->provtelno->CurrentValue = NULL;
 563		$province->provtelno->OldValue = $province->provtelno->CurrentValue;
 564		$province->provlatitude->CurrentValue = NULL;
 565		$province->provlatitude->OldValue = $province->provlatitude->CurrentValue;
 566		$province->provlongitude->CurrentValue = NULL;
 567		$province->provlongitude->OldValue = $province->provlongitude->CurrentValue;
 568		$province->provaltitude->CurrentValue = NULL;
 569		$province->provaltitude->OldValue = $province->provaltitude->CurrentValue;
 570		$province->countryid->CurrentValue = NULL;
 571		$province->countryid->OldValue = $province->countryid->CurrentValue;
 572		$province->provincecode->CurrentValue = NULL;
 573		$province->provincecode->OldValue = $province->provincecode->CurrentValue;
 574	}
 575
 576	// Load form values
 577	function LoadFormValues() {
 578
 579		// Load from form
 580		global $objForm, $province;
 581		if (!$province->province_1->FldIsDetailKey) {
 582			$province->province_1->setFormValue($objForm->GetValue("x_province_1"));
 583		}
 584		if (!$province->provcontact->FldIsDetailKey) {
 585			$province->provcontact->setFormValue($objForm->GetValue("x_provcontact"));
 586		}
 587		if (!$province->provhalladdress->FldIsDetailKey) {
 588			$province->provhalladdress->setFormValue($objForm->GetValue("x_provhalladdress"));
 589		}
 590		if (!$province->provtelno->FldIsDetailKey) {
 591			$province->provtelno->setFormValue($objForm->GetValue("x_provtelno"));
 592		}
 593		if (!$province->provlatitude->FldIsDetailKey) {
 594			$province->provlatitude->setFormValue($objForm->GetValue("x_provlatitude"));
 595		}
 596		if (!$province->provlongitude->FldIsDetailKey) {
 597			$province->provlongitude->setFormValue($objForm->GetValue("x_provlongitude"));
 598		}
 599		if (!$province->provaltitude->FldIsDetailKey) {
 600			$province->provaltitude->setFormValue($objForm->GetValue("x_provaltitude"));
 601		}
 602		if (!$province->countryid->FldIsDetailKey) {
 603			$province->countryid->setFormValue($objForm->GetValue("x_countryid"));
 604		}
 605		if (!$province->provincecode->FldIsDetailKey) {
 606			$province->provincecode->setFormValue($objForm->GetValue("x_provincecode"));
 607		}
 608	}
 609
 610	// Restore form values
 611	function RestoreFormValues() {
 612		global $objForm, $province;
 613		$this->LoadOldRecord();
 614		$province->province_1->CurrentValue = $province->province_1->FormValue;
 615		$province->provcontact->CurrentValue = $province->provcontact->FormValue;
 616		$province->provhalladdress->CurrentValue = $province->provhalladdress->FormValue;
 617		$province->provtelno->CurrentValue = $province->provtelno->FormValue;
 618		$province->provlatitude->CurrentValue = $province->provlatitude->FormValue;
 619		$province->provlongitude->CurrentValue = $province->provlongitude->FormValue;
 620		$province->provaltitude->CurrentValue = $province->provaltitude->FormValue;
 621		$province->countryid->CurrentValue = $province->countryid->FormValue;
 622		$province->provincecode->CurrentValue = $province->provincecode->FormValue;
 623	}
 624
 625	// Load row based on key values
 626	function LoadRow() {
 627		global $conn, $Security, $province;
 628		$sFilter = $province->KeyFilter();
 629
 630		// Call Row Selecting event
 631		$province->Row_Selecting($sFilter);
 632
 633		// Load SQL based on filter
 634		$province->CurrentFilter = $sFilter;
 635		$sSql = $province->SQL();
 636		$res = FALSE;
 637		$rs = ew_LoadRecordset($sSql);
 638		if ($rs && !$rs->EOF) {
 639			$res = TRUE;
 640			$this->LoadRowValues($rs); // Load row values
 641			$rs->Close();
 642		}
 643		return $res;
 644	}
 645
 646	// Load row values from recordset
 647	function LoadRowValues(&$rs) {
 648		global $conn, $province;
 649		if (!$rs || $rs->EOF) return;
 650
 651		// Call Row Selected event
 652		$row =& $rs->fields;
 653		$province->Row_Selected($row);
 654		$province->id->setDbValue($rs->fields('id'));
 655		$province->province_1->setDbValue($rs->fields('province'));
 656		$province->provcontact->setDbValue($rs->fields('provcontact'));
 657		$province->provhalladdress->setDbValue($rs->fields('provhalladdress'));
 658		$province->provtelno->setDbValue($rs->fields('provtelno'));
 659		$province->provlatitude->setDbValue($rs->fields('provlatitude'));
 660		$province->provlongitude->setDbValue($rs->fields('provlongitude'));
 661		$province->provaltitude->setDbValue($rs->fields('provaltitude'));
 662		$province->countryid->setDbValue($rs->fields('countryid'));
 663		$province->zuserid->setDbValue($rs->fields('userid'));
 664		$province->timestamp->setDbValue($rs->fields('timestamp'));
 665		$province->provincecode->setDbValue($rs->fields('provincecode'));
 666	}
 667
 668	// Load old record
 669	function LoadOldRecord() {
 670		global $province;
 671
 672		// Load key values from Session
 673		$bValidKey = TRUE;
 674		if (strval($province->getKey("id")) <> "")
 675			$province->id->CurrentValue = $province->getKey("id"); // id
 676		else
 677			$bValidKey = FALSE;
 678
 679		// Load old recordset
 680		if ($bValidKey) {
 681			$province->CurrentFilter = $province->KeyFilter();
 682			$sSql = $province->SQL();
 683			$this->OldRecordset = ew_LoadRecordset($sSql);
 684			$this->LoadRowValues($this->OldRecordset); // Load row values
 685		} else {
 686			$this->OldRecordset = NULL;
 687		}
 688		return $bValidKey;
 689	}
 690
 691	// Render row values based on field settings
 692	function RenderRow() {
 693		global $conn, $Security, $Language, $province;
 694
 695		// Initialize URLs
 696		// Call Row_Rendering event
 697
 698		$province->Row_Rendering();
 699
 700		// Common render codes for all row types
 701		// id
 702		// province
 703		// provcontact
 704		// provhalladdress
 705		// provtelno
 706		// provlatitude
 707		// provlongitude
 708		// provaltitude
 709		// countryid
 710		// userid
 711		// timestamp
 712		// provincecode
 713
 714		if ($province->RowType == EW_ROWTYPE_VIEW) { // View row
 715
 716			// id
 717			$province->id->ViewValue = $province->id->CurrentValue;
 718			$province->id->ViewCustomAttributes = "";
 719
 720			// province
 721			$province->province_1->ViewValue = $province->province_1->CurrentValue;
 722			$province->province_1->ViewCustomAttributes = "";
 723
 724			// provcontact
 725			$province->provcontact->ViewValue = $province->provcontact->CurrentValue;
 726			$province->provcontact->ViewCustomAttributes = "";
 727
 728			// provhalladdress
 729			$province->provhalladdress->ViewValue = $province->provhalladdress->CurrentValue;
 730			$province->provhalladdress->ViewCustomAttributes = "";
 731
 732			// provtelno
 733			$province->provtelno->ViewValue = $province->provtelno->CurrentValue;
 734			$province->provtelno->ViewCustomAttributes = "";
 735
 736			// provlatitude
 737			$province->provlatitude->ViewValue = $province->provlatitude->CurrentValue;
 738			$province->provlatitude->ViewCustomAttributes = "";
 739
 740			// provlongitude
 741			$province->provlongitude->ViewValue = $province->provlongitude->CurrentValue;
 742			$province->provlongitude->ViewCustomAttributes = "";
 743
 744			// provaltitude
 745			$province->provaltitude->ViewValue = $province->provaltitude->CurrentValue;
 746			$province->provaltitude->ViewCustomAttributes = "";
 747
 748			// countryid
 749			if (strval($province->countryid->CurrentValue) <> "") {
 750				$sFilterWrk = "`id` = " . ew_AdjustSql($province->countryid->CurrentValue) . "";
 751			$sSqlWrk = "SELECT `country` FROM `country`";
 752			$sWhereWrk = "";
 753			if ($sFilterWrk <> "") {
 754				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
 755				$sWhereWrk .= "(" . $sFilterWrk . ")";
 756			}
 757			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
 758				$rswrk = $conn->Execute($sSqlWrk);
 759				if ($rswrk && !$rswrk->EOF) { // Lookup values found
 760					$province->countryid->ViewValue = $rswrk->fields('country');
 761					$rswrk->Close();
 762				} else {
 763					$province->countryid->ViewValue = $province->countryid->CurrentValue;
 764				}
 765			} else {
 766				$province->countryid->ViewValue = NULL;
 767			}
 768			$province->countryid->ViewCustomAttributes = "";
 769
 770			// userid
 771			$province->zuserid->ViewValue = $province->zuserid->CurrentValue;
 772			$province->zuserid->ViewCustomAttributes = "";
 773
 774			// timestamp
 775			$province->timestamp->ViewValue = $province->timestamp->CurrentValue;
 776			$province->timestamp->ViewValue = ew_FormatDateTime($province->timestamp->ViewValue, 9);
 777			$province->timestamp->ViewCustomAttributes = "";
 778
 779			// provincecode
 780			$province->provincecode->ViewValue = $province->provincecode->CurrentValue;
 781			$province->provincecode->ViewCustomAttributes = "";
 782
 783			// province
 784			$province->province_1->LinkCustomAttributes = "";
 785			$province->province_1->HrefValue = "";
 786			$province->province_1->TooltipValue = "";
 787
 788			// provcontact
 789			$province->provcontact->LinkCustomAttributes = "";
 790			$province->provcontact->HrefValue = "";
 791			$province->provcontact->TooltipValue = "";
 792
 793			// provhalladdress
 794			$province->provhalladdress->LinkCustomAttributes = "";
 795			$province->provhalladdress->HrefValue = "";
 796			$province->provhalladdress->TooltipValue = "";
 797
 798			// provtelno
 799			$province->provtelno->LinkCustomAttributes = "";
 800			$province->provtelno->HrefValue = "";
 801			$province->provtelno->TooltipValue = "";
 802
 803			// provlatitude
 804			$province->provlatitude->LinkCustomAttributes = "";
 805			$province->provlatitude->HrefValue = "";
 806			$province->provlatitude->TooltipValue = "";
 807
 808			// provlongitude
 809			$province->provlongitude->LinkCustomAttributes = "";
 810			$province->provlongitude->HrefValue = "";
 811			$province->provlongitude->TooltipValue = "";
 812
 813			// provaltitude
 814			$province->provaltitude->LinkCustomAttributes = "";
 815			$province->provaltitude->HrefValue = "";
 816			$province->provaltitude->TooltipValue = "";
 817
 818			// countryid
 819			$province->countryid->LinkCustomAttributes = "";
 820			$province->countryid->HrefValue = "";
 821			$province->countryid->TooltipValue = "";
 822
 823			// provincecode
 824			$province->provincecode->LinkCustomAttributes = "";
 825			$province->provincecode->HrefValue = "";
 826			$province->provincecode->TooltipValue = "";
 827		} elseif ($province->RowType == EW_ROWTYPE_ADD) { // Add row
 828
 829			// province
 830			$province->province_1->EditCustomAttributes = "";
 831			$province->province_1->EditValue = ew_HtmlEncode($province->province_1->CurrentValue);
 832
 833			// provcontact
 834			$province->provcontact->EditCustomAttributes = "";
 835			$province->provcontact->EditValue = ew_HtmlEncode($province->provcontact->CurrentValue);
 836
 837			// provhalladdress
 838			$province->provhalladdress->EditCustomAttributes = "";
 839			$province->provhalladdress->EditValue = ew_HtmlEncode($province->provhalladdress->CurrentValue);
 840
 841			// provtelno
 842			$province->provtelno->EditCustomAttributes = "";
 843			$province->provtelno->EditValue = ew_HtmlEncode($province->provtelno->CurrentValue);
 844
 845			// provlatitude
 846			$province->provlatitude->EditCustomAttributes = "";
 847			$province->provlatitude->EditValue = ew_HtmlEncode($province->provlatitude->CurrentValue);
 848
 849			// provlongitude
 850			$province->provlongitude->EditCustomAttributes = "";
 851			$province->provlongitude->EditValue = ew_HtmlEncode($province->provlongitude->CurrentValue);
 852
 853			// provaltitude
 854			$province->provaltitude->EditCustomAttributes = "";
 855			$province->provaltitude->EditValue = ew_HtmlEncode($province->provaltitude->CurrentValue);
 856
 857			// countryid
 858			$province->countryid->EditCustomAttributes = "";
 859				$sFilterWrk = "";
 860			$sSqlWrk = "SELECT `id`, `country` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld`, '' AS `SelectFilterFld` FROM `country`";
 861			$sWhereWrk = "";
 862			if ($sFilterWrk <> "") {
 863				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
 864				$sWhereWrk .= "(" . $sFilterWrk . ")";
 865			}
 866			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
 867			$rswrk = $conn->Execute($sSqlWrk);
 868			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
 869			if ($rswrk) $rswrk->Close();
 870			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
 871			$province->countryid->EditValue = $arwrk;
 872
 873			// provincecode
 874			$province->provincecode->EditCustomAttributes = "";
 875			$province->provincecode->EditValue = ew_HtmlEncode($province->provincecode->CurrentValue);
 876
 877			// Edit refer script
 878			// province
 879
 880			$province->province_1->HrefValue = "";
 881
 882			// provcontact
 883			$province->provcontact->HrefValue = "";
 884
 885			// provhalladdress
 886			$province->provhalladdress->HrefValue = "";
 887
 888			// provtelno
 889			$province->provtelno->HrefValue = "";
 890
 891			// provlatitude
 892			$province->provlatitude->HrefValue = "";
 893
 894			// provlongitude
 895			$province->provlongitude->HrefValue = "";
 896
 897			// provaltitude
 898			$province->provaltitude->HrefValue = "";
 899
 900			// countryid
 901			$province->countryid->HrefValue = "";
 902
 903			// provincecode
 904			$province->provincecode->HrefValue = "";
 905		}
 906		if ($province->RowType == EW_ROWTYPE_ADD ||
 907			$province->RowType == EW_ROWTYPE_EDIT ||
 908			$province->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
 909			$province->SetupFieldTitles();
 910		}
 911
 912		// Call Row Rendered event
 913		if ($province->RowType <> EW_ROWTYPE_AGGREGATEINIT)
 914			$province->Row_Rendered();
 915	}
 916
 917	// Validate form
 918	function ValidateForm() {
 919		global $Language, $gsFormError, $province;
 920
 921		// Initialize form error message
 922		$gsFormError = "";
 923
 924		// Check if validation required
 925		if (!EW_SERVER_VALIDATE)
 926			return ($gsFormError == "");
 927		if (!is_null($province->province_1->FormValue) && $province->province_1->FormValue == "") {
 928			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->province_1->FldCaption());
 929		}
 930		if (!is_null($province->provcontact->FormValue) && $province->provcontact->FormValue == "") {
 931			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provcontact->FldCaption());
 932		}
 933		if (!is_null($province->provhalladdress->FormValue) && $province->provhalladdress->FormValue == "") {
 934			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provhalladdress->FldCaption());
 935		}
 936		if (!is_null($province->provtelno->FormValue) && $province->provtelno->FormValue == "") {
 937			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provtelno->FldCaption());
 938		}
 939		if (!is_null($province->provlatitude->FormValue) && $province->provlatitude->FormValue == "") {
 940			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provlatitude->FldCaption());
 941		}
 942		if (!ew_CheckNumber($province->provlatitude->FormValue)) {
 943			ew_AddMessage($gsFormError, $province->provlatitude->FldErrMsg());
 944		}
 945		if (!is_null($province->provlongitude->FormValue) && $province->provlongitude->FormValue == "") {
 946			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provlongitude->FldCaption());
 947		}
 948		if (!ew_CheckNumber($province->provlongitude->FormValue)) {
 949			ew_AddMessage($gsFormError, $province->provlongitude->FldErrMsg());
 950		}
 951		if (!is_null($province->provaltitude->FormValue) && $province->provaltitude->FormValue == "") {
 952			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provaltitude->FldCaption());
 953		}
 954		if (!ew_CheckNumber($province->provaltitude->FormValue)) {
 955			ew_AddMessage($gsFormError, $province->provaltitude->FldErrMsg());
 956		}
 957		if (!is_null($province->countryid->FormValue) && $province->countryid->FormValue == "") {
 958			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->countryid->FldCaption());
 959		}
 960		if (!is_null($province->provincecode->FormValue) && $province->provincecode->FormValue == "") {
 961			ew_AddMessage($gsFormError, $Language->Phrase("EnterRequiredField") . " - " . $province->provincecode->FldCaption());
 962		}
 963		if (!ew_CheckInteger($province->provincecode->FormValue)) {
 964			ew_AddMessage($gsFormError, $province->provincecode->FldErrMsg());
 965		}
 966
 967		// Return validate result
 968		$ValidateForm = ($gsFormError == "");
 969
 970		// Call Form_CustomValidate event
 971		$sFormCustomError = "";
 972		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
 973		if ($sFormCustomError <> "") {
 974			ew_AddMessage($gsFormError, $sFormCustomError);
 975		}
 976		return $ValidateForm;
 977	}
 978
 979	// Add record
 980	function AddRow($rsold = NULL) {
 981		global $conn, $Language, $Security, $province;
 982		$rsnew = array();
 983
 984		// province
 985		$province->province_1->SetDbValueDef($rsnew, $province->province_1->CurrentValue, "", FALSE);
 986
 987		// provcontact
 988		$province->provcontact->SetDbValueDef($rsnew, $province->provcontact->CurrentValue, "", FALSE);
 989
 990		// provhalladdress
 991		$province->provhalladdress->SetDbValueDef($rsnew, $province->provhalladdress->CurrentValue, "", FALSE);
 992
 993		// provtelno
 994		$province->provtelno->SetDbValueDef($rsnew, $province->provtelno->CurrentValue, "", FALSE);
 995
 996		// provlatitude
 997		$province->provlatitude->SetDbValueDef($rsnew, $province->provlatitude->CurrentValue, 0, FALSE);
 998
 999		// provlongitude
1000		$province->provlongitude->SetDbValueDef($rsnew, $province->provlongitude->CurrentValue, 0, FALSE);
1001
1002		// provaltitude
1003		$province->provaltitude->SetDbValueDef($rsnew, $province->provaltitude->CurrentValue, 0, FALSE);
1004
1005		// countryid
1006		$province->countryid->SetDbValueDef($rsnew, $province->countryid->CurrentValue, 0, FALSE);
1007
1008		// provincecode
1009		$province->provincecode->SetDbValueDef($rsnew, $province->provincecode->CurrentValue, 0, FALSE);
1010
1011		// Call Row Inserting event
1012		$rs = ($rsold == NULL) ? NULL : $rsold->fields;
1013		$bInsertRow = $province->Row_Inserting($rs, $rsnew);
1014		if ($bInsertRow) {
1015			$conn->raiseErrorFn = 'ew_ErrorFn';
1016			$AddRow = $conn->Execute($province->InsertSQL($rsnew));
1017			$conn->raiseErrorFn = '';
1018		} else {
1019			if ($province->CancelMessage <> "") {
1020				$this->setFailureMessage($province->CancelMessage);
1021				$province->CancelMessage = "";
1022			} else {
1023				$this->setFailureMessage($Language->Phrase("InsertCancelled"));
1024			}
1025			$AddRow = FALSE;
1026		}
1027
1028		// Get insert id if necessary
1029		if ($AddRow) {
1030			$province->id->setDbValue($conn->Insert_ID());
1031			$rsnew['id'] = $province->id->DbValue;
1032		}
1033		if ($AddRow) {
1034
1035			// Call Row Inserted event
1036			$rs = ($rsold == NULL) ? NULL : $rsold->fields;
1037			$province->Row_Inserted($rs, $rsnew);
1038			$this->WriteAuditTrailOnAdd($rsnew);
1039		}
1040		return $AddRow;
1041	}
1042// Write Audit Trail start/end for grid update
1043	function WriteAuditTrailDummy($typ) {
1044		$table = 'province';
1045	  $usr = CurrentUserName();
1046		ew_WriteAuditTrail("log", ew_StdCurrentDateTime(), ew_ScriptName(), $usr, $typ, $table, "", "", "", "");
1047	}
1048
1049	// Write Audit Trail (add page)
1050	function WriteAuditTrailOnAdd(&$rs) {
1051		global $province;
1052		$table = 'province';
1053
1054		// Get key value
1055		$key = "";
1056		if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
1057		$key .= $rs['id'];
1058
1059		// Write Audit Trail
1060		$dt = ew_StdCurrentDateTime();
1061		$id = ew_ScriptName();
1062	  $usr = CurrentUserName();
1063		foreach (array_keys($rs) as $fldname) {
1064			if ($province->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore BLOB fields
1065				if ($province->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) {
1066					if (EW_AUDIT_TRAIL_TO_DATABASE)
1067						$newvalue = $rs[$fldname];
1068					else
1069						$newvalue = "[MEMO]"; // Memo Field
1070				} elseif ($province->fields[$fldname]->FldDataType == EW_DATATYPE_XML) {
1071					$newvalue = "[XML]"; // XML Field
1072				} else {
1073					$newvalue = $rs[$fldname];
1074				}
1075				ew_WriteAuditTrail("log", $dt, $id, $usr, "A", $table, $fldname, $key, "", $newvalue);
1076			}
1077		}
1078	}
1079
1080	// Page Load event
1081	function Page_Load() {
1082
1083		//echo "Page Load";
1084	}
1085
1086	// Page Unload event
1087	function Page_Unload() {
1088
1089		//echo "Page Unload";
1090	}
1091
1092	// Page Redirecting event
1093	function Page_Redirecting(&$url) {
1094
1095		// Example:
1096		//$url = "your URL";
1097
1098	}
1099
1100	// Message Showing event
1101	// $type = ''|'success'|'failure'
1102	function Message_Showing(&$msg, $type) {
1103
1104		// Example:
1105		//if ($type == 'success') $msg = "your success message";
1106
1107	}
1108
1109	// Page Data Rendering event
1110	function Page_DataRendering(&$header) {
1111
1112		// Example:
1113		//$header = "your header";
1114
1115	}
1116
1117	// Page Data Rendered event
1118	function Page_DataRendered(&$footer) {
1119
1120		// Example:
1121		//$footer = "your footer";
1122
1123	}
1124
1125	// Form Custom Validate event
1126	function Form_CustomValidate(&$CustomError) {
1127
1128		// Return error message in CustomError
1129		return TRUE;
1130	}
1131}
1132?>