| Current Path : /var/www/cesa.co.za/echasl23/ |
| Current File : /var/www/cesa.co.za/echasl23/BranchDocumentssrch.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 "BranchDocumentsinfo.php" ?>
<?php include "adminusersinfo.php" ?>
<?php include "SAACEBranchesinfo.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
$BranchDocuments_search = new cBranchDocuments_search();
$Page =& $BranchDocuments_search;
// Page init
$BranchDocuments_search->Page_Init();
// Page main
$BranchDocuments_search->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var BranchDocuments_search = new ew_Page("BranchDocuments_search");
// page properties
BranchDocuments_search.PageID = "search"; // page ID
BranchDocuments_search.FormID = "fBranchDocumentssearch"; // form ID
var EW_PAGE_ID = BranchDocuments_search.PageID; // for backward compatibility
// extend page with validate function for search
BranchDocuments_search.ValidateSearch = function(fobj) {
ew_PostAutoSuggest(fobj);
if (this.ValidateRequired) {
var infix = "";
elm = fobj.elements["x" + infix + "_SortOrder"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($BranchDocuments->SortOrder->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
BranchDocuments_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) { ?>
BranchDocuments_search.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
BranchDocuments_search.ValidateRequired = false; // no JavaScript validation
<?php } ?>
// search highlight properties
BranchDocuments_search.ShowHighlightText = ewLanguage.Phrase("ShowHighlight");
BranchDocuments_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("TblTypeTABLE") ?><?php echo $BranchDocuments->TableCaption() ?><br><br>
<a href="<?php echo $BranchDocuments->getReturnUrl() ?>"><?php echo $Language->Phrase("BackToList") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$BranchDocuments_search->ShowMessage();
?>
<form name="fBranchDocumentssearch" id="fBranchDocumentssearch" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return BranchDocuments_search.ValidateSearch(this);">
<p>
<input type="hidden" name="t" id="t" value="BranchDocuments">
<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 $BranchDocuments->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $BranchDocuments->BranchDocID->FldCaption() ?></td>
<td<?php echo $BranchDocuments->BranchDocID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_BranchDocID" id="z_BranchDocID" value="="></span></td>
<td<?php echo $BranchDocuments->BranchDocID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_BranchDocID" id="x_BranchDocID" title="<?php echo $BranchDocuments->BranchDocID->FldTitle() ?>" value="<?php echo $BranchDocuments->BranchDocID->EditValue ?>"<?php echo $BranchDocuments->BranchDocID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $BranchDocuments->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $BranchDocuments->BranchID->FldCaption() ?></td>
<td<?php echo $BranchDocuments->BranchID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_BranchID" id="z_BranchID" value="="></span></td>
<td<?php echo $BranchDocuments->BranchID->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_BranchID" id="x_BranchID" title="<?php echo $BranchDocuments->BranchID->FldTitle() ?>" size="30" value="<?php echo $BranchDocuments->BranchID->EditValue ?>"<?php echo $BranchDocuments->BranchID->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $BranchDocuments->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $BranchDocuments->Category->FldCaption() ?></td>
<td<?php echo $BranchDocuments->Category->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Category" id="z_Category" value="LIKE"></span></td>
<td<?php echo $BranchDocuments->Category->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<select id="x_Category" name="x_Category" title="<?php echo $BranchDocuments->Category->FldTitle() ?>"<?php echo $BranchDocuments->Category->EditAttributes() ?>>
<?php
if (is_array($BranchDocuments->Category->EditValue)) {
$arwrk = $BranchDocuments->Category->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($BranchDocuments->Category->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 $BranchDocuments->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $BranchDocuments->DocName->FldCaption() ?></td>
<td<?php echo $BranchDocuments->DocName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_DocName" id="z_DocName" value="LIKE"></span></td>
<td<?php echo $BranchDocuments->DocName->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_DocName" id="x_DocName" title="<?php echo $BranchDocuments->DocName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $BranchDocuments->DocName->EditValue ?>"<?php echo $BranchDocuments->DocName->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr<?php echo $BranchDocuments->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $BranchDocuments->SortOrder->FldCaption() ?></td>
<td<?php echo $BranchDocuments->SortOrder->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_SortOrder" id="z_SortOrder" value="="></span></td>
<td<?php echo $BranchDocuments->SortOrder->CellAttributes() ?>>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_SortOrder" id="x_SortOrder" title="<?php echo $BranchDocuments->SortOrder->FldTitle() ?>" size="30" value="<?php echo $BranchDocuments->SortOrder->EditValue ?>"<?php echo $BranchDocuments->SortOrder->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
$BranchDocuments_search->Page_Terminate();
?>
<?php
//
// Page class
//
class cBranchDocuments_search {
// Page ID
var $PageID = 'search';
// Table name
var $TableName = 'BranchDocuments';
// Page object name
var $PageObjName = 'BranchDocuments_search';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $BranchDocuments;
if ($BranchDocuments->UseTokenInUrl) $PageUrl .= "t=" . $BranchDocuments->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;
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (BranchDocuments)
$GLOBALS["BranchDocuments"] = new cBranchDocuments();
// Table object (adminusers)
$GLOBALS['adminusers'] = new cadminusers();
// Table object (SAACEBranches)
$GLOBALS['SAACEBranches'] = new cSAACEBranches();
// 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", 'BranchDocuments', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
}
// 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, $BranchDocuments;
if ($BranchDocuments->UseTokenInUrl) {
if ($objForm)
return ($BranchDocuments->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($BranchDocuments->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $BranchDocuments;
// 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("BranchDocumentslist.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, $BranchDocuments;
if ($this->IsPageRequest()) { // Validate request
// Get action
$BranchDocuments->CurrentAction = $objForm->GetValue("a_search");
switch ($BranchDocuments->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 = $BranchDocuments->UrlParm($sSrchStr);
$this->Page_Terminate("BranchDocumentslist.php" . "?" . $sSrchStr); // Go to list page
}
}
}
// Restore search settings from Session
if ($gsSearchError == "")
$this->LoadAdvancedSearch();
// Render row for search
$BranchDocuments->RowType = EW_ROWTYPE_SEARCH;
$this->RenderRow();
}
// Build advanced search
function BuildAdvancedSearch() {
global $BranchDocuments;
$sSrchUrl = "";
$this->BuildSearchUrl($sSrchUrl, $BranchDocuments->BranchDocID); // BranchDocID
$this->BuildSearchUrl($sSrchUrl, $BranchDocuments->BranchID); // BranchID
$this->BuildSearchUrl($sSrchUrl, $BranchDocuments->Category); // Category
$this->BuildSearchUrl($sSrchUrl, $BranchDocuments->DocName); // DocName
$this->BuildSearchUrl($sSrchUrl, $BranchDocuments->SortOrder); // SortOrder
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, $BranchDocuments;
// Load search values
// BranchDocID
$BranchDocuments->BranchDocID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_BranchDocID"));
$BranchDocuments->BranchDocID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_BranchDocID");
// BranchID
$BranchDocuments->BranchID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_BranchID"));
$BranchDocuments->BranchID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_BranchID");
// Category
$BranchDocuments->Category->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Category"));
$BranchDocuments->Category->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Category");
// DocName
$BranchDocuments->DocName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DocName"));
$BranchDocuments->DocName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DocName");
// SortOrder
$BranchDocuments->SortOrder->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_SortOrder"));
$BranchDocuments->SortOrder->AdvancedSearch->SearchOperator = $objForm->GetValue("z_SortOrder");
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $BranchDocuments;
// Initialize URLs
// Call Row_Rendering event
$BranchDocuments->Row_Rendering();
// Common render codes for all row types
// BranchDocID
$BranchDocuments->BranchDocID->CellCssStyle = ""; $BranchDocuments->BranchDocID->CellCssClass = "";
$BranchDocuments->BranchDocID->CellAttrs = array(); $BranchDocuments->BranchDocID->ViewAttrs = array(); $BranchDocuments->BranchDocID->EditAttrs = array();
// BranchID
$BranchDocuments->BranchID->CellCssStyle = ""; $BranchDocuments->BranchID->CellCssClass = "";
$BranchDocuments->BranchID->CellAttrs = array(); $BranchDocuments->BranchID->ViewAttrs = array(); $BranchDocuments->BranchID->EditAttrs = array();
// Category
$BranchDocuments->Category->CellCssStyle = ""; $BranchDocuments->Category->CellCssClass = "";
$BranchDocuments->Category->CellAttrs = array(); $BranchDocuments->Category->ViewAttrs = array(); $BranchDocuments->Category->EditAttrs = array();
// Document
$BranchDocuments->Document->CellCssStyle = ""; $BranchDocuments->Document->CellCssClass = "";
$BranchDocuments->Document->CellAttrs = array(); $BranchDocuments->Document->ViewAttrs = array(); $BranchDocuments->Document->EditAttrs = array();
// DocName
$BranchDocuments->DocName->CellCssStyle = ""; $BranchDocuments->DocName->CellCssClass = "";
$BranchDocuments->DocName->CellAttrs = array(); $BranchDocuments->DocName->ViewAttrs = array(); $BranchDocuments->DocName->EditAttrs = array();
// SortOrder
$BranchDocuments->SortOrder->CellCssStyle = ""; $BranchDocuments->SortOrder->CellCssClass = "";
$BranchDocuments->SortOrder->CellAttrs = array(); $BranchDocuments->SortOrder->ViewAttrs = array(); $BranchDocuments->SortOrder->EditAttrs = array();
if ($BranchDocuments->RowType == EW_ROWTYPE_VIEW) { // View row
// BranchDocID
$BranchDocuments->BranchDocID->ViewValue = $BranchDocuments->BranchDocID->CurrentValue;
$BranchDocuments->BranchDocID->CssStyle = "";
$BranchDocuments->BranchDocID->CssClass = "";
$BranchDocuments->BranchDocID->ViewCustomAttributes = "";
// BranchID
$BranchDocuments->BranchID->ViewValue = $BranchDocuments->BranchID->CurrentValue;
$BranchDocuments->BranchID->CssStyle = "";
$BranchDocuments->BranchID->CssClass = "";
$BranchDocuments->BranchID->ViewCustomAttributes = "";
// Category
if (strval($BranchDocuments->Category->CurrentValue) <> "") {
switch ($BranchDocuments->Category->CurrentValue) {
case "Agenda Minutes":
$BranchDocuments->Category->ViewValue = "Agenda Minutes";
break;
case "General Correspondence":
$BranchDocuments->Category->ViewValue = "General Correspondence";
break;
default:
$BranchDocuments->Category->ViewValue = $BranchDocuments->Category->CurrentValue;
}
} else {
$BranchDocuments->Category->ViewValue = NULL;
}
$BranchDocuments->Category->CssStyle = "";
$BranchDocuments->Category->CssClass = "";
$BranchDocuments->Category->ViewCustomAttributes = "";
// Document
if (!ew_Empty($BranchDocuments->Document->Upload->DbValue)) {
$BranchDocuments->Document->ViewValue = $BranchDocuments->Document->Upload->DbValue;
} else {
$BranchDocuments->Document->ViewValue = "";
}
$BranchDocuments->Document->CssStyle = "";
$BranchDocuments->Document->CssClass = "";
$BranchDocuments->Document->ViewCustomAttributes = "";
// DocName
$BranchDocuments->DocName->ViewValue = $BranchDocuments->DocName->CurrentValue;
$BranchDocuments->DocName->CssStyle = "";
$BranchDocuments->DocName->CssClass = "";
$BranchDocuments->DocName->ViewCustomAttributes = "";
// SortOrder
$BranchDocuments->SortOrder->ViewValue = $BranchDocuments->SortOrder->CurrentValue;
$BranchDocuments->SortOrder->CssStyle = "";
$BranchDocuments->SortOrder->CssClass = "";
$BranchDocuments->SortOrder->ViewCustomAttributes = "";
// BranchDocID
$BranchDocuments->BranchDocID->HrefValue = "";
$BranchDocuments->BranchDocID->TooltipValue = "";
// BranchID
$BranchDocuments->BranchID->HrefValue = "";
$BranchDocuments->BranchID->TooltipValue = "";
// Category
$BranchDocuments->Category->HrefValue = "";
$BranchDocuments->Category->TooltipValue = "";
// Document
if (!ew_Empty($BranchDocuments->Document->Upload->DbValue)) {
$BranchDocuments->Document->HrefValue = ew_UploadPathEx(FALSE, $BranchDocuments->Document->UploadPath) . ((!empty($BranchDocuments->Document->ViewValue)) ? $BranchDocuments->Document->ViewValue : $BranchDocuments->Document->CurrentValue);
if ($BranchDocuments->Export <> "") $BranchDocuments->Document->HrefValue = ew_ConvertFullUrl($BranchDocuments->Document->HrefValue);
} else {
$BranchDocuments->Document->HrefValue = "";
}
$BranchDocuments->Document->TooltipValue = "";
// DocName
$BranchDocuments->DocName->HrefValue = "";
$BranchDocuments->DocName->TooltipValue = "";
// SortOrder
$BranchDocuments->SortOrder->HrefValue = "";
$BranchDocuments->SortOrder->TooltipValue = "";
} elseif ($BranchDocuments->RowType == EW_ROWTYPE_SEARCH) { // Search row
// BranchDocID
$BranchDocuments->BranchDocID->EditCustomAttributes = "";
$BranchDocuments->BranchDocID->EditValue = ew_HtmlEncode($BranchDocuments->BranchDocID->AdvancedSearch->SearchValue);
// BranchID
$BranchDocuments->BranchID->EditCustomAttributes = "";
$BranchDocuments->BranchID->EditValue = ew_HtmlEncode($BranchDocuments->BranchID->AdvancedSearch->SearchValue);
// Category
$BranchDocuments->Category->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("Agenda Minutes", "Agenda Minutes");
$arwrk[] = array("General Correspondence", "General Correspondence");
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$BranchDocuments->Category->EditValue = $arwrk;
// Document
$BranchDocuments->Document->EditCustomAttributes = "";
if (!ew_Empty($BranchDocuments->Document->Upload->DbValue)) {
$BranchDocuments->Document->EditValue = $BranchDocuments->Document->Upload->DbValue;
} else {
$BranchDocuments->Document->EditValue = "";
}
// DocName
$BranchDocuments->DocName->EditCustomAttributes = "";
$BranchDocuments->DocName->EditValue = ew_HtmlEncode($BranchDocuments->DocName->AdvancedSearch->SearchValue);
// SortOrder
$BranchDocuments->SortOrder->EditCustomAttributes = "";
$BranchDocuments->SortOrder->EditValue = ew_HtmlEncode($BranchDocuments->SortOrder->AdvancedSearch->SearchValue);
}
// Call Row Rendered event
if ($BranchDocuments->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$BranchDocuments->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $BranchDocuments;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
if (!ew_CheckInteger($BranchDocuments->SortOrder->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $BranchDocuments->SortOrder->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 $BranchDocuments;
$BranchDocuments->BranchDocID->AdvancedSearch->SearchValue = $BranchDocuments->getAdvancedSearch("x_BranchDocID");
$BranchDocuments->BranchID->AdvancedSearch->SearchValue = $BranchDocuments->getAdvancedSearch("x_BranchID");
$BranchDocuments->Category->AdvancedSearch->SearchValue = $BranchDocuments->getAdvancedSearch("x_Category");
$BranchDocuments->DocName->AdvancedSearch->SearchValue = $BranchDocuments->getAdvancedSearch("x_DocName");
$BranchDocuments->SortOrder->AdvancedSearch->SearchValue = $BranchDocuments->getAdvancedSearch("x_SortOrder");
}
// 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;
}
}
?>