Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEDocumentssrch.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_search = new cCCEDocuments_search();
$Page =& $CCEDocuments_search;

// Page init
$CCEDocuments_search->Page_Init();

// Page main
$CCEDocuments_search->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--

// Create page object
var CCEDocuments_search = new ew_Page("CCEDocuments_search");

// page properties
CCEDocuments_search.PageID = "search"; // page ID
CCEDocuments_search.FormID = "fCCEDocumentssearch"; // form ID
var EW_PAGE_ID = CCEDocuments_search.PageID; // for backward compatibility

// extend page with validate function for search
CCEDocuments_search.ValidateSearch = function(fobj) {
	ew_PostAutoSuggest(fobj);
	if (this.ValidateRequired) {
		var infix = "";
		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 + "_ReleaseTime"];
		if (elm && !ew_CheckTime(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEDocuments->ReleaseTime->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()) ?>");
		elm = fobj.elements["x" + infix + "_DateCreated"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEDocuments->DateCreated->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_search.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
CCEDocuments_search.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEDocuments_search.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-cold-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<p><span class="phpmaker"><?php echo $Language->Phrase("Search") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEDocuments->TableCaption() ?><br><br>
<a href="<?php echo $CCEDocuments->getReturnUrl() ?>"><?php echo $Language->Phrase("BackToList") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEDocuments_search->ShowMessage();
?>
<form name="fCCEDocumentssearch" id="fCCEDocumentssearch" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEDocuments_search.ValidateSearch(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEDocuments">
<input type="hidden" name="a_search" id="a_search" value="S">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->CCEModuleID->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->CCEModuleID->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CCEModuleID" id="z_CCEModuleID" value="="></span></td>
		<td<?php echo $CCEDocuments->CCEModuleID->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<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>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->DocumentCode->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->DocumentCode->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_DocumentCode" id="z_DocumentCode" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->DocumentCode->CellAttributes() ?>>
			<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<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->DocumentCategory->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->DocumentCategory->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_DocumentCategory" id="z_DocumentCategory" value="="></span></td>
		<td<?php echo $CCEDocuments->DocumentCategory->CellAttributes() ?>>
			<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<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->DocumentName->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->DocumentName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_DocumentName" id="z_DocumentName" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->DocumentName->CellAttributes() ?>>
			<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<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->AppliesToDate->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->AppliesToDate->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_AppliesToDate" id="z_AppliesToDate" value="="></span></td>
		<td<?php echo $CCEDocuments->AppliesToDate->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<?php $CCEDocuments->AppliesToDate->EditAttrs["onchange"] = "ew_UpdateOpt('x_PresenterName','x_AppliesToDate',CCEDocuments_search.ar_x_PresenterName); " . @$CCEDocuments->AppliesToDate->EditAttrs["onchange"]; ?>
<select id="x_AppliesToDate" name="x_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->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->PresenterName->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->PresenterName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_PresenterName" id="z_PresenterName" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->PresenterName->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<select id="x_PresenterName" name="x_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->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>
<?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_search.ar_x_PresenterName = [<?php echo $jswrk ?>];

//-->
</script>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->ReleaseDate->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->ReleaseDate->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_ReleaseDate" id="z_ReleaseDate" value="="></span></td>
		<td<?php echo $CCEDocuments->ReleaseDate->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_ReleaseDate" id="x_ReleaseDate" title="<?php echo $CCEDocuments->ReleaseDate->FldTitle() ?>" value="<?php echo $CCEDocuments->ReleaseDate->EditValue ?>"<?php echo $CCEDocuments->ReleaseDate->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x_ReleaseDate" name="cal_x_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_ReleaseDate", // input field id
	ifFormat: "%Y/%m/%d", // date format
	button: "cal_x_ReleaseDate" // button id
});
</script>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->ReleaseTime->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->ReleaseTime->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_ReleaseTime" id="z_ReleaseTime" value="="></span></td>
		<td<?php echo $CCEDocuments->ReleaseTime->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_ReleaseTime" id="x_ReleaseTime" title="<?php echo $CCEDocuments->ReleaseTime->FldTitle() ?>" size="30" value="<?php echo $CCEDocuments->ReleaseTime->EditValue ?>"<?php echo $CCEDocuments->ReleaseTime->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->Students->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->Students->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Students" id="z_Students" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->Students->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<select id="x_Students[]" name="x_Students[]" title="<?php echo $CCEDocuments->Students->FldTitle() ?>" multiple="multiple"<?php echo $CCEDocuments->Students->EditAttributes() ?>>
<?php
if (is_array($CCEDocuments->Students->EditValue)) {
	$arwrk = $CCEDocuments->Students->EditValue;
	$armultiwrk= explode(",", strval($CCEDocuments->Students->AdvancedSearch->SearchValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		for ($ari = 0; $ari < count($armultiwrk); $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " selected=\"selected\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}	
?>
<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>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->Archived->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->Archived->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Archived" id="z_Archived" value="="></span></td>
		<td<?php echo $CCEDocuments->Archived->CellAttributes() ?>>
			<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<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->ArchiveYear->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->ArchiveYear->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_ArchiveYear" id="z_ArchiveYear" value="="></span></td>
		<td<?php echo $CCEDocuments->ArchiveYear->CellAttributes() ?>>
			<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>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->DateCreated->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->DateCreated->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_DateCreated" id="z_DateCreated" value="="></span></td>
		<td<?php echo $CCEDocuments->DateCreated->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_DateCreated" id="x_DateCreated" title="<?php echo $CCEDocuments->DateCreated->FldTitle() ?>" value="<?php echo $CCEDocuments->DateCreated->EditValue ?>"<?php echo $CCEDocuments->DateCreated->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->Description->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->Description->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Description" id="z_Description" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->Description->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<textarea name="x_Description" id="x_Description" title="<?php echo $CCEDocuments->Description->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEDocuments->Description->EditAttributes() ?>><?php echo $CCEDocuments->Description->EditValue ?></textarea>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->KeyWords->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->KeyWords->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_KeyWords" id="z_KeyWords" value="LIKE"></span></td>
		<td<?php echo $CCEDocuments->KeyWords->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<textarea name="x_KeyWords" id="x_KeyWords" title="<?php echo $CCEDocuments->KeyWords->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEDocuments->KeyWords->EditAttributes() ?>><?php echo $CCEDocuments->KeyWords->EditValue ?></textarea>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $CCEDocuments->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEDocuments->DisplayInline->FldCaption() ?></td>
		<td<?php echo $CCEDocuments->DisplayInline->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_DisplayInline" id="z_DisplayInline" value="="></span></td>
		<td<?php echo $CCEDocuments->DisplayInline->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<div id="tp_x_DisplayInline" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_DisplayInline" id="x_DisplayInline" title="<?php echo $CCEDocuments->DisplayInline->FldTitle() ?>" value="{value}"<?php echo $CCEDocuments->DisplayInline->EditAttributes() ?>></label></div>
<div id="dsl_x_DisplayInline" repeatcolumn="5">
<?php
$arwrk = $CCEDocuments->DisplayInline->EditValue;
if (is_array($arwrk)) {
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEDocuments->DisplayInline->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_DisplayInline" id="x_DisplayInline" title="<?php echo $CCEDocuments->DisplayInline->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEDocuments->DisplayInline->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
?>
</div>
</span>
			</div>
		</td>
	</tr>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("Search")) ?>">
<input type="button" name="Reset" id="Reset" value="<?php echo ew_BtnCaption($Language->Phrase("Reset")) ?>" onclick="ew_ClearForm(this.form);">
</form>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x_PresenterName','x_AppliesToDate',CCEDocuments_search.ar_x_PresenterName]]);

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php include "footer.php" ?>
<?php
$CCEDocuments_search->Page_Terminate();
?>
<?php

//
// Page class
//
class cCCEDocuments_search {

	// Page ID
	var $PageID = 'search';

	// Table name
	var $TableName = 'CCEDocuments';

	// Page object name
	var $PageObjName = 'CCEDocuments_search';

	// 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();

		// Table object (CCEModules)
		$GLOBALS['CCEModules'] = new cCCEModules();

		// Table object (CCEUsers)
		$GLOBALS['CCEUsers'] = new cCCEUsers();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'search', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'CCEDocuments', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $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->CanSearch()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCEDocumentslist.php");
		}

		// Create form object
		$objForm = new cFormObj();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError, $CCEDocuments;
		if ($this->IsPageRequest()) { // Validate request

			// Get action
			$CCEDocuments->CurrentAction = $objForm->GetValue("a_search");
			switch ($CCEDocuments->CurrentAction) {
				case "S": // Get search criteria

					// Build search string for advanced search, remove blank field
					$this->LoadSearchValues(); // Get search values
					if ($this->ValidateSearch()) {
						$sSrchStr = $this->BuildAdvancedSearch();
					} else {
						$sSrchStr = "";
						$this->setMessage($gsSearchError);
					}
					if ($sSrchStr <> "") {
						$sSrchStr = $CCEDocuments->UrlParm($sSrchStr);
						$this->Page_Terminate("CCEDocumentslist.php" . "?" . $sSrchStr); // Go to list page
					}
			}
		}

		// Restore search settings from Session
		if ($gsSearchError == "")
			$this->LoadAdvancedSearch();

		// Render row for search
		$CCEDocuments->RowType = EW_ROWTYPE_SEARCH;
		$this->RenderRow();
	}

// Build advanced search
function BuildAdvancedSearch() {
	global $CCEDocuments;
	$sSrchUrl = "";
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->CCEModuleID); // CCEModuleID
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->DocumentCode); // DocumentCode
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->DocumentCategory); // DocumentCategory
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->DocumentName); // DocumentName
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->AppliesToDate); // AppliesToDate
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->PresenterName); // PresenterName
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->ReleaseDate); // ReleaseDate
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->ReleaseTime); // ReleaseTime
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->Students); // Students
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->Archived); // Archived
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->ArchiveYear); // ArchiveYear
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->DateCreated); // DateCreated
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->Description); // Description
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->KeyWords); // KeyWords
	$this->BuildSearchUrl($sSrchUrl, $CCEDocuments->DisplayInline); // DisplayInline
	return $sSrchUrl;
}

