| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEMessagessrch.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 "CCEMessagesinfo.php" ?>
<?php include "CCEModulesinfo.php" ?>
<?php include "CCEUsersinfo.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
$CCEMessages_search = new cCCEMessages_search();
$Page =& $CCEMessages_search;
// Page init
$CCEMessages_search->Page_Init();
// Page main
$CCEMessages_search->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEMessages_search = new ew_Page("CCEMessages_search");
// page properties
CCEMessages_search.PageID = "search"; // page ID
CCEMessages_search.FormID = "fCCEMessagessearch"; // form ID
var EW_PAGE_ID = CCEMessages_search.PageID; // for backward compatibility
// extend page with validate function for search
CCEMessages_search.ValidateSearch = function(fobj) {
ew_PostAutoSuggest(fobj);
if (this.ValidateRequired) {
var infix = "";
elm = fobj.elements["x" + infix + "_SentDateTime"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEMessages->SentDateTime->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_SentByName"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEMessages->SentByName->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_SentByStudentID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEMessages->SentByStudentID->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_SentByFacilitatorID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEMessages->SentByFacilitatorID->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_SentByExpertID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEMessages->SentByExpertID->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
CCEMessages_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) { ?>
CCEMessages_search.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEMessages_search.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-cold-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></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("TblTypeTABLE") ?><?php echo $CCEMessages->TableCaption() ?><br><br>
<a href="<?php echo $CCEMessages->getReturnUrl() ?>"><?php echo $Language->Phrase("BackToList") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEMessages_search->ShowMessage();
?>
<form name="fCCEMessagessearch" id="fCCEMessagessearch" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEMessages_search.ValidateSearch(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEMessages">
<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 $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->CCEMessageID->FldCaption() ?></td>
<td<?php echo $CCEMessages->CCEMessageID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CCEMessageID" id="z_CCEMessageID" value="="></span></td>
<td<?php echo $CCEMessages->CCEMessageID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_CCEMessageID" id="x_CCEMessageID" title="<?php echo $CCEMessages->CCEMessageID->FldTitle() ?>" value="<?php echo $CCEMessages->CCEMessageID->EditValue ?>"<?php echo $CCEMessages->CCEMessageID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->CCEModuleID->FldCaption() ?></td>
<td<?php echo $CCEMessages->CCEModuleID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CCEModuleID" id="z_CCEModuleID" value="="></span></td>
<td<?php echo $CCEMessages->CCEModuleID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<select id="x_CCEModuleID" name="x_CCEModuleID" title="<?php echo $CCEMessages->CCEModuleID->FldTitle() ?>"<?php echo $CCEMessages->CCEModuleID->EditAttributes() ?>>
<?php
if (is_array($CCEMessages->CCEModuleID->EditValue)) {
$arwrk = $CCEMessages->CCEModuleID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEMessages->CCEModuleID->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 $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentDateTime->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentDateTime->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_SentDateTime" id="z_SentDateTime" value="="></span></td>
<td<?php echo $CCEMessages->SentDateTime->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SentDateTime" id="x_SentDateTime" title="<?php echo $CCEMessages->SentDateTime->FldTitle() ?>" value="<?php echo $CCEMessages->SentDateTime->EditValue ?>"<?php echo $CCEMessages->SentDateTime->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x_SentDateTime" name="cal_x_SentDateTime" alt="<?php echo $Language->Phrase("PickDate") ?>" title="<?php echo $Language->Phrase("PickDate") ?>" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup({
inputField: "x_SentDateTime", // input field id
showsTime: true, // show time
ifFormat: "%Y/%m/%d %H:%M:%S", // date format
button: "cal_x_SentDateTime" // button id
});
</script>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentByName->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentByName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_SentByName" id="z_SentByName" value="LIKE"></span></td>
<td<?php echo $CCEMessages->SentByName->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SentByName" id="x_SentByName" title="<?php echo $CCEMessages->SentByName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEMessages->SentByName->EditValue ?>"<?php echo $CCEMessages->SentByName->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentTo->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentTo->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_SentTo" id="z_SentTo" value="LIKE"></span></td>
<td<?php echo $CCEMessages->SentTo->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<textarea name="x_SentTo" id="x_SentTo" title="<?php echo $CCEMessages->SentTo->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEMessages->SentTo->EditAttributes() ?>><?php echo $CCEMessages->SentTo->EditValue ?></textarea>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->MessageSubject->FldCaption() ?></td>
<td<?php echo $CCEMessages->MessageSubject->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_MessageSubject" id="z_MessageSubject" value="LIKE"></span></td>
<td<?php echo $CCEMessages->MessageSubject->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_MessageSubject" id="x_MessageSubject" title="<?php echo $CCEMessages->MessageSubject->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEMessages->MessageSubject->EditValue ?>"<?php echo $CCEMessages->MessageSubject->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->MessageText->FldCaption() ?></td>
<td<?php echo $CCEMessages->MessageText->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_MessageText" id="z_MessageText" value="LIKE"></span></td>
<td<?php echo $CCEMessages->MessageText->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<textarea name="x_MessageText" id="x_MessageText" title="<?php echo $CCEMessages->MessageText->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEMessages->MessageText->EditAttributes() ?>><?php echo $CCEMessages->MessageText->EditValue ?></textarea>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentByStudentID->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentByStudentID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_SentByStudentID" id="z_SentByStudentID" value="="></span></td>
<td<?php echo $CCEMessages->SentByStudentID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SentByStudentID" id="x_SentByStudentID" title="<?php echo $CCEMessages->SentByStudentID->FldTitle() ?>" size="30" value="<?php echo $CCEMessages->SentByStudentID->EditValue ?>"<?php echo $CCEMessages->SentByStudentID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentByFacilitatorID->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentByFacilitatorID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_SentByFacilitatorID" id="z_SentByFacilitatorID" value="="></span></td>
<td<?php echo $CCEMessages->SentByFacilitatorID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SentByFacilitatorID" id="x_SentByFacilitatorID" title="<?php echo $CCEMessages->SentByFacilitatorID->FldTitle() ?>" size="30" value="<?php echo $CCEMessages->SentByFacilitatorID->EditValue ?>"<?php echo $CCEMessages->SentByFacilitatorID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $CCEMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEMessages->SentByExpertID->FldCaption() ?></td>
<td<?php echo $CCEMessages->SentByExpertID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_SentByExpertID" id="z_SentByExpertID" value="="></span></td>
<td<?php echo $CCEMessages->SentByExpertID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SentByExpertID" id="x_SentByExpertID" title="<?php echo $CCEMessages->SentByExpertID->FldTitle() ?>" size="30" value="<?php echo $CCEMessages->SentByExpertID->EditValue ?>"<?php echo $CCEMessages->SentByExpertID->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
$CCEMessages_search->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEMessages_search {
// Page ID
var $PageID = 'search';
// Table name
var $TableName = 'CCEMessages';
// Page object name
var $PageObjName = 'CCEMessages_search';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEMessages;
if ($CCEMessages->UseTokenInUrl) $PageUrl .= "t=" . $CCEMessages->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, $CCEMessages;
if ($CCEMessages->UseTokenInUrl) {
if ($objForm)
return ($CCEMessages->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEMessages->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEMessages)
$GLOBALS["CCEMessages"] = new cCCEMessages();
// Table object (CCEModules)
$GLOBALS['CCEModules'] = new cCCEModules();
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// 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", 'CCEMessages', 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 $CCEMessages;
// 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->CanSearch()) {
$Security->SaveLastUrl();
$this->Page_Terminate("CCEMessageslist.php");
}
// 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, $CCEMessages;
if ($this->IsPageRequest()) { // Validate request
// Get action
$CCEMessages->CurrentAction = $objForm->GetValue("a_search");
switch ($CCEMessages->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 = $CCEMessages->UrlParm($sSrchStr);
$this->Page_Terminate("CCEMessageslist.php" . "?" . $sSrchStr); // Go to list page
}
}
}
// Restore search settings from Session
if ($gsSearchError == "")
$this->LoadAdvancedSearch();
// Render row for search
$CCEMessages->RowType = EW_ROWTYPE_SEARCH;
$this->RenderRow();
}
// Build advanced search
function BuildAdvancedSearch() {
global $CCEMessages;
$sSrchUrl = "";
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->CCEMessageID); // CCEMessageID
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->CCEModuleID); // CCEModuleID
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentDateTime); // SentDateTime
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentByName); // SentByName
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentTo); // SentTo
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->MessageSubject); // MessageSubject
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->MessageText); // MessageText
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentByStudentID); // SentByStudentID
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentByFacilitatorID); // SentByFacilitatorID
$this->BuildSearchUrl($sSrchUrl, $CCEMessages->SentByExpertID); // SentByExpertID
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, $CCEMessages;
// Load search values
// CCEMessageID
$CCEMessages->CCEMessageID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_CCEMessageID"));
$CCEMessages->CCEMessageID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_CCEMessageID");
// CCEModuleID
$CCEMessages->CCEModuleID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_CCEModuleID"));
$CCEMessages->CCEModuleID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_CCEModuleID");
// SentDateTime
$CCEMessages->SentDateTime->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentDateTime"));
$CCEMessages->SentDateTime->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentDateTime");
// SentByName
$CCEMessages->SentByName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentByName"));
$CCEMessages->SentByName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentByName");
// SentTo
$CCEMessages->SentTo->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentTo"));
$CCEMessages->SentTo->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentTo");
// MessageSubject
$CCEMessages->MessageSubject->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_MessageSubject"));
$CCEMessages->MessageSubject->AdvancedSearch->SearchOperator = $objForm->GetValue("z_MessageSubject");
// MessageText
$CCEMessages->MessageText->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_MessageText"));
$CCEMessages->MessageText->AdvancedSearch->SearchOperator = $objForm->GetValue("z_MessageText");
// SentByStudentID
$CCEMessages->SentByStudentID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentByStudentID"));
$CCEMessages->SentByStudentID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentByStudentID");
// SentByFacilitatorID
$CCEMessages->SentByFacilitatorID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentByFacilitatorID"));
$CCEMessages->SentByFacilitatorID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentByFacilitatorID");
// SentByExpertID
$CCEMessages->SentByExpertID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SentByExpertID"));
$CCEMessages->SentByExpertID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SentByExpertID");
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEMessages;
// Initialize URLs
// Call Row_Rendering event
$CCEMessages->Row_Rendering();
// Common render codes for all row types
// CCEMessageID
$CCEMessages->CCEMessageID->CellCssStyle = ""; $CCEMessages->CCEMessageID->CellCssClass = "";
$CCEMessages->CCEMessageID->CellAttrs = array(); $CCEMessages->CCEMessageID->ViewAttrs = array(); $CCEMessages->CCEMessageID->EditAttrs = array();
// CCEModuleID
$CCEMessages->CCEModuleID->CellCssStyle = ""; $CCEMessages->CCEModuleID->CellCssClass = "";
$CCEMessages->CCEModuleID->CellAttrs = array(); $CCEMessages->CCEModuleID->ViewAttrs = array(); $CCEMessages->CCEModuleID->EditAttrs = array();
// SentDateTime
$CCEMessages->SentDateTime->CellCssStyle = ""; $CCEMessages->SentDateTime->CellCssClass = "";
$CCEMessages->SentDateTime->CellAttrs = array(); $CCEMessages->SentDateTime->ViewAttrs = array(); $CCEMessages->SentDateTime->EditAttrs = array();
// SentByName
$CCEMessages->SentByName->CellCssStyle = ""; $CCEMessages->SentByName->CellCssClass = "";
$CCEMessages->SentByName->CellAttrs = array(); $CCEMessages->SentByName->ViewAttrs = array(); $CCEMessages->SentByName->EditAttrs = array();
// SentTo
$CCEMessages->SentTo->CellCssStyle = ""; $CCEMessages->SentTo->CellCssClass = "";
$CCEMessages->SentTo->CellAttrs = array(); $CCEMessages->SentTo->ViewAttrs = array(); $CCEMessages->SentTo->EditAttrs = array();
// MessageSubject
$CCEMessages->MessageSubject->CellCssStyle = ""; $CCEMessages->MessageSubject->CellCssClass = "";
$CCEMessages->MessageSubject->CellAttrs = array(); $CCEMessages->MessageSubject->ViewAttrs = array(); $CCEMessages->MessageSubject->EditAttrs = array();
// MessageText
$CCEMessages->MessageText->CellCssStyle = ""; $CCEMessages->MessageText->CellCssClass = "";
$CCEMessages->MessageText->CellAttrs = array(); $CCEMessages->MessageText->ViewAttrs = array(); $CCEMessages->MessageText->EditAttrs = array();
// SentByStudentID
$CCEMessages->SentByStudentID->CellCssStyle = ""; $CCEMessages->SentByStudentID->CellCssClass = "";
$CCEMessages->SentByStudentID->CellAttrs = array(); $CCEMessages->SentByStudentID->ViewAttrs = array(); $CCEMessages->SentByStudentID->EditAttrs = array();
// SentByFacilitatorID
$CCEMessages->SentByFacilitatorID->CellCssStyle = ""; $CCEMessages->SentByFacilitatorID->CellCssClass = "";
$CCEMessages->SentByFacilitatorID->CellAttrs = array(); $CCEMessages->SentByFacilitatorID->ViewAttrs = array(); $CCEMessages->SentByFacilitatorID->EditAttrs = array();
// MessageFile
$CCEMessages->MessageFile->CellCssStyle = ""; $CCEMessages->MessageFile->CellCssClass = "";
$CCEMessages->MessageFile->CellAttrs = array(); $CCEMessages->MessageFile->ViewAttrs = array(); $CCEMessages->MessageFile->EditAttrs = array();
// SentByExpertID
$CCEMessages->SentByExpertID->CellCssStyle = ""; $CCEMessages->SentByExpertID->CellCssClass = "";
$CCEMessages->SentByExpertID->CellAttrs = array(); $CCEMessages->SentByExpertID->ViewAttrs = array(); $CCEMessages->SentByExpertID->EditAttrs = array();
if ($CCEMessages->RowType == EW_ROWTYPE_VIEW) { // View row
// CCEMessageID
$CCEMessages->CCEMessageID->ViewValue = $CCEMessages->CCEMessageID->CurrentValue;
$CCEMessages->CCEMessageID->CssStyle = "";
$CCEMessages->CCEMessageID->CssClass = "";
$CCEMessages->CCEMessageID->ViewCustomAttributes = "";
// CCEModuleID
if (strval($CCEMessages->CCEModuleID->CurrentValue) <> "") {
$sFilterWrk = "`CCEModuleID` = " . ew_AdjustSql($CCEMessages->CCEModuleID->CurrentValue) . "";
$sSqlWrk = "SELECT `ModuleName` FROM `CCEModules`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `ModuleName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEMessages->CCEModuleID->ViewValue = $rswrk->fields('ModuleName');
$rswrk->Close();
} else {
$CCEMessages->CCEModuleID->ViewValue = $CCEMessages->CCEModuleID->CurrentValue;
}
} else {
$CCEMessages->CCEModuleID->ViewValue = NULL;
}
$CCEMessages->CCEModuleID->CssStyle = "";
$CCEMessages->CCEModuleID->CssClass = "";
$CCEMessages->CCEModuleID->ViewCustomAttributes = "";
// SentDateTime
$CCEMessages->SentDateTime->ViewValue = $CCEMessages->SentDateTime->CurrentValue;
$CCEMessages->SentDateTime->ViewValue = ew_FormatDateTime($CCEMessages->SentDateTime->ViewValue, 9);
$CCEMessages->SentDateTime->CssStyle = "";
$CCEMessages->SentDateTime->CssClass = "";
$CCEMessages->SentDateTime->ViewCustomAttributes = "";
// SentByName
$CCEMessages->SentByName->ViewValue = $CCEMessages->SentByName->CurrentValue;
$CCEMessages->SentByName->CssStyle = "";
$CCEMessages->SentByName->CssClass = "";
$CCEMessages->SentByName->ViewCustomAttributes = "";
// SentTo
$CCEMessages->SentTo->ViewValue = $CCEMessages->SentTo->CurrentValue;
$CCEMessages->SentTo->CssStyle = "";
$CCEMessages->SentTo->CssClass = "";
$CCEMessages->SentTo->ViewCustomAttributes = "";
// MessageSubject
$CCEMessages->MessageSubject->ViewValue = $CCEMessages->MessageSubject->CurrentValue;
$CCEMessages->MessageSubject->CssStyle = "";
$CCEMessages->MessageSubject->CssClass = "";
$CCEMessages->MessageSubject->ViewCustomAttributes = "";
// MessageText
$CCEMessages->MessageText->ViewValue = $CCEMessages->MessageText->CurrentValue;
if (!is_null($CCEMessages->MessageText->ViewValue)) $CCEMessages->MessageText->ViewValue = str_replace("\n", "<br>", $CCEMessages->MessageText->ViewValue);
$CCEMessages->MessageText->CssStyle = "";
$CCEMessages->MessageText->CssClass = "";
$CCEMessages->MessageText->ViewCustomAttributes = "";
// SentByStudentID
$CCEMessages->SentByStudentID->ViewValue = $CCEMessages->SentByStudentID->CurrentValue;
$CCEMessages->SentByStudentID->CssStyle = "";
$CCEMessages->SentByStudentID->CssClass = "";
$CCEMessages->SentByStudentID->ViewCustomAttributes = "";
// SentByFacilitatorID
$CCEMessages->SentByFacilitatorID->ViewValue = $CCEMessages->SentByFacilitatorID->CurrentValue;
$CCEMessages->SentByFacilitatorID->CssStyle = "";
$CCEMessages->SentByFacilitatorID->CssClass = "";
$CCEMessages->SentByFacilitatorID->ViewCustomAttributes = "";
// MessageFile
if (!ew_Empty($CCEMessages->MessageFile->Upload->DbValue)) {
$CCEMessages->MessageFile->ViewValue = $CCEMessages->MessageFile->Upload->DbValue;
} else {
$CCEMessages->MessageFile->ViewValue = "";
}
$CCEMessages->MessageFile->CssStyle = "";
$CCEMessages->MessageFile->CssClass = "";
$CCEMessages->MessageFile->ViewCustomAttributes = "";
// SentByExpertID
$CCEMessages->SentByExpertID->ViewValue = $CCEMessages->SentByExpertID->CurrentValue;
$CCEMessages->SentByExpertID->CssStyle = "";
$CCEMessages->SentByExpertID->CssClass = "";
$CCEMessages->SentByExpertID->ViewCustomAttributes = "";
// CCEMessageID
$CCEMessages->CCEMessageID->HrefValue = "";
$CCEMessages->CCEMessageID->TooltipValue = "";
// CCEModuleID
$CCEMessages->CCEModuleID->HrefValue = "";
$CCEMessages->CCEModuleID->TooltipValue = "";
// SentDateTime
$CCEMessages->SentDateTime->HrefValue = "";
$CCEMessages->SentDateTime->TooltipValue = "";
// SentByName
$CCEMessages->SentByName->HrefValue = "";
$CCEMessages->SentByName->TooltipValue = "";
// SentTo
$CCEMessages->SentTo->HrefValue = "";
$CCEMessages->SentTo->TooltipValue = "";
// MessageSubject
$CCEMessages->MessageSubject->HrefValue = "";
$CCEMessages->MessageSubject->TooltipValue = "";
// MessageText
$CCEMessages->MessageText->HrefValue = "";
$CCEMessages->MessageText->TooltipValue = "";
// SentByStudentID
$CCEMessages->SentByStudentID->HrefValue = "";
$CCEMessages->SentByStudentID->TooltipValue = "";
// SentByFacilitatorID
$CCEMessages->SentByFacilitatorID->HrefValue = "";
$CCEMessages->SentByFacilitatorID->TooltipValue = "";
// MessageFile
if (!ew_Empty($CCEMessages->MessageFile->Upload->DbValue)) {
$CCEMessages->MessageFile->HrefValue = ew_UploadPathEx(FALSE, $CCEMessages->MessageFile->UploadPath) . ((!empty($CCEMessages->MessageFile->ViewValue)) ? $CCEMessages->MessageFile->ViewValue : $CCEMessages->MessageFile->CurrentValue);
if ($CCEMessages->Export <> "") $CCEMessages->MessageFile->HrefValue = ew_ConvertFullUrl($CCEMessages->MessageFile->HrefValue);
} else {
$CCEMessages->MessageFile->HrefValue = "";
}
$CCEMessages->MessageFile->TooltipValue = "";
// SentByExpertID
$CCEMessages->SentByExpertID->HrefValue = "";
$CCEMessages->SentByExpertID->TooltipValue = "";
} elseif ($CCEMessages->RowType == EW_ROWTYPE_SEARCH) { // Search row
// CCEMessageID
$CCEMessages->CCEMessageID->EditCustomAttributes = "";
$CCEMessages->CCEMessageID->EditValue = ew_HtmlEncode($CCEMessages->CCEMessageID->AdvancedSearch->SearchValue);
// CCEModuleID
$CCEMessages->CCEModuleID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `CCEModuleID`, `ModuleName`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEModules`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `ModuleName`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEMessages->CCEModuleID->EditValue = $arwrk;
// SentDateTime
$CCEMessages->SentDateTime->EditCustomAttributes = "";
$CCEMessages->SentDateTime->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($CCEMessages->SentDateTime->AdvancedSearch->SearchValue, 9), 9));
// SentByName
$CCEMessages->SentByName->EditCustomAttributes = "";
$CCEMessages->SentByName->EditValue = ew_HtmlEncode($CCEMessages->SentByName->AdvancedSearch->SearchValue);
// SentTo
$CCEMessages->SentTo->EditCustomAttributes = "";
$CCEMessages->SentTo->EditValue = ew_HtmlEncode($CCEMessages->SentTo->AdvancedSearch->SearchValue);
// MessageSubject
$CCEMessages->MessageSubject->EditCustomAttributes = "";
$CCEMessages->MessageSubject->EditValue = ew_HtmlEncode($CCEMessages->MessageSubject->AdvancedSearch->SearchValue);
// MessageText
$CCEMessages->MessageText->EditCustomAttributes = "";
$CCEMessages->MessageText->EditValue = ew_HtmlEncode($CCEMessages->MessageText->AdvancedSearch->SearchValue);
// SentByStudentID
$CCEMessages->SentByStudentID->EditCustomAttributes = "";
$CCEMessages->SentByStudentID->EditValue = ew_HtmlEncode($CCEMessages->SentByStudentID->AdvancedSearch->SearchValue);
// SentByFacilitatorID
$CCEMessages->SentByFacilitatorID->EditCustomAttributes = "";
$CCEMessages->SentByFacilitatorID->EditValue = ew_HtmlEncode($CCEMessages->SentByFacilitatorID->AdvancedSearch->SearchValue);
// MessageFile
$CCEMessages->MessageFile->EditCustomAttributes = "";
if (!ew_Empty($CCEMessages->MessageFile->Upload->DbValue)) {
$CCEMessages->MessageFile->EditValue = $CCEMessages->MessageFile->Upload->DbValue;
} else {
$CCEMessages->MessageFile->EditValue = "";
}
// SentByExpertID
$CCEMessages->SentByExpertID->EditCustomAttributes = "";
$CCEMessages->SentByExpertID->EditValue = ew_HtmlEncode($CCEMessages->SentByExpertID->AdvancedSearch->SearchValue);
}
// Call Row Rendered event
if ($CCEMessages->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEMessages->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $CCEMessages;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
if (!ew_CheckDate($CCEMessages->SentDateTime->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEMessages->SentDateTime->FldErrMsg();
}
if (!ew_CheckInteger($CCEMessages->SentByName->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEMessages->SentByName->FldErrMsg();
}
if (!ew_CheckInteger($CCEMessages->SentByStudentID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEMessages->SentByStudentID->FldErrMsg();
}
if (!ew_CheckInteger($CCEMessages->SentByFacilitatorID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEMessages->SentByFacilitatorID->FldErrMsg();
}
if (!ew_CheckInteger($CCEMessages->SentByExpertID->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEMessages->SentByExpertID->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 $CCEMessages;
$CCEMessages->CCEMessageID->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_CCEMessageID");
$CCEMessages->CCEModuleID->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_CCEModuleID");
$CCEMessages->SentDateTime->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentDateTime");
$CCEMessages->SentByName->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentByName");
$CCEMessages->SentTo->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentTo");
$CCEMessages->MessageSubject->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_MessageSubject");
$CCEMessages->MessageText->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_MessageText");
$CCEMessages->SentByStudentID->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentByStudentID");
$CCEMessages->SentByFacilitatorID->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentByFacilitatorID");
$CCEMessages->SentByExpertID->AdvancedSearch->SearchValue = $CCEMessages->getAdvancedSearch("x_SentByExpertID");
}
// 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;
}
}
?>