Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEExamsedit.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 "CCEExamsinfo.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
$CCEExams_edit = new cCCEExams_edit();
$Page =& $CCEExams_edit;

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

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

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

// page properties
CCEExams_edit.PageID = "edit"; // page ID
CCEExams_edit.FormID = "fCCEExamsedit"; // form ID
var EW_PAGE_ID = CCEExams_edit.PageID; // for backward compatibility

// extend page with ValidateForm function
CCEExams_edit.ValidateForm = function(fobj) {
	ew_PostAutoSuggest(fobj);
	if (!this.ValidateRequired)
		return true; // ignore validation
	if (fobj.a_confirm && fobj.a_confirm.value == "F")
		return true;
	var i, elm, aelm, infix;
	var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
	for (i=0; i<rowcnt; i++) {
		infix = (fobj.key_count) ? String(i+1) : "";

		// Call Form Custom Validate event
		if (!this.Form_CustomValidate(fobj)) return false;
	}
	return true;
}

// extend page with Form_CustomValidate function
CCEExams_edit.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) { ?>
CCEExams_edit.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEExams_edit.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("Edit") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEExams->TableCaption() ?><br><br>
<a href="<?php echo $CCEExams->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEExams_edit->ShowMessage();
?>
<form name="fCCEExamsedit" id="fCCEExamsedit" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEExams_edit.ValidateForm(this);">
<p>
<input type="hidden" name="a_table" id="a_table" value="CCEExams">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEExams->Questionnaire_ID->Visible) { // Questionnaire_ID ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->Questionnaire_ID->FldCaption() ?></td>
		<td<?php echo $CCEExams->Questionnaire_ID->CellAttributes() ?>><span id="el_Questionnaire_ID">
<div<?php echo $CCEExams->Questionnaire_ID->ViewAttributes() ?>><?php echo $CCEExams->Questionnaire_ID->EditValue ?></div><input type="hidden" name="x_Questionnaire_ID" id="x_Questionnaire_ID" value="<?php echo ew_HtmlEncode($CCEExams->Questionnaire_ID->CurrentValue) ?>">
</span><?php echo $CCEExams->Questionnaire_ID->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEExams->Questionnaire_Name->Visible) { // Questionnaire_Name ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->Questionnaire_Name->FldCaption() ?></td>
		<td<?php echo $CCEExams->Questionnaire_Name->CellAttributes() ?>><span id="el_Questionnaire_Name">
<input type="text" name="x_Questionnaire_Name" id="x_Questionnaire_Name" title="<?php echo $CCEExams->Questionnaire_Name->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEExams->Questionnaire_Name->EditValue ?>"<?php echo $CCEExams->Questionnaire_Name->EditAttributes() ?>>
</span><?php echo $CCEExams->Questionnaire_Name->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEExams->StartDate->Visible) { // StartDate ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->StartDate->FldCaption() ?></td>
		<td<?php echo $CCEExams->StartDate->CellAttributes() ?>><span id="el_StartDate">
<input type="text" name="x_StartDate" id="x_StartDate" title="<?php echo $CCEExams->StartDate->FldTitle() ?>" value="<?php echo $CCEExams->StartDate->EditValue ?>"<?php echo $CCEExams->StartDate->EditAttributes() ?>>
</span><?php echo $CCEExams->StartDate->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEExams->CloseDate->Visible) { // CloseDate ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->CloseDate->FldCaption() ?></td>
		<td<?php echo $CCEExams->CloseDate->CellAttributes() ?>><span id="el_CloseDate">
<input type="text" name="x_CloseDate" id="x_CloseDate" title="<?php echo $CCEExams->CloseDate->FldTitle() ?>" value="<?php echo $CCEExams->CloseDate->EditValue ?>"<?php echo $CCEExams->CloseDate->EditAttributes() ?>>
</span><?php echo $CCEExams->CloseDate->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEExams->Introduction->Visible) { // Introduction ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->Introduction->FldCaption() ?></td>
		<td<?php echo $CCEExams->Introduction->CellAttributes() ?>><span id="el_Introduction">
<textarea name="x_Introduction" id="x_Introduction" title="<?php echo $CCEExams->Introduction->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEExams->Introduction->EditAttributes() ?>><?php echo $CCEExams->Introduction->EditValue ?></textarea>
</span><?php echo $CCEExams->Introduction->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEExams->MarkerUser->Visible) { // MarkerUser ?>
	<tr<?php echo $CCEExams->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEExams->MarkerUser->FldCaption() ?></td>
		<td<?php echo $CCEExams->MarkerUser->CellAttributes() ?>><span id="el_MarkerUser">
<input type="text" name="x_MarkerUser" id="x_MarkerUser" title="<?php echo $CCEExams->MarkerUser->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEExams->MarkerUser->EditValue ?>"<?php echo $CCEExams->MarkerUser->EditAttributes() ?>>
</span><?php echo $CCEExams->MarkerUser->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("EditBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class cCCEExams_edit {

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

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

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

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

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

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

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

		// Table object (CCEExams)
		$GLOBALS["CCEExams"] = new cCCEExams();

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

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

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'CCEExams', 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 $CCEExams;

		// 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->CanEdit()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCEExamslist.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();
	}
	var $sDbMasterFilter;
	var $sDbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError, $CCEExams;

		// Load key from QueryString
		if (@$_GET["Questionnaire_ID"] <> "")
			$CCEExams->Questionnaire_ID->setQueryStringValue($_GET["Questionnaire_ID"]);
		if (@$_POST["a_edit"] <> "") {
			$CCEExams->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->LoadFormValues(); // Get form values

			// Validate form
			if (!$this->ValidateForm()) {
				$CCEExams->CurrentAction = ""; // Form error, reset action
				$this->setMessage($gsFormError);
				$CCEExams->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		} else {
			$CCEExams->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($CCEExams->Questionnaire_ID->CurrentValue == "")
			$this->Page_Terminate("CCEExamslist.php"); // Invalid key, return to list
		switch ($CCEExams->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					$this->setMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("CCEExamslist.php"); // No matching record, return to list
				}
				break;
			Case "U": // Update
				$CCEExams->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					$this->setMessage($Language->Phrase("UpdateSuccess")); // Update success
					$sReturnUrl = $CCEExams->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "CCEExamsview.php")
						$sReturnUrl = $CCEExams->ViewUrl(); // View paging, return to View page directly
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$CCEExams->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed
				}
		}

		// Render the record
		$CCEExams->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm, $CCEExams;

		// Get upload data
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $CCEExams;
		$CCEExams->Questionnaire_ID->setFormValue($objForm->GetValue("x_Questionnaire_ID"));
		$CCEExams->Questionnaire_Name->setFormValue($objForm->GetValue("x_Questionnaire_Name"));
		$CCEExams->StartDate->setFormValue($objForm->GetValue("x_StartDate"));
		$CCEExams->StartDate->CurrentValue = ew_UnFormatDateTime($CCEExams->StartDate->CurrentValue, 11);
		$CCEExams->CloseDate->setFormValue($objForm->GetValue("x_CloseDate"));
		$CCEExams->CloseDate->CurrentValue = ew_UnFormatDateTime($CCEExams->CloseDate->CurrentValue, 11);
		$CCEExams->Introduction->setFormValue($objForm->GetValue("x_Introduction"));
		$CCEExams->MarkerUser->setFormValue($objForm->GetValue("x_MarkerUser"));
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm, $CCEExams;
		$this->LoadRow();
		$CCEExams->Questionnaire_ID->CurrentValue = $CCEExams->Questionnaire_ID->FormValue;
		$CCEExams->Questionnaire_Name->CurrentValue = $CCEExams->Questionnaire_Name->FormValue;
		$CCEExams->StartDate->CurrentValue = $CCEExams->StartDate->FormValue;
		$CCEExams->StartDate->CurrentValue = ew_UnFormatDateTime($CCEExams->StartDate->CurrentValue, 11);
		$CCEExams->CloseDate->CurrentValue = $CCEExams->CloseDate->FormValue;
		$CCEExams->CloseDate->CurrentValue = ew_UnFormatDateTime($CCEExams->CloseDate->CurrentValue, 11);
		$CCEExams->Introduction->CurrentValue = $CCEExams->Introduction->FormValue;
		$CCEExams->MarkerUser->CurrentValue = $CCEExams->MarkerUser->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $CCEExams;
		$sFilter = $CCEExams->KeyFilter();

		// Call Row Selecting event
		$CCEExams->Row_Selecting($sFilter);

		// Load SQL based on filter
		$CCEExams->CurrentFilter = $sFilter;
		$sSql = $CCEExams->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$CCEExams->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCEExams;
		$CCEExams->Questionnaire_ID->setDbValue($rs->fields('Questionnaire_ID'));
		$CCEExams->Questionnaire_Name->setDbValue($rs->fields('Questionnaire_Name'));
		$CCEExams->Score->setDbValue($rs->fields('Score'));
		$CCEExams->PassPerc->setDbValue($rs->fields('PassPerc'));
		$CCEExams->GoodResultText->setDbValue($rs->fields('GoodResultText'));
		$CCEExams->BadResultText->setDbValue($rs->fields('BadResultText'));
		$CCEExams->HasScore->setDbValue($rs->fields('HasScore'));
		$CCEExams->TopicID->setDbValue($rs->fields('TopicID'));
		$CCEExams->CanDistrib->setDbValue($rs->fields('CanDistrib'));
		$CCEExams->DistribAccessCode->setDbValue($rs->fields('DistribAccessCode'));
		$CCEExams->Anonymous->setDbValue($rs->fields('Anonymous'));
		$CCEExams->ShowSubscribeOption->setDbValue($rs->fields('ShowSubscribeOption'));
		$CCEExams->StartDate->setDbValue($rs->fields('StartDate'));
		$CCEExams->CloseDate->setDbValue($rs->fields('CloseDate'));
		$CCEExams->Introduction->setDbValue($rs->fields('Introduction'));
		$CCEExams->DateCreated->setDbValue($rs->fields('DateCreated'));
		$CCEExams->Website->setDbValue($rs->fields('Website'));
		$CCEExams->ServiceProviderID->setDbValue($rs->fields('ServiceProviderID'));
		$CCEExams->ServiceProviderID2->setDbValue($rs->fields('ServiceProviderID2'));
		$CCEExams->ServiceProviderID3->setDbValue($rs->fields('ServiceProviderID3'));
		$CCEExams->ServiceProviderID4->setDbValue($rs->fields('ServiceProviderID4'));
		$CCEExams->QuestionnaireType->setDbValue($rs->fields('QuestionnaireType'));
		$CCEExams->MarkerUser->setDbValue($rs->fields('MarkerUser'));
		$CCEExams->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$CCEExams->Row_Rendering();

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

		$CCEExams->Questionnaire_ID->CellCssStyle = ""; $CCEExams->Questionnaire_ID->CellCssClass = "";
		$CCEExams->Questionnaire_ID->CellAttrs = array(); $CCEExams->Questionnaire_ID->ViewAttrs = array(); $CCEExams->Questionnaire_ID->EditAttrs = array();

		// Questionnaire_Name
		$CCEExams->Questionnaire_Name->CellCssStyle = ""; $CCEExams->Questionnaire_Name->CellCssClass = "";
		$CCEExams->Questionnaire_Name->CellAttrs = array(); $CCEExams->Questionnaire_Name->ViewAttrs = array(); $CCEExams->Questionnaire_Name->EditAttrs = array();

		// StartDate
		$CCEExams->StartDate->CellCssStyle = ""; $CCEExams->StartDate->CellCssClass = "";
		$CCEExams->StartDate->CellAttrs = array(); $CCEExams->StartDate->ViewAttrs = array(); $CCEExams->StartDate->EditAttrs = array();

		// CloseDate
		$CCEExams->CloseDate->CellCssStyle = ""; $CCEExams->CloseDate->CellCssClass = "";
		$CCEExams->CloseDate->CellAttrs = array(); $CCEExams->CloseDate->ViewAttrs = array(); $CCEExams->CloseDate->EditAttrs = array();

		// Introduction
		$CCEExams->Introduction->CellCssStyle = ""; $CCEExams->Introduction->CellCssClass = "";
		$CCEExams->Introduction->CellAttrs = array(); $CCEExams->Introduction->ViewAttrs = array(); $CCEExams->Introduction->EditAttrs = array();

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

			// Questionnaire_ID
			$CCEExams->Questionnaire_ID->ViewValue = $CCEExams->Questionnaire_ID->CurrentValue;
			$CCEExams->Questionnaire_ID->CssStyle = "";
			$CCEExams->Questionnaire_ID->CssClass = "";
			$CCEExams->Questionnaire_ID->ViewCustomAttributes = "";

			// Questionnaire_Name
			$CCEExams->Questionnaire_Name->ViewValue = $CCEExams->Questionnaire_Name->CurrentValue;
			$CCEExams->Questionnaire_Name->CssStyle = "";
			$CCEExams->Questionnaire_Name->CssClass = "";
			$CCEExams->Questionnaire_Name->ViewCustomAttributes = "";

			// StartDate
			$CCEExams->StartDate->ViewValue = $CCEExams->StartDate->CurrentValue;
			$CCEExams->StartDate->ViewValue = ew_FormatDateTime($CCEExams->StartDate->ViewValue, 11);
			$CCEExams->StartDate->CssStyle = "";
			$CCEExams->StartDate->CssClass = "";
			$CCEExams->StartDate->ViewCustomAttributes = "";

			// CloseDate
			$CCEExams->CloseDate->ViewValue = $CCEExams->CloseDate->CurrentValue;
			$CCEExams->CloseDate->ViewValue = ew_FormatDateTime($CCEExams->CloseDate->ViewValue, 11);
			$CCEExams->CloseDate->CssStyle = "";
			$CCEExams->CloseDate->CssClass = "";
			$CCEExams->CloseDate->ViewCustomAttributes = "";

			// Introduction
			$CCEExams->Introduction->ViewValue = $CCEExams->Introduction->CurrentValue;
			$CCEExams->Introduction->CssStyle = "";
			$CCEExams->Introduction->CssClass = "";
			$CCEExams->Introduction->ViewCustomAttributes = "";

			// MarkerUser
			$CCEExams->MarkerUser->ViewValue = $CCEExams->MarkerUser->CurrentValue;
			$CCEExams->MarkerUser->CssStyle = "";
			$CCEExams->MarkerUser->CssClass = "";
			$CCEExams->MarkerUser->ViewCustomAttributes = "";

			// Questionnaire_ID
			$CCEExams->Questionnaire_ID->HrefValue = "";
			$CCEExams->Questionnaire_ID->TooltipValue = "";

			// Questionnaire_Name
			$CCEExams->Questionnaire_Name->HrefValue = "";
			$CCEExams->Questionnaire_Name->TooltipValue = "";

			// StartDate
			$CCEExams->StartDate->HrefValue = "";
			$CCEExams->StartDate->TooltipValue = "";

			// CloseDate
			$CCEExams->CloseDate->HrefValue = "";
			$CCEExams->CloseDate->TooltipValue = "";

			// Introduction
			$CCEExams->Introduction->HrefValue = "";
			$CCEExams->Introduction->TooltipValue = "";

			// MarkerUser
			$CCEExams->MarkerUser->HrefValue = "";
			$CCEExams->MarkerUser->TooltipValue = "";
		} elseif ($CCEExams->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// Questionnaire_ID
			$CCEExams->Questionnaire_ID->EditCustomAttributes = "";
			$CCEExams->Questionnaire_ID->EditValue = $CCEExams->Questionnaire_ID->CurrentValue;
			$CCEExams->Questionnaire_ID->CssStyle = "";
			$CCEExams->Questionnaire_ID->CssClass = "";
			$CCEExams->Questionnaire_ID->ViewCustomAttributes = "";

			// Questionnaire_Name
			$CCEExams->Questionnaire_Name->EditCustomAttributes = "";
			$CCEExams->Questionnaire_Name->EditValue = ew_HtmlEncode($CCEExams->Questionnaire_Name->CurrentValue);

			// StartDate
			$CCEExams->StartDate->EditCustomAttributes = "";
			$CCEExams->StartDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEExams->StartDate->CurrentValue, 11));

			// CloseDate
			$CCEExams->CloseDate->EditCustomAttributes = "";
			$CCEExams->CloseDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEExams->CloseDate->CurrentValue, 11));

			// Introduction
			$CCEExams->Introduction->EditCustomAttributes = "";
			$CCEExams->Introduction->EditValue = ew_HtmlEncode($CCEExams->Introduction->CurrentValue);

			// MarkerUser
			$CCEExams->MarkerUser->EditCustomAttributes = "";
			$CCEExams->MarkerUser->EditValue = ew_HtmlEncode($CCEExams->MarkerUser->CurrentValue);

			// Edit refer script
			// Questionnaire_ID

			$CCEExams->Questionnaire_ID->HrefValue = "";

			// Questionnaire_Name
			$CCEExams->Questionnaire_Name->HrefValue = "";

			// StartDate
			$CCEExams->StartDate->HrefValue = "";

			// CloseDate
			$CCEExams->CloseDate->HrefValue = "";

			// Introduction
			$CCEExams->Introduction->HrefValue = "";

			// MarkerUser
			$CCEExams->MarkerUser->HrefValue = "";
		}

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

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError, $CCEExams;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $sFormCustomError;
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language, $CCEExams;
		$sFilter = $CCEExams->KeyFilter();
		$CCEExams->CurrentFilter = $sFilter;
		$sSql = $CCEExams->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Save old values
			$rsold =& $rs->fields;
			$rsnew = array();

			// Questionnaire_Name
			$CCEExams->Questionnaire_Name->SetDbValueDef($rsnew, $CCEExams->Questionnaire_Name->CurrentValue, NULL, FALSE);

			// StartDate
			$CCEExams->StartDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEExams->StartDate->CurrentValue, 11, FALSE), NULL);

			// CloseDate
			$CCEExams->CloseDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEExams->CloseDate->CurrentValue, 11, FALSE), NULL);

			// Introduction
			$CCEExams->Introduction->SetDbValueDef($rsnew, $CCEExams->Introduction->CurrentValue, NULL, FALSE);

			// MarkerUser
			$CCEExams->MarkerUser->SetDbValueDef($rsnew, $CCEExams->MarkerUser->CurrentValue, NULL, FALSE);

			// Call Row Updating event
			$bUpdateRow = $CCEExams->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$EditRow = $conn->Execute($CCEExams->UpdateSQL($rsnew));
				$conn->raiseErrorFn = '';
			} else {
				if ($CCEExams->CancelMessage <> "") {
					$this->setMessage($CCEExams->CancelMessage);
					$CCEExams->CancelMessage = "";
				} else {
					$this->setMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$CCEExams->Row_Updated($rsold, $rsnew);
		$rs->Close();
		return $EditRow;
	}

	// 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";
    $msg = cceQuestionListPageLoad();
}

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

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