// Build search URL
function BuildSearchUrl(&$Url, &$Fld) {
	global $objForm;
	$sWrk = "";
	$FldParm = substr($Fld->FldVar, 2);
	$FldVal = $objForm->GetValue("x_$FldParm");
	$FldOpr = $objForm->GetValue("z_$FldParm");
	$FldCond = $objForm->GetValue("v_$FldParm");
	$FldVal2 = $objForm->GetValue("y_$FldParm");
	$FldOpr2 = $objForm->GetValue("w_$FldParm");
	$FldVal = ew_StripSlashes($FldVal);
	if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
	$FldVal2 = ew_StripSlashes($FldVal2);
	if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
	$FldOpr = strtoupper(trim($FldOpr));
	$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
	if ($FldOpr == "BETWEEN") {
		$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
			($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2));
		if ($FldVal <> "" && $FldVal2 <> "" && $IsValidValue) {
			$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
				"&y_" . $FldParm . "=" . urlencode($FldVal2) .
				"&z_" . $FldParm . "=" . urlencode($FldOpr);
		}
	} elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
		$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
			"&z_" . $FldParm . "=" . urlencode($FldOpr);
	} else {
		$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
			($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal));
		if ($FldVal <> "" && $IsValidValue && ew_IsValidOpr($FldOpr, $lFldDataType)) {

			//$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
			$sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) .
				"&z_" . $FldParm . "=" . urlencode($FldOpr);
		}
		$IsValidValue = ($lFldDataType <> EW_DATATYPE_NUMBER) ||
			($lFldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2));
		if ($FldVal2 <> "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $lFldDataType)) {

			//$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
			if ($sWrk <> "") $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
			$sWrk .= "&y_" . $FldParm . "=" . urlencode($FldVal2) .
				"&w_" . $FldParm . "=" . urlencode($FldOpr2);
		}
	}
	if ($sWrk <> "") {
		if ($Url <> "") $Url .= "&";
		$Url .= $sWrk;
	}
}

