Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/ccmadmin/
Upload File :
Current File : /var/www/cesa.co.za/ccmadmin/CCMStudentsdelete.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 "CCMStudentsinfo.php" ?>
<?php include "CCMUsersinfo.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
$CCMStudents_delete = new cCCMStudents_delete();
$Page =& $CCMStudents_delete;

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

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

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

// page properties
CCMStudents_delete.PageID = "delete"; // page ID
CCMStudents_delete.FormID = "fCCMStudentsdelete"; // form ID
var EW_PAGE_ID = CCMStudents_delete.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
CCMStudents_delete.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) { ?>
CCMStudents_delete.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCMStudents_delete.ValidateRequired = false; // no JavaScript validation
<?php } ?>

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

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

</script>
<?php

// Load records for display
if ($rs = $CCMStudents_delete->LoadRecordset())
	$CCMStudents_deletelTotalRecs = $rs->RecordCount(); // Get record count
if ($CCMStudents_deletelTotalRecs <= 0) { // No record found, exit
	if ($rs)
		$rs->Close();
	$CCMStudents_delete->Page_Terminate("CCMStudentslist.php"); // Return to list
}
?>
<p><span class="phpmaker"><?php echo $Language->Phrase("Delete") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCMStudents->TableCaption() ?><br><br>
<a href="<?php echo $CCMStudents->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCMStudents_delete->ShowMessage();
?>
<form action="<?php echo ew_CurrentPage() ?>" method="post">
<p>
<input type="hidden" name="t" id="t" value="CCMStudents">
<input type="hidden" name="a_delete" id="a_delete" value="D">
<?php foreach ($CCMStudents_delete->arRecKeys as $key) { ?>
<input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($key) ?>">
<?php } ?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable ewTableSeparate">
<?php echo $CCMStudents->TableCustomInnerHtml ?>
	<thead>
	<tr class="ewTableHeader">
		<td valign="top"><?php echo $CCMStudents->SelectionCategory->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->FirstName->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->Surname->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->KnownAs->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->IDNumber->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->Telephone->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->Cellphone->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->EmailAddress->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->Organisation->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->Province->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->ProfessionalCouncil->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->CategoryReg->FldCaption() ?></td>
		<td valign="top"><?php echo $CCMStudents->BelongsTo->FldCaption() ?></td>
	</tr>
	</thead>
	<tbody>
