Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/ccmadmin/
Upload File :
Current File : /var/www/cesa.co.za/ccmadmin/CCMMentorsdelete.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 "CCMMentorsinfo.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
$CCMMentors_delete = new cCCMMentors_delete();
$Page =& $CCMMentors_delete;

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

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

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

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

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

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

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

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

</script>
<?php

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

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

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

	// Render row
	$CCMMentors_delete->RenderRow();
?>
	<tr<?php echo $CCMMentors->RowAttributes() ?>>
		<td<?php echo $CCMMentors->Organisation->CellAttributes() ?>>
<div<?php echo $CCMMentors->Organisation->ViewAttributes() ?>><?php echo $CCMMentors->Organisation->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->FirstName->CellAttributes() ?>>
<div<?php echo $CCMMentors->FirstName->ViewAttributes() ?>><?php echo $CCMMentors->FirstName->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Surname->CellAttributes() ?>>
<div<?php echo $CCMMentors->Surname->ViewAttributes() ?>><?php echo $CCMMentors->Surname->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Telephone->CellAttributes() ?>>
<div<?php echo $CCMMentors->Telephone->ViewAttributes() ?>><?php echo $CCMMentors->Telephone->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Cellphone->CellAttributes() ?>>
<div<?php echo $CCMMentors->Cellphone->ViewAttributes() ?>><?php echo $CCMMentors->Cellphone->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->EmailAddress->CellAttributes() ?>>
<div<?php echo $CCMMentors->EmailAddress->ViewAttributes() ?>><?php echo $CCMMentors->EmailAddress->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Designation->CellAttributes() ?>>
<div<?php echo $CCMMentors->Designation->ViewAttributes() ?>><?php echo $CCMMentors->Designation->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Prof_Reg_No->CellAttributes() ?>>
<div<?php echo $CCMMentors->Prof_Reg_No->ViewAttributes() ?>><?php echo $CCMMentors->Prof_Reg_No->ListViewValue() ?></div></td>
		<td<?php echo $CCMMentors->Reg_No->CellAttributes() ?>>
<div<?php echo $CCMMentors->Reg_No->ViewAttributes() ?>><?php echo $CCMMentors->Reg_No->ListViewValue() ?></div></td>
	</tr>
