| Current Path : /var/www/cesa.co.za/ccmadmin/ |
| Current File : /var/www/cesa.co.za/ccmadmin/CCMEmployerslist.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 "CCMEmployersinfo.php" ?>
<?php include "CCMUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Create page object
$CCMEmployers_list = new cCCMEmployers_list();
$Page =& $CCMEmployers_list;
// Page init
$CCMEmployers_list->Page_Init();
// Page main
$CCMEmployers_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCMEmployers->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var CCMEmployers_list = new ew_Page("CCMEmployers_list");
// page properties
CCMEmployers_list.PageID = "list"; // page ID
CCMEmployers_list.FormID = "fCCMEmployerslist"; // form ID
var EW_PAGE_ID = CCMEmployers_list.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
CCMEmployers_list.Form_CustomValidate =
function(fobj) { // DO NOT CHANGE THIS LINE!
// Your custom validation code here, return false if invalid.
return true;
}
<?php if (EW_CLIENT_VALIDATE) { ?>
CCMEmployers_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCMEmployers_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js");
//-->
</script>
<?php } ?>
<?php if ($CCMEmployers->Export == "") { ?>
<?php } ?>
<?php
$bSelectLimit = EW_SELECT_LIMIT;
if ($bSelectLimit) {
$CCMEmployers_list->lTotalRecs = $CCMEmployers->SelectRecordCount();
} else {
if ($rs = $CCMEmployers_list->LoadRecordset())
$CCMEmployers_list->lTotalRecs = $rs->RecordCount();
}
$CCMEmployers_list->lStartRec = 1;
if ($CCMEmployers_list->lDisplayRecs <= 0 || ($CCMEmployers->Export <> "" && $CCMEmployers->ExportAll)) // Display all records
$CCMEmployers_list->lDisplayRecs = $CCMEmployers_list->lTotalRecs;
if (!($CCMEmployers->Export <> "" && $CCMEmployers->ExportAll))
$CCMEmployers_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
$rs = $CCMEmployers_list->LoadRecordset($CCMEmployers_list->lStartRec-1, $CCMEmployers_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCMEmployers->TableCaption() ?>
<?php if ($CCMEmployers->Export == "" && $CCMEmployers->CurrentAction == "") { ?>
<a href="<?php echo $CCMEmployers_list->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
<a href="<?php echo $CCMEmployers_list->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
<a href="<?php echo $CCMEmployers_list->ExportWordUrl ?>"><img src='images/exportdoc.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' width='16' height='16' border='0'></a>
<a name="emf_CCMEmployers" id="emf_CCMEmployers" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCMEmployers',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCMEmployerslist,sel:false});"><img src='images/exportemail.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
</span></p>
<?php if ($Security->CanSearch()) { ?>
<?php if ($CCMEmployers->Export == "" && $CCMEmployers->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCMEmployers_list);" style="text-decoration: none;"><img id="CCMEmployers_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker"> <?php echo $Language->Phrase("Search") ?></span><br>
<div id="CCMEmployers_list_SearchPanel">
<form name="fCCMEmployerslistsrch" id="fCCMEmployerslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="CCMEmployers">
<table class="ewBasicSearch">
<tr>
<td><span class="phpmaker">
<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($CCMEmployers->getSessionBasicSearchKeyword()) ?>">
<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">
<a href="<?php echo $CCMEmployers_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>
<a href="CCMEmployerssrch.php"><?php echo $Language->Phrase("AdvancedSearch") ?></a>
</span></td>
</tr>
<tr>
<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($CCMEmployers->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($CCMEmployers->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($CCMEmployers->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCMEmployers_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCMEmployers->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCMEmployers->CurrentAction <> "gridadd" && $CCMEmployers->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCMEmployers_list->Pager)) $CCMEmployers_list->Pager = new cPrevNextPager($CCMEmployers_list->lStartRec, $CCMEmployers_list->lDisplayRecs, $CCMEmployers_list->lTotalRecs) ?>
<?php if ($CCMEmployers_list->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 ($CCMEmployers_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCMEmployers_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCMEmployers_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCMEmployers_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCMEmployers_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCMEmployers_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCMEmployers_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCMEmployers_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCMEmployers_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCMEmployers_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCMEmployers_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCMEmployerslist" id="fCCMEmployerslist" class="ewForm" action="" method="post">
<div id="gmp_CCMEmployers" class="ewGridMiddlePanel">
<?php if ($CCMEmployers_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCMEmployers->TableCustomInnerHtml ?>
<thead><!-- Table header -->
<tr class="ewTableHeader">
<?php
// Render list options
$CCMEmployers_list->RenderListOptions();
// Render list options (header, left)
$CCMEmployers_list->ListOptions->Render("header", "left");
?>
<?php if ($CCMEmployers->Organisation->Visible) { // Organisation ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->Organisation) == "") { ?>
<td><?php echo $CCMEmployers->Organisation->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->Organisation) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->Organisation->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->Organisation->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->Organisation->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->Title->Visible) { // Title ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->Title) == "") { ?>
<td><?php echo $CCMEmployers->Title->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->Title) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->Title->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->Title->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->Title->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->FirstName->Visible) { // FirstName ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->FirstName) == "") { ?>
<td><?php echo $CCMEmployers->FirstName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->FirstName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->FirstName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->FirstName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->FirstName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->Surname->Visible) { // Surname ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->Surname) == "") { ?>
<td><?php echo $CCMEmployers->Surname->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->Surname) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->Surname->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->Surname->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->Surname->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->Telephone->Visible) { // Telephone ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->Telephone) == "") { ?>
<td><?php echo $CCMEmployers->Telephone->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->Telephone) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->Telephone->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->Telephone->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->Telephone->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->Cellphone->Visible) { // Cellphone ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->Cellphone) == "") { ?>
<td><?php echo $CCMEmployers->Cellphone->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->Cellphone) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->Cellphone->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->Cellphone->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->Cellphone->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->EmailAddress->Visible) { // EmailAddress ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->EmailAddress) == "") { ?>
<td><?php echo $CCMEmployers->EmailAddress->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->EmailAddress) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->EmailAddress->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->EmailAddress->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->EmailAddress->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->AccountName->Visible) { // AccountName ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->AccountName) == "") { ?>
<td><?php echo $CCMEmployers->AccountName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->AccountName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->AccountName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->AccountName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->AccountName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->BankName->Visible) { // BankName ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->BankName) == "") { ?>
<td><?php echo $CCMEmployers->BankName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->BankName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->BankName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->BankName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->BankName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->BranchName->Visible) { // BranchName ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->BranchName) == "") { ?>
<td><?php echo $CCMEmployers->BranchName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->BranchName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->BranchName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->BranchName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->BranchName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCMEmployers->AccountNum->Visible) { // AccountNum ?>
<?php if ($CCMEmployers->SortUrl($CCMEmployers->AccountNum) == "") { ?>
<td><?php echo $CCMEmployers->AccountNum->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCMEmployers->SortUrl($CCMEmployers->AccountNum) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCMEmployers->AccountNum->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCMEmployers->AccountNum->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCMEmployers->AccountNum->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php
// Render list options (header, right)
$CCMEmployers_list->ListOptions->Render("header", "right");
?>
</tr>
</thead>
<?php
if ($CCMEmployers->ExportAll && $CCMEmployers->Export <> "") {
$CCMEmployers_list->lStopRec = $CCMEmployers_list->lTotalRecs;
} else {
$CCMEmployers_list->lStopRec = $CCMEmployers_list->lStartRec + $CCMEmployers_list->lDisplayRecs - 1; // Set the last record to display
}
$CCMEmployers_list->lRecCount = $CCMEmployers_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $CCMEmployers_list->lStartRec > 1)
$rs->Move($CCMEmployers_list->lStartRec - 1);
}
// Initialize aggregate
$CCMEmployers->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCMEmployers_list->RenderRow();
$CCMEmployers_list->lRowCnt = 0;
while (($CCMEmployers->CurrentAction == "gridadd" || !$rs->EOF) &&
$CCMEmployers_list->lRecCount < $CCMEmployers_list->lStopRec) {
$CCMEmployers_list->lRecCount++;
if (intval($CCMEmployers_list->lRecCount) >= intval($CCMEmployers_list->lStartRec)) {
$CCMEmployers_list->lRowCnt++;
// Init row class and style
$CCMEmployers->CssClass = "";
$CCMEmployers->CssStyle = "";
$CCMEmployers->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
if ($CCMEmployers->CurrentAction == "gridadd") {
$CCMEmployers_list->LoadDefaultValues(); // Load default values
} else {
$CCMEmployers_list->LoadRowValues($rs); // Load row values
}
$CCMEmployers->RowType = EW_ROWTYPE_VIEW; // Render view
// Render row
$CCMEmployers_list->RenderRow();
// Render list options
$CCMEmployers_list->RenderListOptions();
?>
<tr<?php echo $CCMEmployers->RowAttributes() ?>>
<?php
// Render list options (body, left)
$CCMEmployers_list->ListOptions->Render("body", "left");
?>
<?php if ($CCMEmployers->Organisation->Visible) { // Organisation ?>
<td<?php echo $CCMEmployers->Organisation->CellAttributes() ?>>
<div<?php echo $CCMEmployers->Organisation->ViewAttributes() ?>><?php echo $CCMEmployers->Organisation->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->Title->Visible) { // Title ?>
<td<?php echo $CCMEmployers->Title->CellAttributes() ?>>
<div<?php echo $CCMEmployers->Title->ViewAttributes() ?>><?php echo $CCMEmployers->Title->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->FirstName->Visible) { // FirstName ?>
<td<?php echo $CCMEmployers->FirstName->CellAttributes() ?>>
<div<?php echo $CCMEmployers->FirstName->ViewAttributes() ?>><?php echo $CCMEmployers->FirstName->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->Surname->Visible) { // Surname ?>
<td<?php echo $CCMEmployers->Surname->CellAttributes() ?>>
<div<?php echo $CCMEmployers->Surname->ViewAttributes() ?>><?php echo $CCMEmployers->Surname->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->Telephone->Visible) { // Telephone ?>
<td<?php echo $CCMEmployers->Telephone->CellAttributes() ?>>
<div<?php echo $CCMEmployers->Telephone->ViewAttributes() ?>><?php echo $CCMEmployers->Telephone->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->Cellphone->Visible) { // Cellphone ?>
<td<?php echo $CCMEmployers->Cellphone->CellAttributes() ?>>
<div<?php echo $CCMEmployers->Cellphone->ViewAttributes() ?>><?php echo $CCMEmployers->Cellphone->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->EmailAddress->Visible) { // EmailAddress ?>
<td<?php echo $CCMEmployers->EmailAddress->CellAttributes() ?>>
<div<?php echo $CCMEmployers->EmailAddress->ViewAttributes() ?>><?php echo $CCMEmployers->EmailAddress->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->AccountName->Visible) { // AccountName ?>
<td<?php echo $CCMEmployers->AccountName->CellAttributes() ?>>
<div<?php echo $CCMEmployers->AccountName->ViewAttributes() ?>><?php echo $CCMEmployers->AccountName->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->BankName->Visible) { // BankName ?>
<td<?php echo $CCMEmployers->BankName->CellAttributes() ?>>
<div<?php echo $CCMEmployers->BankName->ViewAttributes() ?>><?php echo $CCMEmployers->BankName->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->BranchName->Visible) { // BranchName ?>
<td<?php echo $CCMEmployers->BranchName->CellAttributes() ?>>
<div<?php echo $CCMEmployers->BranchName->ViewAttributes() ?>><?php echo $CCMEmployers->BranchName->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCMEmployers->AccountNum->Visible) { // AccountNum ?>
<td<?php echo $CCMEmployers->AccountNum->CellAttributes() ?>>
<div<?php echo $CCMEmployers->AccountNum->ViewAttributes() ?>><?php echo $CCMEmployers->AccountNum->ListViewValue() ?></div>
</td>
<?php } ?>
<?php
// Render list options (body, right)
$CCMEmployers_list->ListOptions->Render("body", "right");
?>
</tr>
<?php
}
if ($CCMEmployers->CurrentAction <> "gridadd")
$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php
// Close recordset
if ($rs)
$rs->Close();
?>
<?php if ($CCMEmployers_list->lTotalRecs > 0) { ?>
<?php if ($CCMEmployers->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCMEmployers->CurrentAction <> "gridadd" && $CCMEmployers->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCMEmployers_list->Pager)) $CCMEmployers_list->Pager = new cPrevNextPager($CCMEmployers_list->lStartRec, $CCMEmployers_list->lDisplayRecs, $CCMEmployers_list->lTotalRecs) ?>
<?php if ($CCMEmployers_list->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 ($CCMEmployers_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCMEmployers_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCMEmployers_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCMEmployers_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCMEmployers_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCMEmployers_list->PageUrl() ?>start=<?php echo $CCMEmployers_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCMEmployers_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCMEmployers_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCMEmployers_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCMEmployers_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCMEmployers_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<?php //if ($CCMEmployers_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCMEmployers_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCMEmployers->Export == "" && $CCMEmployers->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCMEmployers->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
$CCMEmployers_list->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCMEmployers_list {
// Page ID
var $PageID = 'list';
// Table name
var $TableName = 'CCMEmployers';
// Page object name
var $PageObjName = 'CCMEmployers_list';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCMEmployers;
if ($CCMEmployers->UseTokenInUrl) $PageUrl .= "t=" . $CCMEmployers->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, $CCMEmployers;
if ($CCMEmployers->UseTokenInUrl) {
if ($objForm)
return ($CCMEmployers->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCMEmployers->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function cCCMEmployers_list() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCMEmployers)
$GLOBALS["CCMEmployers"] = new cCCMEmployers();
// Initialize URLs
$this->ExportPrintUrl = $this->PageUrl() . "export=print";
$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
$this->ExportWordUrl = $this->PageUrl() . "export=word";
$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
$this->AddUrl = $GLOBALS["CCMEmployers"]->AddUrl();
$this->InlineAddUrl = $this->PageUrl() . "a=add";
$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
$this->MultiDeleteUrl = "CCMEmployersdelete.php";
$this->MultiUpdateUrl = "CCMEmployersupdate.php";
// Table object (CCMUsers)
$GLOBALS['CCMUsers'] = new cCCMUsers();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'list', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCMEmployers', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
// List options
$this->ListOptions = new cListOptions();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $CCMEmployers;
// Security
$Security = new cAdvancedSecurity();
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->TableName);
$Security->TablePermission_Loaded();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
if (!$Security->CanList()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
// Get export parameters
if (@$_GET["export"] <> "") {
$CCMEmployers->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$CCMEmployers->Export = $_POST["exporttype"];
} else {
$CCMEmployers->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $CCMEmployers->Export; // Get export parameter, used in header
$gsExportFile = $CCMEmployers->TableVar; // Get export file, used in header
if ($CCMEmployers->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($CCMEmployers->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
}
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
// Class variables
var $ListOptions; // List options
var $lDisplayRecs = 20;
var $lStartRec;
var $lStopRec;
var $lTotalRecs = 0;
var $lRecRange = 10;
var $sSrchWhere = ""; // Search WHERE clause
var $lRecCnt = 0; // Record count
var $lEditRowCnt;
var $lRowCnt;
var $lRowIndex; // Row index
var $lRecPerRow = 0;
var $lColCnt = 0;
var $sDbMasterFilter = ""; // Master filter
var $sDbDetailFilter = ""; // Detail filter
var $bMasterRecordExists;
var $sMultiSelectKey;
var $RestoreSearch;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Security, $CCMEmployers;
// Search filters
$sSrchAdvanced = ""; // Advanced search filter
$sSrchBasic = ""; // Basic search filter
$sFilter = "";
if ($this->IsPageRequest()) { // Validate request
// Handle reset command
$this->ResetCmd();
// Set up list options
$this->SetupListOptions();
// Get basic search values
$this->LoadBasicSearchValues();
// Get and validate search values for advanced search
$this->LoadSearchValues(); // Get search values
if (!$this->ValidateSearch())
$this->setMessage($gsSearchError);
// Restore search parms from Session
$this->RestoreSearchParms();
// Call Recordset SearchValidated event
$CCMEmployers->Recordset_SearchValidated();
// Set up sorting order
$this->SetUpSortOrder();
// Get basic search criteria
if ($gsSearchError == "")
$sSrchBasic = $this->BasicSearchWhere();
// Get search criteria for advanced search
if ($gsSearchError == "")
$sSrchAdvanced = $this->AdvancedSearchWhere();
}
// Restore display records
if ($CCMEmployers->getRecordsPerPage() <> "") {
$this->lDisplayRecs = $CCMEmployers->getRecordsPerPage(); // Restore from Session
} else {
$this->lDisplayRecs = 20; // Load default
}
// Load Sorting Order
$this->LoadSortOrder();
// Build search criteria
if ($sSrchAdvanced <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
if ($sSrchBasic <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;
// Call Recordset_Searching event
$CCMEmployers->Recordset_Searching($this->sSrchWhere);
// Save search criteria
if ($this->sSrchWhere <> "") {
if ($sSrchBasic == "")
$this->ResetBasicSearchParms();
if ($sSrchAdvanced == "")
$this->ResetAdvancedSearchParms();
$CCMEmployers->setSearchWhere($this->sSrchWhere); // Save to Session
if (!$this->RestoreSearch) {
$this->lStartRec = 1; // Reset start record counter
$CCMEmployers->setStartRecordNumber($this->lStartRec);
}
} else {
$this->sSrchWhere = $CCMEmployers->getSearchWhere();
}
// Build filter
$sFilter = "";
if (!$Security->CanList())
$sFilter = "(0=1)"; // Filter all records
if ($this->sDbDetailFilter <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
if ($this->sSrchWhere <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
// Set up filter in session
$CCMEmployers->setSessionWhere($sFilter);
$CCMEmployers->CurrentFilter = "";
// Export data only
if (in_array($CCMEmployers->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($CCMEmployers->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
}
// Advanced search WHERE clause based on QueryString
function AdvancedSearchWhere() {
global $Security, $CCMEmployers;
$sWhere = "";
if (!$Security->CanSearch()) return "";
$this->BuildSearchSql($sWhere, $CCMEmployers->CCMEmployerID, FALSE); // CCMEmployerID
$this->BuildSearchSql($sWhere, $CCMEmployers->Organisation, FALSE); // Organisation
$this->BuildSearchSql($sWhere, $CCMEmployers->Title, FALSE); // Title
$this->BuildSearchSql($sWhere, $CCMEmployers->FirstName, FALSE); // FirstName
$this->BuildSearchSql($sWhere, $CCMEmployers->Surname, FALSE); // Surname
$this->BuildSearchSql($sWhere, $CCMEmployers->Initials, FALSE); // Initials
$this->BuildSearchSql($sWhere, $CCMEmployers->KnownAs, FALSE); // KnownAs
$this->BuildSearchSql($sWhere, $CCMEmployers->IDNumber, FALSE); // IDNumber
$this->BuildSearchSql($sWhere, $CCMEmployers->Telephone, FALSE); // Telephone
$this->BuildSearchSql($sWhere, $CCMEmployers->Cellphone, FALSE); // Cellphone
$this->BuildSearchSql($sWhere, $CCMEmployers->EmailAddress, FALSE); // EmailAddress
$this->BuildSearchSql($sWhere, $CCMEmployers->WorkAddress, FALSE); // WorkAddress
$this->BuildSearchSql($sWhere, $CCMEmployers->PostalAddress, FALSE); // PostalAddress
$this->BuildSearchSql($sWhere, $CCMEmployers->CandUUndertaking, FALSE); // CandUUndertaking
$this->BuildSearchSql($sWhere, $CCMEmployers->WebUsername, FALSE); // WebUsername
$this->BuildSearchSql($sWhere, $CCMEmployers->WebPassword, FALSE); // WebPassword
$this->BuildSearchSql($sWhere, $CCMEmployers->BlockAccess, FALSE); // BlockAccess
$this->BuildSearchSql($sWhere, $CCMEmployers->Archived, FALSE); // Archived
$this->BuildSearchSql($sWhere, $CCMEmployers->AccountName, FALSE); // AccountName
$this->BuildSearchSql($sWhere, $CCMEmployers->BankName, FALSE); // BankName
$this->BuildSearchSql($sWhere, $CCMEmployers->BranchName, FALSE); // BranchName
$this->BuildSearchSql($sWhere, $CCMEmployers->AccountNum, FALSE); // AccountNum
// Set up search parm
if ($sWhere <> "") {
$this->SetSearchParm($CCMEmployers->CCMEmployerID); // CCMEmployerID
$this->SetSearchParm($CCMEmployers->Organisation); // Organisation
$this->SetSearchParm($CCMEmployers->Title); // Title
$this->SetSearchParm($CCMEmployers->FirstName); // FirstName
$this->SetSearchParm($CCMEmployers->Surname); // Surname
$this->SetSearchParm($CCMEmployers->Initials); // Initials
$this->SetSearchParm($CCMEmployers->KnownAs); // KnownAs
$this->SetSearchParm($CCMEmployers->IDNumber); // IDNumber
$this->SetSearchParm($CCMEmployers->Telephone); // Telephone
$this->SetSearchParm($CCMEmployers->Cellphone); // Cellphone
$this->SetSearchParm($CCMEmployers->EmailAddress); // EmailAddress
$this->SetSearchParm($CCMEmployers->WorkAddress); // WorkAddress
$this->SetSearchParm($CCMEmployers->PostalAddress); // PostalAddress
$this->SetSearchParm($CCMEmployers->CandUUndertaking); // CandUUndertaking
$this->SetSearchParm($CCMEmployers->WebUsername); // WebUsername
$this->SetSearchParm($CCMEmployers->WebPassword); // WebPassword
$this->SetSearchParm($CCMEmployers->BlockAccess); // BlockAccess
$this->SetSearchParm($CCMEmployers->Archived); // Archived
$this->SetSearchParm($CCMEmployers->AccountName); // AccountName
$this->SetSearchParm($CCMEmployers->BankName); // BankName
$this->SetSearchParm($CCMEmployers->BranchName); // BranchName
$this->SetSearchParm($CCMEmployers->AccountNum); // AccountNum
}
return $sWhere;
}
// Build search SQL
function BuildSearchSql(&$Where, &$Fld, $MultiValue) {
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldOpr = $Fld->AdvancedSearch->SearchOperator; // @$_GET["z_$FldParm"]
$FldCond = $Fld->AdvancedSearch->SearchCondition; // @$_GET["v_$FldParm"]
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldOpr2 = $Fld->AdvancedSearch->SearchOperator2; // @$_GET["w_$FldParm"]
$sWrk = "";
//$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
//$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$FldOpr = strtoupper(trim($FldOpr));
if ($FldOpr == "") $FldOpr = "=";
$FldOpr2 = strtoupper(trim($FldOpr2));
if ($FldOpr2 == "") $FldOpr2 = "=";
if (EW_SEARCH_MULTI_VALUE_OPTION == 1 || $FldOpr <> "LIKE" ||
($FldOpr2 <> "LIKE" && $FldVal2 <> ""))
$MultiValue = FALSE;
if ($MultiValue) {
$sWrk1 = ($FldVal <> "") ? ew_GetMultiSearchSql($Fld, $FldVal) : ""; // Field value 1
$sWrk2 = ($FldVal2 <> "") ? ew_GetMultiSearchSql($Fld, $FldVal2) : ""; // Field value 2
$sWrk = $sWrk1; // Build final SQL
if ($sWrk2 <> "")
$sWrk = ($sWrk <> "") ? "($sWrk) $FldCond ($sWrk2)" : $sWrk2;
} else {
$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
$sWrk = ew_GetSearchSql($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2);
}
if ($sWrk <> "") {
if ($Where <> "") $Where .= " AND ";
$Where .= "(" . $sWrk . ")";
}
}
// Set search parameters
function SetSearchParm(&$Fld) {
global $CCMEmployers;
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$CCMEmployers->setAdvancedSearch("x_$FldParm", $FldVal);
$CCMEmployers->setAdvancedSearch("z_$FldParm", $Fld->AdvancedSearch->SearchOperator); // @$_GET["z_$FldParm"]
$CCMEmployers->setAdvancedSearch("v_$FldParm", $Fld->AdvancedSearch->SearchCondition); // @$_GET["v_$FldParm"]
$CCMEmployers->setAdvancedSearch("y_$FldParm", $FldVal2);
$CCMEmployers->setAdvancedSearch("w_$FldParm", $Fld->AdvancedSearch->SearchOperator2); // @$_GET["w_$FldParm"]
}
// Get search parameters
function GetSearchParm(&$Fld) {
global $CCMEmployers;
$FldParm = substr($Fld->FldVar, 2);
$Fld->AdvancedSearch->SearchValue = $CCMEmployers->GetAdvancedSearch("x_$FldParm");
$Fld->AdvancedSearch->SearchOperator = $CCMEmployers->GetAdvancedSearch("z_$FldParm");
$Fld->AdvancedSearch->SearchCondition = $CCMEmployers->GetAdvancedSearch("v_$FldParm");
$Fld->AdvancedSearch->SearchValue2 = $CCMEmployers->GetAdvancedSearch("y_$FldParm");
$Fld->AdvancedSearch->SearchOperator2 = $CCMEmployers->GetAdvancedSearch("w_$FldParm");
}
// Convert search value
function ConvertSearchValue(&$Fld, $FldVal) {
$Value = $FldVal;
if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
if ($FldVal <> "") $Value = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
} elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
if ($FldVal <> "") $Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
}
return $Value;
}
// Return basic search SQL
function BasicSearchSQL($Keyword) {
global $CCMEmployers;
$sKeyword = ew_AdjustSql($Keyword);
$sWhere = "";
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Organisation, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Title, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->FirstName, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Surname, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Initials, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->KnownAs, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->IDNumber, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Telephone, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->Cellphone, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->EmailAddress, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->WorkAddress, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->PostalAddress, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->CandUUndertaking, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->WebUsername, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->WebPassword, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->BlockAccess, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->AccountName, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->BankName, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->BranchName, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCMEmployers->AccountNum, $Keyword);
return $sWhere;
}
// Build basic search SQL
function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
if ($lFldDataType == EW_DATATYPE_NUMBER) {
$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
} else {
$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
}
if ($Where <> "") $Where .= " OR ";
$Where .= $sWrk;
}
// Return basic search WHERE clause based on search keyword and type
function BasicSearchWhere() {
global $Security, $CCMEmployers;
$sSearchStr = "";
if (!$Security->CanSearch()) return "";
$sSearchKeyword = $CCMEmployers->BasicSearchKeyword;
$sSearchType = $CCMEmployers->BasicSearchType;
if ($sSearchKeyword <> "") {
$sSearch = trim($sSearchKeyword);
if ($sSearchType <> "") {
while (strpos($sSearch, " ") !== FALSE)
$sSearch = str_replace(" ", " ", $sSearch);
$arKeyword = explode(" ", trim($sSearch));
foreach ($arKeyword as $sKeyword) {
if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
}
} else {
$sSearchStr = $this->BasicSearchSQL($sSearch);
}
}
if ($sSearchKeyword <> "") {
$CCMEmployers->setSessionBasicSearchKeyword($sSearchKeyword);
$CCMEmployers->setSessionBasicSearchType($sSearchType);
}
return $sSearchStr;
}
// Clear all search parameters
function ResetSearchParms() {
global $CCMEmployers;
// Clear search WHERE clause
$this->sSrchWhere = "";
$CCMEmployers->setSearchWhere($this->sSrchWhere);
// Clear basic search parameters
$this->ResetBasicSearchParms();
// Clear advanced search parameters
$this->ResetAdvancedSearchParms();
}
// Clear all basic search parameters
function ResetBasicSearchParms() {
global $CCMEmployers;
$CCMEmployers->setSessionBasicSearchKeyword("");
$CCMEmployers->setSessionBasicSearchType("");
}
// Clear all advanced search parameters
function ResetAdvancedSearchParms() {
global $CCMEmployers;
$CCMEmployers->setAdvancedSearch("x_CCMEmployerID", "");
$CCMEmployers->setAdvancedSearch("x_Organisation", "");
$CCMEmployers->setAdvancedSearch("x_Title", "");
$CCMEmployers->setAdvancedSearch("x_FirstName", "");
$CCMEmployers->setAdvancedSearch("x_Surname", "");
$CCMEmployers->setAdvancedSearch("x_Initials", "");
$CCMEmployers->setAdvancedSearch("x_KnownAs", "");
$CCMEmployers->setAdvancedSearch("x_IDNumber", "");
$CCMEmployers->setAdvancedSearch("x_Telephone", "");
$CCMEmployers->setAdvancedSearch("x_Cellphone", "");
$CCMEmployers->setAdvancedSearch("x_EmailAddress", "");
$CCMEmployers->setAdvancedSearch("x_WorkAddress", "");
$CCMEmployers->setAdvancedSearch("x_PostalAddress", "");
$CCMEmployers->setAdvancedSearch("x_CandUUndertaking", "");
$CCMEmployers->setAdvancedSearch("x_WebUsername", "");
$CCMEmployers->setAdvancedSearch("x_WebPassword", "");
$CCMEmployers->setAdvancedSearch("x_BlockAccess", "");
$CCMEmployers->setAdvancedSearch("x_Archived", "");
$CCMEmployers->setAdvancedSearch("x_AccountName", "");
$CCMEmployers->setAdvancedSearch("x_BankName", "");
$CCMEmployers->setAdvancedSearch("x_BranchName", "");
$CCMEmployers->setAdvancedSearch("x_AccountNum", "");
}
// Restore all search parameters
function RestoreSearchParms() {
global $CCMEmployers;
$bRestore = TRUE;
if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
if (@$_GET["x_CCMEmployerID"] <> "") $bRestore = FALSE;
if (@$_GET["x_Organisation"] <> "") $bRestore = FALSE;
if (@$_GET["x_Title"] <> "") $bRestore = FALSE;
if (@$_GET["x_FirstName"] <> "") $bRestore = FALSE;
if (@$_GET["x_Surname"] <> "") $bRestore = FALSE;
if (@$_GET["x_Initials"] <> "") $bRestore = FALSE;
if (@$_GET["x_KnownAs"] <> "") $bRestore = FALSE;
if (@$_GET["x_IDNumber"] <> "") $bRestore = FALSE;
if (@$_GET["x_Telephone"] <> "") $bRestore = FALSE;
if (@$_GET["x_Cellphone"] <> "") $bRestore = FALSE;
if (@$_GET["x_EmailAddress"] <> "") $bRestore = FALSE;
if (@$_GET["x_WorkAddress"] <> "") $bRestore = FALSE;
if (@$_GET["x_PostalAddress"] <> "") $bRestore = FALSE;
if (@$_GET["x_CandUUndertaking"] <> "") $bRestore = FALSE;
if (@$_GET["x_WebUsername"] <> "") $bRestore = FALSE;
if (@$_GET["x_WebPassword"] <> "") $bRestore = FALSE;
if (@$_GET["x_BlockAccess"] <> "") $bRestore = FALSE;
if (@$_GET["x_Archived"] <> "") $bRestore = FALSE;
if (@$_GET["x_AccountName"] <> "") $bRestore = FALSE;
if (@$_GET["x_BankName"] <> "") $bRestore = FALSE;
if (@$_GET["x_BranchName"] <> "") $bRestore = FALSE;
if (@$_GET["x_AccountNum"] <> "") $bRestore = FALSE;
$this->RestoreSearch = $bRestore;
if ($bRestore) {
// Restore basic search values
$CCMEmployers->BasicSearchKeyword = $CCMEmployers->getSessionBasicSearchKeyword();
$CCMEmployers->BasicSearchType = $CCMEmployers->getSessionBasicSearchType();
// Restore advanced search values
$this->GetSearchParm($CCMEmployers->CCMEmployerID);
$this->GetSearchParm($CCMEmployers->Organisation);
$this->GetSearchParm($CCMEmployers->Title);
$this->GetSearchParm($CCMEmployers->FirstName);
$this->GetSearchParm($CCMEmployers->Surname);
$this->GetSearchParm($CCMEmployers->Initials);
$this->GetSearchParm($CCMEmployers->KnownAs);
$this->GetSearchParm($CCMEmployers->IDNumber);
$this->GetSearchParm($CCMEmployers->Telephone);
$this->GetSearchParm($CCMEmployers->Cellphone);
$this->GetSearchParm($CCMEmployers->EmailAddress);
$this->GetSearchParm($CCMEmployers->WorkAddress);
$this->GetSearchParm($CCMEmployers->PostalAddress);
$this->GetSearchParm($CCMEmployers->CandUUndertaking);
$this->GetSearchParm($CCMEmployers->WebUsername);
$this->GetSearchParm($CCMEmployers->WebPassword);
$this->GetSearchParm($CCMEmployers->BlockAccess);
$this->GetSearchParm($CCMEmployers->Archived);
$this->GetSearchParm($CCMEmployers->AccountName);
$this->GetSearchParm($CCMEmployers->BankName);
$this->GetSearchParm($CCMEmployers->BranchName);
$this->GetSearchParm($CCMEmployers->AccountNum);
}
}
// Set up sort parameters
function SetUpSortOrder() {
global $CCMEmployers;
// Check for Ctrl pressed
$bCtrl = (@$_GET["ctrl"] <> "");
// Check for "order" parameter
if (@$_GET["order"] <> "") {
$CCMEmployers->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
$CCMEmployers->CurrentOrderType = @$_GET["ordertype"];
$CCMEmployers->UpdateSort($CCMEmployers->Organisation, $bCtrl); // Organisation
$CCMEmployers->UpdateSort($CCMEmployers->Title, $bCtrl); // Title
$CCMEmployers->UpdateSort($CCMEmployers->FirstName, $bCtrl); // FirstName
$CCMEmployers->UpdateSort($CCMEmployers->Surname, $bCtrl); // Surname
$CCMEmployers->UpdateSort($CCMEmployers->Telephone, $bCtrl); // Telephone
$CCMEmployers->UpdateSort($CCMEmployers->Cellphone, $bCtrl); // Cellphone
$CCMEmployers->UpdateSort($CCMEmployers->EmailAddress, $bCtrl); // EmailAddress
$CCMEmployers->UpdateSort($CCMEmployers->AccountName, $bCtrl); // AccountName
$CCMEmployers->UpdateSort($CCMEmployers->BankName, $bCtrl); // BankName
$CCMEmployers->UpdateSort($CCMEmployers->BranchName, $bCtrl); // BranchName
$CCMEmployers->UpdateSort($CCMEmployers->AccountNum, $bCtrl); // AccountNum
$CCMEmployers->setStartRecordNumber(1); // Reset start position
}
}
// Load sort order parameters
function LoadSortOrder() {
global $CCMEmployers;
$sOrderBy = $CCMEmployers->getSessionOrderBy(); // Get ORDER BY from Session
if ($sOrderBy == "") {
if ($CCMEmployers->SqlOrderBy() <> "") {
$sOrderBy = $CCMEmployers->SqlOrderBy();
$CCMEmployers->setSessionOrderBy($sOrderBy);
$CCMEmployers->Organisation->setSort("ASC");
$CCMEmployers->Surname->setSort("ASC");
}
}
}
// Reset command
// cmd=reset (Reset search parameters)
// cmd=resetall (Reset search and master/detail parameters)
// cmd=resetsort (Reset sort parameters)
function ResetCmd() {
global $CCMEmployers;
// Get reset command
if (@$_GET["cmd"] <> "") {
$sCmd = $_GET["cmd"];
// Reset search criteria
if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
$this->ResetSearchParms();
// Reset sorting order
if (strtolower($sCmd) == "resetsort") {
$sOrderBy = "";
$CCMEmployers->setSessionOrderBy($sOrderBy);
$CCMEmployers->Organisation->setSort("");
$CCMEmployers->Title->setSort("");
$CCMEmployers->FirstName->setSort("");
$CCMEmployers->Surname->setSort("");
$CCMEmployers->Telephone->setSort("");
$CCMEmployers->Cellphone->setSort("");
$CCMEmployers->EmailAddress->setSort("");
$CCMEmployers->AccountName->setSort("");
$CCMEmployers->BankName->setSort("");
$CCMEmployers->BranchName->setSort("");
$CCMEmployers->AccountNum->setSort("");
}
// Reset start position
$this->lStartRec = 1;
$CCMEmployers->setStartRecordNumber($this->lStartRec);
}
}
// Set up list options
function SetupListOptions() {
global $Security, $CCMEmployers;
// "view"
$this->ListOptions->Add("view");
$item =& $this->ListOptions->Items["view"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanView();
$item->OnLeft = FALSE;
// "edit"
$this->ListOptions->Add("edit");
$item =& $this->ListOptions->Items["edit"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanEdit();
$item->OnLeft = FALSE;
// "delete"
$this->ListOptions->Add("delete");
$item =& $this->ListOptions->Items["delete"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanDelete();
$item->OnLeft = FALSE;
// "detail_CCMMilestones"
$this->ListOptions->Add("detail_CCMMilestones");
$item =& $this->ListOptions->Items["detail_CCMMilestones"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->AllowList('CCMMilestones');
$item->OnLeft = FALSE;
// Call ListOptions_Load event
$this->ListOptions_Load();
if ($CCMEmployers->Export <> "" ||
$CCMEmployers->CurrentAction == "gridadd" ||
$CCMEmployers->CurrentAction == "gridedit")
$this->ListOptions->HideAllOptions();
}
// Render list options
function RenderListOptions() {
global $Security, $Language, $CCMEmployers;
$this->ListOptions->LoadDefault();
// "view"
$oListOpt =& $this->ListOptions->Items["view"];
if ($Security->CanView() && $oListOpt->Visible)
$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . "<img src=\"images/view.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
// "edit"
$oListOpt =& $this->ListOptions->Items["edit"];
if ($Security->CanEdit() && $oListOpt->Visible) {
$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . "<img src=\"images/edit.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
}
// "delete"
$oListOpt =& $this->ListOptions->Items["delete"];
if ($Security->CanDelete() && $oListOpt->Visible)
$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . "<img src=\"images/delete.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
// "detail_CCMMilestones"
$oListOpt =& $this->ListOptions->Items["detail_CCMMilestones"];
if ($Security->AllowList('CCMMilestones')) {
$oListOpt->Body = "<img src=\"images/detail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . $Language->TablePhrase("CCMMilestones", "TblCaption");
$oListOpt->Body = "<a href=\"CCMMilestoneslist.php?" . EW_TABLE_SHOW_MASTER . "=CCMEmployers&CCMEmployerID=" . urlencode(strval($CCMEmployers->CCMEmployerID->CurrentValue)) . "\">" . $oListOpt->Body . "</a>";
}
$this->RenderListOptionsExt();
// Call ListOptions_Rendered event
$this->ListOptions_Rendered();
}
function RenderListOptionsExt() {
global $Security, $Language, $CCMEmployers;
}
// Set up starting record parameters
function SetUpStartRec() {
global $CCMEmployers;
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];
$CCMEmployers->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;
}
$CCMEmployers->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $CCMEmployers->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
$CCMEmployers->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
$CCMEmployers->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
$CCMEmployers->setStartRecordNumber($this->lStartRec);
}
}
// Load basic search values
function LoadBasicSearchValues() {
global $CCMEmployers;
$CCMEmployers->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
$CCMEmployers->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
}
// Load search values for validation
function LoadSearchValues() {
global $objForm, $CCMEmployers;
// Load search values
// CCMEmployerID
$CCMEmployers->CCMEmployerID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CCMEmployerID"]);
$CCMEmployers->CCMEmployerID->AdvancedSearch->SearchOperator = @$_GET["z_CCMEmployerID"];
// Organisation
$CCMEmployers->Organisation->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Organisation"]);
$CCMEmployers->Organisation->AdvancedSearch->SearchOperator = @$_GET["z_Organisation"];
// Title
$CCMEmployers->Title->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Title"]);
$CCMEmployers->Title->AdvancedSearch->SearchOperator = @$_GET["z_Title"];
// FirstName
$CCMEmployers->FirstName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_FirstName"]);
$CCMEmployers->FirstName->AdvancedSearch->SearchOperator = @$_GET["z_FirstName"];
// Surname
$CCMEmployers->Surname->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Surname"]);
$CCMEmployers->Surname->AdvancedSearch->SearchOperator = @$_GET["z_Surname"];
// Initials
$CCMEmployers->Initials->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Initials"]);
$CCMEmployers->Initials->AdvancedSearch->SearchOperator = @$_GET["z_Initials"];
// KnownAs
$CCMEmployers->KnownAs->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_KnownAs"]);
$CCMEmployers->KnownAs->AdvancedSearch->SearchOperator = @$_GET["z_KnownAs"];
// IDNumber
$CCMEmployers->IDNumber->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_IDNumber"]);
$CCMEmployers->IDNumber->AdvancedSearch->SearchOperator = @$_GET["z_IDNumber"];
// Telephone
$CCMEmployers->Telephone->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Telephone"]);
$CCMEmployers->Telephone->AdvancedSearch->SearchOperator = @$_GET["z_Telephone"];
// Cellphone
$CCMEmployers->Cellphone->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Cellphone"]);
$CCMEmployers->Cellphone->AdvancedSearch->SearchOperator = @$_GET["z_Cellphone"];
// EmailAddress
$CCMEmployers->EmailAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_EmailAddress"]);
$CCMEmployers->EmailAddress->AdvancedSearch->SearchOperator = @$_GET["z_EmailAddress"];
// WorkAddress
$CCMEmployers->WorkAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WorkAddress"]);
$CCMEmployers->WorkAddress->AdvancedSearch->SearchOperator = @$_GET["z_WorkAddress"];
// PostalAddress
$CCMEmployers->PostalAddress->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_PostalAddress"]);
$CCMEmployers->PostalAddress->AdvancedSearch->SearchOperator = @$_GET["z_PostalAddress"];
// CandUUndertaking
$CCMEmployers->CandUUndertaking->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CandUUndertaking"]);
$CCMEmployers->CandUUndertaking->AdvancedSearch->SearchOperator = @$_GET["z_CandUUndertaking"];
// WebUsername
$CCMEmployers->WebUsername->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WebUsername"]);
$CCMEmployers->WebUsername->AdvancedSearch->SearchOperator = @$_GET["z_WebUsername"];
// WebPassword
$CCMEmployers->WebPassword->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_WebPassword"]);
$CCMEmployers->WebPassword->AdvancedSearch->SearchOperator = @$_GET["z_WebPassword"];
// BlockAccess
$CCMEmployers->BlockAccess->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BlockAccess"]);
$CCMEmployers->BlockAccess->AdvancedSearch->SearchOperator = @$_GET["z_BlockAccess"];
// Archived
$CCMEmployers->Archived->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Archived"]);
$CCMEmployers->Archived->AdvancedSearch->SearchOperator = @$_GET["z_Archived"];
// AccountName
$CCMEmployers->AccountName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_AccountName"]);
$CCMEmployers->AccountName->AdvancedSearch->SearchOperator = @$_GET["z_AccountName"];
// BankName
$CCMEmployers->BankName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BankName"]);
$CCMEmployers->BankName->AdvancedSearch->SearchOperator = @$_GET["z_BankName"];
// BranchName
$CCMEmployers->BranchName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BranchName"]);
$CCMEmployers->BranchName->AdvancedSearch->SearchOperator = @$_GET["z_BranchName"];
// AccountNum
$CCMEmployers->AccountNum->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_AccountNum"]);
$CCMEmployers->AccountNum->AdvancedSearch->SearchOperator = @$_GET["z_AccountNum"];
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $CCMEmployers;
// Call Recordset Selecting event
$CCMEmployers->Recordset_Selecting($CCMEmployers->CurrentFilter);
// Load List page SQL
$sSql = $CCMEmployers->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$CCMEmployers->Recordset_Selected($rs);
return $rs;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCMEmployers;
$sFilter = $CCMEmployers->KeyFilter();
// Call Row Selecting event
$CCMEmployers->Row_Selecting($sFilter);
// Load SQL based on filter
$CCMEmployers->CurrentFilter = $sFilter;
$sSql = $CCMEmployers->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCMEmployers->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCMEmployers;
$CCMEmployers->CCMEmployerID->setDbValue($rs->fields('CCMEmployerID'));
$CCMEmployers->Organisation->setDbValue($rs->fields('Organisation'));
$CCMEmployers->Title->setDbValue($rs->fields('Title'));
$CCMEmployers->FirstName->setDbValue($rs->fields('FirstName'));
$CCMEmployers->Surname->setDbValue($rs->fields('Surname'));
$CCMEmployers->Initials->setDbValue($rs->fields('Initials'));
$CCMEmployers->KnownAs->setDbValue($rs->fields('KnownAs'));
$CCMEmployers->IDNumber->setDbValue($rs->fields('IDNumber'));
$CCMEmployers->Telephone->setDbValue($rs->fields('Telephone'));
$CCMEmployers->Cellphone->setDbValue($rs->fields('Cellphone'));
$CCMEmployers->EmailAddress->setDbValue($rs->fields('EmailAddress'));
$CCMEmployers->WorkAddress->setDbValue($rs->fields('WorkAddress'));
$CCMEmployers->PostalAddress->setDbValue($rs->fields('PostalAddress'));
$CCMEmployers->CandUUndertaking->setDbValue($rs->fields('CandUUndertaking'));
$CCMEmployers->WebUsername->setDbValue($rs->fields('WebUsername'));
$CCMEmployers->WebPassword->setDbValue($rs->fields('WebPassword'));
$CCMEmployers->BlockAccess->setDbValue($rs->fields('BlockAccess'));
$CCMEmployers->Archived->setDbValue($rs->fields('Archived'));
$CCMEmployers->AccountName->setDbValue($rs->fields('AccountName'));
$CCMEmployers->BankName->setDbValue($rs->fields('BankName'));
$CCMEmployers->BranchName->setDbValue($rs->fields('BranchName'));
$CCMEmployers->AccountNum->setDbValue($rs->fields('AccountNum'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCMEmployers;
// Initialize URLs
$this->ViewUrl = $CCMEmployers->ViewUrl();
$this->EditUrl = $CCMEmployers->EditUrl();
$this->InlineEditUrl = $CCMEmployers->InlineEditUrl();
$this->CopyUrl = $CCMEmployers->CopyUrl();
$this->InlineCopyUrl = $CCMEmployers->InlineCopyUrl();
$this->DeleteUrl = $CCMEmployers->DeleteUrl();
// Call Row_Rendering event
$CCMEmployers->Row_Rendering();
// Common render codes for all row types
// Organisation
$CCMEmployers->Organisation->CellCssStyle = ""; $CCMEmployers->Organisation->CellCssClass = "";
$CCMEmployers->Organisation->CellAttrs = array(); $CCMEmployers->Organisation->ViewAttrs = array(); $CCMEmployers->Organisation->EditAttrs = array();
// Title
$CCMEmployers->Title->CellCssStyle = ""; $CCMEmployers->Title->CellCssClass = "";
$CCMEmployers->Title->CellAttrs = array(); $CCMEmployers->Title->ViewAttrs = array(); $CCMEmployers->Title->EditAttrs = array();
// FirstName
$CCMEmployers->FirstName->CellCssStyle = ""; $CCMEmployers->FirstName->CellCssClass = "";
$CCMEmployers->FirstName->CellAttrs = array(); $CCMEmployers->FirstName->ViewAttrs = array(); $CCMEmployers->FirstName->EditAttrs = array();
// Surname
$CCMEmployers->Surname->CellCssStyle = ""; $CCMEmployers->Surname->CellCssClass = "";
$CCMEmployers->Surname->CellAttrs = array(); $CCMEmployers->Surname->ViewAttrs = array(); $CCMEmployers->Surname->EditAttrs = array();
// Telephone
$CCMEmployers->Telephone->CellCssStyle = ""; $CCMEmployers->Telephone->CellCssClass = "";
$CCMEmployers->Telephone->CellAttrs = array(); $CCMEmployers->Telephone->ViewAttrs = array(); $CCMEmployers->Telephone->EditAttrs = array();
// Cellphone
$CCMEmployers->Cellphone->CellCssStyle = ""; $CCMEmployers->Cellphone->CellCssClass = "";
$CCMEmployers->Cellphone->CellAttrs = array(); $CCMEmployers->Cellphone->ViewAttrs = array(); $CCMEmployers->Cellphone->EditAttrs = array();
// EmailAddress
$CCMEmployers->EmailAddress->CellCssStyle = ""; $CCMEmployers->EmailAddress->CellCssClass = "";
$CCMEmployers->EmailAddress->CellAttrs = array(); $CCMEmployers->EmailAddress->ViewAttrs = array(); $CCMEmployers->EmailAddress->EditAttrs = array();
// AccountName
$CCMEmployers->AccountName->CellCssStyle = ""; $CCMEmployers->AccountName->CellCssClass = "";
$CCMEmployers->AccountName->CellAttrs = array(); $CCMEmployers->AccountName->ViewAttrs = array(); $CCMEmployers->AccountName->EditAttrs = array();
// BankName
$CCMEmployers->BankName->CellCssStyle = ""; $CCMEmployers->BankName->CellCssClass = "";
$CCMEmployers->BankName->CellAttrs = array(); $CCMEmployers->BankName->ViewAttrs = array(); $CCMEmployers->BankName->EditAttrs = array();
// BranchName
$CCMEmployers->BranchName->CellCssStyle = ""; $CCMEmployers->BranchName->CellCssClass = "";
$CCMEmployers->BranchName->CellAttrs = array(); $CCMEmployers->BranchName->ViewAttrs = array(); $CCMEmployers->BranchName->EditAttrs = array();
// AccountNum
$CCMEmployers->AccountNum->CellCssStyle = ""; $CCMEmployers->AccountNum->CellCssClass = "";
$CCMEmployers->AccountNum->CellAttrs = array(); $CCMEmployers->AccountNum->ViewAttrs = array(); $CCMEmployers->AccountNum->EditAttrs = array();
if ($CCMEmployers->RowType == EW_ROWTYPE_VIEW) { // View row
// CCMEmployerID
$CCMEmployers->CCMEmployerID->ViewValue = $CCMEmployers->CCMEmployerID->CurrentValue;
$CCMEmployers->CCMEmployerID->CssStyle = "";
$CCMEmployers->CCMEmployerID->CssClass = "";
$CCMEmployers->CCMEmployerID->ViewCustomAttributes = "";
// Organisation
$CCMEmployers->Organisation->ViewValue = $CCMEmployers->Organisation->CurrentValue;
$CCMEmployers->Organisation->CssStyle = "";
$CCMEmployers->Organisation->CssClass = "";
$CCMEmployers->Organisation->ViewCustomAttributes = "";
// Title
$CCMEmployers->Title->ViewValue = $CCMEmployers->Title->CurrentValue;
$CCMEmployers->Title->CssStyle = "";
$CCMEmployers->Title->CssClass = "";
$CCMEmployers->Title->ViewCustomAttributes = "";
// FirstName
$CCMEmployers->FirstName->ViewValue = $CCMEmployers->FirstName->CurrentValue;
$CCMEmployers->FirstName->CssStyle = "";
$CCMEmployers->FirstName->CssClass = "";
$CCMEmployers->FirstName->ViewCustomAttributes = "";
// Surname
$CCMEmployers->Surname->ViewValue = $CCMEmployers->Surname->CurrentValue;
$CCMEmployers->Surname->CssStyle = "";
$CCMEmployers->Surname->CssClass = "";
$CCMEmployers->Surname->ViewCustomAttributes = "";
// Initials
$CCMEmployers->Initials->ViewValue = $CCMEmployers->Initials->CurrentValue;
$CCMEmployers->Initials->CssStyle = "";
$CCMEmployers->Initials->CssClass = "";
$CCMEmployers->Initials->ViewCustomAttributes = "";
// KnownAs
$CCMEmployers->KnownAs->ViewValue = $CCMEmployers->KnownAs->CurrentValue;
$CCMEmployers->KnownAs->CssStyle = "";
$CCMEmployers->KnownAs->CssClass = "";
$CCMEmployers->KnownAs->ViewCustomAttributes = "";
// IDNumber
$CCMEmployers->IDNumber->ViewValue = $CCMEmployers->IDNumber->CurrentValue;
$CCMEmployers->IDNumber->CssStyle = "";
$CCMEmployers->IDNumber->CssClass = "";
$CCMEmployers->IDNumber->ViewCustomAttributes = "";
// Telephone
$CCMEmployers->Telephone->ViewValue = $CCMEmployers->Telephone->CurrentValue;
$CCMEmployers->Telephone->CssStyle = "";
$CCMEmployers->Telephone->CssClass = "";
$CCMEmployers->Telephone->ViewCustomAttributes = "";
// Cellphone
$CCMEmployers->Cellphone->ViewValue = $CCMEmployers->Cellphone->CurrentValue;
$CCMEmployers->Cellphone->CssStyle = "";
$CCMEmployers->Cellphone->CssClass = "";
$CCMEmployers->Cellphone->ViewCustomAttributes = "";
// EmailAddress
$CCMEmployers->EmailAddress->ViewValue = $CCMEmployers->EmailAddress->CurrentValue;
$CCMEmployers->EmailAddress->CssStyle = "";
$CCMEmployers->EmailAddress->CssClass = "";
$CCMEmployers->EmailAddress->ViewCustomAttributes = "";
// CandUUndertaking
$CCMEmployers->CandUUndertaking->ViewValue = $CCMEmployers->CandUUndertaking->CurrentValue;
$CCMEmployers->CandUUndertaking->CssStyle = "";
$CCMEmployers->CandUUndertaking->CssClass = "";
$CCMEmployers->CandUUndertaking->ViewCustomAttributes = "";
// WebUsername
$CCMEmployers->WebUsername->ViewValue = $CCMEmployers->WebUsername->CurrentValue;
$CCMEmployers->WebUsername->CssStyle = "";
$CCMEmployers->WebUsername->CssClass = "";
$CCMEmployers->WebUsername->ViewCustomAttributes = "";
// WebPassword
$CCMEmployers->WebPassword->ViewValue = $CCMEmployers->WebPassword->CurrentValue;
$CCMEmployers->WebPassword->CssStyle = "";
$CCMEmployers->WebPassword->CssClass = "";
$CCMEmployers->WebPassword->ViewCustomAttributes = "";
// BlockAccess
if (strval($CCMEmployers->BlockAccess->CurrentValue) <> "") {
switch ($CCMEmployers->BlockAccess->CurrentValue) {
case "y":
$CCMEmployers->BlockAccess->ViewValue = "Yes";
break;
case "n":
$CCMEmployers->BlockAccess->ViewValue = "No";
break;
default:
$CCMEmployers->BlockAccess->ViewValue = $CCMEmployers->BlockAccess->CurrentValue;
}
} else {
$CCMEmployers->BlockAccess->ViewValue = NULL;
}
$CCMEmployers->BlockAccess->CssStyle = "";
$CCMEmployers->BlockAccess->CssClass = "";
$CCMEmployers->BlockAccess->ViewCustomAttributes = "";
// Archived
if (strval($CCMEmployers->Archived->CurrentValue) <> "") {
switch ($CCMEmployers->Archived->CurrentValue) {
case "1":
$CCMEmployers->Archived->ViewValue = "Yes";
break;
case "0":
$CCMEmployers->Archived->ViewValue = "No";
break;
default:
$CCMEmployers->Archived->ViewValue = $CCMEmployers->Archived->CurrentValue;
}
} else {
$CCMEmployers->Archived->ViewValue = NULL;
}
$CCMEmployers->Archived->CssStyle = "";
$CCMEmployers->Archived->CssClass = "";
$CCMEmployers->Archived->ViewCustomAttributes = "";
// AccountName
$CCMEmployers->AccountName->ViewValue = $CCMEmployers->AccountName->CurrentValue;
$CCMEmployers->AccountName->CssStyle = "";
$CCMEmployers->AccountName->CssClass = "";
$CCMEmployers->AccountName->ViewCustomAttributes = "";
// BankName
$CCMEmployers->BankName->ViewValue = $CCMEmployers->BankName->CurrentValue;
$CCMEmployers->BankName->CssStyle = "";
$CCMEmployers->BankName->CssClass = "";
$CCMEmployers->BankName->ViewCustomAttributes = "";
// BranchName
$CCMEmployers->BranchName->ViewValue = $CCMEmployers->BranchName->CurrentValue;
$CCMEmployers->BranchName->CssStyle = "";
$CCMEmployers->BranchName->CssClass = "";
$CCMEmployers->BranchName->ViewCustomAttributes = "";
// AccountNum
$CCMEmployers->AccountNum->ViewValue = $CCMEmployers->AccountNum->CurrentValue;
$CCMEmployers->AccountNum->CssStyle = "";
$CCMEmployers->AccountNum->CssClass = "";
$CCMEmployers->AccountNum->ViewCustomAttributes = "";
// Organisation
$CCMEmployers->Organisation->HrefValue = "";
$CCMEmployers->Organisation->TooltipValue = "";
// Title
$CCMEmployers->Title->HrefValue = "";
$CCMEmployers->Title->TooltipValue = "";
// FirstName
$CCMEmployers->FirstName->HrefValue = "";
$CCMEmployers->FirstName->TooltipValue = "";
// Surname
$CCMEmployers->Surname->HrefValue = "";
$CCMEmployers->Surname->TooltipValue = "";
// Telephone
$CCMEmployers->Telephone->HrefValue = "";
$CCMEmployers->Telephone->TooltipValue = "";
// Cellphone
$CCMEmployers->Cellphone->HrefValue = "";
$CCMEmployers->Cellphone->TooltipValue = "";
// EmailAddress
$CCMEmployers->EmailAddress->HrefValue = "";
$CCMEmployers->EmailAddress->TooltipValue = "";
// AccountName
$CCMEmployers->AccountName->HrefValue = "";
$CCMEmployers->AccountName->TooltipValue = "";
// BankName
$CCMEmployers->BankName->HrefValue = "";
$CCMEmployers->BankName->TooltipValue = "";
// BranchName
$CCMEmployers->BranchName->HrefValue = "";
$CCMEmployers->BranchName->TooltipValue = "";
// AccountNum
$CCMEmployers->AccountNum->HrefValue = "";
$CCMEmployers->AccountNum->TooltipValue = "";
}
// Call Row Rendered event
if ($CCMEmployers->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCMEmployers->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $CCMEmployers;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
// Return validate result
$ValidateSearch = ($gsSearchError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $sFormCustomError;
}
return $ValidateSearch;
}
// Load advanced search
function LoadAdvancedSearch() {
global $CCMEmployers;
$CCMEmployers->CCMEmployerID->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_CCMEmployerID");
$CCMEmployers->Organisation->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Organisation");
$CCMEmployers->Title->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Title");
$CCMEmployers->FirstName->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_FirstName");
$CCMEmployers->Surname->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Surname");
$CCMEmployers->Initials->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Initials");
$CCMEmployers->KnownAs->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_KnownAs");
$CCMEmployers->IDNumber->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_IDNumber");
$CCMEmployers->Telephone->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Telephone");
$CCMEmployers->Cellphone->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Cellphone");
$CCMEmployers->EmailAddress->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_EmailAddress");
$CCMEmployers->WorkAddress->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_WorkAddress");
$CCMEmployers->PostalAddress->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_PostalAddress");
$CCMEmployers->CandUUndertaking->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_CandUUndertaking");
$CCMEmployers->WebUsername->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_WebUsername");
$CCMEmployers->WebPassword->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_WebPassword");
$CCMEmployers->BlockAccess->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_BlockAccess");
$CCMEmployers->Archived->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_Archived");
$CCMEmployers->AccountName->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_AccountName");
$CCMEmployers->BankName->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_BankName");
$CCMEmployers->BranchName->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_BranchName");
$CCMEmployers->AccountNum->AdvancedSearch->SearchValue = $CCMEmployers->getAdvancedSearch("x_AccountNum");
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $CCMEmployers;
$utf8 = FALSE;
$bSelectLimit = EW_SELECT_LIMIT;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $CCMEmployers->SelectRecordCount();
} else {
if ($rs = $this->LoadRecordset())
$this->lTotalRecs = $rs->RecordCount();
}
$this->lStartRec = 1;
// Export all
if ($CCMEmployers->ExportAll) {
$this->lDisplayRecs = $this->lTotalRecs;
$this->lStopRec = $this->lTotalRecs;
} else { // Export one page only
$this->SetUpStartRec(); // Set up start record position
// Set the last record to display
if ($this->lDisplayRecs < 0) {
$this->lStopRec = $this->lTotalRecs;
} else {
$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
}
}
if ($bSelectLimit)
$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
if (!$rs) {
header("Content-Type:"); // Remove header
header("Content-Disposition:");
$this->ShowMessage();
return;
}
if ($CCMEmployers->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($CCMEmployers, "h");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($CCMEmployers->CCMEmployerID);
$ExportDoc->ExportCaption($CCMEmployers->Organisation);
$ExportDoc->ExportCaption($CCMEmployers->Title);
$ExportDoc->ExportCaption($CCMEmployers->FirstName);
$ExportDoc->ExportCaption($CCMEmployers->Surname);
$ExportDoc->ExportCaption($CCMEmployers->Initials);
$ExportDoc->ExportCaption($CCMEmployers->KnownAs);
$ExportDoc->ExportCaption($CCMEmployers->IDNumber);
$ExportDoc->ExportCaption($CCMEmployers->Telephone);
$ExportDoc->ExportCaption($CCMEmployers->Cellphone);
$ExportDoc->ExportCaption($CCMEmployers->EmailAddress);
$ExportDoc->ExportCaption($CCMEmployers->CandUUndertaking);
$ExportDoc->ExportCaption($CCMEmployers->WebUsername);
$ExportDoc->ExportCaption($CCMEmployers->WebPassword);
$ExportDoc->ExportCaption($CCMEmployers->BlockAccess);
$ExportDoc->ExportCaption($CCMEmployers->Archived);
$ExportDoc->ExportCaption($CCMEmployers->AccountName);
$ExportDoc->ExportCaption($CCMEmployers->BankName);
$ExportDoc->ExportCaption($CCMEmployers->BranchName);
$ExportDoc->ExportCaption($CCMEmployers->AccountNum);
$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
$CCMEmployers->CssClass = "";
$CCMEmployers->CssStyle = "";
$CCMEmployers->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($CCMEmployers->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('CCMEmployerID', $CCMEmployers->CCMEmployerID->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Organisation', $CCMEmployers->Organisation->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Title', $CCMEmployers->Title->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('FirstName', $CCMEmployers->FirstName->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Surname', $CCMEmployers->Surname->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Initials', $CCMEmployers->Initials->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('KnownAs', $CCMEmployers->KnownAs->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('IDNumber', $CCMEmployers->IDNumber->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Telephone', $CCMEmployers->Telephone->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Cellphone', $CCMEmployers->Cellphone->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('EmailAddress', $CCMEmployers->EmailAddress->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('CandUUndertaking', $CCMEmployers->CandUUndertaking->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('WebUsername', $CCMEmployers->WebUsername->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('WebPassword', $CCMEmployers->WebPassword->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('BlockAccess', $CCMEmployers->BlockAccess->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('Archived', $CCMEmployers->Archived->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('AccountName', $CCMEmployers->AccountName->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('BankName', $CCMEmployers->BankName->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('BranchName', $CCMEmployers->BranchName->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
$XmlDoc->AddField('AccountNum', $CCMEmployers->AccountNum->ExportValue($CCMEmployers->Export, $CCMEmployers->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($CCMEmployers->CCMEmployerID);
$ExportDoc->ExportField($CCMEmployers->Organisation);
$ExportDoc->ExportField($CCMEmployers->Title);
$ExportDoc->ExportField($CCMEmployers->FirstName);
$ExportDoc->ExportField($CCMEmployers->Surname);
$ExportDoc->ExportField($CCMEmployers->Initials);
$ExportDoc->ExportField($CCMEmployers->KnownAs);
$ExportDoc->ExportField($CCMEmployers->IDNumber);
$ExportDoc->ExportField($CCMEmployers->Telephone);
$ExportDoc->ExportField($CCMEmployers->Cellphone);
$ExportDoc->ExportField($CCMEmployers->EmailAddress);
$ExportDoc->ExportField($CCMEmployers->CandUUndertaking);
$ExportDoc->ExportField($CCMEmployers->WebUsername);
$ExportDoc->ExportField($CCMEmployers->WebPassword);
$ExportDoc->ExportField($CCMEmployers->BlockAccess);
$ExportDoc->ExportField($CCMEmployers->Archived);
$ExportDoc->ExportField($CCMEmployers->AccountName);
$ExportDoc->ExportField($CCMEmployers->BankName);
$ExportDoc->ExportField($CCMEmployers->BranchName);
$ExportDoc->ExportField($CCMEmployers->AccountNum);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($CCMEmployers->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($CCMEmployers->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($CCMEmployers->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($CCMEmployers->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($CCMEmployers->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $CCMEmployers;
$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 ($CCMEmployers->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 $CCMEmployers;
// Initialize
$sQry = "export=html";
// Build QueryString for search
if ($CCMEmployers->getSessionBasicSearchKeyword() <> "") {
$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCMEmployers->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCMEmployers->getSessionBasicSearchType();
}
$this->AddSearchQueryString($sQry, $CCMEmployers->CCMEmployerID); // CCMEmployerID
$this->AddSearchQueryString($sQry, $CCMEmployers->Organisation); // Organisation
$this->AddSearchQueryString($sQry, $CCMEmployers->Title); // Title
$this->AddSearchQueryString($sQry, $CCMEmployers->FirstName); // FirstName
$this->AddSearchQueryString($sQry, $CCMEmployers->Surname); // Surname
$this->AddSearchQueryString($sQry, $CCMEmployers->Initials); // Initials
$this->AddSearchQueryString($sQry, $CCMEmployers->KnownAs); // KnownAs
$this->AddSearchQueryString($sQry, $CCMEmployers->IDNumber); // IDNumber
$this->AddSearchQueryString($sQry, $CCMEmployers->Telephone); // Telephone
$this->AddSearchQueryString($sQry, $CCMEmployers->Cellphone); // Cellphone
$this->AddSearchQueryString($sQry, $CCMEmployers->EmailAddress); // EmailAddress
$this->AddSearchQueryString($sQry, $CCMEmployers->WorkAddress); // WorkAddress
$this->AddSearchQueryString($sQry, $CCMEmployers->PostalAddress); // PostalAddress
$this->AddSearchQueryString($sQry, $CCMEmployers->CandUUndertaking); // CandUUndertaking
$this->AddSearchQueryString($sQry, $CCMEmployers->WebUsername); // WebUsername
$this->AddSearchQueryString($sQry, $CCMEmployers->WebPassword); // WebPassword
$this->AddSearchQueryString($sQry, $CCMEmployers->BlockAccess); // BlockAccess
$this->AddSearchQueryString($sQry, $CCMEmployers->Archived); // Archived
$this->AddSearchQueryString($sQry, $CCMEmployers->AccountName); // AccountName
$this->AddSearchQueryString($sQry, $CCMEmployers->BankName); // BankName
$this->AddSearchQueryString($sQry, $CCMEmployers->BranchName); // BranchName
$this->AddSearchQueryString($sQry, $CCMEmployers->AccountNum); // AccountNum
// Build QueryString for pager
$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCMEmployers->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCMEmployers->getStartRecordNumber();
return $sQry;
}
// Add search QueryString
function AddSearchQueryString(&$Qry, &$Fld) {
global $CCMEmployers;
$FldParm = substr($Fld->FldVar, 2);
$FldSearchValue = $CCMEmployers->GetAdvancedSearch("x_" . $FldParm);
if (strval($FldSearchValue) <> "") {
$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
"&z_" . $FldParm . "=" . $CCMEmployers->GetAdvancedSearch("z_" . $FldParm);
}
$FldSearchValue2 = $CCMEmployers->GetAdvancedSearch("y_" . $FldParm);
if (strval($FldSearchValue2) <> "") {
$Qry .= "&v_" . $FldParm . "=" . $CCMEmployers->GetAdvancedSearch("v_" . $FldParm) .
"&y_" . $FldParm . "=" . $FldSearchValue2 .
"&w_" . $FldParm . "=" . $CCMEmployers->GetAdvancedSearch("w_" . $FldParm);
}
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
// ListOptions Load event
function ListOptions_Load() {
// Example:
//$this->ListOptions->Add("new");
//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
//$this->ListOptions->MoveItem("new", 0); // Move to first column
}
// ListOptions Rendered event
function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
}
}
?>