| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEStudentCoursesadd.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 "CCEStudentCoursesinfo.php" ?>
<?php include "CCEStudentsinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "cstArchivedStudentsinfo.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
$CCEStudentCourses_add = new cCCEStudentCourses_add();
$Page =& $CCEStudentCourses_add;
// Page init
$CCEStudentCourses_add->Page_Init();
// Page main
$CCEStudentCourses_add->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEStudentCourses_add = new ew_Page("CCEStudentCourses_add");
// page properties
CCEStudentCourses_add.PageID = "add"; // page ID
CCEStudentCourses_add.FormID = "fCCEStudentCoursesadd"; // form ID
var EW_PAGE_ID = CCEStudentCourses_add.PageID; // for backward compatibility
// extend page with ValidateForm function
CCEStudentCourses_add.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 + "_CCECourseID"];
if (elm && !ew_HasValue(elm))
return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEStudentCourses->CCECourseID->FldCaption()) ?>");
elm = fobj.elements["x" + infix + "_CCEStudentID"];
if (elm && !ew_HasValue(elm))
return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEStudentCourses->CCEStudentID->FldCaption()) ?>");
elm = fobj.elements["x" + infix + "_SentDateTime"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEStudentCourses->SentDateTime->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_CourseAverage"];
if (elm && !ew_CheckNumber(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEStudentCourses->CourseAverage->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with Form_CustomValidate function
CCEStudentCourses_add.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) { ?>
CCEStudentCourses_add.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentCourses_add.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("Add") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentCourses->TableCaption() ?><br><br>
<a href="<?php echo $CCEStudentCourses->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEStudentCourses_add->ShowMessage();
?>
<form name="fCCEStudentCoursesadd" id="fCCEStudentCoursesadd" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEStudentCourses_add.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEStudentCourses">
<input type="hidden" name="a_add" id="a_add" value="A">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEStudentCourses->CCECourseID->Visible) { // CCECourseID ?>
<tr<?php echo $CCEStudentCourses->CCECourseID->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->CCECourseID->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEStudentCourses->CCECourseID->CellAttributes() ?>><span id="el_CCECourseID">
<?php $CCEStudentCourses->CCECourseID->EditAttrs["onchange"] = "ew_UpdateOpt('x_CCECourseScheduleID','x_CCECourseID',CCEStudentCourses_add.ar_x_CCECourseScheduleID); " . @$CCEStudentCourses->CCECourseID->EditAttrs["onchange"]; ?>
<select id="x_CCECourseID" name="x_CCECourseID" title="<?php echo $CCEStudentCourses->CCECourseID->FldTitle() ?>"<?php echo $CCEStudentCourses->CCECourseID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentCourses->CCECourseID->EditValue)) {
$arwrk = $CCEStudentCourses->CCECourseID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEStudentCourses->CCECourseID->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>
</span><?php echo $CCEStudentCourses->CCECourseID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->CCEStudentID->Visible) { // CCEStudentID ?>
<tr<?php echo $CCEStudentCourses->CCEStudentID->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->CCEStudentID->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEStudentCourses->CCEStudentID->CellAttributes() ?>><span id="el_CCEStudentID">
<?php if ($CCEStudentCourses->CCEStudentID->getSessionValue() <> "") { ?>
<div<?php echo $CCEStudentCourses->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentCourses->CCEStudentID->ViewValue ?></div>
<input type="hidden" id="x_CCEStudentID" name="x_CCEStudentID" value="<?php echo ew_HtmlEncode($CCEStudentCourses->CCEStudentID->CurrentValue) ?>">
<?php } else { ?>
<select id="x_CCEStudentID" name="x_CCEStudentID" title="<?php echo $CCEStudentCourses->CCEStudentID->FldTitle() ?>"<?php echo $CCEStudentCourses->CCEStudentID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentCourses->CCEStudentID->EditValue)) {
$arwrk = $CCEStudentCourses->CCEStudentID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEStudentCourses->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 $CCEStudentCourses->CCEStudentID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->OrderNo->Visible) { // OrderNo ?>
<tr<?php echo $CCEStudentCourses->OrderNo->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->OrderNo->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->OrderNo->CellAttributes() ?>><span id="el_OrderNo">
<input type="text" name="x_OrderNo" id="x_OrderNo" title="<?php echo $CCEStudentCourses->OrderNo->FldTitle() ?>" size="30" maxlength="50" value="<?php echo $CCEStudentCourses->OrderNo->EditValue ?>"<?php echo $CCEStudentCourses->OrderNo->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->OrderNo->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByName->Visible) { // BookedByName ?>
<tr<?php echo $CCEStudentCourses->BookedByName->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByName->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByName->CellAttributes() ?>><span id="el_BookedByName">
<input type="text" name="x_BookedByName" id="x_BookedByName" title="<?php echo $CCEStudentCourses->BookedByName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByName->EditValue ?>"<?php echo $CCEStudentCourses->BookedByName->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByName->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByDesignation->Visible) { // BookedByDesignation ?>
<tr<?php echo $CCEStudentCourses->BookedByDesignation->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByDesignation->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByDesignation->CellAttributes() ?>><span id="el_BookedByDesignation">
<input type="text" name="x_BookedByDesignation" id="x_BookedByDesignation" title="<?php echo $CCEStudentCourses->BookedByDesignation->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByDesignation->EditValue ?>"<?php echo $CCEStudentCourses->BookedByDesignation->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByDesignation->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByTelNo->Visible) { // BookedByTelNo ?>
<tr<?php echo $CCEStudentCourses->BookedByTelNo->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByTelNo->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByTelNo->CellAttributes() ?>><span id="el_BookedByTelNo">
<input type="text" name="x_BookedByTelNo" id="x_BookedByTelNo" title="<?php echo $CCEStudentCourses->BookedByTelNo->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByTelNo->EditValue ?>"<?php echo $CCEStudentCourses->BookedByTelNo->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByTelNo->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByFaxNo->Visible) { // BookedByFaxNo ?>
<tr<?php echo $CCEStudentCourses->BookedByFaxNo->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByFaxNo->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByFaxNo->CellAttributes() ?>><span id="el_BookedByFaxNo">
<input type="text" name="x_BookedByFaxNo" id="x_BookedByFaxNo" title="<?php echo $CCEStudentCourses->BookedByFaxNo->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByFaxNo->EditValue ?>"<?php echo $CCEStudentCourses->BookedByFaxNo->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByFaxNo->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByCellNo->Visible) { // BookedByCellNo ?>
<tr<?php echo $CCEStudentCourses->BookedByCellNo->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByCellNo->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByCellNo->CellAttributes() ?>><span id="el_BookedByCellNo">
<input type="text" name="x_BookedByCellNo" id="x_BookedByCellNo" title="<?php echo $CCEStudentCourses->BookedByCellNo->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByCellNo->EditValue ?>"<?php echo $CCEStudentCourses->BookedByCellNo->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByCellNo->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->BookedByEmail->Visible) { // BookedByEmail ?>
<tr<?php echo $CCEStudentCourses->BookedByEmail->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->BookedByEmail->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->BookedByEmail->CellAttributes() ?>><span id="el_BookedByEmail">
<input type="text" name="x_BookedByEmail" id="x_BookedByEmail" title="<?php echo $CCEStudentCourses->BookedByEmail->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEStudentCourses->BookedByEmail->EditValue ?>"<?php echo $CCEStudentCourses->BookedByEmail->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->BookedByEmail->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->CertificateSent->Visible) { // CertificateSent ?>
<tr<?php echo $CCEStudentCourses->CertificateSent->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->CertificateSent->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->CertificateSent->CellAttributes() ?>><span id="el_CertificateSent">
<div id="tp_x_CertificateSent" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_CertificateSent" id="x_CertificateSent" title="<?php echo $CCEStudentCourses->CertificateSent->FldTitle() ?>" value="{value}"<?php echo $CCEStudentCourses->CertificateSent->EditAttributes() ?>></label></div>
<div id="dsl_x_CertificateSent" repeatcolumn="5">
<?php
$arwrk = $CCEStudentCourses->CertificateSent->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEStudentCourses->CertificateSent->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_CertificateSent" id="x_CertificateSent" title="<?php echo $CCEStudentCourses->CertificateSent->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEStudentCourses->CertificateSent->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $CCEStudentCourses->CertificateSent->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->SentDateTime->Visible) { // SentDateTime ?>
<tr<?php echo $CCEStudentCourses->SentDateTime->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->SentDateTime->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->SentDateTime->CellAttributes() ?>><span id="el_SentDateTime">
<input type="text" name="x_SentDateTime" id="x_SentDateTime" title="<?php echo $CCEStudentCourses->SentDateTime->FldTitle() ?>" value="<?php echo $CCEStudentCourses->SentDateTime->EditValue ?>"<?php echo $CCEStudentCourses->SentDateTime->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x_SentDateTime" name="cal_x_SentDateTime" 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_SentDateTime", // input field id
ifFormat: "%Y/%m/%d", // date format
button: "cal_x_SentDateTime" // button id
});
</script>
</span><?php echo $CCEStudentCourses->SentDateTime->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->CCECourseScheduleID->Visible) { // CCECourseScheduleID ?>
<tr<?php echo $CCEStudentCourses->CCECourseScheduleID->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->CCECourseScheduleID->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->CCECourseScheduleID->CellAttributes() ?>><span id="el_CCECourseScheduleID">
<select id="x_CCECourseScheduleID" name="x_CCECourseScheduleID" title="<?php echo $CCEStudentCourses->CCECourseScheduleID->FldTitle() ?>"<?php echo $CCEStudentCourses->CCECourseScheduleID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentCourses->CCECourseScheduleID->EditValue)) {
$arwrk = $CCEStudentCourses->CCECourseScheduleID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEStudentCourses->CCECourseScheduleID->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
$jswrk = "";
if (is_array($CCEStudentCourses->CCECourseScheduleID->EditValue)) {
$arwrk = $CCEStudentCourses->CCECourseScheduleID->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">
<!--
CCEStudentCourses_add.ar_x_CCECourseScheduleID = [<?php echo $jswrk ?>];
//-->
</script>
</span><?php echo $CCEStudentCourses->CCECourseScheduleID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEStudentCourses->CourseAverage->Visible) { // CourseAverage ?>
<tr<?php echo $CCEStudentCourses->CourseAverage->RowAttributes ?>>
<td class="ewTableHeader"><?php echo $CCEStudentCourses->CourseAverage->FldCaption() ?></td>
<td<?php echo $CCEStudentCourses->CourseAverage->CellAttributes() ?>><span id="el_CourseAverage">
<input type="text" name="x_CourseAverage" id="x_CourseAverage" title="<?php echo $CCEStudentCourses->CourseAverage->FldTitle() ?>" size="30" value="<?php echo $CCEStudentCourses->CourseAverage->EditValue ?>"<?php echo $CCEStudentCourses->CourseAverage->EditAttributes() ?>>
</span><?php echo $CCEStudentCourses->CourseAverage->CustomMsg ?></td>
</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("AddBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x_CCECourseScheduleID','x_CCECourseID',CCEStudentCourses_add.ar_x_CCECourseScheduleID]]);
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$CCEStudentCourses_add->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEStudentCourses_add {
// Page ID
var $PageID = 'add';
// Table name
var $TableName = 'CCEStudentCourses';
// Page object name
var $PageObjName = 'CCEStudentCourses_add';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEStudentCourses;
if ($CCEStudentCourses->UseTokenInUrl) $PageUrl .= "t=" . $CCEStudentCourses->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, $CCEStudentCourses;
if ($CCEStudentCourses->UseTokenInUrl) {
if ($objForm)
return ($CCEStudentCourses->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEStudentCourses->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEStudentCourses)
$GLOBALS["CCEStudentCourses"] = new cCCEStudentCourses();
// Table object (CCEStudents)
$GLOBALS['CCEStudents'] = new cCCEStudents();
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// Table object (cstArchivedStudents)
$GLOBALS['cstArchivedStudents'] = new ccstArchivedStudents();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'add', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCEStudentCourses', 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 $CCEStudentCourses;
// 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->CanAdd()) {
$Security->SaveLastUrl();
$this->Page_Terminate("CCEStudentCourseslist.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 = "";
var $lPriv = 0;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsFormError, $CCEStudentCourses;
// Load key values from QueryString
$bCopy = TRUE;
if (@$_GET["CCEEnrollID"] != "") {
$CCEStudentCourses->CCEEnrollID->setQueryStringValue($_GET["CCEEnrollID"]);
} else {
$bCopy = FALSE;
}
// Set up master/detail parameters
$this->SetUpMasterDetail();
// Process form if post back
if (@$_POST["a_add"] <> "") {
$CCEStudentCourses->CurrentAction = $_POST["a_add"]; // Get form action
$this->LoadFormValues(); // Load form values
// Validate form
if (!$this->ValidateForm()) {
$CCEStudentCourses->CurrentAction = "I"; // Form error, reset action
$this->setMessage($gsFormError);
}
} else { // Not post back
if ($bCopy) {
$CCEStudentCourses->CurrentAction = "C"; // Copy record
} else {
$CCEStudentCourses->CurrentAction = "I"; // Display blank record
$this->LoadDefaultValues(); // Load default values
}
}
// Perform action based on action code
switch ($CCEStudentCourses->CurrentAction) {
case "I": // Blank record, no action required
break;
case "C": // Copy an existing record
if (!$this->LoadRow()) { // Load record based on key
$this->setMessage($Language->Phrase("NoRecord")); // No record found
$this->Page_Terminate("CCEStudentCourseslist.php"); // No matching record, return to list
}
break;
case "A": // ' Add new record
$CCEStudentCourses->SendEmail = TRUE; // Send email on add success
if ($this->AddRow()) { // Add successful
$this->setMessage($Language->Phrase("AddSuccess")); // Set up success message
$sReturnUrl = $CCEStudentCourses->getReturnUrl();
if (ew_GetPageName($sReturnUrl) == "CCEStudentCoursesview.php")
$sReturnUrl = $CCEStudentCourses->ViewUrl(); // View paging, return to view page with keyurl directly
$this->Page_Terminate($sReturnUrl); // Clean up and return
} else {
$this->RestoreFormValues(); // Add failed, restore form values
}
}
// Render row based on row type
$CCEStudentCourses->RowType = EW_ROWTYPE_ADD; // Render add type
// Render row
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $CCEStudentCourses;
// Get upload data
}
// Load default values
function LoadDefaultValues() {
global $CCEStudentCourses;
$CCEStudentCourses->CertificateSent->CurrentValue = 0;
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $CCEStudentCourses;
$CCEStudentCourses->CCECourseID->setFormValue($objForm->GetValue("x_CCECourseID"));
$CCEStudentCourses->CCEStudentID->setFormValue($objForm->GetValue("x_CCEStudentID"));
$CCEStudentCourses->OrderNo->setFormValue($objForm->GetValue("x_OrderNo"));
$CCEStudentCourses->BookedByName->setFormValue($objForm->GetValue("x_BookedByName"));
$CCEStudentCourses->BookedByDesignation->setFormValue($objForm->GetValue("x_BookedByDesignation"));
$CCEStudentCourses->BookedByTelNo->setFormValue($objForm->GetValue("x_BookedByTelNo"));
$CCEStudentCourses->BookedByFaxNo->setFormValue($objForm->GetValue("x_BookedByFaxNo"));
$CCEStudentCourses->BookedByCellNo->setFormValue($objForm->GetValue("x_BookedByCellNo"));
$CCEStudentCourses->BookedByEmail->setFormValue($objForm->GetValue("x_BookedByEmail"));
$CCEStudentCourses->CertificateSent->setFormValue($objForm->GetValue("x_CertificateSent"));
$CCEStudentCourses->SentDateTime->setFormValue($objForm->GetValue("x_SentDateTime"));
$CCEStudentCourses->SentDateTime->CurrentValue = ew_UnFormatDateTime($CCEStudentCourses->SentDateTime->CurrentValue, 5);
$CCEStudentCourses->CCECourseScheduleID->setFormValue($objForm->GetValue("x_CCECourseScheduleID"));
$CCEStudentCourses->CourseAverage->setFormValue($objForm->GetValue("x_CourseAverage"));
$CCEStudentCourses->CCEEnrollID->setFormValue($objForm->GetValue("x_CCEEnrollID"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $CCEStudentCourses;
$CCEStudentCourses->CCEEnrollID->CurrentValue = $CCEStudentCourses->CCEEnrollID->FormValue;
$CCEStudentCourses->CCECourseID->CurrentValue = $CCEStudentCourses->CCECourseID->FormValue;
$CCEStudentCourses->CCEStudentID->CurrentValue = $CCEStudentCourses->CCEStudentID->FormValue;
$CCEStudentCourses->OrderNo->CurrentValue = $CCEStudentCourses->OrderNo->FormValue;
$CCEStudentCourses->BookedByName->CurrentValue = $CCEStudentCourses->BookedByName->FormValue;
$CCEStudentCourses->BookedByDesignation->CurrentValue = $CCEStudentCourses->BookedByDesignation->FormValue;
$CCEStudentCourses->BookedByTelNo->CurrentValue = $CCEStudentCourses->BookedByTelNo->FormValue;
$CCEStudentCourses->BookedByFaxNo->CurrentValue = $CCEStudentCourses->BookedByFaxNo->FormValue;
$CCEStudentCourses->BookedByCellNo->CurrentValue = $CCEStudentCourses->BookedByCellNo->FormValue;
$CCEStudentCourses->BookedByEmail->CurrentValue = $CCEStudentCourses->BookedByEmail->FormValue;
$CCEStudentCourses->CertificateSent->CurrentValue = $CCEStudentCourses->CertificateSent->FormValue;
$CCEStudentCourses->SentDateTime->CurrentValue = $CCEStudentCourses->SentDateTime->FormValue;
$CCEStudentCourses->SentDateTime->CurrentValue = ew_UnFormatDateTime($CCEStudentCourses->SentDateTime->CurrentValue, 5);
$CCEStudentCourses->CCECourseScheduleID->CurrentValue = $CCEStudentCourses->CCECourseScheduleID->FormValue;
$CCEStudentCourses->CourseAverage->CurrentValue = $CCEStudentCourses->CourseAverage->FormValue;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEStudentCourses;
$sFilter = $CCEStudentCourses->KeyFilter();
// Call Row Selecting event
$CCEStudentCourses->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEStudentCourses->CurrentFilter = $sFilter;
$sSql = $CCEStudentCourses->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEStudentCourses->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEStudentCourses;
$CCEStudentCourses->CCEEnrollID->setDbValue($rs->fields('CCEEnrollID'));
$CCEStudentCourses->CCECourseID->setDbValue($rs->fields('CCECourseID'));
$CCEStudentCourses->CCEStudentID->setDbValue($rs->fields('CCEStudentID'));
$CCEStudentCourses->OrderNo->setDbValue($rs->fields('OrderNo'));
$CCEStudentCourses->BookedByName->setDbValue($rs->fields('BookedByName'));
$CCEStudentCourses->BookedByDesignation->setDbValue($rs->fields('BookedByDesignation'));
$CCEStudentCourses->BookedByTelNo->setDbValue($rs->fields('BookedByTelNo'));
$CCEStudentCourses->BookedByFaxNo->setDbValue($rs->fields('BookedByFaxNo'));
$CCEStudentCourses->BookedByCellNo->setDbValue($rs->fields('BookedByCellNo'));
$CCEStudentCourses->BookedByEmail->setDbValue($rs->fields('BookedByEmail'));
$CCEStudentCourses->CertificateSent->setDbValue($rs->fields('CertificateSent'));
$CCEStudentCourses->SentDateTime->setDbValue($rs->fields('SentDateTime'));
$CCEStudentCourses->CCECourseScheduleID->setDbValue($rs->fields('CCECourseScheduleID'));
$CCEStudentCourses->CourseAverage->setDbValue($rs->fields('CourseAverage'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEStudentCourses;
// Initialize URLs
// Call Row_Rendering event
$CCEStudentCourses->Row_Rendering();
// Common render codes for all row types
// CCECourseID
$CCEStudentCourses->CCECourseID->CellCssStyle = ""; $CCEStudentCourses->CCECourseID->CellCssClass = "";
$CCEStudentCourses->CCECourseID->CellAttrs = array(); $CCEStudentCourses->CCECourseID->ViewAttrs = array(); $CCEStudentCourses->CCECourseID->EditAttrs = array();
// CCEStudentID
$CCEStudentCourses->CCEStudentID->CellCssStyle = ""; $CCEStudentCourses->CCEStudentID->CellCssClass = "";
$CCEStudentCourses->CCEStudentID->CellAttrs = array(); $CCEStudentCourses->CCEStudentID->ViewAttrs = array(); $CCEStudentCourses->CCEStudentID->EditAttrs = array();
// OrderNo
$CCEStudentCourses->OrderNo->CellCssStyle = ""; $CCEStudentCourses->OrderNo->CellCssClass = "";
$CCEStudentCourses->OrderNo->CellAttrs = array(); $CCEStudentCourses->OrderNo->ViewAttrs = array(); $CCEStudentCourses->OrderNo->EditAttrs = array();
// BookedByName
$CCEStudentCourses->BookedByName->CellCssStyle = ""; $CCEStudentCourses->BookedByName->CellCssClass = "";
$CCEStudentCourses->BookedByName->CellAttrs = array(); $CCEStudentCourses->BookedByName->ViewAttrs = array(); $CCEStudentCourses->BookedByName->EditAttrs = array();
// BookedByDesignation
$CCEStudentCourses->BookedByDesignation->CellCssStyle = ""; $CCEStudentCourses->BookedByDesignation->CellCssClass = "";
$CCEStudentCourses->BookedByDesignation->CellAttrs = array(); $CCEStudentCourses->BookedByDesignation->ViewAttrs = array(); $CCEStudentCourses->BookedByDesignation->EditAttrs = array();
// BookedByTelNo
$CCEStudentCourses->BookedByTelNo->CellCssStyle = ""; $CCEStudentCourses->BookedByTelNo->CellCssClass = "";
$CCEStudentCourses->BookedByTelNo->CellAttrs = array(); $CCEStudentCourses->BookedByTelNo->ViewAttrs = array(); $CCEStudentCourses->BookedByTelNo->EditAttrs = array();
// BookedByFaxNo
$CCEStudentCourses->BookedByFaxNo->CellCssStyle = ""; $CCEStudentCourses->BookedByFaxNo->CellCssClass = "";
$CCEStudentCourses->BookedByFaxNo->CellAttrs = array(); $CCEStudentCourses->BookedByFaxNo->ViewAttrs = array(); $CCEStudentCourses->BookedByFaxNo->EditAttrs = array();
// BookedByCellNo
$CCEStudentCourses->BookedByCellNo->CellCssStyle = ""; $CCEStudentCourses->BookedByCellNo->CellCssClass = "";
$CCEStudentCourses->BookedByCellNo->CellAttrs = array(); $CCEStudentCourses->BookedByCellNo->ViewAttrs = array(); $CCEStudentCourses->BookedByCellNo->EditAttrs = array();
// BookedByEmail
$CCEStudentCourses->BookedByEmail->CellCssStyle = ""; $CCEStudentCourses->BookedByEmail->CellCssClass = "";
$CCEStudentCourses->BookedByEmail->CellAttrs = array(); $CCEStudentCourses->BookedByEmail->ViewAttrs = array(); $CCEStudentCourses->BookedByEmail->EditAttrs = array();
// CertificateSent
$CCEStudentCourses->CertificateSent->CellCssStyle = ""; $CCEStudentCourses->CertificateSent->CellCssClass = "";
$CCEStudentCourses->CertificateSent->CellAttrs = array(); $CCEStudentCourses->CertificateSent->ViewAttrs = array(); $CCEStudentCourses->CertificateSent->EditAttrs = array();
// SentDateTime
$CCEStudentCourses->SentDateTime->CellCssStyle = ""; $CCEStudentCourses->SentDateTime->CellCssClass = "";
$CCEStudentCourses->SentDateTime->CellAttrs = array(); $CCEStudentCourses->SentDateTime->ViewAttrs = array(); $CCEStudentCourses->SentDateTime->EditAttrs = array();
// CCECourseScheduleID
$CCEStudentCourses->CCECourseScheduleID->CellCssStyle = ""; $CCEStudentCourses->CCECourseScheduleID->CellCssClass = "";
$CCEStudentCourses->CCECourseScheduleID->CellAttrs = array(); $CCEStudentCourses->CCECourseScheduleID->ViewAttrs = array(); $CCEStudentCourses->CCECourseScheduleID->EditAttrs = array();
// CourseAverage
$CCEStudentCourses->CourseAverage->CellCssStyle = ""; $CCEStudentCourses->CourseAverage->CellCssClass = "";
$CCEStudentCourses->CourseAverage->CellAttrs = array(); $CCEStudentCourses->CourseAverage->ViewAttrs = array(); $CCEStudentCourses->CourseAverage->EditAttrs = array();
if ($CCEStudentCourses->RowType == EW_ROWTYPE_VIEW) { // View row
// CCEEnrollID
$CCEStudentCourses->CCEEnrollID->ViewValue = $CCEStudentCourses->CCEEnrollID->CurrentValue;
$CCEStudentCourses->CCEEnrollID->CssStyle = "";
$CCEStudentCourses->CCEEnrollID->CssClass = "";
$CCEStudentCourses->CCEEnrollID->ViewCustomAttributes = "";
// CCECourseID
if (strval($CCEStudentCourses->CCECourseID->CurrentValue) <> "") {
$sFilterWrk = "CCECourseSchedules.CCECourseScheduleID = " . ew_AdjustSql($CCEStudentCourses->CCECourseID->CurrentValue) . "";
$sSqlWrk = "SELECT CCECourses.CCECourseName AS `CCECourseName`, CCECourseSchedules.StartDate AS `StartDate` FROM CCECourses Inner Join CCECourseSchedules On CCECourseSchedules.CCECourseID = CCECourses.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseName, CCECourseSchedules.StartDate";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentCourses->CCECourseID->ViewValue = $rswrk->fields('CCECourseName');
$CCEStudentCourses->CCECourseID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('StartDate');
$rswrk->Close();
} else {
$CCEStudentCourses->CCECourseID->ViewValue = $CCEStudentCourses->CCECourseID->CurrentValue;
}
} else {
$CCEStudentCourses->CCECourseID->ViewValue = NULL;
}
$CCEStudentCourses->CCECourseID->CssStyle = "";
$CCEStudentCourses->CCECourseID->CssClass = "";
$CCEStudentCourses->CCECourseID->ViewCustomAttributes = "";
// CCEStudentID
if (strval($CCEStudentCourses->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentCourses->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
$CCEStudentCourses->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$CCEStudentCourses->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$CCEStudentCourses->CCEStudentID->ViewValue = $CCEStudentCourses->CCEStudentID->CurrentValue;
}
} else {
$CCEStudentCourses->CCEStudentID->ViewValue = NULL;
}
$CCEStudentCourses->CCEStudentID->CssStyle = "";
$CCEStudentCourses->CCEStudentID->CssClass = "";
$CCEStudentCourses->CCEStudentID->ViewCustomAttributes = "";
// OrderNo
$CCEStudentCourses->OrderNo->ViewValue = $CCEStudentCourses->OrderNo->CurrentValue;
$CCEStudentCourses->OrderNo->CssStyle = "";
$CCEStudentCourses->OrderNo->CssClass = "";
$CCEStudentCourses->OrderNo->ViewCustomAttributes = "";
// BookedByName
$CCEStudentCourses->BookedByName->ViewValue = $CCEStudentCourses->BookedByName->CurrentValue;
$CCEStudentCourses->BookedByName->CssStyle = "";
$CCEStudentCourses->BookedByName->CssClass = "";
$CCEStudentCourses->BookedByName->ViewCustomAttributes = "";
// BookedByDesignation
$CCEStudentCourses->BookedByDesignation->ViewValue = $CCEStudentCourses->BookedByDesignation->CurrentValue;
$CCEStudentCourses->BookedByDesignation->CssStyle = "";
$CCEStudentCourses->BookedByDesignation->CssClass = "";
$CCEStudentCourses->BookedByDesignation->ViewCustomAttributes = "";
// BookedByTelNo
$CCEStudentCourses->BookedByTelNo->ViewValue = $CCEStudentCourses->BookedByTelNo->CurrentValue;
$CCEStudentCourses->BookedByTelNo->CssStyle = "";
$CCEStudentCourses->BookedByTelNo->CssClass = "";
$CCEStudentCourses->BookedByTelNo->ViewCustomAttributes = "";
// BookedByFaxNo
$CCEStudentCourses->BookedByFaxNo->ViewValue = $CCEStudentCourses->BookedByFaxNo->CurrentValue;
$CCEStudentCourses->BookedByFaxNo->CssStyle = "";
$CCEStudentCourses->BookedByFaxNo->CssClass = "";
$CCEStudentCourses->BookedByFaxNo->ViewCustomAttributes = "";
// BookedByCellNo
$CCEStudentCourses->BookedByCellNo->ViewValue = $CCEStudentCourses->BookedByCellNo->CurrentValue;
$CCEStudentCourses->BookedByCellNo->CssStyle = "";
$CCEStudentCourses->BookedByCellNo->CssClass = "";
$CCEStudentCourses->BookedByCellNo->ViewCustomAttributes = "";
// BookedByEmail
$CCEStudentCourses->BookedByEmail->ViewValue = $CCEStudentCourses->BookedByEmail->CurrentValue;
$CCEStudentCourses->BookedByEmail->CssStyle = "";
$CCEStudentCourses->BookedByEmail->CssClass = "";
$CCEStudentCourses->BookedByEmail->ViewCustomAttributes = "";
// CertificateSent
if (strval($CCEStudentCourses->CertificateSent->CurrentValue) <> "") {
switch ($CCEStudentCourses->CertificateSent->CurrentValue) {
case "1":
$CCEStudentCourses->CertificateSent->ViewValue = "Yes";
break;
case "0":
$CCEStudentCourses->CertificateSent->ViewValue = "No";
break;
default:
$CCEStudentCourses->CertificateSent->ViewValue = $CCEStudentCourses->CertificateSent->CurrentValue;
}
} else {
$CCEStudentCourses->CertificateSent->ViewValue = NULL;
}
$CCEStudentCourses->CertificateSent->CssStyle = "";
$CCEStudentCourses->CertificateSent->CssClass = "";
$CCEStudentCourses->CertificateSent->ViewCustomAttributes = "";
// SentDateTime
$CCEStudentCourses->SentDateTime->ViewValue = $CCEStudentCourses->SentDateTime->CurrentValue;
$CCEStudentCourses->SentDateTime->ViewValue = ew_FormatDateTime($CCEStudentCourses->SentDateTime->ViewValue, 5);
$CCEStudentCourses->SentDateTime->CssStyle = "";
$CCEStudentCourses->SentDateTime->CssClass = "";
$CCEStudentCourses->SentDateTime->ViewCustomAttributes = "";
// CCECourseScheduleID
if (strval($CCEStudentCourses->CCECourseScheduleID->CurrentValue) <> "") {
$sFilterWrk = "`CCECourseScheduleID` = " . ew_AdjustSql($CCEStudentCourses->CCECourseScheduleID->CurrentValue) . "";
$sSqlWrk = "SELECT `StartDate`, `EndDate` FROM `CCECourseSchedules`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `StartDate`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentCourses->CCECourseScheduleID->ViewValue = $rswrk->fields('StartDate');
$CCEStudentCourses->CCECourseScheduleID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('EndDate');
$rswrk->Close();
} else {
$CCEStudentCourses->CCECourseScheduleID->ViewValue = $CCEStudentCourses->CCECourseScheduleID->CurrentValue;
}
} else {
$CCEStudentCourses->CCECourseScheduleID->ViewValue = NULL;
}
$CCEStudentCourses->CCECourseScheduleID->CssStyle = "";
$CCEStudentCourses->CCECourseScheduleID->CssClass = "";
$CCEStudentCourses->CCECourseScheduleID->ViewCustomAttributes = "";
// CourseAverage
$CCEStudentCourses->CourseAverage->ViewValue = $CCEStudentCourses->CourseAverage->CurrentValue;
$CCEStudentCourses->CourseAverage->CssStyle = "";
$CCEStudentCourses->CourseAverage->CssClass = "";
$CCEStudentCourses->CourseAverage->ViewCustomAttributes = "";
// CCECourseID
$CCEStudentCourses->CCECourseID->HrefValue = "";
$CCEStudentCourses->CCECourseID->TooltipValue = "";
// CCEStudentID
$CCEStudentCourses->CCEStudentID->HrefValue = "";
$CCEStudentCourses->CCEStudentID->TooltipValue = "";
// OrderNo
$CCEStudentCourses->OrderNo->HrefValue = "";
$CCEStudentCourses->OrderNo->TooltipValue = "";
// BookedByName
$CCEStudentCourses->BookedByName->HrefValue = "";
$CCEStudentCourses->BookedByName->TooltipValue = "";
// BookedByDesignation
$CCEStudentCourses->BookedByDesignation->HrefValue = "";
$CCEStudentCourses->BookedByDesignation->TooltipValue = "";
// BookedByTelNo
$CCEStudentCourses->BookedByTelNo->HrefValue = "";
$CCEStudentCourses->BookedByTelNo->TooltipValue = "";
// BookedByFaxNo
$CCEStudentCourses->BookedByFaxNo->HrefValue = "";
$CCEStudentCourses->BookedByFaxNo->TooltipValue = "";
// BookedByCellNo
$CCEStudentCourses->BookedByCellNo->HrefValue = "";
$CCEStudentCourses->BookedByCellNo->TooltipValue = "";
// BookedByEmail
$CCEStudentCourses->BookedByEmail->HrefValue = "";
$CCEStudentCourses->BookedByEmail->TooltipValue = "";
// CertificateSent
$CCEStudentCourses->CertificateSent->HrefValue = "";
$CCEStudentCourses->CertificateSent->TooltipValue = "";
// SentDateTime
$CCEStudentCourses->SentDateTime->HrefValue = "";
$CCEStudentCourses->SentDateTime->TooltipValue = "";
// CCECourseScheduleID
$CCEStudentCourses->CCECourseScheduleID->HrefValue = "";
$CCEStudentCourses->CCECourseScheduleID->TooltipValue = "";
// CourseAverage
$CCEStudentCourses->CourseAverage->HrefValue = "";
$CCEStudentCourses->CourseAverage->TooltipValue = "";
} elseif ($CCEStudentCourses->RowType == EW_ROWTYPE_ADD) { // Add row
// CCECourseID
$CCEStudentCourses->CCECourseID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT CCECourseSchedules.CCECourseScheduleID, CCECourses.CCECourseName, CCECourseSchedules.StartDate, '' AS SelectFilterFld FROM CCECourses Inner Join CCECourseSchedules On CCECourseSchedules.CCECourseID = CCECourses.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseName, CCECourseSchedules.StartDate";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEStudentCourses->CCECourseID->EditValue = $arwrk;
// CCEStudentID
$CCEStudentCourses->CCEStudentID->EditCustomAttributes = "";
if ($CCEStudentCourses->CCEStudentID->getSessionValue() <> "") {
$CCEStudentCourses->CCEStudentID->CurrentValue = $CCEStudentCourses->CCEStudentID->getSessionValue();
if (strval($CCEStudentCourses->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentCourses->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
$CCEStudentCourses->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$CCEStudentCourses->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$CCEStudentCourses->CCEStudentID->ViewValue = $CCEStudentCourses->CCEStudentID->CurrentValue;
}
} else {
$CCEStudentCourses->CCEStudentID->ViewValue = NULL;
}
$CCEStudentCourses->CCEStudentID->CssStyle = "";
$CCEStudentCourses->CCEStudentID->CssClass = "";
$CCEStudentCourses->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"), ""));
$CCEStudentCourses->CCEStudentID->EditValue = $arwrk;
}
// OrderNo
$CCEStudentCourses->OrderNo->EditCustomAttributes = "";
$CCEStudentCourses->OrderNo->EditValue = ew_HtmlEncode($CCEStudentCourses->OrderNo->CurrentValue);
// BookedByName
$CCEStudentCourses->BookedByName->EditCustomAttributes = "";
$CCEStudentCourses->BookedByName->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByName->CurrentValue);
// BookedByDesignation
$CCEStudentCourses->BookedByDesignation->EditCustomAttributes = "";
$CCEStudentCourses->BookedByDesignation->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByDesignation->CurrentValue);
// BookedByTelNo
$CCEStudentCourses->BookedByTelNo->EditCustomAttributes = "";
$CCEStudentCourses->BookedByTelNo->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByTelNo->CurrentValue);
// BookedByFaxNo
$CCEStudentCourses->BookedByFaxNo->EditCustomAttributes = "";
$CCEStudentCourses->BookedByFaxNo->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByFaxNo->CurrentValue);
// BookedByCellNo
$CCEStudentCourses->BookedByCellNo->EditCustomAttributes = "";
$CCEStudentCourses->BookedByCellNo->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByCellNo->CurrentValue);
// BookedByEmail
$CCEStudentCourses->BookedByEmail->EditCustomAttributes = "";
$CCEStudentCourses->BookedByEmail->EditValue = ew_HtmlEncode($CCEStudentCourses->BookedByEmail->CurrentValue);
// CertificateSent
$CCEStudentCourses->CertificateSent->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEStudentCourses->CertificateSent->EditValue = $arwrk;
// SentDateTime
$CCEStudentCourses->SentDateTime->EditCustomAttributes = "";
$CCEStudentCourses->SentDateTime->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEStudentCourses->SentDateTime->CurrentValue, 5));
// CCECourseScheduleID
$CCEStudentCourses->CCECourseScheduleID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `CCECourseScheduleID`, `StartDate`, `EndDate`, `CCECourseID` FROM `CCECourseSchedules`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `StartDate`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", ""));
$CCEStudentCourses->CCECourseScheduleID->EditValue = $arwrk;
// CourseAverage
$CCEStudentCourses->CourseAverage->EditCustomAttributes = "";
$CCEStudentCourses->CourseAverage->EditValue = ew_HtmlEncode($CCEStudentCourses->CourseAverage->CurrentValue);
}
// Call Row Rendered event
if ($CCEStudentCourses->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEStudentCourses->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $CCEStudentCourses;
// Initialize form error message
$gsFormError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!is_null($CCEStudentCourses->CCECourseID->FormValue) && $CCEStudentCourses->CCECourseID->FormValue == "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEStudentCourses->CCECourseID->FldCaption();
}
if (!is_null($CCEStudentCourses->CCEStudentID->FormValue) && $CCEStudentCourses->CCEStudentID->FormValue == "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEStudentCourses->CCEStudentID->FldCaption();
}
if (!ew_CheckDate($CCEStudentCourses->SentDateTime->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEStudentCourses->SentDateTime->FldErrMsg();
}
if (!ew_CheckNumber($CCEStudentCourses->CourseAverage->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEStudentCourses->CourseAverage->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;
}
// Add record
function AddRow() {
global $conn, $Language, $Security, $CCEStudentCourses;
$rsnew = array();
// CCECourseID
$CCEStudentCourses->CCECourseID->SetDbValueDef($rsnew, $CCEStudentCourses->CCECourseID->CurrentValue, 0, FALSE);
// CCEStudentID
$CCEStudentCourses->CCEStudentID->SetDbValueDef($rsnew, $CCEStudentCourses->CCEStudentID->CurrentValue, 0, FALSE);
// OrderNo
$CCEStudentCourses->OrderNo->SetDbValueDef($rsnew, $CCEStudentCourses->OrderNo->CurrentValue, NULL, FALSE);
// BookedByName
$CCEStudentCourses->BookedByName->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByName->CurrentValue, NULL, FALSE);
// BookedByDesignation
$CCEStudentCourses->BookedByDesignation->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByDesignation->CurrentValue, NULL, FALSE);
// BookedByTelNo
$CCEStudentCourses->BookedByTelNo->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByTelNo->CurrentValue, NULL, FALSE);
// BookedByFaxNo
$CCEStudentCourses->BookedByFaxNo->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByFaxNo->CurrentValue, NULL, FALSE);
// BookedByCellNo
$CCEStudentCourses->BookedByCellNo->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByCellNo->CurrentValue, NULL, FALSE);
// BookedByEmail
$CCEStudentCourses->BookedByEmail->SetDbValueDef($rsnew, $CCEStudentCourses->BookedByEmail->CurrentValue, NULL, FALSE);
// CertificateSent
$CCEStudentCourses->CertificateSent->SetDbValueDef($rsnew, $CCEStudentCourses->CertificateSent->CurrentValue, NULL, TRUE);
// SentDateTime
$CCEStudentCourses->SentDateTime->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEStudentCourses->SentDateTime->CurrentValue, 5, FALSE), NULL);
// CCECourseScheduleID
$CCEStudentCourses->CCECourseScheduleID->SetDbValueDef($rsnew, $CCEStudentCourses->CCECourseScheduleID->CurrentValue, NULL, FALSE);
// CourseAverage
$CCEStudentCourses->CourseAverage->SetDbValueDef($rsnew, $CCEStudentCourses->CourseAverage->CurrentValue, NULL, FALSE);
// Call Row Inserting event
$bInsertRow = $CCEStudentCourses->Row_Inserting($rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $conn->Execute($CCEStudentCourses->InsertSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($CCEStudentCourses->CancelMessage <> "") {
$this->setMessage($CCEStudentCourses->CancelMessage);
$CCEStudentCourses->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
if ($AddRow) {
$CCEStudentCourses->CCEEnrollID->setDbValue($conn->Insert_ID());
$rsnew['CCEEnrollID'] = $CCEStudentCourses->CCEEnrollID->DbValue;
// Call Row Inserted event
$CCEStudentCourses->Row_Inserted($rsnew);
}
return $AddRow;
}
// Set up master/detail based on QueryString
function SetUpMasterDetail() {
global $CCEStudentCourses;
$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 = $CCEStudentCourses->SqlMasterFilter_CCEStudents();
$this->sDbDetailFilter = $CCEStudentCourses->SqlDetailFilter_CCEStudents();
if (@$_GET["CCEStudentID"] <> "") {
$GLOBALS["CCEStudents"]->CCEStudentID->setQueryStringValue($_GET["CCEStudentID"]);
$CCEStudentCourses->CCEStudentID->setQueryStringValue($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue);
$CCEStudentCourses->CCEStudentID->setSessionValue($CCEStudentCourses->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 ($sMasterTblVar == "cstArchivedStudents") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEStudentCourses->SqlMasterFilter_cstArchivedStudents();
$this->sDbDetailFilter = $CCEStudentCourses->SqlDetailFilter_cstArchivedStudents();
if (@$_GET["CCEStudentID"] <> "") {
$GLOBALS["cstArchivedStudents"]->CCEStudentID->setQueryStringValue($_GET["CCEStudentID"]);
$CCEStudentCourses->CCEStudentID->setQueryStringValue($GLOBALS["cstArchivedStudents"]->CCEStudentID->QueryStringValue);
$CCEStudentCourses->CCEStudentID->setSessionValue($CCEStudentCourses->CCEStudentID->QueryStringValue);
if (!is_numeric($GLOBALS["cstArchivedStudents"]->CCEStudentID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["cstArchivedStudents"]->CCEStudentID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["cstArchivedStudents"]->CCEStudentID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
}
if ($bValidMaster) {
// Save current master table
$CCEStudentCourses->setCurrentMasterTable($sMasterTblVar);
// Reset start record counter (new master key)
$this->lStartRec = 1;
$CCEStudentCourses->setStartRecordNumber($this->lStartRec);
$CCEStudentCourses->setMasterFilter($this->sDbMasterFilter); // Set up master filter
$CCEStudentCourses->setDetailFilter($this->sDbDetailFilter); // Set up detail filter
// Clear previous master key from Session
if ($sMasterTblVar <> "CCEStudents") {
if ($CCEStudentCourses->CCEStudentID->QueryStringValue == "") $CCEStudentCourses->CCEStudentID->setSessionValue("");
}
if ($sMasterTblVar <> "cstArchivedStudents") {
if ($CCEStudentCourses->CCEStudentID->QueryStringValue == "") $CCEStudentCourses->CCEStudentID->setSessionValue("");
}
} else {
$this->sDbMasterFilter = $CCEStudentCourses->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEStudentCourses->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;
}
}
?>