<?php
$CCMStudents_delete->lRecCnt = 0;
$i = 0;
while (!$rs->EOF) {
	$CCMStudents_delete->lRecCnt++;

	// Set row properties
	$CCMStudents->CssClass = "";
	$CCMStudents->CssStyle = "";
	$CCMStudents->RowAttrs = array();
	$CCMStudents->RowType = EW_ROWTYPE_VIEW; // View

	// Get the field contents
	$CCMStudents_delete->LoadRowValues($rs);

	// Render row
	$CCMStudents_delete->RenderRow();
?>
	<tr<?php echo $CCMStudents->RowAttributes() ?>>
		<td<?php echo $CCMStudents->SelectionCategory->CellAttributes() ?>>
<div<?php echo $CCMStudents->SelectionCategory->ViewAttributes() ?>><?php echo $CCMStudents->SelectionCategory->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->FirstName->CellAttributes() ?>>
<div<?php echo $CCMStudents->FirstName->ViewAttributes() ?>><?php echo $CCMStudents->FirstName->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->Surname->CellAttributes() ?>>
<div<?php echo $CCMStudents->Surname->ViewAttributes() ?>><?php echo $CCMStudents->Surname->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->KnownAs->CellAttributes() ?>>
<div<?php echo $CCMStudents->KnownAs->ViewAttributes() ?>><?php echo $CCMStudents->KnownAs->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->IDNumber->CellAttributes() ?>>
<div<?php echo $CCMStudents->IDNumber->ViewAttributes() ?>><?php echo $CCMStudents->IDNumber->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->Telephone->CellAttributes() ?>>
<div<?php echo $CCMStudents->Telephone->ViewAttributes() ?>><?php echo $CCMStudents->Telephone->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->Cellphone->CellAttributes() ?>>
<div<?php echo $CCMStudents->Cellphone->ViewAttributes() ?>><?php echo $CCMStudents->Cellphone->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->EmailAddress->CellAttributes() ?>>
<div<?php echo $CCMStudents->EmailAddress->ViewAttributes() ?>><?php echo $CCMStudents->EmailAddress->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->Organisation->CellAttributes() ?>>
<div<?php echo $CCMStudents->Organisation->ViewAttributes() ?>><?php echo $CCMStudents->Organisation->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->Province->CellAttributes() ?>>
<div<?php echo $CCMStudents->Province->ViewAttributes() ?>><?php echo $CCMStudents->Province->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->ProfessionalCouncil->CellAttributes() ?>>
<div<?php echo $CCMStudents->ProfessionalCouncil->ViewAttributes() ?>><?php echo $CCMStudents->ProfessionalCouncil->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->CategoryReg->CellAttributes() ?>>
<div<?php echo $CCMStudents->CategoryReg->ViewAttributes() ?>><?php echo $CCMStudents->CategoryReg->ListViewValue() ?></div></td>
		<td<?php echo $CCMStudents->BelongsTo->CellAttributes() ?>>
<div<?php echo $CCMStudents->BelongsTo->ViewAttributes() ?>><?php echo $CCMStudents->BelongsTo->ListViewValue() ?></div></td>
	</tr>
<?php
	$rs->MoveNext();
}
$rs->Close();
?>
</tbody>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("DeleteBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCMStudents_delete {

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

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

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

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

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

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

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

		// Table object (CCMStudents)
		$GLOBALS["CCMStudents"] = new cCCMStudents();

		// Table object (CCMUsers)
		$GLOBALS['CCMUsers'] = new cCCMUsers();

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

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

		// 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->CanDelete()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCMStudentslist.php");
		}

		// 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 $lTotalRecs = 0;
	var $lRecCnt;
	var $arRecKeys = array();

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

		// Load key parameters
		$sKey = "";
		$bSingleDelete = TRUE; // Initialize as single delete
		$nKeySelected = 0; // Initialize selected key count
		$sFilter = "";
		if (@$_GET["CCMStudentID"] <> "") {
			$CCMStudents->CCMStudentID->setQueryStringValue($_GET["CCMStudentID"]);
			if (!is_numeric($CCMStudents->CCMStudentID->QueryStringValue))
				$this->Page_Terminate("CCMStudentslist.php"); // Prevent SQL injection, exit
			$sKey .= $CCMStudents->CCMStudentID->QueryStringValue;
		} else {
			$bSingleDelete = FALSE;
		}
		if ($bSingleDelete) {
			$nKeySelected = 1; // Set up key selected count
			$this->arRecKeys[0] = $sKey;
		} else {
			if (isset($_POST["key_m"])) { // Key in form
				$nKeySelected = count($_POST["key_m"]); // Set up key selected count
				$this->arRecKeys = ew_StripSlashes($_POST["key_m"]);
			}
		}
		if ($nKeySelected <= 0)
			$this->Page_Terminate("CCMStudentslist.php"); // No key specified, return to list

		// Build filter
		foreach ($this->arRecKeys as $sKey) {
			$sFilter .= "(";

			// Set up key field
			$sKeyFld = $sKey;
			if (!is_numeric($sKeyFld))
				$this->Page_Terminate("CCMStudentslist.php"); // Prevent SQL injection, return to list
			$sFilter .= "`CCMStudentID`=" . ew_AdjustSql($sKeyFld) . " AND ";
			if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
		}
		if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);

		// Set up filter (SQL WHHERE clause) and get return SQL
		// SQL constructor in CCMStudents class, CCMStudentsinfo.php

		$CCMStudents->CurrentFilter = $sFilter;

		// Get action
		if (@$_POST["a_delete"] <> "") {
			$CCMStudents->CurrentAction = $_POST["a_delete"];
		} else {
			$CCMStudents->CurrentAction = "I"; // Display record
		}
		switch ($CCMStudents->CurrentAction) {
			case "D": // Delete
				$CCMStudents->SendEmail = TRUE; // Send email on delete success
				if ($this->DeleteRows()) { // delete rows
					$this->setMessage($Language->Phrase("DeleteSuccess")); // Set up success message
					$this->Page_Terminate($CCMStudents->getReturnUrl()); // Return to caller
				}
		}
	}

	//
	// Delete records based on current filter
	//
	function DeleteRows() {
		global $conn, $Language, $Security, $CCMStudents;
		$DeleteRows = TRUE;
		$sWrkFilter = $CCMStudents->CurrentFilter;

		// Set up filter (SQL WHERE clause) and get return SQL
		// SQL constructor in CCMStudents class, CCMStudentsinfo.php

		$CCMStudents->CurrentFilter = $sWrkFilter;
		$sSql = $CCMStudents->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE) {
			return FALSE;
		} elseif ($rs->EOF) {
			$this->setMessage($Language->Phrase("NoRecord")); // No record found
			$rs->Close();
			return FALSE;
		}
		$conn->BeginTrans();

		// Clone old rows
		$rsold = ($rs) ? $rs->GetRows() : array();
		if ($rs)
			$rs->Close();

		// Call row deleting event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$DeleteRows = $CCMStudents->Row_Deleting($row);
				if (!$DeleteRows) break;
			}
		}
		if ($DeleteRows) {
			$sKey = "";
			foreach ($rsold as $row) {
				$sThisKey = "";
				if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
				$sThisKey .= $row['CCMStudentID'];
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$DeleteRows = $conn->Execute($CCMStudents->DeleteSQL($row)); // Delete
				$conn->raiseErrorFn = '';
				if ($DeleteRows === FALSE)
					break;
				if ($sKey <> "") $sKey .= ", ";
				$sKey .= $sThisKey;
			}
		} else {

			// Set up error message
			if ($CCMStudents->CancelMessage <> "") {
				$this->setMessage($CCMStudents->CancelMessage);
				$CCMStudents->CancelMessage = "";
			} else {
				$this->setMessage($Language->Phrase("DeleteCancelled"));
			}
		}
		if ($DeleteRows) {
			$conn->CommitTrans(); // Commit the changes
		} else {
			$conn->RollbackTrans(); // Rollback changes
		}

		// Call Row Deleted event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$CCMStudents->Row_Deleted($row);
			}	
		}
		return $DeleteRows;
	}

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCMStudents;
		$CCMStudents->CCMStudentID->setDbValue($rs->fields('CCMStudentID'));
		$CCMStudents->SelectionCategory->setDbValue($rs->fields('SelectionCategory'));
		$CCMStudents->Title->setDbValue($rs->fields('Title'));
		$CCMStudents->Initials->setDbValue($rs->fields('Initials'));
		$CCMStudents->FirstName->setDbValue($rs->fields('FirstName'));
		$CCMStudents->Surname->setDbValue($rs->fields('Surname'));
		$CCMStudents->KnownAs->setDbValue($rs->fields('KnownAs'));
		$CCMStudents->IDNumber->setDbValue($rs->fields('IDNumber'));
		$CCMStudents->Telephone->setDbValue($rs->fields('Telephone'));
		$CCMStudents->Cellphone->setDbValue($rs->fields('Cellphone'));
		$CCMStudents->EmailAddress->setDbValue($rs->fields('EmailAddress'));
		$CCMStudents->WorkAddress->setDbValue($rs->fields('WorkAddress'));
		$CCMStudents->PostalAddress->setDbValue($rs->fields('PostalAddress'));
		$CCMStudents->Department->setDbValue($rs->fields('Department'));
		$CCMStudents->Organisation->setDbValue($rs->fields('Organisation'));
		$CCMStudents->VATNo->setDbValue($rs->fields('VATNo'));
		$CCMStudents->JobTitle->setDbValue($rs->fields('JobTitle'));
		$CCMStudents->DateofBirth->setDbValue($rs->fields('DateofBirth'));
		$CCMStudents->PlaceofBirth->setDbValue($rs->fields('PlaceofBirth'));
		$CCMStudents->CountryofBirth->setDbValue($rs->fields('CountryofBirth'));
		$CCMStudents->Province->setDbValue($rs->fields('Province'));
		$CCMStudents->MaleorFemale->setDbValue($rs->fields('MaleorFemale'));
		$CCMStudents->RaceGroup->setDbValue($rs->fields('RaceGroup'));
		$CCMStudents->Disability->setDbValue($rs->fields('Disability'));
		$CCMStudents->DisabilityNature->setDbValue($rs->fields('DisabilityNature'));
		$CCMStudents->DisabilityCertificate->Upload->DbValue = $rs->fields('DisabilityCertificate');
		$CCMStudents->ProfessionalCouncil->setDbValue($rs->fields('ProfessionalCouncil'));
		$CCMStudents->CategoryReg->setDbValue($rs->fields('CategoryReg'));
		$CCMStudents->CouncilRegNumber->setDbValue($rs->fields('CouncilRegNumber'));
		$CCMStudents->LengthCandidateReg->setDbValue($rs->fields('LengthCandidateReg'));
		$CCMStudents->YearsToProfReg->setDbValue($rs->fields('YearsToProfReg'));
		$CCMStudents->FirstJobStart->setDbValue($rs->fields('FirstJobStart'));
		$CCMStudents->VolAssociations->setDbValue($rs->fields('VolAssociations'));
		$CCMStudents->BelongsTo->setDbValue($rs->fields('BelongsTo'));
		$CCMStudents->CESA_SABTACO_MemNum->setDbValue($rs->fields('CESA_SABTACO_MemNum'));
		$CCMStudents->AreaDiscipline->setDbValue($rs->fields('AreaDiscipline'));
		$CCMStudents->AreaSubDiscipline->setDbValue($rs->fields('AreaSubDiscipline'));
		$CCMStudents->Salary->setDbValue($rs->fields('Salary'));
		$CCMStudents->Payslip->Upload->DbValue = $rs->fields('Payslip');
		$CCMStudents->BankAccountName->setDbValue($rs->fields('BankAccountName'));
		$CCMStudents->BankAccountBank->setDbValue($rs->fields('BankAccountBank'));
		$CCMStudents->BankAccountBranch->setDbValue($rs->fields('BankAccountBranch'));
		$CCMStudents->BankAccountNo->setDbValue($rs->fields('BankAccountNo'));
		$CCMStudents->BankAccountProof->Upload->DbValue = $rs->fields('BankAccountProof');
		$CCMStudents->Funding->setDbValue($rs->fields('Funding'));
		$CCMStudents->CWDTP->setDbValue($rs->fields('CWDTP'));
		$CCMStudents->BookedByName->setDbValue($rs->fields('BookedByName'));
		$CCMStudents->BookedByDesignation->setDbValue($rs->fields('BookedByDesignation'));
		$CCMStudents->BookedByTelNo->setDbValue($rs->fields('BookedByTelNo'));
		$CCMStudents->BookedByFaxNo->setDbValue($rs->fields('BookedByFaxNo'));
		$CCMStudents->BookedByCellNo->setDbValue($rs->fields('BookedByCellNo'));
		$CCMStudents->BookedByEmail->setDbValue($rs->fields('BookedByEmail'));
		$CCMStudents->MentorID->setDbValue($rs->fields('MentorID'));
		$CCMStudents->MentorName->setDbValue($rs->fields('MentorName'));
		$CCMStudents->MentorDesig->setDbValue($rs->fields('MentorDesig'));
		$CCMStudents->MentorProfRegNo->setDbValue($rs->fields('MentorProfRegNo'));
		$CCMStudents->MentorRegNo->setDbValue($rs->fields('MentorRegNo'));
		$CCMStudents->MentorTel->setDbValue($rs->fields('MentorTel'));
		$CCMStudents->MentorCell->setDbValue($rs->fields('MentorCell'));
		$CCMStudents->MentorEmail->setDbValue($rs->fields('MentorEmail'));
		$CCMStudents->EmployerID->setDbValue($rs->fields('EmployerID'));
		$CCMStudents->HRManagerName->setDbValue($rs->fields('HRManagerName'));
		$CCMStudents->HRManagerDesignation->setDbValue($rs->fields('HRManagerDesignation'));
		$CCMStudents->HRManagerTelNo->setDbValue($rs->fields('HRManagerTelNo'));
		$CCMStudents->HRManagerCellNo->setDbValue($rs->fields('HRManagerCellNo'));
		$CCMStudents->HRManagerEmail->setDbValue($rs->fields('HRManagerEmail'));
		$CCMStudents->SupervisorName->setDbValue($rs->fields('SupervisorName'));
		$CCMStudents->SupervisorDesig->setDbValue($rs->fields('SupervisorDesig'));
		$CCMStudents->SupervisorProfRegNo->setDbValue($rs->fields('SupervisorProfRegNo'));
		$CCMStudents->SupervisorTelNo->setDbValue($rs->fields('SupervisorTelNo'));
		$CCMStudents->SupervisorCellNo->setDbValue($rs->fields('SupervisorCellNo'));
		$CCMStudents->SupervisorEmail->setDbValue($rs->fields('SupervisorEmail'));
		$CCMStudents->EducationalInst->setDbValue($rs->fields('EducationalInst'));
		$CCMStudents->Qualifications->setDbValue($rs->fields('Qualifications'));
		$CCMStudents->DateFinalExam->setDbValue($rs->fields('DateFinalExam'));
		$CCMStudents->IDFile->Upload->DbValue = $rs->fields('IDFile');
		$CCMStudents->CVFile->Upload->DbValue = $rs->fields('CVFile');
		$CCMStudents->QualCertificate1->Upload->DbValue = $rs->fields('QualCertificate1');
		$CCMStudents->QualCertificate2->Upload->DbValue = $rs->fields('QualCertificate2');
		$CCMStudents->QualCertificate3->Upload->DbValue = $rs->fields('QualCertificate3');
		$CCMStudents->MentorUndertaking->Upload->DbValue = $rs->fields('MentorUndertaking');
		$CCMStudents->CandUUndertaking->Upload->DbValue = $rs->fields('CandUUndertaking');
		$CCMStudents->CompanyCandidatePolicy->Upload->DbValue = $rs->fields('CompanyCandidatePolicy');
		$CCMStudents->ResidenceProof->Upload->DbValue = $rs->fields('ResidenceProof');
		$CCMStudents->SignedAppForm->Upload->DbValue = $rs->fields('SignedAppForm');
		$CCMStudents->Photograph->Upload->DbValue = $rs->fields('Photograph');
		$CCMStudents->StudentNumber->setDbValue($rs->fields('StudentNumber'));
		$CCMStudents->WebUsername->setDbValue($rs->fields('WebUsername'));
		$CCMStudents->WebPassword->setDbValue($rs->fields('WebPassword'));
		$CCMStudents->BlockAccess->setDbValue($rs->fields('BlockAccess'));
		$CCMStudents->SABTACO->setDbValue($rs->fields('SABTACO'));
		$CCMStudents->CESA->setDbValue($rs->fields('CESA'));
		$CCMStudents->Archived->setDbValue($rs->fields('Archived'));
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$CCMStudents->Row_Rendering();

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

		$CCMStudents->SelectionCategory->CellCssStyle = ""; $CCMStudents->SelectionCategory->CellCssClass = "";
		$CCMStudents->SelectionCategory->CellAttrs = array(); $CCMStudents->SelectionCategory->ViewAttrs = array(); $CCMStudents->SelectionCategory->EditAttrs = array();

		// FirstName
		$CCMStudents->FirstName->CellCssStyle = ""; $CCMStudents->FirstName->CellCssClass = "";
		$CCMStudents->FirstName->CellAttrs = array(); $CCMStudents->FirstName->ViewAttrs = array(); $CCMStudents->FirstName->EditAttrs = array();

		// Surname
		$CCMStudents->Surname->CellCssStyle = ""; $CCMStudents->Surname->CellCssClass = "";
		$CCMStudents->Surname->CellAttrs = array(); $CCMStudents->Surname->ViewAttrs = array(); $CCMStudents->Surname->EditAttrs = array();

		// KnownAs
		$CCMStudents->KnownAs->CellCssStyle = ""; $CCMStudents->KnownAs->CellCssClass = "";
		$CCMStudents->KnownAs->CellAttrs = array(); $CCMStudents->KnownAs->ViewAttrs = array(); $CCMStudents->KnownAs->EditAttrs = array();

		// IDNumber
		$CCMStudents->IDNumber->CellCssStyle = ""; $CCMStudents->IDNumber->CellCssClass = "";
		$CCMStudents->IDNumber->CellAttrs = array(); $CCMStudents->IDNumber->ViewAttrs = array(); $CCMStudents->IDNumber->EditAttrs = array();

		// Telephone
		$CCMStudents->Telephone->CellCssStyle = ""; $CCMStudents->Telephone->CellCssClass = "";
		$CCMStudents->Telephone->CellAttrs = array(); $CCMStudents->Telephone->ViewAttrs = array(); $CCMStudents->Telephone->EditAttrs = array();

		// Cellphone
		$CCMStudents->Cellphone->CellCssStyle = ""; $CCMStudents->Cellphone->CellCssClass = "";
		$CCMStudents->Cellphone->CellAttrs = array(); $CCMStudents->Cellphone->ViewAttrs = array(); $CCMStudents->Cellphone->EditAttrs = array();

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

		// Organisation
		$CCMStudents->Organisation->CellCssStyle = ""; $CCMStudents->Organisation->CellCssClass = "";
		$CCMStudents->Organisation->CellAttrs = array(); $CCMStudents->Organisation->ViewAttrs = array(); $CCMStudents->Organisation->EditAttrs = array();

		// Province
		$CCMStudents->Province->CellCssStyle = ""; $CCMStudents->Province->CellCssClass = "";
		$CCMStudents->Province->CellAttrs = array(); $CCMStudents->Province->ViewAttrs = array(); $CCMStudents->Province->EditAttrs = array();

		// ProfessionalCouncil
		$CCMStudents->ProfessionalCouncil->CellCssStyle = ""; $CCMStudents->ProfessionalCouncil->CellCssClass = "";
		$CCMStudents->ProfessionalCouncil->CellAttrs = array(); $CCMStudents->ProfessionalCouncil->ViewAttrs = array(); $CCMStudents->ProfessionalCouncil->EditAttrs = array();

		// CategoryReg
		$CCMStudents->CategoryReg->CellCssStyle = ""; $CCMStudents->CategoryReg->CellCssClass = "";
		$CCMStudents->CategoryReg->CellAttrs = array(); $CCMStudents->CategoryReg->ViewAttrs = array(); $CCMStudents->CategoryReg->EditAttrs = array();

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

			// SelectionCategory
			$CCMStudents->SelectionCategory->ViewValue = $CCMStudents->SelectionCategory->CurrentValue;
			$CCMStudents->SelectionCategory->CssStyle = "";
			$CCMStudents->SelectionCategory->CssClass = "";
			$CCMStudents->SelectionCategory->ViewCustomAttributes = "";

			// Title
			$CCMStudents->Title->ViewValue = $CCMStudents->Title->CurrentValue;
			$CCMStudents->Title->CssStyle = "";
			$CCMStudents->Title->CssClass = "";
			$CCMStudents->Title->ViewCustomAttributes = "";

			// Initials
			$CCMStudents->Initials->ViewValue = $CCMStudents->Initials->CurrentValue;
			$CCMStudents->Initials->CssStyle = "";
			$CCMStudents->Initials->CssClass = "";
			$CCMStudents->Initials->ViewCustomAttributes = "";

			// FirstName
			$CCMStudents->FirstName->ViewValue = $CCMStudents->FirstName->CurrentValue;
			$CCMStudents->FirstName->CssStyle = "";
			$CCMStudents->FirstName->CssClass = "";
			$CCMStudents->FirstName->ViewCustomAttributes = "";

			// Surname
			$CCMStudents->Surname->ViewValue = $CCMStudents->Surname->CurrentValue;
			$CCMStudents->Surname->CssStyle = "";
			$CCMStudents->Surname->CssClass = "";
			$CCMStudents->Surname->ViewCustomAttributes = "";

			// KnownAs
			$CCMStudents->KnownAs->ViewValue = $CCMStudents->KnownAs->CurrentValue;
			$CCMStudents->KnownAs->CssStyle = "";
			$CCMStudents->KnownAs->CssClass = "";
			$CCMStudents->KnownAs->ViewCustomAttributes = "";

			// IDNumber
			$CCMStudents->IDNumber->ViewValue = $CCMStudents->IDNumber->CurrentValue;
			$CCMStudents->IDNumber->CssStyle = "";
			$CCMStudents->IDNumber->CssClass = "";
			$CCMStudents->IDNumber->ViewCustomAttributes = "mso-number-format:General";

			// Telephone
			$CCMStudents->Telephone->ViewValue = $CCMStudents->Telephone->CurrentValue;
			$CCMStudents->Telephone->CssStyle = "";
			$CCMStudents->Telephone->CssClass = "";
			$CCMStudents->Telephone->ViewCustomAttributes = "mso-number-format:General";

			// Cellphone
			$CCMStudents->Cellphone->ViewValue = $CCMStudents->Cellphone->CurrentValue;
			$CCMStudents->Cellphone->CssStyle = "";
			$CCMStudents->Cellphone->CssClass = "";
			$CCMStudents->Cellphone->ViewCustomAttributes = "mso-number-format:General";

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

			// WorkAddress
			$CCMStudents->WorkAddress->ViewValue = $CCMStudents->WorkAddress->CurrentValue;
			$CCMStudents->WorkAddress->CssStyle = "";
			$CCMStudents->WorkAddress->CssClass = "";
			$CCMStudents->WorkAddress->ViewCustomAttributes = "";

			// PostalAddress
			$CCMStudents->PostalAddress->ViewValue = $CCMStudents->PostalAddress->CurrentValue;
			$CCMStudents->PostalAddress->CssStyle = "";
			$CCMStudents->PostalAddress->CssClass = "";
			$CCMStudents->PostalAddress->ViewCustomAttributes = "";

			// Department
			$CCMStudents->Department->ViewValue = $CCMStudents->Department->CurrentValue;
			$CCMStudents->Department->CssStyle = "";
			$CCMStudents->Department->CssClass = "";
			$CCMStudents->Department->ViewCustomAttributes = "";

			// Organisation
			$CCMStudents->Organisation->ViewValue = $CCMStudents->Organisation->CurrentValue;
			$CCMStudents->Organisation->CssStyle = "";
			$CCMStudents->Organisation->CssClass = "";
			$CCMStudents->Organisation->ViewCustomAttributes = "";

			// VATNo
			$CCMStudents->VATNo->ViewValue = $CCMStudents->VATNo->CurrentValue;
			$CCMStudents->VATNo->CssStyle = "";
			$CCMStudents->VATNo->CssClass = "";
			$CCMStudents->VATNo->ViewCustomAttributes = "";

			// JobTitle
			$CCMStudents->JobTitle->ViewValue = $CCMStudents->JobTitle->CurrentValue;
			$CCMStudents->JobTitle->CssStyle = "";
			$CCMStudents->JobTitle->CssClass = "";
			$CCMStudents->JobTitle->ViewCustomAttributes = "";

			// DateofBirth
			$CCMStudents->DateofBirth->ViewValue = $CCMStudents->DateofBirth->CurrentValue;
			$CCMStudents->DateofBirth->ViewValue = ew_FormatDateTime($CCMStudents->DateofBirth->ViewValue, 5);
			$CCMStudents->DateofBirth->CssStyle = "";
			$CCMStudents->DateofBirth->CssClass = "";
			$CCMStudents->DateofBirth->ViewCustomAttributes = "";

			// PlaceofBirth
			$CCMStudents->PlaceofBirth->ViewValue = $CCMStudents->PlaceofBirth->CurrentValue;
			$CCMStudents->PlaceofBirth->CssStyle = "";
			$CCMStudents->PlaceofBirth->CssClass = "";
			$CCMStudents->PlaceofBirth->ViewCustomAttributes = "";

			// CountryofBirth
			$CCMStudents->CountryofBirth->ViewValue = $CCMStudents->CountryofBirth->CurrentValue;
			$CCMStudents->CountryofBirth->CssStyle = "";
			$CCMStudents->CountryofBirth->CssClass = "";
			$CCMStudents->CountryofBirth->ViewCustomAttributes = "";

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

			// MaleorFemale
			$CCMStudents->MaleorFemale->ViewValue = $CCMStudents->MaleorFemale->CurrentValue;
			$CCMStudents->MaleorFemale->CssStyle = "";
			$CCMStudents->MaleorFemale->CssClass = "";
			$CCMStudents->MaleorFemale->ViewCustomAttributes = "";

			// RaceGroup
			$CCMStudents->RaceGroup->ViewValue = $CCMStudents->RaceGroup->CurrentValue;
			$CCMStudents->RaceGroup->CssStyle = "";
			$CCMStudents->RaceGroup->CssClass = "";
			$CCMStudents->RaceGroup->ViewCustomAttributes = "";

			// Disability
			if (strval($CCMStudents->Disability->CurrentValue) <> "") {
				switch ($CCMStudents->Disability->CurrentValue) {
					case "y":
						$CCMStudents->Disability->ViewValue = "Yes";
						break;
					case "n":
						$CCMStudents->Disability->ViewValue = "No";
						break;
					default:
						$CCMStudents->Disability->ViewValue = $CCMStudents->Disability->CurrentValue;
				}
			} else {
				$CCMStudents->Disability->ViewValue = NULL;
			}
			$CCMStudents->Disability->CssStyle = "";
			$CCMStudents->Disability->CssClass = "";
			$CCMStudents->Disability->ViewCustomAttributes = "";

			// DisabilityNature
			$CCMStudents->DisabilityNature->ViewValue = $CCMStudents->DisabilityNature->CurrentValue;
			$CCMStudents->DisabilityNature->CssStyle = "";
			$CCMStudents->DisabilityNature->CssClass = "";
			$CCMStudents->DisabilityNature->ViewCustomAttributes = "";

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

			// ProfessionalCouncil
			$CCMStudents->ProfessionalCouncil->ViewValue = $CCMStudents->ProfessionalCouncil->CurrentValue;
			$CCMStudents->ProfessionalCouncil->CssStyle = "";
			$CCMStudents->ProfessionalCouncil->CssClass = "";
			$CCMStudents->ProfessionalCouncil->ViewCustomAttributes = "";

			// CategoryReg
			$CCMStudents->CategoryReg->ViewValue = $CCMStudents->CategoryReg->CurrentValue;
			$CCMStudents->CategoryReg->CssStyle = "";
			$CCMStudents->CategoryReg->CssClass = "";
			$CCMStudents->CategoryReg->ViewCustomAttributes = "";

			// CouncilRegNumber
			$CCMStudents->CouncilRegNumber->ViewValue = $CCMStudents->CouncilRegNumber->CurrentValue;
			$CCMStudents->CouncilRegNumber->CssStyle = "";
			$CCMStudents->CouncilRegNumber->CssClass = "";
			$CCMStudents->CouncilRegNumber->ViewCustomAttributes = "";

			// LengthCandidateReg
			$CCMStudents->LengthCandidateReg->ViewValue = $CCMStudents->LengthCandidateReg->CurrentValue;
			$CCMStudents->LengthCandidateReg->CssStyle = "";
			$CCMStudents->LengthCandidateReg->CssClass = "";
			$CCMStudents->LengthCandidateReg->ViewCustomAttributes = "";

			// YearsToProfReg
			$CCMStudents->YearsToProfReg->ViewValue = $CCMStudents->YearsToProfReg->CurrentValue;
			$CCMStudents->YearsToProfReg->CssStyle = "";
			$CCMStudents->YearsToProfReg->CssClass = "";
			$CCMStudents->YearsToProfReg->ViewCustomAttributes = "";

			// FirstJobStart
			$CCMStudents->FirstJobStart->ViewValue = $CCMStudents->FirstJobStart->CurrentValue;
			$CCMStudents->FirstJobStart->CssStyle = "";
			$CCMStudents->FirstJobStart->CssClass = "";
			$CCMStudents->FirstJobStart->ViewCustomAttributes = "";

			// VolAssociations
			$CCMStudents->VolAssociations->ViewValue = $CCMStudents->VolAssociations->CurrentValue;
			$CCMStudents->VolAssociations->CssStyle = "";
			$CCMStudents->VolAssociations->CssClass = "";
			$CCMStudents->VolAssociations->ViewCustomAttributes = "";

			// BelongsTo
			$CCMStudents->BelongsTo->ViewValue = $CCMStudents->BelongsTo->CurrentValue;
			$CCMStudents->BelongsTo->CssStyle = "";
			$CCMStudents->BelongsTo->CssClass = "";
			$CCMStudents->BelongsTo->ViewCustomAttributes = "";

			// CESA_SABTACO_MemNum
			$CCMStudents->CESA_SABTACO_MemNum->ViewValue = $CCMStudents->CESA_SABTACO_MemNum->CurrentValue;
			$CCMStudents->CESA_SABTACO_MemNum->CssStyle = "";
			$CCMStudents->CESA_SABTACO_MemNum->CssClass = "";
			$CCMStudents->CESA_SABTACO_MemNum->ViewCustomAttributes = "";

			// AreaDiscipline
			$CCMStudents->AreaDiscipline->ViewValue = $CCMStudents->AreaDiscipline->CurrentValue;
			$CCMStudents->AreaDiscipline->CssStyle = "";
			$CCMStudents->AreaDiscipline->CssClass = "";
			$CCMStudents->AreaDiscipline->ViewCustomAttributes = "";

			// AreaSubDiscipline
			$CCMStudents->AreaSubDiscipline->ViewValue = $CCMStudents->AreaSubDiscipline->CurrentValue;
			$CCMStudents->AreaSubDiscipline->CssStyle = "";
			$CCMStudents->AreaSubDiscipline->CssClass = "";
			$CCMStudents->AreaSubDiscipline->ViewCustomAttributes = "";

			// Salary
			$CCMStudents->Salary->ViewValue = $CCMStudents->Salary->CurrentValue;
			$CCMStudents->Salary->CssStyle = "";
			$CCMStudents->Salary->CssClass = "";
			$CCMStudents->Salary->ViewCustomAttributes = "";

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

			// BankAccountName
			$CCMStudents->BankAccountName->ViewValue = $CCMStudents->BankAccountName->CurrentValue;
			$CCMStudents->BankAccountName->CssStyle = "";
			$CCMStudents->BankAccountName->CssClass = "";
			$CCMStudents->BankAccountName->ViewCustomAttributes = "";

			// BankAccountBank
			$CCMStudents->BankAccountBank->ViewValue = $CCMStudents->BankAccountBank->CurrentValue;
			$CCMStudents->BankAccountBank->CssStyle = "";
			$CCMStudents->BankAccountBank->CssClass = "";
			$CCMStudents->BankAccountBank->ViewCustomAttributes = "";

			// BankAccountBranch
			$CCMStudents->BankAccountBranch->ViewValue = $CCMStudents->BankAccountBranch->CurrentValue;
			$CCMStudents->BankAccountBranch->CssStyle = "";
			$CCMStudents->BankAccountBranch->CssClass = "";
			$CCMStudents->BankAccountBranch->ViewCustomAttributes = "";

			// BankAccountNo
			$CCMStudents->BankAccountNo->ViewValue = $CCMStudents->BankAccountNo->CurrentValue;
			$CCMStudents->BankAccountNo->CssStyle = "";
			$CCMStudents->BankAccountNo->CssClass = "";
			$CCMStudents->BankAccountNo->ViewCustomAttributes = "";

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

			// Funding
			$CCMStudents->Funding->ViewValue = $CCMStudents->Funding->CurrentValue;
			$CCMStudents->Funding->CssStyle = "";
			$CCMStudents->Funding->CssClass = "";
			$CCMStudents->Funding->ViewCustomAttributes = "";

			// CWDTP
			$CCMStudents->CWDTP->ViewValue = $CCMStudents->CWDTP->CurrentValue;
			$CCMStudents->CWDTP->CssStyle = "";
			$CCMStudents->CWDTP->CssClass = "";
			$CCMStudents->CWDTP->ViewCustomAttributes = "";

			// BookedByName
			$CCMStudents->BookedByName->ViewValue = $CCMStudents->BookedByName->CurrentValue;
			$CCMStudents->BookedByName->CssStyle = "";
			$CCMStudents->BookedByName->CssClass = "";
			$CCMStudents->BookedByName->ViewCustomAttributes = "";

			// BookedByDesignation
			$CCMStudents->BookedByDesignation->ViewValue = $CCMStudents->BookedByDesignation->CurrentValue;
			$CCMStudents->BookedByDesignation->CssStyle = "";
			$CCMStudents->BookedByDesignation->CssClass = "";
			$CCMStudents->BookedByDesignation->ViewCustomAttributes = "";

			// BookedByTelNo
			$CCMStudents->BookedByTelNo->ViewValue = $CCMStudents->BookedByTelNo->CurrentValue;
			$CCMStudents->BookedByTelNo->CssStyle = "";
			$CCMStudents->BookedByTelNo->CssClass = "";
			$CCMStudents->BookedByTelNo->ViewCustomAttributes = "";

			// BookedByFaxNo
			$CCMStudents->BookedByFaxNo->ViewValue = $CCMStudents->BookedByFaxNo->CurrentValue;
			$CCMStudents->BookedByFaxNo->CssStyle = "";
			$CCMStudents->BookedByFaxNo->CssClass = "";
			$CCMStudents->BookedByFaxNo->ViewCustomAttributes = "";

			// BookedByCellNo
			$CCMStudents->BookedByCellNo->ViewValue = $CCMStudents->BookedByCellNo->CurrentValue;
			$CCMStudents->BookedByCellNo->CssStyle = "";
			$CCMStudents->BookedByCellNo->CssClass = "";
			$CCMStudents->BookedByCellNo->ViewCustomAttributes = "";

			// BookedByEmail
			$CCMStudents->BookedByEmail->ViewValue = $CCMStudents->BookedByEmail->CurrentValue;
			$CCMStudents->BookedByEmail->CssStyle = "";
			$CCMStudents->BookedByEmail->CssClass = "";
			$CCMStudents->BookedByEmail->ViewCustomAttributes = "";

			// MentorID
			if (strval($CCMStudents->MentorID->CurrentValue) <> "") {
				$sFilterWrk = "`CCMMentorID` = " . ew_AdjustSql($CCMStudents->MentorID->CurrentValue) . "";
			$sSqlWrk = "SELECT `Surname`, `FirstName` FROM `CCMMentors`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FirstName`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCMStudents->MentorID->ViewValue = $rswrk->fields('Surname');
					$CCMStudents->MentorID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('FirstName');
					$rswrk->Close();
				} else {
					$CCMStudents->MentorID->ViewValue = $CCMStudents->MentorID->CurrentValue;
				}
			} else {
				$CCMStudents->MentorID->ViewValue = NULL;
			}
			$CCMStudents->MentorID->CssStyle = "";
			$CCMStudents->MentorID->CssClass = "";
			$CCMStudents->MentorID->ViewCustomAttributes = "";

			// MentorName
			$CCMStudents->MentorName->ViewValue = $CCMStudents->MentorName->CurrentValue;
			$CCMStudents->MentorName->CssStyle = "";
			$CCMStudents->MentorName->CssClass = "";
			$CCMStudents->MentorName->ViewCustomAttributes = "";

			// MentorDesig
			$CCMStudents->MentorDesig->ViewValue = $CCMStudents->MentorDesig->CurrentValue;
			$CCMStudents->MentorDesig->CssStyle = "";
			$CCMStudents->MentorDesig->CssClass = "";
			$CCMStudents->MentorDesig->ViewCustomAttributes = "";

			// MentorProfRegNo
			$CCMStudents->MentorProfRegNo->ViewValue = $CCMStudents->MentorProfRegNo->CurrentValue;
			$CCMStudents->MentorProfRegNo->CssStyle = "";
			$CCMStudents->MentorProfRegNo->CssClass = "";
			$CCMStudents->MentorProfRegNo->ViewCustomAttributes = "";

			// MentorRegNo
			$CCMStudents->MentorRegNo->ViewValue = $CCMStudents->MentorRegNo->CurrentValue;
			$CCMStudents->MentorRegNo->CssStyle = "";
			$CCMStudents->MentorRegNo->CssClass = "";
			$CCMStudents->MentorRegNo->ViewCustomAttributes = "";

			// MentorTel
			$CCMStudents->MentorTel->ViewValue = $CCMStudents->MentorTel->CurrentValue;
			$CCMStudents->MentorTel->CssStyle = "";
			$CCMStudents->MentorTel->CssClass = "";
			$CCMStudents->MentorTel->ViewCustomAttributes = "";

			// MentorCell
			$CCMStudents->MentorCell->ViewValue = $CCMStudents->MentorCell->CurrentValue;
			$CCMStudents->MentorCell->CssStyle = "";
			$CCMStudents->MentorCell->CssClass = "";
			$CCMStudents->MentorCell->ViewCustomAttributes = "";

			// MentorEmail
			$CCMStudents->MentorEmail->ViewValue = $CCMStudents->MentorEmail->CurrentValue;
			$CCMStudents->MentorEmail->CssStyle = "";
			$CCMStudents->MentorEmail->CssClass = "";
			$CCMStudents->MentorEmail->ViewCustomAttributes = "";

			// EmployerID
			if (strval($CCMStudents->EmployerID->CurrentValue) <> "") {
				$sFilterWrk = "`CCMEmployerID` = " . ew_AdjustSql($CCMStudents->EmployerID->CurrentValue) . "";
			$sSqlWrk = "SELECT `Organisation`, `Surname` FROM `CCMEmployers`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `Organisation`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCMStudents->EmployerID->ViewValue = $rswrk->fields('Organisation');
					$CCMStudents->EmployerID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
					$rswrk->Close();
				} else {
					$CCMStudents->EmployerID->ViewValue = $CCMStudents->EmployerID->CurrentValue;
				}
			} else {
				$CCMStudents->EmployerID->ViewValue = NULL;
			}
			$CCMStudents->EmployerID->CssStyle = "";
			$CCMStudents->EmployerID->CssClass = "";
			$CCMStudents->EmployerID->ViewCustomAttributes = "";

			// HRManagerName
			$CCMStudents->HRManagerName->ViewValue = $CCMStudents->HRManagerName->CurrentValue;
			$CCMStudents->HRManagerName->CssStyle = "";
			$CCMStudents->HRManagerName->CssClass = "";
			$CCMStudents->HRManagerName->ViewCustomAttributes = "";

			// HRManagerDesignation
			$CCMStudents->HRManagerDesignation->ViewValue = $CCMStudents->HRManagerDesignation->CurrentValue;
			$CCMStudents->HRManagerDesignation->CssStyle = "";
			$CCMStudents->HRManagerDesignation->CssClass = "";
			$CCMStudents->HRManagerDesignation->ViewCustomAttributes = "";

			// HRManagerTelNo
			$CCMStudents->HRManagerTelNo->ViewValue = $CCMStudents->HRManagerTelNo->CurrentValue;
			$CCMStudents->HRManagerTelNo->CssStyle = "";
			$CCMStudents->HRManagerTelNo->CssClass = "";
			$CCMStudents->HRManagerTelNo->ViewCustomAttributes = "";

			// HRManagerCellNo
			$CCMStudents->HRManagerCellNo->ViewValue = $CCMStudents->HRManagerCellNo->CurrentValue;
			$CCMStudents->HRManagerCellNo->CssStyle = "";
			$CCMStudents->HRManagerCellNo->CssClass = "";
			$CCMStudents->HRManagerCellNo->ViewCustomAttributes = "";

			// HRManagerEmail
			$CCMStudents->HRManagerEmail->ViewValue = $CCMStudents->HRManagerEmail->CurrentValue;
			$CCMStudents->HRManagerEmail->CssStyle = "";
			$CCMStudents->HRManagerEmail->CssClass = "";
			$CCMStudents->HRManagerEmail->ViewCustomAttributes = "";

			// SupervisorName
			$CCMStudents->SupervisorName->ViewValue = $CCMStudents->SupervisorName->CurrentValue;
			$CCMStudents->SupervisorName->CssStyle = "";
			$CCMStudents->SupervisorName->CssClass = "";
			$CCMStudents->SupervisorName->ViewCustomAttributes = "";

			// SupervisorDesig
			$CCMStudents->SupervisorDesig->ViewValue = $CCMStudents->SupervisorDesig->CurrentValue;
			$CCMStudents->SupervisorDesig->CssStyle = "";
			$CCMStudents->SupervisorDesig->CssClass = "";
			$CCMStudents->SupervisorDesig->ViewCustomAttributes = "";

			// SupervisorProfRegNo
			$CCMStudents->SupervisorProfRegNo->ViewValue = $CCMStudents->SupervisorProfRegNo->CurrentValue;
			$CCMStudents->SupervisorProfRegNo->CssStyle = "";
			$CCMStudents->SupervisorProfRegNo->CssClass = "";
			$CCMStudents->SupervisorProfRegNo->ViewCustomAttributes = "";

			// SupervisorTelNo
			$CCMStudents->SupervisorTelNo->ViewValue = $CCMStudents->SupervisorTelNo->CurrentValue;
			$CCMStudents->SupervisorTelNo->CssStyle = "";
			$CCMStudents->SupervisorTelNo->CssClass = "";
			$CCMStudents->SupervisorTelNo->ViewCustomAttributes = "";

			// SupervisorCellNo
			$CCMStudents->SupervisorCellNo->ViewValue = $CCMStudents->SupervisorCellNo->CurrentValue;
			$CCMStudents->SupervisorCellNo->CssStyle = "";
			$CCMStudents->SupervisorCellNo->CssClass = "";
			$CCMStudents->SupervisorCellNo->ViewCustomAttributes = "";

			// SupervisorEmail
			$CCMStudents->SupervisorEmail->ViewValue = $CCMStudents->SupervisorEmail->CurrentValue;
			$CCMStudents->SupervisorEmail->CssStyle = "";
			$CCMStudents->SupervisorEmail->CssClass = "";
			$CCMStudents->SupervisorEmail->ViewCustomAttributes = "";

			// EducationalInst
			$CCMStudents->EducationalInst->ViewValue = $CCMStudents->EducationalInst->CurrentValue;
			$CCMStudents->EducationalInst->CssStyle = "";
			$CCMStudents->EducationalInst->CssClass = "";
			$CCMStudents->EducationalInst->ViewCustomAttributes = "";

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

			// DateFinalExam
			$CCMStudents->DateFinalExam->ViewValue = $CCMStudents->DateFinalExam->CurrentValue;
			$CCMStudents->DateFinalExam->CssStyle = "";
			$CCMStudents->DateFinalExam->CssClass = "";
			$CCMStudents->DateFinalExam->ViewCustomAttributes = "";

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

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

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

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

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

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

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

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

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

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

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

			// StudentNumber
			$CCMStudents->StudentNumber->ViewValue = $CCMStudents->StudentNumber->CurrentValue;
			$CCMStudents->StudentNumber->CssStyle = "";
			$CCMStudents->StudentNumber->CssClass = "";
			$CCMStudents->StudentNumber->ViewCustomAttributes = "";

			// WebUsername
			$CCMStudents->WebUsername->ViewValue = $CCMStudents->WebUsername->CurrentValue;
			$CCMStudents->WebUsername->CssStyle = "";
			$CCMStudents->WebUsername->CssClass = "";
			$CCMStudents->WebUsername->ViewCustomAttributes = "";

			// WebPassword
			$CCMStudents->WebPassword->ViewValue = $CCMStudents->WebPassword->CurrentValue;
			$CCMStudents->WebPassword->CssStyle = "";
			$CCMStudents->WebPassword->CssClass = "";
			$CCMStudents->WebPassword->ViewCustomAttributes = "";

			// BlockAccess
			if (strval($CCMStudents->BlockAccess->CurrentValue) <> "") {
				switch ($CCMStudents->BlockAccess->CurrentValue) {
					case "y":
						$CCMStudents->BlockAccess->ViewValue = "Yes";
						break;
					case "n":
						$CCMStudents->BlockAccess->ViewValue = "No";
						break;
					default:
						$CCMStudents->BlockAccess->ViewValue = $CCMStudents->BlockAccess->CurrentValue;
				}
			} else {
				$CCMStudents->BlockAccess->ViewValue = NULL;
			}
			$CCMStudents->BlockAccess->CssStyle = "";
			$CCMStudents->BlockAccess->CssClass = "";
			$CCMStudents->BlockAccess->ViewCustomAttributes = "";

			// SABTACO
			$CCMStudents->SABTACO->ViewValue = $CCMStudents->SABTACO->CurrentValue;
			$CCMStudents->SABTACO->CssStyle = "";
			$CCMStudents->SABTACO->CssClass = "";
			$CCMStudents->SABTACO->ViewCustomAttributes = "";

			// CESA
			$CCMStudents->CESA->ViewValue = $CCMStudents->CESA->CurrentValue;
			$CCMStudents->CESA->CssStyle = "";
			$CCMStudents->CESA->CssClass = "";
			$CCMStudents->CESA->ViewCustomAttributes = "";

			// Archived
			if (strval($CCMStudents->Archived->CurrentValue) <> "") {
				switch ($CCMStudents->Archived->CurrentValue) {
					case "1":
						$CCMStudents->Archived->ViewValue = "Yes";
						break;
					case "0":
						$CCMStudents->Archived->ViewValue = "No";
						break;
					default:
						$CCMStudents->Archived->ViewValue = $CCMStudents->Archived->CurrentValue;
				}
			} else {
				$CCMStudents->Archived->ViewValue = NULL;
			}
			$CCMStudents->Archived->CssStyle = "";
			$CCMStudents->Archived->CssClass = "";
			$CCMStudents->Archived->ViewCustomAttributes = "";

			// SelectionCategory
			$CCMStudents->SelectionCategory->HrefValue = "";
			$CCMStudents->SelectionCategory->TooltipValue = "";

			// FirstName
			$CCMStudents->FirstName->HrefValue = "";
			$CCMStudents->FirstName->TooltipValue = "";

			// Surname
			$CCMStudents->Surname->HrefValue = "";
			$CCMStudents->Surname->TooltipValue = "";

			// KnownAs
			$CCMStudents->KnownAs->HrefValue = "";
			$CCMStudents->KnownAs->TooltipValue = "";

			// IDNumber
			$CCMStudents->IDNumber->HrefValue = "";
			$CCMStudents->IDNumber->TooltipValue = "";

			// Telephone
			$CCMStudents->Telephone->HrefValue = "";
			$CCMStudents->Telephone->TooltipValue = "";

			// Cellphone
			$CCMStudents->Cellphone->HrefValue = "";
			$CCMStudents->Cellphone->TooltipValue = "";

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

			// Organisation
			$CCMStudents->Organisation->HrefValue = "";
			$CCMStudents->Organisation->TooltipValue = "";

			// Province
			$CCMStudents->Province->HrefValue = "";
			$CCMStudents->Province->TooltipValue = "";

			// ProfessionalCouncil
			$CCMStudents->ProfessionalCouncil->HrefValue = "";
			$CCMStudents->ProfessionalCouncil->TooltipValue = "";

			// CategoryReg
			$CCMStudents->CategoryReg->HrefValue = "";
			$CCMStudents->CategoryReg->TooltipValue = "";

			// BelongsTo
			$CCMStudents->BelongsTo->HrefValue = "";
			$CCMStudents->BelongsTo->TooltipValue = "";
		}

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

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

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

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

	}

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

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

	}
}
?>