| Current Path : /var/www/cesa.co.za/echasl23/ |
| Current File : /var/www/cesa.co.za/echasl23/Applicationsview.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 "Applicationsinfo.php" ?>
<?php include "adminusersinfo.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
$Applications_view = new cApplications_view();
$Page =& $Applications_view;
// Page init
$Applications_view->Page_Init();
// Page main
$Applications_view->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($Applications->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var Applications_view = new ew_Page("Applications_view");
// page properties
Applications_view.PageID = "view"; // page ID
Applications_view.FormID = "fApplicationsview"; // form ID
var EW_PAGE_ID = Applications_view.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
Applications_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) { ?>
Applications_view.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
Applications_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") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $Applications->TableCaption() ?>
<?php if ($Applications->Export == "") { ?>
<a href="<?php echo $Applications_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>
<a href="<?php echo $Applications_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>
<a href="<?php echo $Applications_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>
<a name="emf_Applications" id="emf_Applications" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_Applications',hdr:ewLanguage.Phrase('ExportToEmail'),key:<?php echo ew_ArrayToJsonAttr($Applications_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 ($Applications->Export == "") { ?>
<a href="<?php echo $Applications_view->ListUrl ?>"><?php echo $Language->Phrase("BackToList") ?></a>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $Applications_view->AddUrl ?>"><?php echo $Language->Phrase("ViewPageAddLink") ?></a>
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<a href="<?php echo $Applications_view->EditUrl ?>"><?php echo $Language->Phrase("ViewPageEditLink") ?></a>
<?php } ?>
<?php if ($Security->CanDelete()) { ?>
<a href="<?php echo $Applications_view->DeleteUrl ?>"><?php echo $Language->Phrase("ViewPageDeleteLink") ?></a>
<?php } ?>
<?php if ($Security->AllowList('ApplicationCVs')) { ?>
<a href="ApplicationCVslist.php?<?php echo EW_TABLE_SHOW_MASTER ?>=Applications&ApplicationID=<?php echo urlencode(strval($Applications->ApplicationID->CurrentValue)) ?>"><?php echo $Language->Phrase("ViewPageDetailLink") ?><?php echo $Language->TablePhrase("ApplicationCVs", "TblCaption") ?>
</a>
<?php } ?>
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$Applications_view->ShowMessage();
?>
<p>
<?php if ($Applications->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($Applications_view->Pager)) $Applications_view->Pager = new cPrevNextPager($Applications_view->lStartRec, $Applications_view->lDisplayRecs, $Applications_view->lTotalRecs) ?>
<?php if ($Applications_view->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($Applications_view->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 ($Applications_view->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 $Applications_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($Applications_view->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 ($Applications_view->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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"> <?php echo $Language->Phrase("of") ?> <?php echo $Applications_view->Pager->PageCount ?></span></td>
</tr></table>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($Applications_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 ($Applications->ApplicationID->Visible) { // ApplicationID ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->ApplicationID->FldCaption() ?></td>
<td<?php echo $Applications->ApplicationID->CellAttributes() ?>>
<div<?php echo $Applications->ApplicationID->ViewAttributes() ?>><?php echo $Applications->ApplicationID->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->FirmName->Visible) { // FirmName ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->FirmName->FldCaption() ?></td>
<td<?php echo $Applications->FirmName->CellAttributes() ?>>
<div<?php echo $Applications->FirmName->ViewAttributes() ?>><?php echo $Applications->FirmName->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->PhysicalAddress->Visible) { // PhysicalAddress ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->PhysicalAddress->FldCaption() ?></td>
<td<?php echo $Applications->PhysicalAddress->CellAttributes() ?>>
<div<?php echo $Applications->PhysicalAddress->ViewAttributes() ?>><?php echo $Applications->PhysicalAddress->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->FoundingDate->Visible) { // FoundingDate ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->FoundingDate->FldCaption() ?></td>
<td<?php echo $Applications->FoundingDate->CellAttributes() ?>>
<div<?php echo $Applications->FoundingDate->ViewAttributes() ?>><?php echo $Applications->FoundingDate->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->VATNumber->Visible) { // VATNumber ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->VATNumber->FldCaption() ?></td>
<td<?php echo $Applications->VATNumber->CellAttributes() ?>>
<div<?php echo $Applications->VATNumber->ViewAttributes() ?>><?php echo $Applications->VATNumber->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->AppForm->Visible) { // AppForm ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->AppForm->FldCaption() ?></td>
<td<?php echo $Applications->AppForm->CellAttributes() ?>>
<?php if ($Applications->AppForm->HrefValue <> "" || $Applications->AppForm->TooltipValue <> "") { ?>
<?php if (!empty($Applications->AppForm->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->AppForm->HrefValue ?>"><?php echo $Applications->AppForm->ViewValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->AppForm->Upload->DbValue)) { ?>
<?php echo $Applications->AppForm->ViewValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($Applications->CIPCReg->Visible) { // CIPCReg ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->CIPCReg->FldCaption() ?></td>
<td<?php echo $Applications->CIPCReg->CellAttributes() ?>>
<?php if ($Applications->CIPCReg->HrefValue <> "" || $Applications->CIPCReg->TooltipValue <> "") { ?>
<?php if (!empty($Applications->CIPCReg->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->CIPCReg->HrefValue ?>"><?php echo $Applications->CIPCReg->ViewValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->CIPCReg->Upload->DbValue)) { ?>
<?php echo $Applications->CIPCReg->ViewValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($Applications->MPRes->Visible) { // MPRes ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->MPRes->FldCaption() ?></td>
<td<?php echo $Applications->MPRes->CellAttributes() ?>>
<?php if ($Applications->MPRes->HrefValue <> "" || $Applications->MPRes->TooltipValue <> "") { ?>
<?php if (!empty($Applications->MPRes->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->MPRes->HrefValue ?>"><?php echo $Applications->MPRes->ViewValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->MPRes->Upload->DbValue)) { ?>
<?php echo $Applications->MPRes->ViewValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($Applications->PIInsurance->Visible) { // PIInsurance ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->PIInsurance->FldCaption() ?></td>
<td<?php echo $Applications->PIInsurance->CellAttributes() ?>>
<?php if ($Applications->PIInsurance->HrefValue <> "" || $Applications->PIInsurance->TooltipValue <> "") { ?>
<?php if (!empty($Applications->PIInsurance->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->PIInsurance->HrefValue ?>"><?php echo $Applications->PIInsurance->ViewValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->PIInsurance->Upload->DbValue)) { ?>
<?php echo $Applications->PIInsurance->ViewValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($Applications->Letterhead->Visible) { // Letterhead ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Letterhead->FldCaption() ?></td>
<td<?php echo $Applications->Letterhead->CellAttributes() ?>>
<?php if ($Applications->Letterhead->HrefValue <> "" || $Applications->Letterhead->TooltipValue <> "") { ?>
<?php if (!empty($Applications->Letterhead->Upload->DbValue)) { ?>
<a href="<?php echo $Applications->Letterhead->HrefValue ?>"><?php echo $Applications->Letterhead->ViewValue ?></a>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } else { ?>
<?php if (!empty($Applications->Letterhead->Upload->DbValue)) { ?>
<?php echo $Applications->Letterhead->ViewValue ?>
<?php } elseif (!in_array($Applications->CurrentAction, array("I", "edit", "gridedit"))) { ?>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($Applications->DateCreated->Visible) { // DateCreated ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->DateCreated->FldCaption() ?></td>
<td<?php echo $Applications->DateCreated->CellAttributes() ?>>
<div<?php echo $Applications->DateCreated->ViewAttributes() ?>><?php echo $Applications->DateCreated->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->Status->Visible) { // Status ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Status->FldCaption() ?></td>
<td<?php echo $Applications->Status->CellAttributes() ?>>
<div<?php echo $Applications->Status->ViewAttributes() ?>><?php echo $Applications->Status->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->DateApproved->Visible) { // DateApproved ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->DateApproved->FldCaption() ?></td>
<td<?php echo $Applications->DateApproved->CellAttributes() ?>>
<div<?php echo $Applications->DateApproved->ViewAttributes() ?>><?php echo $Applications->DateApproved->ViewValue ?></div></td>
</tr>
<?php } ?>
<?php if ($Applications->Comments->Visible) { // Comments ?>
<tr<?php echo $Applications->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Applications->Comments->FldCaption() ?></td>
<td<?php echo $Applications->Comments->CellAttributes() ?>>
<div<?php echo $Applications->Comments->ViewAttributes() ?>><?php echo $Applications->Comments->ViewValue ?></div></td>
</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<?php if ($Applications->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($Applications_view->Pager)) $Applications_view->Pager = new cPrevNextPager($Applications_view->lStartRec, $Applications_view->lDisplayRecs, $Applications_view->lTotalRecs) ?>
<?php if ($Applications_view->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($Applications_view->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 ($Applications_view->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 $Applications_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($Applications_view->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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 ($Applications_view->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $Applications_view->PageUrl() ?>start=<?php echo $Applications_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"> <?php echo $Language->Phrase("of") ?> <?php echo $Applications_view->Pager->PageCount ?></span></td>
</tr></table>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($Applications_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 ($Applications->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
$Applications_view->Page_Terminate();
?>
<?php
//
// Page class
//
class cApplications_view {
// Page ID
var $PageID = 'view';
// Table name
var $TableName = 'Applications';
// Page object name
var $PageObjName = 'Applications_view';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $Applications;
if ($Applications->UseTokenInUrl) $PageUrl .= "t=" . $Applications->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, $Applications;
if ($Applications->UseTokenInUrl) {
if ($objForm)
return ($Applications->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($Applications->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (Applications)
$GLOBALS["Applications"] = new cApplications();
// Table object (adminusers)
$GLOBALS['adminusers'] = new cadminusers();
// 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", 'Applications', 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 $Applications;
// 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("Applicationslist.php");
}
$Security->UserID_Loading();
if ($Security->IsLoggedIn()) $Security->LoadUserID();
$Security->UserID_Loaded();
// Get export parameters
if (@$_GET["export"] <> "") {
$Applications->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$Applications->Export = $_POST["exporttype"];
} else {
$Applications->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $Applications->Export; // Get export parameter, used in header
$gsExportFile = $Applications->TableVar; // Get export file, used in header
if (@$_GET["ApplicationID"] <> "") {
if ($gsExportFile <> "") $gsExportFile .= "_";
$gsExportFile .= ew_StripSlashes($_GET["ApplicationID"]);
}
if ($Applications->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($Applications->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, $Applications;
// Load current record
$bLoadCurrentRecord = FALSE;
$sReturnUrl = "";
$bMatchRecord = FALSE;
if ($this->IsPageRequest()) { // Validate request
if (@$_GET["ApplicationID"] <> "") {
$Applications->ApplicationID->setQueryStringValue($_GET["ApplicationID"]);
$this->arRecKey["ApplicationID"] = $Applications->ApplicationID->QueryStringValue;
} else {
$bLoadCurrentRecord = TRUE;
}
// Get action
$Applications->CurrentAction = "I"; // Display form
switch ($Applications->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("Applicationslist.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($Applications->ApplicationID->CurrentValue) == strval($rs->fields('ApplicationID'))) {
$Applications->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 = "Applicationslist.php"; // No matching record, return to list
} else {
$this->LoadRowValues($rs); // Load row values
}
}
// Export data only
if (in_array($Applications->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($Applications->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
} else {
$sReturnUrl = "Applicationslist.php"; // Not page request, return to list
}
if ($sReturnUrl <> "")
$this->Page_Terminate($sReturnUrl);
// Render row
$Applications->RowType = EW_ROWTYPE_VIEW;
$this->RenderRow();
}
// Set up starting record parameters
function SetUpStartRec() {
global $Applications;
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];
$Applications->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;
}
$Applications->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $Applications->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
$Applications->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
$Applications->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
$Applications->setStartRecordNumber($this->lStartRec);
}
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $Applications;
// Call Recordset Selecting event
$Applications->Recordset_Selecting($Applications->CurrentFilter);
// Load List page SQL
$sSql = $Applications->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$Applications->Recordset_Selected($rs);
return $rs;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $Applications;
$sFilter = $Applications->KeyFilter();
// Call Row Selecting event
$Applications->Row_Selecting($sFilter);
// Load SQL based on filter
$Applications->CurrentFilter = $sFilter;
$sSql = $Applications->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$Applications->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $Applications;
$Applications->ApplicationID->setDbValue($rs->fields('ApplicationID'));
$Applications->FirmName->setDbValue($rs->fields('FirmName'));
$Applications->PhysicalAddress->setDbValue($rs->fields('PhysicalAddress'));
$Applications->FoundingDate->setDbValue($rs->fields('FoundingDate'));
$Applications->VATNumber->setDbValue($rs->fields('VATNumber'));
$Applications->AppForm->Upload->DbValue = $rs->fields('AppForm');
$Applications->CIPCReg->Upload->DbValue = $rs->fields('CIPCReg');
$Applications->MPRes->Upload->DbValue = $rs->fields('MPRes');
$Applications->PIInsurance->Upload->DbValue = $rs->fields('PIInsurance');
$Applications->Letterhead->Upload->DbValue = $rs->fields('Letterhead');
$Applications->DateCreated->setDbValue($rs->fields('DateCreated'));
$Applications->Status->setDbValue($rs->fields('Status'));
$Applications->DateApproved->setDbValue($rs->fields('DateApproved'));
$Applications->Comments->setDbValue($rs->fields('Comments'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $Applications;
// Initialize URLs
$this->ExportPrintUrl = $this->PageUrl() . "export=print&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->ExportHtmlUrl = $this->PageUrl() . "export=html&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->ExportExcelUrl = $this->PageUrl() . "export=excel&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->ExportWordUrl = $this->PageUrl() . "export=word&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->ExportXmlUrl = $this->PageUrl() . "export=xml&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->ExportCsvUrl = $this->PageUrl() . "export=csv&" . "ApplicationID=" . urlencode($Applications->ApplicationID->CurrentValue);
$this->AddUrl = $Applications->AddUrl();
$this->EditUrl = $Applications->EditUrl();
$this->CopyUrl = $Applications->CopyUrl();
$this->DeleteUrl = $Applications->DeleteUrl();
$this->ListUrl = $Applications->ListUrl();
// Call Row_Rendering event
$Applications->Row_Rendering();
// Common render codes for all row types
// ApplicationID
$Applications->ApplicationID->CellCssStyle = ""; $Applications->ApplicationID->CellCssClass = "";
$Applications->ApplicationID->CellAttrs = array(); $Applications->ApplicationID->ViewAttrs = array(); $Applications->ApplicationID->EditAttrs = array();
// FirmName
$Applications->FirmName->CellCssStyle = ""; $Applications->FirmName->CellCssClass = "";
$Applications->FirmName->CellAttrs = array(); $Applications->FirmName->ViewAttrs = array(); $Applications->FirmName->EditAttrs = array();
// PhysicalAddress
$Applications->PhysicalAddress->CellCssStyle = ""; $Applications->PhysicalAddress->CellCssClass = "";
$Applications->PhysicalAddress->CellAttrs = array(); $Applications->PhysicalAddress->ViewAttrs = array(); $Applications->PhysicalAddress->EditAttrs = array();
// FoundingDate
$Applications->FoundingDate->CellCssStyle = ""; $Applications->FoundingDate->CellCssClass = "";
$Applications->FoundingDate->CellAttrs = array(); $Applications->FoundingDate->ViewAttrs = array(); $Applications->FoundingDate->EditAttrs = array();
// VATNumber
$Applications->VATNumber->CellCssStyle = ""; $Applications->VATNumber->CellCssClass = "";
$Applications->VATNumber->CellAttrs = array(); $Applications->VATNumber->ViewAttrs = array(); $Applications->VATNumber->EditAttrs = array();
// AppForm
$Applications->AppForm->CellCssStyle = ""; $Applications->AppForm->CellCssClass = "";
$Applications->AppForm->CellAttrs = array(); $Applications->AppForm->ViewAttrs = array(); $Applications->AppForm->EditAttrs = array();
// CIPCReg
$Applications->CIPCReg->CellCssStyle = ""; $Applications->CIPCReg->CellCssClass = "";
$Applications->CIPCReg->CellAttrs = array(); $Applications->CIPCReg->ViewAttrs = array(); $Applications->CIPCReg->EditAttrs = array();
// MPRes
$Applications->MPRes->CellCssStyle = ""; $Applications->MPRes->CellCssClass = "";
$Applications->MPRes->CellAttrs = array(); $Applications->MPRes->ViewAttrs = array(); $Applications->MPRes->EditAttrs = array();
// PIInsurance
$Applications->PIInsurance->CellCssStyle = ""; $Applications->PIInsurance->CellCssClass = "";
$Applications->PIInsurance->CellAttrs = array(); $Applications->PIInsurance->ViewAttrs = array(); $Applications->PIInsurance->EditAttrs = array();
// Letterhead
$Applications->Letterhead->CellCssStyle = ""; $Applications->Letterhead->CellCssClass = "";
$Applications->Letterhead->CellAttrs = array(); $Applications->Letterhead->ViewAttrs = array(); $Applications->Letterhead->EditAttrs = array();
// DateCreated
$Applications->DateCreated->CellCssStyle = ""; $Applications->DateCreated->CellCssClass = "";
$Applications->DateCreated->CellAttrs = array(); $Applications->DateCreated->ViewAttrs = array(); $Applications->DateCreated->EditAttrs = array();
// Status
$Applications->Status->CellCssStyle = ""; $Applications->Status->CellCssClass = "";
$Applications->Status->CellAttrs = array(); $Applications->Status->ViewAttrs = array(); $Applications->Status->EditAttrs = array();
// DateApproved
$Applications->DateApproved->CellCssStyle = ""; $Applications->DateApproved->CellCssClass = "";
$Applications->DateApproved->CellAttrs = array(); $Applications->DateApproved->ViewAttrs = array(); $Applications->DateApproved->EditAttrs = array();
// Comments
$Applications->Comments->CellCssStyle = ""; $Applications->Comments->CellCssClass = "";
$Applications->Comments->CellAttrs = array(); $Applications->Comments->ViewAttrs = array(); $Applications->Comments->EditAttrs = array();
if ($Applications->RowType == EW_ROWTYPE_VIEW) { // View row
// ApplicationID
$Applications->ApplicationID->ViewValue = $Applications->ApplicationID->CurrentValue;
$Applications->ApplicationID->CssStyle = "";
$Applications->ApplicationID->CssClass = "";
$Applications->ApplicationID->ViewCustomAttributes = "";
// FirmName
$Applications->FirmName->ViewValue = $Applications->FirmName->CurrentValue;
$Applications->FirmName->CssStyle = "";
$Applications->FirmName->CssClass = "";
$Applications->FirmName->ViewCustomAttributes = "";
// PhysicalAddress
$Applications->PhysicalAddress->ViewValue = $Applications->PhysicalAddress->CurrentValue;
$Applications->PhysicalAddress->CssStyle = "";
$Applications->PhysicalAddress->CssClass = "";
$Applications->PhysicalAddress->ViewCustomAttributes = "";
// FoundingDate
$Applications->FoundingDate->ViewValue = $Applications->FoundingDate->CurrentValue;
$Applications->FoundingDate->ViewValue = ew_FormatDateTime($Applications->FoundingDate->ViewValue, 5);
$Applications->FoundingDate->CssStyle = "";
$Applications->FoundingDate->CssClass = "";
$Applications->FoundingDate->ViewCustomAttributes = "";
// VATNumber
$Applications->VATNumber->ViewValue = $Applications->VATNumber->CurrentValue;
$Applications->VATNumber->CssStyle = "";
$Applications->VATNumber->CssClass = "";
$Applications->VATNumber->ViewCustomAttributes = "";
// AppForm
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->ViewValue = $Applications->AppForm->Upload->DbValue;
} else {
$Applications->AppForm->ViewValue = "";
}
$Applications->AppForm->CssStyle = "";
$Applications->AppForm->CssClass = "";
$Applications->AppForm->ViewCustomAttributes = "";
// CIPCReg
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->ViewValue = $Applications->CIPCReg->Upload->DbValue;
} else {
$Applications->CIPCReg->ViewValue = "";
}
$Applications->CIPCReg->CssStyle = "";
$Applications->CIPCReg->CssClass = "";
$Applications->CIPCReg->ViewCustomAttributes = "";
// MPRes
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->ViewValue = $Applications->MPRes->Upload->DbValue;
} else {
$Applications->MPRes->ViewValue = "";
}
$Applications->MPRes->CssStyle = "";
$Applications->MPRes->CssClass = "";
$Applications->MPRes->ViewCustomAttributes = "";
// PIInsurance
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->ViewValue = $Applications->PIInsurance->Upload->DbValue;
} else {
$Applications->PIInsurance->ViewValue = "";
}
$Applications->PIInsurance->CssStyle = "";
$Applications->PIInsurance->CssClass = "";
$Applications->PIInsurance->ViewCustomAttributes = "";
// Letterhead
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->ViewValue = $Applications->Letterhead->Upload->DbValue;
} else {
$Applications->Letterhead->ViewValue = "";
}
$Applications->Letterhead->CssStyle = "";
$Applications->Letterhead->CssClass = "";
$Applications->Letterhead->ViewCustomAttributes = "";
// DateCreated
$Applications->DateCreated->ViewValue = $Applications->DateCreated->CurrentValue;
$Applications->DateCreated->ViewValue = ew_FormatDateTime($Applications->DateCreated->ViewValue, 5);
$Applications->DateCreated->CssStyle = "";
$Applications->DateCreated->CssClass = "";
$Applications->DateCreated->ViewCustomAttributes = "";
// Status
if (strval($Applications->Status->CurrentValue) <> "") {
switch ($Applications->Status->CurrentValue) {
case "P":
$Applications->Status->ViewValue = "Pending";
break;
case "A":
$Applications->Status->ViewValue = "Approved";
break;
case "R":
$Applications->Status->ViewValue = "Rejected";
break;
default:
$Applications->Status->ViewValue = $Applications->Status->CurrentValue;
}
} else {
$Applications->Status->ViewValue = NULL;
}
$Applications->Status->CssStyle = "";
$Applications->Status->CssClass = "";
$Applications->Status->ViewCustomAttributes = "";
// DateApproved
$Applications->DateApproved->ViewValue = $Applications->DateApproved->CurrentValue;
$Applications->DateApproved->ViewValue = ew_FormatDateTime($Applications->DateApproved->ViewValue, 5);
$Applications->DateApproved->CssStyle = "";
$Applications->DateApproved->CssClass = "";
$Applications->DateApproved->ViewCustomAttributes = "";
// Comments
$Applications->Comments->ViewValue = $Applications->Comments->CurrentValue;
$Applications->Comments->CssStyle = "";
$Applications->Comments->CssClass = "";
$Applications->Comments->ViewCustomAttributes = "";
// ApplicationID
$Applications->ApplicationID->HrefValue = "";
$Applications->ApplicationID->TooltipValue = "";
// FirmName
$Applications->FirmName->HrefValue = "";
$Applications->FirmName->TooltipValue = "";
// PhysicalAddress
$Applications->PhysicalAddress->HrefValue = "";
$Applications->PhysicalAddress->TooltipValue = "";
// FoundingDate
$Applications->FoundingDate->HrefValue = "";
$Applications->FoundingDate->TooltipValue = "";
// VATNumber
$Applications->VATNumber->HrefValue = "";
$Applications->VATNumber->TooltipValue = "";
// AppForm
if (!ew_Empty($Applications->AppForm->Upload->DbValue)) {
$Applications->AppForm->HrefValue = ew_UploadPathEx(FALSE, $Applications->AppForm->UploadPath) . ((!empty($Applications->AppForm->ViewValue)) ? $Applications->AppForm->ViewValue : $Applications->AppForm->CurrentValue);
if ($Applications->Export <> "") $Applications->AppForm->HrefValue = ew_ConvertFullUrl($Applications->AppForm->HrefValue);
} else {
$Applications->AppForm->HrefValue = "";
}
$Applications->AppForm->TooltipValue = "";
// CIPCReg
if (!ew_Empty($Applications->CIPCReg->Upload->DbValue)) {
$Applications->CIPCReg->HrefValue = ew_UploadPathEx(FALSE, $Applications->CIPCReg->UploadPath) . ((!empty($Applications->CIPCReg->ViewValue)) ? $Applications->CIPCReg->ViewValue : $Applications->CIPCReg->CurrentValue);
if ($Applications->Export <> "") $Applications->CIPCReg->HrefValue = ew_ConvertFullUrl($Applications->CIPCReg->HrefValue);
} else {
$Applications->CIPCReg->HrefValue = "";
}
$Applications->CIPCReg->TooltipValue = "";
// MPRes
if (!ew_Empty($Applications->MPRes->Upload->DbValue)) {
$Applications->MPRes->HrefValue = ew_UploadPathEx(FALSE, $Applications->MPRes->UploadPath) . ((!empty($Applications->MPRes->ViewValue)) ? $Applications->MPRes->ViewValue : $Applications->MPRes->CurrentValue);
if ($Applications->Export <> "") $Applications->MPRes->HrefValue = ew_ConvertFullUrl($Applications->MPRes->HrefValue);
} else {
$Applications->MPRes->HrefValue = "";
}
$Applications->MPRes->TooltipValue = "";
// PIInsurance
if (!ew_Empty($Applications->PIInsurance->Upload->DbValue)) {
$Applications->PIInsurance->HrefValue = ew_UploadPathEx(FALSE, $Applications->PIInsurance->UploadPath) . ((!empty($Applications->PIInsurance->ViewValue)) ? $Applications->PIInsurance->ViewValue : $Applications->PIInsurance->CurrentValue);
if ($Applications->Export <> "") $Applications->PIInsurance->HrefValue = ew_ConvertFullUrl($Applications->PIInsurance->HrefValue);
} else {
$Applications->PIInsurance->HrefValue = "";
}
$Applications->PIInsurance->TooltipValue = "";
// Letterhead
if (!ew_Empty($Applications->Letterhead->Upload->DbValue)) {
$Applications->Letterhead->HrefValue = ew_UploadPathEx(FALSE, $Applications->Letterhead->UploadPath) . ((!empty($Applications->Letterhead->ViewValue)) ? $Applications->Letterhead->ViewValue : $Applications->Letterhead->CurrentValue);
if ($Applications->Export <> "") $Applications->Letterhead->HrefValue = ew_ConvertFullUrl($Applications->Letterhead->HrefValue);
} else {
$Applications->Letterhead->HrefValue = "";
}
$Applications->Letterhead->TooltipValue = "";
// DateCreated
$Applications->DateCreated->HrefValue = "";
$Applications->DateCreated->TooltipValue = "";
// Status
$Applications->Status->HrefValue = "";
$Applications->Status->TooltipValue = "";
// DateApproved
$Applications->DateApproved->HrefValue = "";
$Applications->DateApproved->TooltipValue = "";
// Comments
$Applications->Comments->HrefValue = "";
$Applications->Comments->TooltipValue = "";
}
// Call Row Rendered event
if ($Applications->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$Applications->Row_Rendered();
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $Applications;
$utf8 = FALSE;
$bSelectLimit = FALSE;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $Applications->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 ($Applications->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($Applications, "v");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($Applications->ApplicationID);
$ExportDoc->ExportCaption($Applications->FirmName);
$ExportDoc->ExportCaption($Applications->FoundingDate);
$ExportDoc->ExportCaption($Applications->VATNumber);
$ExportDoc->ExportCaption($Applications->AppForm);
$ExportDoc->ExportCaption($Applications->CIPCReg);
$ExportDoc->ExportCaption($Applications->MPRes);
$ExportDoc->ExportCaption($Applications->PIInsurance);
$ExportDoc->ExportCaption($Applications->Letterhead);
$ExportDoc->ExportCaption($Applications->DateCreated);
$ExportDoc->ExportCaption($Applications->Status);
$ExportDoc->ExportCaption($Applications->DateApproved);
$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
$Applications->CssClass = "";
$Applications->CssStyle = "";
$Applications->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($Applications->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('ApplicationID', $Applications->ApplicationID->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('FirmName', $Applications->FirmName->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('FoundingDate', $Applications->FoundingDate->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('VATNumber', $Applications->VATNumber->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('AppForm', $Applications->AppForm->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('CIPCReg', $Applications->CIPCReg->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('MPRes', $Applications->MPRes->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('PIInsurance', $Applications->PIInsurance->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('Letterhead', $Applications->Letterhead->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('DateCreated', $Applications->DateCreated->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('Status', $Applications->Status->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
$XmlDoc->AddField('DateApproved', $Applications->DateApproved->ExportValue($Applications->Export, $Applications->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($Applications->ApplicationID);
$ExportDoc->ExportField($Applications->FirmName);
$ExportDoc->ExportField($Applications->FoundingDate);
$ExportDoc->ExportField($Applications->VATNumber);
$ExportDoc->ExportField($Applications->AppForm);
$ExportDoc->ExportField($Applications->CIPCReg);
$ExportDoc->ExportField($Applications->MPRes);
$ExportDoc->ExportField($Applications->PIInsurance);
$ExportDoc->ExportField($Applications->Letterhead);
$ExportDoc->ExportField($Applications->DateCreated);
$ExportDoc->ExportField($Applications->Status);
$ExportDoc->ExportField($Applications->DateApproved);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($Applications->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($Applications->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($Applications->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($Applications->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($Applications->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $Applications;
$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 ($Applications->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 $Applications;
// Initialize
$sQry = "export=html";
// Add record key QueryString
$sQry .= "&" . substr($Applications->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";
}
}
?>