// Convert search value for date
function ConvertSearchValue(&$Fld, $FldVal) {
	$Value = $FldVal;
	if ($Fld->FldDataType == EW_DATATYPE_DATE && $FldVal <> "")
		$Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
	return $Value;
}

	//  Load search values for validation
	function LoadSearchValues() {
		global $objForm, $CCEDocuments;

		// Load search values
		// CCEModuleID

		$CCEDocuments->CCEModuleID->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_CCEModuleID"));
		$CCEDocuments->CCEModuleID->AdvancedSearch->SearchOperator = $objForm->GetValue("z_CCEModuleID");

		// DocumentCode
		$CCEDocuments->DocumentCode->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DocumentCode"));
		$CCEDocuments->DocumentCode->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DocumentCode");

		// DocumentCategory
		$CCEDocuments->DocumentCategory->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DocumentCategory"));
		$CCEDocuments->DocumentCategory->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DocumentCategory");

		// DocumentName
		$CCEDocuments->DocumentName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DocumentName"));
		$CCEDocuments->DocumentName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DocumentName");

		// AppliesToDate
		$CCEDocuments->AppliesToDate->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_AppliesToDate"));
		$CCEDocuments->AppliesToDate->AdvancedSearch->SearchOperator = $objForm->GetValue("z_AppliesToDate");

		// PresenterName
		$CCEDocuments->PresenterName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_PresenterName"));
		$CCEDocuments->PresenterName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_PresenterName");

		// ReleaseDate
		$CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_ReleaseDate"));
		$CCEDocuments->ReleaseDate->AdvancedSearch->SearchOperator = $objForm->GetValue("z_ReleaseDate");

		// ReleaseTime
		$CCEDocuments->ReleaseTime->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_ReleaseTime"));
		$CCEDocuments->ReleaseTime->AdvancedSearch->SearchOperator = $objForm->GetValue("z_ReleaseTime");

		// Students
		$CCEDocuments->Students->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Students"));
		$CCEDocuments->Students->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Students");

		// Archived
		$CCEDocuments->Archived->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Archived"));
		$CCEDocuments->Archived->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Archived");

		// ArchiveYear
		$CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_ArchiveYear"));
		$CCEDocuments->ArchiveYear->AdvancedSearch->SearchOperator = $objForm->GetValue("z_ArchiveYear");

		// DateCreated
		$CCEDocuments->DateCreated->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DateCreated"));
		$CCEDocuments->DateCreated->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DateCreated");

		// Description
		$CCEDocuments->Description->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Description"));
		$CCEDocuments->Description->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Description");

		// KeyWords
		$CCEDocuments->KeyWords->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_KeyWords"));
		$CCEDocuments->KeyWords->AdvancedSearch->SearchOperator = $objForm->GetValue("z_KeyWords");

		// DisplayInline
		$CCEDocuments->DisplayInline->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_DisplayInline"));
		$CCEDocuments->DisplayInline->AdvancedSearch->SearchOperator = $objForm->GetValue("z_DisplayInline");
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $CCEDocuments;

		// Initialize URLs
		// 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();

		// ReleaseDate
		$CCEDocuments->ReleaseDate->CellCssStyle = ""; $CCEDocuments->ReleaseDate->CellCssClass = "";
		$CCEDocuments->ReleaseDate->CellAttrs = array(); $CCEDocuments->ReleaseDate->ViewAttrs = array(); $CCEDocuments->ReleaseDate->EditAttrs = array();

		// ReleaseTime
		$CCEDocuments->ReleaseTime->CellCssStyle = ""; $CCEDocuments->ReleaseTime->CellCssClass = "";
		$CCEDocuments->ReleaseTime->CellAttrs = array(); $CCEDocuments->ReleaseTime->ViewAttrs = array(); $CCEDocuments->ReleaseTime->EditAttrs = array();

		// Students
		$CCEDocuments->Students->CellCssStyle = ""; $CCEDocuments->Students->CellCssClass = "";
		$CCEDocuments->Students->CellAttrs = array(); $CCEDocuments->Students->ViewAttrs = array(); $CCEDocuments->Students->EditAttrs = array();

		// Archived
		$CCEDocuments->Archived->CellCssStyle = ""; $CCEDocuments->Archived->CellCssClass = "";
		$CCEDocuments->Archived->CellAttrs = array(); $CCEDocuments->Archived->ViewAttrs = array(); $CCEDocuments->Archived->EditAttrs = array();

		// ArchiveYear
		$CCEDocuments->ArchiveYear->CellCssStyle = ""; $CCEDocuments->ArchiveYear->CellCssClass = "";
		$CCEDocuments->ArchiveYear->CellAttrs = array(); $CCEDocuments->ArchiveYear->ViewAttrs = array(); $CCEDocuments->ArchiveYear->EditAttrs = array();

		// DateCreated
		$CCEDocuments->DateCreated->CellCssStyle = ""; $CCEDocuments->DateCreated->CellCssClass = "";
		$CCEDocuments->DateCreated->CellAttrs = array(); $CCEDocuments->DateCreated->ViewAttrs = array(); $CCEDocuments->DateCreated->EditAttrs = array();

		// Description
		$CCEDocuments->Description->CellCssStyle = ""; $CCEDocuments->Description->CellCssClass = "";
		$CCEDocuments->Description->CellAttrs = array(); $CCEDocuments->Description->ViewAttrs = array(); $CCEDocuments->Description->EditAttrs = array();

		// KeyWords
		$CCEDocuments->KeyWords->CellCssStyle = ""; $CCEDocuments->KeyWords->CellCssClass = "";
		$CCEDocuments->KeyWords->CellAttrs = array(); $CCEDocuments->KeyWords->ViewAttrs = array(); $CCEDocuments->KeyWords->EditAttrs = array();

		// DisplayInline
		$CCEDocuments->DisplayInline->CellCssStyle = ""; $CCEDocuments->DisplayInline->CellCssClass = "";
		$CCEDocuments->DisplayInline->CellAttrs = array(); $CCEDocuments->DisplayInline->ViewAttrs = array(); $CCEDocuments->DisplayInline->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 = "";

			// Students
			if (strval($CCEDocuments->Students->CurrentValue) <> "") {
				$arwrk = explode(",", $CCEDocuments->Students->CurrentValue);
				$sFilterWrk = "";
				foreach ($arwrk as $wrk) {
					if ($sFilterWrk <> "") $sFilterWrk .= " OR ";
					$sFilterWrk .= "`CCEStudentID` = " . ew_AdjustSql(trim($wrk)) . "";
				}	
			$sSqlWrk = "SELECT `Surname`, `FirstName` FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0 AND CCEStudentID in (select CCEStudentID from CCEStudentCourses, CCESetup WHERE CCECourseScheduleID=CurrentScheduleID)" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `Surname`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEDocuments->Students->ViewValue = "";
					$ari = 0;
					while (!$rswrk->EOF) {
						$CCEDocuments->Students->ViewValue .= $rswrk->fields('Surname');
						$CCEDocuments->Students->ViewValue .= ew_ValueSeparator($ari) . $rswrk->fields('FirstName');
						$rswrk->MoveNext();
						if (!$rswrk->EOF) $CCEDocuments->Students->ViewValue .= ew_ViewOptionSeparator($ari); // Separate Options
						$ari++;
					}
					$rswrk->Close();
				} else {
					$CCEDocuments->Students->ViewValue = $CCEDocuments->Students->CurrentValue;
				}
			} else {
				$CCEDocuments->Students->ViewValue = NULL;
			}
			$CCEDocuments->Students->CssStyle = "";
			$CCEDocuments->Students->CssClass = "";
			$CCEDocuments->Students->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 = "";

			// ReleaseDate
			$CCEDocuments->ReleaseDate->HrefValue = "";
			$CCEDocuments->ReleaseDate->TooltipValue = "";

			// ReleaseTime
			$CCEDocuments->ReleaseTime->HrefValue = "";
			$CCEDocuments->ReleaseTime->TooltipValue = "";

			// Students
			$CCEDocuments->Students->HrefValue = "";
			$CCEDocuments->Students->TooltipValue = "";

			// Archived
			$CCEDocuments->Archived->HrefValue = "";
			$CCEDocuments->Archived->TooltipValue = "";

			// ArchiveYear
			$CCEDocuments->ArchiveYear->HrefValue = "";
			$CCEDocuments->ArchiveYear->TooltipValue = "";

			// DateCreated
			$CCEDocuments->DateCreated->HrefValue = "";
			$CCEDocuments->DateCreated->TooltipValue = "";

			// Description
			$CCEDocuments->Description->HrefValue = "";
			$CCEDocuments->Description->TooltipValue = "";

			// KeyWords
			$CCEDocuments->KeyWords->HrefValue = "";
			$CCEDocuments->KeyWords->TooltipValue = "";

			// DisplayInline
			$CCEDocuments->DisplayInline->HrefValue = "";
			$CCEDocuments->DisplayInline->TooltipValue = "";
		} 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 = "";
				$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;

			// ReleaseDate
			$CCEDocuments->ReleaseDate->EditCustomAttributes = "";
			$CCEDocuments->ReleaseDate->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue, 5), 5));

			// ReleaseTime
			$CCEDocuments->ReleaseTime->EditCustomAttributes = "";
			$CCEDocuments->ReleaseTime->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEDocuments->ReleaseTime->AdvancedSearch->SearchValue, 4));

			// Students
			$CCEDocuments->Students->EditCustomAttributes = "";
				$sFilterWrk = "";
			$sSqlWrk = "SELECT `CCEStudentID`, `Surname`, `FirstName`, '' AS SelectFilterFld FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0 AND CCEStudentID in (select CCEStudentID from CCEStudentCourses, CCESetup WHERE CCECourseScheduleID=CurrentScheduleID)" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `Surname`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			$CCEDocuments->Students->EditValue = $arwrk;

			// 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);

			// DateCreated
			$CCEDocuments->DateCreated->EditCustomAttributes = "";
			$CCEDocuments->DateCreated->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($CCEDocuments->DateCreated->AdvancedSearch->SearchValue, 5), 5));

			// Description
			$CCEDocuments->Description->EditCustomAttributes = "";
			$CCEDocuments->Description->EditValue = ew_HtmlEncode($CCEDocuments->Description->AdvancedSearch->SearchValue);

			// KeyWords
			$CCEDocuments->KeyWords->EditCustomAttributes = "";
			$CCEDocuments->KeyWords->EditValue = ew_HtmlEncode($CCEDocuments->KeyWords->AdvancedSearch->SearchValue);

			// DisplayInline
			$CCEDocuments->DisplayInline->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array("0", "No");
			$arwrk[] = array("1", "Yes");
			$CCEDocuments->DisplayInline->EditValue = $arwrk;
		}

		// 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_CheckDate($CCEDocuments->ReleaseDate->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $CCEDocuments->ReleaseDate->FldErrMsg();
		}
		if (!ew_CheckTime($CCEDocuments->ReleaseTime->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $CCEDocuments->ReleaseTime->FldErrMsg();
		}
		if (!ew_CheckInteger($CCEDocuments->ArchiveYear->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $CCEDocuments->ArchiveYear->FldErrMsg();
		}
		if (!ew_CheckDate($CCEDocuments->DateCreated->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $CCEDocuments->DateCreated->FldErrMsg();
		}

		// Return validate result
		$ValidateSearch = ($gsSearchError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $sFormCustomError;
		}
		return $ValidateSearch;
	}

	// Load advanced search
	function LoadAdvancedSearch() {
		global $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");
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>