Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEWeeklySessionslist.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 "CCEWeeklySessionsinfo.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
$CCEWeeklySessions_list = new cCCEWeeklySessions_list();
$Page =& $CCEWeeklySessions_list;

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

// Page main
$CCEWeeklySessions_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEWeeklySessions->Export == "") { ?>
<script type="text/javascript">
<!--

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

// page properties
CCEWeeklySessions_list.PageID = "list"; // page ID
CCEWeeklySessions_list.FormID = "fCCEWeeklySessionslist"; // form ID
var EW_PAGE_ID = CCEWeeklySessions_list.PageID; // for backward compatibility

// extend page with ValidateForm function
CCEWeeklySessions_list.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 + "_TrimesterNum"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->TrimesterNum->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_WeekNum"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->WeekNum->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_SessionDate"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->SessionDate->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_StartTime"];
		if (elm && !ew_CheckTime(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->StartTime->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_EndTime"];
		if (elm && !ew_CheckTime(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->EndTime->FldErrMsg()) ?>");
		elm = fobj.elements["x" + infix + "_AssignmentSubDate"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEWeeklySessions->AssignmentSubDate->FldErrMsg()) ?>");

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

// extend page with Form_CustomValidate function
CCEWeeklySessions_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) { ?>
CCEWeeklySessions_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEWeeklySessions_list.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>
<?php } ?>
<?php if ($CCEWeeklySessions->Export == "") { ?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$CCEWeeklySessions_list->lTotalRecs = $CCEWeeklySessions->SelectRecordCount();
	} else {
		if ($rs = $CCEWeeklySessions_list->LoadRecordset())
			$CCEWeeklySessions_list->lTotalRecs = $rs->RecordCount();
	}
	$CCEWeeklySessions_list->lStartRec = 1;
	if ($CCEWeeklySessions_list->lDisplayRecs <= 0 || ($CCEWeeklySessions->Export <> "" && $CCEWeeklySessions->ExportAll)) // Display all records
		$CCEWeeklySessions_list->lDisplayRecs = $CCEWeeklySessions_list->lTotalRecs;
	if (!($CCEWeeklySessions->Export <> "" && $CCEWeeklySessions->ExportAll))
		$CCEWeeklySessions_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $CCEWeeklySessions_list->LoadRecordset($CCEWeeklySessions_list->lStartRec-1, $CCEWeeklySessions_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEWeeklySessions->TableCaption() ?>
<?php if ($CCEWeeklySessions->Export == "" && $CCEWeeklySessions->CurrentAction == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $CCEWeeklySessions_list->ExportPrintUrl ?>"><?php echo $Language->Phrase("PrinterFriendly") ?></a>
&nbsp;&nbsp;<a href="<?php echo $CCEWeeklySessions_list->ExportExcelUrl ?>"><?php echo $Language->Phrase("ExportToExcel") ?></a>
&nbsp;&nbsp;<a href="<?php echo $CCEWeeklySessions_list->ExportWordUrl ?>"><?php echo $Language->Phrase("ExportToWord") ?></a>
&nbsp;&nbsp;<a name="emf_CCEWeeklySessions" id="emf_CCEWeeklySessions" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEWeeklySessions',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCEWeeklySessionslist,sel:false});"><?php echo $Language->Phrase("ExportToEmail") ?></a>
<?php } ?>
</span></p>
<?php if ($Security->CanSearch()) { ?>
<?php if ($CCEWeeklySessions->Export == "" && $CCEWeeklySessions->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCEWeeklySessions_list);" style="text-decoration: none;"><img id="CCEWeeklySessions_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("Search") ?></span><br>
<div id="CCEWeeklySessions_list_SearchPanel">
<form name="fCCEWeeklySessionslistsrch" id="fCCEWeeklySessionslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="CCEWeeklySessions">
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker">
			<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($CCEWeeklySessions->getSessionBasicSearchKeyword()) ?>">
			<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">&nbsp;
			<a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>&nbsp;
		</span></td>
	</tr>
	<tr>
	<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($CCEWeeklySessions->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($CCEWeeklySessions->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($CCEWeeklySessions->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
	</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEWeeklySessions_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCEWeeklySessions->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCEWeeklySessions->CurrentAction <> "gridadd" && $CCEWeeklySessions->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($CCEWeeklySessions_list->Pager)) $CCEWeeklySessions_list->Pager = new cPrevNextPager($CCEWeeklySessions_list->lStartRec, $CCEWeeklySessions_list->lDisplayRecs, $CCEWeeklySessions_list->lTotalRecs) ?>
<?php if ($CCEWeeklySessions_list->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCEWeeklySessions_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 ($CCEWeeklySessions_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 $CCEWeeklySessions_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCEWeeklySessions_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 ($CCEWeeklySessions_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCEWeeklySessions_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 ($CCEWeeklySessions->CurrentAction <> "gridadd" && $CCEWeeklySessions->CurrentAction <> "gridedit") { // Not grid add/edit mode ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEWeeklySessions_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<?php if ($CCEWeeklySessions_list->lTotalRecs > 0) { ?>
<a href="<?php echo $CCEWeeklySessions_list->GridEditUrl ?>"><?php echo $Language->Phrase("GridEditLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php } ?>
<?php } else { // Grid add/edit mode ?>
<?php if ($CCEWeeklySessions->CurrentAction == "gridedit") { ?>
<a href="" onclick="f=document.fCCEWeeklySessionslist;if(CCEWeeklySessions_list.ValidateForm(f))f.submit();return false;"><?php echo $Language->Phrase("GridSaveLink") ?></a>&nbsp;&nbsp;
<a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>a=cancel"><?php echo $Language->Phrase("GridCancelLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCEWeeklySessionslist" id="fCCEWeeklySessionslist" class="ewForm" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" id="t" value="CCEWeeklySessions">
<div id="gmp_CCEWeeklySessions" class="ewGridMiddlePanel">
<?php if ($CCEWeeklySessions_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCEWeeklySessions->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$CCEWeeklySessions_list->RenderListOptions();

// Render list options (header, left)
$CCEWeeklySessions_list->ListOptions->Render("header", "left");
?>
<?php if ($CCEWeeklySessions->TrimesterNum->Visible) { // TrimesterNum ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->TrimesterNum) == "") { ?>
		<td><?php echo $CCEWeeklySessions->TrimesterNum->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->TrimesterNum) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->TrimesterNum->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->TrimesterNum->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->TrimesterNum->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->WeekNum->Visible) { // WeekNum ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->WeekNum) == "") { ?>
		<td><?php echo $CCEWeeklySessions->WeekNum->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->WeekNum) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->WeekNum->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->WeekNum->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->WeekNum->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->SessionDate->Visible) { // SessionDate ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->SessionDate) == "") { ?>
		<td><?php echo $CCEWeeklySessions->SessionDate->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->SessionDate) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->SessionDate->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->SessionDate->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->SessionDate->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->SessionDay->Visible) { // SessionDay ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->SessionDay) == "") { ?>
		<td><?php echo $CCEWeeklySessions->SessionDay->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->SessionDay) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->SessionDay->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->SessionDay->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->SessionDay->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->StartTime->Visible) { // StartTime ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->StartTime) == "") { ?>
		<td><?php echo $CCEWeeklySessions->StartTime->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->StartTime) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->StartTime->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->StartTime->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->StartTime->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->EndTime->Visible) { // EndTime ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->EndTime) == "") { ?>
		<td><?php echo $CCEWeeklySessions->EndTime->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->EndTime) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->EndTime->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->EndTime->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->EndTime->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->Description->Visible) { // Description ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->Description) == "") { ?>
		<td><?php echo $CCEWeeklySessions->Description->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->Description) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->Description->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->Description->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->Description->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->PresentationRef->Visible) { // PresentationRef ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->PresentationRef) == "") { ?>
		<td><?php echo $CCEWeeklySessions->PresentationRef->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->PresentationRef) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->PresentationRef->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->PresentationRef->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->PresentationRef->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->AssignmentRef->Visible) { // AssignmentRef ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->AssignmentRef) == "") { ?>
		<td><?php echo $CCEWeeklySessions->AssignmentRef->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->AssignmentRef) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->AssignmentRef->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->AssignmentRef->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->AssignmentRef->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->AssignmentSubDate->Visible) { // AssignmentSubDate ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->AssignmentSubDate) == "") { ?>
		<td><?php echo $CCEWeeklySessions->AssignmentSubDate->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->AssignmentSubDate) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->AssignmentSubDate->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->AssignmentSubDate->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->AssignmentSubDate->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->PresenterName->Visible) { // PresenterName ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->PresenterName) == "") { ?>
		<td><?php echo $CCEWeeklySessions->PresenterName->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->PresenterName) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->PresenterName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->PresenterName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->PresenterName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($CCEWeeklySessions->Duration->Visible) { // Duration ?>
	<?php if ($CCEWeeklySessions->SortUrl($CCEWeeklySessions->Duration) == "") { ?>
		<td><?php echo $CCEWeeklySessions->Duration->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEWeeklySessions->SortUrl($CCEWeeklySessions->Duration) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEWeeklySessions->Duration->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEWeeklySessions->Duration->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEWeeklySessions->Duration->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)
$CCEWeeklySessions_list->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<?php
if ($CCEWeeklySessions->ExportAll && $CCEWeeklySessions->Export <> "") {
	$CCEWeeklySessions_list->lStopRec = $CCEWeeklySessions_list->lTotalRecs;
} else {
	$CCEWeeklySessions_list->lStopRec = $CCEWeeklySessions_list->lStartRec + $CCEWeeklySessions_list->lDisplayRecs - 1; // Set the last record to display
}
$CCEWeeklySessions_list->lRecCount = $CCEWeeklySessions_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
	$rs->MoveFirst();
	if (!$bSelectLimit && $CCEWeeklySessions_list->lStartRec > 1)
		$rs->Move($CCEWeeklySessions_list->lStartRec - 1);
}

// Initialize aggregate
$CCEWeeklySessions->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCEWeeklySessions_list->RenderRow();
$CCEWeeklySessions_list->lRowCnt = 0;
if ($CCEWeeklySessions->CurrentAction == "gridedit")
	$CCEWeeklySessions_list->lRowIndex = 0;
while (($CCEWeeklySessions->CurrentAction == "gridadd" || !$rs->EOF) &&
	$CCEWeeklySessions_list->lRecCount < $CCEWeeklySessions_list->lStopRec) {
	$CCEWeeklySessions_list->lRecCount++;
	if (intval($CCEWeeklySessions_list->lRecCount) >= intval($CCEWeeklySessions_list->lStartRec)) {
		$CCEWeeklySessions_list->lRowCnt++;
		if ($CCEWeeklySessions->CurrentAction == "gridadd" || $CCEWeeklySessions->CurrentAction == "gridedit")
			$CCEWeeklySessions_list->lRowIndex++;

	// Init row class and style
	$CCEWeeklySessions->CssClass = "";
	$CCEWeeklySessions->CssStyle = "";
	$CCEWeeklySessions->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
	if ($CCEWeeklySessions->CurrentAction == "gridadd") {
		$CCEWeeklySessions_list->LoadDefaultValues(); // Load default values
	} else {
		$CCEWeeklySessions_list->LoadRowValues($rs); // Load row values
	}
	$CCEWeeklySessions->RowType = EW_ROWTYPE_VIEW; // Render view
	if ($CCEWeeklySessions->CurrentAction == "gridedit") { // Grid edit
		$CCEWeeklySessions->RowType = EW_ROWTYPE_EDIT; // Render edit
	}
	if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT && $CCEWeeklySessions->EventCancelled) { // Update failed
		if ($CCEWeeklySessions->CurrentAction == "gridedit")
			$CCEWeeklySessions_list->RestoreCurrentRowFormValues($CCEWeeklySessions_list->lRowIndex); // Restore form values
	}
	if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) // Edit row
		$CCEWeeklySessions_list->lEditRowCnt++;
	if ($CCEWeeklySessions->RowType == EW_ROWTYPE_ADD || $CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Add / Edit row
		$CCEWeeklySessions->RowAttrs = array_merge($CCEWeeklySessions->RowAttrs, array('onmouseover'=>'this.edit=true;ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);'));
		$CCEWeeklySessions->CssClass = "ewTableEditRow";
	}

	// Render row
	$CCEWeeklySessions_list->RenderRow();

	// Render list options
	$CCEWeeklySessions_list->RenderListOptions();
?>
	<tr<?php echo $CCEWeeklySessions->RowAttributes() ?>>
<?php

// Render list options (body, left)
$CCEWeeklySessions_list->ListOptions->Render("body", "left");
?>
	<?php if ($CCEWeeklySessions->TrimesterNum->Visible) { // TrimesterNum ?>
		<td<?php echo $CCEWeeklySessions->TrimesterNum->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_TrimesterNum" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_TrimesterNum" title="<?php echo $CCEWeeklySessions->TrimesterNum->FldTitle() ?>" size="30" value="<?php echo $CCEWeeklySessions->TrimesterNum->EditValue ?>"<?php echo $CCEWeeklySessions->TrimesterNum->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->TrimesterNum->ViewAttributes() ?>><?php echo $CCEWeeklySessions->TrimesterNum->ListViewValue() ?></div>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { ?>
<input type="hidden" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_CCEWeeklySessionID" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_CCEWeeklySessionID" value="<?php echo ew_HtmlEncode($CCEWeeklySessions->CCEWeeklySessionID->CurrentValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->WeekNum->Visible) { // WeekNum ?>
		<td<?php echo $CCEWeeklySessions->WeekNum->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_WeekNum" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_WeekNum" title="<?php echo $CCEWeeklySessions->WeekNum->FldTitle() ?>" size="30" value="<?php echo $CCEWeeklySessions->WeekNum->EditValue ?>"<?php echo $CCEWeeklySessions->WeekNum->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->WeekNum->ViewAttributes() ?>><?php echo $CCEWeeklySessions->WeekNum->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->SessionDate->Visible) { // SessionDate ?>
		<td<?php echo $CCEWeeklySessions->SessionDate->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate" title="<?php echo $CCEWeeklySessions->SessionDate->FldTitle() ?>" value="<?php echo $CCEWeeklySessions->SessionDate->EditValue ?>"<?php echo $CCEWeeklySessions->SessionDate->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate" name="cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate" 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<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate", // input field id
	ifFormat: "%Y/%m/%d", // date format
	button: "cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDate" // button id
});
</script>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->SessionDate->ViewAttributes() ?>><?php echo $CCEWeeklySessions->SessionDate->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->SessionDay->Visible) { // SessionDay ?>
		<td<?php echo $CCEWeeklySessions->SessionDay->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDay" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_SessionDay" title="<?php echo $CCEWeeklySessions->SessionDay->FldTitle() ?>" size="30" maxlength="20" value="<?php echo $CCEWeeklySessions->SessionDay->EditValue ?>"<?php echo $CCEWeeklySessions->SessionDay->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->SessionDay->ViewAttributes() ?>><?php echo $CCEWeeklySessions->SessionDay->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->StartTime->Visible) { // StartTime ?>
		<td<?php echo $CCEWeeklySessions->StartTime->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_StartTime" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_StartTime" title="<?php echo $CCEWeeklySessions->StartTime->FldTitle() ?>" size="30" value="<?php echo $CCEWeeklySessions->StartTime->EditValue ?>"<?php echo $CCEWeeklySessions->StartTime->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->StartTime->ViewAttributes() ?>><?php echo $CCEWeeklySessions->StartTime->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->EndTime->Visible) { // EndTime ?>
		<td<?php echo $CCEWeeklySessions->EndTime->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_EndTime" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_EndTime" title="<?php echo $CCEWeeklySessions->EndTime->FldTitle() ?>" size="30" value="<?php echo $CCEWeeklySessions->EndTime->EditValue ?>"<?php echo $CCEWeeklySessions->EndTime->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->EndTime->ViewAttributes() ?>><?php echo $CCEWeeklySessions->EndTime->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->Description->Visible) { // Description ?>
		<td<?php echo $CCEWeeklySessions->Description->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<textarea name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_Description" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_Description" title="<?php echo $CCEWeeklySessions->Description->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEWeeklySessions->Description->EditAttributes() ?>><?php echo $CCEWeeklySessions->Description->EditValue ?></textarea>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->Description->ViewAttributes() ?>><?php echo $CCEWeeklySessions->Description->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->PresentationRef->Visible) { // PresentationRef ?>
		<td<?php echo $CCEWeeklySessions->PresentationRef->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_PresentationRef" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_PresentationRef" title="<?php echo $CCEWeeklySessions->PresentationRef->FldTitle() ?>" size="30" maxlength="50" value="<?php echo $CCEWeeklySessions->PresentationRef->EditValue ?>"<?php echo $CCEWeeklySessions->PresentationRef->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->PresentationRef->ViewAttributes() ?>><?php echo $CCEWeeklySessions->PresentationRef->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->AssignmentRef->Visible) { // AssignmentRef ?>
		<td<?php echo $CCEWeeklySessions->AssignmentRef->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentRef" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentRef" title="<?php echo $CCEWeeklySessions->AssignmentRef->FldTitle() ?>" size="30" maxlength="50" value="<?php echo $CCEWeeklySessions->AssignmentRef->EditValue ?>"<?php echo $CCEWeeklySessions->AssignmentRef->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->AssignmentRef->ViewAttributes() ?>><?php echo $CCEWeeklySessions->AssignmentRef->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->AssignmentSubDate->Visible) { // AssignmentSubDate ?>
		<td<?php echo $CCEWeeklySessions->AssignmentSubDate->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate" title="<?php echo $CCEWeeklySessions->AssignmentSubDate->FldTitle() ?>" value="<?php echo $CCEWeeklySessions->AssignmentSubDate->EditValue ?>"<?php echo $CCEWeeklySessions->AssignmentSubDate->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate" name="cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate" 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<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate", // input field id
	ifFormat: "%Y/%m/%d", // date format
	button: "cal_x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_AssignmentSubDate" // button id
});
</script>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->AssignmentSubDate->ViewAttributes() ?>><?php echo $CCEWeeklySessions->AssignmentSubDate->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->PresenterName->Visible) { // PresenterName ?>
		<td<?php echo $CCEWeeklySessions->PresenterName->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_PresenterName" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_PresenterName" title="<?php echo $CCEWeeklySessions->PresenterName->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEWeeklySessions->PresenterName->EditValue ?>"<?php echo $CCEWeeklySessions->PresenterName->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->PresenterName->ViewAttributes() ?>><?php echo $CCEWeeklySessions->PresenterName->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($CCEWeeklySessions->Duration->Visible) { // Duration ?>
		<td<?php echo $CCEWeeklySessions->Duration->CellAttributes() ?>>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<input type="text" name="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_Duration" id="x<?php echo $CCEWeeklySessions_list->lRowIndex ?>_Duration" title="<?php echo $CCEWeeklySessions->Duration->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEWeeklySessions->Duration->EditValue ?>"<?php echo $CCEWeeklySessions->Duration->EditAttributes() ?>>
<?php } ?>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<div<?php echo $CCEWeeklySessions->Duration->ViewAttributes() ?>><?php echo $CCEWeeklySessions->Duration->ListViewValue() ?></div>
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$CCEWeeklySessions_list->ListOptions->Render("body", "right");
?>
	</tr>
<?php if ($CCEWeeklySessions->RowType == EW_ROWTYPE_EDIT) { ?>
<?php } ?>
<?php
	}
	if ($CCEWeeklySessions->CurrentAction <> "gridadd")
		$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
<?php if ($CCEWeeklySessions->CurrentAction == "gridedit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="key_count" id="key_count" value="<?php echo $CCEWeeklySessions_list->lRowIndex ?>">
<?php echo $CCEWeeklySessions_list->sMultiSelectKey ?>
<?php } ?>
</div>
</form>
<?php

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($CCEWeeklySessions_list->lTotalRecs > 0) { ?>
<?php if ($CCEWeeklySessions->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCEWeeklySessions->CurrentAction <> "gridadd" && $CCEWeeklySessions->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($CCEWeeklySessions_list->Pager)) $CCEWeeklySessions_list->Pager = new cPrevNextPager($CCEWeeklySessions_list->lStartRec, $CCEWeeklySessions_list->lDisplayRecs, $CCEWeeklySessions_list->lTotalRecs) ?>
<?php if ($CCEWeeklySessions_list->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCEWeeklySessions_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 ($CCEWeeklySessions_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 $CCEWeeklySessions_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCEWeeklySessions_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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 ($CCEWeeklySessions_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>start=<?php echo $CCEWeeklySessions_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">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $CCEWeeklySessions_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCEWeeklySessions_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 ($CCEWeeklySessions_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($CCEWeeklySessions->CurrentAction <> "gridadd" && $CCEWeeklySessions->CurrentAction <> "gridedit") { // Not grid add/edit mode ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEWeeklySessions_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<?php if ($CCEWeeklySessions_list->lTotalRecs > 0) { ?>
<a href="<?php echo $CCEWeeklySessions_list->GridEditUrl ?>"><?php echo $Language->Phrase("GridEditLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php } ?>
<?php } else { // Grid add/edit mode ?>
<?php if ($CCEWeeklySessions->CurrentAction == "gridedit") { ?>
<a href="" onclick="f=document.fCCEWeeklySessionslist;if(CCEWeeklySessions_list.ValidateForm(f))f.submit();return false;"><?php echo $Language->Phrase("GridSaveLink") ?></a>&nbsp;&nbsp;
<a href="<?php echo $CCEWeeklySessions_list->PageUrl() ?>a=cancel"><?php echo $Language->Phrase("GridCancelLink") ?></a>&nbsp;&nbsp;
<?php } ?>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCEWeeklySessions->Export == "" && $CCEWeeklySessions->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCEWeeklySessions->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
$CCEWeeklySessions_list->Page_Terminate();
?>
<?php

//
// Page class
//
class cCCEWeeklySessions_list {

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

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

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

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

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

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

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

		// Table object (CCEWeeklySessions)
		$GLOBALS["CCEWeeklySessions"] = new cCCEWeeklySessions();

		// 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["CCEWeeklySessions"]->AddUrl();
		$this->InlineAddUrl = $this->PageUrl() . "a=add";
		$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
		$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
		$this->MultiDeleteUrl = "CCEWeeklySessionsdelete.php";
		$this->MultiUpdateUrl = "CCEWeeklySessionsupdate.php";

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

		// 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");
		}

		// Create form object
		$objForm = new cFormObj();

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$CCEWeeklySessions->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$CCEWeeklySessions->Export = $_POST["exporttype"];
		} else {
			$CCEWeeklySessions->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $CCEWeeklySessions->Export; // Get export parameter, used in header
		$gsExportFile = $CCEWeeklySessions->TableVar; // Get export file, used in header
		if ($CCEWeeklySessions->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($CCEWeeklySessions->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 = 40;
	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, $CCEWeeklySessions;

		// Search filters
		$sSrchAdvanced = ""; // Advanced search filter
		$sSrchBasic = ""; // Basic search filter
		$sFilter = "";
		if ($this->IsPageRequest()) { // Validate request

			// Handle reset command
			$this->ResetCmd();

			// Check QueryString parameters
			if (@$_GET["a"] <> "") {
				$CCEWeeklySessions->CurrentAction = $_GET["a"];

				// Clear inline mode
				if ($CCEWeeklySessions->CurrentAction == "cancel")
					$this->ClearInlineMode();

				// Switch to grid edit mode
				if ($CCEWeeklySessions->CurrentAction == "gridedit")
					$this->GridEditMode();
			} else {
				if (@$_POST["a_list"] <> "") {
					$CCEWeeklySessions->CurrentAction = $_POST["a_list"]; // Get action

					// Grid Update
					if (($CCEWeeklySessions->CurrentAction == "gridupdate" || $CCEWeeklySessions->CurrentAction == "gridoverwrite") && @$_SESSION[EW_SESSION_INLINE_MODE] == "gridedit")
						$this->GridUpdate();
				}
			}

			// Set up list options
			$this->SetupListOptions();

			// Get basic search values
			$this->LoadBasicSearchValues();

			// Restore search parms from Session
			$this->RestoreSearchParms();

			// Call Recordset SearchValidated event
			$CCEWeeklySessions->Recordset_SearchValidated();

			// Set up sorting order
			$this->SetUpSortOrder();

			// Get basic search criteria
			if ($gsSearchError == "")
				$sSrchBasic = $this->BasicSearchWhere();
		}

		// Restore display records
		if ($CCEWeeklySessions->getRecordsPerPage() <> "") {
			$this->lDisplayRecs = $CCEWeeklySessions->getRecordsPerPage(); // Restore from Session
		} else {
			$this->lDisplayRecs = 40; // Load default
		}

		// Load Sorting Order
		$this->LoadSortOrder();

		// Build search criteria
		if ($sSrchAdvanced <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
		if ($sSrchBasic <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;

		// Call Recordset_Searching event
		$CCEWeeklySessions->Recordset_Searching($this->sSrchWhere);

		// Save search criteria
		if ($this->sSrchWhere <> "") {
			if ($sSrchBasic == "")
				$this->ResetBasicSearchParms();
			$CCEWeeklySessions->setSearchWhere($this->sSrchWhere); // Save to Session
			if (!$this->RestoreSearch) {
				$this->lStartRec = 1; // Reset start record counter
				$CCEWeeklySessions->setStartRecordNumber($this->lStartRec);
			}
		} else {
			$this->sSrchWhere = $CCEWeeklySessions->getSearchWhere();
		}

		// Build filter
		$sFilter = "";
		if (!$Security->CanList())
			$sFilter = "(0=1)"; // Filter all records
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

		// Set up filter in session
		$CCEWeeklySessions->setSessionWhere($sFilter);
		$CCEWeeklySessions->CurrentFilter = "";

		// Export data only
		if (in_array($CCEWeeklySessions->Export, array("html","word","excel","xml","csv","email"))) {
			$this->ExportData();
			if ($CCEWeeklySessions->Export <> "email")
				$this->Page_Terminate(); // Terminate response
			exit();
		}
	}

	//  Exit inline mode
	function ClearInlineMode() {
		global $CCEWeeklySessions;
		$CCEWeeklySessions->CurrentAction = ""; // Clear action
		$_SESSION[EW_SESSION_INLINE_MODE] = ""; // Clear inline mode
	}

	// Switch to Grid Edit mode
	function GridEditMode() {
		$_SESSION[EW_SESSION_INLINE_MODE] = "gridedit"; // Enable grid edit
	}

	// Perform update to grid
	function GridUpdate() {
		global $conn, $Language, $objForm, $gsFormError, $CCEWeeklySessions;
		$rowindex = 1;
		$bGridUpdate = TRUE;

		// Begin transaction
		$conn->BeginTrans();

		// Get old recordset
		$CCEWeeklySessions->CurrentFilter = $this->BuildKeyFilter();
		$sSql = $CCEWeeklySessions->SQL();
		if ($rs = $conn->Execute($sSql)) {
			$rsold = $rs->GetRows();
			$rs->Close();
		}
		$sKey = "";

		// Update row index and get row key
		$objForm->Index = $rowindex;
		$sThisKey = strval($objForm->GetValue("k_key"));

		// Update all rows based on key
		while ($sThisKey <> "") {

			// Load all values and keys
			$this->LoadFormValues(); // Get form values

			// Validate form
			if (!$this->ValidateForm()) {
				$bGridUpdate = FALSE; // Form error, reset action
				$this->setMessage($gsFormError);
			} else {
				if ($this->SetupKeyValues($sThisKey)) { // Set up key values
					$CCEWeeklySessions->SendEmail = FALSE; // Do not send email on update success
					$bGridUpdate = $this->EditRow(); // Update this row
				} else {
					$bGridUpdate = FALSE; // update failed
				}
			}
			if ($bGridUpdate) {
				if ($sKey <> "") $sKey .= ", ";
				$sKey .= $sThisKey;
			} else {
				break;
			}

			// Update row index and get row key
			$rowindex++; // next row
			$objForm->Index = $rowindex;
			$sThisKey = strval($objForm->GetValue("k_key"));
		}
		if ($bGridUpdate) {
			$conn->CommitTrans(); // Commit transaction

			// Get new recordset
			if ($rs = $conn->Execute($sSql)) {
				$rsnew = $rs->GetRows();
				$rs->Close();
			}
			$this->setMessage($Language->Phrase("UpdateSuccess")); // Set update success message
			$this->ClearInlineMode(); // Clear inline edit mode
		} else {
			$conn->RollbackTrans(); // Rollback transaction
			if ($this->getMessage() == "")
				$this->setMessage($Language->Phrase("UpdateFailed")); // Set update failed message
			$CCEWeeklySessions->EventCancelled = TRUE; // Set event cancelled
			$CCEWeeklySessions->CurrentAction = "gridedit"; // Stay in Grid Edit mode
		}
	}

	// Build filter for all keys
	function BuildKeyFilter() {
		global $objForm, $CCEWeeklySessions;
		$sWrkFilter = "";

		// Update row index and get row key
		$rowindex = 1;
		$objForm->Index = $rowindex;
		$sThisKey = strval($objForm->GetValue("k_key"));
		while ($sThisKey <> "") {
			if ($this->SetupKeyValues($sThisKey)) {
				$sFilter = $CCEWeeklySessions->KeyFilter();
				if ($sWrkFilter <> "") $sWrkFilter .= " OR ";
				$sWrkFilter .= $sFilter;
			} else {
				$sWrkFilter = "0=1";
				break;
			}

			// Update row index and get row key
			$rowindex++; // next row
			$objForm->Index = $rowindex;
			$sThisKey = strval($objForm->GetValue("k_key"));
		}
		return $sWrkFilter;
	}

	// Set up key values
	function SetupKeyValues($key) {
		global $CCEWeeklySessions;
		$arrKeyFlds = explode(EW_COMPOSITE_KEY_SEPARATOR, $key);
		if (count($arrKeyFlds) >= 1) {
			$CCEWeeklySessions->CCEWeeklySessionID->setFormValue($arrKeyFlds[0]);
			if (!is_numeric($CCEWeeklySessions->CCEWeeklySessionID->FormValue))
				return FALSE;
		}
		return TRUE;
	}

	// Restore form values for current row
	function RestoreCurrentRowFormValues($idx) {
		global $objForm, $CCEWeeklySessions;

		// Get row based on current index
		$objForm->Index = $idx;
		if ($CCEWeeklySessions->CurrentAction == "gridadd")
			$this->LoadFormValues(); // Load form values
		if ($CCEWeeklySessions->CurrentAction == "gridedit") {
			$sKey = strval($objForm->GetValue("k_key"));
			$arrKeyFlds = explode(EW_COMPOSITE_KEY_SEPARATOR, $sKey);
			if (count($arrKeyFlds) >= 1) {
				if (strval($arrKeyFlds[0]) == strval($CCEWeeklySessions->CCEWeeklySessionID->CurrentValue)) {
					$this->LoadFormValues(); // Load form values
				}
			}
		}
	}

	// Return basic search SQL
	function BasicSearchSQL($Keyword) {
		global $CCEWeeklySessions;
		$sKeyword = ew_AdjustSql($Keyword);
		$sWhere = "";
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->SessionDay, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->Description, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->PresentationRef, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->AssignmentRef, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->PresenterName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $CCEWeeklySessions->Duration, $Keyword);
		return $sWhere;
	}

	// Build basic search SQL
	function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
		$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($lFldDataType == EW_DATATYPE_NUMBER) {
			$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
		} else {
			$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
		}
		if ($Where <> "") $Where .= " OR ";
		$Where .= $sWrk;
	}

	// Return basic search WHERE clause based on search keyword and type
	function BasicSearchWhere() {
		global $Security, $CCEWeeklySessions;
		$sSearchStr = "";
		if (!$Security->CanSearch()) return "";
		$sSearchKeyword = $CCEWeeklySessions->BasicSearchKeyword;
		$sSearchType = $CCEWeeklySessions->BasicSearchType;
		if ($sSearchKeyword <> "") {
			$sSearch = trim($sSearchKeyword);
			if ($sSearchType <> "") {
				while (strpos($sSearch, "  ") !== FALSE)
					$sSearch = str_replace("  ", " ", $sSearch);
				$arKeyword = explode(" ", trim($sSearch));
				foreach ($arKeyword as $sKeyword) {
					if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
					$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
				}
			} else {
				$sSearchStr = $this->BasicSearchSQL($sSearch);
			}
		}
		if ($sSearchKeyword <> "") {
			$CCEWeeklySessions->setSessionBasicSearchKeyword($sSearchKeyword);
			$CCEWeeklySessions->setSessionBasicSearchType($sSearchType);
		}
		return $sSearchStr;
	}

	// Clear all search parameters
	function ResetSearchParms() {
		global $CCEWeeklySessions;

		// Clear search WHERE clause
		$this->sSrchWhere = "";
		$CCEWeeklySessions->setSearchWhere($this->sSrchWhere);

		// Clear basic search parameters
		$this->ResetBasicSearchParms();
	}

	// Clear all basic search parameters
	function ResetBasicSearchParms() {
		global $CCEWeeklySessions;
		$CCEWeeklySessions->setSessionBasicSearchKeyword("");
		$CCEWeeklySessions->setSessionBasicSearchType("");
	}

	// Restore all search parameters
	function RestoreSearchParms() {
		global $CCEWeeklySessions;
		$bRestore = TRUE;
		if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
		$this->RestoreSearch = $bRestore;
		if ($bRestore) {

			// Restore basic search values
			$CCEWeeklySessions->BasicSearchKeyword = $CCEWeeklySessions->getSessionBasicSearchKeyword();
			$CCEWeeklySessions->BasicSearchType = $CCEWeeklySessions->getSessionBasicSearchType();
		}
	}

	// Set up sort parameters
	function SetUpSortOrder() {
		global $CCEWeeklySessions;

		// Check for Ctrl pressed
		$bCtrl = (@$_GET["ctrl"] <> "");

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$CCEWeeklySessions->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$CCEWeeklySessions->CurrentOrderType = @$_GET["ordertype"];
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->TrimesterNum, $bCtrl); // TrimesterNum
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->WeekNum, $bCtrl); // WeekNum
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->SessionDate, $bCtrl); // SessionDate
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->SessionDay, $bCtrl); // SessionDay
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->StartTime, $bCtrl); // StartTime
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->EndTime, $bCtrl); // EndTime
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->Description, $bCtrl); // Description
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->PresentationRef, $bCtrl); // PresentationRef
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->AssignmentRef, $bCtrl); // AssignmentRef
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->AssignmentSubDate, $bCtrl); // AssignmentSubDate
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->PresenterName, $bCtrl); // PresenterName
			$CCEWeeklySessions->UpdateSort($CCEWeeklySessions->Duration, $bCtrl); // Duration
			$CCEWeeklySessions->setStartRecordNumber(1); // Reset start position
		}
	}

	// Load sort order parameters
	function LoadSortOrder() {
		global $CCEWeeklySessions;
		$sOrderBy = $CCEWeeklySessions->getSessionOrderBy(); // Get ORDER BY from Session
		if ($sOrderBy == "") {
			if ($CCEWeeklySessions->SqlOrderBy() <> "") {
				$sOrderBy = $CCEWeeklySessions->SqlOrderBy();
				$CCEWeeklySessions->setSessionOrderBy($sOrderBy);
			}
		}
	}

	// Reset command
	// cmd=reset (Reset search parameters)
	// cmd=resetall (Reset search and master/detail parameters)
	// cmd=resetsort (Reset sort parameters)
	function ResetCmd() {
		global $CCEWeeklySessions;

		// Get reset command
		if (@$_GET["cmd"] <> "") {
			$sCmd = $_GET["cmd"];

			// Reset search criteria
			if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
				$this->ResetSearchParms();

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$CCEWeeklySessions->setSessionOrderBy($sOrderBy);
				$CCEWeeklySessions->TrimesterNum->setSort("");
				$CCEWeeklySessions->WeekNum->setSort("");
				$CCEWeeklySessions->SessionDate->setSort("");
				$CCEWeeklySessions->SessionDay->setSort("");
				$CCEWeeklySessions->StartTime->setSort("");
				$CCEWeeklySessions->EndTime->setSort("");
				$CCEWeeklySessions->Description->setSort("");
				$CCEWeeklySessions->PresentationRef->setSort("");
				$CCEWeeklySessions->AssignmentRef->setSort("");
				$CCEWeeklySessions->AssignmentSubDate->setSort("");
				$CCEWeeklySessions->PresenterName->setSort("");
				$CCEWeeklySessions->Duration->setSort("");
			}

			// Reset start position
			$this->lStartRec = 1;
			$CCEWeeklySessions->setStartRecordNumber($this->lStartRec);
		}
	}

	// Set up list options
	function SetupListOptions() {
		global $Security, $CCEWeeklySessions;

		// "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 ($CCEWeeklySessions->Export <> "" ||
			$CCEWeeklySessions->CurrentAction == "gridadd" ||
			$CCEWeeklySessions->CurrentAction == "gridedit")
			$this->ListOptions->HideAllOptions();
	}

	// Render list options
	function RenderListOptions() {
		global $Security, $Language, $CCEWeeklySessions;
		$this->ListOptions->LoadDefault();

		// "edit"
		$oListOpt =& $this->ListOptions->Items["edit"];
		if ($Security->CanEdit() && $oListOpt->Visible) {
			$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . $Language->Phrase("EditLink") . "</a>";
		}

		// "delete"
		$oListOpt =& $this->ListOptions->Items["delete"];
		if ($Security->CanDelete() && $oListOpt->Visible)
			$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . $Language->Phrase("DeleteLink") . "</a>";
		if ($CCEWeeklySessions->CurrentAction == "gridedit")
			$this->sMultiSelectKey .= "<input type=\"hidden\" name=\"k" . $this->lRowIndex . "_key\" id=\"k" . $this->lRowIndex . "_key\" value=\"" . $CCEWeeklySessions->CCEWeeklySessionID->CurrentValue . "\">";
		$this->RenderListOptionsExt();

		// Call ListOptions_Rendered event
		$this->ListOptions_Rendered();
	}

	function RenderListOptionsExt() {
		global $Security, $Language, $CCEWeeklySessions;
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $CCEWeeklySessions;
		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];
				$CCEWeeklySessions->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;
					}
					$CCEWeeklySessions->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $CCEWeeklySessions->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
			$CCEWeeklySessions->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
			$CCEWeeklySessions->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
			$CCEWeeklySessions->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load basic search values
	function LoadBasicSearchValues() {
		global $CCEWeeklySessions;
		$CCEWeeklySessions->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
		$CCEWeeklySessions->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $CCEWeeklySessions;
		$CCEWeeklySessions->TrimesterNum->setFormValue($objForm->GetValue("x_TrimesterNum"));
		$CCEWeeklySessions->WeekNum->setFormValue($objForm->GetValue("x_WeekNum"));
		$CCEWeeklySessions->SessionDate->setFormValue($objForm->GetValue("x_SessionDate"));
		$CCEWeeklySessions->SessionDate->CurrentValue = ew_UnFormatDateTime($CCEWeeklySessions->SessionDate->CurrentValue, 5);
		$CCEWeeklySessions->SessionDay->setFormValue($objForm->GetValue("x_SessionDay"));
		$CCEWeeklySessions->StartTime->setFormValue($objForm->GetValue("x_StartTime"));
		$CCEWeeklySessions->EndTime->setFormValue($objForm->GetValue("x_EndTime"));
		$CCEWeeklySessions->Description->setFormValue($objForm->GetValue("x_Description"));
		$CCEWeeklySessions->PresentationRef->setFormValue($objForm->GetValue("x_PresentationRef"));
		$CCEWeeklySessions->AssignmentRef->setFormValue($objForm->GetValue("x_AssignmentRef"));
		$CCEWeeklySessions->AssignmentSubDate->setFormValue($objForm->GetValue("x_AssignmentSubDate"));
		$CCEWeeklySessions->AssignmentSubDate->CurrentValue = ew_UnFormatDateTime($CCEWeeklySessions->AssignmentSubDate->CurrentValue, 5);
		$CCEWeeklySessions->PresenterName->setFormValue($objForm->GetValue("x_PresenterName"));
		$CCEWeeklySessions->Duration->setFormValue($objForm->GetValue("x_Duration"));
		$CCEWeeklySessions->CCEWeeklySessionID->setFormValue($objForm->GetValue("x_CCEWeeklySessionID"));
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm, $CCEWeeklySessions;
		$CCEWeeklySessions->CCEWeeklySessionID->CurrentValue = $CCEWeeklySessions->CCEWeeklySessionID->FormValue;
		$CCEWeeklySessions->TrimesterNum->CurrentValue = $CCEWeeklySessions->TrimesterNum->FormValue;
		$CCEWeeklySessions->WeekNum->CurrentValue = $CCEWeeklySessions->WeekNum->FormValue;
		$CCEWeeklySessions->SessionDate->CurrentValue = $CCEWeeklySessions->SessionDate->FormValue;
		$CCEWeeklySessions->SessionDate->CurrentValue = ew_UnFormatDateTime($CCEWeeklySessions->SessionDate->CurrentValue, 5);
		$CCEWeeklySessions->SessionDay->CurrentValue = $CCEWeeklySessions->SessionDay->FormValue;
		$CCEWeeklySessions->StartTime->CurrentValue = $CCEWeeklySessions->StartTime->FormValue;
		$CCEWeeklySessions->EndTime->CurrentValue = $CCEWeeklySessions->EndTime->FormValue;
		$CCEWeeklySessions->Description->CurrentValue = $CCEWeeklySessions->Description->FormValue;
		$CCEWeeklySessions->PresentationRef->CurrentValue = $CCEWeeklySessions->PresentationRef->FormValue;
		$CCEWeeklySessions->AssignmentRef->CurrentValue = $CCEWeeklySessions->AssignmentRef->FormValue;
		$CCEWeeklySessions->AssignmentSubDate->CurrentValue = $CCEWeeklySessions->AssignmentSubDate->FormValue;
		$CCEWeeklySessions->AssignmentSubDate->CurrentValue = ew_UnFormatDateTime($CCEWeeklySessions->AssignmentSubDate->CurrentValue, 5);
		$CCEWeeklySessions->PresenterName->CurrentValue = $CCEWeeklySessions->PresenterName->FormValue;
		$CCEWeeklySessions->Duration->CurrentValue = $CCEWeeklySessions->Duration->FormValue;
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $CCEWeeklySessions;

		// Call Recordset Selecting event
		$CCEWeeklySessions->Recordset_Selecting($CCEWeeklySessions->CurrentFilter);

		// Load List page SQL
		$sSql = $CCEWeeklySessions->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $offset, $rowcnt";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$CCEWeeklySessions->Recordset_Selected($rs);
		return $rs;
	}

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCEWeeklySessions;
		$CCEWeeklySessions->CCEWeeklySessionID->setDbValue($rs->fields('CCEWeeklySessionID'));
		$CCEWeeklySessions->ScheduleID->setDbValue($rs->fields('ScheduleID'));
		$CCEWeeklySessions->TrimesterNum->setDbValue($rs->fields('TrimesterNum'));
		$CCEWeeklySessions->WeekNum->setDbValue($rs->fields('WeekNum'));
		$CCEWeeklySessions->SessionDate->setDbValue($rs->fields('SessionDate'));
		$CCEWeeklySessions->SessionDay->setDbValue($rs->fields('SessionDay'));
		$CCEWeeklySessions->StartTime->setDbValue($rs->fields('StartTime'));
		$CCEWeeklySessions->EndTime->setDbValue($rs->fields('EndTime'));
		$CCEWeeklySessions->Description->setDbValue($rs->fields('Description'));
		$CCEWeeklySessions->PresentationRef->setDbValue($rs->fields('PresentationRef'));
		$CCEWeeklySessions->AssignmentRef->setDbValue($rs->fields('AssignmentRef'));
		$CCEWeeklySessions->AssignmentSubDate->setDbValue($rs->fields('AssignmentSubDate'));
		$CCEWeeklySessions->PresenterName->setDbValue($rs->fields('PresenterName'));
		$CCEWeeklySessions->Duration->setDbValue($rs->fields('Duration'));
	}

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

		// Initialize URLs
		$this->ViewUrl = $CCEWeeklySessions->ViewUrl();
		$this->EditUrl = $CCEWeeklySessions->EditUrl();
		$this->InlineEditUrl = $CCEWeeklySessions->InlineEditUrl();
		$this->CopyUrl = $CCEWeeklySessions->CopyUrl();
		$this->InlineCopyUrl = $CCEWeeklySessions->InlineCopyUrl();
		$this->DeleteUrl = $CCEWeeklySessions->DeleteUrl();

		// Call Row_Rendering event
		$CCEWeeklySessions->Row_Rendering();

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

		$CCEWeeklySessions->TrimesterNum->CellCssStyle = ""; $CCEWeeklySessions->TrimesterNum->CellCssClass = "";
		$CCEWeeklySessions->TrimesterNum->CellAttrs = array(); $CCEWeeklySessions->TrimesterNum->ViewAttrs = array(); $CCEWeeklySessions->TrimesterNum->EditAttrs = array();

		// WeekNum
		$CCEWeeklySessions->WeekNum->CellCssStyle = ""; $CCEWeeklySessions->WeekNum->CellCssClass = "";
		$CCEWeeklySessions->WeekNum->CellAttrs = array(); $CCEWeeklySessions->WeekNum->ViewAttrs = array(); $CCEWeeklySessions->WeekNum->EditAttrs = array();

		// SessionDate
		$CCEWeeklySessions->SessionDate->CellCssStyle = ""; $CCEWeeklySessions->SessionDate->CellCssClass = "";
		$CCEWeeklySessions->SessionDate->CellAttrs = array(); $CCEWeeklySessions->SessionDate->ViewAttrs = array(); $CCEWeeklySessions->SessionDate->EditAttrs = array();

		// SessionDay
		$CCEWeeklySessions->SessionDay->CellCssStyle = ""; $CCEWeeklySessions->SessionDay->CellCssClass = "";
		$CCEWeeklySessions->SessionDay->CellAttrs = array(); $CCEWeeklySessions->SessionDay->ViewAttrs = array(); $CCEWeeklySessions->SessionDay->EditAttrs = array();

		// StartTime
		$CCEWeeklySessions->StartTime->CellCssStyle = ""; $CCEWeeklySessions->StartTime->CellCssClass = "";
		$CCEWeeklySessions->StartTime->CellAttrs = array(); $CCEWeeklySessions->StartTime->ViewAttrs = array(); $CCEWeeklySessions->StartTime->EditAttrs = array();

		// EndTime
		$CCEWeeklySessions->EndTime->CellCssStyle = ""; $CCEWeeklySessions->EndTime->CellCssClass = "";
		$CCEWeeklySessions->EndTime->CellAttrs = array(); $CCEWeeklySessions->EndTime->ViewAttrs = array(); $CCEWeeklySessions->EndTime->EditAttrs = array();

		// Description
		$CCEWeeklySessions->Description->CellCssStyle = ""; $CCEWeeklySessions->Description->CellCssClass = "";
		$CCEWeeklySessions->Description->CellAttrs = array(); $CCEWeeklySessions->Description->ViewAttrs = array(); $CCEWeeklySessions->Description->EditAttrs = array();

		// PresentationRef
		$CCEWeeklySessions->PresentationRef->CellCssStyle = ""; $CCEWeeklySessions->PresentationRef->CellCssClass = "";
		$CCEWeeklySessions->PresentationRef->CellAttrs = array(); $CCEWeeklySessions->PresentationRef->ViewAttrs = array(); $CCEWeeklySessions->PresentationRef->EditAttrs = array();

		// AssignmentRef
		$CCEWeeklySessions->AssignmentRef->CellCssStyle = ""; $CCEWeeklySessions->AssignmentRef->CellCssClass = "";
		$CCEWeeklySessions->AssignmentRef->CellAttrs = array(); $CCEWeeklySessions->AssignmentRef->ViewAttrs = array(); $CCEWeeklySessions->AssignmentRef->EditAttrs = array();

		// AssignmentSubDate
		$CCEWeeklySessions->AssignmentSubDate->CellCssStyle = ""; $CCEWeeklySessions->AssignmentSubDate->CellCssClass = "";
		$CCEWeeklySessions->AssignmentSubDate->CellAttrs = array(); $CCEWeeklySessions->AssignmentSubDate->ViewAttrs = array(); $CCEWeeklySessions->AssignmentSubDate->EditAttrs = array();

		// PresenterName
		$CCEWeeklySessions->PresenterName->CellCssStyle = ""; $CCEWeeklySessions->PresenterName->CellCssClass = "";
		$CCEWeeklySessions->PresenterName->CellAttrs = array(); $CCEWeeklySessions->PresenterName->ViewAttrs = array(); $CCEWeeklySessions->PresenterName->EditAttrs = array();

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

			// ScheduleID
			$CCEWeeklySessions->ScheduleID->ViewValue = $CCEWeeklySessions->ScheduleID->CurrentValue;
			$CCEWeeklySessions->ScheduleID->CssStyle = "";
			$CCEWeeklySessions->ScheduleID->CssClass = "";
			$CCEWeeklySessions->ScheduleID->ViewCustomAttributes = "";

			// TrimesterNum
			$CCEWeeklySessions->TrimesterNum->ViewValue = $CCEWeeklySessions->TrimesterNum->CurrentValue;
			$CCEWeeklySessions->TrimesterNum->CssStyle = "";
			$CCEWeeklySessions->TrimesterNum->CssClass = "";
			$CCEWeeklySessions->TrimesterNum->ViewCustomAttributes = "";

			// WeekNum
			$CCEWeeklySessions->WeekNum->ViewValue = $CCEWeeklySessions->WeekNum->CurrentValue;
			$CCEWeeklySessions->WeekNum->CssStyle = "";
			$CCEWeeklySessions->WeekNum->CssClass = "";
			$CCEWeeklySessions->WeekNum->ViewCustomAttributes = "";

			// SessionDate
			$CCEWeeklySessions->SessionDate->ViewValue = $CCEWeeklySessions->SessionDate->CurrentValue;
			$CCEWeeklySessions->SessionDate->ViewValue = ew_FormatDateTime($CCEWeeklySessions->SessionDate->ViewValue, 5);
			$CCEWeeklySessions->SessionDate->CssStyle = "";
			$CCEWeeklySessions->SessionDate->CssClass = "";
			$CCEWeeklySessions->SessionDate->ViewCustomAttributes = "";

			// SessionDay
			$CCEWeeklySessions->SessionDay->ViewValue = $CCEWeeklySessions->SessionDay->CurrentValue;
			$CCEWeeklySessions->SessionDay->CssStyle = "";
			$CCEWeeklySessions->SessionDay->CssClass = "";
			$CCEWeeklySessions->SessionDay->ViewCustomAttributes = "";

			// StartTime
			$CCEWeeklySessions->StartTime->ViewValue = $CCEWeeklySessions->StartTime->CurrentValue;
			$CCEWeeklySessions->StartTime->ViewValue = ew_FormatDateTime($CCEWeeklySessions->StartTime->ViewValue, 4);
			$CCEWeeklySessions->StartTime->CssStyle = "";
			$CCEWeeklySessions->StartTime->CssClass = "";
			$CCEWeeklySessions->StartTime->ViewCustomAttributes = "";

			// EndTime
			$CCEWeeklySessions->EndTime->ViewValue = $CCEWeeklySessions->EndTime->CurrentValue;
			$CCEWeeklySessions->EndTime->ViewValue = ew_FormatDateTime($CCEWeeklySessions->EndTime->ViewValue, 4);
			$CCEWeeklySessions->EndTime->CssStyle = "";
			$CCEWeeklySessions->EndTime->CssClass = "";
			$CCEWeeklySessions->EndTime->ViewCustomAttributes = "";

			// Description
			$CCEWeeklySessions->Description->ViewValue = $CCEWeeklySessions->Description->CurrentValue;
			$CCEWeeklySessions->Description->CssStyle = "";
			$CCEWeeklySessions->Description->CssClass = "";
			$CCEWeeklySessions->Description->ViewCustomAttributes = "";

			// PresentationRef
			$CCEWeeklySessions->PresentationRef->ViewValue = $CCEWeeklySessions->PresentationRef->CurrentValue;
			$CCEWeeklySessions->PresentationRef->CssStyle = "";
			$CCEWeeklySessions->PresentationRef->CssClass = "";
			$CCEWeeklySessions->PresentationRef->ViewCustomAttributes = "";

			// AssignmentRef
			$CCEWeeklySessions->AssignmentRef->ViewValue = $CCEWeeklySessions->AssignmentRef->CurrentValue;
			$CCEWeeklySessions->AssignmentRef->CssStyle = "";
			$CCEWeeklySessions->AssignmentRef->CssClass = "";
			$CCEWeeklySessions->AssignmentRef->ViewCustomAttributes = "";

			// AssignmentSubDate
			$CCEWeeklySessions->AssignmentSubDate->ViewValue = $CCEWeeklySessions->AssignmentSubDate->CurrentValue;
			$CCEWeeklySessions->AssignmentSubDate->ViewValue = ew_FormatDateTime($CCEWeeklySessions->AssignmentSubDate->ViewValue, 5);
			$CCEWeeklySessions->AssignmentSubDate->CssStyle = "";
			$CCEWeeklySessions->AssignmentSubDate->CssClass = "";
			$CCEWeeklySessions->AssignmentSubDate->ViewCustomAttributes = "";

			// PresenterName
			$CCEWeeklySessions->PresenterName->ViewValue = $CCEWeeklySessions->PresenterName->CurrentValue;
			$CCEWeeklySessions->PresenterName->CssStyle = "";
			$CCEWeeklySessions->PresenterName->CssClass = "";
			$CCEWeeklySessions->PresenterName->ViewCustomAttributes = "";

			// Duration
			$CCEWeeklySessions->Duration->ViewValue = $CCEWeeklySessions->Duration->CurrentValue;
			$CCEWeeklySessions->Duration->CssStyle = "";
			$CCEWeeklySessions->Duration->CssClass = "";
			$CCEWeeklySessions->Duration->ViewCustomAttributes = "";

			// TrimesterNum
			$CCEWeeklySessions->TrimesterNum->HrefValue = "";
			$CCEWeeklySessions->TrimesterNum->TooltipValue = "";

			// WeekNum
			$CCEWeeklySessions->WeekNum->HrefValue = "";
			$CCEWeeklySessions->WeekNum->TooltipValue = "";

			// SessionDate
			$CCEWeeklySessions->SessionDate->HrefValue = "";
			$CCEWeeklySessions->SessionDate->TooltipValue = "";

			// SessionDay
			$CCEWeeklySessions->SessionDay->HrefValue = "";
			$CCEWeeklySessions->SessionDay->TooltipValue = "";

			// StartTime
			$CCEWeeklySessions->StartTime->HrefValue = "";
			$CCEWeeklySessions->StartTime->TooltipValue = "";

			// EndTime
			$CCEWeeklySessions->EndTime->HrefValue = "";
			$CCEWeeklySessions->EndTime->TooltipValue = "";

			// Description
			$CCEWeeklySessions->Description->HrefValue = "";
			$CCEWeeklySessions->Description->TooltipValue = "";

			// PresentationRef
			$CCEWeeklySessions->PresentationRef->HrefValue = "";
			$CCEWeeklySessions->PresentationRef->TooltipValue = "";

			// AssignmentRef
			$CCEWeeklySessions->AssignmentRef->HrefValue = "";
			$CCEWeeklySessions->AssignmentRef->TooltipValue = "";

			// AssignmentSubDate
			$CCEWeeklySessions->AssignmentSubDate->HrefValue = "";
			$CCEWeeklySessions->AssignmentSubDate->TooltipValue = "";

			// PresenterName
			$CCEWeeklySessions->PresenterName->HrefValue = "";
			$CCEWeeklySessions->PresenterName->TooltipValue = "";

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

			// TrimesterNum
			$CCEWeeklySessions->TrimesterNum->EditCustomAttributes = "";
			$CCEWeeklySessions->TrimesterNum->EditValue = ew_HtmlEncode($CCEWeeklySessions->TrimesterNum->CurrentValue);

			// WeekNum
			$CCEWeeklySessions->WeekNum->EditCustomAttributes = "";
			$CCEWeeklySessions->WeekNum->EditValue = ew_HtmlEncode($CCEWeeklySessions->WeekNum->CurrentValue);

			// SessionDate
			$CCEWeeklySessions->SessionDate->EditCustomAttributes = "";
			$CCEWeeklySessions->SessionDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEWeeklySessions->SessionDate->CurrentValue, 5));

			// SessionDay
			$CCEWeeklySessions->SessionDay->EditCustomAttributes = "";
			$CCEWeeklySessions->SessionDay->EditValue = ew_HtmlEncode($CCEWeeklySessions->SessionDay->CurrentValue);

			// StartTime
			$CCEWeeklySessions->StartTime->EditCustomAttributes = "";
			$CCEWeeklySessions->StartTime->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEWeeklySessions->StartTime->CurrentValue, 4));

			// EndTime
			$CCEWeeklySessions->EndTime->EditCustomAttributes = "";
			$CCEWeeklySessions->EndTime->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEWeeklySessions->EndTime->CurrentValue, 4));

			// Description
			$CCEWeeklySessions->Description->EditCustomAttributes = "";
			$CCEWeeklySessions->Description->EditValue = ew_HtmlEncode($CCEWeeklySessions->Description->CurrentValue);

			// PresentationRef
			$CCEWeeklySessions->PresentationRef->EditCustomAttributes = "";
			$CCEWeeklySessions->PresentationRef->EditValue = ew_HtmlEncode($CCEWeeklySessions->PresentationRef->CurrentValue);

			// AssignmentRef
			$CCEWeeklySessions->AssignmentRef->EditCustomAttributes = "";
			$CCEWeeklySessions->AssignmentRef->EditValue = ew_HtmlEncode($CCEWeeklySessions->AssignmentRef->CurrentValue);

			// AssignmentSubDate
			$CCEWeeklySessions->AssignmentSubDate->EditCustomAttributes = "";
			$CCEWeeklySessions->AssignmentSubDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEWeeklySessions->AssignmentSubDate->CurrentValue, 5));

			// PresenterName
			$CCEWeeklySessions->PresenterName->EditCustomAttributes = "";
			$CCEWeeklySessions->PresenterName->EditValue = ew_HtmlEncode($CCEWeeklySessions->PresenterName->CurrentValue);

			// Duration
			$CCEWeeklySessions->Duration->EditCustomAttributes = "";
			$CCEWeeklySessions->Duration->EditValue = ew_HtmlEncode($CCEWeeklySessions->Duration->CurrentValue);

			// Edit refer script
			// TrimesterNum

			$CCEWeeklySessions->TrimesterNum->HrefValue = "";

			// WeekNum
			$CCEWeeklySessions->WeekNum->HrefValue = "";

			// SessionDate
			$CCEWeeklySessions->SessionDate->HrefValue = "";

			// SessionDay
			$CCEWeeklySessions->SessionDay->HrefValue = "";

			// StartTime
			$CCEWeeklySessions->StartTime->HrefValue = "";

			// EndTime
			$CCEWeeklySessions->EndTime->HrefValue = "";

			// Description
			$CCEWeeklySessions->Description->HrefValue = "";

			// PresentationRef
			$CCEWeeklySessions->PresentationRef->HrefValue = "";

			// AssignmentRef
			$CCEWeeklySessions->AssignmentRef->HrefValue = "";

			// AssignmentSubDate
			$CCEWeeklySessions->AssignmentSubDate->HrefValue = "";

			// PresenterName
			$CCEWeeklySessions->PresenterName->HrefValue = "";

			// Duration
			$CCEWeeklySessions->Duration->HrefValue = "";
		}

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

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

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

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckInteger($CCEWeeklySessions->TrimesterNum->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->TrimesterNum->FldErrMsg();
		}
		if (!ew_CheckInteger($CCEWeeklySessions->WeekNum->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->WeekNum->FldErrMsg();
		}
		if (!ew_CheckDate($CCEWeeklySessions->SessionDate->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->SessionDate->FldErrMsg();
		}
		if (!ew_CheckTime($CCEWeeklySessions->StartTime->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->StartTime->FldErrMsg();
		}
		if (!ew_CheckTime($CCEWeeklySessions->EndTime->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->EndTime->FldErrMsg();
		}
		if (!ew_CheckDate($CCEWeeklySessions->AssignmentSubDate->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEWeeklySessions->AssignmentSubDate->FldErrMsg();
		}

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

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

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

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

			// TrimesterNum
			$CCEWeeklySessions->TrimesterNum->SetDbValueDef($rsnew, $CCEWeeklySessions->TrimesterNum->CurrentValue, NULL, FALSE);

			// WeekNum
			$CCEWeeklySessions->WeekNum->SetDbValueDef($rsnew, $CCEWeeklySessions->WeekNum->CurrentValue, NULL, FALSE);

			// SessionDate
			$CCEWeeklySessions->SessionDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEWeeklySessions->SessionDate->CurrentValue, 5, FALSE), NULL);

			// SessionDay
			$CCEWeeklySessions->SessionDay->SetDbValueDef($rsnew, $CCEWeeklySessions->SessionDay->CurrentValue, NULL, FALSE);

			// StartTime
			$CCEWeeklySessions->StartTime->SetDbValueDef($rsnew, ew_FormatDateTime($CCEWeeklySessions->StartTime->CurrentValue, 4), NULL, FALSE);

			// EndTime
			$CCEWeeklySessions->EndTime->SetDbValueDef($rsnew, ew_FormatDateTime($CCEWeeklySessions->EndTime->CurrentValue, 4), NULL, FALSE);

			// Description
			$CCEWeeklySessions->Description->SetDbValueDef($rsnew, $CCEWeeklySessions->Description->CurrentValue, NULL, FALSE);

			// PresentationRef
			$CCEWeeklySessions->PresentationRef->SetDbValueDef($rsnew, $CCEWeeklySessions->PresentationRef->CurrentValue, NULL, FALSE);

			// AssignmentRef
			$CCEWeeklySessions->AssignmentRef->SetDbValueDef($rsnew, $CCEWeeklySessions->AssignmentRef->CurrentValue, NULL, FALSE);

			// AssignmentSubDate
			$CCEWeeklySessions->AssignmentSubDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEWeeklySessions->AssignmentSubDate->CurrentValue, 5, FALSE), NULL);

			// PresenterName
			$CCEWeeklySessions->PresenterName->SetDbValueDef($rsnew, $CCEWeeklySessions->PresenterName->CurrentValue, NULL, FALSE);

			// Duration
			$CCEWeeklySessions->Duration->SetDbValueDef($rsnew, $CCEWeeklySessions->Duration->CurrentValue, NULL, FALSE);

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

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

	// Export data in HTML/CSV/Word/Excel/XML/Email format
	function ExportData() {
		global $CCEWeeklySessions;
		$utf8 = FALSE;
		$bSelectLimit = EW_SELECT_LIMIT;

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $CCEWeeklySessions->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;

		// Export all
		if ($CCEWeeklySessions->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 ($CCEWeeklySessions->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($CCEWeeklySessions, "h");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($CCEWeeklySessions->ScheduleID);
				$ExportDoc->ExportCaption($CCEWeeklySessions->TrimesterNum);
				$ExportDoc->ExportCaption($CCEWeeklySessions->WeekNum);
				$ExportDoc->ExportCaption($CCEWeeklySessions->SessionDate);
				$ExportDoc->ExportCaption($CCEWeeklySessions->SessionDay);
				$ExportDoc->ExportCaption($CCEWeeklySessions->StartTime);
				$ExportDoc->ExportCaption($CCEWeeklySessions->EndTime);
				$ExportDoc->ExportCaption($CCEWeeklySessions->Description);
				$ExportDoc->ExportCaption($CCEWeeklySessions->PresentationRef);
				$ExportDoc->ExportCaption($CCEWeeklySessions->AssignmentRef);
				$ExportDoc->ExportCaption($CCEWeeklySessions->AssignmentSubDate);
				$ExportDoc->ExportCaption($CCEWeeklySessions->PresenterName);
				$ExportDoc->ExportCaption($CCEWeeklySessions->Duration);
				$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
				$CCEWeeklySessions->CssClass = "";
				$CCEWeeklySessions->CssStyle = "";
				$CCEWeeklySessions->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($CCEWeeklySessions->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('ScheduleID', $CCEWeeklySessions->ScheduleID->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('TrimesterNum', $CCEWeeklySessions->TrimesterNum->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('WeekNum', $CCEWeeklySessions->WeekNum->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('SessionDate', $CCEWeeklySessions->SessionDate->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('SessionDay', $CCEWeeklySessions->SessionDay->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('StartTime', $CCEWeeklySessions->StartTime->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('EndTime', $CCEWeeklySessions->EndTime->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('Description', $CCEWeeklySessions->Description->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('PresentationRef', $CCEWeeklySessions->PresentationRef->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('AssignmentRef', $CCEWeeklySessions->AssignmentRef->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('AssignmentSubDate', $CCEWeeklySessions->AssignmentSubDate->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('PresenterName', $CCEWeeklySessions->PresenterName->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
					$XmlDoc->AddField('Duration', $CCEWeeklySessions->Duration->ExportValue($CCEWeeklySessions->Export, $CCEWeeklySessions->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($CCEWeeklySessions->ScheduleID);
					$ExportDoc->ExportField($CCEWeeklySessions->TrimesterNum);
					$ExportDoc->ExportField($CCEWeeklySessions->WeekNum);
					$ExportDoc->ExportField($CCEWeeklySessions->SessionDate);
					$ExportDoc->ExportField($CCEWeeklySessions->SessionDay);
					$ExportDoc->ExportField($CCEWeeklySessions->StartTime);
					$ExportDoc->ExportField($CCEWeeklySessions->EndTime);
					$ExportDoc->ExportField($CCEWeeklySessions->Description);
					$ExportDoc->ExportField($CCEWeeklySessions->PresentationRef);
					$ExportDoc->ExportField($CCEWeeklySessions->AssignmentRef);
					$ExportDoc->ExportField($CCEWeeklySessions->AssignmentSubDate);
					$ExportDoc->ExportField($CCEWeeklySessions->PresenterName);
					$ExportDoc->ExportField($CCEWeeklySessions->Duration);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($CCEWeeklySessions->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($CCEWeeklySessions->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

		// Write debug message if enabled
		if (EW_DEBUG_ENABLED)
			echo ew_DebugMsg();

		// Output data
		if ($CCEWeeklySessions->Export == "xml") {
			header("Content-Type: text/xml");
			echo $XmlDoc->XML();
		} elseif ($CCEWeeklySessions->Export == "email") {
			$this->ExportEmail($ExportDoc->Text);
			$this->Page_Terminate($CCEWeeklySessions->ExportReturnUrl());
		} else {
			echo $ExportDoc->Text;
		}
	}

	// Export email
	function ExportEmail($EmailContent) {
		global $Language, $CCEWeeklySessions;
		$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 ($CCEWeeklySessions->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 $CCEWeeklySessions;

		// Initialize
		$sQry = "export=html";

		// Build QueryString for search
		if ($CCEWeeklySessions->getSessionBasicSearchKeyword() <> "") {
			$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCEWeeklySessions->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCEWeeklySessions->getSessionBasicSearchType();
		}

		// Build QueryString for pager
		$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCEWeeklySessions->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCEWeeklySessions->getStartRecordNumber();
		return $sQry;
	}

	// Add search QueryString
	function AddSearchQueryString(&$Qry, &$Fld) {
		global $CCEWeeklySessions;
		$FldParm = substr($Fld->FldVar, 2);
		$FldSearchValue = $CCEWeeklySessions->GetAdvancedSearch("x_" . $FldParm);
		if (strval($FldSearchValue) <> "") {
			$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
				"&z_" . $FldParm . "=" . $CCEWeeklySessions->GetAdvancedSearch("z_" . $FldParm);
		}
		$FldSearchValue2 = $CCEWeeklySessions->GetAdvancedSearch("y_" . $FldParm);
		if (strval($FldSearchValue2) <> "") {
			$Qry .= "&v_" . $FldParm . "=" . $CCEWeeklySessions->GetAdvancedSearch("v_" . $FldParm) .
				"&y_" . $FldParm . "=" . $FldSearchValue2 .
				"&w_" . $FldParm . "=" . $CCEWeeklySessions->GetAdvancedSearch("w_" . $FldParm);
		}
	}

		// Page Load event
	function Page_Load() {

	    //echo "Page Load";
	    cceWeeklySessionsPageLoad($this);
	}

	// 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";

	}
}
?>