| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEDocumentslist.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 "CCEDocumentsinfo.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
$CCEDocuments_list = new cCCEDocuments_list();
$Page =& $CCEDocuments_list;
// Page init
$CCEDocuments_list->Page_Init();
// Page main
$CCEDocuments_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEDocuments->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var CCEDocuments_list = new ew_Page("CCEDocuments_list");
// page properties
CCEDocuments_list.PageID = "list"; // page ID
CCEDocuments_list.FormID = "fCCEDocumentslist"; // form ID
var EW_PAGE_ID = CCEDocuments_list.PageID; // for backward compatibility
// extend page with ValidateForm function
CCEDocuments_list.ValidateForm = function(fobj) {
ew_PostAutoSuggest(fobj);
if (!this.ValidateRequired)
return true; // ignore validation
if (fobj.a_confirm && fobj.a_confirm.value == "F")
return true;
var i, elm, aelm, infix;
var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
for (i=0; i<rowcnt; i++) {
infix = (fobj.key_count) ? String(i+1) : "";
elm = fobj.elements["x" + infix + "_DocumentCategory"];
if (elm && !ew_HasValue(elm))
return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEDocuments->DocumentCategory->FldCaption()) ?>");
elm = fobj.elements["x" + infix + "_ReleaseDate"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEDocuments->ReleaseDate->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_ArchiveYear"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEDocuments->ArchiveYear->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with validate function for search
CCEDocuments_list.ValidateSearch = function(fobj) {
ew_PostAutoSuggest(fobj);
if (this.ValidateRequired) {
var infix = "";
elm = fobj.elements["x" + infix + "_ArchiveYear"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEDocuments->ArchiveYear->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
CCEDocuments_list.Form_CustomValidate =
function(fobj) { // DO NOT CHANGE THIS LINE!
// Your custom validation code here, return false if invalid.
return true;
}
<?php if (EW_CLIENT_VALIDATE) { ?>
CCEDocuments_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEDocuments_list.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>
<?php } ?>
<?php if ($CCEDocuments->Export == "") { ?>
<?php
$gsMasterReturnUrl = "CCEModuleslist.php";
if ($CCEDocuments_list->sDbMasterFilter <> "" && $CCEDocuments->getCurrentMasterTable() == "CCEModules") {
if ($CCEDocuments_list->bMasterRecordExists) {
if ($CCEDocuments->getCurrentMasterTable() == $CCEDocuments->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "CCEModulesmaster.php" ?>
<?php
}
}
?>
<?php } ?>
<?php
$bSelectLimit = EW_SELECT_LIMIT;
if ($bSelectLimit) {
$CCEDocuments_list->lTotalRecs = $CCEDocuments->SelectRecordCount();
} else {
if ($rs = $CCEDocuments_list->LoadRecordset())
$CCEDocuments_list->lTotalRecs = $rs->RecordCount();
}
$CCEDocuments_list->lStartRec = 1;
if ($CCEDocuments_list->lDisplayRecs <= 0 || ($CCEDocuments->Export <> "" && $CCEDocuments->ExportAll)) // Display all records
$CCEDocuments_list->lDisplayRecs = $CCEDocuments_list->lTotalRecs;
if (!($CCEDocuments->Export <> "" && $CCEDocuments->ExportAll))
$CCEDocuments_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
$rs = $CCEDocuments_list->LoadRecordset($CCEDocuments_list->lStartRec-1, $CCEDocuments_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEDocuments->TableCaption() ?>
<?php if ($CCEDocuments->Export == "" && $CCEDocuments->CurrentAction == "") { ?>
<a href="<?php echo $CCEDocuments_list->ExportPrintUrl ?>"><?php echo $Language->Phrase("PrinterFriendly") ?></a>
<a href="<?php echo $CCEDocuments_list->ExportExcelUrl ?>"><?php echo $Language->Phrase("ExportToExcel") ?></a>
<a href="<?php echo $CCEDocuments_list->ExportWordUrl ?>"><?php echo $Language->Phrase("ExportToWord") ?></a>
<a name="emf_CCEDocuments" id="emf_CCEDocuments" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEDocuments',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCEDocumentslist,sel:false});"><?php echo $Language->Phrase("ExportToEmail") ?></a>
<?php } ?>
</span></p>
<?php if ($Security->CanSearch()) { ?>
<?php if ($CCEDocuments->Export == "" && $CCEDocuments->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCEDocuments_list);" style="text-decoration: none;"><img id="CCEDocuments_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker"> <?php echo $Language->Phrase("Search") ?></span><br>
<div id="CCEDocuments_list_SearchPanel">
<form name="fCCEDocumentslistsrch" id="fCCEDocumentslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>" onsubmit="return CCEDocuments_list.ValidateSearch(this);">
<input type="hidden" id="t" name="t" value="CCEDocuments">
<?php
if ($gsSearchError == "")
$CCEDocuments_list->LoadAdvancedSearch(); // Load advanced search
// Render for search
$CCEDocuments->RowType = EW_ROWTYPE_SEARCH;
// Render row
$CCEDocuments_list->RenderRow();
?>
<table class="ewBasicSearch">
<tr>
<td><span class="phpmaker"><?php echo $CCEDocuments->CCEModuleID->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CCEModuleID" id="z_CCEModuleID" value="="></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<?php if ($CCEDocuments->CCEModuleID->getSessionValue() <> "") { ?>
<div<?php echo $CCEDocuments->CCEModuleID->ViewAttributes() ?>><?php echo $CCEDocuments->CCEModuleID->ListViewValue() ?></div>
<input type="hidden" id="x_CCEModuleID" name="x_CCEModuleID" value="<?php echo ew_HtmlEncode($CCEDocuments->CCEModuleID->AdvancedSearch->SearchValue) ?>">
<?php } else { ?>
<select id="x_CCEModuleID" name="x_CCEModuleID" title="<?php echo $CCEDocuments->CCEModuleID->FldTitle() ?>"<?php echo $CCEDocuments->CCEModuleID->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->CCEModuleID->EditValue)) {
$arwrk = $CCEDocuments->CCEModuleID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->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] ?>
<?php if ($arwrk[$rowcntwrk][2] <> "") { ?>
<?php echo ew_ValueSeparator($rowcntwrk) ?><?php echo $arwrk[$rowcntwrk][2] ?>
<?php } ?>
</option>
<?php
}
}
?>
</select>
<?php } ?>
</span>
</div>
</td>
</tr>
<tr>
<td><span class="phpmaker"><?php echo $CCEDocuments->DocumentCode->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_DocumentCode" id="z_DocumentCode" value="LIKE"></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_DocumentCode" id="x_DocumentCode" title="<?php echo $CCEDocuments->DocumentCode->FldTitle() ?>" size="30" maxlength="20" value="<?php echo $CCEDocuments->DocumentCode->EditValue ?>"<?php echo $CCEDocuments->DocumentCode->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr>
<td><span class="phpmaker"><?php echo $CCEDocuments->DocumentCategory->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_DocumentCategory" id="z_DocumentCategory" value="="></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<select id="x_DocumentCategory" name="x_DocumentCategory" title="<?php echo $CCEDocuments->DocumentCategory->FldTitle() ?>"<?php echo $CCEDocuments->DocumentCategory->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->DocumentCategory->EditValue)) {
$arwrk = $CCEDocuments->DocumentCategory->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->DocumentCategory->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>
<td><span class="phpmaker"><?php echo $CCEDocuments->DocumentName->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_DocumentName" id="z_DocumentName" value="LIKE"></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_DocumentName" id="x_DocumentName" title="<?php echo $CCEDocuments->DocumentName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEDocuments->DocumentName->EditValue ?>"<?php echo $CCEDocuments->DocumentName->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
<tr>
<td><span class="phpmaker"><?php echo $CCEDocuments->Archived->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Archived" id="z_Archived" value="="></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<div id="tp_x_Archived" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_Archived" id="x_Archived" title="<?php echo $CCEDocuments->Archived->FldTitle() ?>" value="{value}"<?php echo $CCEDocuments->Archived->EditAttributes() ?>></label></div>
<div id="dsl_x_Archived" repeatcolumn="5">
<?php
$arwrk = $CCEDocuments->Archived->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->Archived->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_Archived" id="x_Archived" title="<?php echo $CCEDocuments->Archived->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEDocuments->Archived->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span>
</div>
</td>
</tr>
<tr>
<td><span class="phpmaker"><?php echo $CCEDocuments->ArchiveYear->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_ArchiveYear" id="z_ArchiveYear" value="="></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<input type="text" name="x_ArchiveYear" id="x_ArchiveYear" title="<?php echo $CCEDocuments->ArchiveYear->FldTitle() ?>" size="30" value="<?php echo $CCEDocuments->ArchiveYear->EditValue ?>"<?php echo $CCEDocuments->ArchiveYear->EditAttributes() ?>>
</span>
</div>
</td>
</tr>
</table>
<table class="ewBasicSearch">
<tr>
<td><span class="phpmaker">
<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($CCEDocuments->getSessionBasicSearchKeyword()) ?>">
<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">
<a href="<?php echo $CCEDocuments_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>
<a href="CCEDocumentssrch.php"><?php echo $Language->Phrase("AdvancedSearch") ?></a>
</span></td>
</tr>
<tr>
<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($CCEDocuments->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($CCEDocuments->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($CCEDocuments->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEDocuments_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCEDocuments->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCEDocuments->CurrentAction <> "gridadd" && $CCEDocuments->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCEDocuments_list->Pager)) $CCEDocuments_list->Pager = new cPrevNextPager($CCEDocuments_list->lStartRec, $CCEDocuments_list->lDisplayRecs, $CCEDocuments_list->lTotalRecs) ?>
<?php if ($CCEDocuments_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEDocuments_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCEDocuments_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEDocuments_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEDocuments_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCEDocuments_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEDocuments_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEDocuments_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEDocuments_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEDocuments_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEDocuments_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
<?php if ($CCEDocuments->CurrentAction <> "gridadd" && $CCEDocuments->CurrentAction <> "gridedit") { // Not grid add/edit mode ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEDocuments_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<?php if ($CCEDocuments_list->lTotalRecs > 0) { ?>
<a href="<?php echo $CCEDocuments_list->GridEditUrl ?>"><?php echo $Language->Phrase("GridEditLink") ?></a>
<?php } ?>
<?php } ?>
<?php } else { // Grid add/edit mode ?>
<?php if ($CCEDocuments->CurrentAction == "gridedit") { ?>
<a href="" onclick="f=document.fCCEDocumentslist;if(CCEDocuments_list.ValidateForm(f))f.submit();return false;"><?php echo $Language->Phrase("GridSaveLink") ?></a>
<a href="<?php echo $CCEDocuments_list->PageUrl() ?>a=cancel"><?php echo $Language->Phrase("GridCancelLink") ?></a>
<?php } ?>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCEDocumentslist" id="fCCEDocumentslist" class="ewForm" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" id="t" value="CCEDocuments">
<div id="gmp_CCEDocuments" class="ewGridMiddlePanel">
<?php if ($CCEDocuments_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCEDocuments->TableCustomInnerHtml ?>
<thead><!-- Table header -->
<tr class="ewTableHeader">
<?php
// Render list options
$CCEDocuments_list->RenderListOptions();
// Render list options (header, left)
$CCEDocuments_list->ListOptions->Render("header", "left");
?>
<?php if ($CCEDocuments->CCEModuleID->Visible) { // CCEModuleID ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->CCEModuleID) == "") { ?>
<td><?php echo $CCEDocuments->CCEModuleID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->CCEModuleID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->CCEModuleID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->CCEModuleID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->CCEModuleID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->DocumentCode->Visible) { // DocumentCode ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->DocumentCode) == "") { ?>
<td><?php echo $CCEDocuments->DocumentCode->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->DocumentCode) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->DocumentCode->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->DocumentCode->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->DocumentCode->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->DocumentCategory->Visible) { // DocumentCategory ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->DocumentCategory) == "") { ?>
<td><?php echo $CCEDocuments->DocumentCategory->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->DocumentCategory) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->DocumentCategory->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->DocumentCategory->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->DocumentCategory->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->DocumentName->Visible) { // DocumentName ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->DocumentName) == "") { ?>
<td><?php echo $CCEDocuments->DocumentName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->DocumentName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->DocumentName->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->DocumentName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->DocumentName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->AppliesToDate->Visible) { // AppliesToDate ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->AppliesToDate) == "") { ?>
<td><?php echo $CCEDocuments->AppliesToDate->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->AppliesToDate) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->AppliesToDate->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->AppliesToDate->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->AppliesToDate->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->PresenterName->Visible) { // PresenterName ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->PresenterName) == "") { ?>
<td><?php echo $CCEDocuments->PresenterName->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->PresenterName) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->PresenterName->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->PresenterName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->PresenterName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->PresentationTime->Visible) { // PresentationTime ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->PresentationTime) == "") { ?>
<td><?php echo $CCEDocuments->PresentationTime->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->PresentationTime) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->PresentationTime->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->PresentationTime->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->PresentationTime->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->ReleaseDate->Visible) { // ReleaseDate ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->ReleaseDate) == "") { ?>
<td><?php echo $CCEDocuments->ReleaseDate->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->ReleaseDate) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEDocuments->ReleaseDate->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->ReleaseDate->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->ReleaseDate->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->Archived->Visible) { // Archived ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->Archived) == "") { ?>
<td style="white-space: nowrap;"><?php echo $CCEDocuments->Archived->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->Archived) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn" style="white-space: nowrap;"><thead><tr><td><?php echo $CCEDocuments->Archived->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEDocuments->Archived->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->Archived->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->ArchiveYear->Visible) { // ArchiveYear ?>
<?php if ($CCEDocuments->SortUrl($CCEDocuments->ArchiveYear) == "") { ?>
<td style="white-space: nowrap;"><?php echo $CCEDocuments->ArchiveYear->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEDocuments->SortUrl($CCEDocuments->ArchiveYear) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn" style="white-space: nowrap;"><thead><tr><td><?php echo $CCEDocuments->ArchiveYear->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEDocuments->ArchiveYear->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEDocuments->ArchiveYear->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php
// Render list options (header, right)
$CCEDocuments_list->ListOptions->Render("header", "right");
?>
</tr>
</thead>
<?php
if ($CCEDocuments->ExportAll && $CCEDocuments->Export <> "") {
$CCEDocuments_list->lStopRec = $CCEDocuments_list->lTotalRecs;
} else {
$CCEDocuments_list->lStopRec = $CCEDocuments_list->lStartRec + $CCEDocuments_list->lDisplayRecs - 1; // Set the last record to display
}
$CCEDocuments_list->lRecCount = $CCEDocuments_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $CCEDocuments_list->lStartRec > 1)
$rs->Move($CCEDocuments_list->lStartRec - 1);
}
// Initialize aggregate
$CCEDocuments->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCEDocuments_list->RenderRow();
$CCEDocuments_list->lRowCnt = 0;
if ($CCEDocuments->CurrentAction == "gridedit")
$CCEDocuments_list->lRowIndex = 0;
while (($CCEDocuments->CurrentAction == "gridadd" || !$rs->EOF) &&
$CCEDocuments_list->lRecCount < $CCEDocuments_list->lStopRec) {
$CCEDocuments_list->lRecCount++;
if (intval($CCEDocuments_list->lRecCount) >= intval($CCEDocuments_list->lStartRec)) {
$CCEDocuments_list->lRowCnt++;
if ($CCEDocuments->CurrentAction == "gridadd" || $CCEDocuments->CurrentAction == "gridedit")
$CCEDocuments_list->lRowIndex++;
// Init row class and style
$CCEDocuments->CssClass = "";
$CCEDocuments->CssStyle = "";
$CCEDocuments->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
if ($CCEDocuments->CurrentAction == "gridadd") {
$CCEDocuments_list->LoadDefaultValues(); // Load default values
} else {
$CCEDocuments_list->LoadRowValues($rs); // Load row values
}
$CCEDocuments->RowType = EW_ROWTYPE_VIEW; // Render view
if ($CCEDocuments->CurrentAction == "gridedit") { // Grid edit
$CCEDocuments->RowType = EW_ROWTYPE_EDIT; // Render edit
}
if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT && $CCEDocuments->EventCancelled) { // Update failed
if ($CCEDocuments->CurrentAction == "gridedit")
$CCEDocuments_list->RestoreCurrentRowFormValues($CCEDocuments_list->lRowIndex); // Restore form values
}
if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) // Edit row
$CCEDocuments_list->lEditRowCnt++;
if ($CCEDocuments->RowType == EW_ROWTYPE_ADD || $CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Add / Edit row
$CCEDocuments->RowAttrs = array_merge($CCEDocuments->RowAttrs, array('onmouseover'=>'this.edit=true;ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);'));
$CCEDocuments->CssClass = "ewTableEditRow";
}
// Render row
$CCEDocuments_list->RenderRow();
// Render list options
$CCEDocuments_list->RenderListOptions();
?>
<tr<?php echo $CCEDocuments->RowAttributes() ?>>
<?php
// Render list options (body, left)
$CCEDocuments_list->ListOptions->Render("body", "left");
?>
<?php if ($CCEDocuments->CCEModuleID->Visible) { // CCEModuleID ?>
<td<?php echo $CCEDocuments->CCEModuleID->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php if ($CCEDocuments->CCEModuleID->getSessionValue() <> "") { ?>
<div<?php echo $CCEDocuments->CCEModuleID->ViewAttributes() ?>><?php echo $CCEDocuments->CCEModuleID->ListViewValue() ?></div>
<input type="hidden" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEModuleID" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEModuleID" value="<?php echo ew_HtmlEncode($CCEDocuments->CCEModuleID->CurrentValue) ?>">
<?php } else { ?>
<select id="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEModuleID" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEModuleID" title="<?php echo $CCEDocuments->CCEModuleID->FldTitle() ?>"<?php echo $CCEDocuments->CCEModuleID->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->CCEModuleID->EditValue)) {
$arwrk = $CCEDocuments->CCEModuleID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->CCEModuleID->CurrentValue) == 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] ?>
<?php if ($arwrk[$rowcntwrk][2] <> "") { ?>
<?php echo ew_ValueSeparator($rowcntwrk) ?><?php echo $arwrk[$rowcntwrk][2] ?>
<?php } ?>
</option>
<?php
}
}
?>
</select>
<?php } ?>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->CCEModuleID->ViewAttributes() ?>><?php echo $CCEDocuments->CCEModuleID->ListViewValue() ?></div>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { ?>
<input type="hidden" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEDocumentID" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_CCEDocumentID" value="<?php echo ew_HtmlEncode($CCEDocuments->CCEDocumentID->CurrentValue) ?>">
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->DocumentCode->Visible) { // DocumentCode ?>
<td<?php echo $CCEDocuments->DocumentCode->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentCode" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentCode" title="<?php echo $CCEDocuments->DocumentCode->FldTitle() ?>" size="30" maxlength="20" value="<?php echo $CCEDocuments->DocumentCode->EditValue ?>"<?php echo $CCEDocuments->DocumentCode->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->DocumentCode->ViewAttributes() ?>><?php echo $CCEDocuments->DocumentCode->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->DocumentCategory->Visible) { // DocumentCategory ?>
<td<?php echo $CCEDocuments->DocumentCategory->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<select id="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentCategory" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentCategory" title="<?php echo $CCEDocuments->DocumentCategory->FldTitle() ?>"<?php echo $CCEDocuments->DocumentCategory->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->DocumentCategory->EditValue)) {
$arwrk = $CCEDocuments->DocumentCategory->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->DocumentCategory->CurrentValue) == 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>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->DocumentCategory->ViewAttributes() ?>><?php echo $CCEDocuments->DocumentCategory->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->DocumentName->Visible) { // DocumentName ?>
<td<?php echo $CCEDocuments->DocumentName->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentName" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_DocumentName" title="<?php echo $CCEDocuments->DocumentName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEDocuments->DocumentName->EditValue ?>"<?php echo $CCEDocuments->DocumentName->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->DocumentName->ViewAttributes() ?>><?php echo $CCEDocuments->DocumentName->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->AppliesToDate->Visible) { // AppliesToDate ?>
<td<?php echo $CCEDocuments->AppliesToDate->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php $CCEDocuments->AppliesToDate->EditAttrs["onchange"] = "ew_UpdateOpt('x" . $CCEDocuments_list->lRowIndex . "_PresenterName','x" . $CCEDocuments_list->lRowIndex . "_AppliesToDate',CCEDocuments_list.ar_x" . $CCEDocuments_list->lRowIndex . "_PresenterName); " . @$CCEDocuments->AppliesToDate->EditAttrs["onchange"]; ?>
<select id="x<?php echo $CCEDocuments_list->lRowIndex ?>_AppliesToDate" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_AppliesToDate" title="<?php echo $CCEDocuments->AppliesToDate->FldTitle() ?>"<?php echo $CCEDocuments->AppliesToDate->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->AppliesToDate->EditValue)) {
$arwrk = $CCEDocuments->AppliesToDate->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->AppliesToDate->CurrentValue) == 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>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->AppliesToDate->ViewAttributes() ?>><?php echo $CCEDocuments->AppliesToDate->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->PresenterName->Visible) { // PresenterName ?>
<td<?php echo $CCEDocuments->PresenterName->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<select id="x<?php echo $CCEDocuments_list->lRowIndex ?>_PresenterName" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_PresenterName" title="<?php echo $CCEDocuments->PresenterName->FldTitle() ?>"<?php echo $CCEDocuments->PresenterName->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->PresenterName->EditValue)) {
$arwrk = $CCEDocuments->PresenterName->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->PresenterName->CurrentValue) == 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>
<?php
$jswrk = "";
if (is_array($CCEDocuments->PresenterName->EditValue)) {
$arwrk = $CCEDocuments->PresenterName->EditValue;
$arwrkcnt = count($arwrk);
for ($rowcntwrk = 1; $rowcntwrk < $arwrkcnt; $rowcntwrk++) {
if ($jswrk <> "") $jswrk .= ",";
$jswrk .= "['" . ew_JsEncode($arwrk[$rowcntwrk][0]) . "',"; // Value
$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][1]) . "',"; // Display field 1
$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][2]) . "',"; // Display field 2
$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][3]) . "']"; // Filter field
}
}
?>
<script type="text/javascript">
<!--
CCEDocuments_list.ar_x<?php echo $CCEDocuments_list->lRowIndex ?>_PresenterName = [<?php echo $jswrk ?>];
//-->
</script>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->PresenterName->ViewAttributes() ?>><?php echo $CCEDocuments->PresenterName->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->PresentationTime->Visible) { // PresentationTime ?>
<td<?php echo $CCEDocuments->PresentationTime->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_PresentationTime" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_PresentationTime" title="<?php echo $CCEDocuments->PresentationTime->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEDocuments->PresentationTime->EditValue ?>"<?php echo $CCEDocuments->PresentationTime->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->PresentationTime->ViewAttributes() ?>><?php echo $CCEDocuments->PresentationTime->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->ReleaseDate->Visible) { // ReleaseDate ?>
<td<?php echo $CCEDocuments->ReleaseDate->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate" title="<?php echo $CCEDocuments->ReleaseDate->FldTitle() ?>" value="<?php echo $CCEDocuments->ReleaseDate->EditValue ?>"<?php echo $CCEDocuments->ReleaseDate->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate" name="cal_x<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate" 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<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate", // input field id
ifFormat: "%Y/%m/%d", // date format
button: "cal_x<?php echo $CCEDocuments_list->lRowIndex ?>_ReleaseDate" // button id
});
</script>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->ReleaseDate->ViewAttributes() ?>><?php echo $CCEDocuments->ReleaseDate->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->Archived->Visible) { // Archived ?>
<td<?php echo $CCEDocuments->Archived->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<div id="tp_x<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" title="<?php echo $CCEDocuments->Archived->FldTitle() ?>" value="{value}"<?php echo $CCEDocuments->Archived->EditAttributes() ?>></label></div>
<div id="dsl_x<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" repeatcolumn="5">
<?php
$arwrk = $CCEDocuments->Archived->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEDocuments->Archived->CurrentValue) == 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<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_Archived" title="<?php echo $CCEDocuments->Archived->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEDocuments->Archived->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->Archived->ViewAttributes() ?>><?php echo $CCEDocuments->Archived->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php if ($CCEDocuments->ArchiveYear->Visible) { // ArchiveYear ?>
<td<?php echo $CCEDocuments->ArchiveYear->CellAttributes() ?>>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEDocuments_list->lRowIndex ?>_ArchiveYear" id="x<?php echo $CCEDocuments_list->lRowIndex ?>_ArchiveYear" title="<?php echo $CCEDocuments->ArchiveYear->FldTitle() ?>" size="30" value="<?php echo $CCEDocuments->ArchiveYear->EditValue ?>"<?php echo $CCEDocuments->ArchiveYear->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEDocuments->ArchiveYear->ViewAttributes() ?>><?php echo $CCEDocuments->ArchiveYear->ListViewValue() ?></div>
<?php } ?>
</td>
<?php } ?>
<?php
// Render list options (body, right)
$CCEDocuments_list->ListOptions->Render("body", "right");
?>
</tr>
<?php if ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { ?>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x<?php echo $CCEDocuments_list->lRowIndex ?>_PresenterName','x<?php echo $CCEDocuments_list->lRowIndex ?>_AppliesToDate',CCEDocuments_list.ar_x<?php echo $CCEDocuments_list->lRowIndex ?>_PresenterName]]);
//-->
</script>
<?php } ?>
<?php
}
if ($CCEDocuments->CurrentAction <> "gridadd")
$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
<?php if ($CCEDocuments->CurrentAction == "gridedit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="key_count" id="key_count" value="<?php echo $CCEDocuments_list->lRowIndex ?>">
<?php echo $CCEDocuments_list->sMultiSelectKey ?>
<?php } ?>
</div>
</form>
<?php
// Close recordset
if ($rs)
$rs->Close();
?>
<?php if ($CCEDocuments_list->lTotalRecs > 0) { ?>
<?php if ($CCEDocuments->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCEDocuments->CurrentAction <> "gridadd" && $CCEDocuments->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCEDocuments_list->Pager)) $CCEDocuments_list->Pager = new cPrevNextPager($CCEDocuments_list->lStartRec, $CCEDocuments_list->lDisplayRecs, $CCEDocuments_list->lTotalRecs) ?>
<?php if ($CCEDocuments_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEDocuments_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCEDocuments_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEDocuments_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEDocuments_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCEDocuments_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEDocuments_list->PageUrl() ?>start=<?php echo $CCEDocuments_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEDocuments_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEDocuments_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEDocuments_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEDocuments_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEDocuments_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<?php //if ($CCEDocuments_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($CCEDocuments->CurrentAction <> "gridadd" && $CCEDocuments->CurrentAction <> "gridedit") { // Not grid add/edit mode ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEDocuments_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<?php if ($CCEDocuments_list->lTotalRecs > 0) { ?>
<a href="<?php echo $CCEDocuments_list->GridEditUrl ?>"><?php echo $Language->Phrase("GridEditLink") ?></a>
<?php } ?>
<?php } ?>
<?php } else { // Grid add/edit mode ?>
<?php if ($CCEDocuments->CurrentAction == "gridedit") { ?>
<a href="" onclick="f=document.fCCEDocumentslist;if(CCEDocuments_list.ValidateForm(f))f.submit();return false;"><?php echo $Language->Phrase("GridSaveLink") ?></a>
<a href="<?php echo $CCEDocuments_list->PageUrl() ?>a=cancel"><?php echo $Language->Phrase("GridCancelLink") ?></a>
<?php } ?>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCEDocuments->Export == "" && $CCEDocuments->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCEDocuments->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$CCEDocuments_list->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEDocuments_list {
// Page ID
var $PageID = 'list';
// Table name
var $TableName = 'CCEDocuments';
// Page object name
var $PageObjName = 'CCEDocuments_list';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEDocuments;
if ($CCEDocuments->UseTokenInUrl) $PageUrl .= "t=" . $CCEDocuments->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, $CCEDocuments;
if ($CCEDocuments->UseTokenInUrl) {
if ($objForm)
return ($CCEDocuments->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEDocuments->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEDocuments)
$GLOBALS["CCEDocuments"] = new cCCEDocuments();
// Initialize URLs
$this->ExportPrintUrl = $this->PageUrl() . "export=print";
$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
$this->ExportWordUrl = $this->PageUrl() . "export=word";
$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
$this->AddUrl = $GLOBALS["CCEDocuments"]->AddUrl();
$this->InlineAddUrl = $this->PageUrl() . "a=add";
$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
$this->MultiDeleteUrl = "CCEDocumentsdelete.php";
$this->MultiUpdateUrl = "CCEDocumentsupdate.php";
// 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", 'list', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCEDocuments', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
// List options
$this->ListOptions = new cListOptions();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $CCEDocuments;
// Security
$Security = new cAdvancedSecurity();
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->TableName);
$Security->TablePermission_Loaded();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
if (!$Security->CanList()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
// Create form object
$objForm = new cFormObj();
// Get export parameters
if (@$_GET["export"] <> "") {
$CCEDocuments->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$CCEDocuments->Export = $_POST["exporttype"];
} else {
$CCEDocuments->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $CCEDocuments->Export; // Get export parameter, used in header
$gsExportFile = $CCEDocuments->TableVar; // Get export file, used in header
if ($CCEDocuments->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($CCEDocuments->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
}
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
// Class variables
var $ListOptions; // List options
var $lDisplayRecs = 40;
var $lStartRec;
var $lStopRec;
var $lTotalRecs = 0;
var $lRecRange = 10;
var $sSrchWhere = ""; // Search WHERE clause
var $lRecCnt = 0; // Record count
var $lEditRowCnt;
var $lRowCnt;
var $lRowIndex; // Row index
var $lRecPerRow = 0;
var $lColCnt = 0;
var $sDbMasterFilter = ""; // Master filter
var $sDbDetailFilter = ""; // Detail filter
var $bMasterRecordExists;
var $sMultiSelectKey;
var $RestoreSearch;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Security, $CCEDocuments;
// Search filters
$sSrchAdvanced = ""; // Advanced search filter
$sSrchBasic = ""; // Basic search filter
$sFilter = "";
if ($this->IsPageRequest()) { // Validate request
// Handle reset command
$this->ResetCmd();
// Set up master detail parameters
$this->SetUpMasterDetail();
// Check QueryString parameters
if (@$_GET["a"] <> "") {
$CCEDocuments->CurrentAction = $_GET["a"];
// Clear inline mode
if ($CCEDocuments->CurrentAction == "cancel")
$this->ClearInlineMode();
// Switch to grid edit mode
if ($CCEDocuments->CurrentAction == "gridedit")
$this->GridEditMode();
} else {
if (@$_POST["a_list"] <> "") {
$CCEDocuments->CurrentAction = $_POST["a_list"]; // Get action
// Grid Update
if (($CCEDocuments->CurrentAction == "gridupdate" || $CCEDocuments->CurrentAction == "gridoverwrite") && @$_SESSION[EW_SESSION_INLINE_MODE] == "gridedit")
$this->GridUpdate();
}
}
// Set up list options
$this->SetupListOptions();
// Get basic search values
$this->LoadBasicSearchValues();
// Get and validate search values for advanced search
$this->LoadSearchValues(); // Get search values
if (!$this->ValidateSearch())
$this->setMessage($gsSearchError);
// Restore search parms from Session
$this->RestoreSearchParms();
// Call Recordset SearchValidated event
$CCEDocuments->Recordset_SearchValidated();
// Set up sorting order
$this->SetUpSortOrder();
// Get basic search criteria
if ($gsSearchError == "")
$sSrchBasic = $this->BasicSearchWhere();
// Get search criteria for advanced search
if ($gsSearchError == "")
$sSrchAdvanced = $this->AdvancedSearchWhere();
}
// Restore display records
if ($CCEDocuments->getRecordsPerPage() <> "") {
$this->lDisplayRecs = $CCEDocuments->getRecordsPerPage(); // Restore from Session
} else {
$this->lDisplayRecs = 40; // Load default
}
// Load Sorting Order
$this->LoadSortOrder();
// Build search criteria
if ($sSrchAdvanced <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
if ($sSrchBasic <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;
// Call Recordset_Searching event
$CCEDocuments->Recordset_Searching($this->sSrchWhere);
// Save search criteria
if ($this->sSrchWhere <> "") {
if ($sSrchBasic == "")
$this->ResetBasicSearchParms();
if ($sSrchAdvanced == "")
$this->ResetAdvancedSearchParms();
$CCEDocuments->setSearchWhere($this->sSrchWhere); // Save to Session
if (!$this->RestoreSearch) {
$this->lStartRec = 1; // Reset start record counter
$CCEDocuments->setStartRecordNumber($this->lStartRec);
}
} else {
$this->sSrchWhere = $CCEDocuments->getSearchWhere();
}
// Build filter
$sFilter = "";
if (!$Security->CanList())
$sFilter = "(0=1)"; // Filter all records
// Restore master/detail filter
$this->sDbMasterFilter = $CCEDocuments->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEDocuments->getDetailFilter(); // Restore detail filter
if ($this->sDbDetailFilter <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
if ($this->sSrchWhere <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
// Load master record
if ($CCEDocuments->getMasterFilter() <> "" && $CCEDocuments->getCurrentMasterTable() == "CCEModules") {
global $CCEModules;
$rsmaster = $CCEModules->LoadRs($this->sDbMasterFilter);
$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
if (!$this->bMasterRecordExists) {
$CCEDocuments->setMasterFilter(""); // Clear master filter
$CCEDocuments->setDetailFilter(""); // Clear detail filter
$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
$this->Page_Terminate($CCEDocuments->getReturnUrl()); // Return to caller
} else {
$CCEModules->LoadListRowValues($rsmaster);
$CCEModules->RowType = EW_ROWTYPE_MASTER; // Master row
$CCEModules->RenderListRow();
$rsmaster->Close();
}
}
// Set up filter in session
$CCEDocuments->setSessionWhere($sFilter);
$CCEDocuments->CurrentFilter = "";
// Export data only
if (in_array($CCEDocuments->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($CCEDocuments->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
}
// Exit inline mode
function ClearInlineMode() {
global $CCEDocuments;
$CCEDocuments->CurrentAction = ""; // Clear action
$_SESSION[EW_SESSION_INLINE_MODE] = ""; // Clear inline mode
}
// Switch to Grid Edit mode
function GridEditMode() {
$_SESSION[EW_SESSION_INLINE_MODE] = "gridedit"; // Enable grid edit
}
// Perform update to grid
function GridUpdate() {
global $conn, $Language, $objForm, $gsFormError, $CCEDocuments;
$rowindex = 1;
$bGridUpdate = TRUE;
// Begin transaction
$conn->BeginTrans();
// Get old recordset
$CCEDocuments->CurrentFilter = $this->BuildKeyFilter();
$sSql = $CCEDocuments->SQL();
if ($rs = $conn->Execute($sSql)) {
$rsold = $rs->GetRows();
$rs->Close();
}
$sKey = "";
// Update row index and get row key
$objForm->Index = $rowindex;
$sThisKey = strval($objForm->GetValue("k_key"));
// Update all rows based on key
while ($sThisKey <> "") {
// Load all values and keys
$this->LoadFormValues(); // Get form values
// Validate form
if (!$this->ValidateForm()) {
$bGridUpdate = FALSE; // Form error, reset action
$this->setMessage($gsFormError);
} else {
if ($this->SetupKeyValues($sThisKey)) { // Set up key values
$CCEDocuments->SendEmail = FALSE; // Do not send email on update success
$bGridUpdate = $this->EditRow(); // Update this row
} else {
$bGridUpdate = FALSE; // update failed
}
}
if ($bGridUpdate) {
if ($sKey <> "") $sKey .= ", ";
$sKey .= $sThisKey;
} else {
break;
}
// Update row index and get row key
$rowindex++; // next row
$objForm->Index = $rowindex;
$sThisKey = strval($objForm->GetValue("k_key"));
}
if ($bGridUpdate) {
$conn->CommitTrans(); // Commit transaction
// Get new recordset
if ($rs = $conn->Execute($sSql)) {
$rsnew = $rs->GetRows();
$rs->Close();
}
$this->setMessage($Language->Phrase("UpdateSuccess")); // Set update success message
$this->ClearInlineMode(); // Clear inline edit mode
} else {
$conn->RollbackTrans(); // Rollback transaction
if ($this->getMessage() == "")
$this->setMessage($Language->Phrase("UpdateFailed")); // Set update failed message
$CCEDocuments->EventCancelled = TRUE; // Set event cancelled
$CCEDocuments->CurrentAction = "gridedit"; // Stay in Grid Edit mode
}
}
// Build filter for all keys
function BuildKeyFilter() {
global $objForm, $CCEDocuments;
$sWrkFilter = "";
// Update row index and get row key
$rowindex = 1;
$objForm->Index = $rowindex;
$sThisKey = strval($objForm->GetValue("k_key"));
while ($sThisKey <> "") {
if ($this->SetupKeyValues($sThisKey)) {
$sFilter = $CCEDocuments->KeyFilter();
if ($sWrkFilter <> "") $sWrkFilter .= " OR ";
$sWrkFilter .= $sFilter;
} else {
$sWrkFilter = "0=1";
break;
}
// Update row index and get row key
$rowindex++; // next row
$objForm->Index = $rowindex;
$sThisKey = strval($objForm->GetValue("k_key"));
}
return $sWrkFilter;
}
// Set up key values
function SetupKeyValues($key) {
global $CCEDocuments;
$arrKeyFlds = explode(EW_COMPOSITE_KEY_SEPARATOR, $key);
if (count($arrKeyFlds) >= 1) {
$CCEDocuments->CCEDocumentID->setFormValue($arrKeyFlds[0]);
if (!is_numeric($CCEDocuments->CCEDocumentID->FormValue))
return FALSE;
}
return TRUE;
}
// Restore form values for current row
function RestoreCurrentRowFormValues($idx) {
global $objForm, $CCEDocuments;
// Get row based on current index
$objForm->Index = $idx;
if ($CCEDocuments->CurrentAction == "gridadd")
$this->LoadFormValues(); // Load form values
if ($CCEDocuments->CurrentAction == "gridedit") {
$sKey = strval($objForm->GetValue("k_key"));
$arrKeyFlds = explode(EW_COMPOSITE_KEY_SEPARATOR, $sKey);
if (count($arrKeyFlds) >= 1) {
if (strval($arrKeyFlds[0]) == strval($CCEDocuments->CCEDocumentID->CurrentValue)) {
$this->LoadFormValues(); // Load form values
}
}
}
}
// Advanced search WHERE clause based on QueryString
function AdvancedSearchWhere() {
global $Security, $CCEDocuments;
$sWhere = "";
if (!$Security->CanSearch()) return "";
$this->BuildSearchSql($sWhere, $CCEDocuments->CCEModuleID, FALSE); // CCEModuleID
$this->BuildSearchSql($sWhere, $CCEDocuments->DocumentCode, FALSE); // DocumentCode
$this->BuildSearchSql($sWhere, $CCEDocuments->DocumentCategory, FALSE); // DocumentCategory
$this->BuildSearchSql($sWhere, $CCEDocuments->DocumentName, FALSE); // DocumentName
$this->BuildSearchSql($sWhere, $CCEDocuments->AppliesToDate, FALSE); // AppliesToDate
$this->BuildSearchSql($sWhere, $CCEDocuments->CCEWeeklySessionID, FALSE); // CCEWeeklySessionID
$this->BuildSearchSql($sWhere, $CCEDocuments->PresenterName, FALSE); // PresenterName
$this->BuildSearchSql($sWhere, $CCEDocuments->ReleaseDate, FALSE); // ReleaseDate
$this->BuildSearchSql($sWhere, $CCEDocuments->ReleaseTime, FALSE); // ReleaseTime
$this->BuildSearchSql($sWhere, $CCEDocuments->Students, TRUE); // Students
$this->BuildSearchSql($sWhere, $CCEDocuments->Archived, FALSE); // Archived
$this->BuildSearchSql($sWhere, $CCEDocuments->ArchiveYear, FALSE); // ArchiveYear
$this->BuildSearchSql($sWhere, $CCEDocuments->DateCreated, FALSE); // DateCreated
$this->BuildSearchSql($sWhere, $CCEDocuments->Description, FALSE); // Description
$this->BuildSearchSql($sWhere, $CCEDocuments->KeyWords, FALSE); // KeyWords
$this->BuildSearchSql($sWhere, $CCEDocuments->DisplayInline, FALSE); // DisplayInline
// Set up search parm
if ($sWhere <> "") {
$this->SetSearchParm($CCEDocuments->CCEModuleID); // CCEModuleID
$this->SetSearchParm($CCEDocuments->DocumentCode); // DocumentCode
$this->SetSearchParm($CCEDocuments->DocumentCategory); // DocumentCategory
$this->SetSearchParm($CCEDocuments->DocumentName); // DocumentName
$this->SetSearchParm($CCEDocuments->AppliesToDate); // AppliesToDate
$this->SetSearchParm($CCEDocuments->CCEWeeklySessionID); // CCEWeeklySessionID
$this->SetSearchParm($CCEDocuments->PresenterName); // PresenterName
$this->SetSearchParm($CCEDocuments->ReleaseDate); // ReleaseDate
$this->SetSearchParm($CCEDocuments->ReleaseTime); // ReleaseTime
$this->SetSearchParm($CCEDocuments->Students); // Students
$this->SetSearchParm($CCEDocuments->Archived); // Archived
$this->SetSearchParm($CCEDocuments->ArchiveYear); // ArchiveYear
$this->SetSearchParm($CCEDocuments->DateCreated); // DateCreated
$this->SetSearchParm($CCEDocuments->Description); // Description
$this->SetSearchParm($CCEDocuments->KeyWords); // KeyWords
$this->SetSearchParm($CCEDocuments->DisplayInline); // DisplayInline
}
return $sWhere;
}
// Build search SQL
function BuildSearchSql(&$Where, &$Fld, $MultiValue) {
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldOpr = $Fld->AdvancedSearch->SearchOperator; // @$_GET["z_$FldParm"]
$FldCond = $Fld->AdvancedSearch->SearchCondition; // @$_GET["v_$FldParm"]
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldOpr2 = $Fld->AdvancedSearch->SearchOperator2; // @$_GET["w_$FldParm"]
$sWrk = "";
//$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
//$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$FldOpr = strtoupper(trim($FldOpr));
if ($FldOpr == "") $FldOpr = "=";
$FldOpr2 = strtoupper(trim($FldOpr2));
if ($FldOpr2 == "") $FldOpr2 = "=";
if (EW_SEARCH_MULTI_VALUE_OPTION == 1 || $FldOpr <> "LIKE" ||
($FldOpr2 <> "LIKE" && $FldVal2 <> ""))
$MultiValue = FALSE;
if ($MultiValue) {
$sWrk1 = ($FldVal <> "") ? ew_GetMultiSearchSql($Fld, $FldVal) : ""; // Field value 1
$sWrk2 = ($FldVal2 <> "") ? ew_GetMultiSearchSql($Fld, $FldVal2) : ""; // Field value 2
$sWrk = $sWrk1; // Build final SQL
if ($sWrk2 <> "")
$sWrk = ($sWrk <> "") ? "($sWrk) $FldCond ($sWrk2)" : $sWrk2;
} else {
$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
$sWrk = ew_GetSearchSql($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2);
}
if ($sWrk <> "") {
if ($Where <> "") $Where .= " AND ";
$Where .= "(" . $sWrk . ")";
}
}
// Set search parameters
function SetSearchParm(&$Fld) {
global $CCEDocuments;
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$CCEDocuments->setAdvancedSearch("x_$FldParm", $FldVal);
$CCEDocuments->setAdvancedSearch("z_$FldParm", $Fld->AdvancedSearch->SearchOperator); // @$_GET["z_$FldParm"]
$CCEDocuments->setAdvancedSearch("v_$FldParm", $Fld->AdvancedSearch->SearchCondition); // @$_GET["v_$FldParm"]
$CCEDocuments->setAdvancedSearch("y_$FldParm", $FldVal2);
$CCEDocuments->setAdvancedSearch("w_$FldParm", $Fld->AdvancedSearch->SearchOperator2); // @$_GET["w_$FldParm"]
}
// Get search parameters
function GetSearchParm(&$Fld) {
global $CCEDocuments;
$FldParm = substr($Fld->FldVar, 2);
$Fld->AdvancedSearch->SearchValue = $CCEDocuments->GetAdvancedSearch("x_$FldParm");
$Fld->AdvancedSearch->SearchOperator = $CCEDocuments->GetAdvancedSearch("z_$FldParm");
$Fld->AdvancedSearch->SearchCondition = $CCEDocuments->GetAdvancedSearch("v_$FldParm");
$Fld->AdvancedSearch->SearchValue2 = $CCEDocuments->GetAdvancedSearch("y_$FldParm");
$Fld->AdvancedSearch->SearchOperator2 = $CCEDocuments->GetAdvancedSearch("w_$FldParm");
}
// Convert search value
function ConvertSearchValue(&$Fld, $FldVal) {
$Value = $FldVal;
if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
if ($FldVal <> "") $Value = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
} elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
if ($FldVal <> "") $Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
}
return $Value;
}
// Return basic search SQL
function BasicSearchSQL($Keyword) {
global $CCEDocuments;
$sKeyword = ew_AdjustSql($Keyword);
$sWhere = "";
if (is_numeric($Keyword)) $this->BuildBasicSearchSQL($sWhere, $CCEDocuments->CCEWeeklySessionID, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEDocuments->Students, $Keyword);
if (is_numeric($Keyword)) $this->BuildBasicSearchSQL($sWhere, $CCEDocuments->Archived, $Keyword);
if (is_numeric($Keyword)) $this->BuildBasicSearchSQL($sWhere, $CCEDocuments->ArchiveYear, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEDocuments->Description, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEDocuments->KeyWords, $Keyword);
return $sWhere;
}
// Build basic search SQL
function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
if ($lFldDataType == EW_DATATYPE_NUMBER) {
$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
} else {
$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
}
if ($Where <> "") $Where .= " OR ";
$Where .= $sWrk;
}
// Return basic search WHERE clause based on search keyword and type
function BasicSearchWhere() {
global $Security, $CCEDocuments;
$sSearchStr = "";
if (!$Security->CanSearch()) return "";
$sSearchKeyword = $CCEDocuments->BasicSearchKeyword;
$sSearchType = $CCEDocuments->BasicSearchType;
if ($sSearchKeyword <> "") {
$sSearch = trim($sSearchKeyword);
if ($sSearchType <> "") {
while (strpos($sSearch, " ") !== FALSE)
$sSearch = str_replace(" ", " ", $sSearch);
$arKeyword = explode(" ", trim($sSearch));
foreach ($arKeyword as $sKeyword) {
if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
}
} else {
$sSearchStr = $this->BasicSearchSQL($sSearch);
}
}
if ($sSearchKeyword <> "") {
$CCEDocuments->setSessionBasicSearchKeyword($sSearchKeyword);
$CCEDocuments->setSessionBasicSearchType($sSearchType);
}
return $sSearchStr;
}
// Clear all search parameters
function ResetSearchParms() {
global $CCEDocuments;
// Clear search WHERE clause
$this->sSrchWhere = "";
$CCEDocuments->setSearchWhere($this->sSrchWhere);
// Clear basic search parameters
$this->ResetBasicSearchParms();
// Clear advanced search parameters
$this->ResetAdvancedSearchParms();
}
// Clear all basic search parameters
function ResetBasicSearchParms() {
global $CCEDocuments;
$CCEDocuments->setSessionBasicSearchKeyword("");
$CCEDocuments->setSessionBasicSearchType("");
}
// Clear all advanced search parameters
function ResetAdvancedSearchParms() {
global $CCEDocuments;
$CCEDocuments->setAdvancedSearch("x_CCEModuleID", "");
$CCEDocuments->setAdvancedSearch("x_DocumentCode", "");
$CCEDocuments->setAdvancedSearch("x_DocumentCategory", "");
$CCEDocuments->setAdvancedSearch("x_DocumentName", "");
$CCEDocuments->setAdvancedSearch("x_AppliesToDate", "");
$CCEDocuments->setAdvancedSearch("x_CCEWeeklySessionID", "");
$CCEDocuments->setAdvancedSearch("x_PresenterName", "");
$CCEDocuments->setAdvancedSearch("x_ReleaseDate", "");
$CCEDocuments->setAdvancedSearch("x_ReleaseTime", "");
$CCEDocuments->setAdvancedSearch("x_Students", "");
$CCEDocuments->setAdvancedSearch("x_Archived", "");
$CCEDocuments->setAdvancedSearch("x_ArchiveYear", "");
$CCEDocuments->setAdvancedSearch("x_DateCreated", "");
$CCEDocuments->setAdvancedSearch("x_Description", "");
$CCEDocuments->setAdvancedSearch("x_KeyWords", "");
$CCEDocuments->setAdvancedSearch("x_DisplayInline", "");
}
// Restore all search parameters
function RestoreSearchParms() {
global $CCEDocuments;
$bRestore = TRUE;
if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
if (@$_GET["x_CCEModuleID"] <> "") $bRestore = FALSE;
if (@$_GET["x_DocumentCode"] <> "") $bRestore = FALSE;
if (@$_GET["x_DocumentCategory"] <> "") $bRestore = FALSE;
if (@$_GET["x_DocumentName"] <> "") $bRestore = FALSE;
if (@$_GET["x_AppliesToDate"] <> "") $bRestore = FALSE;
if (@$_GET["x_CCEWeeklySessionID"] <> "") $bRestore = FALSE;
if (@$_GET["x_PresenterName"] <> "") $bRestore = FALSE;
if (@$_GET["x_ReleaseDate"] <> "") $bRestore = FALSE;
if (@$_GET["x_ReleaseTime"] <> "") $bRestore = FALSE;
if (@$_GET["x_Students"] <> "") $bRestore = FALSE;
if (@$_GET["x_Archived"] <> "") $bRestore = FALSE;
if (@$_GET["x_ArchiveYear"] <> "") $bRestore = FALSE;
if (@$_GET["x_DateCreated"] <> "") $bRestore = FALSE;
if (@$_GET["x_Description"] <> "") $bRestore = FALSE;
if (@$_GET["x_KeyWords"] <> "") $bRestore = FALSE;
if (@$_GET["x_DisplayInline"] <> "") $bRestore = FALSE;
$this->RestoreSearch = $bRestore;
if ($bRestore) {
// Restore basic search values
$CCEDocuments->BasicSearchKeyword = $CCEDocuments->getSessionBasicSearchKeyword();
$CCEDocuments->BasicSearchType = $CCEDocuments->getSessionBasicSearchType();
// Restore advanced search values
$this->GetSearchParm($CCEDocuments->CCEModuleID);
$this->GetSearchParm($CCEDocuments->DocumentCode);
$this->GetSearchParm($CCEDocuments->DocumentCategory);
$this->GetSearchParm($CCEDocuments->DocumentName);
$this->GetSearchParm($CCEDocuments->AppliesToDate);
$this->GetSearchParm($CCEDocuments->CCEWeeklySessionID);
$this->GetSearchParm($CCEDocuments->PresenterName);
$this->GetSearchParm($CCEDocuments->ReleaseDate);
$this->GetSearchParm($CCEDocuments->ReleaseTime);
$this->GetSearchParm($CCEDocuments->Students);
$this->GetSearchParm($CCEDocuments->Archived);
$this->GetSearchParm($CCEDocuments->ArchiveYear);
$this->GetSearchParm($CCEDocuments->DateCreated);
$this->GetSearchParm($CCEDocuments->Description);
$this->GetSearchParm($CCEDocuments->KeyWords);
$this->GetSearchParm($CCEDocuments->DisplayInline);
}
}
// Set up sort parameters
function SetUpSortOrder() {
global $CCEDocuments;
// Check for Ctrl pressed
$bCtrl = (@$_GET["ctrl"] <> "");
// Check for "order" parameter
if (@$_GET["order"] <> "") {
$CCEDocuments->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
$CCEDocuments->CurrentOrderType = @$_GET["ordertype"];
$CCEDocuments->UpdateSort($CCEDocuments->CCEModuleID, $bCtrl); // CCEModuleID
$CCEDocuments->UpdateSort($CCEDocuments->DocumentCode, $bCtrl); // DocumentCode
$CCEDocuments->UpdateSort($CCEDocuments->DocumentCategory, $bCtrl); // DocumentCategory
$CCEDocuments->UpdateSort($CCEDocuments->DocumentName, $bCtrl); // DocumentName
$CCEDocuments->UpdateSort($CCEDocuments->AppliesToDate, $bCtrl); // AppliesToDate
$CCEDocuments->UpdateSort($CCEDocuments->PresenterName, $bCtrl); // PresenterName
$CCEDocuments->UpdateSort($CCEDocuments->PresentationTime, $bCtrl); // PresentationTime
$CCEDocuments->UpdateSort($CCEDocuments->ReleaseDate, $bCtrl); // ReleaseDate
$CCEDocuments->UpdateSort($CCEDocuments->Archived, $bCtrl); // Archived
$CCEDocuments->UpdateSort($CCEDocuments->ArchiveYear, $bCtrl); // ArchiveYear
$CCEDocuments->setStartRecordNumber(1); // Reset start position
}
}
// Load sort order parameters
function LoadSortOrder() {
global $CCEDocuments;
$sOrderBy = $CCEDocuments->getSessionOrderBy(); // Get ORDER BY from Session
if ($sOrderBy == "") {
if ($CCEDocuments->SqlOrderBy() <> "") {
$sOrderBy = $CCEDocuments->SqlOrderBy();
$CCEDocuments->setSessionOrderBy($sOrderBy);
$CCEDocuments->CCEModuleID->setSort("ASC");
$CCEDocuments->DocumentCategory->setSort("ASC");
$CCEDocuments->DocumentName->setSort("ASC");
}
}
}
// Reset command
// cmd=reset (Reset search parameters)
// cmd=resetall (Reset search and master/detail parameters)
// cmd=resetsort (Reset sort parameters)
function ResetCmd() {
global $CCEDocuments;
// Get reset command
if (@$_GET["cmd"] <> "") {
$sCmd = $_GET["cmd"];
// Reset search criteria
if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
$this->ResetSearchParms();
// Reset master/detail keys
if (strtolower($sCmd) == "resetall") {
$CCEDocuments->getCurrentMasterTable = ""; // Clear master table
$CCEDocuments->setMasterFilter(""); // Clear master filter
$this->sDbMasterFilter = "";
$CCEDocuments->setDetailFilter(""); // Clear detail filter
$this->sDbDetailFilter = "";
$CCEDocuments->CCEModuleID->setSessionValue("");
}
// Reset sorting order
if (strtolower($sCmd) == "resetsort") {
$sOrderBy = "";
$CCEDocuments->setSessionOrderBy($sOrderBy);
$CCEDocuments->CCEModuleID->setSort("");
$CCEDocuments->DocumentCode->setSort("");
$CCEDocuments->DocumentCategory->setSort("");
$CCEDocuments->DocumentName->setSort("");
$CCEDocuments->AppliesToDate->setSort("");
$CCEDocuments->PresenterName->setSort("");
$CCEDocuments->PresentationTime->setSort("");
$CCEDocuments->ReleaseDate->setSort("");
$CCEDocuments->Archived->setSort("");
$CCEDocuments->ArchiveYear->setSort("");
}
// Reset start position
$this->lStartRec = 1;
$CCEDocuments->setStartRecordNumber($this->lStartRec);
}
}
// Set up list options
function SetupListOptions() {
global $Security, $CCEDocuments;
// "view"
$this->ListOptions->Add("view");
$item =& $this->ListOptions->Items["view"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanView();
$item->OnLeft = FALSE;
// "edit"
$this->ListOptions->Add("edit");
$item =& $this->ListOptions->Items["edit"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanEdit();
$item->OnLeft = FALSE;
// "delete"
$this->ListOptions->Add("delete");
$item =& $this->ListOptions->Items["delete"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanDelete();
$item->OnLeft = FALSE;
// Call ListOptions_Load event
$this->ListOptions_Load();
if ($CCEDocuments->Export <> "" ||
$CCEDocuments->CurrentAction == "gridadd" ||
$CCEDocuments->CurrentAction == "gridedit")
$this->ListOptions->HideAllOptions();
}
// Render list options
function RenderListOptions() {
global $Security, $Language, $CCEDocuments;
$this->ListOptions->LoadDefault();
// "view"
$oListOpt =& $this->ListOptions->Items["view"];
if ($Security->CanView() && $oListOpt->Visible)
$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . $Language->Phrase("ViewLink") . "</a>";
// "edit"
$oListOpt =& $this->ListOptions->Items["edit"];
if ($Security->CanEdit() && $oListOpt->Visible) {
$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . $Language->Phrase("EditLink") . "</a>";
}
// "delete"
$oListOpt =& $this->ListOptions->Items["delete"];
if ($Security->CanDelete() && $oListOpt->Visible)
$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . $Language->Phrase("DeleteLink") . "</a>";
if ($CCEDocuments->CurrentAction == "gridedit")
$this->sMultiSelectKey .= "<input type=\"hidden\" name=\"k" . $this->lRowIndex . "_key\" id=\"k" . $this->lRowIndex . "_key\" value=\"" . $CCEDocuments->CCEDocumentID->CurrentValue . "\">";
$this->RenderListOptionsExt();
// Call ListOptions_Rendered event
$this->ListOptions_Rendered();
}
function RenderListOptionsExt() {
global $Security, $Language, $CCEDocuments;
}
// Set up starting record parameters
function SetUpStartRec() {
global $CCEDocuments;
if ($this->lDisplayRecs == 0)
return;
if ($this->IsPageRequest()) { // Validate request
if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
$this->lStartRec = $_GET[EW_TABLE_START_REC];
$CCEDocuments->setStartRecordNumber($this->lStartRec);
} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
if (is_numeric($this->nPageNo)) {
$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
if ($this->lStartRec <= 0) {
$this->lStartRec = 1;
} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
}
$CCEDocuments->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $CCEDocuments->getStartRecordNumber();
// Check if correct start record counter
if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
$this->lStartRec = 1; // Reset start record counter
$CCEDocuments->setStartRecordNumber($this->lStartRec);
} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
$CCEDocuments->setStartRecordNumber($this->lStartRec);
} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
$CCEDocuments->setStartRecordNumber($this->lStartRec);
}
}
// Load basic search values
function LoadBasicSearchValues() {
global $CCEDocuments;
$CCEDocuments->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
$CCEDocuments->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
}
// Load search values for validation
function LoadSearchValues() {
global $objForm, $CCEDocuments;
// Load search values
// CCEModuleID
$CCEDocuments->CCEModuleID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_CCEModuleID"]);
$CCEDocuments->CCEModuleID->AdvancedSearch->SearchOperator = @$_GET["z_CCEModuleID"];
// DocumentCode
$CCEDocuments->DocumentCode->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DocumentCode"]);
$CCEDocuments->DocumentCode->AdvancedSearch->SearchOperator = @$_GET["z_DocumentCode"];
// DocumentCategory
$CCEDocuments->DocumentCategory->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DocumentCategory"]);
$CCEDocuments->DocumentCategory->AdvancedSearch->SearchOperator = @$_GET["z_DocumentCategory"];
// DocumentName
$CCEDocuments->DocumentName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DocumentName"]);
$CCEDocuments->DocumentName->AdvancedSearch->SearchOperator = @$_GET["z_DocumentName"];
// AppliesToDate
$CCEDocuments->AppliesToDate->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_AppliesToDate"]);
$CCEDocuments->AppliesToDate->AdvancedSearch->SearchOperator = @$_GET["z_AppliesToDate"];
// PresenterName
$CCEDocuments->PresenterName->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_PresenterName"]);
$CCEDocuments->PresenterName->AdvancedSearch->SearchOperator = @$_GET["z_PresenterName"];
// ReleaseDate
$CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_ReleaseDate"]);
$CCEDocuments->ReleaseDate->AdvancedSearch->SearchOperator = @$_GET["z_ReleaseDate"];
// ReleaseTime
$CCEDocuments->ReleaseTime->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_ReleaseTime"]);
$CCEDocuments->ReleaseTime->AdvancedSearch->SearchOperator = @$_GET["z_ReleaseTime"];
// Students
$CCEDocuments->Students->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Students"]);
$CCEDocuments->Students->AdvancedSearch->SearchOperator = @$_GET["z_Students"];
// Archived
$CCEDocuments->Archived->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Archived"]);
$CCEDocuments->Archived->AdvancedSearch->SearchOperator = @$_GET["z_Archived"];
// ArchiveYear
$CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_ArchiveYear"]);
$CCEDocuments->ArchiveYear->AdvancedSearch->SearchOperator = @$_GET["z_ArchiveYear"];
// DateCreated
$CCEDocuments->DateCreated->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DateCreated"]);
$CCEDocuments->DateCreated->AdvancedSearch->SearchOperator = @$_GET["z_DateCreated"];
// Description
$CCEDocuments->Description->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Description"]);
$CCEDocuments->Description->AdvancedSearch->SearchOperator = @$_GET["z_Description"];
// KeyWords
$CCEDocuments->KeyWords->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_KeyWords"]);
$CCEDocuments->KeyWords->AdvancedSearch->SearchOperator = @$_GET["z_KeyWords"];
// DisplayInline
$CCEDocuments->DisplayInline->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_DisplayInline"]);
$CCEDocuments->DisplayInline->AdvancedSearch->SearchOperator = @$_GET["z_DisplayInline"];
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $CCEDocuments;
$CCEDocuments->CCEModuleID->setFormValue($objForm->GetValue("x_CCEModuleID"));
$CCEDocuments->DocumentCode->setFormValue($objForm->GetValue("x_DocumentCode"));
$CCEDocuments->DocumentCategory->setFormValue($objForm->GetValue("x_DocumentCategory"));
$CCEDocuments->DocumentName->setFormValue($objForm->GetValue("x_DocumentName"));
$CCEDocuments->AppliesToDate->setFormValue($objForm->GetValue("x_AppliesToDate"));
$CCEDocuments->AppliesToDate->CurrentValue = ew_UnFormatDateTime($CCEDocuments->AppliesToDate->CurrentValue, 5);
$CCEDocuments->PresenterName->setFormValue($objForm->GetValue("x_PresenterName"));
$CCEDocuments->PresentationTime->setFormValue($objForm->GetValue("x_PresentationTime"));
$CCEDocuments->ReleaseDate->setFormValue($objForm->GetValue("x_ReleaseDate"));
$CCEDocuments->ReleaseDate->CurrentValue = ew_UnFormatDateTime($CCEDocuments->ReleaseDate->CurrentValue, 5);
$CCEDocuments->Archived->setFormValue($objForm->GetValue("x_Archived"));
$CCEDocuments->ArchiveYear->setFormValue($objForm->GetValue("x_ArchiveYear"));
$CCEDocuments->CCEDocumentID->setFormValue($objForm->GetValue("x_CCEDocumentID"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $CCEDocuments;
$CCEDocuments->CCEDocumentID->CurrentValue = $CCEDocuments->CCEDocumentID->FormValue;
$CCEDocuments->CCEModuleID->CurrentValue = $CCEDocuments->CCEModuleID->FormValue;
$CCEDocuments->DocumentCode->CurrentValue = $CCEDocuments->DocumentCode->FormValue;
$CCEDocuments->DocumentCategory->CurrentValue = $CCEDocuments->DocumentCategory->FormValue;
$CCEDocuments->DocumentName->CurrentValue = $CCEDocuments->DocumentName->FormValue;
$CCEDocuments->AppliesToDate->CurrentValue = $CCEDocuments->AppliesToDate->FormValue;
$CCEDocuments->AppliesToDate->CurrentValue = ew_UnFormatDateTime($CCEDocuments->AppliesToDate->CurrentValue, 5);
$CCEDocuments->PresenterName->CurrentValue = $CCEDocuments->PresenterName->FormValue;
$CCEDocuments->PresentationTime->CurrentValue = $CCEDocuments->PresentationTime->FormValue;
$CCEDocuments->ReleaseDate->CurrentValue = $CCEDocuments->ReleaseDate->FormValue;
$CCEDocuments->ReleaseDate->CurrentValue = ew_UnFormatDateTime($CCEDocuments->ReleaseDate->CurrentValue, 5);
$CCEDocuments->Archived->CurrentValue = $CCEDocuments->Archived->FormValue;
$CCEDocuments->ArchiveYear->CurrentValue = $CCEDocuments->ArchiveYear->FormValue;
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $CCEDocuments;
// Call Recordset Selecting event
$CCEDocuments->Recordset_Selecting($CCEDocuments->CurrentFilter);
// Load List page SQL
$sSql = $CCEDocuments->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$CCEDocuments->Recordset_Selected($rs);
return $rs;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEDocuments;
$sFilter = $CCEDocuments->KeyFilter();
// Call Row Selecting event
$CCEDocuments->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEDocuments->CurrentFilter = $sFilter;
$sSql = $CCEDocuments->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEDocuments->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEDocuments;
$CCEDocuments->CCEDocumentID->setDbValue($rs->fields('CCEDocumentID'));
$CCEDocuments->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
$CCEDocuments->DocumentCode->setDbValue($rs->fields('DocumentCode'));
$CCEDocuments->DocumentCategory->setDbValue($rs->fields('DocumentCategory'));
$CCEDocuments->DocumentName->setDbValue($rs->fields('DocumentName'));
$CCEDocuments->DocumentFile->Upload->DbValue = $rs->fields('DocumentFile');
$CCEDocuments->DocumentURL->setDbValue($rs->fields('DocumentURL'));
$CCEDocuments->DocumentThumb->setDbValue($rs->fields('DocumentThumb'));
$CCEDocuments->UploadedBy->setDbValue($rs->fields('UploadedBy'));
$CCEDocuments->AppliesToDate->setDbValue($rs->fields('AppliesToDate'));
$CCEDocuments->CCEWeeklySessionID->setDbValue($rs->fields('CCEWeeklySessionID'));
$CCEDocuments->PresenterName->setDbValue($rs->fields('PresenterName'));
$CCEDocuments->PresentationTime->setDbValue($rs->fields('PresentationTime'));
$CCEDocuments->ReleaseDate->setDbValue($rs->fields('ReleaseDate'));
$CCEDocuments->ReleaseTime->setDbValue($rs->fields('ReleaseTime'));
$CCEDocuments->Students->setDbValue($rs->fields('Students'));
$CCEDocuments->Archived->setDbValue($rs->fields('Archived'));
$CCEDocuments->ArchiveYear->setDbValue($rs->fields('ArchiveYear'));
$CCEDocuments->DateCreated->setDbValue($rs->fields('DateCreated'));
$CCEDocuments->Description->setDbValue($rs->fields('Description'));
$CCEDocuments->KeyWords->setDbValue($rs->fields('KeyWords'));
$CCEDocuments->DisplayInline->setDbValue($rs->fields('DisplayInline'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEDocuments;
// Initialize URLs
$this->ViewUrl = $CCEDocuments->ViewUrl();
$this->EditUrl = $CCEDocuments->EditUrl();
$this->InlineEditUrl = $CCEDocuments->InlineEditUrl();
$this->CopyUrl = $CCEDocuments->CopyUrl();
$this->InlineCopyUrl = $CCEDocuments->InlineCopyUrl();
$this->DeleteUrl = $CCEDocuments->DeleteUrl();
// Call Row_Rendering event
$CCEDocuments->Row_Rendering();
// Common render codes for all row types
// CCEModuleID
$CCEDocuments->CCEModuleID->CellCssStyle = ""; $CCEDocuments->CCEModuleID->CellCssClass = "";
$CCEDocuments->CCEModuleID->CellAttrs = array(); $CCEDocuments->CCEModuleID->ViewAttrs = array(); $CCEDocuments->CCEModuleID->EditAttrs = array();
// DocumentCode
$CCEDocuments->DocumentCode->CellCssStyle = ""; $CCEDocuments->DocumentCode->CellCssClass = "";
$CCEDocuments->DocumentCode->CellAttrs = array(); $CCEDocuments->DocumentCode->ViewAttrs = array(); $CCEDocuments->DocumentCode->EditAttrs = array();
// DocumentCategory
$CCEDocuments->DocumentCategory->CellCssStyle = ""; $CCEDocuments->DocumentCategory->CellCssClass = "";
$CCEDocuments->DocumentCategory->CellAttrs = array(); $CCEDocuments->DocumentCategory->ViewAttrs = array(); $CCEDocuments->DocumentCategory->EditAttrs = array();
// DocumentName
$CCEDocuments->DocumentName->CellCssStyle = ""; $CCEDocuments->DocumentName->CellCssClass = "";
$CCEDocuments->DocumentName->CellAttrs = array(); $CCEDocuments->DocumentName->ViewAttrs = array(); $CCEDocuments->DocumentName->EditAttrs = array();
// AppliesToDate
$CCEDocuments->AppliesToDate->CellCssStyle = ""; $CCEDocuments->AppliesToDate->CellCssClass = "";
$CCEDocuments->AppliesToDate->CellAttrs = array(); $CCEDocuments->AppliesToDate->ViewAttrs = array(); $CCEDocuments->AppliesToDate->EditAttrs = array();
// PresenterName
$CCEDocuments->PresenterName->CellCssStyle = ""; $CCEDocuments->PresenterName->CellCssClass = "";
$CCEDocuments->PresenterName->CellAttrs = array(); $CCEDocuments->PresenterName->ViewAttrs = array(); $CCEDocuments->PresenterName->EditAttrs = array();
// PresentationTime
$CCEDocuments->PresentationTime->CellCssStyle = ""; $CCEDocuments->PresentationTime->CellCssClass = "";
$CCEDocuments->PresentationTime->CellAttrs = array(); $CCEDocuments->PresentationTime->ViewAttrs = array(); $CCEDocuments->PresentationTime->EditAttrs = array();
// ReleaseDate
$CCEDocuments->ReleaseDate->CellCssStyle = ""; $CCEDocuments->ReleaseDate->CellCssClass = "";
$CCEDocuments->ReleaseDate->CellAttrs = array(); $CCEDocuments->ReleaseDate->ViewAttrs = array(); $CCEDocuments->ReleaseDate->EditAttrs = array();
// Archived
$CCEDocuments->Archived->CellCssStyle = "white-space: nowrap;"; $CCEDocuments->Archived->CellCssClass = "";
$CCEDocuments->Archived->CellAttrs = array(); $CCEDocuments->Archived->ViewAttrs = array(); $CCEDocuments->Archived->EditAttrs = array();
// ArchiveYear
$CCEDocuments->ArchiveYear->CellCssStyle = "white-space: nowrap;"; $CCEDocuments->ArchiveYear->CellCssClass = "";
$CCEDocuments->ArchiveYear->CellAttrs = array(); $CCEDocuments->ArchiveYear->ViewAttrs = array(); $CCEDocuments->ArchiveYear->EditAttrs = array();
if ($CCEDocuments->RowType == EW_ROWTYPE_VIEW) { // View row
// CCEDocumentID
$CCEDocuments->CCEDocumentID->ViewValue = $CCEDocuments->CCEDocumentID->CurrentValue;
$CCEDocuments->CCEDocumentID->CssStyle = "";
$CCEDocuments->CCEDocumentID->CssClass = "";
$CCEDocuments->CCEDocumentID->ViewCustomAttributes = "";
// CCEModuleID
if (strval($CCEDocuments->CCEModuleID->CurrentValue) <> "") {
$sFilterWrk = "CCEModules.CCEModuleID = " . ew_AdjustSql($CCEDocuments->CCEModuleID->CurrentValue) . "";
$sSqlWrk = "SELECT CCEModules.ModuleNum AS `ModuleNum`, CCEModules.ModuleName AS `ModuleName` FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->CCEModuleID->ViewValue = $rswrk->fields('ModuleNum');
$CCEDocuments->CCEModuleID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('ModuleName');
$rswrk->Close();
} else {
$CCEDocuments->CCEModuleID->ViewValue = $CCEDocuments->CCEModuleID->CurrentValue;
}
} else {
$CCEDocuments->CCEModuleID->ViewValue = NULL;
}
$CCEDocuments->CCEModuleID->CssStyle = "";
$CCEDocuments->CCEModuleID->CssClass = "";
$CCEDocuments->CCEModuleID->ViewCustomAttributes = "";
// DocumentCode
$CCEDocuments->DocumentCode->ViewValue = $CCEDocuments->DocumentCode->CurrentValue;
$CCEDocuments->DocumentCode->CssStyle = "";
$CCEDocuments->DocumentCode->CssClass = "";
$CCEDocuments->DocumentCode->ViewCustomAttributes = "";
// DocumentCategory
if (strval($CCEDocuments->DocumentCategory->CurrentValue) <> "") {
$sFilterWrk = "`CCEDocCategoryID` = " . ew_AdjustSql($CCEDocuments->DocumentCategory->CurrentValue) . "";
$sSqlWrk = "SELECT `CategoryName` FROM `CCEDocCategories`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `CategoryName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->DocumentCategory->ViewValue = $rswrk->fields('CategoryName');
$rswrk->Close();
} else {
$CCEDocuments->DocumentCategory->ViewValue = $CCEDocuments->DocumentCategory->CurrentValue;
}
} else {
$CCEDocuments->DocumentCategory->ViewValue = NULL;
}
$CCEDocuments->DocumentCategory->CssStyle = "";
$CCEDocuments->DocumentCategory->CssClass = "";
$CCEDocuments->DocumentCategory->ViewCustomAttributes = "";
// DocumentName
$CCEDocuments->DocumentName->ViewValue = $CCEDocuments->DocumentName->CurrentValue;
$CCEDocuments->DocumentName->CssStyle = "";
$CCEDocuments->DocumentName->CssClass = "";
$CCEDocuments->DocumentName->ViewCustomAttributes = "";
// DocumentFile
if (!ew_Empty($CCEDocuments->DocumentFile->Upload->DbValue)) {
$CCEDocuments->DocumentFile->ViewValue = $CCEDocuments->DocumentFile->Upload->DbValue;
} else {
$CCEDocuments->DocumentFile->ViewValue = "";
}
$CCEDocuments->DocumentFile->CssStyle = "";
$CCEDocuments->DocumentFile->CssClass = "";
$CCEDocuments->DocumentFile->ViewCustomAttributes = "";
// DocumentURL
$CCEDocuments->DocumentURL->ViewValue = $CCEDocuments->DocumentURL->CurrentValue;
$CCEDocuments->DocumentURL->CssStyle = "";
$CCEDocuments->DocumentURL->CssClass = "";
$CCEDocuments->DocumentURL->ViewCustomAttributes = "";
// UploadedBy
if (strval($CCEDocuments->UploadedBy->CurrentValue) <> "") {
$sFilterWrk = "`FacilitatorID` = " . ew_AdjustSql($CCEDocuments->UploadedBy->CurrentValue) . "";
$sSqlWrk = "SELECT `FacilitatorName` FROM `CCEFacilitators`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `FacilitatorName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->UploadedBy->ViewValue = $rswrk->fields('FacilitatorName');
$rswrk->Close();
} else {
$CCEDocuments->UploadedBy->ViewValue = $CCEDocuments->UploadedBy->CurrentValue;
}
} else {
$CCEDocuments->UploadedBy->ViewValue = NULL;
}
$CCEDocuments->UploadedBy->CssStyle = "";
$CCEDocuments->UploadedBy->CssClass = "";
$CCEDocuments->UploadedBy->ViewCustomAttributes = "";
// AppliesToDate
if (strval($CCEDocuments->AppliesToDate->CurrentValue) <> "") {
$sFilterWrk = "`SessionDate` = '" . ew_AdjustSql($CCEDocuments->AppliesToDate->CurrentValue) . "'";
$sSqlWrk = "SELECT DISTINCT `SessionDate` FROM `CCEWeeklySessions`";
$sWhereWrk = "";
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . "YEAR(SessionDate)=YEAR(NOW())" . ")";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `SessionDate`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->AppliesToDate->ViewValue = $rswrk->fields('SessionDate');
$rswrk->Close();
} else {
$CCEDocuments->AppliesToDate->ViewValue = $CCEDocuments->AppliesToDate->CurrentValue;
}
} else {
$CCEDocuments->AppliesToDate->ViewValue = NULL;
}
$CCEDocuments->AppliesToDate->ViewValue = ew_FormatDateTime($CCEDocuments->AppliesToDate->ViewValue, 5);
$CCEDocuments->AppliesToDate->CssStyle = "";
$CCEDocuments->AppliesToDate->CssClass = "";
$CCEDocuments->AppliesToDate->ViewCustomAttributes = "";
// PresenterName
if (strval($CCEDocuments->PresenterName->CurrentValue) <> "") {
$sFilterWrk = "`SessionDate` = '" . ew_AdjustSql($CCEDocuments->PresenterName->CurrentValue) . "'";
$sSqlWrk = "SELECT DISTINCT `PresenterName` FROM `CCEWeeklySessions`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `PresenterName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->PresenterName->ViewValue = $rswrk->fields('PresenterName');
$rswrk->Close();
} else {
$CCEDocuments->PresenterName->ViewValue = $CCEDocuments->PresenterName->CurrentValue;
}
} else {
$CCEDocuments->PresenterName->ViewValue = NULL;
}
$CCEDocuments->PresenterName->CssStyle = "";
$CCEDocuments->PresenterName->CssClass = "";
$CCEDocuments->PresenterName->ViewCustomAttributes = "";
// PresentationTime
$CCEDocuments->PresentationTime->ViewValue = $CCEDocuments->PresentationTime->CurrentValue;
$CCEDocuments->PresentationTime->CssStyle = "";
$CCEDocuments->PresentationTime->CssClass = "";
$CCEDocuments->PresentationTime->ViewCustomAttributes = "";
// ReleaseDate
$CCEDocuments->ReleaseDate->ViewValue = $CCEDocuments->ReleaseDate->CurrentValue;
$CCEDocuments->ReleaseDate->ViewValue = ew_FormatDateTime($CCEDocuments->ReleaseDate->ViewValue, 5);
$CCEDocuments->ReleaseDate->CssStyle = "";
$CCEDocuments->ReleaseDate->CssClass = "";
$CCEDocuments->ReleaseDate->ViewCustomAttributes = "";
// ReleaseTime
$CCEDocuments->ReleaseTime->ViewValue = $CCEDocuments->ReleaseTime->CurrentValue;
$CCEDocuments->ReleaseTime->ViewValue = ew_FormatDateTime($CCEDocuments->ReleaseTime->ViewValue, 4);
$CCEDocuments->ReleaseTime->CssStyle = "";
$CCEDocuments->ReleaseTime->CssClass = "";
$CCEDocuments->ReleaseTime->ViewCustomAttributes = "";
// Archived
if (strval($CCEDocuments->Archived->CurrentValue) <> "") {
switch ($CCEDocuments->Archived->CurrentValue) {
case "1":
$CCEDocuments->Archived->ViewValue = "Yes";
break;
case "0":
$CCEDocuments->Archived->ViewValue = "No";
break;
default:
$CCEDocuments->Archived->ViewValue = $CCEDocuments->Archived->CurrentValue;
}
} else {
$CCEDocuments->Archived->ViewValue = NULL;
}
$CCEDocuments->Archived->CssStyle = "";
$CCEDocuments->Archived->CssClass = "";
$CCEDocuments->Archived->ViewCustomAttributes = "";
// ArchiveYear
$CCEDocuments->ArchiveYear->ViewValue = $CCEDocuments->ArchiveYear->CurrentValue;
$CCEDocuments->ArchiveYear->CssStyle = "";
$CCEDocuments->ArchiveYear->CssClass = "";
$CCEDocuments->ArchiveYear->ViewCustomAttributes = "";
// DateCreated
$CCEDocuments->DateCreated->ViewValue = $CCEDocuments->DateCreated->CurrentValue;
$CCEDocuments->DateCreated->ViewValue = ew_FormatDateTime($CCEDocuments->DateCreated->ViewValue, 5);
$CCEDocuments->DateCreated->CssStyle = "";
$CCEDocuments->DateCreated->CssClass = "";
$CCEDocuments->DateCreated->ViewCustomAttributes = "";
// Description
$CCEDocuments->Description->ViewValue = $CCEDocuments->Description->CurrentValue;
$CCEDocuments->Description->CssStyle = "";
$CCEDocuments->Description->CssClass = "";
$CCEDocuments->Description->ViewCustomAttributes = "";
// KeyWords
$CCEDocuments->KeyWords->ViewValue = $CCEDocuments->KeyWords->CurrentValue;
$CCEDocuments->KeyWords->CssStyle = "";
$CCEDocuments->KeyWords->CssClass = "";
$CCEDocuments->KeyWords->ViewCustomAttributes = "";
// DisplayInline
if (strval($CCEDocuments->DisplayInline->CurrentValue) <> "") {
switch ($CCEDocuments->DisplayInline->CurrentValue) {
case "0":
$CCEDocuments->DisplayInline->ViewValue = "No";
break;
case "1":
$CCEDocuments->DisplayInline->ViewValue = "Yes";
break;
default:
$CCEDocuments->DisplayInline->ViewValue = $CCEDocuments->DisplayInline->CurrentValue;
}
} else {
$CCEDocuments->DisplayInline->ViewValue = NULL;
}
$CCEDocuments->DisplayInline->CssStyle = "";
$CCEDocuments->DisplayInline->CssClass = "";
$CCEDocuments->DisplayInline->ViewCustomAttributes = "";
// CCEModuleID
$CCEDocuments->CCEModuleID->HrefValue = "";
$CCEDocuments->CCEModuleID->TooltipValue = "";
// DocumentCode
$CCEDocuments->DocumentCode->HrefValue = "";
$CCEDocuments->DocumentCode->TooltipValue = "";
// DocumentCategory
$CCEDocuments->DocumentCategory->HrefValue = "";
$CCEDocuments->DocumentCategory->TooltipValue = "";
// DocumentName
$CCEDocuments->DocumentName->HrefValue = "";
$CCEDocuments->DocumentName->TooltipValue = "";
// AppliesToDate
$CCEDocuments->AppliesToDate->HrefValue = "";
$CCEDocuments->AppliesToDate->TooltipValue = "";
// PresenterName
$CCEDocuments->PresenterName->HrefValue = "";
$CCEDocuments->PresenterName->TooltipValue = "";
// PresentationTime
$CCEDocuments->PresentationTime->HrefValue = "";
$CCEDocuments->PresentationTime->TooltipValue = "";
// ReleaseDate
$CCEDocuments->ReleaseDate->HrefValue = "";
$CCEDocuments->ReleaseDate->TooltipValue = "";
// Archived
$CCEDocuments->Archived->HrefValue = "";
$CCEDocuments->Archived->TooltipValue = "";
// ArchiveYear
$CCEDocuments->ArchiveYear->HrefValue = "";
$CCEDocuments->ArchiveYear->TooltipValue = "";
} elseif ($CCEDocuments->RowType == EW_ROWTYPE_EDIT) { // Edit row
// CCEModuleID
$CCEDocuments->CCEModuleID->EditCustomAttributes = "";
if ($CCEDocuments->CCEModuleID->getSessionValue() <> "") {
$CCEDocuments->CCEModuleID->CurrentValue = $CCEDocuments->CCEModuleID->getSessionValue();
if (strval($CCEDocuments->CCEModuleID->CurrentValue) <> "") {
$sFilterWrk = "CCEModules.CCEModuleID = " . ew_AdjustSql($CCEDocuments->CCEModuleID->CurrentValue) . "";
$sSqlWrk = "SELECT CCEModules.ModuleNum AS `ModuleNum`, CCEModules.ModuleName AS `ModuleName` FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEDocuments->CCEModuleID->ViewValue = $rswrk->fields('ModuleNum');
$CCEDocuments->CCEModuleID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('ModuleName');
$rswrk->Close();
} else {
$CCEDocuments->CCEModuleID->ViewValue = $CCEDocuments->CCEModuleID->CurrentValue;
}
} else {
$CCEDocuments->CCEModuleID->ViewValue = NULL;
}
$CCEDocuments->CCEModuleID->CssStyle = "";
$CCEDocuments->CCEModuleID->CssClass = "";
$CCEDocuments->CCEModuleID->ViewCustomAttributes = "";
} else {
$sFilterWrk = "";
$sSqlWrk = "SELECT CCEModules.CCEModuleID, CCEModules.ModuleNum, CCEModules.ModuleName, '' AS SelectFilterFld FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEDocuments->CCEModuleID->EditValue = $arwrk;
}
// DocumentCode
$CCEDocuments->DocumentCode->EditCustomAttributes = "";
$CCEDocuments->DocumentCode->EditValue = ew_HtmlEncode($CCEDocuments->DocumentCode->CurrentValue);
// DocumentCategory
$CCEDocuments->DocumentCategory->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `CCEDocCategoryID`, `CategoryName`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEDocCategories`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `CategoryName`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEDocuments->DocumentCategory->EditValue = $arwrk;
// DocumentName
$CCEDocuments->DocumentName->EditCustomAttributes = "";
$CCEDocuments->DocumentName->EditValue = ew_HtmlEncode($CCEDocuments->DocumentName->CurrentValue);
// AppliesToDate
$CCEDocuments->AppliesToDate->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT DISTINCT `SessionDate`, `SessionDate`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEWeeklySessions`";
$sWhereWrk = "";
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . "YEAR(SessionDate)=YEAR(NOW())" . ")";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `SessionDate`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEDocuments->AppliesToDate->EditValue = $arwrk;
// PresenterName
$CCEDocuments->PresenterName->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT DISTINCT `SessionDate`, `PresenterName`, '' AS Disp2Fld, `SessionDate` FROM `CCEWeeklySessions`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `PresenterName`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEDocuments->PresenterName->EditValue = $arwrk;
// PresentationTime
$CCEDocuments->PresentationTime->EditCustomAttributes = "";
$CCEDocuments->PresentationTime->EditValue = ew_HtmlEncode($CCEDocuments->PresentationTime->CurrentValue);
// ReleaseDate
$CCEDocuments->ReleaseDate->EditCustomAttributes = "";
$CCEDocuments->ReleaseDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEDocuments->ReleaseDate->CurrentValue, 5));
// Archived
$CCEDocuments->Archived->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEDocuments->Archived->EditValue = $arwrk;
// ArchiveYear
$CCEDocuments->ArchiveYear->EditCustomAttributes = "";
$CCEDocuments->ArchiveYear->EditValue = ew_HtmlEncode($CCEDocuments->ArchiveYear->CurrentValue);
// Edit refer script
// CCEModuleID
$CCEDocuments->CCEModuleID->HrefValue = "";
// DocumentCode
$CCEDocuments->DocumentCode->HrefValue = "";
// DocumentCategory
$CCEDocuments->DocumentCategory->HrefValue = "";
// DocumentName
$CCEDocuments->DocumentName->HrefValue = "";
// AppliesToDate
$CCEDocuments->AppliesToDate->HrefValue = "";
// PresenterName
$CCEDocuments->PresenterName->HrefValue = "";
// PresentationTime
$CCEDocuments->PresentationTime->HrefValue = "";
// ReleaseDate
$CCEDocuments->ReleaseDate->HrefValue = "";
// Archived
$CCEDocuments->Archived->HrefValue = "";
// ArchiveYear
$CCEDocuments->ArchiveYear->HrefValue = "";
} elseif ($CCEDocuments->RowType == EW_ROWTYPE_SEARCH) { // Search row
// CCEModuleID
$CCEDocuments->CCEModuleID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT CCEModules.CCEModuleID, CCEModules.ModuleNum, CCEModules.ModuleName, '' AS SelectFilterFld FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEDocuments->CCEModuleID->EditValue = $arwrk;
// DocumentCode
$CCEDocuments->DocumentCode->EditCustomAttributes = "";
$CCEDocuments->DocumentCode->EditValue = ew_HtmlEncode($CCEDocuments->DocumentCode->AdvancedSearch->SearchValue);
// DocumentCategory
$CCEDocuments->DocumentCategory->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `CCEDocCategoryID`, `CategoryName`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEDocCategories`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `CategoryName`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEDocuments->DocumentCategory->EditValue = $arwrk;
// DocumentName
$CCEDocuments->DocumentName->EditCustomAttributes = "";
$CCEDocuments->DocumentName->EditValue = ew_HtmlEncode($CCEDocuments->DocumentName->AdvancedSearch->SearchValue);
// AppliesToDate
$CCEDocuments->AppliesToDate->EditCustomAttributes = "";
// PresenterName
$CCEDocuments->PresenterName->EditCustomAttributes = "";
// PresentationTime
$CCEDocuments->PresentationTime->EditCustomAttributes = "";
$CCEDocuments->PresentationTime->EditValue = ew_HtmlEncode($CCEDocuments->PresentationTime->AdvancedSearch->SearchValue);
// ReleaseDate
$CCEDocuments->ReleaseDate->EditCustomAttributes = "";
$CCEDocuments->ReleaseDate->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue, 5), 5));
// Archived
$CCEDocuments->Archived->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEDocuments->Archived->EditValue = $arwrk;
// ArchiveYear
$CCEDocuments->ArchiveYear->EditCustomAttributes = "";
$CCEDocuments->ArchiveYear->EditValue = ew_HtmlEncode($CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue);
}
// Call Row Rendered event
if ($CCEDocuments->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEDocuments->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $CCEDocuments;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
if (!ew_CheckInteger($CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue)) {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $CCEDocuments->ArchiveYear->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;
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $CCEDocuments;
// Initialize form error message
$gsFormError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!is_null($CCEDocuments->DocumentCategory->FormValue) && $CCEDocuments->DocumentCategory->FormValue == "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEDocuments->DocumentCategory->FldCaption();
}
if (!ew_CheckDate($CCEDocuments->ReleaseDate->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEDocuments->ReleaseDate->FldErrMsg();
}
if (!ew_CheckInteger($CCEDocuments->ArchiveYear->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEDocuments->ArchiveYear->FldErrMsg();
}
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Update record based on key values
function EditRow() {
global $conn, $Security, $Language, $CCEDocuments;
$sFilter = $CCEDocuments->KeyFilter();
$CCEDocuments->CurrentFilter = $sFilter;
$sSql = $CCEDocuments->SQL();
$conn->raiseErrorFn = 'ew_ErrorFn';
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE)
return FALSE;
if ($rs->EOF) {
$EditRow = FALSE; // Update Failed
} else {
// Save old values
$rsold =& $rs->fields;
$rsnew = array();
// CCEModuleID
$CCEDocuments->CCEModuleID->SetDbValueDef($rsnew, $CCEDocuments->CCEModuleID->CurrentValue, NULL, FALSE);
// DocumentCode
$CCEDocuments->DocumentCode->SetDbValueDef($rsnew, $CCEDocuments->DocumentCode->CurrentValue, NULL, FALSE);
// DocumentCategory
$CCEDocuments->DocumentCategory->SetDbValueDef($rsnew, $CCEDocuments->DocumentCategory->CurrentValue, NULL, FALSE);
// DocumentName
$CCEDocuments->DocumentName->SetDbValueDef($rsnew, $CCEDocuments->DocumentName->CurrentValue, NULL, FALSE);
// AppliesToDate
$CCEDocuments->AppliesToDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEDocuments->AppliesToDate->CurrentValue, 5, FALSE), NULL);
// PresenterName
$CCEDocuments->PresenterName->SetDbValueDef($rsnew, $CCEDocuments->PresenterName->CurrentValue, NULL, FALSE);
// PresentationTime
$CCEDocuments->PresentationTime->SetDbValueDef($rsnew, $CCEDocuments->PresentationTime->CurrentValue, NULL, FALSE);
// ReleaseDate
$CCEDocuments->ReleaseDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEDocuments->ReleaseDate->CurrentValue, 5, FALSE), NULL);
// Archived
$CCEDocuments->Archived->SetDbValueDef($rsnew, $CCEDocuments->Archived->CurrentValue, 0, FALSE);
// ArchiveYear
$CCEDocuments->ArchiveYear->SetDbValueDef($rsnew, $CCEDocuments->ArchiveYear->CurrentValue, NULL, FALSE);
// Call Row Updating event
$bUpdateRow = $CCEDocuments->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$EditRow = $conn->Execute($CCEDocuments->UpdateSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($CCEDocuments->CancelMessage <> "") {
$this->setMessage($CCEDocuments->CancelMessage);
$CCEDocuments->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("UpdateCancelled"));
}
$EditRow = FALSE;
}
}
// Call Row_Updated event
if ($EditRow)
$CCEDocuments->Row_Updated($rsold, $rsnew);
$rs->Close();
return $EditRow;
}
// Load advanced search
function LoadAdvancedSearch() {
global $CCEDocuments;
$CCEDocuments->CCEModuleID->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_CCEModuleID");
$CCEDocuments->DocumentCode->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_DocumentCode");
$CCEDocuments->DocumentCategory->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_DocumentCategory");
$CCEDocuments->DocumentName->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_DocumentName");
$CCEDocuments->AppliesToDate->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_AppliesToDate");
$CCEDocuments->PresenterName->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_PresenterName");
$CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_ReleaseDate");
$CCEDocuments->ReleaseTime->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_ReleaseTime");
$CCEDocuments->Students->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_Students");
$CCEDocuments->Archived->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_Archived");
$CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_ArchiveYear");
$CCEDocuments->DateCreated->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_DateCreated");
$CCEDocuments->Description->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_Description");
$CCEDocuments->KeyWords->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_KeyWords");
$CCEDocuments->DisplayInline->AdvancedSearch->SearchValue = $CCEDocuments->getAdvancedSearch("x_DisplayInline");
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $CCEDocuments;
$utf8 = FALSE;
$bSelectLimit = EW_SELECT_LIMIT;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $CCEDocuments->SelectRecordCount();
} else {
if ($rs = $this->LoadRecordset())
$this->lTotalRecs = $rs->RecordCount();
}
$this->lStartRec = 1;
// Export all
if ($CCEDocuments->ExportAll) {
$this->lDisplayRecs = $this->lTotalRecs;
$this->lStopRec = $this->lTotalRecs;
} else { // Export one page only
$this->SetUpStartRec(); // Set up start record position
// Set the last record to display
if ($this->lDisplayRecs < 0) {
$this->lStopRec = $this->lTotalRecs;
} else {
$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
}
}
if ($bSelectLimit)
$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
if (!$rs) {
header("Content-Type:"); // Remove header
header("Content-Disposition:");
$this->ShowMessage();
return;
}
if ($CCEDocuments->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($CCEDocuments, "h");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($CCEDocuments->CCEDocumentID);
$ExportDoc->ExportCaption($CCEDocuments->CCEModuleID);
$ExportDoc->ExportCaption($CCEDocuments->DocumentCode);
$ExportDoc->ExportCaption($CCEDocuments->DocumentCategory);
$ExportDoc->ExportCaption($CCEDocuments->DocumentName);
$ExportDoc->ExportCaption($CCEDocuments->DocumentFile);
$ExportDoc->ExportCaption($CCEDocuments->DocumentURL);
$ExportDoc->ExportCaption($CCEDocuments->UploadedBy);
$ExportDoc->ExportCaption($CCEDocuments->AppliesToDate);
$ExportDoc->ExportCaption($CCEDocuments->PresenterName);
$ExportDoc->ExportCaption($CCEDocuments->PresentationTime);
$ExportDoc->ExportCaption($CCEDocuments->ReleaseDate);
$ExportDoc->ExportCaption($CCEDocuments->ReleaseTime);
$ExportDoc->ExportCaption($CCEDocuments->Archived);
$ExportDoc->ExportCaption($CCEDocuments->ArchiveYear);
$ExportDoc->ExportCaption($CCEDocuments->DateCreated);
$ExportDoc->ExportCaption($CCEDocuments->Description);
$ExportDoc->ExportCaption($CCEDocuments->KeyWords);
$ExportDoc->ExportCaption($CCEDocuments->DisplayInline);
$ExportDoc->EndExportRow();
}
}
// Move to first record
$this->lRecCnt = $this->lStartRec - 1;
if (!$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $this->lStartRec > 1)
$rs->Move($this->lStartRec - 1);
}
while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
$this->lRecCnt++;
if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
$this->LoadRowValues($rs);
// Render row
$CCEDocuments->CssClass = "";
$CCEDocuments->CssStyle = "";
$CCEDocuments->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($CCEDocuments->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('CCEDocumentID', $CCEDocuments->CCEDocumentID->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('CCEModuleID', $CCEDocuments->CCEModuleID->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DocumentCode', $CCEDocuments->DocumentCode->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DocumentCategory', $CCEDocuments->DocumentCategory->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DocumentName', $CCEDocuments->DocumentName->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DocumentFile', $CCEDocuments->DocumentFile->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DocumentURL', $CCEDocuments->DocumentURL->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('UploadedBy', $CCEDocuments->UploadedBy->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('AppliesToDate', $CCEDocuments->AppliesToDate->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('PresenterName', $CCEDocuments->PresenterName->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('PresentationTime', $CCEDocuments->PresentationTime->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('ReleaseDate', $CCEDocuments->ReleaseDate->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('ReleaseTime', $CCEDocuments->ReleaseTime->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('Archived', $CCEDocuments->Archived->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('ArchiveYear', $CCEDocuments->ArchiveYear->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DateCreated', $CCEDocuments->DateCreated->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('Description', $CCEDocuments->Description->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('KeyWords', $CCEDocuments->KeyWords->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
$XmlDoc->AddField('DisplayInline', $CCEDocuments->DisplayInline->ExportValue($CCEDocuments->Export, $CCEDocuments->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($CCEDocuments->CCEDocumentID);
$ExportDoc->ExportField($CCEDocuments->CCEModuleID);
$ExportDoc->ExportField($CCEDocuments->DocumentCode);
$ExportDoc->ExportField($CCEDocuments->DocumentCategory);
$ExportDoc->ExportField($CCEDocuments->DocumentName);
$ExportDoc->ExportField($CCEDocuments->DocumentFile);
$ExportDoc->ExportField($CCEDocuments->DocumentURL);
$ExportDoc->ExportField($CCEDocuments->UploadedBy);
$ExportDoc->ExportField($CCEDocuments->AppliesToDate);
$ExportDoc->ExportField($CCEDocuments->PresenterName);
$ExportDoc->ExportField($CCEDocuments->PresentationTime);
$ExportDoc->ExportField($CCEDocuments->ReleaseDate);
$ExportDoc->ExportField($CCEDocuments->ReleaseTime);
$ExportDoc->ExportField($CCEDocuments->Archived);
$ExportDoc->ExportField($CCEDocuments->ArchiveYear);
$ExportDoc->ExportField($CCEDocuments->DateCreated);
$ExportDoc->ExportField($CCEDocuments->Description);
$ExportDoc->ExportField($CCEDocuments->KeyWords);
$ExportDoc->ExportField($CCEDocuments->DisplayInline);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($CCEDocuments->Export <> "xml")
$ExportDoc->ExportFooter();
// Close recordset
$rs->Close();
// Clean output buffer
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
// Write BOM if utf-8
if ($utf8 && !in_array($CCEDocuments->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($CCEDocuments->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($CCEDocuments->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($CCEDocuments->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $CCEDocuments;
$sSender = @$_GET["sender"];
$sRecipient = @$_GET["recipient"];
$sCc = @$_GET["cc"];
$sBcc = @$_GET["bcc"];
$sContentType = @$_GET["contenttype"];
// Subject
$sSubject = ew_StripSlashes(@$_GET["subject"]);
$sEmailSubject = $sSubject;
// Message
$sContent = ew_StripSlashes(@$_GET["message"]);
$sEmailMessage = $sContent;
// Check sender
if ($sSender == "") {
$this->setMessage($Language->Phrase("EnterSenderEmail"));
return;
}
if (!ew_CheckEmail($sSender)) {
$this->setMessage($Language->Phrase("EnterProperSenderEmail"));
return;
}
// Check recipient
if (!ew_CheckEmailList($sRecipient, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperRecipientEmail"));
return;
}
// Check cc
if (!ew_CheckEmailList($sCc, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperCcEmail"));
return;
}
// Check bcc
if (!ew_CheckEmailList($sBcc, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperBccEmail"));
return;
}
// Check email sent count
if (!isset($_SESSION[EW_EXPORT_EMAIL_COUNTER]))
$_SESSION[EW_EXPORT_EMAIL_COUNTER] = 0;
if (intval($_SESSION[EW_EXPORT_EMAIL_COUNTER]) > EW_MAX_EMAIL_SENT_COUNT) {
$this->setMessage($Language->Phrase("ExceedMaxEmailExport"));
return;
}
if ($sEmailMessage <> "") {
$sEmailMessage = ew_RemoveXSS($sEmailMessage);
$sEmailMessage .= ($sContentType == "url") ? "\r\n\r\n" : "<br><br>";
}
if ($sContentType == "url") {
$sUrl = ew_ConvertFullUrl(ew_CurrentPage() . "?" . $this->ExportQueryString());
$sEmailMessage .= $sUrl; // send URL only
} else {
$sEmailMessage .= $EmailContent; // send HTML
}
// Send email
$Email = new cEmail();
$Email->Sender = $sSender; // Sender
$Email->Recipient = $sRecipient; // Recipient
$Email->Cc = $sCc; // Cc
$Email->Bcc = $sBcc; // Bcc
$Email->Subject = $sEmailSubject; // Subject
$Email->Content = $sEmailMessage; // Content
$Email->Format = ($sContentType == "url") ? "text" : "html";
$Email->Charset = EW_EMAIL_CHARSET;
$EventArgs = array();
$bEmailSent = FALSE;
if ($CCEDocuments->Email_Sending($Email, $EventArgs))
$bEmailSent = $Email->Send();
// Check email sent status
if ($bEmailSent) {
// Update email sent count
$_SESSION[EW_EXPORT_EMAIL_COUNTER]++;
// Sent email success
$this->setMessage($Language->Phrase("SendEmailSuccess"));
} else {
// Sent email failure
$this->setMessage($Email->SendErrDescription);
}
}
// Export QueryString
function ExportQueryString() {
global $CCEDocuments;
// Initialize
$sQry = "export=html";
// Build QueryString for search
if ($CCEDocuments->getSessionBasicSearchKeyword() <> "") {
$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCEDocuments->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCEDocuments->getSessionBasicSearchType();
}
$this->AddSearchQueryString($sQry, $CCEDocuments->CCEModuleID); // CCEModuleID
$this->AddSearchQueryString($sQry, $CCEDocuments->DocumentCode); // DocumentCode
$this->AddSearchQueryString($sQry, $CCEDocuments->DocumentCategory); // DocumentCategory
$this->AddSearchQueryString($sQry, $CCEDocuments->DocumentName); // DocumentName
$this->AddSearchQueryString($sQry, $CCEDocuments->AppliesToDate); // AppliesToDate
$this->AddSearchQueryString($sQry, $CCEDocuments->CCEWeeklySessionID); // CCEWeeklySessionID
$this->AddSearchQueryString($sQry, $CCEDocuments->PresenterName); // PresenterName
$this->AddSearchQueryString($sQry, $CCEDocuments->ReleaseDate); // ReleaseDate
$this->AddSearchQueryString($sQry, $CCEDocuments->ReleaseTime); // ReleaseTime
$this->AddSearchQueryString($sQry, $CCEDocuments->Students); // Students
$this->AddSearchQueryString($sQry, $CCEDocuments->Archived); // Archived
$this->AddSearchQueryString($sQry, $CCEDocuments->ArchiveYear); // ArchiveYear
$this->AddSearchQueryString($sQry, $CCEDocuments->DateCreated); // DateCreated
$this->AddSearchQueryString($sQry, $CCEDocuments->Description); // Description
$this->AddSearchQueryString($sQry, $CCEDocuments->KeyWords); // KeyWords
$this->AddSearchQueryString($sQry, $CCEDocuments->DisplayInline); // DisplayInline
// Build QueryString for pager
$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCEDocuments->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCEDocuments->getStartRecordNumber();
return $sQry;
}
// Add search QueryString
function AddSearchQueryString(&$Qry, &$Fld) {
global $CCEDocuments;
$FldParm = substr($Fld->FldVar, 2);
$FldSearchValue = $CCEDocuments->GetAdvancedSearch("x_" . $FldParm);
if (strval($FldSearchValue) <> "") {
$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
"&z_" . $FldParm . "=" . $CCEDocuments->GetAdvancedSearch("z_" . $FldParm);
}
$FldSearchValue2 = $CCEDocuments->GetAdvancedSearch("y_" . $FldParm);
if (strval($FldSearchValue2) <> "") {
$Qry .= "&v_" . $FldParm . "=" . $CCEDocuments->GetAdvancedSearch("v_" . $FldParm) .
"&y_" . $FldParm . "=" . $FldSearchValue2 .
"&w_" . $FldParm . "=" . $CCEDocuments->GetAdvancedSearch("w_" . $FldParm);
}
}
// Set up master/detail based on QueryString
function SetUpMasterDetail() {
global $CCEDocuments;
$bValidMaster = FALSE;
// Get the keys for master table
if (@$_GET[EW_TABLE_SHOW_MASTER] <> "") {
$sMasterTblVar = $_GET[EW_TABLE_SHOW_MASTER];
if ($sMasterTblVar == "") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = "";
$this->sDbDetailFilter = "";
}
if ($sMasterTblVar == "CCEModules") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEDocuments->SqlMasterFilter_CCEModules();
$this->sDbDetailFilter = $CCEDocuments->SqlDetailFilter_CCEModules();
if (@$_GET["CCEModuleID"] <> "") {
$GLOBALS["CCEModules"]->CCEModuleID->setQueryStringValue($_GET["CCEModuleID"]);
$CCEDocuments->CCEModuleID->setQueryStringValue($GLOBALS["CCEModules"]->CCEModuleID->QueryStringValue);
$CCEDocuments->CCEModuleID->setSessionValue($CCEDocuments->CCEModuleID->QueryStringValue);
if (!is_numeric($GLOBALS["CCEModules"]->CCEModuleID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@CCEModuleID@", ew_AdjustSql($GLOBALS["CCEModules"]->CCEModuleID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@CCEModuleID@", ew_AdjustSql($GLOBALS["CCEModules"]->CCEModuleID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
}
if ($bValidMaster) {
// Save current master table
$CCEDocuments->setCurrentMasterTable($sMasterTblVar);
// Reset start record counter (new master key)
$this->lStartRec = 1;
$CCEDocuments->setStartRecordNumber($this->lStartRec);
$CCEDocuments->setMasterFilter($this->sDbMasterFilter); // Set up master filter
$CCEDocuments->setDetailFilter($this->sDbDetailFilter); // Set up detail filter
// Clear previous master key from Session
if ($sMasterTblVar <> "CCEModules") {
if ($CCEDocuments->CCEModuleID->QueryStringValue == "") $CCEDocuments->CCEModuleID->setSessionValue("");
}
} else {
$this->sDbMasterFilter = $CCEDocuments->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEDocuments->getDetailFilter(); // Restore detail filter
}
}
// Page Load event
function Page_Load() {
//echo "Page Load";
CCEDocuments_Page_Load();
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
// ListOptions Load event
function ListOptions_Load() {
// Example:
//$this->ListOptions->Add("new");
//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
//$this->ListOptions->MoveItem("new", 0); // Move to first column
}
// ListOptions Rendered event
function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
}
}
?>