| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEStudentActivitieslist.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 "CCEStudentActivitiesinfo.php" ?>
<?php include "CCEAssignmentsinfo.php" ?>
<?php include "CCEStudentsinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Create page object
$CCEStudentActivities_list = new cCCEStudentActivities_list();
$Page =& $CCEStudentActivities_list;
// Page init
$CCEStudentActivities_list->Page_Init();
// Page main
$CCEStudentActivities_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEStudentActivities->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var CCEStudentActivities_list = new ew_Page("CCEStudentActivities_list");
// page properties
CCEStudentActivities_list.PageID = "list"; // page ID
CCEStudentActivities_list.FormID = "fCCEStudentActivitieslist"; // form ID
var EW_PAGE_ID = CCEStudentActivities_list.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
CCEStudentActivities_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) { ?>
CCEStudentActivities_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentActivities_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js");
//-->
</script>
<?php } ?>
<?php if ($CCEStudentActivities->Export == "") { ?>
<?php
$gsMasterReturnUrl = "CCEAssignmentslist.php";
if ($CCEStudentActivities_list->sDbMasterFilter <> "" && $CCEStudentActivities->getCurrentMasterTable() == "CCEAssignments") {
if ($CCEStudentActivities_list->bMasterRecordExists) {
if ($CCEStudentActivities->getCurrentMasterTable() == $CCEStudentActivities->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "CCEAssignmentsmaster.php" ?>
<?php
}
}
?>
<?php
$gsMasterReturnUrl = "CCEStudentslist.php";
if ($CCEStudentActivities_list->sDbMasterFilter <> "" && $CCEStudentActivities->getCurrentMasterTable() == "CCEStudents") {
if ($CCEStudentActivities_list->bMasterRecordExists) {
if ($CCEStudentActivities->getCurrentMasterTable() == $CCEStudentActivities->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "CCEStudentsmaster.php" ?>
<?php
}
}
?>
<?php } ?>
<?php
$bSelectLimit = EW_SELECT_LIMIT;
if ($bSelectLimit) {
$CCEStudentActivities_list->lTotalRecs = $CCEStudentActivities->SelectRecordCount();
} else {
if ($rs = $CCEStudentActivities_list->LoadRecordset())
$CCEStudentActivities_list->lTotalRecs = $rs->RecordCount();
}
$CCEStudentActivities_list->lStartRec = 1;
if ($CCEStudentActivities_list->lDisplayRecs <= 0 || ($CCEStudentActivities->Export <> "" && $CCEStudentActivities->ExportAll)) // Display all records
$CCEStudentActivities_list->lDisplayRecs = $CCEStudentActivities_list->lTotalRecs;
if (!($CCEStudentActivities->Export <> "" && $CCEStudentActivities->ExportAll))
$CCEStudentActivities_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
$rs = $CCEStudentActivities_list->LoadRecordset($CCEStudentActivities_list->lStartRec-1, $CCEStudentActivities_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentActivities->TableCaption() ?>
<?php if ($CCEStudentActivities->Export == "" && $CCEStudentActivities->CurrentAction == "") { ?>
<a href="<?php echo $CCEStudentActivities_list->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
<a href="<?php echo $CCEStudentActivities_list->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
<a href="<?php echo $CCEStudentActivities_list->ExportWordUrl ?>"><img src='images/exportdoc.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' width='16' height='16' border='0'></a>
<a name="emf_CCEStudentActivities" id="emf_CCEStudentActivities" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEStudentActivities',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCEStudentActivitieslist,sel:false});"><img src='images/exportemail.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
</span></p>
<?php if ($Security->CanSearch()) { ?>
<?php if ($CCEStudentActivities->Export == "" && $CCEStudentActivities->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCEStudentActivities_list);" style="text-decoration: none;"><img id="CCEStudentActivities_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker"> <?php echo $Language->Phrase("Search") ?></span><br>
<div id="CCEStudentActivities_list_SearchPanel">
<form name="fCCEStudentActivitieslistsrch" id="fCCEStudentActivitieslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="CCEStudentActivities">
<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($CCEStudentActivities->getSessionBasicSearchKeyword()) ?>">
<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">
<a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>
</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 ($CCEStudentActivities->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($CCEStudentActivities->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label> <label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($CCEStudentActivities->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();
$CCEStudentActivities_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCEStudentActivities->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCEStudentActivities->CurrentAction <> "gridadd" && $CCEStudentActivities->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($CCEStudentActivities_list->Pager)) $CCEStudentActivities_list->Pager = new cPrevNextPager($CCEStudentActivities_list->lStartRec, $CCEStudentActivities_list->lDisplayRecs, $CCEStudentActivities_list->lTotalRecs) ?>
<?php if ($CCEStudentActivities_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEStudentActivities_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 ($CCEStudentActivities_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 $CCEStudentActivities_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEStudentActivities_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 ($CCEStudentActivities_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEStudentActivities_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEStudentActivities_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEStudentActivities_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEStudentActivities_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEStudentActivities_list->sSrchWhere == "0=101") { ?>
<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
<?php } ?>
<?php } else { ?>
<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
<?php } ?>
<?php } ?>
</td>
</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEStudentActivities_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCEStudentActivitieslist" id="fCCEStudentActivitieslist" class="ewForm" action="" method="post">
<div id="gmp_CCEStudentActivities" class="ewGridMiddlePanel">
<?php if ($CCEStudentActivities_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCEStudentActivities->TableCustomInnerHtml ?>
<thead><!-- Table header -->
<tr class="ewTableHeader">
<?php
// Render list options
$CCEStudentActivities_list->RenderListOptions();
// Render list options (header, left)
$CCEStudentActivities_list->ListOptions->Render("header", "left");
?>
<?php if ($CCEStudentActivities->CCEStudentID->Visible) { // CCEStudentID ?>
<?php if ($CCEStudentActivities->SortUrl($CCEStudentActivities->CCEStudentID) == "") { ?>
<td><?php echo $CCEStudentActivities->CCEStudentID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentActivities->SortUrl($CCEStudentActivities->CCEStudentID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentActivities->CCEStudentID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentActivities->CCEStudentID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentActivities->CCEStudentID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEStudentActivities->CCEActivityID->Visible) { // CCEActivityID ?>
<?php if ($CCEStudentActivities->SortUrl($CCEStudentActivities->CCEActivityID) == "") { ?>
<td><?php echo $CCEStudentActivities->CCEActivityID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentActivities->SortUrl($CCEStudentActivities->CCEActivityID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentActivities->CCEActivityID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentActivities->CCEActivityID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentActivities->CCEActivityID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEStudentActivities->ActivityRef->Visible) { // ActivityRef ?>
<?php if ($CCEStudentActivities->SortUrl($CCEStudentActivities->ActivityRef) == "") { ?>
<td><?php echo $CCEStudentActivities->ActivityRef->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentActivities->SortUrl($CCEStudentActivities->ActivityRef) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentActivities->ActivityRef->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentActivities->ActivityRef->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentActivities->ActivityRef->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEStudentActivities->AcceptStatus->Visible) { // AcceptStatus ?>
<?php if ($CCEStudentActivities->SortUrl($CCEStudentActivities->AcceptStatus) == "") { ?>
<td><?php echo $CCEStudentActivities->AcceptStatus->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEStudentActivities->SortUrl($CCEStudentActivities->AcceptStatus) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEStudentActivities->AcceptStatus->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEStudentActivities->AcceptStatus->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEStudentActivities->AcceptStatus->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)
$CCEStudentActivities_list->ListOptions->Render("header", "right");
?>
</tr>
</thead>
<?php
if ($CCEStudentActivities->ExportAll && $CCEStudentActivities->Export <> "") {
$CCEStudentActivities_list->lStopRec = $CCEStudentActivities_list->lTotalRecs;
} else {
$CCEStudentActivities_list->lStopRec = $CCEStudentActivities_list->lStartRec + $CCEStudentActivities_list->lDisplayRecs - 1; // Set the last record to display
}
$CCEStudentActivities_list->lRecCount = $CCEStudentActivities_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $CCEStudentActivities_list->lStartRec > 1)
$rs->Move($CCEStudentActivities_list->lStartRec - 1);
}
// Initialize aggregate
$CCEStudentActivities->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCEStudentActivities_list->RenderRow();
$CCEStudentActivities_list->lRowCnt = 0;
while (($CCEStudentActivities->CurrentAction == "gridadd" || !$rs->EOF) &&
$CCEStudentActivities_list->lRecCount < $CCEStudentActivities_list->lStopRec) {
$CCEStudentActivities_list->lRecCount++;
if (intval($CCEStudentActivities_list->lRecCount) >= intval($CCEStudentActivities_list->lStartRec)) {
$CCEStudentActivities_list->lRowCnt++;
// Init row class and style
$CCEStudentActivities->CssClass = "";
$CCEStudentActivities->CssStyle = "";
$CCEStudentActivities->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
if ($CCEStudentActivities->CurrentAction == "gridadd") {
$CCEStudentActivities_list->LoadDefaultValues(); // Load default values
} else {
$CCEStudentActivities_list->LoadRowValues($rs); // Load row values
}
$CCEStudentActivities->RowType = EW_ROWTYPE_VIEW; // Render view
// Render row
$CCEStudentActivities_list->RenderRow();
// Render list options
$CCEStudentActivities_list->RenderListOptions();
?>
<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
<?php
// Render list options (body, left)
$CCEStudentActivities_list->ListOptions->Render("body", "left");
?>
<?php if ($CCEStudentActivities->CCEStudentID->Visible) { // CCEStudentID ?>
<td<?php echo $CCEStudentActivities->CCEStudentID->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentActivities->CCEStudentID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEStudentActivities->CCEActivityID->Visible) { // CCEActivityID ?>
<td<?php echo $CCEStudentActivities->CCEActivityID->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->CCEActivityID->ViewAttributes() ?>><?php echo $CCEStudentActivities->CCEActivityID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEStudentActivities->ActivityRef->Visible) { // ActivityRef ?>
<td<?php echo $CCEStudentActivities->ActivityRef->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->ActivityRef->ViewAttributes() ?>><?php echo $CCEStudentActivities->ActivityRef->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEStudentActivities->AcceptStatus->Visible) { // AcceptStatus ?>
<td<?php echo $CCEStudentActivities->AcceptStatus->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->AcceptStatus->ViewAttributes() ?>><?php echo $CCEStudentActivities->AcceptStatus->ListViewValue() ?></div>
</td>
<?php } ?>
<?php
// Render list options (body, right)
$CCEStudentActivities_list->ListOptions->Render("body", "right");
?>
</tr>
<?php
}
if ($CCEStudentActivities->CurrentAction <> "gridadd")
$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php
// Close recordset
if ($rs)
$rs->Close();
?>
<?php if ($CCEStudentActivities_list->lTotalRecs > 0) { ?>
<?php if ($CCEStudentActivities->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCEStudentActivities->CurrentAction <> "gridadd" && $CCEStudentActivities->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($CCEStudentActivities_list->Pager)) $CCEStudentActivities_list->Pager = new cPrevNextPager($CCEStudentActivities_list->lStartRec, $CCEStudentActivities_list->lDisplayRecs, $CCEStudentActivities_list->lTotalRecs) ?>
<?php if ($CCEStudentActivities_list->Pager->RecordCount > 0) { ?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?> </span></td>
<!--first page button-->
<?php if ($CCEStudentActivities_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 ($CCEStudentActivities_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 $CCEStudentActivities_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEStudentActivities_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_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 ($CCEStudentActivities_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEStudentActivities_list->PageUrl() ?>start=<?php echo $CCEStudentActivities_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>
<?php } else { ?>
<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
<?php } ?>
<td><span class="phpmaker"> <?php echo $Language->Phrase("of") ?> <?php echo $CCEStudentActivities_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEStudentActivities_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEStudentActivities_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEStudentActivities_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEStudentActivities_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 ($CCEStudentActivities_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEStudentActivities_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCEStudentActivities->Export == "" && $CCEStudentActivities->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCEStudentActivities->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
$CCEStudentActivities_list->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEStudentActivities_list {
// Page ID
var $PageID = 'list';
// Table name
var $TableName = 'CCEStudentActivities';
// Page object name
var $PageObjName = 'CCEStudentActivities_list';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEStudentActivities;
if ($CCEStudentActivities->UseTokenInUrl) $PageUrl .= "t=" . $CCEStudentActivities->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, $CCEStudentActivities;
if ($CCEStudentActivities->UseTokenInUrl) {
if ($objForm)
return ($CCEStudentActivities->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEStudentActivities->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEStudentActivities)
$GLOBALS["CCEStudentActivities"] = new cCCEStudentActivities();
// 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["CCEStudentActivities"]->AddUrl();
$this->InlineAddUrl = $this->PageUrl() . "a=add";
$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
$this->MultiDeleteUrl = "CCEStudentActivitiesdelete.php";
$this->MultiUpdateUrl = "CCEStudentActivitiesupdate.php";
// Table object (CCEAssignments)
$GLOBALS['CCEAssignments'] = new cCCEAssignments();
// Table object (CCEStudents)
$GLOBALS['CCEStudents'] = new cCCEStudents();
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'list', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCEStudentActivities', 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 $CCEStudentActivities;
// Security
$Security = new cAdvancedSecurity();
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->TableName);
$Security->TablePermission_Loaded();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
if (!$Security->CanList()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
// Get export parameters
if (@$_GET["export"] <> "") {
$CCEStudentActivities->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$CCEStudentActivities->Export = $_POST["exporttype"];
} else {
$CCEStudentActivities->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $CCEStudentActivities->Export; // Get export parameter, used in header
$gsExportFile = $CCEStudentActivities->TableVar; // Get export file, used in header
if ($CCEStudentActivities->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($CCEStudentActivities->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
}
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
// Class variables
var $ListOptions; // List options
var $lDisplayRecs = 20;
var $lStartRec;
var $lStopRec;
var $lTotalRecs = 0;
var $lRecRange = 10;
var $sSrchWhere = ""; // Search WHERE clause
var $lRecCnt = 0; // Record count
var $lEditRowCnt;
var $lRowCnt;
var $lRowIndex; // Row index
var $lRecPerRow = 0;
var $lColCnt = 0;
var $sDbMasterFilter = ""; // Master filter
var $sDbDetailFilter = ""; // Detail filter
var $bMasterRecordExists;
var $sMultiSelectKey;
var $RestoreSearch;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Security, $CCEStudentActivities;
// Search filters
$sSrchAdvanced = ""; // Advanced search filter
$sSrchBasic = ""; // Basic search filter
$sFilter = "";
if ($this->IsPageRequest()) { // Validate request
// Handle reset command
$this->ResetCmd();
// Set up master detail parameters
$this->SetUpMasterDetail();
// Set up list options
$this->SetupListOptions();
// Get basic search values
$this->LoadBasicSearchValues();
// Restore search parms from Session
$this->RestoreSearchParms();
// Call Recordset SearchValidated event
$CCEStudentActivities->Recordset_SearchValidated();
// Set up sorting order
$this->SetUpSortOrder();
// Get basic search criteria
if ($gsSearchError == "")
$sSrchBasic = $this->BasicSearchWhere();
}
// Restore display records
if ($CCEStudentActivities->getRecordsPerPage() <> "") {
$this->lDisplayRecs = $CCEStudentActivities->getRecordsPerPage(); // Restore from Session
} else {
$this->lDisplayRecs = 20; // 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
$CCEStudentActivities->Recordset_Searching($this->sSrchWhere);
// Save search criteria
if ($this->sSrchWhere <> "") {
if ($sSrchBasic == "")
$this->ResetBasicSearchParms();
$CCEStudentActivities->setSearchWhere($this->sSrchWhere); // Save to Session
if (!$this->RestoreSearch) {
$this->lStartRec = 1; // Reset start record counter
$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
}
} else {
$this->sSrchWhere = $CCEStudentActivities->getSearchWhere();
}
// Build filter
$sFilter = "";
if (!$Security->CanList())
$sFilter = "(0=1)"; // Filter all records
// Restore master/detail filter
$this->sDbMasterFilter = $CCEStudentActivities->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEStudentActivities->getDetailFilter(); // Restore detail filter
if ($this->sDbDetailFilter <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
if ($this->sSrchWhere <> "")
$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;
// Load master record
if ($CCEStudentActivities->getMasterFilter() <> "" && $CCEStudentActivities->getCurrentMasterTable() == "CCEAssignments") {
global $CCEAssignments;
$rsmaster = $CCEAssignments->LoadRs($this->sDbMasterFilter);
$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
if (!$this->bMasterRecordExists) {
$CCEStudentActivities->setMasterFilter(""); // Clear master filter
$CCEStudentActivities->setDetailFilter(""); // Clear detail filter
$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
$this->Page_Terminate($CCEStudentActivities->getReturnUrl()); // Return to caller
} else {
$CCEAssignments->LoadListRowValues($rsmaster);
$CCEAssignments->RowType = EW_ROWTYPE_MASTER; // Master row
$CCEAssignments->RenderListRow();
$rsmaster->Close();
}
}
// Load master record
if ($CCEStudentActivities->getMasterFilter() <> "" && $CCEStudentActivities->getCurrentMasterTable() == "CCEStudents") {
global $CCEStudents;
$rsmaster = $CCEStudents->LoadRs($this->sDbMasterFilter);
$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
if (!$this->bMasterRecordExists) {
$CCEStudentActivities->setMasterFilter(""); // Clear master filter
$CCEStudentActivities->setDetailFilter(""); // Clear detail filter
$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
$this->Page_Terminate($CCEStudentActivities->getReturnUrl()); // Return to caller
} else {
$CCEStudents->LoadListRowValues($rsmaster);
$CCEStudents->RowType = EW_ROWTYPE_MASTER; // Master row
$CCEStudents->RenderListRow();
$rsmaster->Close();
}
}
// Set up filter in session
$CCEStudentActivities->setSessionWhere($sFilter);
$CCEStudentActivities->CurrentFilter = "";
// Export data only
if (in_array($CCEStudentActivities->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($CCEStudentActivities->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
}
// Return basic search SQL
function BasicSearchSQL($Keyword) {
global $CCEStudentActivities;
$sKeyword = ew_AdjustSql($Keyword);
$sWhere = "";
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->ActivityRef, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile1, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile2, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile3, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile4, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile5, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AssignmentFile6, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->AcceptedBy, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEStudentActivities->Comments, $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, $CCEStudentActivities;
$sSearchStr = "";
if (!$Security->CanSearch()) return "";
$sSearchKeyword = $CCEStudentActivities->BasicSearchKeyword;
$sSearchType = $CCEStudentActivities->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 <> "") {
$CCEStudentActivities->setSessionBasicSearchKeyword($sSearchKeyword);
$CCEStudentActivities->setSessionBasicSearchType($sSearchType);
}
return $sSearchStr;
}
// Clear all search parameters
function ResetSearchParms() {
global $CCEStudentActivities;
// Clear search WHERE clause
$this->sSrchWhere = "";
$CCEStudentActivities->setSearchWhere($this->sSrchWhere);
// Clear basic search parameters
$this->ResetBasicSearchParms();
}
// Clear all basic search parameters
function ResetBasicSearchParms() {
global $CCEStudentActivities;
$CCEStudentActivities->setSessionBasicSearchKeyword("");
$CCEStudentActivities->setSessionBasicSearchType("");
}
// Restore all search parameters
function RestoreSearchParms() {
global $CCEStudentActivities;
$bRestore = TRUE;
if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
$this->RestoreSearch = $bRestore;
if ($bRestore) {
// Restore basic search values
$CCEStudentActivities->BasicSearchKeyword = $CCEStudentActivities->getSessionBasicSearchKeyword();
$CCEStudentActivities->BasicSearchType = $CCEStudentActivities->getSessionBasicSearchType();
}
}
// Set up sort parameters
function SetUpSortOrder() {
global $CCEStudentActivities;
// Check for Ctrl pressed
$bCtrl = (@$_GET["ctrl"] <> "");
// Check for "order" parameter
if (@$_GET["order"] <> "") {
$CCEStudentActivities->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
$CCEStudentActivities->CurrentOrderType = @$_GET["ordertype"];
$CCEStudentActivities->UpdateSort($CCEStudentActivities->CCEStudentID, $bCtrl); // CCEStudentID
$CCEStudentActivities->UpdateSort($CCEStudentActivities->CCEActivityID, $bCtrl); // CCEActivityID
$CCEStudentActivities->UpdateSort($CCEStudentActivities->ActivityRef, $bCtrl); // ActivityRef
$CCEStudentActivities->UpdateSort($CCEStudentActivities->AcceptStatus, $bCtrl); // AcceptStatus
$CCEStudentActivities->setStartRecordNumber(1); // Reset start position
}
}
// Load sort order parameters
function LoadSortOrder() {
global $CCEStudentActivities;
$sOrderBy = $CCEStudentActivities->getSessionOrderBy(); // Get ORDER BY from Session
if ($sOrderBy == "") {
if ($CCEStudentActivities->SqlOrderBy() <> "") {
$sOrderBy = $CCEStudentActivities->SqlOrderBy();
$CCEStudentActivities->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 $CCEStudentActivities;
// Get reset command
if (@$_GET["cmd"] <> "") {
$sCmd = $_GET["cmd"];
// Reset search criteria
if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
$this->ResetSearchParms();
// Reset master/detail keys
if (strtolower($sCmd) == "resetall") {
$CCEStudentActivities->getCurrentMasterTable = ""; // Clear master table
$CCEStudentActivities->setMasterFilter(""); // Clear master filter
$this->sDbMasterFilter = "";
$CCEStudentActivities->setDetailFilter(""); // Clear detail filter
$this->sDbDetailFilter = "";
$CCEStudentActivities->CCEAssignmentID->setSessionValue("");
$CCEStudentActivities->CCEStudentID->setSessionValue("");
}
// Reset sorting order
if (strtolower($sCmd) == "resetsort") {
$sOrderBy = "";
$CCEStudentActivities->setSessionOrderBy($sOrderBy);
$CCEStudentActivities->CCEStudentID->setSort("");
$CCEStudentActivities->CCEActivityID->setSort("");
$CCEStudentActivities->ActivityRef->setSort("");
$CCEStudentActivities->AcceptStatus->setSort("");
}
// Reset start position
$this->lStartRec = 1;
$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
}
}
// Set up list options
function SetupListOptions() {
global $Security, $CCEStudentActivities;
// "view"
$this->ListOptions->Add("view");
$item =& $this->ListOptions->Items["view"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanView();
$item->OnLeft = FALSE;
// "edit"
$this->ListOptions->Add("edit");
$item =& $this->ListOptions->Items["edit"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanEdit();
$item->OnLeft = FALSE;
// "delete"
$this->ListOptions->Add("delete");
$item =& $this->ListOptions->Items["delete"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanDelete();
$item->OnLeft = FALSE;
// Call ListOptions_Load event
$this->ListOptions_Load();
if ($CCEStudentActivities->Export <> "" ||
$CCEStudentActivities->CurrentAction == "gridadd" ||
$CCEStudentActivities->CurrentAction == "gridedit")
$this->ListOptions->HideAllOptions();
}
// Render list options
function RenderListOptions() {
global $Security, $Language, $CCEStudentActivities;
$this->ListOptions->LoadDefault();
// "view"
$oListOpt =& $this->ListOptions->Items["view"];
if ($Security->CanView() && $oListOpt->Visible)
$oListOpt->Body = "<a href=\"" . $this->ViewUrl . "\">" . "<img src=\"images/view.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("ViewLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
// "edit"
$oListOpt =& $this->ListOptions->Items["edit"];
if ($Security->CanEdit() && $oListOpt->Visible) {
$oListOpt->Body = "<a href=\"" . $this->EditUrl . "\">" . "<img src=\"images/edit.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("EditLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
}
// "delete"
$oListOpt =& $this->ListOptions->Items["delete"];
if ($Security->CanDelete() && $oListOpt->Visible)
$oListOpt->Body = "<a" . "" . " href=\"" . $this->DeleteUrl . "\">" . "<img src=\"images/delete.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DeleteLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . "</a>";
$this->RenderListOptionsExt();
// Call ListOptions_Rendered event
$this->ListOptions_Rendered();
}
function RenderListOptionsExt() {
global $Security, $Language, $CCEStudentActivities;
}
// Set up starting record parameters
function SetUpStartRec() {
global $CCEStudentActivities;
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];
$CCEStudentActivities->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;
}
$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $CCEStudentActivities->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
$CCEStudentActivities->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
$CCEStudentActivities->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
$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
}
}
// Load basic search values
function LoadBasicSearchValues() {
global $CCEStudentActivities;
$CCEStudentActivities->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
$CCEStudentActivities->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $CCEStudentActivities;
// Call Recordset Selecting event
$CCEStudentActivities->Recordset_Selecting($CCEStudentActivities->CurrentFilter);
// Load List page SQL
$sSql = $CCEStudentActivities->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$CCEStudentActivities->Recordset_Selected($rs);
return $rs;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEStudentActivities;
$sFilter = $CCEStudentActivities->KeyFilter();
// Call Row Selecting event
$CCEStudentActivities->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEStudentActivities->CurrentFilter = $sFilter;
$sSql = $CCEStudentActivities->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEStudentActivities->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEStudentActivities;
$CCEStudentActivities->CCEStudentAssigID->setDbValue($rs->fields('CCEStudentAssigID'));
$CCEStudentActivities->CCEStudentID->setDbValue($rs->fields('CCEStudentID'));
$CCEStudentActivities->CCEAssignmentID->setDbValue($rs->fields('CCEAssignmentID'));
$CCEStudentActivities->CCEActivityID->setDbValue($rs->fields('CCEActivityID'));
$CCEStudentActivities->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
$CCEStudentActivities->ActivityRef->setDbValue($rs->fields('ActivityRef'));
$CCEStudentActivities->AssignmentFile1->Upload->DbValue = $rs->fields('AssignmentFile1');
$CCEStudentActivities->AssignmentFile2->Upload->DbValue = $rs->fields('AssignmentFile2');
$CCEStudentActivities->AssignmentFile3->Upload->DbValue = $rs->fields('AssignmentFile3');
$CCEStudentActivities->AssignmentFile4->Upload->DbValue = $rs->fields('AssignmentFile4');
$CCEStudentActivities->AssignmentFile5->Upload->DbValue = $rs->fields('AssignmentFile5');
$CCEStudentActivities->AssignmentFile6->Upload->DbValue = $rs->fields('AssignmentFile6');
$CCEStudentActivities->DateSubmitted->setDbValue($rs->fields('DateSubmitted'));
$CCEStudentActivities->AcceptStatus->setDbValue($rs->fields('AcceptStatus'));
$CCEStudentActivities->AcceptedBy->setDbValue($rs->fields('AcceptedBy'));
$CCEStudentActivities->DateAccepted->setDbValue($rs->fields('DateAccepted'));
$CCEStudentActivities->Comments->setDbValue($rs->fields('Comments'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEStudentActivities;
// Initialize URLs
$this->ViewUrl = $CCEStudentActivities->ViewUrl();
$this->EditUrl = $CCEStudentActivities->EditUrl();
$this->InlineEditUrl = $CCEStudentActivities->InlineEditUrl();
$this->CopyUrl = $CCEStudentActivities->CopyUrl();
$this->InlineCopyUrl = $CCEStudentActivities->InlineCopyUrl();
$this->DeleteUrl = $CCEStudentActivities->DeleteUrl();
// Call Row_Rendering event
$CCEStudentActivities->Row_Rendering();
// Common render codes for all row types
// CCEStudentID
$CCEStudentActivities->CCEStudentID->CellCssStyle = ""; $CCEStudentActivities->CCEStudentID->CellCssClass = "";
$CCEStudentActivities->CCEStudentID->CellAttrs = array(); $CCEStudentActivities->CCEStudentID->ViewAttrs = array(); $CCEStudentActivities->CCEStudentID->EditAttrs = array();
// CCEActivityID
$CCEStudentActivities->CCEActivityID->CellCssStyle = ""; $CCEStudentActivities->CCEActivityID->CellCssClass = "";
$CCEStudentActivities->CCEActivityID->CellAttrs = array(); $CCEStudentActivities->CCEActivityID->ViewAttrs = array(); $CCEStudentActivities->CCEActivityID->EditAttrs = array();
// ActivityRef
$CCEStudentActivities->ActivityRef->CellCssStyle = ""; $CCEStudentActivities->ActivityRef->CellCssClass = "";
$CCEStudentActivities->ActivityRef->CellAttrs = array(); $CCEStudentActivities->ActivityRef->ViewAttrs = array(); $CCEStudentActivities->ActivityRef->EditAttrs = array();
// AcceptStatus
$CCEStudentActivities->AcceptStatus->CellCssStyle = ""; $CCEStudentActivities->AcceptStatus->CellCssClass = "";
$CCEStudentActivities->AcceptStatus->CellAttrs = array(); $CCEStudentActivities->AcceptStatus->ViewAttrs = array(); $CCEStudentActivities->AcceptStatus->EditAttrs = array();
if ($CCEStudentActivities->RowType == EW_ROWTYPE_VIEW) { // View row
// CCEStudentAssigID
$CCEStudentActivities->CCEStudentAssigID->ViewValue = $CCEStudentActivities->CCEStudentAssigID->CurrentValue;
$CCEStudentActivities->CCEStudentAssigID->CssStyle = "";
$CCEStudentActivities->CCEStudentAssigID->CssClass = "";
$CCEStudentActivities->CCEStudentAssigID->ViewCustomAttributes = "";
// CCEStudentID
if (strval($CCEStudentActivities->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentActivities->CCEStudentID->CurrentValue) . "";
$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `FirstName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$CCEStudentActivities->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$CCEStudentActivities->CCEStudentID->ViewValue = $CCEStudentActivities->CCEStudentID->CurrentValue;
}
} else {
$CCEStudentActivities->CCEStudentID->ViewValue = NULL;
}
$CCEStudentActivities->CCEStudentID->CssStyle = "";
$CCEStudentActivities->CCEStudentID->CssClass = "";
$CCEStudentActivities->CCEStudentID->ViewCustomAttributes = "";
// CCEAssignmentID
if (strval($CCEStudentActivities->CCEAssignmentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEAssignmentID` = " . ew_AdjustSql($CCEStudentActivities->CCEAssignmentID->CurrentValue) . "";
$sSqlWrk = "SELECT `RefNum`, `AssignmentName` FROM `CCEAssignments`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `RefNum`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->CCEAssignmentID->ViewValue = $rswrk->fields('RefNum');
$CCEStudentActivities->CCEAssignmentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('AssignmentName');
$rswrk->Close();
} else {
$CCEStudentActivities->CCEAssignmentID->ViewValue = $CCEStudentActivities->CCEAssignmentID->CurrentValue;
}
} else {
$CCEStudentActivities->CCEAssignmentID->ViewValue = NULL;
}
$CCEStudentActivities->CCEAssignmentID->CssStyle = "";
$CCEStudentActivities->CCEAssignmentID->CssClass = "";
$CCEStudentActivities->CCEAssignmentID->ViewCustomAttributes = "";
// CCEActivityID
if (strval($CCEStudentActivities->CCEActivityID->CurrentValue) <> "") {
$sFilterWrk = "`CCEActivityID` = " . ew_AdjustSql($CCEStudentActivities->CCEActivityID->CurrentValue) . "";
$sSqlWrk = "SELECT `WorkbookName` FROM `CCEActivities`";
$sWhereWrk = "";
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . "Archived=0" . ")";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `WorkbookName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->CCEActivityID->ViewValue = $rswrk->fields('WorkbookName');
$rswrk->Close();
} else {
$CCEStudentActivities->CCEActivityID->ViewValue = $CCEStudentActivities->CCEActivityID->CurrentValue;
}
} else {
$CCEStudentActivities->CCEActivityID->ViewValue = NULL;
}
$CCEStudentActivities->CCEActivityID->CssStyle = "";
$CCEStudentActivities->CCEActivityID->CssClass = "";
$CCEStudentActivities->CCEActivityID->ViewCustomAttributes = "";
// CCEModuleID
if (strval($CCEStudentActivities->CCEModuleID->CurrentValue) <> "") {
$sFilterWrk = "CCEModules.CCEModuleID = " . ew_AdjustSql($CCEStudentActivities->CCEModuleID->CurrentValue) . "";
$sSqlWrk = "SELECT CCEModules.ModuleNum AS `ModuleNum`, CCEModules.ModuleName AS `ModuleName` FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->CCEModuleID->ViewValue = $rswrk->fields('ModuleNum');
$CCEStudentActivities->CCEModuleID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('ModuleName');
$rswrk->Close();
} else {
$CCEStudentActivities->CCEModuleID->ViewValue = $CCEStudentActivities->CCEModuleID->CurrentValue;
}
} else {
$CCEStudentActivities->CCEModuleID->ViewValue = NULL;
}
$CCEStudentActivities->CCEModuleID->CssStyle = "";
$CCEStudentActivities->CCEModuleID->CssClass = "";
$CCEStudentActivities->CCEModuleID->ViewCustomAttributes = "";
// ActivityRef
if (strval($CCEStudentActivities->ActivityRef->CurrentValue) <> "") {
$sFilterWrk = "`RefNum` = '" . ew_AdjustSql($CCEStudentActivities->ActivityRef->CurrentValue) . "'";
$sSqlWrk = "SELECT `RefNum` FROM `CCEActivities`";
$sWhereWrk = "";
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . "Archived=0" . ")";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `RefNum`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->ActivityRef->ViewValue = $rswrk->fields('RefNum');
$rswrk->Close();
} else {
$CCEStudentActivities->ActivityRef->ViewValue = $CCEStudentActivities->ActivityRef->CurrentValue;
}
} else {
$CCEStudentActivities->ActivityRef->ViewValue = NULL;
}
$CCEStudentActivities->ActivityRef->CssStyle = "";
$CCEStudentActivities->ActivityRef->CssClass = "";
$CCEStudentActivities->ActivityRef->ViewCustomAttributes = "";
// AssignmentFile1
if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile1->ViewValue = $CCEStudentActivities->AssignmentFile1->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile1->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile1->CssStyle = "";
$CCEStudentActivities->AssignmentFile1->CssClass = "";
$CCEStudentActivities->AssignmentFile1->ViewCustomAttributes = "";
// AssignmentFile2
if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile2->ViewValue = $CCEStudentActivities->AssignmentFile2->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile2->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile2->CssStyle = "";
$CCEStudentActivities->AssignmentFile2->CssClass = "";
$CCEStudentActivities->AssignmentFile2->ViewCustomAttributes = "";
// AssignmentFile3
if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile3->ViewValue = $CCEStudentActivities->AssignmentFile3->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile3->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile3->CssStyle = "";
$CCEStudentActivities->AssignmentFile3->CssClass = "";
$CCEStudentActivities->AssignmentFile3->ViewCustomAttributes = "";
// AssignmentFile4
if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile4->ViewValue = $CCEStudentActivities->AssignmentFile4->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile4->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile4->CssStyle = "";
$CCEStudentActivities->AssignmentFile4->CssClass = "";
$CCEStudentActivities->AssignmentFile4->ViewCustomAttributes = "";
// AssignmentFile5
if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile5->ViewValue = $CCEStudentActivities->AssignmentFile5->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile5->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile5->CssStyle = "";
$CCEStudentActivities->AssignmentFile5->CssClass = "";
$CCEStudentActivities->AssignmentFile5->ViewCustomAttributes = "";
// AssignmentFile6
if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) {
$CCEStudentActivities->AssignmentFile6->ViewValue = $CCEStudentActivities->AssignmentFile6->Upload->DbValue;
} else {
$CCEStudentActivities->AssignmentFile6->ViewValue = "";
}
$CCEStudentActivities->AssignmentFile6->CssStyle = "";
$CCEStudentActivities->AssignmentFile6->CssClass = "";
$CCEStudentActivities->AssignmentFile6->ViewCustomAttributes = "";
// DateSubmitted
$CCEStudentActivities->DateSubmitted->ViewValue = $CCEStudentActivities->DateSubmitted->CurrentValue;
$CCEStudentActivities->DateSubmitted->ViewValue = ew_FormatDateTime($CCEStudentActivities->DateSubmitted->ViewValue, 5);
$CCEStudentActivities->DateSubmitted->CssStyle = "";
$CCEStudentActivities->DateSubmitted->CssClass = "";
$CCEStudentActivities->DateSubmitted->ViewCustomAttributes = "";
// AcceptStatus
if (strval($CCEStudentActivities->AcceptStatus->CurrentValue) <> "") {
switch ($CCEStudentActivities->AcceptStatus->CurrentValue) {
case "1":
$CCEStudentActivities->AcceptStatus->ViewValue = "Yes";
break;
case "0":
$CCEStudentActivities->AcceptStatus->ViewValue = "No";
break;
default:
$CCEStudentActivities->AcceptStatus->ViewValue = $CCEStudentActivities->AcceptStatus->CurrentValue;
}
} else {
$CCEStudentActivities->AcceptStatus->ViewValue = NULL;
}
$CCEStudentActivities->AcceptStatus->CssStyle = "";
$CCEStudentActivities->AcceptStatus->CssClass = "";
$CCEStudentActivities->AcceptStatus->ViewCustomAttributes = "";
// AcceptedBy
if (strval($CCEStudentActivities->AcceptedBy->CurrentValue) <> "") {
$sFilterWrk = "`FacilitatorName` = '" . ew_AdjustSql($CCEStudentActivities->AcceptedBy->CurrentValue) . "'";
$sSqlWrk = "SELECT `FacilitatorName` FROM `CCEFacilitators`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `FacilitatorName`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEStudentActivities->AcceptedBy->ViewValue = $rswrk->fields('FacilitatorName');
$rswrk->Close();
} else {
$CCEStudentActivities->AcceptedBy->ViewValue = $CCEStudentActivities->AcceptedBy->CurrentValue;
}
} else {
$CCEStudentActivities->AcceptedBy->ViewValue = NULL;
}
$CCEStudentActivities->AcceptedBy->CssStyle = "";
$CCEStudentActivities->AcceptedBy->CssClass = "";
$CCEStudentActivities->AcceptedBy->ViewCustomAttributes = "";
// DateAccepted
$CCEStudentActivities->DateAccepted->ViewValue = $CCEStudentActivities->DateAccepted->CurrentValue;
$CCEStudentActivities->DateAccepted->ViewValue = ew_FormatDateTime($CCEStudentActivities->DateAccepted->ViewValue, 5);
$CCEStudentActivities->DateAccepted->CssStyle = "";
$CCEStudentActivities->DateAccepted->CssClass = "";
$CCEStudentActivities->DateAccepted->ViewCustomAttributes = "";
// CCEStudentID
$CCEStudentActivities->CCEStudentID->HrefValue = "";
$CCEStudentActivities->CCEStudentID->TooltipValue = "";
// CCEActivityID
$CCEStudentActivities->CCEActivityID->HrefValue = "";
$CCEStudentActivities->CCEActivityID->TooltipValue = "";
// ActivityRef
$CCEStudentActivities->ActivityRef->HrefValue = "";
$CCEStudentActivities->ActivityRef->TooltipValue = "";
// AcceptStatus
$CCEStudentActivities->AcceptStatus->HrefValue = "";
$CCEStudentActivities->AcceptStatus->TooltipValue = "";
}
// Call Row Rendered event
if ($CCEStudentActivities->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEStudentActivities->Row_Rendered();
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $CCEStudentActivities;
$utf8 = FALSE;
$bSelectLimit = EW_SELECT_LIMIT;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $CCEStudentActivities->SelectRecordCount();
} else {
if ($rs = $this->LoadRecordset())
$this->lTotalRecs = $rs->RecordCount();
}
$this->lStartRec = 1;
// Export all
if ($CCEStudentActivities->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 ($CCEStudentActivities->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($CCEStudentActivities, "h");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($CCEStudentActivities->CCEStudentAssigID);
$ExportDoc->ExportCaption($CCEStudentActivities->CCEStudentID);
$ExportDoc->ExportCaption($CCEStudentActivities->CCEAssignmentID);
$ExportDoc->ExportCaption($CCEStudentActivities->CCEActivityID);
$ExportDoc->ExportCaption($CCEStudentActivities->CCEModuleID);
$ExportDoc->ExportCaption($CCEStudentActivities->ActivityRef);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile1);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile2);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile3);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile4);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile5);
$ExportDoc->ExportCaption($CCEStudentActivities->AssignmentFile6);
$ExportDoc->ExportCaption($CCEStudentActivities->DateSubmitted);
$ExportDoc->ExportCaption($CCEStudentActivities->AcceptStatus);
$ExportDoc->ExportCaption($CCEStudentActivities->AcceptedBy);
$ExportDoc->ExportCaption($CCEStudentActivities->DateAccepted);
$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
$CCEStudentActivities->CssClass = "";
$CCEStudentActivities->CssStyle = "";
$CCEStudentActivities->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($CCEStudentActivities->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('CCEStudentAssigID', $CCEStudentActivities->CCEStudentAssigID->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('CCEStudentID', $CCEStudentActivities->CCEStudentID->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('CCEAssignmentID', $CCEStudentActivities->CCEAssignmentID->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('CCEActivityID', $CCEStudentActivities->CCEActivityID->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('CCEModuleID', $CCEStudentActivities->CCEModuleID->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('ActivityRef', $CCEStudentActivities->ActivityRef->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile1', $CCEStudentActivities->AssignmentFile1->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile2', $CCEStudentActivities->AssignmentFile2->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile3', $CCEStudentActivities->AssignmentFile3->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile4', $CCEStudentActivities->AssignmentFile4->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile5', $CCEStudentActivities->AssignmentFile5->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AssignmentFile6', $CCEStudentActivities->AssignmentFile6->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('DateSubmitted', $CCEStudentActivities->DateSubmitted->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AcceptStatus', $CCEStudentActivities->AcceptStatus->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('AcceptedBy', $CCEStudentActivities->AcceptedBy->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
$XmlDoc->AddField('DateAccepted', $CCEStudentActivities->DateAccepted->ExportValue($CCEStudentActivities->Export, $CCEStudentActivities->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($CCEStudentActivities->CCEStudentAssigID);
$ExportDoc->ExportField($CCEStudentActivities->CCEStudentID);
$ExportDoc->ExportField($CCEStudentActivities->CCEAssignmentID);
$ExportDoc->ExportField($CCEStudentActivities->CCEActivityID);
$ExportDoc->ExportField($CCEStudentActivities->CCEModuleID);
$ExportDoc->ExportField($CCEStudentActivities->ActivityRef);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile1);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile2);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile3);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile4);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile5);
$ExportDoc->ExportField($CCEStudentActivities->AssignmentFile6);
$ExportDoc->ExportField($CCEStudentActivities->DateSubmitted);
$ExportDoc->ExportField($CCEStudentActivities->AcceptStatus);
$ExportDoc->ExportField($CCEStudentActivities->AcceptedBy);
$ExportDoc->ExportField($CCEStudentActivities->DateAccepted);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($CCEStudentActivities->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($CCEStudentActivities->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($CCEStudentActivities->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($CCEStudentActivities->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($CCEStudentActivities->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $CCEStudentActivities;
$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 ($CCEStudentActivities->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 $CCEStudentActivities;
// Initialize
$sQry = "export=html";
// Build QueryString for search
if ($CCEStudentActivities->getSessionBasicSearchKeyword() <> "") {
$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCEStudentActivities->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCEStudentActivities->getSessionBasicSearchType();
}
// Build QueryString for pager
$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCEStudentActivities->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCEStudentActivities->getStartRecordNumber();
return $sQry;
}
// Add search QueryString
function AddSearchQueryString(&$Qry, &$Fld) {
global $CCEStudentActivities;
$FldParm = substr($Fld->FldVar, 2);
$FldSearchValue = $CCEStudentActivities->GetAdvancedSearch("x_" . $FldParm);
if (strval($FldSearchValue) <> "") {
$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
"&z_" . $FldParm . "=" . $CCEStudentActivities->GetAdvancedSearch("z_" . $FldParm);
}
$FldSearchValue2 = $CCEStudentActivities->GetAdvancedSearch("y_" . $FldParm);
if (strval($FldSearchValue2) <> "") {
$Qry .= "&v_" . $FldParm . "=" . $CCEStudentActivities->GetAdvancedSearch("v_" . $FldParm) .
"&y_" . $FldParm . "=" . $FldSearchValue2 .
"&w_" . $FldParm . "=" . $CCEStudentActivities->GetAdvancedSearch("w_" . $FldParm);
}
}
// Set up master/detail based on QueryString
function SetUpMasterDetail() {
global $CCEStudentActivities;
$bValidMaster = FALSE;
// Get the keys for master table
if (@$_GET[EW_TABLE_SHOW_MASTER] <> "") {
$sMasterTblVar = $_GET[EW_TABLE_SHOW_MASTER];
if ($sMasterTblVar == "") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = "";
$this->sDbDetailFilter = "";
}
if ($sMasterTblVar == "CCEAssignments") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEStudentActivities->SqlMasterFilter_CCEAssignments();
$this->sDbDetailFilter = $CCEStudentActivities->SqlDetailFilter_CCEAssignments();
if (@$_GET["CCEAssignmentID"] <> "") {
$GLOBALS["CCEAssignments"]->CCEAssignmentID->setQueryStringValue($_GET["CCEAssignmentID"]);
$CCEStudentActivities->CCEAssignmentID->setQueryStringValue($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue);
$CCEStudentActivities->CCEAssignmentID->setSessionValue($CCEStudentActivities->CCEAssignmentID->QueryStringValue);
if (!is_numeric($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@CCEAssignmentID@", ew_AdjustSql($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@CCEAssignmentID@", ew_AdjustSql($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
if ($sMasterTblVar == "CCEStudents") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEStudentActivities->SqlMasterFilter_CCEStudents();
$this->sDbDetailFilter = $CCEStudentActivities->SqlDetailFilter_CCEStudents();
if (@$_GET["CCEStudentID"] <> "") {
$GLOBALS["CCEStudents"]->CCEStudentID->setQueryStringValue($_GET["CCEStudentID"]);
$CCEStudentActivities->CCEStudentID->setQueryStringValue($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue);
$CCEStudentActivities->CCEStudentID->setSessionValue($CCEStudentActivities->CCEStudentID->QueryStringValue);
if (!is_numeric($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
}
if ($bValidMaster) {
// Save current master table
$CCEStudentActivities->setCurrentMasterTable($sMasterTblVar);
// Reset start record counter (new master key)
$this->lStartRec = 1;
$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
$CCEStudentActivities->setMasterFilter($this->sDbMasterFilter); // Set up master filter
$CCEStudentActivities->setDetailFilter($this->sDbDetailFilter); // Set up detail filter
// Clear previous master key from Session
if ($sMasterTblVar <> "CCEAssignments") {
if ($CCEStudentActivities->CCEAssignmentID->QueryStringValue == "") $CCEStudentActivities->CCEAssignmentID->setSessionValue("");
}
if ($sMasterTblVar <> "CCEStudents") {
if ($CCEStudentActivities->CCEStudentID->QueryStringValue == "") $CCEStudentActivities->CCEStudentID->setSessionValue("");
}
} else {
$this->sDbMasterFilter = $CCEStudentActivities->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEStudentActivities->getDetailFilter(); // Restore detail filter
}
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
// ListOptions Load event
function ListOptions_Load() {
// Example:
//$this->ListOptions->Add("new");
//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
//$this->ListOptions->MoveItem("new", 0); // Move to first column
}
// ListOptions Rendered event
function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
}
}
?>