| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEStudentSessionsedit.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 "CCEStudentSessionsinfo.php" ?>
<?php include "CCEStudentsinfo.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
$CCEStudentSessions_edit = new cCCEStudentSessions_edit();
$Page =& $CCEStudentSessions_edit;
// Page init
$CCEStudentSessions_edit->Page_Init();
// Page main
$CCEStudentSessions_edit->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEStudentSessions_edit = new ew_Page("CCEStudentSessions_edit");
// page properties
CCEStudentSessions_edit.PageID = "edit"; // page ID
CCEStudentSessions_edit.FormID = "fCCEStudentSessionsedit"; // form ID
var EW_PAGE_ID = CCEStudentSessions_edit.PageID; // for backward compatibility
// extend page with ValidateForm function
CCEStudentSessions_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) : "";
elm = fobj.elements["x" + infix + "_CCESessionScheduleID"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEStudentSessions->CCESessionScheduleID->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with Form_CustomValidate function
CCEStudentSessions_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) { ?>
CCEStudentSessions_edit.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentSessions_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") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentSessions->TableCaption() ?><br><br>
<a href="<?php echo $CCEStudentSessions->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEStudentSessions_edit->ShowMessage();
?>
<form name="fCCEStudentSessionsedit" id="fCCEStudentSessionsedit" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEStudentSessions_edit.ValidateForm(this);">
<p>
<input type="hidden" name="a_table" id="a_table" value="CCEStudentSessions">
<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">
<input type="hidden" name="x_CCEStudentModuleID" id="x_CCEStudentModuleID" value="<?php echo ew_HtmlEncode($CCEStudentSessions->CCEStudentModuleID->CurrentValue) ?>">
<?php if ($CCEStudentSessions->CCEStudentID->Visible) { // CCEStudentID ?>
<tr<?php echo $CCEStudentSessions->CCEStudentID->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentSessions->CCEStudentID->FldCaption() ?></td>
<td<?php echo $CCEStudentSessions->CCEStudentID->CellAttributes() ?>><span id="el_CCEStudentID">
<?php if ($CCEStudentSessions->CCEStudentID->getSessionValue() <> "") { ?>
<div<?php echo $CCEStudentSessions->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentSessions->CCEStudentID->ViewValue ?></div>
<input type="hidden" id="x_CCEStudentID" name="x_CCEStudentID" value="<?php echo ew_HtmlEncode($CCEStudentSessions->CCEStudentID->CurrentValue) ?>">
<?php } else { ?>
<select id="x_CCEStudentID" name="x_CCEStudentID" title="<?php echo $CCEStudentSessions->CCEStudentID->FldTitle() ?>"<?php echo $CCEStudentSessions->CCEStudentID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentSessions->CCEStudentID->EditValue)) {
$arwrk = $CCEStudentSessions->CCEStudentID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEStudentSessions->CCEStudentID->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
<?php if ($arwrk[$rowcntwrk][2] <> "") { ?>
<?php echo ew_ValueSeparator($rowcntwrk) ?><?php echo $arwrk[$rowcntwrk][2] ?>
<?php } ?>
</option>
<?php
}
}
?>
</select>
<?php } ?>
</span><?php echo $CCEStudentSessions->CCEStudentID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentSessions->CCESessionScheduleID->Visible) { // CCESessionScheduleID ?>
<tr<?php echo $CCEStudentSessions->CCESessionScheduleID->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentSessions->CCESessionScheduleID->FldCaption() ?></td>
<td<?php echo $CCEStudentSessions->CCESessionScheduleID->CellAttributes() ?>><span id="el_CCESessionScheduleID">
<input type="text" name="x_CCESessionScheduleID" id="x_CCESessionScheduleID" title="<?php echo $CCEStudentSessions->CCESessionScheduleID->FldTitle() ?>" size="30" value="<?php echo $CCEStudentSessions->CCESessionScheduleID->EditValue ?>"<?php echo $CCEStudentSessions->CCESessionScheduleID->EditAttributes() ?>>
</span><?php echo $CCEStudentSessions->CCESessionScheduleID->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
$CCEStudentSessions_edit->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEStudentSessions_edit {
// Page ID
var $PageID = 'edit';
// Table name
var $TableName = 'CCEStudentSessions';
// Page object name
var $PageObjName = 'CCEStudentSessions_edit';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEStudentSessions;
if ($CCEStudentSessions->UseTokenInUrl) $PageUrl .= "t=" . $CCEStudentSessions->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, $CCEStudentSessions;
if ($CCEStudentSessions->UseTokenInUrl) {
if ($objForm)
return ($CCEStudentSessions->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEStudentSessions->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEStudentSessions)
$GLOBALS["CCEStudentSessions"] = new cCCEStudentSessions();
// Table object (CCEStudents)
$GLOBALS['CCEStudents'] = new cCCEStudents();
// 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", 'CCEStudentSessions', 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 $CCEStudentSessions;
// 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("CCEStudentSessionslist.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, $CCEStudentSessions;
// Load key from QueryString
if (@$_GET["CCEStudentModuleID"] <> "")
$CCEStudentSessions->CCEStudentModuleID->setQueryStringValue($_GET["CCEStudentModuleID"]);
// Set up master detail parameters
$this->SetUpMasterDetail();
if (@$_POST["a_edit"] <> "") {
$CCEStudentSessions->CurrentAction = $_POST["a_edit"]; // Get action code
$this->LoadFormValues(); // Get form values
// Validate form
if (!$this->ValidateForm()) {
$CCEStudentSessions->CurrentAction = ""; // Form error, reset action
$this->setMessage($gsFormError);
$CCEStudentSessions->EventCancelled = TRUE; // Event cancelled
$this->RestoreFormValues();
}
} else {
$CCEStudentSessions->CurrentAction = "I"; // Default action is display
}
// Check if valid key
if ($CCEStudentSessions->CCEStudentModuleID->CurrentValue == "")
$this->Page_Terminate("CCEStudentSessionslist.php"); // Invalid key, return to list
switch ($CCEStudentSessions->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("CCEStudentSessionslist.php"); // No matching record, return to list
}
break;
Case "U": // Update
$CCEStudentSessions->SendEmail = TRUE; // Send email on update success
if ($this->EditRow()) { // Update record based on key
$this->setMessage($Language->Phrase("UpdateSuccess")); // Update success
$sReturnUrl = $CCEStudentSessions->getReturnUrl();
if (ew_GetPageName($sReturnUrl) == "CCEStudentSessionsview.php")
$sReturnUrl = $CCEStudentSessions->ViewUrl(); // View paging, return to View page directly
$this->Page_Terminate($sReturnUrl); // Return to caller
} else {
$CCEStudentSessions->EventCancelled = TRUE; // Event cancelled
$this->RestoreFormValues(); // Restore form values if update failed
}
}
// Render the record
$CCEStudentSessions->RowType = EW_ROWTYPE_EDIT; // Render as Edit
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $CCEStudentSessions;
// Get upload data
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $CCEStudentSessions;
$CCEStudentSessions->CCEStudentModuleID->setFormValue($objForm->GetValue("x_CCEStudentModuleID"));
$CCEStudentSessions->CCEStudentID->setFormValue($objForm->GetValue("x_CCEStudentID"));
$CCEStudentSessions->CCESessionScheduleID->setFormValue($objForm->GetValue("x_CCESessionScheduleID"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $CCEStudentSessions;
$this->LoadRow();
$CCEStudentSessions->CCEStudentModuleID->CurrentValue = $CCEStudentSessions->CCEStudentModuleID->FormValue;
$CCEStudentSessions->CCEStudentID->CurrentValue = $CCEStudentSessions->CCEStudentID->FormValue;
$CCEStudentSessions->CCESessionScheduleID->CurrentValue = $CCEStudentSessions->CCESessionScheduleID->FormValue;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEStudentSessions;
$sFilter = $CCEStudentSessions->KeyFilter();
// Call Row Selecting event
$CCEStudentSessions->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEStudentSessions->CurrentFilter = $sFilter;
$sSql = $CCEStudentSessions->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEStudentSessions->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEStudentSessions;
$CCEStudentSessions->CCEStudentModuleID->setDbValue($rs->fields('CCEStudentModuleID'));
$CCEStudentSessions->CCEStudentID->setDbValue($rs->fields('CCEStudentID'));
$CCEStudentSessions->CCESessionScheduleID->setDbValue($rs->fields('CCESessionScheduleID'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEStudentSessions;
// Initialize URLs
// Call Row_Rendering event
$CCEStudentSessions->Row_Rendering();
// Common render codes for all row types
// CCEStudentModuleID
$CCEStudentSessions->CCEStudentModuleID->CellCssStyle = ""; $CCEStudentSessions->CCEStudentModuleID->CellCssClass = "";
$CCEStudentSessions->CCEStudentModuleID->CellAttrs = array(); $CCEStudentSessions->CCEStudentModuleID->ViewAttrs = array(); $CCEStudentSessions->CCEStudentModuleID->EditAttrs = array();
// CCEStudentID
$CCEStudentSessions->CCEStudentID->CellCssStyle = ""; $CCEStudentSessions->CCEStudentID->CellCssClass = "";
$CCEStudentSessions->CCEStudentID->CellAttrs = array(); $CCEStudentSessions->CCEStudentID->ViewAttrs = array(); $CCEStudentSessions->CCEStudentID->EditAttrs = array();
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->CellCssStyle = ""; $CCEStudentSessions->CCESessionScheduleID->CellCssClass = "";
$CCEStudentSessions->CCESessionScheduleID->CellAttrs = array(); $CCEStudentSessions->CCESessionScheduleID->ViewAttrs = array(); $CCEStudentSessions->CCESessionScheduleID->EditAttrs = array();
if ($CCEStudentSessions->RowType == EW_ROWTYPE_VIEW) { // View row
// CCEStudentModuleID
$CCEStudentSessions->CCEStudentModuleID->ViewValue = $CCEStudentSessions->CCEStudentModuleID->CurrentValue;
$CCEStudentSessions->CCEStudentModuleID->CssStyle = "";
$CCEStudentSessions->CCEStudentModuleID->CssClass = "";
$CCEStudentSessions->CCEStudentModuleID->ViewCustomAttributes = "";
// CCEStudentID
if (strval($CCEStudentSessions->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentSessions->CCEStudentID->CurrentValue) . "";
$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
$sWhereWrk = "";
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
$CCEStudentSessions->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$CCEStudentSessions->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$CCEStudentSessions->CCEStudentID->ViewValue = $CCEStudentSessions->CCEStudentID->CurrentValue;
}
} else {
$CCEStudentSessions->CCEStudentID->ViewValue = NULL;
}
$CCEStudentSessions->CCEStudentID->CssStyle = "";
$CCEStudentSessions->CCEStudentID->CssClass = "";
$CCEStudentSessions->CCEStudentID->ViewCustomAttributes = "";
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->ViewValue = $CCEStudentSessions->CCESessionScheduleID->CurrentValue;
$CCEStudentSessions->CCESessionScheduleID->CssStyle = "";
$CCEStudentSessions->CCESessionScheduleID->CssClass = "";
$CCEStudentSessions->CCESessionScheduleID->ViewCustomAttributes = "";
// CCEStudentModuleID
$CCEStudentSessions->CCEStudentModuleID->HrefValue = "";
$CCEStudentSessions->CCEStudentModuleID->TooltipValue = "";
// CCEStudentID
$CCEStudentSessions->CCEStudentID->HrefValue = "";
$CCEStudentSessions->CCEStudentID->TooltipValue = "";
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->HrefValue = "";
$CCEStudentSessions->CCESessionScheduleID->TooltipValue = "";
} elseif ($CCEStudentSessions->RowType == EW_ROWTYPE_EDIT) { // Edit row
// CCEStudentModuleID
$CCEStudentSessions->CCEStudentModuleID->EditCustomAttributes = "";
// CCEStudentID
$CCEStudentSessions->CCEStudentID->EditCustomAttributes = "";
if ($CCEStudentSessions->CCEStudentID->getSessionValue() <> "") {
$CCEStudentSessions->CCEStudentID->CurrentValue = $CCEStudentSessions->CCEStudentID->getSessionValue();
if (strval($CCEStudentSessions->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentSessions->CCEStudentID->CurrentValue) . "";
$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
$sWhereWrk = "";
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
$CCEStudentSessions->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$CCEStudentSessions->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$CCEStudentSessions->CCEStudentID->ViewValue = $CCEStudentSessions->CCEStudentID->CurrentValue;
}
} else {
$CCEStudentSessions->CCEStudentID->ViewValue = NULL;
}
$CCEStudentSessions->CCEStudentID->CssStyle = "";
$CCEStudentSessions->CCEStudentID->CssClass = "";
$CCEStudentSessions->CCEStudentID->ViewCustomAttributes = "";
} else {
$sFilterWrk = "";
$sSqlWrk = "SELECT `CCEStudentID`, `FirstName`, `Surname`, '' AS SelectFilterFld FROM `CCEStudents`";
$sWhereWrk = "";
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();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEStudentSessions->CCEStudentID->EditValue = $arwrk;
}
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->EditCustomAttributes = "";
$CCEStudentSessions->CCESessionScheduleID->EditValue = ew_HtmlEncode($CCEStudentSessions->CCESessionScheduleID->CurrentValue);
// Edit refer script
// CCEStudentModuleID
$CCEStudentSessions->CCEStudentModuleID->HrefValue = "";
// CCEStudentID
$CCEStudentSessions->CCEStudentID->HrefValue = "";
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->HrefValue = "";
}
// Call Row Rendered event
if ($CCEStudentSessions->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEStudentSessions->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $CCEStudentSessions;
// Initialize form error message
$gsFormError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!ew_CheckInteger($CCEStudentSessions->CCESessionScheduleID->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEStudentSessions->CCESessionScheduleID->FldErrMsg();
}
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Update record based on key values
function EditRow() {
global $conn, $Security, $Language, $CCEStudentSessions;
$sFilter = $CCEStudentSessions->KeyFilter();
$CCEStudentSessions->CurrentFilter = $sFilter;
$sSql = $CCEStudentSessions->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();
// CCEStudentID
$CCEStudentSessions->CCEStudentID->SetDbValueDef($rsnew, $CCEStudentSessions->CCEStudentID->CurrentValue, NULL, FALSE);
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->SetDbValueDef($rsnew, $CCEStudentSessions->CCESessionScheduleID->CurrentValue, NULL, FALSE);
// Call Row Updating event
$bUpdateRow = $CCEStudentSessions->Row_Updating($rsold, $rsnew);
if ($bUpdateRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$EditRow = $conn->Execute($CCEStudentSessions->UpdateSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($CCEStudentSessions->CancelMessage <> "") {
$this->setMessage($CCEStudentSessions->CancelMessage);
$CCEStudentSessions->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("UpdateCancelled"));
}
$EditRow = FALSE;
}
}
// Call Row_Updated event
if ($EditRow)
$CCEStudentSessions->Row_Updated($rsold, $rsnew);
$rs->Close();
return $EditRow;
}
// Set up master/detail based on QueryString
function SetUpMasterDetail() {
global $CCEStudentSessions;
$bValidMaster = FALSE;
// Get the keys for master table
if (@$_GET[EW_TABLE_SHOW_MASTER] <> "") {
$sMasterTblVar = $_GET[EW_TABLE_SHOW_MASTER];
if ($sMasterTblVar == "") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = "";
$this->sDbDetailFilter = "";
}
if ($sMasterTblVar == "CCEStudents") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEStudentSessions->SqlMasterFilter_CCEStudents();
$this->sDbDetailFilter = $CCEStudentSessions->SqlDetailFilter_CCEStudents();
if (@$_GET["CCEStudentID"] <> "") {
$GLOBALS["CCEStudents"]->CCEStudentID->setQueryStringValue($_GET["CCEStudentID"]);
$CCEStudentSessions->CCEStudentID->setQueryStringValue($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue);
$CCEStudentSessions->CCEStudentID->setSessionValue($CCEStudentSessions->CCEStudentID->QueryStringValue);
if (!is_numeric($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
}
if ($bValidMaster) {
// Save current master table
$CCEStudentSessions->setCurrentMasterTable($sMasterTblVar);
// Reset start record counter (new master key)
$this->lStartRec = 1;
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
$CCEStudentSessions->setMasterFilter($this->sDbMasterFilter); // Set up master filter
$CCEStudentSessions->setDetailFilter($this->sDbDetailFilter); // Set up detail filter
// Clear previous master key from Session
if ($sMasterTblVar <> "CCEStudents") {
if ($CCEStudentSessions->CCEStudentID->QueryStringValue == "") $CCEStudentSessions->CCEStudentID->setSessionValue("");
}
} else {
$this->sDbMasterFilter = $CCEStudentSessions->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEStudentSessions->getDetailFilter(); // Restore detail filter
}
}
// 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;
}
}
?>