Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/ccmadmin/
Upload File :
Current File : /var/www/cesa.co.za/ccmadmin/CCMStudentslist.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_list = new cCCMStudents_list();
$Page =& $CCMStudents_list;

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

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

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

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

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

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

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

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

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

</script>
<?php } ?>
<?php if ($CCMStudents->Export == "") { ?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$CCMStudents_list->lTotalRecs = $CCMStudents->SelectRecordCount();
	} else {
		if ($rs = $CCMStudents_list->LoadRecordset())
			$CCMStudents_list->lTotalRecs = $rs->RecordCount();
	}
	$CCMStudents_list->lStartRec = 1;
	if ($CCMStudents_list->lDisplayRecs <= 0 || ($CCMStudents->Export <> "" && $CCMStudents->ExportAll)) // Display all records
		$CCMStudents_list->lDisplayRecs = $CCMStudents_list->lTotalRecs;
	if (!($CCMStudents->Export <> "" && $CCMStudents->ExportAll))
		$CCMStudents_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $CCMStudents_list->LoadRecordset($CCMStudents_list->lStartRec-1, $CCMStudents_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCMStudents->TableCaption() ?>
<?php if ($CCMStudents->Export == "" && $CCMStudents->CurrentAction == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $CCMStudents_list->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
&nbsp;&nbsp;<a href="<?php echo $CCMStudents_list->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
&nbsp;&nbsp;<a href="<?php echo $CCMStudents_list->ExportWordUrl ?>"><img src='images/exportdoc.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' width='16' height='16' border='0'></a>
&nbsp;&nbsp;<a name="emf_CCMStudents" id="emf_CCMStudents" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCMStudents',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCMStudentslist,sel:false});"><img src='images/exportemail.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
</span></p>
<?php if ($Security->CanSearch()) { ?>
<?php if ($CCMStudents->Export == "" && $CCMStudents->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCMStudents_list);" style="text-decoration: none;"><img id="CCMStudents_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("Search") ?></span><br>
<div id="CCMStudents_list_SearchPanel">
<form name="fCCMStudentslistsrch" id="fCCMStudentslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="CCMStudents">
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker">
			<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($CCMStudents->getSessionBasicSearchKeyword()) ?>">
			<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">&nbsp;
			<a href="<?php echo $CCMStudents_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>&nbsp;
			<a href="CCMStudentssrch.php"><?php echo $Language->Phrase("AdvancedSearch") ?></a>&nbsp;
		</span></td>
	</tr>
	<tr>
	<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($CCMStudents->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($CCMStudents->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($CCMStudents->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
	</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCMStudents_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCMStudents->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCMStudents->CurrentAction <> "gridadd" && $CCMStudents->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($CCMStudents_list->Pager)) $CCMStudents_list->Pager = new cPrevNextPager($CCMStudents_list->lStartRec, $CCMStudents_list->lDisplayRecs, $CCMStudents_list->lTotalRecs) ?>
<?php if ($CCMStudents_list->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCMStudents_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($CCMStudents_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCMStudents_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCMStudents_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($CCMStudents_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCMStudents_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $CCMStudents_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $CCMStudents_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $CCMStudents_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCMStudents_list->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCMStudents_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>&nbsp;&nbsp;
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCMStudentslist" id="fCCMStudentslist" class="ewForm" action="" method="post">
<div id="gmp_CCMStudents" class="ewGridMiddlePanel">
<?php if ($CCMStudents_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCMStudents->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

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

// Render list options (header, left)
$CCMStudents_list->ListOptions->Render("header", "left");
?>
<?php if ($CCMStudents->SelectionCategory->Visible) { // SelectionCategory ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->SelectionCategory) == "") { ?>
		<td><?php echo $CCMStudents->SelectionCategory->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->SelectionCategory) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->SelectionCategory->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->SelectionCategory->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->SelectionCategory->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->FirstName->Visible) { // FirstName ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->FirstName) == "") { ?>
		<td><?php echo $CCMStudents->FirstName->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->FirstName) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->FirstName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->FirstName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->FirstName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->Surname->Visible) { // Surname ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->Surname) == "") { ?>
		<td><?php echo $CCMStudents->Surname->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->Surname) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->Surname->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->Surname->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->Surname->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->KnownAs->Visible) { // KnownAs ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->KnownAs) == "") { ?>
		<td><?php echo $CCMStudents->KnownAs->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->KnownAs) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->KnownAs->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->KnownAs->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->KnownAs->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->IDNumber->Visible) { // IDNumber ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->IDNumber) == "") { ?>
		<td><?php echo $CCMStudents->IDNumber->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->IDNumber) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->IDNumber->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->IDNumber->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->IDNumber->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->Telephone->Visible) { // Telephone ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->Telephone) == "") { ?>
		<td><?php echo $CCMStudents->Telephone->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->Telephone) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->Telephone->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->Telephone->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->Telephone->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->Cellphone->Visible) { // Cellphone ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->Cellphone) == "") { ?>
		<td><?php echo $CCMStudents->Cellphone->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->Cellphone) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->Cellphone->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->Cellphone->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->Cellphone->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->EmailAddress->Visible) { // EmailAddress ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->EmailAddress) == "") { ?>
		<td><?php echo $CCMStudents->EmailAddress->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->EmailAddress) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->EmailAddress->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->EmailAddress->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->EmailAddress->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->Organisation->Visible) { // Organisation ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->Organisation) == "") { ?>
		<td><?php echo $CCMStudents->Organisation->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->Organisation) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->Organisation->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->Organisation->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->Organisation->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->Province->Visible) { // Province ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->Province) == "") { ?>
		<td><?php echo $CCMStudents->Province->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->Province) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->Province->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCMStudents->Province->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->Province->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->ProfessionalCouncil->Visible) { // ProfessionalCouncil ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->ProfessionalCouncil) == "") { ?>
		<td><?php echo $CCMStudents->ProfessionalCouncil->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->ProfessionalCouncil) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->ProfessionalCouncil->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->ProfessionalCouncil->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->ProfessionalCouncil->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->CategoryReg->Visible) { // CategoryReg ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->CategoryReg) == "") { ?>
		<td><?php echo $CCMStudents->CategoryReg->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->CategoryReg) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->CategoryReg->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->CategoryReg->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->CategoryReg->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCMStudents->BelongsTo->Visible) { // BelongsTo ?>
	<?php if ($CCMStudents->SortUrl($CCMStudents->BelongsTo) == "") { ?>
		<td><?php echo $CCMStudents->BelongsTo->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMStudents->SortUrl($CCMStudents->BelongsTo) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMStudents->BelongsTo->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMStudents->BelongsTo->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMStudents->BelongsTo->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php

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

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

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

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

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

// Render list options (body, left)
$CCMStudents_list->ListOptions->Render("body", "left");
?>
	<?php if ($CCMStudents->SelectionCategory->Visible) { // SelectionCategory ?>
		<td<?php echo $CCMStudents->SelectionCategory->CellAttributes() ?>>
<div<?php echo $CCMStudents->SelectionCategory->ViewAttributes() ?>><?php echo $CCMStudents->SelectionCategory->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->FirstName->Visible) { // FirstName ?>
		<td<?php echo $CCMStudents->FirstName->CellAttributes() ?>>
<div<?php echo $CCMStudents->FirstName->ViewAttributes() ?>><?php echo $CCMStudents->FirstName->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->Surname->Visible) { // Surname ?>
		<td<?php echo $CCMStudents->Surname->CellAttributes() ?>>
<div<?php echo $CCMStudents->Surname->ViewAttributes() ?>><?php echo $CCMStudents->Surname->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->KnownAs->Visible) { // KnownAs ?>
		<td<?php echo $CCMStudents->KnownAs->CellAttributes() ?>>
<div<?php echo $CCMStudents->KnownAs->ViewAttributes() ?>><?php echo $CCMStudents->KnownAs->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->IDNumber->Visible) { // IDNumber ?>
		<td<?php echo $CCMStudents->IDNumber->CellAttributes() ?>>
<div<?php echo $CCMStudents->IDNumber->ViewAttributes() ?>><?php echo $CCMStudents->IDNumber->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->Telephone->Visible) { // Telephone ?>
		<td<?php echo $CCMStudents->Telephone->CellAttributes() ?>>
<div<?php echo $CCMStudents->Telephone->ViewAttributes() ?>><?php echo $CCMStudents->Telephone->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->Cellphone->Visible) { // Cellphone ?>
		<td<?php echo $CCMStudents->Cellphone->CellAttributes() ?>>
<div<?php echo $CCMStudents->Cellphone->ViewAttributes() ?>><?php echo $CCMStudents->Cellphone->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->EmailAddress->Visible) { // EmailAddress ?>
		<td<?php echo $CCMStudents->EmailAddress->CellAttributes() ?>>
<div<?php echo $CCMStudents->EmailAddress->ViewAttributes() ?>><?php echo $CCMStudents->EmailAddress->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->Organisation->Visible) { // Organisation ?>
		<td<?php echo $CCMStudents->Organisation->CellAttributes() ?>>
<div<?php echo $CCMStudents->Organisation->ViewAttributes() ?>><?php echo $CCMStudents->Organisation->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->Province->Visible) { // Province ?>
		<td<?php echo $CCMStudents->Province->CellAttributes() ?>>
<div<?php echo $CCMStudents->Province->ViewAttributes() ?>><?php echo $CCMStudents->Province->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->ProfessionalCouncil->Visible) { // ProfessionalCouncil ?>
		<td<?php echo $CCMStudents->ProfessionalCouncil->CellAttributes() ?>>
<div<?php echo $CCMStudents->ProfessionalCouncil->ViewAttributes() ?>><?php echo $CCMStudents->ProfessionalCouncil->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->CategoryReg->Visible) { // CategoryReg ?>
		<td<?php echo $CCMStudents->CategoryReg->CellAttributes() ?>>
<div<?php echo $CCMStudents->CategoryReg->ViewAttributes() ?>><?php echo $CCMStudents->CategoryReg->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($CCMStudents->BelongsTo->Visible) { // BelongsTo ?>
		<td<?php echo $CCMStudents->BelongsTo->CellAttributes() ?>>
<div<?php echo $CCMStudents->BelongsTo->ViewAttributes() ?>><?php echo $CCMStudents->BelongsTo->ListViewValue() ?></div>
</td>
	<?php } ?>
<?php

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

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($CCMStudents_list->lTotalRecs > 0) { ?>
<?php if ($CCMStudents->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCMStudents->CurrentAction <> "gridadd" && $CCMStudents->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($CCMStudents_list->Pager)) $CCMStudents_list->Pager = new cPrevNextPager($CCMStudents_list->lStartRec, $CCMStudents_list->lDisplayRecs, $CCMStudents_list->lTotalRecs) ?>
<?php if ($CCMStudents_list->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCMStudents_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($CCMStudents_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCMStudents_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCMStudents_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($CCMStudents_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCMStudents_list->PageUrl() ?>start=<?php echo $CCMStudents_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCMStudents_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $CCMStudents_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $CCMStudents_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $CCMStudents_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCMStudents_list->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<?php //if ($CCMStudents_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCMStudents_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>&nbsp;&nbsp;
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCMStudents->Export == "" && $CCMStudents->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCMStudents->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCMStudents_list {

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

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

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

	// 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_list() {
		global $conn, $Language;

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

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

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

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

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

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

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

		// Open connection
		$conn = ew_Connect();

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

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $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->CanList()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$CCMStudents->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$CCMStudents->Export = $_POST["exporttype"];
		} else {
			$CCMStudents->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $CCMStudents->Export; // Get export parameter, used in header
		$gsExportFile = $CCMStudents->TableVar; // Get export file, used in header
		if ($CCMStudents->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($CCMStudents->Export == "word") {
			header('Content-Type: application/vnd.ms-word');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
		}

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}

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

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

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

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

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

			// Get basic search values
			$this->LoadBasicSearchValues();

			// Get and validate search values for advanced search
			$this->LoadSearchValues(); // Get search values
			if (!$this->ValidateSearch())
				$this->setMessage($gsSearchError);

			// Restore search parms from Session
			$this->RestoreSearchParms();

			// Call Recordset SearchValidated event
			$CCMStudents->Recordset_SearchValidated();

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

			// Get basic search criteria
			if ($gsSearchError == "")
				$sSrchBasic = $this->BasicSearchWhere();

			// Get search criteria for advanced search
			if ($gsSearchError == "")
				$sSrchAdvanced = $this->AdvancedSearchWhere();
		}

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

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

		// Build search criteria
		if ($sSrchAdvanced <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
		if ($sSrchBasic <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;

		// Call Recordset_Searching event
		$CCMStudents->Recordset_Searching($this->sSrchWhere);

		// Save search criteria
		if ($this->sSrchWhere <> "") {
			if ($sSrchBasic == "")
				$this->ResetBasicSearchParms();
			if ($sSrchAdvanced == "")
				$this->ResetAdvancedSearchParms();
			$CCMStudents->setSearchWhere($this->sSrchWhere); // Save to Session
			if (!$this->RestoreSearch) {
				$this->lStartRec = 1; // Reset start record counter
				$CCMStudents->setStartRecordNumber($this->lStartRec);
			}
		} else {
			$this->sSrchWhere = $CCMStudents->getSearchWhere();
		}

		// Build filter
		$sFilter = "";
		if (!$Security->CanList())
			$sFilter = "(0=1)"; // Filter all records
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

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

		// Export data only
		if (in_array($CCMStudents->Export, array("html","word","excel","xml","csv","email"))) {
			$this->ExportData();
			if ($CCMStudents->Export <> "email")
				$this->Page_Terminate(); // Terminate response
			exit();
		}
	}

	// Advanced search WHERE clause based on QueryString
	function AdvancedSearchWhere() {
		global $Security, $CCMStudents;
		$sWhere = "";
		if (!$Security->CanSearch()) return "";
		$this->BuildSearchSql($sWhere, $CCMStudents->CCMStudentID, FALSE); // CCMStudentID
		$this->BuildSearchSql($sWhere, $CCMStudents->SelectionCategory, FALSE); // SelectionCategory
		$this->BuildSearchSql($sWhere, $CCMStudents->Title, FALSE); // Title
		$this->BuildSearchSql($sWhere, $CCMStudents->Initials, FALSE); // Initials
		$this->BuildSearchSql($sWhere, $CCMStudents->FirstName, FALSE); // FirstName
		$this->BuildSearchSql($sWhere, $CCMStudents->Surname, FALSE); // Surname
		$this->BuildSearchSql($sWhere, $CCMStudents->KnownAs, FALSE); // KnownAs
		$this->BuildSearchSql($sWhere, $CCMStudents->IDNumber, FALSE); // IDNumber
		$this->BuildSearchSql($sWhere, $CCMStudents->Telephone, FALSE); // Telephone
		$this->BuildSearchSql($sWhere, $CCMStudents->Cellphone, FALSE); // Cellphone
		$this->BuildSearchSql($sWhere, $CCMStudents->EmailAddress, FALSE); // EmailAddress
		$this->BuildSearchSql($sWhere, $CCMStudents->WorkAddress, FALSE); // WorkAddress
		$this->BuildSearchSql($sWhere, $CCMStudents->PostalAddress, FALSE); // PostalAddress
		$this->BuildSearchSql($sWhere, $CCMStudents->Department, FALSE); // Department
		$this->BuildSearchSql($sWhere, $CCMStudents->Organisation, FALSE); // Organisation
		$this->BuildSearchSql($sWhere, $CCMStudents->VATNo, FALSE); // VATNo
		$this->BuildSearchSql($sWhere, $CCMStudents->JobTitle, FALSE); // JobTitle
		$this->BuildSearchSql($sWhere, $CCMStudents->DateofBirth, FALSE); // DateofBirth
		$this->BuildSearchSql($sWhere, $CCMStudents->PlaceofBirth, FALSE); // PlaceofBirth
		$this->BuildSearchSql($sWhere, $CCMStudents->CountryofBirth, FALSE); // CountryofBirth
		$this->BuildSearchSql($sWhere, $CCMStudents->Province, FALSE); // Province
		$this->BuildSearchSql($sWhere, $CCMStudents->MaleorFemale, FALSE); // MaleorFemale
		$this->BuildSearchSql($sWhere, $CCMStudents->RaceGroup, FALSE); // RaceGroup
		$this->BuildSearchSql($sWhere, $CCMStudents->Disability, FALSE); // Disability
		$this->BuildSearchSql($sWhere, $CCMStudents->DisabilityNature, FALSE); // DisabilityNature
		$this->BuildSearchSql($sWhere, $CCMStudents->ProfessionalCouncil, FALSE); // ProfessionalCouncil
		$this->BuildSearchSql($sWhere, $CCMStudents->CategoryReg, FALSE); // CategoryReg
		$this->BuildSearchSql($sWhere, $CCMStudents->CouncilRegNumber, FALSE); // CouncilRegNumber
		$this->BuildSearchSql($sWhere, $CCMStudents->LengthCandidateReg, FALSE); // LengthCandidateReg
		$this->BuildSearchSql($sWhere, $CCMStudents->YearsToProfReg, FALSE); // YearsToProfReg
		$this->BuildSearchSql($sWhere, $CCMStudents->FirstJobStart, FALSE); // FirstJobStart
		$this->BuildSearchSql($sWhere, $CCMStudents->VolAssociations, FALSE); // VolAssociations
		$this->BuildSearchSql($sWhere, $CCMStudents->BelongsTo, FALSE); // BelongsTo
		$this->BuildSearchSql($sWhere, $CCMStudents->CESA_SABTACO_MemNum, FALSE); // CESA_SABTACO_MemNum
		$this->BuildSearchSql($sWhere, $CCMStudents->AreaDiscipline, FALSE); // AreaDiscipline
		$this->BuildSearchSql($sWhere, $CCMStudents->AreaSubDiscipline, FALSE); // AreaSubDiscipline
		$this->BuildSearchSql($sWhere, $CCMStudents->Salary, FALSE); // Salary
		$this->BuildSearchSql($sWhere, $CCMStudents->BankAccountName, FALSE); // BankAccountName
		$this->BuildSearchSql($sWhere, $CCMStudents->BankAccountBank, FALSE); // BankAccountBank
		$this->BuildSearchSql($sWhere, $CCMStudents->BankAccountBranch, FALSE); // BankAccountBranch
		$this->BuildSearchSql($sWhere, $CCMStudents->BankAccountNo, FALSE); // BankAccountNo
		$this->BuildSearchSql($sWhere, $CCMStudents->Funding, FALSE); // Funding
		$this->BuildSearchSql($sWhere, $CCMStudents->CWDTP, FALSE); // CWDTP
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByName, FALSE); // BookedByName
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByDesignation, FALSE); // BookedByDesignation
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByTelNo, FALSE); // BookedByTelNo
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByFaxNo, FALSE); // BookedByFaxNo
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByCellNo, FALSE); // BookedByCellNo
		$this->BuildSearchSql($sWhere, $CCMStudents->BookedByEmail, FALSE); // BookedByEmail
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorID, FALSE); // MentorID
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorName, FALSE); // MentorName
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorDesig, FALSE); // MentorDesig
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorProfRegNo, FALSE); // MentorProfRegNo
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorRegNo, FALSE); // MentorRegNo
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorTel, FALSE); // MentorTel
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorCell, FALSE); // MentorCell
		$this->BuildSearchSql($sWhere, $CCMStudents->MentorEmail, FALSE); // MentorEmail
		$this->BuildSearchSql($sWhere, $CCMStudents->EmployerID, FALSE); // EmployerID
		$this->BuildSearchSql($sWhere, $CCMStudents->HRManagerName, FALSE); // HRManagerName
		$this->BuildSearchSql($sWhere, $CCMStudents->HRManagerDesignation, FALSE); // HRManagerDesignation
		$this->BuildSearchSql($sWhere, $CCMStudents->HRManagerTelNo, FALSE); // HRManagerTelNo
		$this->BuildSearchSql($sWhere, $CCMStudents->HRManagerCellNo, FALSE); // HRManagerCellNo
		$this->BuildSearchSql($sWhere, $CCMStudents->HRManagerEmail, FALSE); // HRManagerEmail
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorName, FALSE); // SupervisorName
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorDesig, FALSE); // SupervisorDesig
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorProfRegNo, FALSE); // SupervisorProfRegNo
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorTelNo, FALSE); // SupervisorTelNo
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorCellNo, FALSE); // SupervisorCellNo
		$this->BuildSearchSql($sWhere, $CCMStudents->SupervisorEmail, FALSE); // SupervisorEmail
		$this->BuildSearchSql($sWhere, $CCMStudents->EducationalInst, FALSE); // EducationalInst
		$this->BuildSearchSql($sWhere, $CCMStudents->Qualifications, FALSE); // Qualifications
		$this->BuildSearchSql($sWhere, $CCMStudents->DateFinalExam, FALSE); // DateFinalExam
		$this->BuildSearchSql($sWhere, $CCMStudents->StudentNumber, FALSE); // StudentNumber
		$this->BuildSearchSql($sWhere, $CCMStudents->WebUsername, FALSE); // WebUsername
		$this->BuildSearchSql($sWhere, $CCMStudents->WebPassword, FALSE); // WebPassword
		$this->BuildSearchSql($sWhere, $CCMStudents->BlockAccess, FALSE); // BlockAccess
		$this->BuildSearchSql($sWhere, $CCMStudents->Archived, FALSE); // Archived

		// Set up search parm
		if ($sWhere <> "") {
			$this->SetSearchParm($CCMStudents->CCMStudentID); // CCMStudentID
			$this->SetSearchParm($CCMStudents->SelectionCategory); // SelectionCategory
			$this->SetSearchParm($CCMStudents->Title); // Title
			$this->SetSearchParm($CCMStudents->Initials); // Initials
			$this->SetSearchParm($CCMStudents->FirstName); // FirstName
			$this->SetSearchParm($CCMStudents->Surname); // Surname
			$this->SetSearchParm($CCMStudents->KnownAs); // KnownAs
			$this->SetSearchParm($CCMStudents->IDNumber); // IDNumber
			$this->SetSearchParm($CCMStudents->Telephone); // Telephone
			$this->SetSearchParm($CCMStudents->Cellphone); // Cellphone
			$this->SetSearchParm($CCMStudents->EmailAddress); // EmailAddress
			$this->SetSearchParm($CCMStudents->WorkAddress); // WorkAddress
			$this->SetSearchParm($CCMStudents->PostalAddress); // PostalAddress
			$this->SetSearchParm($CCMStudents->Department); // Department
			$this->SetSearchParm($CCMStudents->Organisation); // Organisation
			$this->SetSearchParm($CCMStudents->VATNo); // VATNo
			$this->SetSearchParm($CCMStudents->JobTitle); // JobTitle
			$this->SetSearchParm($CCMStudents->DateofBirth); // DateofBirth
			$this->SetSearchParm($CCMStudents->PlaceofBirth); // PlaceofBirth
			$this->SetSearchParm($CCMStudents->CountryofBirth); // CountryofBirth
			$this->SetSearchParm($CCMStudents->Province); // Province
			$this->SetSearchParm($CCMStudents->MaleorFemale); // MaleorFemale
			$this->SetSearchParm($CCMStudents->RaceGroup); // RaceGroup
			$this->SetSearchParm($CCMStudents->Disability); // Disability
			$this->SetSearchParm($CCMStudents->DisabilityNature); // DisabilityNature
			$this->SetSearchParm($CCMStudents->ProfessionalCouncil); // ProfessionalCouncil
			$this->SetSearchParm($CCMStudents->CategoryReg); // CategoryReg
			$this->SetSearchParm($CCMStudents->CouncilRegNumber); // CouncilRegNumber
			$this->SetSearchParm($CCMStudents->LengthCandidateReg); // LengthCandidateReg
			$this->SetSearchParm($CCMStudents->YearsToProfReg); // YearsToProfReg
			$this->SetSearchParm($CCMStudents->FirstJobStart); // FirstJobStart
			$this->SetSearchParm($CCMStudents->VolAssociations); // VolAssociations
			$this->SetSearchParm($CCMStudents->BelongsTo); // BelongsTo
			$this->SetSearchParm($CCMStudents->CESA_SABTACO_MemNum); // CESA_SABTACO_MemNum
			$this->SetSearchParm($CCMStudents->AreaDiscipline); // AreaDiscipline
			$this->SetSearchParm($CCMStudents->AreaSubDiscipline); // AreaSubDiscipline
			$this->SetSearchParm($CCMStudents->Salary); // Salary
			$this->SetSearchParm($CCMStudents->BankAccountName); // BankAccountName
			$this->SetSearchParm($CCMStudents->BankAccountBank); // BankAccountBank
			$this->SetSearchParm($CCMStudents->BankAccountBranch); // BankAccountBranch
			$this->SetSearchParm($CCMStudents->BankAccountNo); // BankAccountNo
			$this->SetSearchParm($CCMStudents->Funding); // Funding
			$this->SetSearchParm($CCMStudents->CWDTP); // CWDTP
			$this->SetSearchParm($CCMStudents->BookedByName); // BookedByName
			$this->SetSearchParm($CCMStudents->BookedByDesignation); // BookedByDesignation
			$this->SetSearchParm($CCMStudents->BookedByTelNo); // BookedByTelNo
			$this->SetSearchParm($CCMStudents->BookedByFaxNo); // BookedByFaxNo
			$this->SetSearchParm($CCMStudents->BookedByCellNo); // BookedByCellNo
			$this->SetSearchParm($CCMStudents->BookedByEmail); // BookedByEmail
			$this->SetSearchParm($CCMStudents->MentorID); // MentorID
			$this->SetSearchParm($CCMStudents->MentorName); // MentorName
			$this->SetSearchParm($CCMStudents->MentorDesig); // MentorDesig
			$this->SetSearchParm($CCMStudents->MentorProfRegNo); // MentorProfRegNo
			$this->SetSearchParm($CCMStudents->MentorRegNo); // MentorRegNo
			$this->SetSearchParm($CCMStudents->MentorTel); // MentorTel
			$this->SetSearchParm($CCMStudents->MentorCell); // MentorCell
			$this->SetSearchParm($CCMStudents->MentorEmail); // MentorEmail
			$this->SetSearchParm($CCMStudents->EmployerID); // EmployerID
			$this->SetSearchParm($CCMStudents->HRManagerName); // HRManagerName
			$this->SetSearchParm($CCMStudents->HRManagerDesignation); // HRManagerDesignation
			$this->SetSearchParm($CCMStudents->HRManagerTelNo); // HRManagerTelNo
			$this->SetSearchParm($CCMStudents->HRManagerCellNo); // HRManagerCellNo
			$this->SetSearchParm($CCMStudents->HRManagerEmail); // HRManagerEmail
			$this->SetSearchParm($CCMStudents->SupervisorName); // SupervisorName
			$this->SetSearchParm($CCMStudents->SupervisorDesig); // SupervisorDesig
			$this->SetSearchParm($CCMStudents->SupervisorProfRegNo); // SupervisorProfRegNo
			$this->SetSearchParm($CCMStudents->SupervisorTelNo); // SupervisorTelNo
			$this->SetSearchParm($CCMStudents->SupervisorCellNo); // SupervisorCellNo
			$this->SetSearchParm($CCMStudents->SupervisorEmail); // SupervisorEmail
			$this->SetSearchParm($CCMStudents->EducationalInst); // EducationalInst
			$this->SetSearchParm($CCMStudents->Qualifications); // Qualifications
			$this->SetSearchParm($CCMStudents->DateFinalExam); // DateFinalExam
			$this->SetSearchParm($CCMStudents->StudentNumber); // StudentNumber
			$this->SetSearchParm($CCMStudents->WebUsername); // WebUsername
			$this->SetSearchParm($CCMStudents->WebPassword); // WebPassword
			$this->SetSearchParm($CCMStudents->BlockAccess); // BlockAccess
			$this->SetSearchParm($CCMStudents->Archived); // Archived
		}
		return $sWhere;
	}

	// Build search SQL
	function BuildSearchSql(&$Where, &$Fld, $MultiValue) {
		$FldParm = substr($Fld->FldVar, 2);		
		$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
		$FldOpr = $Fld->AdvancedSearch->SearchOperator; // @$_GET["z_$FldParm"]
		$FldCond = $Fld->AdvancedSearch->SearchCondition; // @$_GET["v_$FldParm"]
		$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
		$FldOpr2 = $Fld->AdvancedSearch->SearchOperator2; // @$_GET["w_$FldParm"]
		$sWrk = "";

		//$FldVal = ew_StripSlashes($FldVal);
		if (is_array($FldVal)) $FldVal = implode(",", $FldVal);

		//$FldVal2 = ew_StripSlashes($FldVal2);
		if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
		$FldOpr = strtoupper(trim($FldOpr));
		if ($FldOpr == "") $FldOpr = "=";
		$FldOpr2 = strtoupper(trim($FldOpr2));
		if ($FldOpr2 == "") $FldOpr2 = "=";
		if (EW_SEARCH_MULTI_VALUE_OPTION == 1 || $FldOpr <> "LIKE" ||
			($FldOpr2 <> "LIKE" && $FldVal2 <> ""))
			$MultiValue = FALSE;
		if ($MultiValue) {
			$sWrk1 = ($FldVal <> "") ? ew_GetMultiSearchSql($Fld, $FldVal) : ""; // Field value 1
			$sWrk2 = ($FldVal2 <> "") ? ew_GetMultiSearchSql($Fld, $FldVal2) : ""; // Field value 2
			$sWrk = $sWrk1; // Build final SQL
			if ($sWrk2 <> "")
				$sWrk = ($sWrk <> "") ? "($sWrk) $FldCond ($sWrk2)" : $sWrk2;
		} else {
			$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
			$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
			$sWrk = ew_GetSearchSql($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2);
		}
		if ($sWrk <> "") {
			if ($Where <> "") $Where .= " AND ";
			$Where .= "(" . $sWrk . ")";
		}
	}

	// Set search parameters
	function SetSearchParm(&$Fld) {
		global $CCMStudents;
		$FldParm = substr($Fld->FldVar, 2);
		$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
		$FldVal = ew_StripSlashes($FldVal);
		if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
		$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
		$FldVal2 = ew_StripSlashes($FldVal2);
		if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
		$CCMStudents->setAdvancedSearch("x_$FldParm", $FldVal);
		$CCMStudents->setAdvancedSearch("z_$FldParm", $Fld->AdvancedSearch->SearchOperator); // @$_GET["z_$FldParm"]
		$CCMStudents->setAdvancedSearch("v_$FldParm", $Fld->AdvancedSearch->SearchCondition); // @$_GET["v_$FldParm"]
		$CCMStudents->setAdvancedSearch("y_$FldParm", $FldVal2);
		$CCMStudents->setAdvancedSearch("w_$FldParm", $Fld->AdvancedSearch->SearchOperator2); // @$_GET["w_$FldParm"]
	}

	// Get search parameters
	function GetSearchParm(&$Fld) {
		global $CCMStudents;
		$FldParm = substr($Fld->FldVar, 2);
		$Fld->AdvancedSearch->SearchValue = $CCMStudents->GetAdvancedSearch("x_$FldParm");
		$Fld->AdvancedSearch->SearchOperator = $CCMStudents->GetAdvancedSearch("z_$FldParm");
		$Fld->AdvancedSearch->SearchCondition = $CCMStudents->GetAdvancedSearch("v_$FldParm");
		$Fld->AdvancedSearch->SearchValue2 = $CCMStudents->GetAdvancedSearch("y_$FldParm");
		$Fld->AdvancedSearch->SearchOperator2 = $CCMStudents->GetAdvancedSearch("w_$FldParm");
	}

	// Convert search value
	function ConvertSearchValue(&$Fld, $FldVal) {
		$Value = $FldVal;
		if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
			if ($FldVal <> "") $Value = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
		} elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
			if ($FldVal <> "") $Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
		}
		return $Value;
	}

	// Return basic search SQL
	function BasicSearchSQL($Keyword) {
		global $CCMStudents;
		$sKeyword = ew_AdjustSql($Keyword);
		$sWhere = "";
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SelectionCategory, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Title, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Initials, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->FirstName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Surname, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->KnownAs, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->IDNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Telephone, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Cellphone, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->EmailAddress, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->WorkAddress, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->PostalAddress, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Department, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Organisation, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->VATNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->JobTitle, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->PlaceofBirth, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CountryofBirth, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Province, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MaleorFemale, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->RaceGroup, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Disability, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->DisabilityNature, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->DisabilityCertificate, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->ProfessionalCouncil, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CategoryReg, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CouncilRegNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->LengthCandidateReg, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->YearsToProfReg, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->FirstJobStart, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->VolAssociations, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BelongsTo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CESA_SABTACO_MemNum, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->AreaDiscipline, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->AreaSubDiscipline, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Salary, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Payslip, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BankAccountName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BankAccountBank, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BankAccountBranch, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BankAccountNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BankAccountProof, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Funding, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CWDTP, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByDesignation, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByTelNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByFaxNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByCellNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BookedByEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorDesig, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorProfRegNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorRegNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorTel, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorCell, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->HRManagerName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->HRManagerDesignation, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->HRManagerTelNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->HRManagerCellNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->HRManagerEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorDesig, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorProfRegNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorTelNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorCellNo, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SupervisorEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->EducationalInst, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Qualifications, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->DateFinalExam, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->IDFile, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CVFile, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->QualCertificate1, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->QualCertificate2, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->QualCertificate3, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->MentorUndertaking, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CandUUndertaking, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->CompanyCandidatePolicy, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->ResidenceProof, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->SignedAppForm, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->Photograph, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->StudentNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->WebUsername, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->WebPassword, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCMStudents->BlockAccess, $Keyword);
		return $sWhere;
	}

	// Build basic search SQL
	function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
		$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($lFldDataType == EW_DATATYPE_NUMBER) {
			$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
		} else {
			$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
		}
		if ($Where <> "") $Where .= " OR ";
		$Where .= $sWrk;
	}

	// Return basic search WHERE clause based on search keyword and type
	function BasicSearchWhere() {
		global $Security, $CCMStudents;
		$sSearchStr = "";
		if (!$Security->CanSearch()) return "";
		$sSearchKeyword = $CCMStudents->BasicSearchKeyword;
		$sSearchType = $CCMStudents->BasicSearchType;
		if ($sSearchKeyword <> "") {
			$sSearch = trim($sSearchKeyword);
			if ($sSearchType <> "") {
				while (strpos($sSearch, "  ") !== FALSE)
					$sSearch = str_replace("  ", " ", $sSearch);
				$arKeyword = explode(" ", trim($sSearch));
				foreach ($arKeyword as $sKeyword) {
					if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
					$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
				}
			} else {
				$sSearchStr = $this->BasicSearchSQL($sSearch);
			}
		}
		if ($sSearchKeyword <> "") {
			$CCMStudents->setSessionBasicSearchKeyword($sSearchKeyword);
			$CCMStudents->setSessionBasicSearchType($sSearchType);
		}
		return $sSearchStr;
	}

	// Clear all search parameters
	function ResetSearchParms() {
		global $CCMStudents;

		// Clear search WHERE clause
		$this->sSrchWhere = "";
		$CCMStudents->setSearchWhere($this->sSrchWhere);

		// Clear basic search parameters
		$this->ResetBasicSearchParms();

		// Clear advanced search parameters
		$this->ResetAdvancedSearchParms();
	}

	// Clear all basic search parameters
	function ResetBasicSearchParms() {
		global $CCMStudents;
		$CCMStudents->setSessionBasicSearchKeyword("");
		$CCMStudents->setSessionBasicSearchType("");
	}

	// Clear all advanced search parameters
	function ResetAdvancedSearchParms() {
		global $CCMStudents;
		$CCMStudents->setAdvancedSearch("x_CCMStudentID", "");
		$CCMStudents->setAdvancedSearch("x_SelectionCategory", "");
		$CCMStudents->setAdvancedSearch("x_Title", "");
		$CCMStudents->setAdvancedSearch("x_Initials", "");
		$CCMStudents->setAdvancedSearch("x_FirstName", "");
		$CCMStudents->setAdvancedSearch("x_Surname", "");
		$CCMStudents->setAdvancedSearch("x_KnownAs", "");
		$CCMStudents->setAdvancedSearch("x_IDNumber", "");
		$CCMStudents->setAdvancedSearch("x_Telephone", "");
		$CCMStudents->setAdvancedSearch("x_Cellphone", "");
		$CCMStudents->setAdvancedSearch("x_EmailAddress", "");
		$CCMStudents->setAdvancedSearch("x_WorkAddress", "");
		$CCMStudents->setAdvancedSearch("x_PostalAddress", "");
		$CCMStudents->setAdvancedSearch("x_Department", "");
		$CCMStudents->setAdvancedSearch("x_Organisation", "");
		$CCMStudents->setAdvancedSearch("x_VATNo", "");
		$CCMStudents->setAdvancedSearch("x_JobTitle", "");
		$CCMStudents->setAdvancedSearch("x_DateofBirth", "");
		$CCMStudents->setAdvancedSearch("x_PlaceofBirth", "");
		$CCMStudents->setAdvancedSearch("x_CountryofBirth", "");
		$CCMStudents->setAdvancedSearch("x_Province", "");
		$CCMStudents->setAdvancedSearch("x_MaleorFemale", "");
		$CCMStudents->setAdvancedSearch("x_RaceGroup", "");
		$CCMStudents->setAdvancedSearch("x_Disability", "");
		$CCMStudents->setAdvancedSearch("x_DisabilityNature", "");
		$CCMStudents->setAdvancedSearch("x_ProfessionalCouncil", "");
		$CCMStudents->setAdvancedSearch("x_CategoryReg", "");
		$CCMStudents->setAdvancedSearch("x_CouncilRegNumber", "");
		$CCMStudents->setAdvancedSearch("x_LengthCandidateReg", "");
		$CCMStudents->setAdvancedSearch("x_YearsToProfReg", "");
		$CCMStudents->setAdvancedSearch("x_FirstJobStart", "");
		$CCMStudents->setAdvancedSearch("x_VolAssociations", "");
		$CCMStudents->setAdvancedSearch("x_BelongsTo", "");
		$CCMStudents->setAdvancedSearch("x_CESA_SABTACO_MemNum", "");
		$CCMStudents->setAdvancedSearch("x_AreaDiscipline", "");
		$CCMStudents->setAdvancedSearch("x_AreaSubDiscipline", "");
		$CCMStudents->setAdvancedSearch("x_Salary", "");
		$CCMStudents->setAdvancedSearch("x_BankAccountName", "");
		$CCMStudents->setAdvancedSearch("x_BankAccountBank", "");
		$CCMStudents->setAdvancedSearch("x_BankAccountBranch", "");
		$CCMStudents->setAdvancedSearch("x_BankAccountNo", "");
		$CCMStudents->setAdvancedSearch("x_Funding", "");
		$CCMStudents->setAdvancedSearch("x_CWDTP", "");
		$CCMStudents->setAdvancedSearch("x_BookedByName", "");
		$CCMStudents->setAdvancedSearch("x_BookedByDesignation", "");
		$CCMStudents->setAdvancedSearch("x_BookedByTelNo", "");
		$CCMStudents->setAdvancedSearch("x_BookedByFaxNo", "");
		$CCMStudents->setAdvancedSearch("x_BookedByCellNo", "");
		$CCMStudents->setAdvancedSearch("x_BookedByEmail", "");
		$CCMStudents->setAdvancedSearch("x_MentorID", "");
		$CCMStudents->setAdvancedSearch("x_MentorName", "");
		$CCMStudents->setAdvancedSearch("x_MentorDesig", "");
		$CCMStudents->setAdvancedSearch("x_MentorProfRegNo", "");
		$CCMStudents->setAdvancedSearch("x_MentorRegNo", "");
		$CCMStudents->setAdvancedSearch("x_MentorTel", "");
		$CCMStudents->setAdvancedSearch("x_MentorCell", "");
		$CCMStudents->setAdvancedSearch("x_MentorEmail", "");
		$CCMStudents->setAdvancedSearch("x_EmployerID", "");
		$CCMStudents->setAdvancedSearch("x_HRManagerName", "");
		$CCMStudents->setAdvancedSearch("x_HRManagerDesignation", "");
		$CCMStudents->setAdvancedSearch("x_HRManagerTelNo", "");
		$CCMStudents->setAdvancedSearch("x_HRManagerCellNo", "");
		$CCMStudents->setAdvancedSearch("x_HRManagerEmail", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorName", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorDesig", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorProfRegNo", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorTelNo", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorCellNo", "");
		$CCMStudents->setAdvancedSearch("x_SupervisorEmail", "");
		$CCMStudents->setAdvancedSearch("x_EducationalInst", "");
		$CCMStudents->setAdvancedSearch("x_Qualifications", "");
		$CCMStudents->setAdvancedSearch("x_DateFinalExam", "");
		$CCMStudents->setAdvancedSearch("x_StudentNumber", "");
		$CCMStudents->setAdvancedSearch("x_WebUsername", "");
		$CCMStudents->setAdvancedSearch("x_WebPassword", "");
		$CCMStudents->setAdvancedSearch("x_BlockAccess", "");
		$CCMStudents->setAdvancedSearch("x_Archived", "");
	}

	// Restore all search parameters
	function RestoreSearchParms() {
		global $CCMStudents;
		$bRestore = TRUE;
		if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
		if (@$_GET["x_CCMStudentID"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SelectionCategory"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Title"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Initials"] <> "") $bRestore = FALSE;
		if (@$_GET["x_FirstName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Surname"] <> "") $bRestore = FALSE;
		if (@$_GET["x_KnownAs"] <> "") $bRestore = FALSE;
		if (@$_GET["x_IDNumber"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Telephone"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Cellphone"] <> "") $bRestore = FALSE;
		if (@$_GET["x_EmailAddress"] <> "") $bRestore = FALSE;
		if (@$_GET["x_WorkAddress"] <> "") $bRestore = FALSE;
		if (@$_GET["x_PostalAddress"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Department"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Organisation"] <> "") $bRestore = FALSE;
		if (@$_GET["x_VATNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_JobTitle"] <> "") $bRestore = FALSE;
		if (@$_GET["x_DateofBirth"] <> "") $bRestore = FALSE;
		if (@$_GET["x_PlaceofBirth"] <> "") $bRestore = FALSE;
		if (@$_GET["x_CountryofBirth"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Province"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MaleorFemale"] <> "") $bRestore = FALSE;
		if (@$_GET["x_RaceGroup"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Disability"] <> "") $bRestore = FALSE;
		if (@$_GET["x_DisabilityNature"] <> "") $bRestore = FALSE;
		if (@$_GET["x_ProfessionalCouncil"] <> "") $bRestore = FALSE;
		if (@$_GET["x_CategoryReg"] <> "") $bRestore = FALSE;
		if (@$_GET["x_CouncilRegNumber"] <> "") $bRestore = FALSE;
		if (@$_GET["x_LengthCandidateReg"] <> "") $bRestore = FALSE;
		if (@$_GET["x_YearsToProfReg"] <> "") $bRestore = FALSE;
		if (@$_GET["x_FirstJobStart"] <> "") $bRestore = FALSE;
		if (@$_GET["x_VolAssociations"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BelongsTo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_CESA_SABTACO_MemNum"] <> "") $bRestore = FALSE;
		if (@$_GET["x_AreaDiscipline"] <> "") $bRestore = FALSE;
		if (@$_GET["x_AreaSubDiscipline"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Salary"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BankAccountName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BankAccountBank"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BankAccountBranch"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BankAccountNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Funding"] <> "") $bRestore = FALSE;
		if (@$_GET["x_CWDTP"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByDesignation"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByTelNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByFaxNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByCellNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BookedByEmail"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorID"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorDesig"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorProfRegNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorRegNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorTel"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorCell"] <> "") $bRestore = FALSE;
		if (@$_GET["x_MentorEmail"] <> "") $bRestore = FALSE;
		if (@$_GET["x_EmployerID"] <> "") $bRestore = FALSE;
		if (@$_GET["x_HRManagerName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_HRManagerDesignation"] <> "") $bRestore = FALSE;
		if (@$_GET["x_HRManagerTelNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_HRManagerCellNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_HRManagerEmail"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorName"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorDesig"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorProfRegNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorTelNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorCellNo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_SupervisorEmail"] <> "") $bRestore = FALSE;
		if (@$_GET["x_EducationalInst"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Qualifications"] <> "") $bRestore = FALSE;
		if (@$_GET["x_DateFinalExam"] <> "") $bRestore = FALSE;
		if (@$_GET["x_StudentNumber"] <> "") $bRestore = FALSE;
		if (@$_GET["x_WebUsername"] <> "") $bRestore = FALSE;
		if (@$_GET["x_WebPassword"] <> "") $bRestore = FALSE;
		if (@$_GET["x_BlockAccess"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Archived"] <> "") $bRestore = FALSE;
		$this->RestoreSearch = $bRestore;
		if ($bRestore) {

			// Restore basic search values
			$CCMStudents->BasicSearchKeyword = $CCMStudents->getSessionBasicSearchKeyword();
			$CCMStudents->BasicSearchType = $CCMStudents->getSessionBasicSearchType();

			// Restore advanced search values
			$this->GetSearchParm($CCMStudents->CCMStudentID);
			$this->GetSearchParm($CCMStudents->SelectionCategory);
			$this->GetSearchParm($CCMStudents->Title);
			$this->GetSearchParm($CCMStudents->Initials);
			$this->GetSearchParm($CCMStudents->FirstName);
			$this->GetSearchParm($CCMStudents->Surname);
			$this->GetSearchParm($CCMStudents->KnownAs);
			$this->GetSearchParm($CCMStudents->IDNumber);
			$this->GetSearchParm($CCMStudents->Telephone);
			$this->GetSearchParm($CCMStudents->Cellphone);
			$this->GetSearchParm($CCMStudents->EmailAddress);
			$this->GetSearchParm($CCMStudents->WorkAddress);
			$this->GetSearchParm($CCMStudents->PostalAddress);
			$this->GetSearchParm($CCMStudents->Department);
			$this->GetSearchParm($CCMStudents->Organisation);
			$this->GetSearchParm($CCMStudents->VATNo);
			$this->GetSearchParm($CCMStudents->JobTitle);
			$this->GetSearchParm($CCMStudents->DateofBirth);
			$this->GetSearchParm($CCMStudents->PlaceofBirth);
			$this->GetSearchParm($CCMStudents->CountryofBirth);
			$this->GetSearchParm($CCMStudents->Province);
			$this->GetSearchParm($CCMStudents->MaleorFemale);
			$this->GetSearchParm($CCMStudents->RaceGroup);
			$this->GetSearchParm($CCMStudents->Disability);
			$this->GetSearchParm($CCMStudents->DisabilityNature);
			$this->GetSearchParm($CCMStudents->ProfessionalCouncil);
			$this->GetSearchParm($CCMStudents->CategoryReg);
			$this->GetSearchParm($CCMStudents->CouncilRegNumber);
			$this->GetSearchParm($CCMStudents->LengthCandidateReg);
			$this->GetSearchParm($CCMStudents->YearsToProfReg);
			$this->GetSearchParm($CCMStudents->FirstJobStart);
			$this->GetSearchParm($CCMStudents->VolAssociations);
			$this->GetSearchParm($CCMStudents->BelongsTo);
			$this->GetSearchParm($CCMStudents->CESA_SABTACO_MemNum);
			$this->GetSearchParm($CCMStudents->AreaDiscipline);
			$this->GetSearchParm($CCMStudents->AreaSubDiscipline);
			$this->GetSearchParm($CCMStudents->Salary);
			$this->GetSearchParm($CCMStudents->BankAccountName);
			$this->GetSearchParm($CCMStudents->BankAccountBank);
			$this->GetSearchParm($CCMStudents->BankAccountBranch);
			$this->GetSearchParm($CCMStudents->BankAccountNo);
			$this->GetSearchParm($CCMStudents->Funding);
			$this->GetSearchParm($CCMStudents->CWDTP);
			$this->GetSearchParm($CCMStudents->BookedByName);
			$this->GetSearchParm($CCMStudents->BookedByDesignation);
			$this->GetSearchParm($CCMStudents->BookedByTelNo);
			$this->GetSearchParm($CCMStudents->BookedByFaxNo);
			$this->GetSearchParm($CCMStudents->BookedByCellNo);
			$this->GetSearchParm($CCMStudents->BookedByEmail);
			$this->GetSearchParm($CCMStudents->MentorID);
			$this->GetSearchParm($CCMStudents->MentorName);
			$this->GetSearchParm($CCMStudents->MentorDesig);
			$this->GetSearchParm($CCMStudents->MentorProfRegNo);
			$this->GetSearchParm($CCMStudents->MentorRegNo);
			$this->GetSearchParm($CCMStudents->MentorTel);
			$this->GetSearchParm($CCMStudents->MentorCell);
			$this->GetSearchParm($CCMStudents->MentorEmail);
			$this->GetSearchParm($CCMStudents->EmployerID);
			$this->GetSearchParm($CCMStudents->HRManagerName);
			$this->GetSearchParm($CCMStudents->HRManagerDesignation);
			$this->GetSearchParm($CCMStudents->HRManagerTelNo);
			$this->GetSearchParm($CCMStudents->HRManagerCellNo);
			$this->GetSearchParm($CCMStudents->HRManagerEmail);
			$this->GetSearchParm($CCMStudents->SupervisorName);
			$this->GetSearchParm($CCMStudents->SupervisorDesig);
			$this->GetSearchParm($CCMStudents->SupervisorProfRegNo);
			$this->GetSearchParm($CCMStudents->SupervisorTelNo);
			$this->GetSearchParm($CCMStudents->SupervisorCellNo);
			$this->GetSearchParm($CCMStudents->SupervisorEmail);
			$this->GetSearchParm($CCMStudents->EducationalInst);
			$this->GetSearchParm($CCMStudents->Qualifications);
			$this->GetSearchParm($CCMStudents->DateFinalExam);
			$this->GetSearchParm($CCMStudents->StudentNumber);
			$this->GetSearchParm($CCMStudents->WebUsername);
			$this->GetSearchParm($CCMStudents->WebPassword);
			$this->GetSearchParm($CCMStudents->BlockAccess);
			$this->GetSearchParm($CCMStudents->Archived);
		}
	}

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

		// Check for Ctrl pressed
		$bCtrl = (@$_GET["ctrl"] <> "");

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$CCMStudents->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$CCMStudents->CurrentOrderType = @$_GET["ordertype"];
			$CCMStudents->UpdateSort($CCMStudents->SelectionCategory, $bCtrl); // SelectionCategory
			$CCMStudents->UpdateSort($CCMStudents->FirstName, $bCtrl); // FirstName
			$CCMStudents->UpdateSort($CCMStudents->Surname, $bCtrl); // Surname
			$CCMStudents->UpdateSort($CCMStudents->KnownAs, $bCtrl); // KnownAs
			$CCMStudents->UpdateSort($CCMStudents->IDNumber, $bCtrl); // IDNumber
			$CCMStudents->UpdateSort($CCMStudents->Telephone, $bCtrl); // Telephone
			$CCMStudents->UpdateSort($CCMStudents->Cellphone, $bCtrl); // Cellphone
			$CCMStudents->UpdateSort($CCMStudents->EmailAddress, $bCtrl); // EmailAddress
			$CCMStudents->UpdateSort($CCMStudents->Organisation, $bCtrl); // Organisation
			$CCMStudents->UpdateSort($CCMStudents->Province, $bCtrl); // Province
			$CCMStudents->UpdateSort($CCMStudents->ProfessionalCouncil, $bCtrl); // ProfessionalCouncil
			$CCMStudents->UpdateSort($CCMStudents->CategoryReg, $bCtrl); // CategoryReg
			$CCMStudents->UpdateSort($CCMStudents->BelongsTo, $bCtrl); // BelongsTo
			$CCMStudents->setStartRecordNumber(1); // Reset start position
		}
	}

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

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

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

			// Reset search criteria
			if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
				$this->ResetSearchParms();

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$CCMStudents->setSessionOrderBy($sOrderBy);
				$CCMStudents->SelectionCategory->setSort("");
				$CCMStudents->FirstName->setSort("");
				$CCMStudents->Surname->setSort("");
				$CCMStudents->KnownAs->setSort("");
				$CCMStudents->IDNumber->setSort("");
				$CCMStudents->Telephone->setSort("");
				$CCMStudents->Cellphone->setSort("");
				$CCMStudents->EmailAddress->setSort("");
				$CCMStudents->Organisation->setSort("");
				$CCMStudents->Province->setSort("");
				$CCMStudents->ProfessionalCouncil->setSort("");
				$CCMStudents->CategoryReg->setSort("");
				$CCMStudents->BelongsTo->setSort("");
			}

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

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

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

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

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

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

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

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

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

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

		// "view"
		$oListOpt =& $this->ListOptions->Items["view"];
		if ($Security->CanView() && $oListOpt->Visible)
			$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . "<img src=\"images/view.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";

		// "edit"
		$oListOpt =& $this->ListOptions->Items["edit"];
		if ($Security->CanEdit() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . "<img src=\"images/edit.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
		}

		// "copy"
		$oListOpt =& $this->ListOptions->Items["copy"];
		if ($Security->CanAdd() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->CopyUrl . "\">" . "<img src=\"images/copy.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("CopyLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("CopyLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
		}

		// "delete"
		$oListOpt =& $this->ListOptions->Items["delete"];
		if ($Security->CanDelete() && $oListOpt->Visible)
			$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . "<img src=\"images/delete.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";

		// "detail_CCMMilestones"
		$oListOpt =& $this->ListOptions->Items["detail_CCMMilestones"];
		if ($Security->AllowList('CCMMilestones')) {
			$oListOpt->Body = "<img src=\"images/detail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . $Language->TablePhrase("CCMMilestones", "TblCaption");
			$oListOpt->Body = "<a href=\"CCMMilestoneslist.php?" . EW_TABLE_SHOW_MASTER . "=CCMStudents&CCMStudentID=" . urlencode(strval($CCMStudents->CCMStudentID->CurrentValue)) . "\">" . $oListOpt->Body . "</a>";
		}

		// "detail_CCMStudentProgress"
		$oListOpt =& $this->ListOptions->Items["detail_CCMStudentProgress"];
		if ($Security->AllowList('CCMStudentProgress')) {
			$oListOpt->Body = "<img src=\"images/detail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . $Language->TablePhrase("CCMStudentProgress", "TblCaption");
			$oListOpt->Body = "<a href=\"CCMStudentProgresslist.php?" . EW_TABLE_SHOW_MASTER . "=CCMStudents&CCMStudentID=" . urlencode(strval($CCMStudents->CCMStudentID->CurrentValue)) . "\">" . $oListOpt->Body . "</a>";
			$oListOpt->Body.="<br><a href='changementor.php?candidate=".$CCMStudents->CCMStudentID->CurrentValue."'>Change Mentor</a>";
		}
		$this->RenderListOptionsExt();

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

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

	// Set up starting record parameters
	function SetUpStartRec() {
		global $CCMStudents;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$CCMStudents->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$CCMStudents->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $CCMStudents->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$CCMStudents->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$CCMStudents->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$CCMStudents->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load basic search values
	function LoadBasicSearchValues() {
		global $CCMStudents;
		$CCMStudents->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
		$CCMStudents->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
	}

	//  Load search values for validation
	function LoadSearchValues() {
		global $objForm, $CCMStudents;

		// Load search values
		// CCMStudentID

		$CCMStudents->CCMStudentID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CCMStudentID"]);
		$CCMStudents->CCMStudentID->AdvancedSearch->SearchOperator = @$_GET["z_CCMStudentID"];

		// SelectionCategory
		$CCMStudents->SelectionCategory->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SelectionCategory"]);
		$CCMStudents->SelectionCategory->AdvancedSearch->SearchOperator = @$_GET["z_SelectionCategory"];

		// Title
		$CCMStudents->Title->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Title"]);
		$CCMStudents->Title->AdvancedSearch->SearchOperator = @$_GET["z_Title"];

		// Initials
		$CCMStudents->Initials->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Initials"]);
		$CCMStudents->Initials->AdvancedSearch->SearchOperator = @$_GET["z_Initials"];

		// FirstName
		$CCMStudents->FirstName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_FirstName"]);
		$CCMStudents->FirstName->AdvancedSearch->SearchOperator = @$_GET["z_FirstName"];

		// Surname
		$CCMStudents->Surname->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Surname"]);
		$CCMStudents->Surname->AdvancedSearch->SearchOperator = @$_GET["z_Surname"];

		// KnownAs
		$CCMStudents->KnownAs->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_KnownAs"]);
		$CCMStudents->KnownAs->AdvancedSearch->SearchOperator = @$_GET["z_KnownAs"];

		// IDNumber
		$CCMStudents->IDNumber->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_IDNumber"]);
		$CCMStudents->IDNumber->AdvancedSearch->SearchOperator = @$_GET["z_IDNumber"];

		// Telephone
		$CCMStudents->Telephone->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Telephone"]);
		$CCMStudents->Telephone->AdvancedSearch->SearchOperator = @$_GET["z_Telephone"];

		// Cellphone
		$CCMStudents->Cellphone->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Cellphone"]);
		$CCMStudents->Cellphone->AdvancedSearch->SearchOperator = @$_GET["z_Cellphone"];

		// EmailAddress
		$CCMStudents->EmailAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_EmailAddress"]);
		$CCMStudents->EmailAddress->AdvancedSearch->SearchOperator = @$_GET["z_EmailAddress"];

		// WorkAddress
		$CCMStudents->WorkAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WorkAddress"]);
		$CCMStudents->WorkAddress->AdvancedSearch->SearchOperator = @$_GET["z_WorkAddress"];

		// PostalAddress
		$CCMStudents->PostalAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_PostalAddress"]);
		$CCMStudents->PostalAddress->AdvancedSearch->SearchOperator = @$_GET["z_PostalAddress"];

		// Department
		$CCMStudents->Department->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Department"]);
		$CCMStudents->Department->AdvancedSearch->SearchOperator = @$_GET["z_Department"];

		// Organisation
		$CCMStudents->Organisation->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Organisation"]);
		$CCMStudents->Organisation->AdvancedSearch->SearchOperator = @$_GET["z_Organisation"];

		// VATNo
		$CCMStudents->VATNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_VATNo"]);
		$CCMStudents->VATNo->AdvancedSearch->SearchOperator = @$_GET["z_VATNo"];

		// JobTitle
		$CCMStudents->JobTitle->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_JobTitle"]);
		$CCMStudents->JobTitle->AdvancedSearch->SearchOperator = @$_GET["z_JobTitle"];

		// DateofBirth
		$CCMStudents->DateofBirth->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DateofBirth"]);
		$CCMStudents->DateofBirth->AdvancedSearch->SearchOperator = @$_GET["z_DateofBirth"];

		// PlaceofBirth
		$CCMStudents->PlaceofBirth->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_PlaceofBirth"]);
		$CCMStudents->PlaceofBirth->AdvancedSearch->SearchOperator = @$_GET["z_PlaceofBirth"];

		// CountryofBirth
		$CCMStudents->CountryofBirth->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CountryofBirth"]);
		$CCMStudents->CountryofBirth->AdvancedSearch->SearchOperator = @$_GET["z_CountryofBirth"];

		// Province
		$CCMStudents->Province->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Province"]);
		$CCMStudents->Province->AdvancedSearch->SearchOperator = @$_GET["z_Province"];

		// MaleorFemale
		$CCMStudents->MaleorFemale->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MaleorFemale"]);
		$CCMStudents->MaleorFemale->AdvancedSearch->SearchOperator = @$_GET["z_MaleorFemale"];

		// RaceGroup
		$CCMStudents->RaceGroup->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_RaceGroup"]);
		$CCMStudents->RaceGroup->AdvancedSearch->SearchOperator = @$_GET["z_RaceGroup"];

		// Disability
		$CCMStudents->Disability->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Disability"]);
		$CCMStudents->Disability->AdvancedSearch->SearchOperator = @$_GET["z_Disability"];

		// DisabilityNature
		$CCMStudents->DisabilityNature->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DisabilityNature"]);
		$CCMStudents->DisabilityNature->AdvancedSearch->SearchOperator = @$_GET["z_DisabilityNature"];

		// ProfessionalCouncil
		$CCMStudents->ProfessionalCouncil->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_ProfessionalCouncil"]);
		$CCMStudents->ProfessionalCouncil->AdvancedSearch->SearchOperator = @$_GET["z_ProfessionalCouncil"];

		// CategoryReg
		$CCMStudents->CategoryReg->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CategoryReg"]);
		$CCMStudents->CategoryReg->AdvancedSearch->SearchOperator = @$_GET["z_CategoryReg"];

		// CouncilRegNumber
		$CCMStudents->CouncilRegNumber->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CouncilRegNumber"]);
		$CCMStudents->CouncilRegNumber->AdvancedSearch->SearchOperator = @$_GET["z_CouncilRegNumber"];

		// LengthCandidateReg
		$CCMStudents->LengthCandidateReg->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_LengthCandidateReg"]);
		$CCMStudents->LengthCandidateReg->AdvancedSearch->SearchOperator = @$_GET["z_LengthCandidateReg"];

		// YearsToProfReg
		$CCMStudents->YearsToProfReg->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_YearsToProfReg"]);
		$CCMStudents->YearsToProfReg->AdvancedSearch->SearchOperator = @$_GET["z_YearsToProfReg"];

		// FirstJobStart
		$CCMStudents->FirstJobStart->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_FirstJobStart"]);
		$CCMStudents->FirstJobStart->AdvancedSearch->SearchOperator = @$_GET["z_FirstJobStart"];

		// VolAssociations
		$CCMStudents->VolAssociations->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_VolAssociations"]);
		$CCMStudents->VolAssociations->AdvancedSearch->SearchOperator = @$_GET["z_VolAssociations"];

		// BelongsTo
		$CCMStudents->BelongsTo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BelongsTo"]);
		$CCMStudents->BelongsTo->AdvancedSearch->SearchOperator = @$_GET["z_BelongsTo"];

		// CESA_SABTACO_MemNum
		$CCMStudents->CESA_SABTACO_MemNum->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CESA_SABTACO_MemNum"]);
		$CCMStudents->CESA_SABTACO_MemNum->AdvancedSearch->SearchOperator = @$_GET["z_CESA_SABTACO_MemNum"];

		// AreaDiscipline
		$CCMStudents->AreaDiscipline->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_AreaDiscipline"]);
		$CCMStudents->AreaDiscipline->AdvancedSearch->SearchOperator = @$_GET["z_AreaDiscipline"];

		// AreaSubDiscipline
		$CCMStudents->AreaSubDiscipline->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_AreaSubDiscipline"]);
		$CCMStudents->AreaSubDiscipline->AdvancedSearch->SearchOperator = @$_GET["z_AreaSubDiscipline"];

		// Salary
		$CCMStudents->Salary->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Salary"]);
		$CCMStudents->Salary->AdvancedSearch->SearchOperator = @$_GET["z_Salary"];

		// BankAccountName
		$CCMStudents->BankAccountName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BankAccountName"]);
		$CCMStudents->BankAccountName->AdvancedSearch->SearchOperator = @$_GET["z_BankAccountName"];

		// BankAccountBank
		$CCMStudents->BankAccountBank->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BankAccountBank"]);
		$CCMStudents->BankAccountBank->AdvancedSearch->SearchOperator = @$_GET["z_BankAccountBank"];

		// BankAccountBranch
		$CCMStudents->BankAccountBranch->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BankAccountBranch"]);
		$CCMStudents->BankAccountBranch->AdvancedSearch->SearchOperator = @$_GET["z_BankAccountBranch"];

		// BankAccountNo
		$CCMStudents->BankAccountNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BankAccountNo"]);
		$CCMStudents->BankAccountNo->AdvancedSearch->SearchOperator = @$_GET["z_BankAccountNo"];

		// Funding
		$CCMStudents->Funding->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Funding"]);
		$CCMStudents->Funding->AdvancedSearch->SearchOperator = @$_GET["z_Funding"];

		// CWDTP
		$CCMStudents->CWDTP->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CWDTP"]);
		$CCMStudents->CWDTP->AdvancedSearch->SearchOperator = @$_GET["z_CWDTP"];

		// BookedByName
		$CCMStudents->BookedByName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByName"]);
		$CCMStudents->BookedByName->AdvancedSearch->SearchOperator = @$_GET["z_BookedByName"];

		// BookedByDesignation
		$CCMStudents->BookedByDesignation->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByDesignation"]);
		$CCMStudents->BookedByDesignation->AdvancedSearch->SearchOperator = @$_GET["z_BookedByDesignation"];

		// BookedByTelNo
		$CCMStudents->BookedByTelNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByTelNo"]);
		$CCMStudents->BookedByTelNo->AdvancedSearch->SearchOperator = @$_GET["z_BookedByTelNo"];

		// BookedByFaxNo
		$CCMStudents->BookedByFaxNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByFaxNo"]);
		$CCMStudents->BookedByFaxNo->AdvancedSearch->SearchOperator = @$_GET["z_BookedByFaxNo"];

		// BookedByCellNo
		$CCMStudents->BookedByCellNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByCellNo"]);
		$CCMStudents->BookedByCellNo->AdvancedSearch->SearchOperator = @$_GET["z_BookedByCellNo"];

		// BookedByEmail
		$CCMStudents->BookedByEmail->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BookedByEmail"]);
		$CCMStudents->BookedByEmail->AdvancedSearch->SearchOperator = @$_GET["z_BookedByEmail"];

		// MentorID
		$CCMStudents->MentorID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorID"]);
		$CCMStudents->MentorID->AdvancedSearch->SearchOperator = @$_GET["z_MentorID"];

		// MentorName
		$CCMStudents->MentorName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorName"]);
		$CCMStudents->MentorName->AdvancedSearch->SearchOperator = @$_GET["z_MentorName"];

		// MentorDesig
		$CCMStudents->MentorDesig->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorDesig"]);
		$CCMStudents->MentorDesig->AdvancedSearch->SearchOperator = @$_GET["z_MentorDesig"];

		// MentorProfRegNo
		$CCMStudents->MentorProfRegNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorProfRegNo"]);
		$CCMStudents->MentorProfRegNo->AdvancedSearch->SearchOperator = @$_GET["z_MentorProfRegNo"];

		// MentorRegNo
		$CCMStudents->MentorRegNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorRegNo"]);
		$CCMStudents->MentorRegNo->AdvancedSearch->SearchOperator = @$_GET["z_MentorRegNo"];

		// MentorTel
		$CCMStudents->MentorTel->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorTel"]);
		$CCMStudents->MentorTel->AdvancedSearch->SearchOperator = @$_GET["z_MentorTel"];

		// MentorCell
		$CCMStudents->MentorCell->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorCell"]);
		$CCMStudents->MentorCell->AdvancedSearch->SearchOperator = @$_GET["z_MentorCell"];

		// MentorEmail
		$CCMStudents->MentorEmail->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_MentorEmail"]);
		$CCMStudents->MentorEmail->AdvancedSearch->SearchOperator = @$_GET["z_MentorEmail"];

		// EmployerID
		$CCMStudents->EmployerID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_EmployerID"]);
		$CCMStudents->EmployerID->AdvancedSearch->SearchOperator = @$_GET["z_EmployerID"];

		// HRManagerName
		$CCMStudents->HRManagerName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_HRManagerName"]);
		$CCMStudents->HRManagerName->AdvancedSearch->SearchOperator = @$_GET["z_HRManagerName"];

		// HRManagerDesignation
		$CCMStudents->HRManagerDesignation->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_HRManagerDesignation"]);
		$CCMStudents->HRManagerDesignation->AdvancedSearch->SearchOperator = @$_GET["z_HRManagerDesignation"];

		// HRManagerTelNo
		$CCMStudents->HRManagerTelNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_HRManagerTelNo"]);
		$CCMStudents->HRManagerTelNo->AdvancedSearch->SearchOperator = @$_GET["z_HRManagerTelNo"];

		// HRManagerCellNo
		$CCMStudents->HRManagerCellNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_HRManagerCellNo"]);
		$CCMStudents->HRManagerCellNo->AdvancedSearch->SearchOperator = @$_GET["z_HRManagerCellNo"];

		// HRManagerEmail
		$CCMStudents->HRManagerEmail->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_HRManagerEmail"]);
		$CCMStudents->HRManagerEmail->AdvancedSearch->SearchOperator = @$_GET["z_HRManagerEmail"];

		// SupervisorName
		$CCMStudents->SupervisorName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorName"]);
		$CCMStudents->SupervisorName->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorName"];

		// SupervisorDesig
		$CCMStudents->SupervisorDesig->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorDesig"]);
		$CCMStudents->SupervisorDesig->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorDesig"];

		// SupervisorProfRegNo
		$CCMStudents->SupervisorProfRegNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorProfRegNo"]);
		$CCMStudents->SupervisorProfRegNo->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorProfRegNo"];

		// SupervisorTelNo
		$CCMStudents->SupervisorTelNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorTelNo"]);
		$CCMStudents->SupervisorTelNo->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorTelNo"];

		// SupervisorCellNo
		$CCMStudents->SupervisorCellNo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorCellNo"]);
		$CCMStudents->SupervisorCellNo->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorCellNo"];

		// SupervisorEmail
		$CCMStudents->SupervisorEmail->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_SupervisorEmail"]);
		$CCMStudents->SupervisorEmail->AdvancedSearch->SearchOperator = @$_GET["z_SupervisorEmail"];

		// EducationalInst
		$CCMStudents->EducationalInst->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_EducationalInst"]);
		$CCMStudents->EducationalInst->AdvancedSearch->SearchOperator = @$_GET["z_EducationalInst"];

		// Qualifications
		$CCMStudents->Qualifications->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Qualifications"]);
		$CCMStudents->Qualifications->AdvancedSearch->SearchOperator = @$_GET["z_Qualifications"];

		// DateFinalExam
		$CCMStudents->DateFinalExam->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DateFinalExam"]);
		$CCMStudents->DateFinalExam->AdvancedSearch->SearchOperator = @$_GET["z_DateFinalExam"];

		// StudentNumber
		$CCMStudents->StudentNumber->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_StudentNumber"]);
		$CCMStudents->StudentNumber->AdvancedSearch->SearchOperator = @$_GET["z_StudentNumber"];

		// WebUsername
		$CCMStudents->WebUsername->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WebUsername"]);
		$CCMStudents->WebUsername->AdvancedSearch->SearchOperator = @$_GET["z_WebUsername"];

		// WebPassword
		$CCMStudents->WebPassword->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WebPassword"]);
		$CCMStudents->WebPassword->AdvancedSearch->SearchOperator = @$_GET["z_WebPassword"];

		// BlockAccess
		$CCMStudents->BlockAccess->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BlockAccess"]);
		$CCMStudents->BlockAccess->AdvancedSearch->SearchOperator = @$_GET["z_BlockAccess"];

		// Archived
		$CCMStudents->Archived->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Archived"]);
		$CCMStudents->Archived->AdvancedSearch->SearchOperator = @$_GET["z_Archived"];
	}

	// 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
		$this->ViewUrl = $CCMStudents->ViewUrl();
		$this->EditUrl = $CCMStudents->EditUrl();
		$this->InlineEditUrl = $CCMStudents->InlineEditUrl();
		$this->CopyUrl = $CCMStudents->CopyUrl();
		$this->InlineCopyUrl = $CCMStudents->InlineCopyUrl();
		$this->DeleteUrl = $CCMStudents->DeleteUrl();

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

	// Validate search
	function ValidateSearch() {
		global $gsSearchError, $CCMStudents;

		// Initialize
		$gsSearchError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return TRUE;

		// Return validate result
		$ValidateSearch = ($gsSearchError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $sFormCustomError;
		}
		return $ValidateSearch;
	}

	// Load advanced search
	function LoadAdvancedSearch() {
		global $CCMStudents;
		$CCMStudents->CCMStudentID->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CCMStudentID");
		$CCMStudents->SelectionCategory->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SelectionCategory");
		$CCMStudents->Title->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Title");
		$CCMStudents->Initials->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Initials");
		$CCMStudents->FirstName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_FirstName");
		$CCMStudents->Surname->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Surname");
		$CCMStudents->KnownAs->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_KnownAs");
		$CCMStudents->IDNumber->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_IDNumber");
		$CCMStudents->Telephone->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Telephone");
		$CCMStudents->Cellphone->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Cellphone");
		$CCMStudents->EmailAddress->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_EmailAddress");
		$CCMStudents->WorkAddress->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_WorkAddress");
		$CCMStudents->PostalAddress->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_PostalAddress");
		$CCMStudents->Department->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Department");
		$CCMStudents->Organisation->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Organisation");
		$CCMStudents->VATNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_VATNo");
		$CCMStudents->JobTitle->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_JobTitle");
		$CCMStudents->DateofBirth->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_DateofBirth");
		$CCMStudents->PlaceofBirth->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_PlaceofBirth");
		$CCMStudents->CountryofBirth->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CountryofBirth");
		$CCMStudents->Province->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Province");
		$CCMStudents->MaleorFemale->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MaleorFemale");
		$CCMStudents->RaceGroup->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_RaceGroup");
		$CCMStudents->Disability->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Disability");
		$CCMStudents->DisabilityNature->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_DisabilityNature");
		$CCMStudents->ProfessionalCouncil->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_ProfessionalCouncil");
		$CCMStudents->CategoryReg->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CategoryReg");
		$CCMStudents->CouncilRegNumber->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CouncilRegNumber");
		$CCMStudents->LengthCandidateReg->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_LengthCandidateReg");
		$CCMStudents->YearsToProfReg->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_YearsToProfReg");
		$CCMStudents->FirstJobStart->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_FirstJobStart");
		$CCMStudents->VolAssociations->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_VolAssociations");
		$CCMStudents->BelongsTo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BelongsTo");
		$CCMStudents->CESA_SABTACO_MemNum->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CESA_SABTACO_MemNum");
		$CCMStudents->AreaDiscipline->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_AreaDiscipline");
		$CCMStudents->AreaSubDiscipline->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_AreaSubDiscipline");
		$CCMStudents->Salary->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Salary");
		$CCMStudents->BankAccountName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BankAccountName");
		$CCMStudents->BankAccountBank->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BankAccountBank");
		$CCMStudents->BankAccountBranch->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BankAccountBranch");
		$CCMStudents->BankAccountNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BankAccountNo");
		$CCMStudents->Funding->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Funding");
		$CCMStudents->CWDTP->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_CWDTP");
		$CCMStudents->BookedByName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByName");
		$CCMStudents->BookedByDesignation->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByDesignation");
		$CCMStudents->BookedByTelNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByTelNo");
		$CCMStudents->BookedByFaxNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByFaxNo");
		$CCMStudents->BookedByCellNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByCellNo");
		$CCMStudents->BookedByEmail->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BookedByEmail");
		$CCMStudents->MentorID->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorID");
		$CCMStudents->MentorName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorName");
		$CCMStudents->MentorDesig->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorDesig");
		$CCMStudents->MentorProfRegNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorProfRegNo");
		$CCMStudents->MentorRegNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorRegNo");
		$CCMStudents->MentorTel->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorTel");
		$CCMStudents->MentorCell->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorCell");
		$CCMStudents->MentorEmail->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_MentorEmail");
		$CCMStudents->EmployerID->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_EmployerID");
		$CCMStudents->HRManagerName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_HRManagerName");
		$CCMStudents->HRManagerDesignation->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_HRManagerDesignation");
		$CCMStudents->HRManagerTelNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_HRManagerTelNo");
		$CCMStudents->HRManagerCellNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_HRManagerCellNo");
		$CCMStudents->HRManagerEmail->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_HRManagerEmail");
		$CCMStudents->SupervisorName->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorName");
		$CCMStudents->SupervisorDesig->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorDesig");
		$CCMStudents->SupervisorProfRegNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorProfRegNo");
		$CCMStudents->SupervisorTelNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorTelNo");
		$CCMStudents->SupervisorCellNo->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorCellNo");
		$CCMStudents->SupervisorEmail->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_SupervisorEmail");
		$CCMStudents->EducationalInst->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_EducationalInst");
		$CCMStudents->Qualifications->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Qualifications");
		$CCMStudents->DateFinalExam->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_DateFinalExam");
		$CCMStudents->StudentNumber->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_StudentNumber");
		$CCMStudents->WebUsername->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_WebUsername");
		$CCMStudents->WebPassword->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_WebPassword");
		$CCMStudents->BlockAccess->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_BlockAccess");
		$CCMStudents->Archived->AdvancedSearch->SearchValue = $CCMStudents->getAdvancedSearch("x_Archived");
	}

	// Export data in HTML/CSV/Word/Excel/XML/Email format
	function ExportData() {
		global $CCMStudents;
		$utf8 = FALSE;
		$bSelectLimit = EW_SELECT_LIMIT;

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $CCMStudents->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;

		// Export all
		if ($CCMStudents->ExportAll) {
			$this->lDisplayRecs = $this->lTotalRecs;
			$this->lStopRec = $this->lTotalRecs;
		} else { // Export one page only
			$this->SetUpStartRec(); // Set up start record position

			// Set the last record to display
			if ($this->lDisplayRecs < 0) {
				$this->lStopRec = $this->lTotalRecs;
			} else {
				$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
			}
		}
		if ($bSelectLimit)
			$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
		if (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($CCMStudents->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($CCMStudents, "h");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($CCMStudents->SelectionCategory);
				$ExportDoc->ExportCaption($CCMStudents->Title);
				$ExportDoc->ExportCaption($CCMStudents->Initials);
				$ExportDoc->ExportCaption($CCMStudents->FirstName);
				$ExportDoc->ExportCaption($CCMStudents->Surname);
				$ExportDoc->ExportCaption($CCMStudents->KnownAs);
				$ExportDoc->ExportCaption($CCMStudents->IDNumber);
				$ExportDoc->ExportCaption($CCMStudents->Telephone);
				$ExportDoc->ExportCaption($CCMStudents->Cellphone);
				$ExportDoc->ExportCaption($CCMStudents->EmailAddress);
				$ExportDoc->ExportCaption($CCMStudents->WorkAddress);
				$ExportDoc->ExportCaption($CCMStudents->PostalAddress);
				$ExportDoc->ExportCaption($CCMStudents->Department);
				$ExportDoc->ExportCaption($CCMStudents->Organisation);
				$ExportDoc->ExportCaption($CCMStudents->VATNo);
				$ExportDoc->ExportCaption($CCMStudents->JobTitle);
				$ExportDoc->ExportCaption($CCMStudents->DateofBirth);
				$ExportDoc->ExportCaption($CCMStudents->PlaceofBirth);
				$ExportDoc->ExportCaption($CCMStudents->CountryofBirth);
				$ExportDoc->ExportCaption($CCMStudents->Province);
				$ExportDoc->ExportCaption($CCMStudents->MaleorFemale);
				$ExportDoc->ExportCaption($CCMStudents->RaceGroup);
				$ExportDoc->ExportCaption($CCMStudents->Disability);
				$ExportDoc->ExportCaption($CCMStudents->DisabilityNature);
				$ExportDoc->ExportCaption($CCMStudents->DisabilityCertificate);
				$ExportDoc->ExportCaption($CCMStudents->ProfessionalCouncil);
				$ExportDoc->ExportCaption($CCMStudents->CategoryReg);
				$ExportDoc->ExportCaption($CCMStudents->CouncilRegNumber);
				$ExportDoc->ExportCaption($CCMStudents->LengthCandidateReg);
				$ExportDoc->ExportCaption($CCMStudents->YearsToProfReg);
				$ExportDoc->ExportCaption($CCMStudents->FirstJobStart);
				$ExportDoc->ExportCaption($CCMStudents->VolAssociations);
				$ExportDoc->ExportCaption($CCMStudents->BelongsTo);
				$ExportDoc->ExportCaption($CCMStudents->CESA_SABTACO_MemNum);
				$ExportDoc->ExportCaption($CCMStudents->AreaDiscipline);
				$ExportDoc->ExportCaption($CCMStudents->AreaSubDiscipline);
				$ExportDoc->ExportCaption($CCMStudents->Salary);
				$ExportDoc->ExportCaption($CCMStudents->Payslip);
				$ExportDoc->ExportCaption($CCMStudents->BankAccountName);
				$ExportDoc->ExportCaption($CCMStudents->BankAccountBank);
				$ExportDoc->ExportCaption($CCMStudents->BankAccountBranch);
				$ExportDoc->ExportCaption($CCMStudents->BankAccountNo);
				$ExportDoc->ExportCaption($CCMStudents->BankAccountProof);
				$ExportDoc->ExportCaption($CCMStudents->Funding);
				$ExportDoc->ExportCaption($CCMStudents->CWDTP);
				$ExportDoc->ExportCaption($CCMStudents->BookedByName);
				$ExportDoc->ExportCaption($CCMStudents->BookedByDesignation);
				$ExportDoc->ExportCaption($CCMStudents->BookedByTelNo);
				$ExportDoc->ExportCaption($CCMStudents->BookedByFaxNo);
				$ExportDoc->ExportCaption($CCMStudents->BookedByCellNo);
				$ExportDoc->ExportCaption($CCMStudents->BookedByEmail);
				$ExportDoc->ExportCaption($CCMStudents->MentorID);
				$ExportDoc->ExportCaption($CCMStudents->MentorName);
				$ExportDoc->ExportCaption($CCMStudents->MentorDesig);
				$ExportDoc->ExportCaption($CCMStudents->MentorProfRegNo);
				$ExportDoc->ExportCaption($CCMStudents->MentorRegNo);
				$ExportDoc->ExportCaption($CCMStudents->MentorTel);
				$ExportDoc->ExportCaption($CCMStudents->MentorCell);
				$ExportDoc->ExportCaption($CCMStudents->MentorEmail);
				$ExportDoc->ExportCaption($CCMStudents->EmployerID);
				$ExportDoc->ExportCaption($CCMStudents->HRManagerName);
				$ExportDoc->ExportCaption($CCMStudents->HRManagerDesignation);
				$ExportDoc->ExportCaption($CCMStudents->HRManagerTelNo);
				$ExportDoc->ExportCaption($CCMStudents->HRManagerCellNo);
				$ExportDoc->ExportCaption($CCMStudents->HRManagerEmail);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorName);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorDesig);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorProfRegNo);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorTelNo);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorCellNo);
				$ExportDoc->ExportCaption($CCMStudents->SupervisorEmail);
				$ExportDoc->ExportCaption($CCMStudents->EducationalInst);
				$ExportDoc->ExportCaption($CCMStudents->Qualifications);
				$ExportDoc->ExportCaption($CCMStudents->DateFinalExam);
				$ExportDoc->ExportCaption($CCMStudents->IDFile);
				$ExportDoc->ExportCaption($CCMStudents->CVFile);
				$ExportDoc->ExportCaption($CCMStudents->QualCertificate1);
				$ExportDoc->ExportCaption($CCMStudents->QualCertificate2);
				$ExportDoc->ExportCaption($CCMStudents->QualCertificate3);
				$ExportDoc->ExportCaption($CCMStudents->MentorUndertaking);
				$ExportDoc->ExportCaption($CCMStudents->CandUUndertaking);
				$ExportDoc->ExportCaption($CCMStudents->CompanyCandidatePolicy);
				$ExportDoc->ExportCaption($CCMStudents->ResidenceProof);
				$ExportDoc->ExportCaption($CCMStudents->SignedAppForm);
				$ExportDoc->ExportCaption($CCMStudents->Photograph);
				$ExportDoc->ExportCaption($CCMStudents->StudentNumber);
				$ExportDoc->ExportCaption($CCMStudents->WebUsername);
				$ExportDoc->ExportCaption($CCMStudents->WebPassword);
				$ExportDoc->ExportCaption($CCMStudents->BlockAccess);
				$ExportDoc->ExportCaption($CCMStudents->SABTACO);
				$ExportDoc->ExportCaption($CCMStudents->CESA);
				$ExportDoc->ExportCaption($CCMStudents->Archived);
				$ExportDoc->EndExportRow();
			}
		}

		// Move to first record
		$this->lRecCnt = $this->lStartRec - 1;
		if (!$rs->EOF) {
			$rs->MoveFirst();
			if (!$bSelectLimit && $this->lStartRec > 1)
				$rs->Move($this->lStartRec - 1);
		}
		while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
			$this->lRecCnt++;
			if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
				$this->LoadRowValues($rs);

				// Render row
				$CCMStudents->CssClass = "";
				$CCMStudents->CssStyle = "";
				$CCMStudents->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($CCMStudents->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('SelectionCategory', $CCMStudents->SelectionCategory->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Title', $CCMStudents->Title->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Initials', $CCMStudents->Initials->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('FirstName', $CCMStudents->FirstName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Surname', $CCMStudents->Surname->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('KnownAs', $CCMStudents->KnownAs->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('IDNumber', $CCMStudents->IDNumber->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Telephone', $CCMStudents->Telephone->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Cellphone', $CCMStudents->Cellphone->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('EmailAddress', $CCMStudents->EmailAddress->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('WorkAddress', $CCMStudents->WorkAddress->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('PostalAddress', $CCMStudents->PostalAddress->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Department', $CCMStudents->Department->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Organisation', $CCMStudents->Organisation->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('VATNo', $CCMStudents->VATNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('JobTitle', $CCMStudents->JobTitle->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('DateofBirth', $CCMStudents->DateofBirth->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('PlaceofBirth', $CCMStudents->PlaceofBirth->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CountryofBirth', $CCMStudents->CountryofBirth->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Province', $CCMStudents->Province->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MaleorFemale', $CCMStudents->MaleorFemale->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('RaceGroup', $CCMStudents->RaceGroup->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Disability', $CCMStudents->Disability->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('DisabilityNature', $CCMStudents->DisabilityNature->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('DisabilityCertificate', $CCMStudents->DisabilityCertificate->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('ProfessionalCouncil', $CCMStudents->ProfessionalCouncil->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CategoryReg', $CCMStudents->CategoryReg->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CouncilRegNumber', $CCMStudents->CouncilRegNumber->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('LengthCandidateReg', $CCMStudents->LengthCandidateReg->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('YearsToProfReg', $CCMStudents->YearsToProfReg->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('FirstJobStart', $CCMStudents->FirstJobStart->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('VolAssociations', $CCMStudents->VolAssociations->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BelongsTo', $CCMStudents->BelongsTo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CESA_SABTACO_MemNum', $CCMStudents->CESA_SABTACO_MemNum->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('AreaDiscipline', $CCMStudents->AreaDiscipline->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('AreaSubDiscipline', $CCMStudents->AreaSubDiscipline->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Salary', $CCMStudents->Salary->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Payslip', $CCMStudents->Payslip->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BankAccountName', $CCMStudents->BankAccountName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BankAccountBank', $CCMStudents->BankAccountBank->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BankAccountBranch', $CCMStudents->BankAccountBranch->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BankAccountNo', $CCMStudents->BankAccountNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BankAccountProof', $CCMStudents->BankAccountProof->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Funding', $CCMStudents->Funding->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CWDTP', $CCMStudents->CWDTP->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByName', $CCMStudents->BookedByName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByDesignation', $CCMStudents->BookedByDesignation->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByTelNo', $CCMStudents->BookedByTelNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByFaxNo', $CCMStudents->BookedByFaxNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByCellNo', $CCMStudents->BookedByCellNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BookedByEmail', $CCMStudents->BookedByEmail->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorID', $CCMStudents->MentorID->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorName', $CCMStudents->MentorName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorDesig', $CCMStudents->MentorDesig->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorProfRegNo', $CCMStudents->MentorProfRegNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorRegNo', $CCMStudents->MentorRegNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorTel', $CCMStudents->MentorTel->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorCell', $CCMStudents->MentorCell->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorEmail', $CCMStudents->MentorEmail->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('EmployerID', $CCMStudents->EmployerID->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('HRManagerName', $CCMStudents->HRManagerName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('HRManagerDesignation', $CCMStudents->HRManagerDesignation->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('HRManagerTelNo', $CCMStudents->HRManagerTelNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('HRManagerCellNo', $CCMStudents->HRManagerCellNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('HRManagerEmail', $CCMStudents->HRManagerEmail->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorName', $CCMStudents->SupervisorName->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorDesig', $CCMStudents->SupervisorDesig->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorProfRegNo', $CCMStudents->SupervisorProfRegNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorTelNo', $CCMStudents->SupervisorTelNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorCellNo', $CCMStudents->SupervisorCellNo->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SupervisorEmail', $CCMStudents->SupervisorEmail->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('EducationalInst', $CCMStudents->EducationalInst->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Qualifications', $CCMStudents->Qualifications->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('DateFinalExam', $CCMStudents->DateFinalExam->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('IDFile', $CCMStudents->IDFile->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CVFile', $CCMStudents->CVFile->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('QualCertificate1', $CCMStudents->QualCertificate1->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('QualCertificate2', $CCMStudents->QualCertificate2->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('QualCertificate3', $CCMStudents->QualCertificate3->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('MentorUndertaking', $CCMStudents->MentorUndertaking->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CandUUndertaking', $CCMStudents->CandUUndertaking->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CompanyCandidatePolicy', $CCMStudents->CompanyCandidatePolicy->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('ResidenceProof', $CCMStudents->ResidenceProof->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SignedAppForm', $CCMStudents->SignedAppForm->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Photograph', $CCMStudents->Photograph->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('StudentNumber', $CCMStudents->StudentNumber->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('WebUsername', $CCMStudents->WebUsername->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('WebPassword', $CCMStudents->WebPassword->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('BlockAccess', $CCMStudents->BlockAccess->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('SABTACO', $CCMStudents->SABTACO->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('CESA', $CCMStudents->CESA->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
					$XmlDoc->AddField('Archived', $CCMStudents->Archived->ExportValue($CCMStudents->Export, $CCMStudents->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($CCMStudents->SelectionCategory);
					$ExportDoc->ExportField($CCMStudents->Title);
					$ExportDoc->ExportField($CCMStudents->Initials);
					$ExportDoc->ExportField($CCMStudents->FirstName);
					$ExportDoc->ExportField($CCMStudents->Surname);
					$ExportDoc->ExportField($CCMStudents->KnownAs);
					$ExportDoc->ExportField($CCMStudents->IDNumber);
					$ExportDoc->ExportField($CCMStudents->Telephone);
					$ExportDoc->ExportField($CCMStudents->Cellphone);
					$ExportDoc->ExportField($CCMStudents->EmailAddress);
					$ExportDoc->ExportField($CCMStudents->WorkAddress);
					$ExportDoc->ExportField($CCMStudents->PostalAddress);
					$ExportDoc->ExportField($CCMStudents->Department);
					$ExportDoc->ExportField($CCMStudents->Organisation);
					$ExportDoc->ExportField($CCMStudents->VATNo);
					$ExportDoc->ExportField($CCMStudents->JobTitle);
					$ExportDoc->ExportField($CCMStudents->DateofBirth);
					$ExportDoc->ExportField($CCMStudents->PlaceofBirth);
					$ExportDoc->ExportField($CCMStudents->CountryofBirth);
					$ExportDoc->ExportField($CCMStudents->Province);
					$ExportDoc->ExportField($CCMStudents->MaleorFemale);
					$ExportDoc->ExportField($CCMStudents->RaceGroup);
					$ExportDoc->ExportField($CCMStudents->Disability);
					$ExportDoc->ExportField($CCMStudents->DisabilityNature);
					$ExportDoc->ExportField($CCMStudents->DisabilityCertificate);
					$ExportDoc->ExportField($CCMStudents->ProfessionalCouncil);
					$ExportDoc->ExportField($CCMStudents->CategoryReg);
					$ExportDoc->ExportField($CCMStudents->CouncilRegNumber);
					$ExportDoc->ExportField($CCMStudents->LengthCandidateReg);
					$ExportDoc->ExportField($CCMStudents->YearsToProfReg);
					$ExportDoc->ExportField($CCMStudents->FirstJobStart);
					$ExportDoc->ExportField($CCMStudents->VolAssociations);
					$ExportDoc->ExportField($CCMStudents->BelongsTo);
					$ExportDoc->ExportField($CCMStudents->CESA_SABTACO_MemNum);
					$ExportDoc->ExportField($CCMStudents->AreaDiscipline);
					$ExportDoc->ExportField($CCMStudents->AreaSubDiscipline);
					$ExportDoc->ExportField($CCMStudents->Salary);
					$ExportDoc->ExportField($CCMStudents->Payslip);
					$ExportDoc->ExportField($CCMStudents->BankAccountName);
					$ExportDoc->ExportField($CCMStudents->BankAccountBank);
					$ExportDoc->ExportField($CCMStudents->BankAccountBranch);
					$ExportDoc->ExportField($CCMStudents->BankAccountNo);
					$ExportDoc->ExportField($CCMStudents->BankAccountProof);
					$ExportDoc->ExportField($CCMStudents->Funding);
					$ExportDoc->ExportField($CCMStudents->CWDTP);
					$ExportDoc->ExportField($CCMStudents->BookedByName);
					$ExportDoc->ExportField($CCMStudents->BookedByDesignation);
					$ExportDoc->ExportField($CCMStudents->BookedByTelNo);
					$ExportDoc->ExportField($CCMStudents->BookedByFaxNo);
					$ExportDoc->ExportField($CCMStudents->BookedByCellNo);
					$ExportDoc->ExportField($CCMStudents->BookedByEmail);
					$ExportDoc->ExportField($CCMStudents->MentorID);
					$ExportDoc->ExportField($CCMStudents->MentorName);
					$ExportDoc->ExportField($CCMStudents->MentorDesig);
					$ExportDoc->ExportField($CCMStudents->MentorProfRegNo);
					$ExportDoc->ExportField($CCMStudents->MentorRegNo);
					$ExportDoc->ExportField($CCMStudents->MentorTel);
					$ExportDoc->ExportField($CCMStudents->MentorCell);
					$ExportDoc->ExportField($CCMStudents->MentorEmail);
					$ExportDoc->ExportField($CCMStudents->EmployerID);
					$ExportDoc->ExportField($CCMStudents->HRManagerName);
					$ExportDoc->ExportField($CCMStudents->HRManagerDesignation);
					$ExportDoc->ExportField($CCMStudents->HRManagerTelNo);
					$ExportDoc->ExportField($CCMStudents->HRManagerCellNo);
					$ExportDoc->ExportField($CCMStudents->HRManagerEmail);
					$ExportDoc->ExportField($CCMStudents->SupervisorName);
					$ExportDoc->ExportField($CCMStudents->SupervisorDesig);
					$ExportDoc->ExportField($CCMStudents->SupervisorProfRegNo);
					$ExportDoc->ExportField($CCMStudents->SupervisorTelNo);
					$ExportDoc->ExportField($CCMStudents->SupervisorCellNo);
					$ExportDoc->ExportField($CCMStudents->SupervisorEmail);
					$ExportDoc->ExportField($CCMStudents->EducationalInst);
					$ExportDoc->ExportField($CCMStudents->Qualifications);
					$ExportDoc->ExportField($CCMStudents->DateFinalExam);
					$ExportDoc->ExportField($CCMStudents->IDFile);
					$ExportDoc->ExportField($CCMStudents->CVFile);
					$ExportDoc->ExportField($CCMStudents->QualCertificate1);
					$ExportDoc->ExportField($CCMStudents->QualCertificate2);
					$ExportDoc->ExportField($CCMStudents->QualCertificate3);
					$ExportDoc->ExportField($CCMStudents->MentorUndertaking);
					$ExportDoc->ExportField($CCMStudents->CandUUndertaking);
					$ExportDoc->ExportField($CCMStudents->CompanyCandidatePolicy);
					$ExportDoc->ExportField($CCMStudents->ResidenceProof);
					$ExportDoc->ExportField($CCMStudents->SignedAppForm);
					$ExportDoc->ExportField($CCMStudents->Photograph);
					$ExportDoc->ExportField($CCMStudents->StudentNumber);
					$ExportDoc->ExportField($CCMStudents->WebUsername);
					$ExportDoc->ExportField($CCMStudents->WebPassword);
					$ExportDoc->ExportField($CCMStudents->BlockAccess);
					$ExportDoc->ExportField($CCMStudents->SABTACO);
					$ExportDoc->ExportField($CCMStudents->CESA);
					$ExportDoc->ExportField($CCMStudents->Archived);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($CCMStudents->Export <> "xml")
			$ExportDoc->ExportFooter();

		// Close recordset
		$rs->Close();

		// Clean output buffer
		if (!EW_DEBUG_ENABLED && ob_get_length())
			ob_end_clean();

		// Write BOM if utf-8
		if ($utf8 && !in_array($CCMStudents->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

		// Write debug message if enabled
		if (EW_DEBUG_ENABLED)
			echo ew_DebugMsg();

		// Output data
		if ($CCMStudents->Export == "xml") {
			header("Content-Type: text/xml");
			echo $XmlDoc->XML();
		} elseif ($CCMStudents->Export == "email") {
			$this->ExportEmail($ExportDoc->Text);
			$this->Page_Terminate($CCMStudents->ExportReturnUrl());
		} else {
			echo $ExportDoc->Text;
		}
	}

	// Export email
	function ExportEmail($EmailContent) {
		global $Language, $CCMStudents;
		$sSender = @$_GET["sender"];
		$sRecipient = @$_GET["recipient"];
		$sCc = @$_GET["cc"];
		$sBcc = @$_GET["bcc"];
		$sContentType = @$_GET["contenttype"];

		// Subject
		$sSubject = ew_StripSlashes(@$_GET["subject"]);
		$sEmailSubject = $sSubject;

		// Message
		$sContent = ew_StripSlashes(@$_GET["message"]);
		$sEmailMessage = $sContent;

		// Check sender
		if ($sSender == "") {
			$this->setMessage($Language->Phrase("EnterSenderEmail"));
			return;
		}
		if (!ew_CheckEmail($sSender)) {
			$this->setMessage($Language->Phrase("EnterProperSenderEmail"));
			return;
		}

		// Check recipient
		if (!ew_CheckEmailList($sRecipient, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperRecipientEmail"));
			return;
		}

		// Check cc
		if (!ew_CheckEmailList($sCc, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperCcEmail"));
			return;
		}

		// Check bcc
		if (!ew_CheckEmailList($sBcc, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperBccEmail"));
			return;
		}

		// Check email sent count
		if (!isset($_SESSION[EW_EXPORT_EMAIL_COUNTER]))
			$_SESSION[EW_EXPORT_EMAIL_COUNTER] = 0;
		if (intval($_SESSION[EW_EXPORT_EMAIL_COUNTER]) > EW_MAX_EMAIL_SENT_COUNT) {
			$this->setMessage($Language->Phrase("ExceedMaxEmailExport"));
			return;
		}
		if ($sEmailMessage <> "") {
			$sEmailMessage = ew_RemoveXSS($sEmailMessage);
			$sEmailMessage .= ($sContentType == "url") ? "\r\n\r\n" : "<br><br>";
		}
		if ($sContentType == "url") {
			$sUrl = ew_ConvertFullUrl(ew_CurrentPage() . "?" . $this->ExportQueryString());
			$sEmailMessage .= $sUrl; // send URL only
		} else {
			$sEmailMessage .= $EmailContent; // send HTML
		}

		// Send email
		$Email = new cEmail();
		$Email->Sender = $sSender; // Sender
		$Email->Recipient = $sRecipient; // Recipient
		$Email->Cc = $sCc; // Cc
		$Email->Bcc = $sBcc; // Bcc
		$Email->Subject = $sEmailSubject; // Subject
		$Email->Content = $sEmailMessage; // Content
		$Email->Format = ($sContentType == "url") ? "text" : "html";
		$Email->Charset = EW_EMAIL_CHARSET;
		$EventArgs = array();
		$bEmailSent = FALSE;
		if ($CCMStudents->Email_Sending($Email, $EventArgs))
			$bEmailSent = $Email->Send();

		// Check email sent status
		if ($bEmailSent) {

			// Update email sent count
			$_SESSION[EW_EXPORT_EMAIL_COUNTER]++;

			// Sent email success
			$this->setMessage($Language->Phrase("SendEmailSuccess"));
		} else {

			// Sent email failure
			$this->setMessage($Email->SendErrDescription);
		}
	}

	// Export QueryString
	function ExportQueryString() {
		global $CCMStudents;

		// Initialize
		$sQry = "export=html";

		// Build QueryString for search
		if ($CCMStudents->getSessionBasicSearchKeyword() <> "") {
			$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCMStudents->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCMStudents->getSessionBasicSearchType();
		}
		$this->AddSearchQueryString($sQry, $CCMStudents->CCMStudentID); // CCMStudentID
		$this->AddSearchQueryString($sQry, $CCMStudents->SelectionCategory); // SelectionCategory
		$this->AddSearchQueryString($sQry, $CCMStudents->Title); // Title
		$this->AddSearchQueryString($sQry, $CCMStudents->Initials); // Initials
		$this->AddSearchQueryString($sQry, $CCMStudents->FirstName); // FirstName
		$this->AddSearchQueryString($sQry, $CCMStudents->Surname); // Surname
		$this->AddSearchQueryString($sQry, $CCMStudents->KnownAs); // KnownAs
		$this->AddSearchQueryString($sQry, $CCMStudents->IDNumber); // IDNumber
		$this->AddSearchQueryString($sQry, $CCMStudents->Telephone); // Telephone
		$this->AddSearchQueryString($sQry, $CCMStudents->Cellphone); // Cellphone
		$this->AddSearchQueryString($sQry, $CCMStudents->EmailAddress); // EmailAddress
		$this->AddSearchQueryString($sQry, $CCMStudents->WorkAddress); // WorkAddress
		$this->AddSearchQueryString($sQry, $CCMStudents->PostalAddress); // PostalAddress
		$this->AddSearchQueryString($sQry, $CCMStudents->Department); // Department
		$this->AddSearchQueryString($sQry, $CCMStudents->Organisation); // Organisation
		$this->AddSearchQueryString($sQry, $CCMStudents->VATNo); // VATNo
		$this->AddSearchQueryString($sQry, $CCMStudents->JobTitle); // JobTitle
		$this->AddSearchQueryString($sQry, $CCMStudents->DateofBirth); // DateofBirth
		$this->AddSearchQueryString($sQry, $CCMStudents->PlaceofBirth); // PlaceofBirth
		$this->AddSearchQueryString($sQry, $CCMStudents->CountryofBirth); // CountryofBirth
		$this->AddSearchQueryString($sQry, $CCMStudents->Province); // Province
		$this->AddSearchQueryString($sQry, $CCMStudents->MaleorFemale); // MaleorFemale
		$this->AddSearchQueryString($sQry, $CCMStudents->RaceGroup); // RaceGroup
		$this->AddSearchQueryString($sQry, $CCMStudents->Disability); // Disability
		$this->AddSearchQueryString($sQry, $CCMStudents->DisabilityNature); // DisabilityNature
		$this->AddSearchQueryString($sQry, $CCMStudents->ProfessionalCouncil); // ProfessionalCouncil
		$this->AddSearchQueryString($sQry, $CCMStudents->CategoryReg); // CategoryReg
		$this->AddSearchQueryString($sQry, $CCMStudents->CouncilRegNumber); // CouncilRegNumber
		$this->AddSearchQueryString($sQry, $CCMStudents->LengthCandidateReg); // LengthCandidateReg
		$this->AddSearchQueryString($sQry, $CCMStudents->YearsToProfReg); // YearsToProfReg
		$this->AddSearchQueryString($sQry, $CCMStudents->FirstJobStart); // FirstJobStart
		$this->AddSearchQueryString($sQry, $CCMStudents->VolAssociations); // VolAssociations
		$this->AddSearchQueryString($sQry, $CCMStudents->BelongsTo); // BelongsTo
		$this->AddSearchQueryString($sQry, $CCMStudents->CESA_SABTACO_MemNum); // CESA_SABTACO_MemNum
		$this->AddSearchQueryString($sQry, $CCMStudents->AreaDiscipline); // AreaDiscipline
		$this->AddSearchQueryString($sQry, $CCMStudents->AreaSubDiscipline); // AreaSubDiscipline
		$this->AddSearchQueryString($sQry, $CCMStudents->Salary); // Salary
		$this->AddSearchQueryString($sQry, $CCMStudents->BankAccountName); // BankAccountName
		$this->AddSearchQueryString($sQry, $CCMStudents->BankAccountBank); // BankAccountBank
		$this->AddSearchQueryString($sQry, $CCMStudents->BankAccountBranch); // BankAccountBranch
		$this->AddSearchQueryString($sQry, $CCMStudents->BankAccountNo); // BankAccountNo
		$this->AddSearchQueryString($sQry, $CCMStudents->Funding); // Funding
		$this->AddSearchQueryString($sQry, $CCMStudents->CWDTP); // CWDTP
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByName); // BookedByName
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByDesignation); // BookedByDesignation
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByTelNo); // BookedByTelNo
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByFaxNo); // BookedByFaxNo
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByCellNo); // BookedByCellNo
		$this->AddSearchQueryString($sQry, $CCMStudents->BookedByEmail); // BookedByEmail
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorID); // MentorID
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorName); // MentorName
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorDesig); // MentorDesig
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorProfRegNo); // MentorProfRegNo
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorRegNo); // MentorRegNo
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorTel); // MentorTel
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorCell); // MentorCell
		$this->AddSearchQueryString($sQry, $CCMStudents->MentorEmail); // MentorEmail
		$this->AddSearchQueryString($sQry, $CCMStudents->EmployerID); // EmployerID
		$this->AddSearchQueryString($sQry, $CCMStudents->HRManagerName); // HRManagerName
		$this->AddSearchQueryString($sQry, $CCMStudents->HRManagerDesignation); // HRManagerDesignation
		$this->AddSearchQueryString($sQry, $CCMStudents->HRManagerTelNo); // HRManagerTelNo
		$this->AddSearchQueryString($sQry, $CCMStudents->HRManagerCellNo); // HRManagerCellNo
		$this->AddSearchQueryString($sQry, $CCMStudents->HRManagerEmail); // HRManagerEmail
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorName); // SupervisorName
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorDesig); // SupervisorDesig
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorProfRegNo); // SupervisorProfRegNo
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorTelNo); // SupervisorTelNo
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorCellNo); // SupervisorCellNo
		$this->AddSearchQueryString($sQry, $CCMStudents->SupervisorEmail); // SupervisorEmail
		$this->AddSearchQueryString($sQry, $CCMStudents->EducationalInst); // EducationalInst
		$this->AddSearchQueryString($sQry, $CCMStudents->Qualifications); // Qualifications
		$this->AddSearchQueryString($sQry, $CCMStudents->DateFinalExam); // DateFinalExam
		$this->AddSearchQueryString($sQry, $CCMStudents->StudentNumber); // StudentNumber
		$this->AddSearchQueryString($sQry, $CCMStudents->WebUsername); // WebUsername
		$this->AddSearchQueryString($sQry, $CCMStudents->WebPassword); // WebPassword
		$this->AddSearchQueryString($sQry, $CCMStudents->BlockAccess); // BlockAccess
		$this->AddSearchQueryString($sQry, $CCMStudents->Archived); // Archived

		// Build QueryString for pager
		$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCMStudents->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCMStudents->getStartRecordNumber();
		return $sQry;
	}

	// Add search QueryString
	function AddSearchQueryString(&$Qry, &$Fld) {
		global $CCMStudents;
		$FldParm = substr($Fld->FldVar, 2);
		$FldSearchValue = $CCMStudents->GetAdvancedSearch("x_" . $FldParm);
		if (strval($FldSearchValue) <> "") {
			$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
				"&z_" . $FldParm . "=" . $CCMStudents->GetAdvancedSearch("z_" . $FldParm);
		}
		$FldSearchValue2 = $CCMStudents->GetAdvancedSearch("y_" . $FldParm);
		if (strval($FldSearchValue2) <> "") {
			$Qry .= "&v_" . $FldParm . "=" . $CCMStudents->GetAdvancedSearch("v_" . $FldParm) .
				"&y_" . $FldParm . "=" . $FldSearchValue2 .
				"&w_" . $FldParm . "=" . $CCMStudents->GetAdvancedSearch("w_" . $FldParm);
		}
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

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

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

	}

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

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

	}

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

		// Return error message in CustomError
		return TRUE;
	}

	// ListOptions Load event
	function ListOptions_Load() {

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

	}

	// ListOptions Rendered event
	function ListOptions_Rendered() {

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

	}
}
?>