| Current Path : /var/www/cesa.co.za/echasl23/ |
| Current File : /var/www/cesa.co.za/echasl23/Certificatessrch.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 "Certificatesinfo.php" ?>
<?php include "adminusersinfo.php" ?>
<?php include "SchoolAttendeesinfo.php" ?>
<?php include "SchoolEventsinfo.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
$Certificates_search = new cCertificates_search();
$Page =& $Certificates_search;
// Page init
$Certificates_search->Page_Init();
// Page main
$Certificates_search->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var Certificates_search = new ew_Page("Certificates_search");
// page properties
Certificates_search.PageID = "search"; // page ID
Certificates_search.FormID = "fCertificatessearch"; // form ID
var EW_PAGE_ID = Certificates_search.PageID; // for backward compatibility
// extend page with validate function for search
Certificates_search.ValidateSearch = function(fobj) {
ew_PostAutoSuggest(fobj);
if (this.ValidateRequired) {
var infix = "";
elm = fobj.elements["x" + infix + "_EventID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Certificates->EventID->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_QuestionnaireID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Certificates->QuestionnaireID->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_AttendeeID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Certificates->AttendeeID->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_CertificateSent"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($Certificates->CertificateSent->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj))
return false;
}
for (var i=0; i<fobj.elements.length; i++) {
var elem = fobj.elements[i];
if (elem.name.substring(0,2) == "s_" || elem.name.substring(0,3) == "sv_")
elem.value = "";
}
return true;
}
// extend page with Form_CustomValidate function
Certificates_search.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) { ?>
Certificates_search.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
Certificates_search.ValidateRequired = false; // no JavaScript validation
<?php } ?>
// search highlight properties
Certificates_search.ShowHighlightText = ewLanguage.Phrase("ShowHighlight");
Certificates_search.HideHighlightText = ewLanguage.Phrase("HideHighlight");
//-->
</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>
<p><span class="phpmaker"><?php echo $Language->Phrase("Search") ?> <?php echo $Language->Phrase("TblTypeCUSTOMVIEW") ?><?php echo $Certificates->TableCaption() ?><br><br>
<a href="<?php echo $Certificates->getReturnUrl() ?>"><?php echo $Language->Phrase("BackToList") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$Certificates_search->ShowMessage();
?>
<form name="fCertificatessearch" id="fCertificatessearch" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return Certificates_search.ValidateSearch(this);">
<p>
<input type="hidden" name="t" id="t" value="Certificates">
<input type="hidden" name="a_search" id="a_search" value="S">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->EventID->FldCaption() ?></td>
<td<?php echo $Certificates->EventID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_EventID" id="z_EventID" value="="></span></td>
<td<?php echo $Certificates->EventID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<div id="as_x_EventID" style="z-index: 8990">
<input type="text" name="sv_x_EventID" id="sv_x_EventID" value="<?php echo $Certificates->EventID->EditValue ?>" title="<?php echo $Certificates->EventID->FldTitle() ?>" size="30"<?php echo $Certificates->EventID->EditAttributes() ?>> <span id="em_x_EventID" class="ewMessage" style="display: none"><?php echo $Language->Phrase("UnmatchedValue") ?></span>
<div id="sc_x_EventID"></div>
</div>
<input type="hidden" name="x_EventID" id="x_EventID" value="<?php echo $Certificates->EventID->AdvancedSearch->SearchValue ?>">
<?php
$sSqlWrk = "SELECT `EventID`, `EventName`, `StartDate` FROM `SchoolEvents`";
$sWhereWrk = "`EventName` LIKE '{query_value}%'";
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk = TEAencrypt($sSqlWrk, EW_RANDOM_KEY);
?>
<input type="hidden" name="s_x_EventID" id="s_x_EventID" value="<?php echo $sSqlWrk ?>">
<script type="text/javascript">
<!--
var oas_x_EventID = new ew_AutoSuggest("sv_x_EventID", "sc_x_EventID", "s_x_EventID", "em_x_EventID", "x_EventID", "", false);
oas_x_EventID.formatResult = function(ar) {
var df1 = ar[1];
var df2 = ar[2];
if (df2 != "")
df1 += EW_FIELD_SEP + df2;
return df1;
};
oas_x_EventID.ac.typeAhead = false;
//-->
</script>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->ContactFirstName->FldCaption() ?></td>
<td<?php echo $Certificates->ContactFirstName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_ContactFirstName" id="z_ContactFirstName" value="LIKE"></span></td>
<td<?php echo $Certificates->ContactFirstName->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_ContactFirstName" id="x_ContactFirstName" title="<?php echo $Certificates->ContactFirstName->FldTitle() ?>" size="30" maxlength="30" value="<?php echo $Certificates->ContactFirstName->EditValue ?>"<?php echo $Certificates->ContactFirstName->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->ContactLastName->FldCaption() ?></td>
<td<?php echo $Certificates->ContactLastName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_ContactLastName" id="z_ContactLastName" value="LIKE"></span></td>
<td<?php echo $Certificates->ContactLastName->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_ContactLastName" id="x_ContactLastName" title="<?php echo $Certificates->ContactLastName->FldTitle() ?>" size="30" maxlength="50" value="<?php echo $Certificates->ContactLastName->EditValue ?>"<?php echo $Certificates->ContactLastName->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->EmailAddress->FldCaption() ?></td>
<td<?php echo $Certificates->EmailAddress->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_EmailAddress" id="z_EmailAddress" value="LIKE"></span></td>
<td<?php echo $Certificates->EmailAddress->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_EmailAddress" id="x_EmailAddress" title="<?php echo $Certificates->EmailAddress->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $Certificates->EmailAddress->EditValue ?>"<?php echo $Certificates->EmailAddress->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->Attended->FldCaption() ?></td>
<td<?php echo $Certificates->Attended->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Attended" id="z_Attended" value="LIKE"></span></td>
<td<?php echo $Certificates->Attended->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<select id="x_Attended" name="x_Attended" title="<?php echo $Certificates->Attended->FldTitle() ?>"<?php echo $Certificates->Attended->EditAttributes() ?>>
<?php
if (is_array($Certificates->Attended->EditValue)) {
$arwrk = $Certificates->Attended->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Certificates->Attended->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
}
}
?>
</select>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->Paid->FldCaption() ?></td>
<td<?php echo $Certificates->Paid->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Paid" id="z_Paid" value="LIKE"></span></td>
<td<?php echo $Certificates->Paid->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<select id="x_Paid" name="x_Paid" title="<?php echo $Certificates->Paid->FldTitle() ?>"<?php echo $Certificates->Paid->EditAttributes() ?>>
<?php
if (is_array($Certificates->Paid->EditValue)) {
$arwrk = $Certificates->Paid->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Certificates->Paid->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
}
}
?>
</select>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->TestRequired->FldCaption() ?></td>
<td<?php echo $Certificates->TestRequired->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_TestRequired" id="z_TestRequired" value="="></span></td>
<td<?php echo $Certificates->TestRequired->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<div id="tp_x_TestRequired" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_TestRequired" id="x_TestRequired" title="<?php echo $Certificates->TestRequired->FldTitle() ?>" value="{value}"<?php echo $Certificates->TestRequired->EditAttributes() ?>></label></div>
<div id="dsl_x_TestRequired" repeatcolumn="5">
<?php
$arwrk = $Certificates->TestRequired->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Certificates->TestRequired->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_TestRequired" id="x_TestRequired" title="<?php echo $Certificates->TestRequired->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $Certificates->TestRequired->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->QuestionnaireID->FldCaption() ?></td>
<td<?php echo $Certificates->QuestionnaireID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_QuestionnaireID" id="z_QuestionnaireID" value="="></span></td>
<td<?php echo $Certificates->QuestionnaireID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_QuestionnaireID" id="x_QuestionnaireID" title="<?php echo $Certificates->QuestionnaireID->FldTitle() ?>" size="30" value="<?php echo $Certificates->QuestionnaireID->EditValue ?>"<?php echo $Certificates->QuestionnaireID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->TestCompleted->FldCaption() ?></td>
<td<?php echo $Certificates->TestCompleted->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_TestCompleted" id="z_TestCompleted" value="="></span></td>
<td<?php echo $Certificates->TestCompleted->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<div id="tp_x_TestCompleted" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_TestCompleted" id="x_TestCompleted" title="<?php echo $Certificates->TestCompleted->FldTitle() ?>" value="{value}"<?php echo $Certificates->TestCompleted->EditAttributes() ?>></label></div>
<div id="dsl_x_TestCompleted" repeatcolumn="5">
<?php
$arwrk = $Certificates->TestCompleted->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Certificates->TestCompleted->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_TestCompleted" id="x_TestCompleted" title="<?php echo $Certificates->TestCompleted->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $Certificates->TestCompleted->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->TestPassed->FldCaption() ?></td>
<td<?php echo $Certificates->TestPassed->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_TestPassed" id="z_TestPassed" value="="></span></td>
<td<?php echo $Certificates->TestPassed->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<div id="tp_x_TestPassed" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_TestPassed" id="x_TestPassed" title="<?php echo $Certificates->TestPassed->FldTitle() ?>" value="{value}"<?php echo $Certificates->TestPassed->EditAttributes() ?>></label></div>
<div id="dsl_x_TestPassed" repeatcolumn="5">
<?php
$arwrk = $Certificates->TestPassed->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($Certificates->TestPassed->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_TestPassed" id="x_TestPassed" title="<?php echo $Certificates->TestPassed->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $Certificates->TestPassed->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->AttendeeID->FldCaption() ?></td>
<td<?php echo $Certificates->AttendeeID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_AttendeeID" id="z_AttendeeID" value="="></span></td>
<td<?php echo $Certificates->AttendeeID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_AttendeeID" id="x_AttendeeID" title="<?php echo $Certificates->AttendeeID->FldTitle() ?>" value="<?php echo $Certificates->AttendeeID->EditValue ?>"<?php echo $Certificates->AttendeeID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $Certificates->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $Certificates->CertificateSent->FldCaption() ?></td>
<td<?php echo $Certificates->CertificateSent->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CertificateSent" id="z_CertificateSent" value="="></span></td>
<td<?php echo $Certificates->CertificateSent->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_CertificateSent" id="x_CertificateSent" title="<?php echo $Certificates->CertificateSent->FldTitle() ?>" value="<?php echo $Certificates->CertificateSent->EditValue ?>"<?php echo $Certificates->CertificateSent->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("Search")) ?>">
<input type="button" name="Reset" id="Reset" value="<?php echo ew_BtnCaption($Language->Phrase("Reset")) ?>" onclick="ew_ClearForm(this.form);">
</form>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$Certificates_search->Page_Terminate();
?>
<?php
//
// Page class
//
class cCertificates_search {
// Page ID
var $PageID = 'search';
// Table name
var $TableName = 'Certificates';
// Page object name
var $PageObjName = 'Certificates_search';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $Certificates;
if ($Certificates->UseTokenInUrl) $PageUrl .= "t=" . $Certificates->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, $Certificates;
if ($Certificates->UseTokenInUrl) {
if ($objForm)
return ($Certificates->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($Certificates->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (Certificates)
$GLOBALS["Certificates"] = new cCertificates();
// Table object (adminusers)
$GLOBALS['adminusers'] = new cadminusers();
// Table object (SchoolAttendees)
$GLOBALS['SchoolAttendees'] = new cSchoolAttendees();
// Table object (SchoolEvents)
$GLOBALS['SchoolEvents'] = new cSchoolEvents();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'search', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'Certificates', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $Certificates;
// User profile
$UserProfile = new cUserProfile();
$UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]);
// Security
$Security = new cAdvancedSecurity();
if (IsPasswordExpired())
$this->Page_Terminate("changepwd.php");
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->CanSearch()) {
$Security->SaveLastUrl();
$this->Page_Terminate("Certificateslist.php");
}
$Security->UserID_Loading();
if ($Security->IsLoggedIn()) $Security->LoadUserID();
$Security->UserID_Loaded();
// Create form object
$objForm = new cFormObj();
// 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();
}
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Certificates;
if ($this->IsPageRequest()) { // Validate request
// Get action
$Certificates->CurrentAction = $objForm->GetValue("a_search");
switch ($Certificates->CurrentAction) {
case "S": // Get search criteria
// Build search string for advanced search, remove blank field
$this->LoadSearchValues(); // Get search values
if ($this->ValidateSearch()) {
$sSrchStr = $this->BuildAdvancedSearch();
} else {
$sSrchStr = "";
$this->setMessage($gsSearchError);
}
if ($sSrchStr <> "") {
$sSrchStr = $Certificates->UrlParm($sSrchStr);
$this->Page_Terminate("Certificateslist.php" . "?" . $sSrchStr); // Go to list page
}
}
}
// Restore search settings from Session
if ($gsSearchError == "")
$this->LoadAdvancedSearch();
// Render row for search
$Certificates->RowType = EW_ROWTYPE_SEARCH;
$this->RenderRow();
}
// Build advanced search
function BuildAdvancedSearch() {
global $Certificates;
$sSrchUrl = "";
$this->BuildSearchUrl($sSrchUrl, $Certificates->EventID); // EventID
$this->BuildSearchUrl($sSrchUrl, $Certificates->ContactFirstName); // ContactFirstName
$this->BuildSearchUrl($sSrchUrl, $Certificates->ContactLastName); // ContactLastName
$this->BuildSearchUrl($sSrchUrl, $Certificates->EmailAddress); // EmailAddress
$this->BuildSearchUrl($sSrchUrl, $Certificates->Attended); // Attended
$this->BuildSearchUrl($sSrchUrl, $Certificates->Paid); // Paid
$this->BuildSearchUrl($sSrchUrl, $Certificates->TestRequired); // TestRequired
$this->BuildSearchUrl($sSrchUrl, $Certificates->QuestionnaireID); // QuestionnaireID
$this->BuildSearchUrl($sSrchUrl, $Certificates->TestCompleted); // TestCompleted
$this->BuildSearchUrl($sSrchUrl, $Certificates->TestPassed); // TestPassed
$this->BuildSearchUrl($sSrchUrl, $Certificates->AttendeeID); // AttendeeID
$this->BuildSearchUrl($sSrchUrl, $Certificates->CertificateSent); // CertificateSent
return $sSrchUrl;
}
// Build search URL
function BuildSearchUrl(&$Url, &$Fld) {
global $objForm;
$sWrk = "";
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $objForm->GetValue("x_$FldParm");
$FldOpr = $objForm->GetValue("z_$FldParm");
$FldCond = $objForm->GetValue("v_$FldParm");
$FldVal2 = $objForm->GetValue("y_$FldParm");
$FldOpr2 = $objForm->GetValue("w_$FldParm");
$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));
$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
if ($FldOpr == "BETWEEN") {
$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2));
if ($FldVal <> "" && $FldVal2 <> "" && $IsValidValue) {
$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
"&y_" . $FldParm . "=" . urlencode($FldVal2) .
"&z_" . $FldParm . "=" . urlencode($FldOpr);
}
} elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
"&z_" . $FldParm . "=" . urlencode($FldOpr);
} else {
$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal));
if ($FldVal <> "" && $IsValidValue && ew_IsValidOpr($FldOpr, $lFldDataType)) {
//$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
"&z_" . $FldParm . "=" . urlencode($FldOpr);
}
$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2));
if ($FldVal2 <> "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $lFldDataType)) {
//$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
if ($sWrk <> "") $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
$sWrk .= "&y_" . $FldParm . "=" . urlencode($FldVal2) .
"&w_" . $FldParm . "=" . urlencode($FldOpr2);
}
}
if ($sWrk <> "") {
if ($Url <> "") $Url .= "&";
$Url .= $sWrk;
}
}
// Convert search value for date
function ConvertSearchValue(&$Fld, $FldVal) {
$Value = $FldVal;
if ($Fld->FldDataType == EW_DATATYPE_DATE && $FldVal <> "")
$Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
return $Value;
}
// Load search values for validation
function LoadSearchValues() {
global $objForm, $Certificates;
// Load search values
// EventID
$Certificates->EventID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_EventID"));
$Certificates->EventID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_EventID");
// ContactFirstName
$Certificates->ContactFirstName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_ContactFirstName"));
$Certificates->ContactFirstName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_ContactFirstName");
// ContactLastName
$Certificates->ContactLastName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_ContactLastName"));
$Certificates->ContactLastName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_ContactLastName");
// EmailAddress
$Certificates->EmailAddress->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_EmailAddress"));
$Certificates->EmailAddress->AdvancedSearch->SearchOperator = $objForm->GetValue("z_EmailAddress");
// Attended
$Certificates->Attended->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Attended"));
$Certificates->Attended->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Attended");
// Paid
$Certificates->Paid->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Paid"));
$Certificates->Paid->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Paid");
// TestRequired
$Certificates->TestRequired->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_TestRequired"));
$Certificates->TestRequired->AdvancedSearch->SearchOperator = $objForm->GetValue("z_TestRequired");
// QuestionnaireID
$Certificates->QuestionnaireID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_QuestionnaireID"));
$Certificates->QuestionnaireID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_QuestionnaireID");
// TestCompleted
$Certificates->TestCompleted->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_TestCompleted"));
$Certificates->TestCompleted->AdvancedSearch->SearchOperator = $objForm->GetValue("z_TestCompleted");
// TestPassed
$Certificates->TestPassed->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_TestPassed"));
$Certificates->TestPassed->AdvancedSearch->SearchOperator = $objForm->GetValue("z_TestPassed");
// AttendeeID
$Certificates->AttendeeID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_AttendeeID"));
$Certificates->AttendeeID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_AttendeeID");
// CertificateSent
$Certificates->CertificateSent->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_CertificateSent"));
$Certificates->CertificateSent->AdvancedSearch->SearchOperator = $objForm->GetValue("z_CertificateSent");
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $Certificates;
// Initialize URLs
// Call Row_Rendering event
$Certificates->Row_Rendering();
// Common render codes for all row types
// EventID
$Certificates->EventID->CellCssStyle = ""; $Certificates->EventID->CellCssClass = "";
$Certificates->EventID->CellAttrs = array(); $Certificates->EventID->ViewAttrs = array(); $Certificates->EventID->EditAttrs = array();
// ContactFirstName
$Certificates->ContactFirstName->CellCssStyle = ""; $Certificates->ContactFirstName->CellCssClass = "";
$Certificates->ContactFirstName->CellAttrs = array(); $Certificates->ContactFirstName->ViewAttrs = array(); $Certificates->ContactFirstName->EditAttrs = array();
// ContactLastName
$Certificates->ContactLastName->CellCssStyle = ""; $Certificates->ContactLastName->CellCssClass = "";
$Certificates->ContactLastName->CellAttrs = array(); $Certificates->ContactLastName->ViewAttrs = array(); $Certificates->ContactLastName->EditAttrs = array();
// EmailAddress
$Certificates->EmailAddress->CellCssStyle = ""; $Certificates->EmailAddress->CellCssClass = "";
$Certificates->EmailAddress->CellAttrs = array(); $Certificates->EmailAddress->ViewAttrs = array(); $Certificates->EmailAddress->EditAttrs = array();
// Attended
$Certificates->Attended->CellCssStyle = ""; $Certificates->Attended->CellCssClass = "";
$Certificates->Attended->CellAttrs = array(); $Certificates->Attended->ViewAttrs = array(); $Certificates->Attended->EditAttrs = array();
// Paid
$Certificates->Paid->CellCssStyle = ""; $Certificates->Paid->CellCssClass = "";
$Certificates->Paid->CellAttrs = array(); $Certificates->Paid->ViewAttrs = array(); $Certificates->Paid->EditAttrs = array();
// TestRequired
$Certificates->TestRequired->CellCssStyle = ""; $Certificates->TestRequired->CellCssClass = "";
$Certificates->TestRequired->CellAttrs = array(); $Certificates->TestRequired->ViewAttrs = array(); $Certificates->TestRequired->EditAttrs = array();
// QuestionnaireID
$Certificates->QuestionnaireID->CellCssStyle = ""; $Certificates->QuestionnaireID->CellCssClass = "";
$Certificates->QuestionnaireID->CellAttrs = array(); $Certificates->QuestionnaireID->ViewAttrs = array(); $Certificates->QuestionnaireID->EditAttrs = array();
// TestCompleted
$Certificates->TestCompleted->CellCssStyle = ""; $Certificates->TestCompleted->CellCssClass = "";
$Certificates->TestCompleted->CellAttrs = array(); $Certificates->TestCompleted->ViewAttrs = array(); $Certificates->TestCompleted->EditAttrs = array();
// TestPassed
$Certificates->TestPassed->CellCssStyle = ""; $Certificates->TestPassed->CellCssClass = "";
$Certificates->TestPassed->CellAttrs = array(); $Certificates->TestPassed->ViewAttrs = array(); $Certificates->TestPassed->EditAttrs = array();
// AttendeeID
$Certificates->AttendeeID->CellCssStyle = ""; $Certificates->AttendeeID->CellCssClass = "";
$Certificates->AttendeeID->CellAttrs = array(); $Certificates->AttendeeID->ViewAttrs = array(); $Certificates->AttendeeID->EditAttrs = array();
// CertificateSent
$Certificates->CertificateSent->CellCssStyle = ""; $Certificates->CertificateSent->CellCssClass = "";
$Certificates->CertificateSent->CellAttrs = array(); $Certificates->CertificateSent->ViewAttrs = array(); $Certificates->CertificateSent->EditAttrs = array();
if ($Certificates->RowType == EW_ROWTYPE_VIEW) { // View row
// EventID
$Certificates->EventID->ViewValue = $Certificates->EventID->CurrentValue;
if (strval($Certificates->EventID->CurrentValue) <> "") {
$sFilterWrk = "`EventID` = " . ew_AdjustSql($Certificates->EventID->CurrentValue) . "";
$sSqlWrk = "SELECT `EventName`, `StartDate` FROM `SchoolEvents`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$Certificates->EventID->ViewValue = $rswrk->fields('EventName');
$Certificates->EventID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('StartDate');
$rswrk->Close();
} else {
$Certificates->EventID->ViewValue = $Certificates->EventID->CurrentValue;
}
} else {
$Certificates->EventID->ViewValue = NULL;
}
$Certificates->EventID->CssStyle = "";
$Certificates->EventID->CssClass = "";
$Certificates->EventID->ViewCustomAttributes = "";
// ContactFirstName
$Certificates->ContactFirstName->ViewValue = $Certificates->ContactFirstName->CurrentValue;
$Certificates->ContactFirstName->CssStyle = "";
$Certificates->ContactFirstName->CssClass = "";
$Certificates->ContactFirstName->ViewCustomAttributes = "";
// ContactLastName
$Certificates->ContactLastName->ViewValue = $Certificates->ContactLastName->CurrentValue;
$Certificates->ContactLastName->CssStyle = "";
$Certificates->ContactLastName->CssClass = "";
$Certificates->ContactLastName->ViewCustomAttributes = "";
// EmailAddress
$Certificates->EmailAddress->ViewValue = $Certificates->EmailAddress->CurrentValue;
$Certificates->EmailAddress->CssStyle = "";
$Certificates->EmailAddress->CssClass = "";
$Certificates->EmailAddress->ViewCustomAttributes = "";
// Attended
if (strval($Certificates->Attended->CurrentValue) <> "") {
switch ($Certificates->Attended->CurrentValue) {
case "y":
$Certificates->Attended->ViewValue = "Yes";
break;
case "n":
$Certificates->Attended->ViewValue = "No";
break;
case "u":
$Certificates->Attended->ViewValue = "Unknown";
break;
default:
$Certificates->Attended->ViewValue = $Certificates->Attended->CurrentValue;
}
} else {
$Certificates->Attended->ViewValue = NULL;
}
$Certificates->Attended->CssStyle = "";
$Certificates->Attended->CssClass = "";
$Certificates->Attended->ViewCustomAttributes = "";
// Paid
if (strval($Certificates->Paid->CurrentValue) <> "") {
switch ($Certificates->Paid->CurrentValue) {
case "y":
$Certificates->Paid->ViewValue = "Yes";
break;
case "n":
$Certificates->Paid->ViewValue = "No";
break;
default:
$Certificates->Paid->ViewValue = $Certificates->Paid->CurrentValue;
}
} else {
$Certificates->Paid->ViewValue = NULL;
}
$Certificates->Paid->CssStyle = "";
$Certificates->Paid->CssClass = "";
$Certificates->Paid->ViewCustomAttributes = "";
// TestRequired
if (strval($Certificates->TestRequired->CurrentValue) <> "") {
switch ($Certificates->TestRequired->CurrentValue) {
case "1":
$Certificates->TestRequired->ViewValue = "Yes";
break;
case "0":
$Certificates->TestRequired->ViewValue = "No";
break;
default:
$Certificates->TestRequired->ViewValue = $Certificates->TestRequired->CurrentValue;
}
} else {
$Certificates->TestRequired->ViewValue = NULL;
}
$Certificates->TestRequired->CssStyle = "";
$Certificates->TestRequired->CssClass = "";
$Certificates->TestRequired->ViewCustomAttributes = "";
// QuestionnaireID
$Certificates->QuestionnaireID->ViewValue = $Certificates->QuestionnaireID->CurrentValue;
$Certificates->QuestionnaireID->CssStyle = "";
$Certificates->QuestionnaireID->CssClass = "";
$Certificates->QuestionnaireID->ViewCustomAttributes = "";
// TestCompleted
if (strval($Certificates->TestCompleted->CurrentValue) <> "") {
switch ($Certificates->TestCompleted->CurrentValue) {
case "1":
$Certificates->TestCompleted->ViewValue = "Yes";
break;
case "0":
$Certificates->TestCompleted->ViewValue = "No";
break;
default:
$Certificates->TestCompleted->ViewValue = $Certificates->TestCompleted->CurrentValue;
}
} else {
$Certificates->TestCompleted->ViewValue = NULL;
}
$Certificates->TestCompleted->CssStyle = "";
$Certificates->TestCompleted->CssClass = "";
$Certificates->TestCompleted->ViewCustomAttributes = "";
// TestPassed
if (strval($Certificates->TestPassed->CurrentValue) <> "") {
switch ($Certificates->TestPassed->CurrentValue) {
case "1":
$Certificates->TestPassed->ViewValue = "Yes";
break;
case "0":
$Certificates->TestPassed->ViewValue = "No";
break;
default:
$Certificates->TestPassed->ViewValue = $Certificates->TestPassed->CurrentValue;
}
} else {
$Certificates->TestPassed->ViewValue = NULL;
}
$Certificates->TestPassed->CssStyle = "";
$Certificates->TestPassed->CssClass = "";
$Certificates->TestPassed->ViewCustomAttributes = "";
// AttendeeID
$Certificates->AttendeeID->ViewValue = $Certificates->AttendeeID->CurrentValue;
$Certificates->AttendeeID->CssStyle = "";
$Certificates->AttendeeID->CssClass = "";
$Certificates->AttendeeID->ViewCustomAttributes = "";
// CertificateSent
$Certificates->CertificateSent->ViewValue = $Certificates->CertificateSent->CurrentValue;
$Certificates->CertificateSent->ViewValue = ew_FormatDateTime($Certificates->CertificateSent->ViewValue, 5);
$Certificates->CertificateSent->CssStyle = "";
$Certificates->CertificateSent->CssClass = "";
$Certificates->CertificateSent->ViewCustomAttributes = "";
// EventID
$Certificates->EventID->HrefValue = "";
$Certificates->EventID->TooltipValue = "";
// ContactFirstName
$Certificates->ContactFirstName->HrefValue = "";
$Certificates->ContactFirstName->TooltipValue = "";
// ContactLastName
$Certificates->ContactLastName->HrefValue = "";
$Certificates->ContactLastName->TooltipValue = "";
// EmailAddress
$Certificates->EmailAddress->HrefValue = "";
$Certificates->EmailAddress->TooltipValue = "";
// Attended
$Certificates->Attended->HrefValue = "";
$Certificates->Attended->TooltipValue = "";
// Paid
$Certificates->Paid->HrefValue = "";
$Certificates->Paid->TooltipValue = "";
// TestRequired
$Certificates->TestRequired->HrefValue = "";
$Certificates->TestRequired->TooltipValue = "";
// QuestionnaireID
$Certificates->QuestionnaireID->HrefValue = "";
$Certificates->QuestionnaireID->TooltipValue = "";
// TestCompleted
$Certificates->TestCompleted->HrefValue = "";
$Certificates->TestCompleted->TooltipValue = "";
// TestPassed
$Certificates->TestPassed->HrefValue = "";
$Certificates->TestPassed->TooltipValue = "";
// AttendeeID
$Certificates->AttendeeID->HrefValue = "";
$Certificates->AttendeeID->TooltipValue = "";
// CertificateSent
$Certificates->CertificateSent->HrefValue = "";
$Certificates->CertificateSent->TooltipValue = "";
} elseif ($Certificates->RowType == EW_ROWTYPE_SEARCH) { // Search row
// EventID
$Certificates->EventID->EditCustomAttributes = "";
$Certificates->EventID->EditValue = ew_HtmlEncode($Certificates->EventID->AdvancedSearch->SearchValue);
if (strval($Certificates->EventID->AdvancedSearch->SearchValue) <> "") {
$sFilterWrk = "`EventID` = " . ew_AdjustSql($Certificates->EventID->AdvancedSearch->SearchValue) . "";
$sSqlWrk = "SELECT `EventName`, `StartDate` FROM `SchoolEvents`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$Certificates->EventID->EditValue = $rswrk->fields('EventName');
$Certificates->EventID->EditValue .= ew_ValueSeparator(0) . $rswrk->fields('StartDate');
$rswrk->Close();
} else {
$Certificates->EventID->EditValue = $Certificates->EventID->AdvancedSearch->SearchValue;
}
} else {
$Certificates->EventID->EditValue = NULL;
}
// ContactFirstName
$Certificates->ContactFirstName->EditCustomAttributes = "";
$Certificates->ContactFirstName->EditValue = ew_HtmlEncode($Certificates->ContactFirstName->AdvancedSearch->SearchValue);
// ContactLastName
$Certificates->ContactLastName->EditCustomAttributes = "";
$Certificates->ContactLastName->EditValue = ew_HtmlEncode($Certificates->ContactLastName->AdvancedSearch->SearchValue);
// EmailAddress
$Certificates->EmailAddress->EditCustomAttributes = "";
$Certificates->EmailAddress->EditValue = ew_HtmlEncode($Certificates->EmailAddress->AdvancedSearch->SearchValue);
// Attended
$Certificates->Attended->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("y", "Yes");
$arwrk[] = array("n", "No");
$arwrk[] = array("u", "Unknown");
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$Certificates->Attended->EditValue = $arwrk;
// Paid
$Certificates->Paid->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("y", "Yes");
$arwrk[] = array("n", "No");
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$Certificates->Paid->EditValue = $arwrk;
// TestRequired
$Certificates->TestRequired->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$Certificates->TestRequired->EditValue = $arwrk;
// QuestionnaireID
$Certificates->QuestionnaireID->EditCustomAttributes = "";
$Certificates->QuestionnaireID->EditValue = ew_HtmlEncode($Certificates->QuestionnaireID->AdvancedSearch->SearchValue);
// TestCompleted
$Certificates->TestCompleted->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$Certificates->TestCompleted->EditValue = $arwrk;
// TestPassed
$Certificates->TestPassed->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$Certificates->TestPassed->EditValue = $arwrk;
// AttendeeID
$Certificates->AttendeeID->EditCustomAttributes = "";
$Certificates->AttendeeID->EditValue = ew_HtmlEncode($Certificates->AttendeeID->AdvancedSearch->SearchValue);
// CertificateSent
$Certificates->CertificateSent->EditCustomAttributes = "";
$Certificates->CertificateSent->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($Certificates->CertificateSent->AdvancedSearch->SearchValue, 5), 5));
}
// Call Row Rendered event
if ($Certificates->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$Certificates->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $Certificates;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
if (!ew_CheckInteger($Certificates->EventID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $Certificates->EventID->FldErrMsg();
}
if (!ew_CheckInteger($Certificates->QuestionnaireID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $Certificates->QuestionnaireID->FldErrMsg();
}
if (!ew_CheckInteger($Certificates->AttendeeID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $Certificates->AttendeeID->FldErrMsg();
}
if (!ew_CheckDate($Certificates->CertificateSent->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $Certificates->CertificateSent->FldErrMsg();
}
// 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 $Certificates;
$Certificates->EventID->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_EventID");
$Certificates->ContactFirstName->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_ContactFirstName");
$Certificates->ContactLastName->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_ContactLastName");
$Certificates->EmailAddress->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_EmailAddress");
$Certificates->Attended->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_Attended");
$Certificates->Paid->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_Paid");
$Certificates->TestRequired->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_TestRequired");
$Certificates->QuestionnaireID->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_QuestionnaireID");
$Certificates->TestCompleted->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_TestCompleted");
$Certificates->TestPassed->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_TestPassed");
$Certificates->AttendeeID->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_AttendeeID");
$Certificates->CertificateSent->AdvancedSearch->SearchValue = $Certificates->getAdvancedSearch("x_CertificateSent");
}
// 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;
}
}
?>