Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/echasl23/
Upload File :
Current File : /var/www/cesa.co.za/echasl23/CPDProviderDocsview.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 "CPDProviderDocsinfo.php" ?>
<?php include "adminusersinfo.php" ?>
<?php include "CPDServiceProviderinfo.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
$CPDProviderDocs_view = new cCPDProviderDocs_view();
$Page =& $CPDProviderDocs_view;

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

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

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

// page properties
CPDProviderDocs_view.PageID = "view"; // page ID
CPDProviderDocs_view.FormID = "fCPDProviderDocsview"; // form ID
var EW_PAGE_ID = CPDProviderDocs_view.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
CPDProviderDocs_view.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) { ?>
CPDProviderDocs_view.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CPDProviderDocs_view.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 } ?>
<p><span class="phpmaker"><?php echo $Language->Phrase("View") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CPDProviderDocs->TableCaption() ?>
<?php if ($CPDProviderDocs->Export == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $CPDProviderDocs_view->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 $CPDProviderDocs_view->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 $CPDProviderDocs_view->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_CPDProviderDocs" id="emf_CPDProviderDocs" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CPDProviderDocs',hdr:ewLanguage.Phrase('ExportToEmail'),key:<?php echo ew_ArrayToJsonAttr($CPDProviderDocs_view->arRecKey) ?>,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 } ?>
<br><br>
<?php if ($CPDProviderDocs->Export == "") { ?>
<a href="<?php echo $CPDProviderDocs_view->ListUrl ?>"><?php echo $Language->Phrase("BackToList") ?></a>&nbsp;
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CPDProviderDocs_view->AddUrl ?>"><?php echo $Language->Phrase("ViewPageAddLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<a href="<?php echo $CPDProviderDocs_view->EditUrl ?>"><?php echo $Language->Phrase("ViewPageEditLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanDelete()) { ?>
<a href="<?php echo $CPDProviderDocs_view->DeleteUrl ?>"><?php echo $Language->Phrase("ViewPageDeleteLink") ?></a>&nbsp;
<?php } ?>
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CPDProviderDocs_view->ShowMessage();
?>
<p>
<?php if ($CPDProviderDocs->Export == "") { ?>
<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($CPDProviderDocs_view->Pager)) $CPDProviderDocs_view->Pager = new cPrevNextPager($CPDProviderDocs_view->lStartRec, $CPDProviderDocs_view->lDisplayRecs, $CPDProviderDocs_view->lTotalRecs) ?>
<?php if ($CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 $CPDProviderDocs_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CPDProviderDocs_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 $CPDProviderDocs_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CPDProviderDocs_view->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>
<br>
<?php } ?>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CPDProviderDocs->CPDProviderDocID->Visible) { // CPDProviderDocID ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->CPDProviderDocID->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->CPDProviderDocID->CellAttributes() ?>>
<div<?php echo $CPDProviderDocs->CPDProviderDocID->ViewAttributes() ?>><?php echo $CPDProviderDocs->CPDProviderDocID->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CPDProviderDocs->CPDProviderID->Visible) { // CPDProviderID ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->CPDProviderID->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->CPDProviderID->CellAttributes() ?>>
<div<?php echo $CPDProviderDocs->CPDProviderID->ViewAttributes() ?>><?php echo $CPDProviderDocs->CPDProviderID->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CPDProviderDocs->DocType->Visible) { // DocType ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->DocType->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->DocType->CellAttributes() ?>>
<div<?php echo $CPDProviderDocs->DocType->ViewAttributes() ?>><?php echo $CPDProviderDocs->DocType->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CPDProviderDocs->DocFile->Visible) { // DocFile ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->DocFile->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->DocFile->CellAttributes() ?>>
<?php if ($CPDProviderDocs->DocFile->HrefValue <> "" || $CPDProviderDocs->DocFile->TooltipValue <> "") { ?>
<?php if (!empty($CPDProviderDocs->DocFile->Upload->DbValue)) { ?>
<a href="<?php echo $CPDProviderDocs->DocFile->HrefValue ?>" target="_blank"><?php echo $CPDProviderDocs->DocFile->ViewValue ?></a>
<?php } elseif (!in_array($CPDProviderDocs->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CPDProviderDocs->DocFile->Upload->DbValue)) { ?>
<?php echo $CPDProviderDocs->DocFile->ViewValue ?>
<?php } elseif (!in_array($CPDProviderDocs->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</td>
	</tr>
<?php } ?>
<?php if ($CPDProviderDocs->UploadedBy->Visible) { // UploadedBy ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->UploadedBy->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->UploadedBy->CellAttributes() ?>>
<div<?php echo $CPDProviderDocs->UploadedBy->ViewAttributes() ?>><?php echo $CPDProviderDocs->UploadedBy->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CPDProviderDocs->DateUploaded->Visible) { // DateUploaded ?>
	<tr<?php echo $CPDProviderDocs->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CPDProviderDocs->DateUploaded->FldCaption() ?></td>
		<td<?php echo $CPDProviderDocs->DateUploaded->CellAttributes() ?>>
<div<?php echo $CPDProviderDocs->DateUploaded->ViewAttributes() ?>><?php echo $CPDProviderDocs->DateUploaded->ViewValue ?></div></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<?php if ($CPDProviderDocs->Export == "") { ?>
<br>
<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($CPDProviderDocs_view->Pager)) $CPDProviderDocs_view->Pager = new cPrevNextPager($CPDProviderDocs_view->lStartRec, $CPDProviderDocs_view->lDisplayRecs, $CPDProviderDocs_view->lTotalRecs) ?>
<?php if ($CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 $CPDProviderDocs_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CPDProviderDocs_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 ($CPDProviderDocs_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CPDProviderDocs_view->PageUrl() ?>start=<?php echo $CPDProviderDocs_view->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 $CPDProviderDocs_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CPDProviderDocs_view->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 } ?>
<p>
<?php if ($CPDProviderDocs->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
$CPDProviderDocs_view->Page_Terminate();
?>
<?php

//
// Page class
//
class cCPDProviderDocs_view {

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

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

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

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

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

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

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

		// Table object (CPDProviderDocs)
		$GLOBALS["CPDProviderDocs"] = new cCPDProviderDocs();

		// Table object (adminusers)
		$GLOBALS['adminusers'] = new cadminusers();

		// Table object (CPDServiceProvider)
		$GLOBALS['CPDServiceProvider'] = new cCPDServiceProvider();

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

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

		// 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->CanView()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CPDProviderDocslist.php");
		}
		$Security->UserID_Loading();
		if ($Security->IsLoggedIn()) $Security->LoadUserID();
		$Security->UserID_Loaded();

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$CPDProviderDocs->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$CPDProviderDocs->Export = $_POST["exporttype"];
		} else {
			$CPDProviderDocs->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $CPDProviderDocs->Export; // Get export parameter, used in header
		$gsExportFile = $CPDProviderDocs->TableVar; // Get export file, used in header
		if (@$_GET["CPDProviderDocID"] <> "") {
			if ($gsExportFile <> "") $gsExportFile .= "_";
			$gsExportFile .= ew_StripSlashes($_GET["CPDProviderDocID"]);
		}
		if ($CPDProviderDocs->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($CPDProviderDocs->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();
	}
	var $lDisplayRecs = 1;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $lRecCnt;
	var $arRecKey = array();

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

		// Load current record
		$bLoadCurrentRecord = FALSE;
		$sReturnUrl = "";
		$bMatchRecord = FALSE;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET["CPDProviderDocID"] <> "") {
				$CPDProviderDocs->CPDProviderDocID->setQueryStringValue($_GET["CPDProviderDocID"]);
				$this->arRecKey["CPDProviderDocID"] = $CPDProviderDocs->CPDProviderDocID->QueryStringValue;
			} else {
				$bLoadCurrentRecord = TRUE;
			}

			// Get action
			$CPDProviderDocs->CurrentAction = "I"; // Display form
			switch ($CPDProviderDocs->CurrentAction) {
				case "I": // Get a record to display
					$this->lStartRec = 1; // Initialize start position
					if ($rs = $this->LoadRecordset()) // Load records
						$this->lTotalRecs = $rs->RecordCount(); // Get record count
					if ($this->lTotalRecs <= 0) { // No record found
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$this->Page_Terminate("CPDProviderDocslist.php"); // Return to list page
					} elseif ($bLoadCurrentRecord) { // Load current record position
						$this->SetUpStartRec(); // Set up start record position

						// Point to current record
						if (intval($this->lStartRec) <= intval($this->lTotalRecs)) {
							$bMatchRecord = TRUE;
							$rs->Move($this->lStartRec-1);
						}
					} else { // Match key values
						while (!$rs->EOF) {
							if (strval($CPDProviderDocs->CPDProviderDocID->CurrentValue) == strval($rs->fields('CPDProviderDocID'))) {
								$CPDProviderDocs->setStartRecordNumber($this->lStartRec); // Save record position
								$bMatchRecord = TRUE;
								break;
							} else {
								$this->lStartRec++;
								$rs->MoveNext();
							}
						}
					}
					if (!$bMatchRecord) {
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$sReturnUrl = "CPDProviderDocslist.php"; // No matching record, return to list
					} else {
						$this->LoadRowValues($rs); // Load row values
					}
			}

			// Export data only
			if (in_array($CPDProviderDocs->Export, array("html","word","excel","xml","csv","email"))) {
				$this->ExportData();
				if ($CPDProviderDocs->Export <> "email")
					$this->Page_Terminate(); // Terminate response
				exit();
			}
		} else {
			$sReturnUrl = "CPDProviderDocslist.php"; // Not page request, return to list
		}
		if ($sReturnUrl <> "")
			$this->Page_Terminate($sReturnUrl);

		// Render row
		$CPDProviderDocs->RowType = EW_ROWTYPE_VIEW;
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $CPDProviderDocs;
		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];
				$CPDProviderDocs->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;
					}
					$CPDProviderDocs->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $CPDProviderDocs->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
			$CPDProviderDocs->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
			$CPDProviderDocs->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
			$CPDProviderDocs->setStartRecordNumber($this->lStartRec);
		}
	}

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CPDProviderDocs;
		$CPDProviderDocs->CPDProviderDocID->setDbValue($rs->fields('CPDProviderDocID'));
		$CPDProviderDocs->CPDProviderID->setDbValue($rs->fields('CPDProviderID'));
		$CPDProviderDocs->DocType->setDbValue($rs->fields('DocType'));
		$CPDProviderDocs->DocFile->Upload->DbValue = $rs->fields('DocFile');
		$CPDProviderDocs->UploadedBy->setDbValue($rs->fields('UploadedBy'));
		$CPDProviderDocs->DateUploaded->setDbValue($rs->fields('DateUploaded'));
	}

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

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->ExportWordUrl = $this->PageUrl() . "export=word&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv&" . "CPDProviderDocID=" . urlencode($CPDProviderDocs->CPDProviderDocID->CurrentValue);
		$this->AddUrl = $CPDProviderDocs->AddUrl();
		$this->EditUrl = $CPDProviderDocs->EditUrl();
		$this->CopyUrl = $CPDProviderDocs->CopyUrl();
		$this->DeleteUrl = $CPDProviderDocs->DeleteUrl();
		$this->ListUrl = $CPDProviderDocs->ListUrl();

		// Call Row_Rendering event
		$CPDProviderDocs->Row_Rendering();

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

		$CPDProviderDocs->CPDProviderDocID->CellCssStyle = ""; $CPDProviderDocs->CPDProviderDocID->CellCssClass = "";
		$CPDProviderDocs->CPDProviderDocID->CellAttrs = array(); $CPDProviderDocs->CPDProviderDocID->ViewAttrs = array(); $CPDProviderDocs->CPDProviderDocID->EditAttrs = array();

		// CPDProviderID
		$CPDProviderDocs->CPDProviderID->CellCssStyle = ""; $CPDProviderDocs->CPDProviderID->CellCssClass = "";
		$CPDProviderDocs->CPDProviderID->CellAttrs = array(); $CPDProviderDocs->CPDProviderID->ViewAttrs = array(); $CPDProviderDocs->CPDProviderID->EditAttrs = array();

		// DocType
		$CPDProviderDocs->DocType->CellCssStyle = ""; $CPDProviderDocs->DocType->CellCssClass = "";
		$CPDProviderDocs->DocType->CellAttrs = array(); $CPDProviderDocs->DocType->ViewAttrs = array(); $CPDProviderDocs->DocType->EditAttrs = array();

		// DocFile
		$CPDProviderDocs->DocFile->CellCssStyle = ""; $CPDProviderDocs->DocFile->CellCssClass = "";
		$CPDProviderDocs->DocFile->CellAttrs = array(); $CPDProviderDocs->DocFile->ViewAttrs = array(); $CPDProviderDocs->DocFile->EditAttrs = array();

		// UploadedBy
		$CPDProviderDocs->UploadedBy->CellCssStyle = ""; $CPDProviderDocs->UploadedBy->CellCssClass = "";
		$CPDProviderDocs->UploadedBy->CellAttrs = array(); $CPDProviderDocs->UploadedBy->ViewAttrs = array(); $CPDProviderDocs->UploadedBy->EditAttrs = array();

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

			// CPDProviderDocID
			$CPDProviderDocs->CPDProviderDocID->ViewValue = $CPDProviderDocs->CPDProviderDocID->CurrentValue;
			$CPDProviderDocs->CPDProviderDocID->CssStyle = "";
			$CPDProviderDocs->CPDProviderDocID->CssClass = "";
			$CPDProviderDocs->CPDProviderDocID->ViewCustomAttributes = "";

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

			// DocType
			if (strval($CPDProviderDocs->DocType->CurrentValue) <> "") {
				$sFilterWrk = "`PicklistValue` = '" . ew_AdjustSql($CPDProviderDocs->DocType->CurrentValue) . "'";
			$sSqlWrk = "SELECT `PicklistValue` FROM `Picklists`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "PicklistType='CPD Provider Documents'" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `PicklistValue`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CPDProviderDocs->DocType->ViewValue = $rswrk->fields('PicklistValue');
					$rswrk->Close();
				} else {
					$CPDProviderDocs->DocType->ViewValue = $CPDProviderDocs->DocType->CurrentValue;
				}
			} else {
				$CPDProviderDocs->DocType->ViewValue = NULL;
			}
			$CPDProviderDocs->DocType->CssStyle = "";
			$CPDProviderDocs->DocType->CssClass = "";
			$CPDProviderDocs->DocType->ViewCustomAttributes = "";

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

			// UploadedBy
			$CPDProviderDocs->UploadedBy->ViewValue = $CPDProviderDocs->UploadedBy->CurrentValue;
			$CPDProviderDocs->UploadedBy->CssStyle = "";
			$CPDProviderDocs->UploadedBy->CssClass = "";
			$CPDProviderDocs->UploadedBy->ViewCustomAttributes = "";

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

			// CPDProviderDocID
			$CPDProviderDocs->CPDProviderDocID->HrefValue = "";
			$CPDProviderDocs->CPDProviderDocID->TooltipValue = "";

			// CPDProviderID
			$CPDProviderDocs->CPDProviderID->HrefValue = "";
			$CPDProviderDocs->CPDProviderID->TooltipValue = "";

			// DocType
			$CPDProviderDocs->DocType->HrefValue = "";
			$CPDProviderDocs->DocType->TooltipValue = "";

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

			// UploadedBy
			$CPDProviderDocs->UploadedBy->HrefValue = "";
			$CPDProviderDocs->UploadedBy->TooltipValue = "";

			// DateUploaded
			$CPDProviderDocs->DateUploaded->HrefValue = "";
			$CPDProviderDocs->DateUploaded->TooltipValue = "";
		}

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

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

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $CPDProviderDocs->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;
		$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 (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($CPDProviderDocs->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($CPDProviderDocs, "v");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($CPDProviderDocs->CPDProviderDocID);
				$ExportDoc->ExportCaption($CPDProviderDocs->CPDProviderID);
				$ExportDoc->ExportCaption($CPDProviderDocs->DocType);
				$ExportDoc->ExportCaption($CPDProviderDocs->DocFile);
				$ExportDoc->ExportCaption($CPDProviderDocs->UploadedBy);
				$ExportDoc->ExportCaption($CPDProviderDocs->DateUploaded);
				$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
				$CPDProviderDocs->CssClass = "";
				$CPDProviderDocs->CssStyle = "";
				$CPDProviderDocs->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($CPDProviderDocs->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('CPDProviderDocID', $CPDProviderDocs->CPDProviderDocID->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
					$XmlDoc->AddField('CPDProviderID', $CPDProviderDocs->CPDProviderID->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
					$XmlDoc->AddField('DocType', $CPDProviderDocs->DocType->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
					$XmlDoc->AddField('DocFile', $CPDProviderDocs->DocFile->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
					$XmlDoc->AddField('UploadedBy', $CPDProviderDocs->UploadedBy->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
					$XmlDoc->AddField('DateUploaded', $CPDProviderDocs->DateUploaded->ExportValue($CPDProviderDocs->Export, $CPDProviderDocs->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($CPDProviderDocs->CPDProviderDocID);
					$ExportDoc->ExportField($CPDProviderDocs->CPDProviderID);
					$ExportDoc->ExportField($CPDProviderDocs->DocType);
					$ExportDoc->ExportField($CPDProviderDocs->DocFile);
					$ExportDoc->ExportField($CPDProviderDocs->UploadedBy);
					$ExportDoc->ExportField($CPDProviderDocs->DateUploaded);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($CPDProviderDocs->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($CPDProviderDocs->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

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

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

	// Export email
	function ExportEmail($EmailContent) {
		global $Language, $CPDProviderDocs;
		$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 ($CPDProviderDocs->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 $CPDProviderDocs;

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

		// Add record key QueryString
		$sQry .= "&" . substr($CPDProviderDocs->KeyUrl("", ""), 1);
		return $sQry;
	}

	// 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";

	}
}
?>