<?php
	$rs->MoveNext();
}
$rs->Close();
?>
</tbody>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("DeleteBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCMMentors_delete {

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

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

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

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

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

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

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

		// Table object (CCMMentors)
		$GLOBALS["CCMMentors"] = new cCCMMentors();

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

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

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

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

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $CCMMentors;

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

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

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

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

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

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

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

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

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

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

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

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

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

		$CCMMentors->CurrentFilter = $sFilter;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCMMentors;
		$CCMMentors->CCMMentorID->setDbValue($rs->fields('CCMMentorID'));
		$CCMMentors->Organisation->setDbValue($rs->fields('Organisation'));
		$CCMMentors->Title->setDbValue($rs->fields('Title'));
		$CCMMentors->FirstName->setDbValue($rs->fields('FirstName'));
		$CCMMentors->Surname->setDbValue($rs->fields('Surname'));
		$CCMMentors->Initials->setDbValue($rs->fields('Initials'));
		$CCMMentors->KnownAs->setDbValue($rs->fields('KnownAs'));
		$CCMMentors->IDNumber->setDbValue($rs->fields('IDNumber'));
		$CCMMentors->ProfessionalCouncil->setDbValue($rs->fields('ProfessionalCouncil'));
		$CCMMentors->CategoryReg->setDbValue($rs->fields('CategoryReg'));
		$CCMMentors->CouncilRegNumber->setDbValue($rs->fields('CouncilRegNumber'));
		$CCMMentors->Telephone->setDbValue($rs->fields('Telephone'));
		$CCMMentors->Cellphone->setDbValue($rs->fields('Cellphone'));
		$CCMMentors->EmailAddress->setDbValue($rs->fields('EmailAddress'));
		$CCMMentors->WorkAddress->setDbValue($rs->fields('WorkAddress'));
		$CCMMentors->PostalAddress->setDbValue($rs->fields('PostalAddress'));
		$CCMMentors->EducationalInst->setDbValue($rs->fields('EducationalInst'));
		$CCMMentors->Qualifications->setDbValue($rs->fields('Qualifications'));
		$CCMMentors->CVFile->setDbValue($rs->fields('CVFile'));
		$CCMMentors->MentorUndertaking->setDbValue($rs->fields('MentorUndertaking'));
		$CCMMentors->CandUUndertaking->setDbValue($rs->fields('CandUUndertaking'));
		$CCMMentors->WebUsername->setDbValue($rs->fields('WebUsername'));
		$CCMMentors->WebPassword->setDbValue($rs->fields('WebPassword'));
		$CCMMentors->BlockAccess->setDbValue($rs->fields('BlockAccess'));
		$CCMMentors->Archived->setDbValue($rs->fields('Archived'));
		$CCMMentors->Designation->setDbValue($rs->fields('Designation'));
		$CCMMentors->Prof_Reg_No->setDbValue($rs->fields('Prof Reg No'));
		$CCMMentors->Reg_No->setDbValue($rs->fields('Reg No'));
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$CCMMentors->Row_Rendering();

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

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

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

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

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

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

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

		// Designation
		$CCMMentors->Designation->CellCssStyle = ""; $CCMMentors->Designation->CellCssClass = "";
		$CCMMentors->Designation->CellAttrs = array(); $CCMMentors->Designation->ViewAttrs = array(); $CCMMentors->Designation->EditAttrs = array();

		// Prof Reg No
		$CCMMentors->Prof_Reg_No->CellCssStyle = ""; $CCMMentors->Prof_Reg_No->CellCssClass = "";
		$CCMMentors->Prof_Reg_No->CellAttrs = array(); $CCMMentors->Prof_Reg_No->ViewAttrs = array(); $CCMMentors->Prof_Reg_No->EditAttrs = array();

		// Reg No
		$CCMMentors->Reg_No->CellCssStyle = ""; $CCMMentors->Reg_No->CellCssClass = "";
		$CCMMentors->Reg_No->CellAttrs = array(); $CCMMentors->Reg_No->ViewAttrs = array(); $CCMMentors->Reg_No->EditAttrs = array();
		if ($CCMMentors->RowType == EW_ROWTYPE_VIEW) { // View row

			// CCMMentorID
			$CCMMentors->CCMMentorID->ViewValue = $CCMMentors->CCMMentorID->CurrentValue;
			$CCMMentors->CCMMentorID->CssStyle = "";
			$CCMMentors->CCMMentorID->CssClass = "";
			$CCMMentors->CCMMentorID->ViewCustomAttributes = "";

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

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

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

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

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

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

			// IDNumber
			$CCMMentors->IDNumber->ViewValue = $CCMMentors->IDNumber->CurrentValue;
			$CCMMentors->IDNumber->CssStyle = "";
			$CCMMentors->IDNumber->CssClass = "";
			$CCMMentors->IDNumber->ViewCustomAttributes = "";

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

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

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

			// Telephone
			$CCMMentors->Telephone->ViewValue = $CCMMentors->Telephone->CurrentValue;
			$CCMMentors->Telephone->CssStyle = "";
			$CCMMentors->Telephone->CssClass = "";
			$CCMMentors->Telephone->ViewCustomAttributes = "";

			// Cellphone
			$CCMMentors->Cellphone->ViewValue = $CCMMentors->Cellphone->CurrentValue;
			$CCMMentors->Cellphone->CssStyle = "";
			$CCMMentors->Cellphone->CssClass = "";
			$CCMMentors->Cellphone->ViewCustomAttributes = "";

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

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

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

			// CandUUndertaking
			$CCMMentors->CandUUndertaking->ViewValue = $CCMMentors->CandUUndertaking->CurrentValue;
			$CCMMentors->CandUUndertaking->CssStyle = "";
			$CCMMentors->CandUUndertaking->CssClass = "";
			$CCMMentors->CandUUndertaking->ViewCustomAttributes = "";

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

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

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

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

			// Designation
			$CCMMentors->Designation->ViewValue = $CCMMentors->Designation->CurrentValue;
			$CCMMentors->Designation->CssStyle = "";
			$CCMMentors->Designation->CssClass = "";
			$CCMMentors->Designation->ViewCustomAttributes = "";

			// Prof Reg No
			$CCMMentors->Prof_Reg_No->ViewValue = $CCMMentors->Prof_Reg_No->CurrentValue;
			$CCMMentors->Prof_Reg_No->CssStyle = "";
			$CCMMentors->Prof_Reg_No->CssClass = "";
			$CCMMentors->Prof_Reg_No->ViewCustomAttributes = "";

			// Reg No
			$CCMMentors->Reg_No->ViewValue = $CCMMentors->Reg_No->CurrentValue;
			$CCMMentors->Reg_No->CssStyle = "";
			$CCMMentors->Reg_No->CssClass = "";
			$CCMMentors->Reg_No->ViewCustomAttributes = "";

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

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

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

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

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

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

			// Designation
			$CCMMentors->Designation->HrefValue = "";
			$CCMMentors->Designation->TooltipValue = "";

			// Prof Reg No
			$CCMMentors->Prof_Reg_No->HrefValue = "";
			$CCMMentors->Prof_Reg_No->TooltipValue = "";

			// Reg No
			$CCMMentors->Reg_No->HrefValue = "";
			$CCMMentors->Reg_No->TooltipValue = "";
		}

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

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

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

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

	}

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

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

	}
}
?>