Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCESubjectExpertsedit.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 "CCESubjectExpertsinfo.php" ?>
<?php include "CCEUsersinfo.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
$CCESubjectExperts_edit = new cCCESubjectExperts_edit();
$Page =& $CCESubjectExperts_edit;

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

// Page main
$CCESubjectExperts_edit->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--

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

// page properties
CCESubjectExperts_edit.PageID = "edit"; // page ID
CCESubjectExperts_edit.FormID = "fCCESubjectExpertsedit"; // form ID
var EW_PAGE_ID = CCESubjectExperts_edit.PageID; // for backward compatibility

// extend page with ValidateForm function
CCESubjectExperts_edit.ValidateForm = function(fobj) {
	ew_PostAutoSuggest(fobj);
	if (!this.ValidateRequired)
		return true; // ignore validation
	if (fobj.a_confirm && fobj.a_confirm.value == "F")
		return true;
	var i, elm, aelm, infix;
	var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
	for (i=0; i<rowcnt; i++) {
		infix = (fobj.key_count) ? String(i+1) : "";
		elm = fobj.elements["x" + infix + "_CVFile"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_Photograph"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_Qualifications"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_Archived"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCESubjectExperts->Archived->FldErrMsg()) ?>");

		// Call Form Custom Validate event
		if (!this.Form_CustomValidate(fobj)) return false;
	}
	return true;
}

