Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/ccmadmin/
Upload File :
Current File : /var/www/cesa.co.za/ccmadmin/cstCandMilestonessrch.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 "cstCandMilestonesinfo.php" ?>
<?php include "CCMUsersinfo.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
$cstCandMilestones_search = new ccstCandMilestones_search();
$Page =& $cstCandMilestones_search;

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

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

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

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

// extend page with validate function for search
cstCandMilestones_search.ValidateSearch = function(fobj) {
	ew_PostAutoSuggest(fobj);
	if (this.ValidateRequired) {
		var infix = "";
		elm = fobj.elements["x" + infix + "_MilestoneNum"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($cstCandMilestones->MilestoneNum->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_Max28CCMMilestones2EDateUpdated29"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_CCMMilestonePaid"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($cstCandMilestones->CCMMilestonePaid->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
cstCandMilestones_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) { ?>
cstCandMilestones_search.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
cstCandMilestones_search.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</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("TblTypeCUSTOMVIEW") ?><?php echo $cstCandMilestones->TableCaption() ?><br><br>
<a href="<?php echo $cstCandMilestones->getReturnUrl() ?>"><?php echo $Language->Phrase("BackToList") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$cstCandMilestones_search->ShowMessage();
?>
<form name="fcstCandMilestonessearch" id="fcstCandMilestonessearch" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return cstCandMilestones_search.ValidateSearch(this);">
<p>
<input type="hidden" name="t" id="t" value="cstCandMilestones">
<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 $cstCandMilestones->FirstName->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->FirstName->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->FirstName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_FirstName" id="z_FirstName" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->FirstName->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_FirstName" id="x_FirstName" title="<?php echo $cstCandMilestones->FirstName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->FirstName->EditValue ?>"<?php echo $cstCandMilestones->FirstName->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->Surname->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->Surname->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->Surname->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Surname" id="z_Surname" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->Surname->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Surname" id="x_Surname" title="<?php echo $cstCandMilestones->Surname->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->Surname->EditValue ?>"<?php echo $cstCandMilestones->Surname->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->MentorFirstName->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->MentorFirstName->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->MentorFirstName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_MentorFirstName" id="z_MentorFirstName" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->MentorFirstName->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_MentorFirstName" id="x_MentorFirstName" title="<?php echo $cstCandMilestones->MentorFirstName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->MentorFirstName->EditValue ?>"<?php echo $cstCandMilestones->MentorFirstName->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->MentorSurname->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->MentorSurname->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->MentorSurname->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_MentorSurname" id="z_MentorSurname" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->MentorSurname->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_MentorSurname" id="x_MentorSurname" title="<?php echo $cstCandMilestones->MentorSurname->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->MentorSurname->EditValue ?>"<?php echo $cstCandMilestones->MentorSurname->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->EmployerFirstName->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->EmployerFirstName->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->EmployerFirstName->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_EmployerFirstName" id="z_EmployerFirstName" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->EmployerFirstName->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_EmployerFirstName" id="x_EmployerFirstName" title="<?php echo $cstCandMilestones->EmployerFirstName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->EmployerFirstName->EditValue ?>"<?php echo $cstCandMilestones->EmployerFirstName->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->EmployerSurname->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->EmployerSurname->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->EmployerSurname->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_EmployerSurname" id="z_EmployerSurname" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->EmployerSurname->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_EmployerSurname" id="x_EmployerSurname" title="<?php echo $cstCandMilestones->EmployerSurname->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->EmployerSurname->EditValue ?>"<?php echo $cstCandMilestones->EmployerSurname->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->Organisation->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->Organisation->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->Organisation->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Organisation" id="z_Organisation" value="LIKE"></span></td>
		<td<?php echo $cstCandMilestones->Organisation->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Organisation" id="x_Organisation" title="<?php echo $cstCandMilestones->Organisation->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $cstCandMilestones->Organisation->EditValue ?>"<?php echo $cstCandMilestones->Organisation->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->MilestoneNum->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->MilestoneNum->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->MilestoneNum->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_MilestoneNum" id="z_MilestoneNum" value="="></span></td>
		<td<?php echo $cstCandMilestones->MilestoneNum->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_MilestoneNum" id="x_MilestoneNum" title="<?php echo $cstCandMilestones->MilestoneNum->FldTitle() ?>" size="30" value="<?php echo $cstCandMilestones->MilestoneNum->EditValue ?>"<?php echo $cstCandMilestones->MilestoneNum->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("BETWEEN") ?><input type="hidden" name="z_Max28CCMMilestones2EDateUpdated29" id="z_Max28CCMMilestones2EDateUpdated29" value="BETWEEN"></span></td>
		<td<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Max28CCMMilestones2EDateUpdated29" id="x_Max28CCMMilestones2EDateUpdated29" title="<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldTitle() ?>" value="<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditValue ?>"<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditAttributes() ?>>
</span>
				<span class="ewSearchOpr" id="btw1_Max28CCMMilestones2EDateUpdated29" name="btw1_Max28CCMMilestones2EDateUpdated29">&nbsp;<?php echo $Language->Phrase("AND") ?>&nbsp;</span>
				<span class="phpmaker" style="float: left;" id="btw1_Max28CCMMilestones2EDateUpdated29" name="btw1_Max28CCMMilestones2EDateUpdated29">
<input type="text" name="y_Max28CCMMilestones2EDateUpdated29" id="y_Max28CCMMilestones2EDateUpdated29" title="<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldTitle() ?>" value="<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditValue2 ?>"<?php echo $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr<?php echo $cstCandMilestones->CCMMilestonePaid->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $cstCandMilestones->CCMMilestonePaid->FldCaption() ?></td>
		<td<?php echo $cstCandMilestones->CCMMilestonePaid->CellAttributes() ?>><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_CCMMilestonePaid" id="z_CCMMilestonePaid" value="="></span></td>
		<td<?php echo $cstCandMilestones->CCMMilestonePaid->CellAttributes() ?>>
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_CCMMilestonePaid" id="x_CCMMilestonePaid" title="<?php echo $cstCandMilestones->CCMMilestonePaid->FldTitle() ?>" size="30" value="<?php echo $cstCandMilestones->CCMMilestonePaid->EditValue ?>"<?php echo $cstCandMilestones->CCMMilestonePaid->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("Search")) ?>">
<input type="button" name="Reset" id="Reset" value="<?php echo ew_BtnCaption($Language->Phrase("Reset")) ?>" onclick="ew_ClearForm(this.form);">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class ccstCandMilestones_search {

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

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

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

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $cstCandMilestones;
		if ($cstCandMilestones->UseTokenInUrl) $PageUrl .= "t=" . $cstCandMilestones->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, $cstCandMilestones;
		if ($cstCandMilestones->UseTokenInUrl) {
			if ($objForm)
				return ($cstCandMilestones->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($cstCandMilestones->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function ccstCandMilestones_search() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (cstCandMilestones)
		$GLOBALS["cstCandMilestones"] = new ccstCandMilestones();

		// Table object (CCMUsers)
		$GLOBALS['CCMUsers'] = new cCCMUsers();

		// 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", 'cstCandMilestones', 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 $cstCandMilestones;

		// 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("cstCandMilestoneslist.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, $cstCandMilestones;
		if ($this->IsPageRequest()) { // Validate request

			// Get action
			$cstCandMilestones->CurrentAction = $objForm->GetValue("a_search");
			switch ($cstCandMilestones->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 = $cstCandMilestones->UrlParm($sSrchStr);
						$this->Page_Terminate("cstCandMilestoneslist.php" . "?" . $sSrchStr); // Go to list page
					}
			}
		}

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

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

// Build advanced search
function BuildAdvancedSearch() {
	global $cstCandMilestones;
	$sSrchUrl = "";
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->FirstName); // FirstName
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->Surname); // Surname
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->MentorFirstName); // MentorFirstName
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->MentorSurname); // MentorSurname
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->EmployerFirstName); // EmployerFirstName
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->EmployerSurname); // EmployerSurname
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->Organisation); // Organisation
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->MilestoneNum); // MilestoneNum
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->Max28CCMMilestones2EDateUpdated29); // Max(CCMMilestones.DateUpdated)
	$this->BuildSearchUrl($sSrchUrl, $cstCandMilestones->CCMMilestonePaid); // CCMMilestonePaid
	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, $cstCandMilestones;

		// Load search values
		// FirstName

		$cstCandMilestones->FirstName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_FirstName"));
		$cstCandMilestones->FirstName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_FirstName");

		// Surname
		$cstCandMilestones->Surname->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Surname"));
		$cstCandMilestones->Surname->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Surname");

		// MentorFirstName
		$cstCandMilestones->MentorFirstName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_MentorFirstName"));
		$cstCandMilestones->MentorFirstName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_MentorFirstName");

		// MentorSurname
		$cstCandMilestones->MentorSurname->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_MentorSurname"));
		$cstCandMilestones->MentorSurname->AdvancedSearch->SearchOperator = $objForm->GetValue("z_MentorSurname");

		// EmployerFirstName
		$cstCandMilestones->EmployerFirstName->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_EmployerFirstName"));
		$cstCandMilestones->EmployerFirstName->AdvancedSearch->SearchOperator = $objForm->GetValue("z_EmployerFirstName");

		// EmployerSurname
		$cstCandMilestones->EmployerSurname->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_EmployerSurname"));
		$cstCandMilestones->EmployerSurname->AdvancedSearch->SearchOperator = $objForm->GetValue("z_EmployerSurname");

		// Organisation
		$cstCandMilestones->Organisation->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Organisation"));
		$cstCandMilestones->Organisation->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Organisation");

		// MilestoneNum
		$cstCandMilestones->MilestoneNum->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_MilestoneNum"));
		$cstCandMilestones->MilestoneNum->AdvancedSearch->SearchOperator = $objForm->GetValue("z_MilestoneNum");

		// Max(CCMMilestones.DateUpdated)
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_Max28CCMMilestones2EDateUpdated29"));
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchOperator = $objForm->GetValue("z_Max28CCMMilestones2EDateUpdated29");
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchCondition = $objForm->GetValue("v_Max28CCMMilestones2EDateUpdated29");
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue2 = ew_StripSlashes($objForm->GetValue("y_Max28CCMMilestones2EDateUpdated29"));
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchOperator2 = $objForm->GetValue("w_Max28CCMMilestones2EDateUpdated29");

		// CCMMilestonePaid
		$cstCandMilestones->CCMMilestonePaid->AdvancedSearch->SearchValue = ew_StripSlashes($objForm->GetValue("x_CCMMilestonePaid"));
		$cstCandMilestones->CCMMilestonePaid->AdvancedSearch->SearchOperator = $objForm->GetValue("z_CCMMilestonePaid");
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$cstCandMilestones->Row_Rendering();

		// Common render codes for all row types
		// FirstName

		$cstCandMilestones->FirstName->CellCssStyle = ""; $cstCandMilestones->FirstName->CellCssClass = "";
		$cstCandMilestones->FirstName->CellAttrs = array(); $cstCandMilestones->FirstName->ViewAttrs = array(); $cstCandMilestones->FirstName->EditAttrs = array();

		// Surname
		$cstCandMilestones->Surname->CellCssStyle = ""; $cstCandMilestones->Surname->CellCssClass = "";
		$cstCandMilestones->Surname->CellAttrs = array(); $cstCandMilestones->Surname->ViewAttrs = array(); $cstCandMilestones->Surname->EditAttrs = array();

		// MentorFirstName
		$cstCandMilestones->MentorFirstName->CellCssStyle = ""; $cstCandMilestones->MentorFirstName->CellCssClass = "";
		$cstCandMilestones->MentorFirstName->CellAttrs = array(); $cstCandMilestones->MentorFirstName->ViewAttrs = array(); $cstCandMilestones->MentorFirstName->EditAttrs = array();

		// MentorSurname
		$cstCandMilestones->MentorSurname->CellCssStyle = ""; $cstCandMilestones->MentorSurname->CellCssClass = "";
		$cstCandMilestones->MentorSurname->CellAttrs = array(); $cstCandMilestones->MentorSurname->ViewAttrs = array(); $cstCandMilestones->MentorSurname->EditAttrs = array();

		// EmployerFirstName
		$cstCandMilestones->EmployerFirstName->CellCssStyle = ""; $cstCandMilestones->EmployerFirstName->CellCssClass = "";
		$cstCandMilestones->EmployerFirstName->CellAttrs = array(); $cstCandMilestones->EmployerFirstName->ViewAttrs = array(); $cstCandMilestones->EmployerFirstName->EditAttrs = array();

		// EmployerSurname
		$cstCandMilestones->EmployerSurname->CellCssStyle = ""; $cstCandMilestones->EmployerSurname->CellCssClass = "";
		$cstCandMilestones->EmployerSurname->CellAttrs = array(); $cstCandMilestones->EmployerSurname->ViewAttrs = array(); $cstCandMilestones->EmployerSurname->EditAttrs = array();

		// Organisation
		$cstCandMilestones->Organisation->CellCssStyle = ""; $cstCandMilestones->Organisation->CellCssClass = "";
		$cstCandMilestones->Organisation->CellAttrs = array(); $cstCandMilestones->Organisation->ViewAttrs = array(); $cstCandMilestones->Organisation->EditAttrs = array();

		// MilestoneNum
		$cstCandMilestones->MilestoneNum->CellCssStyle = ""; $cstCandMilestones->MilestoneNum->CellCssClass = "";
		$cstCandMilestones->MilestoneNum->CellAttrs = array(); $cstCandMilestones->MilestoneNum->ViewAttrs = array(); $cstCandMilestones->MilestoneNum->EditAttrs = array();

		// Max(CCMMilestones.DateUpdated)
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CellCssStyle = ""; $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CellCssClass = "";
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CellAttrs = array(); $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->ViewAttrs = array(); $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditAttrs = array();

		// CCMMilestonePaid
		$cstCandMilestones->CCMMilestonePaid->CellCssStyle = ""; $cstCandMilestones->CCMMilestonePaid->CellCssClass = "";
		$cstCandMilestones->CCMMilestonePaid->CellAttrs = array(); $cstCandMilestones->CCMMilestonePaid->ViewAttrs = array(); $cstCandMilestones->CCMMilestonePaid->EditAttrs = array();
		if ($cstCandMilestones->RowType == EW_ROWTYPE_VIEW) { // View row

			// FirstName
			$cstCandMilestones->FirstName->ViewValue = $cstCandMilestones->FirstName->CurrentValue;
			$cstCandMilestones->FirstName->CssStyle = "";
			$cstCandMilestones->FirstName->CssClass = "";
			$cstCandMilestones->FirstName->ViewCustomAttributes = "";

			// Surname
			$cstCandMilestones->Surname->ViewValue = $cstCandMilestones->Surname->CurrentValue;
			$cstCandMilestones->Surname->CssStyle = "";
			$cstCandMilestones->Surname->CssClass = "";
			$cstCandMilestones->Surname->ViewCustomAttributes = "";

			// MentorFirstName
			$cstCandMilestones->MentorFirstName->ViewValue = $cstCandMilestones->MentorFirstName->CurrentValue;
			$cstCandMilestones->MentorFirstName->CssStyle = "";
			$cstCandMilestones->MentorFirstName->CssClass = "";
			$cstCandMilestones->MentorFirstName->ViewCustomAttributes = "";

			// MentorSurname
			$cstCandMilestones->MentorSurname->ViewValue = $cstCandMilestones->MentorSurname->CurrentValue;
			$cstCandMilestones->MentorSurname->CssStyle = "";
			$cstCandMilestones->MentorSurname->CssClass = "";
			$cstCandMilestones->MentorSurname->ViewCustomAttributes = "";

			// EmployerFirstName
			$cstCandMilestones->EmployerFirstName->ViewValue = $cstCandMilestones->EmployerFirstName->CurrentValue;
			$cstCandMilestones->EmployerFirstName->CssStyle = "";
			$cstCandMilestones->EmployerFirstName->CssClass = "";
			$cstCandMilestones->EmployerFirstName->ViewCustomAttributes = "";

			// EmployerSurname
			$cstCandMilestones->EmployerSurname->ViewValue = $cstCandMilestones->EmployerSurname->CurrentValue;
			$cstCandMilestones->EmployerSurname->CssStyle = "";
			$cstCandMilestones->EmployerSurname->CssClass = "";
			$cstCandMilestones->EmployerSurname->ViewCustomAttributes = "";

			// Organisation
			$cstCandMilestones->Organisation->ViewValue = $cstCandMilestones->Organisation->CurrentValue;
			$cstCandMilestones->Organisation->CssStyle = "";
			$cstCandMilestones->Organisation->CssClass = "";
			$cstCandMilestones->Organisation->ViewCustomAttributes = "";

			// MilestoneNum
			$cstCandMilestones->MilestoneNum->ViewValue = $cstCandMilestones->MilestoneNum->CurrentValue;
			$cstCandMilestones->MilestoneNum->CssStyle = "";
			$cstCandMilestones->MilestoneNum->CssClass = "";
			$cstCandMilestones->MilestoneNum->ViewCustomAttributes = "";

			// Max(CCMMilestones.DateUpdated)
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->ViewValue = $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CurrentValue;
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->ViewValue = ew_FormatDateTime($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->ViewValue, 5);
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CssStyle = "";
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->CssClass = "";
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->ViewCustomAttributes = "";

			// CCMMilestonePaid
			$cstCandMilestones->CCMMilestonePaid->ViewValue = $cstCandMilestones->CCMMilestonePaid->CurrentValue;
			$cstCandMilestones->CCMMilestonePaid->CssStyle = "";
			$cstCandMilestones->CCMMilestonePaid->CssClass = "";
			$cstCandMilestones->CCMMilestonePaid->ViewCustomAttributes = "";

			// FirstName
			$cstCandMilestones->FirstName->HrefValue = "";
			$cstCandMilestones->FirstName->TooltipValue = "";

			// Surname
			$cstCandMilestones->Surname->HrefValue = "";
			$cstCandMilestones->Surname->TooltipValue = "";

			// MentorFirstName
			$cstCandMilestones->MentorFirstName->HrefValue = "";
			$cstCandMilestones->MentorFirstName->TooltipValue = "";

			// MentorSurname
			$cstCandMilestones->MentorSurname->HrefValue = "";
			$cstCandMilestones->MentorSurname->TooltipValue = "";

			// EmployerFirstName
			$cstCandMilestones->EmployerFirstName->HrefValue = "";
			$cstCandMilestones->EmployerFirstName->TooltipValue = "";

			// EmployerSurname
			$cstCandMilestones->EmployerSurname->HrefValue = "";
			$cstCandMilestones->EmployerSurname->TooltipValue = "";

			// Organisation
			$cstCandMilestones->Organisation->HrefValue = "";
			$cstCandMilestones->Organisation->TooltipValue = "";

			// MilestoneNum
			$cstCandMilestones->MilestoneNum->HrefValue = "";
			$cstCandMilestones->MilestoneNum->TooltipValue = "";

			// Max(CCMMilestones.DateUpdated)
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->HrefValue = "";
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->TooltipValue = "";

			// CCMMilestonePaid
			$cstCandMilestones->CCMMilestonePaid->HrefValue = "";
			$cstCandMilestones->CCMMilestonePaid->TooltipValue = "";
		} elseif ($cstCandMilestones->RowType == EW_ROWTYPE_SEARCH) { // Search row

			// FirstName
			$cstCandMilestones->FirstName->EditCustomAttributes = "";
			$cstCandMilestones->FirstName->EditValue = ew_HtmlEncode($cstCandMilestones->FirstName->AdvancedSearch->SearchValue);

			// Surname
			$cstCandMilestones->Surname->EditCustomAttributes = "";
			$cstCandMilestones->Surname->EditValue = ew_HtmlEncode($cstCandMilestones->Surname->AdvancedSearch->SearchValue);

			// MentorFirstName
			$cstCandMilestones->MentorFirstName->EditCustomAttributes = "";
			$cstCandMilestones->MentorFirstName->EditValue = ew_HtmlEncode($cstCandMilestones->MentorFirstName->AdvancedSearch->SearchValue);

			// MentorSurname
			$cstCandMilestones->MentorSurname->EditCustomAttributes = "";
			$cstCandMilestones->MentorSurname->EditValue = ew_HtmlEncode($cstCandMilestones->MentorSurname->AdvancedSearch->SearchValue);

			// EmployerFirstName
			$cstCandMilestones->EmployerFirstName->EditCustomAttributes = "";
			$cstCandMilestones->EmployerFirstName->EditValue = ew_HtmlEncode($cstCandMilestones->EmployerFirstName->AdvancedSearch->SearchValue);

			// EmployerSurname
			$cstCandMilestones->EmployerSurname->EditCustomAttributes = "";
			$cstCandMilestones->EmployerSurname->EditValue = ew_HtmlEncode($cstCandMilestones->EmployerSurname->AdvancedSearch->SearchValue);

			// Organisation
			$cstCandMilestones->Organisation->EditCustomAttributes = "";
			$cstCandMilestones->Organisation->EditValue = ew_HtmlEncode($cstCandMilestones->Organisation->AdvancedSearch->SearchValue);

			// MilestoneNum
			$cstCandMilestones->MilestoneNum->EditCustomAttributes = "";
			$cstCandMilestones->MilestoneNum->EditValue = ew_HtmlEncode($cstCandMilestones->MilestoneNum->AdvancedSearch->SearchValue);

			// Max(CCMMilestones.DateUpdated)
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditCustomAttributes = "";
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditValue = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue, 5), 5));
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditCustomAttributes = "";
			$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->EditValue2 = ew_HtmlEncode(ew_FormatDateTime(ew_UnFormatDateTime($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue2, 5), 5));

			// CCMMilestonePaid
			$cstCandMilestones->CCMMilestonePaid->EditCustomAttributes = "";
			$cstCandMilestones->CCMMilestonePaid->EditValue = ew_HtmlEncode($cstCandMilestones->CCMMilestonePaid->AdvancedSearch->SearchValue);
		}

		// Call Row Rendered event
		if ($cstCandMilestones->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$cstCandMilestones->Row_Rendered();
	}

	// Validate search
	function ValidateSearch() {
		global $gsSearchError, $cstCandMilestones;

		// Initialize
		$gsSearchError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return TRUE;
		if (!ew_CheckInteger($cstCandMilestones->MilestoneNum->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $cstCandMilestones->MilestoneNum->FldErrMsg();
		}
		if (!ew_CheckDate($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldErrMsg();
		}
		if (!ew_CheckDate($cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue2)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $cstCandMilestones->Max28CCMMilestones2EDateUpdated29->FldErrMsg();
		}
		if (!ew_CheckInteger($cstCandMilestones->CCMMilestonePaid->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $cstCandMilestones->CCMMilestonePaid->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 $cstCandMilestones;
		$cstCandMilestones->FirstName->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_FirstName");
		$cstCandMilestones->Surname->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_Surname");
		$cstCandMilestones->MentorFirstName->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_MentorFirstName");
		$cstCandMilestones->MentorSurname->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_MentorSurname");
		$cstCandMilestones->EmployerFirstName->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_EmployerFirstName");
		$cstCandMilestones->EmployerSurname->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_EmployerSurname");
		$cstCandMilestones->Organisation->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_Organisation");
		$cstCandMilestones->MilestoneNum->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_MilestoneNum");
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_Max28CCMMilestones2EDateUpdated29");
		$cstCandMilestones->Max28CCMMilestones2EDateUpdated29->AdvancedSearch->SearchValue2 = $cstCandMilestones->getAdvancedSearch("y_Max28CCMMilestones2EDateUpdated29");
		$cstCandMilestones->CCMMilestonePaid->AdvancedSearch->SearchValue = $cstCandMilestones->getAdvancedSearch("x_CCMMilestonePaid");
	}

	// 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;
	}
}
?>