Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEFacilitatorsadd.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 "CCEFacilitatorsinfo.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
$CCEFacilitators_add = new cCCEFacilitators_add();
$Page =& $CCEFacilitators_add;

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

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

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

// page properties
CCEFacilitators_add.PageID = "add"; // page ID
CCEFacilitators_add.FormID = "fCCEFacilitatorsadd"; // form ID
var EW_PAGE_ID = CCEFacilitators_add.PageID; // for backward compatibility

// extend page with ValidateForm function
CCEFacilitators_add.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 + "_Archived"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEFacilitators->Archived->FldErrMsg()) ?>");

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

// extend page with Form_CustomValidate function
CCEFacilitators_add.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) { ?>
CCEFacilitators_add.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEFacilitators_add.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("Add") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEFacilitators->TableCaption() ?><br><br>
<a href="<?php echo $CCEFacilitators->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEFacilitators_add->ShowMessage();
?>
<form name="fCCEFacilitatorsadd" id="fCCEFacilitatorsadd" action="<?php echo ew_CurrentPage() ?>" method="post" enctype="multipart/form-data" onsubmit="return CCEFacilitators_add.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEFacilitators">
<input type="hidden" name="a_add" id="a_add" value="A">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEFacilitators->FacilitatorName->Visible) { // FacilitatorName ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->FacilitatorName->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->FacilitatorName->CellAttributes() ?>><span id="el_FacilitatorName">
<input type="text" name="x_FacilitatorName" id="x_FacilitatorName" title="<?php echo $CCEFacilitators->FacilitatorName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->FacilitatorName->EditValue ?>"<?php echo $CCEFacilitators->FacilitatorName->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->FacilitatorName->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->PhoneNumber->Visible) { // PhoneNumber ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->PhoneNumber->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->PhoneNumber->CellAttributes() ?>><span id="el_PhoneNumber">
<input type="text" name="x_PhoneNumber" id="x_PhoneNumber" title="<?php echo $CCEFacilitators->PhoneNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->PhoneNumber->EditValue ?>"<?php echo $CCEFacilitators->PhoneNumber->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->PhoneNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->MobileNumber->Visible) { // MobileNumber ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->MobileNumber->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->MobileNumber->CellAttributes() ?>><span id="el_MobileNumber">
<input type="text" name="x_MobileNumber" id="x_MobileNumber" title="<?php echo $CCEFacilitators->MobileNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->MobileNumber->EditValue ?>"<?php echo $CCEFacilitators->MobileNumber->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->MobileNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->FaxNumber->Visible) { // FaxNumber ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->FaxNumber->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->FaxNumber->CellAttributes() ?>><span id="el_FaxNumber">
<input type="text" name="x_FaxNumber" id="x_FaxNumber" title="<?php echo $CCEFacilitators->FaxNumber->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->FaxNumber->EditValue ?>"<?php echo $CCEFacilitators->FaxNumber->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->FaxNumber->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->EmailAddress->Visible) { // EmailAddress ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->EmailAddress->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->EmailAddress->CellAttributes() ?>><span id="el_EmailAddress">
<input type="text" name="x_EmailAddress" id="x_EmailAddress" title="<?php echo $CCEFacilitators->EmailAddress->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->EmailAddress->EditValue ?>"<?php echo $CCEFacilitators->EmailAddress->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->EmailAddress->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->CVFile->Visible) { // CVFile ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->CVFile->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->CVFile->CellAttributes() ?>><span id="el_CVFile">
<input type="file" name="x_CVFile" id="x_CVFile" title="<?php echo $CCEFacilitators->CVFile->FldTitle() ?>" size="30"<?php echo $CCEFacilitators->CVFile->EditAttributes() ?>>
</div>
</span><?php echo $CCEFacilitators->CVFile->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->Photograph->Visible) { // Photograph ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->Photograph->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->Photograph->CellAttributes() ?>><span id="el_Photograph">
<input type="file" name="x_Photograph" id="x_Photograph" title="<?php echo $CCEFacilitators->Photograph->FldTitle() ?>" size="30"<?php echo $CCEFacilitators->Photograph->EditAttributes() ?>>
</div>
</span><?php echo $CCEFacilitators->Photograph->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->Qualifications->Visible) { // Qualifications ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->Qualifications->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->Qualifications->CellAttributes() ?>><span id="el_Qualifications">
<input type="text" name="x_Qualifications" id="x_Qualifications" title="<?php echo $CCEFacilitators->Qualifications->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEFacilitators->Qualifications->EditValue ?>"<?php echo $CCEFacilitators->Qualifications->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->Qualifications->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEFacilitators->Archived->Visible) { // Archived ?>
	<tr<?php echo $CCEFacilitators->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEFacilitators->Archived->FldCaption() ?></td>
		<td<?php echo $CCEFacilitators->Archived->CellAttributes() ?>><span id="el_Archived">
<input type="text" name="x_Archived" id="x_Archived" title="<?php echo $CCEFacilitators->Archived->FldTitle() ?>" size="30" value="<?php echo $CCEFacilitators->Archived->EditValue ?>"<?php echo $CCEFacilitators->Archived->EditAttributes() ?>>
</span><?php echo $CCEFacilitators->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("AddBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCEFacilitators_add {

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

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

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

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

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

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

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

		// Table object (CCEFacilitators)
		$GLOBALS["CCEFacilitators"] = new cCCEFacilitators();

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

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

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

		// 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->CanAdd()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCEFacilitatorslist.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 = "";
	var $lPriv = 0;

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

		// Load key values from QueryString
		$bCopy = TRUE;
		if (@$_GET["FacilitatorID"] != "") {
		  $CCEFacilitators->FacilitatorID->setQueryStringValue($_GET["FacilitatorID"]);
		} else {
		  $bCopy = FALSE;
		}

		// Process form if post back
		if (@$_POST["a_add"] <> "") {
		   $CCEFacilitators->CurrentAction = $_POST["a_add"]; // Get form action
		  $this->GetUploadFiles(); // Get upload files
		  $this->LoadFormValues(); // Load form values

			// Validate form
			if (!$this->ValidateForm()) {
				$CCEFacilitators->CurrentAction = "I"; // Form error, reset action
				$this->setMessage($gsFormError);
			}
		} else { // Not post back
		  if ($bCopy) {
		    $CCEFacilitators->CurrentAction = "C"; // Copy record
		  } else {
		    $CCEFacilitators->CurrentAction = "I"; // Display blank record
		    $this->LoadDefaultValues(); // Load default values
		  }
		}

		// Perform action based on action code
		switch ($CCEFacilitators->CurrentAction) {
		  case "I": // Blank record, no action required
				break;
		  case "C": // Copy an existing record
		   if (!$this->LoadRow()) { // Load record based on key
		      $this->setMessage($Language->Phrase("NoRecord")); // No record found
		      $this->Page_Terminate("CCEFacilitatorslist.php"); // No matching record, return to list
		    }
				break;
		  case "A": // ' Add new record
				$CCEFacilitators->SendEmail = TRUE; // Send email on add success
		    if ($this->AddRow()) { // Add successful
		      $this->setMessage($Language->Phrase("AddSuccess")); // Set up success message
					$sReturnUrl = $CCEFacilitators->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "CCEFacilitatorsview.php")
						$sReturnUrl = $CCEFacilitators->ViewUrl(); // View paging, return to view page with keyurl directly
					$this->Page_Terminate($sReturnUrl); // Clean up and return
		    } else {
		      $this->RestoreFormValues(); // Add failed, restore form values
		    }
		}

		// Render row based on row type
		$CCEFacilitators->RowType = EW_ROWTYPE_ADD;  // Render add type

		// Render row
		$this->RenderRow();
	}

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

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

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

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

	// Load default values
	function LoadDefaultValues() {
		global $CCEFacilitators;
		$CCEFacilitators->CVFile->CurrentValue = NULL; // Clear file related field
		$CCEFacilitators->Photograph->CurrentValue = NULL; // Clear file related field
		$CCEFacilitators->Archived->CurrentValue = 0;
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $CCEFacilitators;
		$CCEFacilitators->FacilitatorName->setFormValue($objForm->GetValue("x_FacilitatorName"));
		$CCEFacilitators->PhoneNumber->setFormValue($objForm->GetValue("x_PhoneNumber"));
		$CCEFacilitators->MobileNumber->setFormValue($objForm->GetValue("x_MobileNumber"));
		$CCEFacilitators->FaxNumber->setFormValue($objForm->GetValue("x_FaxNumber"));
		$CCEFacilitators->EmailAddress->setFormValue($objForm->GetValue("x_EmailAddress"));
		$CCEFacilitators->Qualifications->setFormValue($objForm->GetValue("x_Qualifications"));
		$CCEFacilitators->Archived->setFormValue($objForm->GetValue("x_Archived"));
		$CCEFacilitators->FacilitatorID->setFormValue($objForm->GetValue("x_FacilitatorID"));
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm, $CCEFacilitators;
		$CCEFacilitators->FacilitatorID->CurrentValue = $CCEFacilitators->FacilitatorID->FormValue;
		$CCEFacilitators->FacilitatorName->CurrentValue = $CCEFacilitators->FacilitatorName->FormValue;
		$CCEFacilitators->PhoneNumber->CurrentValue = $CCEFacilitators->PhoneNumber->FormValue;
		$CCEFacilitators->MobileNumber->CurrentValue = $CCEFacilitators->MobileNumber->FormValue;
		$CCEFacilitators->FaxNumber->CurrentValue = $CCEFacilitators->FaxNumber->FormValue;
		$CCEFacilitators->EmailAddress->CurrentValue = $CCEFacilitators->EmailAddress->FormValue;
		$CCEFacilitators->Qualifications->CurrentValue = $CCEFacilitators->Qualifications->FormValue;
		$CCEFacilitators->Archived->CurrentValue = $CCEFacilitators->Archived->FormValue;
	}

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

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

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

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

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

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

		// Initialize URLs
		// Call Row_Rendering event

		$CCEFacilitators->Row_Rendering();

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

		$CCEFacilitators->FacilitatorName->CellCssStyle = ""; $CCEFacilitators->FacilitatorName->CellCssClass = "";
		$CCEFacilitators->FacilitatorName->CellAttrs = array(); $CCEFacilitators->FacilitatorName->ViewAttrs = array(); $CCEFacilitators->FacilitatorName->EditAttrs = array();

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

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

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

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

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

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

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

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

			// FacilitatorID
			$CCEFacilitators->FacilitatorID->ViewValue = $CCEFacilitators->FacilitatorID->CurrentValue;
			$CCEFacilitators->FacilitatorID->CssStyle = "";
			$CCEFacilitators->FacilitatorID->CssClass = "";
			$CCEFacilitators->FacilitatorID->ViewCustomAttributes = "";

			// FacilitatorName
			$CCEFacilitators->FacilitatorName->ViewValue = $CCEFacilitators->FacilitatorName->CurrentValue;
			$CCEFacilitators->FacilitatorName->CssStyle = "";
			$CCEFacilitators->FacilitatorName->CssClass = "";
			$CCEFacilitators->FacilitatorName->ViewCustomAttributes = "";

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

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

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

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

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

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

			// Qualifications
			$CCEFacilitators->Qualifications->ViewValue = $CCEFacilitators->Qualifications->CurrentValue;
			$CCEFacilitators->Qualifications->CssStyle = "";
			$CCEFacilitators->Qualifications->CssClass = "";
			$CCEFacilitators->Qualifications->ViewCustomAttributes = "";

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

			// FacilitatorName
			$CCEFacilitators->FacilitatorName->HrefValue = "";
			$CCEFacilitators->FacilitatorName->TooltipValue = "";

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

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

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

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

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

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

			// Qualifications
			$CCEFacilitators->Qualifications->HrefValue = "";
			$CCEFacilitators->Qualifications->TooltipValue = "";

			// Archived
			$CCEFacilitators->Archived->HrefValue = "";
			$CCEFacilitators->Archived->TooltipValue = "";
		} elseif ($CCEFacilitators->RowType == EW_ROWTYPE_ADD) { // Add row

			// FacilitatorName
			$CCEFacilitators->FacilitatorName->EditCustomAttributes = "";
			$CCEFacilitators->FacilitatorName->EditValue = ew_HtmlEncode($CCEFacilitators->FacilitatorName->CurrentValue);

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

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

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

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

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

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

			// Qualifications
			$CCEFacilitators->Qualifications->EditCustomAttributes = "";
			$CCEFacilitators->Qualifications->EditValue = ew_HtmlEncode($CCEFacilitators->Qualifications->CurrentValue);

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

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

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

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

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckInteger($CCEFacilitators->Archived->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEFacilitators->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;
	}

	// Add record
	function AddRow() {
		global $conn, $Language, $Security, $CCEFacilitators;
		$rsnew = array();

		// FacilitatorName
		$CCEFacilitators->FacilitatorName->SetDbValueDef($rsnew, $CCEFacilitators->FacilitatorName->CurrentValue, NULL, FALSE);

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

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

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

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

		// CVFile
		$CCEFacilitators->CVFile->Upload->SaveToSession(); // Save file value to Session
		if (is_null($CCEFacilitators->CVFile->Upload->Value)) {
			$rsnew['CVFile'] = NULL;
		} else {
			$rsnew['CVFile'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEFacilitators->CVFile->UploadPath), $CCEFacilitators->CVFile->Upload->FileName);
		}

		// Photograph
		$CCEFacilitators->Photograph->Upload->SaveToSession(); // Save file value to Session
		if (is_null($CCEFacilitators->Photograph->Upload->Value)) {
			$rsnew['Photograph'] = NULL;
		} else {
			$rsnew['Photograph'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEFacilitators->Photograph->UploadPath), $CCEFacilitators->Photograph->Upload->FileName);
		}
		$CCEFacilitators->Photograph->ImageWidth = EW_THUMBNAIL_DEFAULT_WIDTH; // Resize width
		$CCEFacilitators->Photograph->ImageHeight = EW_THUMBNAIL_DEFAULT_HEIGHT; // Resize height

		// Qualifications
		$CCEFacilitators->Qualifications->SetDbValueDef($rsnew, $CCEFacilitators->Qualifications->CurrentValue, NULL, FALSE);

		// Archived
		$CCEFacilitators->Archived->SetDbValueDef($rsnew, $CCEFacilitators->Archived->CurrentValue, NULL, TRUE);

		// Call Row Inserting event
		$bInsertRow = $CCEFacilitators->Row_Inserting($rsnew);
		if ($bInsertRow) {
			if (!ew_Empty($CCEFacilitators->CVFile->Upload->Value)) {
				$CCEFacilitators->CVFile->Upload->SaveToFile($CCEFacilitators->CVFile->UploadPath, $rsnew['CVFile'], FALSE);
			}
			if (!ew_Empty($CCEFacilitators->Photograph->Upload->Value)) {
				$CCEFacilitators->Photograph->Upload->RestoreFromSession(); // Restore original value
				$CCEFacilitators->Photograph->Upload->Resize($CCEFacilitators->Photograph->ImageWidth, $CCEFacilitators->Photograph->ImageHeight, 75);
			}
			$CCEFacilitators->Photograph->ImageWidth = 0; // Reset image width
			$CCEFacilitators->Photograph->ImageHeight = 0; // Reset image height
			if (!ew_Empty($CCEFacilitators->Photograph->Upload->Value)) {
				$CCEFacilitators->Photograph->Upload->SaveToFile($CCEFacilitators->Photograph->UploadPath, $rsnew['Photograph'], FALSE);
			}
			$conn->raiseErrorFn = 'ew_ErrorFn';
			$AddRow = $conn->Execute($CCEFacilitators->InsertSQL($rsnew));
			$conn->raiseErrorFn = '';
		} else {
			if ($CCEFacilitators->CancelMessage <> "") {
				$this->setMessage($CCEFacilitators->CancelMessage);
				$CCEFacilitators->CancelMessage = "";
			} else {
				$this->setMessage($Language->Phrase("InsertCancelled"));
			}
			$AddRow = FALSE;
		}
		if ($AddRow) {
			$CCEFacilitators->FacilitatorID->setDbValue($conn->Insert_ID());
			$rsnew['FacilitatorID'] = $CCEFacilitators->FacilitatorID->DbValue;

			// Call Row Inserted event
			$CCEFacilitators->Row_Inserted($rsnew);
		}

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

		// Photograph
		$CCEFacilitators->Photograph->Upload->RemoveFromSession(); // Remove file value from Session
		return $AddRow;
	}

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