// extend page with Form_CustomValidate function
CCESubjectExperts_edit.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) { ?>
CCESubjectExperts_edit.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCESubjectExperts_edit.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>
<p><span class="phpmaker"><?php echo $Language->Phrase("Edit") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCESubjectExperts->TableCaption() ?><br><br>
<a href="<?php echo $CCESubjectExperts->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCESubjectExperts_edit->ShowMessage();
?>
<form name="fCCESubjectExpertsedit" id="fCCESubjectExpertsedit" action="<?php echo ew_CurrentPage() ?>" method="post" enctype="multipart/form-data" onsubmit="return CCESubjectExperts_edit.ValidateForm(this);">
<p>
<input type="hidden" name="a_table" id="a_table" value="CCESubjectExperts">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCESubjectExperts->ExpertID->Visible) { // ExpertID ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->ExpertID->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->ExpertID->CellAttributes() ?>><span id="el_ExpertID">
<div<?php echo $CCESubjectExperts->ExpertID->ViewAttributes() ?>><?php echo $CCESubjectExperts->ExpertID->EditValue ?></div><input type="hidden" name="x_ExpertID" id="x_ExpertID" value="<?php echo ew_HtmlEncode($CCESubjectExperts->ExpertID->CurrentValue) ?>">
</span><?php echo $CCESubjectExperts->ExpertID->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->ExpertName->Visible) { // ExpertName ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->ExpertName->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->ExpertName->CellAttributes() ?>><span id="el_ExpertName">
<input type="text" name="x_ExpertName" id="x_ExpertName" title="<?php echo $CCESubjectExperts->ExpertName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCESubjectExperts->ExpertName->EditValue ?>"<?php echo $CCESubjectExperts->ExpertName->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->ExpertName->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->PhoneNumber->Visible) { // PhoneNumber ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->PhoneNumber->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->PhoneNumber->CellAttributes() ?>><span id="el_PhoneNumber">
<input type="text" name="x_PhoneNumber" id="x_PhoneNumber" title="<?php echo $CCESubjectExperts->PhoneNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCESubjectExperts->PhoneNumber->EditValue ?>"<?php echo $CCESubjectExperts->PhoneNumber->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->PhoneNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->MobileNumber->Visible) { // MobileNumber ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->MobileNumber->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->MobileNumber->CellAttributes() ?>><span id="el_MobileNumber">
<input type="text" name="x_MobileNumber" id="x_MobileNumber" title="<?php echo $CCESubjectExperts->MobileNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCESubjectExperts->MobileNumber->EditValue ?>"<?php echo $CCESubjectExperts->MobileNumber->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->MobileNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->FaxNumber->Visible) { // FaxNumber ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->FaxNumber->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->FaxNumber->CellAttributes() ?>><span id="el_FaxNumber">
<input type="text" name="x_FaxNumber" id="x_FaxNumber" title="<?php echo $CCESubjectExperts->FaxNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCESubjectExperts->FaxNumber->EditValue ?>"<?php echo $CCESubjectExperts->FaxNumber->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->FaxNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->EmailAddress->Visible) { // EmailAddress ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->EmailAddress->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->EmailAddress->CellAttributes() ?>><span id="el_EmailAddress">
<input type="text" name="x_EmailAddress" id="x_EmailAddress" title="<?php echo $CCESubjectExperts->EmailAddress->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCESubjectExperts->EmailAddress->EditValue ?>"<?php echo $CCESubjectExperts->EmailAddress->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->EmailAddress->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->CVFile->Visible) { // CVFile ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->CVFile->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->CVFile->CellAttributes() ?>><span id="el_CVFile">
<div id="old_x_CVFile">
<?php if ($CCESubjectExperts->CVFile->HrefValue <> "" || $CCESubjectExperts->CVFile->TooltipValue <> "") { ?>
<?php if (!empty($CCESubjectExperts->CVFile->Upload->DbValue)) { ?>
<a href="<?php echo $CCESubjectExperts->CVFile->HrefValue ?>"><?php echo $CCESubjectExperts->CVFile->EditValue ?></a>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCESubjectExperts->CVFile->Upload->DbValue)) { ?>
<?php echo $CCESubjectExperts->CVFile->EditValue ?>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_CVFile">
<?php if (!empty($CCESubjectExperts->CVFile->Upload->DbValue)) { ?>
<label><input type="radio" name="a_CVFile" id="a_CVFile" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_CVFile" id="a_CVFile" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_CVFile" id="a_CVFile" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCESubjectExperts->CVFile->EditAttrs["onchange"] = "this.form.a_CVFile[2].checked=true;" . @$CCESubjectExperts->CVFile->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_CVFile" id="a_CVFile" value="3">
<?php } ?>
<input type="file" name="x_CVFile" id="x_CVFile" title="<?php echo $CCESubjectExperts->CVFile->FldTitle() ?>" size="30"<?php echo $CCESubjectExperts->CVFile->EditAttributes() ?>>
</div>
</span><?php echo $CCESubjectExperts->CVFile->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->Photograph->Visible) { // Photograph ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->Photograph->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->Photograph->CellAttributes() ?>><span id="el_Photograph">
<div id="old_x_Photograph">
<?php if ($CCESubjectExperts->Photograph->HrefValue <> "" || $CCESubjectExperts->Photograph->TooltipValue <> "") { ?>
<?php if (!empty($CCESubjectExperts->Photograph->Upload->DbValue)) { ?>
<a href="<?php echo $CCESubjectExperts->Photograph->HrefValue ?>"><?php echo $CCESubjectExperts->Photograph->EditValue ?></a>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCESubjectExperts->Photograph->Upload->DbValue)) { ?>
<?php echo $CCESubjectExperts->Photograph->EditValue ?>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_Photograph">
<?php if (!empty($CCESubjectExperts->Photograph->Upload->DbValue)) { ?>
<label><input type="radio" name="a_Photograph" id="a_Photograph" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_Photograph" id="a_Photograph" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_Photograph" id="a_Photograph" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCESubjectExperts->Photograph->EditAttrs["onchange"] = "this.form.a_Photograph[2].checked=true;" . @$CCESubjectExperts->Photograph->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_Photograph" id="a_Photograph" value="3">
<?php } ?>
<input type="file" name="x_Photograph" id="x_Photograph" title="<?php echo $CCESubjectExperts->Photograph->FldTitle() ?>" size="30"<?php echo $CCESubjectExperts->Photograph->EditAttributes() ?>>
</div>
</span><?php echo $CCESubjectExperts->Photograph->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->Qualifications->Visible) { // Qualifications ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->Qualifications->FldCaption() ?></td>
		<td<?php echo $CCESubjectExperts->Qualifications->CellAttributes() ?>><span id="el_Qualifications">
<div id="old_x_Qualifications">
<?php if ($CCESubjectExperts->Qualifications->HrefValue <> "" || $CCESubjectExperts->Qualifications->TooltipValue <> "") { ?>
<?php if (!empty($CCESubjectExperts->Qualifications->Upload->DbValue)) { ?>
<a href="<?php echo $CCESubjectExperts->Qualifications->HrefValue ?>"><?php echo $CCESubjectExperts->Qualifications->EditValue ?></a>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCESubjectExperts->Qualifications->Upload->DbValue)) { ?>
<?php echo $CCESubjectExperts->Qualifications->EditValue ?>
<?php } elseif (!in_array($CCESubjectExperts->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_Qualifications">
<?php if (!empty($CCESubjectExperts->Qualifications->Upload->DbValue)) { ?>
<label><input type="radio" name="a_Qualifications" id="a_Qualifications" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_Qualifications" id="a_Qualifications" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_Qualifications" id="a_Qualifications" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCESubjectExperts->Qualifications->EditAttrs["onchange"] = "this.form.a_Qualifications[2].checked=true;" . @$CCESubjectExperts->Qualifications->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_Qualifications" id="a_Qualifications" value="3">
<?php } ?>
<input type="file" name="x_Qualifications" id="x_Qualifications" title="<?php echo $CCESubjectExperts->Qualifications->FldTitle() ?>" size="30"<?php echo $CCESubjectExperts->Qualifications->EditAttributes() ?>>
</div>
</span><?php echo $CCESubjectExperts->Qualifications->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCESubjectExperts->Archived->Visible) { // Archived ?>
	<tr<?php echo $CCESubjectExperts->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCESubjectExperts->Archived->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
		<td<?php echo $CCESubjectExperts->Archived->CellAttributes() ?>><span id="el_Archived">
<input type="text" name="x_Archived" id="x_Archived" title="<?php echo $CCESubjectExperts->Archived->FldTitle() ?>" size="30" value="<?php echo $CCESubjectExperts->Archived->EditValue ?>"<?php echo $CCESubjectExperts->Archived->EditAttributes() ?>>
</span><?php echo $CCESubjectExperts->Archived->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("EditBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCESubjectExperts_edit {

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

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

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

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

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

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

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

		// Table object (CCESubjectExperts)
		$GLOBALS["CCESubjectExperts"] = new cCCESubjectExperts();

		// Table object (CCEUsers)
		$GLOBALS['CCEUsers'] = new cCCEUsers();

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

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'CCESubjectExperts', 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 $CCESubjectExperts;

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

		// Create form object
		$objForm = new cFormObj();

		// 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 $sDbMasterFilter;
	var $sDbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError, $CCESubjectExperts;

		// Load key from QueryString
		if (@$_GET["ExpertID"] <> "")
			$CCESubjectExperts->ExpertID->setQueryStringValue($_GET["ExpertID"]);
		if (@$_POST["a_edit"] <> "") {
			$CCESubjectExperts->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->GetUploadFiles(); // Get upload files
			$this->LoadFormValues(); // Get form values

			// Validate form
			if (!$this->ValidateForm()) {
				$CCESubjectExperts->CurrentAction = ""; // Form error, reset action
				$this->setMessage($gsFormError);
				$CCESubjectExperts->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		} else {
			$CCESubjectExperts->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($CCESubjectExperts->ExpertID->CurrentValue == "")
			$this->Page_Terminate("CCESubjectExpertslist.php"); // Invalid key, return to list
		switch ($CCESubjectExperts->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					$this->setMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("CCESubjectExpertslist.php"); // No matching record, return to list
				}
				break;
			Case "U": // Update
				$CCESubjectExperts->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					$this->setMessage($Language->Phrase("UpdateSuccess")); // Update success
					$sReturnUrl = $CCESubjectExperts->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "CCESubjectExpertsview.php")
						$sReturnUrl = $CCESubjectExperts->ViewUrl(); // View paging, return to View page directly
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$CCESubjectExperts->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed
				}
		}

		// Render the record
		$CCESubjectExperts->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm, $CCESubjectExperts;

		// Get upload data
			if ($CCESubjectExperts->CVFile->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCESubjectExperts->CVFile->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCESubjectExperts->Photograph->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCESubjectExperts->Photograph->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCESubjectExperts->Qualifications->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCESubjectExperts->Qualifications->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $CCESubjectExperts;
		$CCESubjectExperts->ExpertID->setFormValue($objForm->GetValue("x_ExpertID"));
		$CCESubjectExperts->ExpertName->setFormValue($objForm->GetValue("x_ExpertName"));
		$CCESubjectExperts->PhoneNumber->setFormValue($objForm->GetValue("x_PhoneNumber"));
		$CCESubjectExperts->MobileNumber->setFormValue($objForm->GetValue("x_MobileNumber"));
		$CCESubjectExperts->FaxNumber->setFormValue($objForm->GetValue("x_FaxNumber"));
		$CCESubjectExperts->EmailAddress->setFormValue($objForm->GetValue("x_EmailAddress"));
		$CCESubjectExperts->Archived->setFormValue($objForm->GetValue("x_Archived"));
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm, $CCESubjectExperts;
		$this->LoadRow();
		$CCESubjectExperts->ExpertID->CurrentValue = $CCESubjectExperts->ExpertID->FormValue;
		$CCESubjectExperts->ExpertName->CurrentValue = $CCESubjectExperts->ExpertName->FormValue;
		$CCESubjectExperts->PhoneNumber->CurrentValue = $CCESubjectExperts->PhoneNumber->FormValue;
		$CCESubjectExperts->MobileNumber->CurrentValue = $CCESubjectExperts->MobileNumber->FormValue;
		$CCESubjectExperts->FaxNumber->CurrentValue = $CCESubjectExperts->FaxNumber->FormValue;
		$CCESubjectExperts->EmailAddress->CurrentValue = $CCESubjectExperts->EmailAddress->FormValue;
		$CCESubjectExperts->Archived->CurrentValue = $CCESubjectExperts->Archived->FormValue;
	}

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCESubjectExperts;
		$CCESubjectExperts->ExpertID->setDbValue($rs->fields('ExpertID'));
		$CCESubjectExperts->ExpertName->setDbValue($rs->fields('ExpertName'));
		$CCESubjectExperts->PhoneNumber->setDbValue($rs->fields('PhoneNumber'));
		$CCESubjectExperts->MobileNumber->setDbValue($rs->fields('MobileNumber'));
		$CCESubjectExperts->FaxNumber->setDbValue($rs->fields('FaxNumber'));
		$CCESubjectExperts->EmailAddress->setDbValue($rs->fields('EmailAddress'));
		$CCESubjectExperts->CVFile->Upload->DbValue = $rs->fields('CVFile');
		$CCESubjectExperts->Photograph->Upload->DbValue = $rs->fields('Photograph');
		$CCESubjectExperts->Qualifications->Upload->DbValue = $rs->fields('Qualifications');
		$CCESubjectExperts->Archived->setDbValue($rs->fields('Archived'));
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$CCESubjectExperts->Row_Rendering();

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

		$CCESubjectExperts->ExpertID->CellCssStyle = ""; $CCESubjectExperts->ExpertID->CellCssClass = "";
		$CCESubjectExperts->ExpertID->CellAttrs = array(); $CCESubjectExperts->ExpertID->ViewAttrs = array(); $CCESubjectExperts->ExpertID->EditAttrs = array();

		// ExpertName
		$CCESubjectExperts->ExpertName->CellCssStyle = ""; $CCESubjectExperts->ExpertName->CellCssClass = "";
		$CCESubjectExperts->ExpertName->CellAttrs = array(); $CCESubjectExperts->ExpertName->ViewAttrs = array(); $CCESubjectExperts->ExpertName->EditAttrs = array();

		// PhoneNumber
		$CCESubjectExperts->PhoneNumber->CellCssStyle = ""; $CCESubjectExperts->PhoneNumber->CellCssClass = "";
		$CCESubjectExperts->PhoneNumber->CellAttrs = array(); $CCESubjectExperts->PhoneNumber->ViewAttrs = array(); $CCESubjectExperts->PhoneNumber->EditAttrs = array();

		// MobileNumber
		$CCESubjectExperts->MobileNumber->CellCssStyle = ""; $CCESubjectExperts->MobileNumber->CellCssClass = "";
		$CCESubjectExperts->MobileNumber->CellAttrs = array(); $CCESubjectExperts->MobileNumber->ViewAttrs = array(); $CCESubjectExperts->MobileNumber->EditAttrs = array();

		// FaxNumber
		$CCESubjectExperts->FaxNumber->CellCssStyle = ""; $CCESubjectExperts->FaxNumber->CellCssClass = "";
		$CCESubjectExperts->FaxNumber->CellAttrs = array(); $CCESubjectExperts->FaxNumber->ViewAttrs = array(); $CCESubjectExperts->FaxNumber->EditAttrs = array();

		// EmailAddress
		$CCESubjectExperts->EmailAddress->CellCssStyle = ""; $CCESubjectExperts->EmailAddress->CellCssClass = "";
		$CCESubjectExperts->EmailAddress->CellAttrs = array(); $CCESubjectExperts->EmailAddress->ViewAttrs = array(); $CCESubjectExperts->EmailAddress->EditAttrs = array();

		// CVFile
		$CCESubjectExperts->CVFile->CellCssStyle = ""; $CCESubjectExperts->CVFile->CellCssClass = "";
		$CCESubjectExperts->CVFile->CellAttrs = array(); $CCESubjectExperts->CVFile->ViewAttrs = array(); $CCESubjectExperts->CVFile->EditAttrs = array();

		// Photograph
		$CCESubjectExperts->Photograph->CellCssStyle = ""; $CCESubjectExperts->Photograph->CellCssClass = "";
		$CCESubjectExperts->Photograph->CellAttrs = array(); $CCESubjectExperts->Photograph->ViewAttrs = array(); $CCESubjectExperts->Photograph->EditAttrs = array();

		// Qualifications
		$CCESubjectExperts->Qualifications->CellCssStyle = ""; $CCESubjectExperts->Qualifications->CellCssClass = "";
		$CCESubjectExperts->Qualifications->CellAttrs = array(); $CCESubjectExperts->Qualifications->ViewAttrs = array(); $CCESubjectExperts->Qualifications->EditAttrs = array();

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

			// ExpertID
			$CCESubjectExperts->ExpertID->ViewValue = $CCESubjectExperts->ExpertID->CurrentValue;
			$CCESubjectExperts->ExpertID->CssStyle = "";
			$CCESubjectExperts->ExpertID->CssClass = "";
			$CCESubjectExperts->ExpertID->ViewCustomAttributes = "";

			// ExpertName
			$CCESubjectExperts->ExpertName->ViewValue = $CCESubjectExperts->ExpertName->CurrentValue;
			$CCESubjectExperts->ExpertName->CssStyle = "";
			$CCESubjectExperts->ExpertName->CssClass = "";
			$CCESubjectExperts->ExpertName->ViewCustomAttributes = "";

			// PhoneNumber
			$CCESubjectExperts->PhoneNumber->ViewValue = $CCESubjectExperts->PhoneNumber->CurrentValue;
			$CCESubjectExperts->PhoneNumber->CssStyle = "";
			$CCESubjectExperts->PhoneNumber->CssClass = "";
			$CCESubjectExperts->PhoneNumber->ViewCustomAttributes = "";

			// MobileNumber
			$CCESubjectExperts->MobileNumber->ViewValue = $CCESubjectExperts->MobileNumber->CurrentValue;
			$CCESubjectExperts->MobileNumber->CssStyle = "";
			$CCESubjectExperts->MobileNumber->CssClass = "";
			$CCESubjectExperts->MobileNumber->ViewCustomAttributes = "";

			// FaxNumber
			$CCESubjectExperts->FaxNumber->ViewValue = $CCESubjectExperts->FaxNumber->CurrentValue;
			$CCESubjectExperts->FaxNumber->CssStyle = "";
			$CCESubjectExperts->FaxNumber->CssClass = "";
			$CCESubjectExperts->FaxNumber->ViewCustomAttributes = "";

			// EmailAddress
			$CCESubjectExperts->EmailAddress->ViewValue = $CCESubjectExperts->EmailAddress->CurrentValue;
			$CCESubjectExperts->EmailAddress->CssStyle = "";
			$CCESubjectExperts->EmailAddress->CssClass = "";
			$CCESubjectExperts->EmailAddress->ViewCustomAttributes = "";

			// CVFile
			if (!ew_Empty($CCESubjectExperts->CVFile->Upload->DbValue)) {
				$CCESubjectExperts->CVFile->ViewValue = $CCESubjectExperts->CVFile->Upload->DbValue;
			} else {
				$CCESubjectExperts->CVFile->ViewValue = "";
			}
			$CCESubjectExperts->CVFile->CssStyle = "";
			$CCESubjectExperts->CVFile->CssClass = "";
			$CCESubjectExperts->CVFile->ViewCustomAttributes = "";

			// Photograph
			if (!ew_Empty($CCESubjectExperts->Photograph->Upload->DbValue)) {
				$CCESubjectExperts->Photograph->ViewValue = $CCESubjectExperts->Photograph->Upload->DbValue;
			} else {
				$CCESubjectExperts->Photograph->ViewValue = "";
			}
			$CCESubjectExperts->Photograph->CssStyle = "";
			$CCESubjectExperts->Photograph->CssClass = "";
			$CCESubjectExperts->Photograph->ViewCustomAttributes = "";

			// Qualifications
			if (!ew_Empty($CCESubjectExperts->Qualifications->Upload->DbValue)) {
				$CCESubjectExperts->Qualifications->ViewValue = $CCESubjectExperts->Qualifications->Upload->DbValue;
			} else {
				$CCESubjectExperts->Qualifications->ViewValue = "";
			}
			$CCESubjectExperts->Qualifications->CssStyle = "";
			$CCESubjectExperts->Qualifications->CssClass = "";
			$CCESubjectExperts->Qualifications->ViewCustomAttributes = "";

			// Archived
			$CCESubjectExperts->Archived->ViewValue = $CCESubjectExperts->Archived->CurrentValue;
			$CCESubjectExperts->Archived->CssStyle = "";
			$CCESubjectExperts->Archived->CssClass = "";
			$CCESubjectExperts->Archived->ViewCustomAttributes = "";

			// ExpertID
			$CCESubjectExperts->ExpertID->HrefValue = "";
			$CCESubjectExperts->ExpertID->TooltipValue = "";

			// ExpertName
			$CCESubjectExperts->ExpertName->HrefValue = "";
			$CCESubjectExperts->ExpertName->TooltipValue = "";

			// PhoneNumber
			$CCESubjectExperts->PhoneNumber->HrefValue = "";
			$CCESubjectExperts->PhoneNumber->TooltipValue = "";

			// MobileNumber
			$CCESubjectExperts->MobileNumber->HrefValue = "";
			$CCESubjectExperts->MobileNumber->TooltipValue = "";

			// FaxNumber
			$CCESubjectExperts->FaxNumber->HrefValue = "";
			$CCESubjectExperts->FaxNumber->TooltipValue = "";

			// EmailAddress
			$CCESubjectExperts->EmailAddress->HrefValue = "";
			$CCESubjectExperts->EmailAddress->TooltipValue = "";

			// CVFile
			if (!ew_Empty($CCESubjectExperts->CVFile->Upload->DbValue)) {
				$CCESubjectExperts->CVFile->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->CVFile->UploadPath) . ((!empty($CCESubjectExperts->CVFile->ViewValue)) ? $CCESubjectExperts->CVFile->ViewValue : $CCESubjectExperts->CVFile->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->CVFile->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->CVFile->HrefValue);
			} else {
				$CCESubjectExperts->CVFile->HrefValue = "";
			}
			$CCESubjectExperts->CVFile->TooltipValue = "";

			// Photograph
			if (!ew_Empty($CCESubjectExperts->Photograph->Upload->DbValue)) {
				$CCESubjectExperts->Photograph->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->Photograph->UploadPath) . ((!empty($CCESubjectExperts->Photograph->ViewValue)) ? $CCESubjectExperts->Photograph->ViewValue : $CCESubjectExperts->Photograph->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->Photograph->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->Photograph->HrefValue);
			} else {
				$CCESubjectExperts->Photograph->HrefValue = "";
			}
			$CCESubjectExperts->Photograph->TooltipValue = "";

			// Qualifications
			if (!ew_Empty($CCESubjectExperts->Qualifications->Upload->DbValue)) {
				$CCESubjectExperts->Qualifications->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->Qualifications->UploadPath) . ((!empty($CCESubjectExperts->Qualifications->ViewValue)) ? $CCESubjectExperts->Qualifications->ViewValue : $CCESubjectExperts->Qualifications->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->Qualifications->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->Qualifications->HrefValue);
			} else {
				$CCESubjectExperts->Qualifications->HrefValue = "";
			}
			$CCESubjectExperts->Qualifications->TooltipValue = "";

			// Archived
			$CCESubjectExperts->Archived->HrefValue = "";
			$CCESubjectExperts->Archived->TooltipValue = "";
		} elseif ($CCESubjectExperts->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// ExpertID
			$CCESubjectExperts->ExpertID->EditCustomAttributes = "";
			$CCESubjectExperts->ExpertID->EditValue = $CCESubjectExperts->ExpertID->CurrentValue;
			$CCESubjectExperts->ExpertID->CssStyle = "";
			$CCESubjectExperts->ExpertID->CssClass = "";
			$CCESubjectExperts->ExpertID->ViewCustomAttributes = "";

			// ExpertName
			$CCESubjectExperts->ExpertName->EditCustomAttributes = "";
			$CCESubjectExperts->ExpertName->EditValue = ew_HtmlEncode($CCESubjectExperts->ExpertName->CurrentValue);

			// PhoneNumber
			$CCESubjectExperts->PhoneNumber->EditCustomAttributes = "";
			$CCESubjectExperts->PhoneNumber->EditValue = ew_HtmlEncode($CCESubjectExperts->PhoneNumber->CurrentValue);

			// MobileNumber
			$CCESubjectExperts->MobileNumber->EditCustomAttributes = "";
			$CCESubjectExperts->MobileNumber->EditValue = ew_HtmlEncode($CCESubjectExperts->MobileNumber->CurrentValue);

			// FaxNumber
			$CCESubjectExperts->FaxNumber->EditCustomAttributes = "";
			$CCESubjectExperts->FaxNumber->EditValue = ew_HtmlEncode($CCESubjectExperts->FaxNumber->CurrentValue);

			// EmailAddress
			$CCESubjectExperts->EmailAddress->EditCustomAttributes = "";
			$CCESubjectExperts->EmailAddress->EditValue = ew_HtmlEncode($CCESubjectExperts->EmailAddress->CurrentValue);

			// CVFile
			$CCESubjectExperts->CVFile->EditCustomAttributes = "";
			if (!ew_Empty($CCESubjectExperts->CVFile->Upload->DbValue)) {
				$CCESubjectExperts->CVFile->EditValue = $CCESubjectExperts->CVFile->Upload->DbValue;
			} else {
				$CCESubjectExperts->CVFile->EditValue = "";
			}

			// Photograph
			$CCESubjectExperts->Photograph->EditCustomAttributes = "";
			if (!ew_Empty($CCESubjectExperts->Photograph->Upload->DbValue)) {
				$CCESubjectExperts->Photograph->EditValue = $CCESubjectExperts->Photograph->Upload->DbValue;
			} else {
				$CCESubjectExperts->Photograph->EditValue = "";
			}

			// Qualifications
			$CCESubjectExperts->Qualifications->EditCustomAttributes = "";
			if (!ew_Empty($CCESubjectExperts->Qualifications->Upload->DbValue)) {
				$CCESubjectExperts->Qualifications->EditValue = $CCESubjectExperts->Qualifications->Upload->DbValue;
			} else {
				$CCESubjectExperts->Qualifications->EditValue = "";
			}

			// Archived
			$CCESubjectExperts->Archived->EditCustomAttributes = "";
			$CCESubjectExperts->Archived->EditValue = ew_HtmlEncode($CCESubjectExperts->Archived->CurrentValue);

			// Edit refer script
			// ExpertID

			$CCESubjectExperts->ExpertID->HrefValue = "";

			// ExpertName
			$CCESubjectExperts->ExpertName->HrefValue = "";

			// PhoneNumber
			$CCESubjectExperts->PhoneNumber->HrefValue = "";

			// MobileNumber
			$CCESubjectExperts->MobileNumber->HrefValue = "";

			// FaxNumber
			$CCESubjectExperts->FaxNumber->HrefValue = "";

			// EmailAddress
			$CCESubjectExperts->EmailAddress->HrefValue = "";

			// CVFile
			if (!ew_Empty($CCESubjectExperts->CVFile->Upload->DbValue)) {
				$CCESubjectExperts->CVFile->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->CVFile->UploadPath) . ((!empty($CCESubjectExperts->CVFile->EditValue)) ? $CCESubjectExperts->CVFile->EditValue : $CCESubjectExperts->CVFile->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->CVFile->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->CVFile->HrefValue);
			} else {
				$CCESubjectExperts->CVFile->HrefValue = "";
			}

			// Photograph
			if (!ew_Empty($CCESubjectExperts->Photograph->Upload->DbValue)) {
				$CCESubjectExperts->Photograph->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->Photograph->UploadPath) . ((!empty($CCESubjectExperts->Photograph->EditValue)) ? $CCESubjectExperts->Photograph->EditValue : $CCESubjectExperts->Photograph->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->Photograph->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->Photograph->HrefValue);
			} else {
				$CCESubjectExperts->Photograph->HrefValue = "";
			}

			// Qualifications
			if (!ew_Empty($CCESubjectExperts->Qualifications->Upload->DbValue)) {
				$CCESubjectExperts->Qualifications->HrefValue = ew_UploadPathEx(FALSE, $CCESubjectExperts->Qualifications->UploadPath) . ((!empty($CCESubjectExperts->Qualifications->EditValue)) ? $CCESubjectExperts->Qualifications->EditValue : $CCESubjectExperts->Qualifications->CurrentValue);
				if ($CCESubjectExperts->Export <> "") $CCESubjectExperts->Qualifications->HrefValue = ew_ConvertFullUrl($CCESubjectExperts->Qualifications->HrefValue);
			} else {
				$CCESubjectExperts->Qualifications->HrefValue = "";
			}

			// Archived
			$CCESubjectExperts->Archived->HrefValue = "";
		}

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

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError, $CCESubjectExperts;

		// Initialize form error message
		$gsFormError = "";
		if (!ew_CheckFileType($CCESubjectExperts->CVFile->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCESubjectExperts->CVFile->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCESubjectExperts->CVFile->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCESubjectExperts->CVFile->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCESubjectExperts->CVFile->Upload->Error);
		}
		if (!ew_CheckFileType($CCESubjectExperts->Photograph->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCESubjectExperts->Photograph->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCESubjectExperts->Photograph->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCESubjectExperts->Photograph->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCESubjectExperts->Photograph->Upload->Error);
		}
		if (!ew_CheckFileType($CCESubjectExperts->Qualifications->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCESubjectExperts->Qualifications->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCESubjectExperts->Qualifications->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCESubjectExperts->Qualifications->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCESubjectExperts->Qualifications->Upload->Error);
		}

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckInteger($CCESubjectExperts->Archived->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCESubjectExperts->Archived->FldErrMsg();
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $sFormCustomError;
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language, $CCESubjectExperts;
		$sFilter = $CCESubjectExperts->KeyFilter();
		$CCESubjectExperts->CurrentFilter = $sFilter;
		$sSql = $CCESubjectExperts->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Save old values
			$rsold =& $rs->fields;
			$rsnew = array();

			// ExpertName
			$CCESubjectExperts->ExpertName->SetDbValueDef($rsnew, $CCESubjectExperts->ExpertName->CurrentValue, NULL, FALSE);

			// PhoneNumber
			$CCESubjectExperts->PhoneNumber->SetDbValueDef($rsnew, $CCESubjectExperts->PhoneNumber->CurrentValue, NULL, FALSE);

			// MobileNumber
			$CCESubjectExperts->MobileNumber->SetDbValueDef($rsnew, $CCESubjectExperts->MobileNumber->CurrentValue, NULL, FALSE);

			// FaxNumber
			$CCESubjectExperts->FaxNumber->SetDbValueDef($rsnew, $CCESubjectExperts->FaxNumber->CurrentValue, NULL, FALSE);

			// EmailAddress
			$CCESubjectExperts->EmailAddress->SetDbValueDef($rsnew, $CCESubjectExperts->EmailAddress->CurrentValue, NULL, FALSE);

			// CVFile
			$CCESubjectExperts->CVFile->Upload->SaveToSession(); // Save file value to Session
						if ($CCESubjectExperts->CVFile->Upload->Action == "2" || $CCESubjectExperts->CVFile->Upload->Action == "3") { // Update/Remove
			$CCESubjectExperts->CVFile->Upload->DbValue = $rs->fields('CVFile'); // Get original value
			if (is_null($CCESubjectExperts->CVFile->Upload->Value)) {
				$rsnew['CVFile'] = NULL;
			} else {
				$rsnew['CVFile'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCESubjectExperts->CVFile->UploadPath), $CCESubjectExperts->CVFile->Upload->FileName);
			}
			}

			// Photograph
			$CCESubjectExperts->Photograph->Upload->SaveToSession(); // Save file value to Session
						if ($CCESubjectExperts->Photograph->Upload->Action == "2" || $CCESubjectExperts->Photograph->Upload->Action == "3") { // Update/Remove
			$CCESubjectExperts->Photograph->Upload->DbValue = $rs->fields('Photograph'); // Get original value
			if (is_null($CCESubjectExperts->Photograph->Upload->Value)) {
				$rsnew['Photograph'] = NULL;
			} else {
				$rsnew['Photograph'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCESubjectExperts->Photograph->UploadPath), $CCESubjectExperts->Photograph->Upload->FileName);
			}
			}

			// Qualifications
			$CCESubjectExperts->Qualifications->Upload->SaveToSession(); // Save file value to Session
						if ($CCESubjectExperts->Qualifications->Upload->Action == "2" || $CCESubjectExperts->Qualifications->Upload->Action == "3") { // Update/Remove
			$CCESubjectExperts->Qualifications->Upload->DbValue = $rs->fields('Qualifications'); // Get original value
			if (is_null($CCESubjectExperts->Qualifications->Upload->Value)) {
				$rsnew['Qualifications'] = NULL;
			} else {
				$rsnew['Qualifications'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCESubjectExperts->Qualifications->UploadPath), $CCESubjectExperts->Qualifications->Upload->FileName);
			}
			}

			// Archived
			$CCESubjectExperts->Archived->SetDbValueDef($rsnew, $CCESubjectExperts->Archived->CurrentValue, 0, FALSE);

			// Call Row Updating event
			$bUpdateRow = $CCESubjectExperts->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
			if (!ew_Empty($CCESubjectExperts->CVFile->Upload->Value)) {
				$CCESubjectExperts->CVFile->Upload->SaveToFile($CCESubjectExperts->CVFile->UploadPath, $rsnew['CVFile'], FALSE);
			}
			if (!ew_Empty($CCESubjectExperts->Photograph->Upload->Value)) {
				$CCESubjectExperts->Photograph->Upload->SaveToFile($CCESubjectExperts->Photograph->UploadPath, $rsnew['Photograph'], FALSE);
			}
			if (!ew_Empty($CCESubjectExperts->Qualifications->Upload->Value)) {
				$CCESubjectExperts->Qualifications->Upload->SaveToFile($CCESubjectExperts->Qualifications->UploadPath, $rsnew['Qualifications'], FALSE);
			}
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$EditRow = $conn->Execute($CCESubjectExperts->UpdateSQL($rsnew));
				$conn->raiseErrorFn = '';
			} else {
				if ($CCESubjectExperts->CancelMessage <> "") {
					$this->setMessage($CCESubjectExperts->CancelMessage);
					$CCESubjectExperts->CancelMessage = "";
				} else {
					$this->setMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$CCESubjectExperts->Row_Updated($rsold, $rsnew);
		$rs->Close();

		// CVFile
		$CCESubjectExperts->CVFile->Upload->RemoveFromSession(); // Remove file value from Session

		// Photograph
		$CCESubjectExperts->Photograph->Upload->RemoveFromSession(); // Remove file value from Session

		// Qualifications
		$CCESubjectExperts->Qualifications->Upload->RemoveFromSession(); // Remove file value from Session
		return $EditRow;
	}

	// 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;
	}
}
?>