| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEStudentSessionslist.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_list = new cCCEStudentSessions_list();
$Page =& $CCEStudentSessions_list;
// Page init
$CCEStudentSessions_list->Page_Init();
// Page main
$CCEStudentSessions_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEStudentSessions->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var CCEStudentSessions_list = new ew_Page("CCEStudentSessions_list");
// page properties
CCEStudentSessions_list.PageID = "list"; // page ID
CCEStudentSessions_list.FormID = "fCCEStudentSessionslist"; // form ID
var EW_PAGE_ID = CCEStudentSessions_list.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
CCEStudentSessions_list.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_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentSessions_list.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>
<?php } ?>
<?php if ($CCEStudentSessions->Export == "") { ?>
<?php
$gsMasterReturnUrl = "CCEStudentslist.php";
if ($CCEStudentSessions_list->sDbMasterFilter <> "" && $CCEStudentSessions->getCurrentMasterTable() == "CCEStudents") {
if ($CCEStudentSessions_list->bMasterRecordExists) {
if ($CCEStudentSessions->getCurrentMasterTable() == $CCEStudentSessions->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "CCEStudentsmaster.php" ?>
<?php
}
}
?>
<?php } ?>
<?php
$bSelectLimit = EW_SELECT_LIMIT;
if ($bSelectLimit) {
$CCEStudentSessions_list->lTotalRecs = $CCEStudentSessions->SelectRecordCount();
} else {
if ($rs = $CCEStudentSessions_list->LoadRecordset())
$CCEStudentSessions_list->lTotalRecs = $rs->RecordCount();
}
$CCEStudentSessions_list->lStartRec = 1;
if ($CCEStudentSessions_list->lDisplayRecs <= 0 || ($CCEStudentSessions->Export <> "" && $CCEStudentSessions->ExportAll)) // Display all records
$CCEStudentSessions_list->lDisplayRecs = $CCEStudentSessions_list->lTotalRecs;
if (!($CCEStudentSessions->Export <> "" && $CCEStudentSessions->ExportAll))
$CCEStudentSessions_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
$rs = $CCEStudentSessions_list->LoadRecordset($CCEStudentSessions_list->lStartRec-1, $CCEStudentSessions_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentSessions->TableCaption() ?>
<?php if ($CCEStudentSessions->Export == "" && $CCEStudentSessions->CurrentAction == "") { ?>
<a href="<?php echo $CCEStudentSessions_list->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
<a href="<?php echo $CCEStudentSessions_list->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
<a href="<?php echo $CCEStudentSessions_list->ExportWordUrl ?>"><img src='images/exportdoc.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' width='16' height='16' border='0'></a>
<a name="emf_CCEStudentSessions" id="emf_CCEStudentSessions" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEStudentSessions',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCEStudentSessionslist,sel:false});"><img src='images/exportemail.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEStudentSessions_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCEStudentSessions->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCEStudentSessions->CurrentAction <> "gridadd" && $CCEStudentSessions->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCEStudentSessions_list->Pager)) $CCEStudentSessions_list->Pager = new cPrevNextPager($CCEStudentSessions_list->lStartRec, $CCEStudentSessions_list->lDisplayRecs, $CCEStudentSessions_list->lTotalRecs) ?>
<?php if ($CCEStudentSessions_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEStudentSessions_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCEStudentSessions_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEStudentSessions_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEStudentSessions_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCEStudentSessions_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEStudentSessions_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEStudentSessions_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEStudentSessions_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEStudentSessions_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEStudentSessions_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEStudentSessions_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCEStudentSessionslist" id="fCCEStudentSessionslist" class="ewForm" action="" method="post">
<div id="gmp_CCEStudentSessions" class="ewGridMiddlePanel">
<?php if ($CCEStudentSessions_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCEStudentSessions->TableCustomInnerHtml ?>
<thead><!-- Table header -->
<tr class="ewTableHeader">
<?php
// Render list options
$CCEStudentSessions_list->RenderListOptions();
// Render list options (header, left)
$CCEStudentSessions_list->ListOptions->Render("header", "left");
?>
<?php if ($CCEStudentSessions->CCEStudentID->Visible) { // CCEStudentID ?>
<?php if ($CCEStudentSessions->SortUrl($CCEStudentSessions->CCEStudentID) == "") { ?>
<td><?php echo $CCEStudentSessions->CCEStudentID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentSessions->SortUrl($CCEStudentSessions->CCEStudentID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentSessions->CCEStudentID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentSessions->CCEStudentID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentSessions->CCEStudentID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEStudentSessions->CCESessionScheduleID->Visible) { // CCESessionScheduleID ?>
<?php if ($CCEStudentSessions->SortUrl($CCEStudentSessions->CCESessionScheduleID) == "") { ?>
<td><?php echo $CCEStudentSessions->CCESessionScheduleID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentSessions->SortUrl($CCEStudentSessions->CCESessionScheduleID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentSessions->CCESessionScheduleID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentSessions->CCESessionScheduleID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentSessions->CCESessionScheduleID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php
// Render list options (header, right)
$CCEStudentSessions_list->ListOptions->Render("header", "right");
?>
</tr>
</thead>
<?php
if ($CCEStudentSessions->ExportAll && $CCEStudentSessions->Export <> "") {
$CCEStudentSessions_list->lStopRec = $CCEStudentSessions_list->lTotalRecs;
} else {
$CCEStudentSessions_list->lStopRec = $CCEStudentSessions_list->lStartRec + $CCEStudentSessions_list->lDisplayRecs - 1; // Set the last record to display
}
$CCEStudentSessions_list->lRecCount = $CCEStudentSessions_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $CCEStudentSessions_list->lStartRec > 1)
$rs->Move($CCEStudentSessions_list->lStartRec - 1);
}
// Initialize aggregate
$CCEStudentSessions->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCEStudentSessions_list->RenderRow();
$CCEStudentSessions_list->lRowCnt = 0;
while (($CCEStudentSessions->CurrentAction == "gridadd" || !$rs->EOF) &&
$CCEStudentSessions_list->lRecCount < $CCEStudentSessions_list->lStopRec) {
$CCEStudentSessions_list->lRecCount++;
if (intval($CCEStudentSessions_list->lRecCount) >= intval($CCEStudentSessions_list->lStartRec)) {
$CCEStudentSessions_list->lRowCnt++;
// Init row class and style
$CCEStudentSessions->CssClass = "";
$CCEStudentSessions->CssStyle = "";
$CCEStudentSessions->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
if ($CCEStudentSessions->CurrentAction == "gridadd") {
$CCEStudentSessions_list->LoadDefaultValues(); // Load default values
} else {
$CCEStudentSessions_list->LoadRowValues($rs); // Load row values
}
$CCEStudentSessions->RowType = EW_ROWTYPE_VIEW; // Render view
// Render row
$CCEStudentSessions_list->RenderRow();
// Render list options
$CCEStudentSessions_list->RenderListOptions();
?>
<tr<?php echo $CCEStudentSessions->RowAttributes() ?>>
<?php
// Render list options (body, left)
$CCEStudentSessions_list->ListOptions->Render("body", "left");
?>
<?php if ($CCEStudentSessions->CCEStudentID->Visible) { // CCEStudentID ?>
<td<?php echo $CCEStudentSessions->CCEStudentID->CellAttributes() ?>>
<div<?php echo $CCEStudentSessions->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentSessions->CCEStudentID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEStudentSessions->CCESessionScheduleID->Visible) { // CCESessionScheduleID ?>
<td<?php echo $CCEStudentSessions->CCESessionScheduleID->CellAttributes() ?>>
<div<?php echo $CCEStudentSessions->CCESessionScheduleID->ViewAttributes() ?>><?php echo $CCEStudentSessions->CCESessionScheduleID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php
// Render list options (body, right)
$CCEStudentSessions_list->ListOptions->Render("body", "right");
?>
</tr>
<?php
}
if ($CCEStudentSessions->CurrentAction <> "gridadd")
$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php
// Close recordset
if ($rs)
$rs->Close();
?>
<?php if ($CCEStudentSessions_list->lTotalRecs > 0) { ?>
<?php if ($CCEStudentSessions->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCEStudentSessions->CurrentAction <> "gridadd" && $CCEStudentSessions->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
<tr>
<td nowrap>
<?php if (!isset($CCEStudentSessions_list->Pager)) $CCEStudentSessions_list->Pager = new cPrevNextPager($CCEStudentSessions_list->lStartRec, $CCEStudentSessions_list->lDisplayRecs, $CCEStudentSessions_list->lTotalRecs) ?>
<?php if ($CCEStudentSessions_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEStudentSessions_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--previous page button-->
<?php if ($CCEStudentSessions_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--current page number-->
<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEStudentSessions_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEStudentSessions_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<!--last page button-->
<?php if ($CCEStudentSessions_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentSessions_list->PageUrl() ?>start=<?php echo $CCEStudentSessions_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEStudentSessions_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEStudentSessions_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEStudentSessions_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEStudentSessions_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEStudentSessions_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<?php //if ($CCEStudentSessions_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEStudentSessions_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCEStudentSessions->Export == "" && $CCEStudentSessions->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCEStudentSessions->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$CCEStudentSessions_list->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEStudentSessions_list {
// Page ID
var $PageID = 'list';
// Table name
var $TableName = 'CCEStudentSessions';
// Page object name
var $PageObjName = 'CCEStudentSessions_list';
// 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();
// Initialize URLs
$this->ExportPrintUrl = $this->PageUrl() . "export=print";
$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
$this->ExportWordUrl = $this->PageUrl() . "export=word";
$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
$this->AddUrl = $GLOBALS["CCEStudentSessions"]->AddUrl();
$this->InlineAddUrl = $this->PageUrl() . "a=add";
$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
$this->MultiDeleteUrl = "CCEStudentSessionsdelete.php";
$this->MultiUpdateUrl = "CCEStudentSessionsupdate.php";
// 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", 'list', 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();
// List options
$this->ListOptions = new cListOptions();
}
//
// 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->CanList()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
// Get export parameters
if (@$_GET["export"] <> "") {
$CCEStudentSessions->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$CCEStudentSessions->Export = $_POST["exporttype"];
} else {
$CCEStudentSessions->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $CCEStudentSessions->Export; // Get export parameter, used in header
$gsExportFile = $CCEStudentSessions->TableVar; // Get export file, used in header
if ($CCEStudentSessions->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($CCEStudentSessions->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
}
// 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();
}
// Class variables
var $ListOptions; // List options
var $lDisplayRecs = 20;
var $lStartRec;
var $lStopRec;
var $lTotalRecs = 0;
var $lRecRange = 10;
var $sSrchWhere = ""; // Search WHERE clause
var $lRecCnt = 0; // Record count
var $lEditRowCnt;
var $lRowCnt;
var $lRowIndex; // Row index
var $lRecPerRow = 0;
var $lColCnt = 0;
var $sDbMasterFilter = ""; // Master filter
var $sDbDetailFilter = ""; // Detail filter
var $bMasterRecordExists;
var $sMultiSelectKey;
var $RestoreSearch;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Security, $CCEStudentSessions;
// Search filters
$sSrchAdvanced = ""; // Advanced search filter
$sSrchBasic = ""; // Basic search filter
$sFilter = "";
if ($this->IsPageRequest()) { // Validate request
// Handle reset command
$this->ResetCmd();
// Set up master detail parameters
$this->SetUpMasterDetail();
// Set up list options
$this->SetupListOptions();
// Set up sorting order
$this->SetUpSortOrder();
}
// Restore display records
if ($CCEStudentSessions->getRecordsPerPage() <> "") {
$this->lDisplayRecs = $CCEStudentSessions->getRecordsPerPage(); // Restore from Session
} else {
$this->lDisplayRecs = 20; // Load default
}
// Load Sorting Order
$this->LoadSortOrder();
// Build filter
$sFilter = "";
if (!$Security->CanList())
$sFilter = "(0=1)"; // Filter all records
// Restore master/detail filter
$this->sDbMasterFilter = $CCEStudentSessions->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEStudentSessions->getDetailFilter(); // Restore detail filter
if ($this->sDbDetailFilter <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
if ($this->sSrchWhere <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
// Load master record
if ($CCEStudentSessions->getMasterFilter() <> "" && $CCEStudentSessions->getCurrentMasterTable() == "CCEStudents") {
global $CCEStudents;
$rsmaster = $CCEStudents->LoadRs($this->sDbMasterFilter);
$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
if (!$this->bMasterRecordExists) {
$CCEStudentSessions->setMasterFilter(""); // Clear master filter
$CCEStudentSessions->setDetailFilter(""); // Clear detail filter
$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
$this->Page_Terminate($CCEStudentSessions->getReturnUrl()); // Return to caller
} else {
$CCEStudents->LoadListRowValues($rsmaster);
$CCEStudents->RowType = EW_ROWTYPE_MASTER; // Master row
$CCEStudents->RenderListRow();
$rsmaster->Close();
}
}
// Set up filter in session
$CCEStudentSessions->setSessionWhere($sFilter);
$CCEStudentSessions->CurrentFilter = "";
// Export data only
if (in_array($CCEStudentSessions->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($CCEStudentSessions->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
}
// Set up sort parameters
function SetUpSortOrder() {
global $CCEStudentSessions;
// Check for Ctrl pressed
$bCtrl = (@$_GET["ctrl"] <> "");
// Check for "order" parameter
if (@$_GET["order"] <> "") {
$CCEStudentSessions->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
$CCEStudentSessions->CurrentOrderType = @$_GET["ordertype"];
$CCEStudentSessions->UpdateSort($CCEStudentSessions->CCEStudentID, $bCtrl); // CCEStudentID
$CCEStudentSessions->UpdateSort($CCEStudentSessions->CCESessionScheduleID, $bCtrl); // CCESessionScheduleID
$CCEStudentSessions->setStartRecordNumber(1); // Reset start position
}
}
// Load sort order parameters
function LoadSortOrder() {
global $CCEStudentSessions;
$sOrderBy = $CCEStudentSessions->getSessionOrderBy(); // Get ORDER BY from Session
if ($sOrderBy == "") {
if ($CCEStudentSessions->SqlOrderBy() <> "") {
$sOrderBy = $CCEStudentSessions->SqlOrderBy();
$CCEStudentSessions->setSessionOrderBy($sOrderBy);
$CCEStudentSessions->CCEStudentID->setSort("ASC");
}
}
}
// Reset command
// cmd=reset (Reset search parameters)
// cmd=resetall (Reset search and master/detail parameters)
// cmd=resetsort (Reset sort parameters)
function ResetCmd() {
global $CCEStudentSessions;
// Get reset command
if (@$_GET["cmd"] <> "") {
$sCmd = $_GET["cmd"];
// Reset master/detail keys
if (strtolower($sCmd) == "resetall") {
$CCEStudentSessions->getCurrentMasterTable = ""; // Clear master table
$CCEStudentSessions->setMasterFilter(""); // Clear master filter
$this->sDbMasterFilter = "";
$CCEStudentSessions->setDetailFilter(""); // Clear detail filter
$this->sDbDetailFilter = "";
$CCEStudentSessions->CCEStudentID->setSessionValue("");
}
// Reset sorting order
if (strtolower($sCmd) == "resetsort") {
$sOrderBy = "";
$CCEStudentSessions->setSessionOrderBy($sOrderBy);
$CCEStudentSessions->CCEStudentID->setSort("");
$CCEStudentSessions->CCESessionScheduleID->setSort("");
}
// Reset start position
$this->lStartRec = 1;
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
}
}
// Set up list options
function SetupListOptions() {
global $Security, $CCEStudentSessions;
// "view"
$this->ListOptions->Add("view");
$item =& $this->ListOptions->Items["view"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanView();
$item->OnLeft = FALSE;
// "edit"
$this->ListOptions->Add("edit");
$item =& $this->ListOptions->Items["edit"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanEdit();
$item->OnLeft = FALSE;
// "delete"
$this->ListOptions->Add("delete");
$item =& $this->ListOptions->Items["delete"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanDelete();
$item->OnLeft = FALSE;
// Call ListOptions_Load event
$this->ListOptions_Load();
if ($CCEStudentSessions->Export <> "" ||
$CCEStudentSessions->CurrentAction == "gridadd" ||
$CCEStudentSessions->CurrentAction == "gridedit")
$this->ListOptions->HideAllOptions();
}
// Render list options
function RenderListOptions() {
global $Security, $Language, $CCEStudentSessions;
$this->ListOptions->LoadDefault();
// "view"
$oListOpt =& $this->ListOptions->Items["view"];
if ($Security->CanView() && $oListOpt->Visible)
$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . "<img src=\"images/view.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
// "edit"
$oListOpt =& $this->ListOptions->Items["edit"];
if ($Security->CanEdit() && $oListOpt->Visible) {
$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . "<img src=\"images/edit.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
}
// "delete"
$oListOpt =& $this->ListOptions->Items["delete"];
if ($Security->CanDelete() && $oListOpt->Visible)
$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . "<img src=\"images/delete.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
$this->RenderListOptionsExt();
// Call ListOptions_Rendered event
$this->ListOptions_Rendered();
}
function RenderListOptionsExt() {
global $Security, $Language, $CCEStudentSessions;
}
// Set up starting record parameters
function SetUpStartRec() {
global $CCEStudentSessions;
if ($this->lDisplayRecs == 0)
return;
if ($this->IsPageRequest()) { // Validate request
if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
$this->lStartRec = $_GET[EW_TABLE_START_REC];
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
if (is_numeric($this->nPageNo)) {
$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
if ($this->lStartRec <= 0) {
$this->lStartRec = 1;
} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
}
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $CCEStudentSessions->getStartRecordNumber();
// Check if correct start record counter
if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
$this->lStartRec = 1; // Reset start record counter
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
$CCEStudentSessions->setStartRecordNumber($this->lStartRec);
}
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $CCEStudentSessions;
// Call Recordset Selecting event
$CCEStudentSessions->Recordset_Selecting($CCEStudentSessions->CurrentFilter);
// Load List page SQL
$sSql = $CCEStudentSessions->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$CCEStudentSessions->Recordset_Selected($rs);
return $rs;
}
// 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
$this->ViewUrl = $CCEStudentSessions->ViewUrl();
$this->EditUrl = $CCEStudentSessions->EditUrl();
$this->InlineEditUrl = $CCEStudentSessions->InlineEditUrl();
$this->CopyUrl = $CCEStudentSessions->CopyUrl();
$this->InlineCopyUrl = $CCEStudentSessions->InlineCopyUrl();
$this->DeleteUrl = $CCEStudentSessions->DeleteUrl();
// Call Row_Rendering event
$CCEStudentSessions->Row_Rendering();
// Common render codes for all row types
// 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 = "";
// CCEStudentID
$CCEStudentSessions->CCEStudentID->HrefValue = "";
$CCEStudentSessions->CCEStudentID->TooltipValue = "";
// CCESessionScheduleID
$CCEStudentSessions->CCESessionScheduleID->HrefValue = "";
$CCEStudentSessions->CCESessionScheduleID->TooltipValue = "";
}
// Call Row Rendered event
if ($CCEStudentSessions->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEStudentSessions->Row_Rendered();
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $CCEStudentSessions;
$utf8 = FALSE;
$bSelectLimit = EW_SELECT_LIMIT;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $CCEStudentSessions->SelectRecordCount();
} else {
if ($rs = $this->LoadRecordset())
$this->lTotalRecs = $rs->RecordCount();
}
$this->lStartRec = 1;
// Export all
if ($CCEStudentSessions->ExportAll) {
$this->lDisplayRecs = $this->lTotalRecs;
$this->lStopRec = $this->lTotalRecs;
} else { // Export one page only
$this->SetUpStartRec(); // Set up start record position
// Set the last record to display
if ($this->lDisplayRecs < 0) {
$this->lStopRec = $this->lTotalRecs;
} else {
$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
}
}
if ($bSelectLimit)
$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
if (!$rs) {
header("Content-Type:"); // Remove header
header("Content-Disposition:");
$this->ShowMessage();
return;
}
if ($CCEStudentSessions->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($CCEStudentSessions, "h");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($CCEStudentSessions->CCEStudentModuleID);
$ExportDoc->ExportCaption($CCEStudentSessions->CCEStudentID);
$ExportDoc->ExportCaption($CCEStudentSessions->CCESessionScheduleID);
$ExportDoc->EndExportRow();
}
}
// Move to first record
$this->lRecCnt = $this->lStartRec - 1;
if (!$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $this->lStartRec > 1)
$rs->Move($this->lStartRec - 1);
}
while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
$this->lRecCnt++;
if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
$this->LoadRowValues($rs);
// Render row
$CCEStudentSessions->CssClass = "";
$CCEStudentSessions->CssStyle = "";
$CCEStudentSessions->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($CCEStudentSessions->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('CCEStudentModuleID', $CCEStudentSessions->CCEStudentModuleID->ExportValue($CCEStudentSessions->Export, $CCEStudentSessions->ExportOriginalValue));
$XmlDoc->AddField('CCEStudentID', $CCEStudentSessions->CCEStudentID->ExportValue($CCEStudentSessions->Export, $CCEStudentSessions->ExportOriginalValue));
$XmlDoc->AddField('CCESessionScheduleID', $CCEStudentSessions->CCESessionScheduleID->ExportValue($CCEStudentSessions->Export, $CCEStudentSessions->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($CCEStudentSessions->CCEStudentModuleID);
$ExportDoc->ExportField($CCEStudentSessions->CCEStudentID);
$ExportDoc->ExportField($CCEStudentSessions->CCESessionScheduleID);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($CCEStudentSessions->Export <> "xml")
$ExportDoc->ExportFooter();
// Close recordset
$rs->Close();
// Clean output buffer
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
// Write BOM if utf-8
if ($utf8 && !in_array($CCEStudentSessions->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($CCEStudentSessions->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($CCEStudentSessions->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($CCEStudentSessions->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $CCEStudentSessions;
$sSender = @$_GET["sender"];
$sRecipient = @$_GET["recipient"];
$sCc = @$_GET["cc"];
$sBcc = @$_GET["bcc"];
$sContentType = @$_GET["contenttype"];
// Subject
$sSubject = ew_StripSlashes(@$_GET["subject"]);
$sEmailSubject = $sSubject;
// Message
$sContent = ew_StripSlashes(@$_GET["message"]);
$sEmailMessage = $sContent;
// Check sender
if ($sSender == "") {
$this->setMessage($Language->Phrase("EnterSenderEmail"));
return;
}
if (!ew_CheckEmail($sSender)) {
$this->setMessage($Language->Phrase("EnterProperSenderEmail"));
return;
}
// Check recipient
if (!ew_CheckEmailList($sRecipient, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperRecipientEmail"));
return;
}
// Check cc
if (!ew_CheckEmailList($sCc, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperCcEmail"));
return;
}
// Check bcc
if (!ew_CheckEmailList($sBcc, EW_MAX_EMAIL_RECIPIENT)) {
$this->setMessage($Language->Phrase("EnterProperBccEmail"));
return;
}
// Check email sent count
if (!isset($_SESSION[EW_EXPORT_EMAIL_COUNTER]))
$_SESSION[EW_EXPORT_EMAIL_COUNTER] = 0;
if (intval($_SESSION[EW_EXPORT_EMAIL_COUNTER]) > EW_MAX_EMAIL_SENT_COUNT) {
$this->setMessage($Language->Phrase("ExceedMaxEmailExport"));
return;
}
if ($sEmailMessage <> "") {
$sEmailMessage = ew_RemoveXSS($sEmailMessage);
$sEmailMessage .= ($sContentType == "url") ? "\r\n\r\n" : "<br><br>";
}
if ($sContentType == "url") {
$sUrl = ew_ConvertFullUrl(ew_CurrentPage() . "?" . $this->ExportQueryString());
$sEmailMessage .= $sUrl; // send URL only
} else {
$sEmailMessage .= $EmailContent; // send HTML
}
// Send email
$Email = new cEmail();
$Email->Sender = $sSender; // Sender
$Email->Recipient = $sRecipient; // Recipient
$Email->Cc = $sCc; // Cc
$Email->Bcc = $sBcc; // Bcc
$Email->Subject = $sEmailSubject; // Subject
$Email->Content = $sEmailMessage; // Content
$Email->Format = ($sContentType == "url") ? "text" : "html";
$Email->Charset = EW_EMAIL_CHARSET;
$EventArgs = array();
$bEmailSent = FALSE;
if ($CCEStudentSessions->Email_Sending($Email, $EventArgs))
$bEmailSent = $Email->Send();
// Check email sent status
if ($bEmailSent) {
// Update email sent count
$_SESSION[EW_EXPORT_EMAIL_COUNTER]++;
// Sent email success
$this->setMessage($Language->Phrase("SendEmailSuccess"));
} else {
// Sent email failure
$this->setMessage($Email->SendErrDescription);
}
}
// Export QueryString
function ExportQueryString() {
global $CCEStudentSessions;
// Initialize
$sQry = "export=html";
// Build QueryString for search
// Build QueryString for pager
$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCEStudentSessions->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCEStudentSessions->getStartRecordNumber();
return $sQry;
}
// Add search QueryString
function AddSearchQueryString(&$Qry, &$Fld) {
global $CCEStudentSessions;
$FldParm = substr($Fld->FldVar, 2);
$FldSearchValue = $CCEStudentSessions->GetAdvancedSearch("x_" . $FldParm);
if (strval($FldSearchValue) <> "") {
$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
"&z_" . $FldParm . "=" . $CCEStudentSessions->GetAdvancedSearch("z_" . $FldParm);
}
$FldSearchValue2 = $CCEStudentSessions->GetAdvancedSearch("y_" . $FldParm);
if (strval($FldSearchValue2) <> "") {
$Qry .= "&v_" . $FldParm . "=" . $CCEStudentSessions->GetAdvancedSearch("v_" . $FldParm) .
"&y_" . $FldParm . "=" . $FldSearchValue2 .
"&w_" . $FldParm . "=" . $CCEStudentSessions->GetAdvancedSearch("w_" . $FldParm);
}
}
// 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;
}
// ListOptions Load event
function ListOptions_Load() {
// Example:
//$this->ListOptions->Add("new");
//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
//$this->ListOptions->MoveItem("new", 0); // Move to first column
}
// ListOptions Rendered event
function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
}
}
?>