| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEStudentActivitiesdelete.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_delete = new cCCEStudentActivities_delete();
$Page =& $CCEStudentActivities_delete;
// Page init
$CCEStudentActivities_delete->Page_Init();
// Page main
$CCEStudentActivities_delete->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEStudentActivities_delete = new ew_Page("CCEStudentActivities_delete");
// page properties
CCEStudentActivities_delete.PageID = "delete"; // page ID
CCEStudentActivities_delete.FormID = "fCCEStudentActivitiesdelete"; // form ID
var EW_PAGE_ID = CCEStudentActivities_delete.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
CCEStudentActivities_delete.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_delete.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentActivities_delete.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</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
// Load records for display
if ($rs = $CCEStudentActivities_delete->LoadRecordset())
$CCEStudentActivities_deletelTotalRecs = $rs->RecordCount(); // Get record count
if ($CCEStudentActivities_deletelTotalRecs <= 0) { // No record found, exit
if ($rs)
$rs->Close();
$CCEStudentActivities_delete->Page_Terminate("CCEStudentActivitieslist.php"); // Return to list
}
?>
<p><span class="phpmaker"><?php echo $Language->Phrase("Delete") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentActivities->TableCaption() ?><br><br>
<a href="<?php echo $CCEStudentActivities->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEStudentActivities_delete->ShowMessage();
?>
<form action="<?php echo ew_CurrentPage() ?>" method="post">
<p>
<input type="hidden" name="t" id="t" value="CCEStudentActivities">
<input type="hidden" name="a_delete" id="a_delete" value="D">
<?php foreach ($CCEStudentActivities_delete->arRecKeys as $key) { ?>
<input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($key) ?>">
<?php } ?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable ewTableSeparate">
<?php echo $CCEStudentActivities->TableCustomInnerHtml ?>
<thead>
<tr class="ewTableHeader">
<td valign="top"><?php echo $CCEStudentActivities->CCEStudentID->FldCaption() ?></td>
<td valign="top"><?php echo $CCEStudentActivities->CCEActivityID->FldCaption() ?></td>
<td valign="top"><?php echo $CCEStudentActivities->ActivityRef->FldCaption() ?></td>
<td valign="top"><?php echo $CCEStudentActivities->AcceptStatus->FldCaption() ?></td>
</tr>
</thead>
<tbody>
<?php
$CCEStudentActivities_delete->lRecCnt = 0;
$i = 0;
while (!$rs->EOF) {
$CCEStudentActivities_delete->lRecCnt++;
// Set row properties
$CCEStudentActivities->CssClass = "";
$CCEStudentActivities->CssStyle = "";
$CCEStudentActivities->RowAttrs = array();
$CCEStudentActivities->RowType = EW_ROWTYPE_VIEW; // View
// Get the field contents
$CCEStudentActivities_delete->LoadRowValues($rs);
// Render row
$CCEStudentActivities_delete->RenderRow();
?>
<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
<td<?php echo $CCEStudentActivities->CCEStudentID->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentActivities->CCEStudentID->ListViewValue() ?></div></td>
<td<?php echo $CCEStudentActivities->CCEActivityID->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->CCEActivityID->ViewAttributes() ?>><?php echo $CCEStudentActivities->CCEActivityID->ListViewValue() ?></div></td>
<td<?php echo $CCEStudentActivities->ActivityRef->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->ActivityRef->ViewAttributes() ?>><?php echo $CCEStudentActivities->ActivityRef->ListViewValue() ?></div></td>
<td<?php echo $CCEStudentActivities->AcceptStatus->CellAttributes() ?>>
<div<?php echo $CCEStudentActivities->AcceptStatus->ViewAttributes() ?>><?php echo $CCEStudentActivities->AcceptStatus->ListViewValue() ?></div></td>
</tr>
<?php
$rs->MoveNext();
}
$rs->Close();
?>
</tbody>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("DeleteBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$CCEStudentActivities_delete->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEStudentActivities_delete {
// Page ID
var $PageID = 'delete';
// Table name
var $TableName = 'CCEStudentActivities';
// Page object name
var $PageObjName = 'CCEStudentActivities_delete';
// 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();
// 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", 'delete', 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();
}
//
// 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->CanDelete()) {
$Security->SaveLastUrl();
$this->Page_Terminate("CCEStudentActivitieslist.php");
}
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
var $lTotalRecs = 0;
var $lRecCnt;
var $arRecKeys = array();
//
// Page main
//
function Page_Main() {
global $Language, $CCEStudentActivities;
// Load key parameters
$sKey = "";
$bSingleDelete = TRUE; // Initialize as single delete
$nKeySelected = 0; // Initialize selected key count
$sFilter = "";
if (@$_GET["CCEStudentAssigID"] <> "") {
$CCEStudentActivities->CCEStudentAssigID->setQueryStringValue($_GET["CCEStudentAssigID"]);
if (!is_numeric($CCEStudentActivities->CCEStudentAssigID->QueryStringValue))
$this->Page_Terminate("CCEStudentActivitieslist.php"); // Prevent SQL injection, exit
$sKey .= $CCEStudentActivities->CCEStudentAssigID->QueryStringValue;
} else {
$bSingleDelete = FALSE;
}
if ($bSingleDelete) {
$nKeySelected = 1; // Set up key selected count
$this->arRecKeys[0] = $sKey;
} else {
if (isset($_POST["key_m"])) { // Key in form
$nKeySelected = count($_POST["key_m"]); // Set up key selected count
$this->arRecKeys = ew_StripSlashes($_POST["key_m"]);
}
}
if ($nKeySelected <= 0)
$this->Page_Terminate("CCEStudentActivitieslist.php"); // No key specified, return to list
// Build filter
foreach ($this->arRecKeys as $sKey) {
$sFilter .= "(";
// Set up key field
$sKeyFld = $sKey;
if (!is_numeric($sKeyFld))
$this->Page_Terminate("CCEStudentActivitieslist.php"); // Prevent SQL injection, return to list
$sFilter .= "`CCEStudentAssigID`=" . ew_AdjustSql($sKeyFld) . " AND ";
if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
}
if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);
// Set up filter (SQL WHHERE clause) and get return SQL
// SQL constructor in CCEStudentActivities class, CCEStudentActivitiesinfo.php
$CCEStudentActivities->CurrentFilter = $sFilter;
// Get action
if (@$_POST["a_delete"] <> "") {
$CCEStudentActivities->CurrentAction = $_POST["a_delete"];
} else {
$CCEStudentActivities->CurrentAction = "I"; // Display record
}
switch ($CCEStudentActivities->CurrentAction) {
case "D": // Delete
$CCEStudentActivities->SendEmail = TRUE; // Send email on delete success
if ($this->DeleteRows()) { // delete rows
$this->setMessage($Language->Phrase("DeleteSuccess")); // Set up success message
$this->Page_Terminate($CCEStudentActivities->getReturnUrl()); // Return to caller
}
}
}
//
// Delete records based on current filter
//
function DeleteRows() {
global $conn, $Language, $Security, $CCEStudentActivities;
$DeleteRows = TRUE;
$sWrkFilter = $CCEStudentActivities->CurrentFilter;
// Set up filter (SQL WHERE clause) and get return SQL
// SQL constructor in CCEStudentActivities class, CCEStudentActivitiesinfo.php
$CCEStudentActivities->CurrentFilter = $sWrkFilter;
$sSql = $CCEStudentActivities->SQL();
$conn->raiseErrorFn = 'ew_ErrorFn';
$rs = $conn->Execute($sSql);
$conn->raiseErrorFn = '';
if ($rs === FALSE) {
return FALSE;
} elseif ($rs->EOF) {
$this->setMessage($Language->Phrase("NoRecord")); // No record found
$rs->Close();
return FALSE;
}
$conn->BeginTrans();
// Clone old rows
$rsold = ($rs) ? $rs->GetRows() : array();
if ($rs)
$rs->Close();
// Call row deleting event
if ($DeleteRows) {
foreach ($rsold as $row) {
$DeleteRows = $CCEStudentActivities->Row_Deleting($row);
if (!$DeleteRows) break;
}
}
if ($DeleteRows) {
$sKey = "";
foreach ($rsold as $row) {
$sThisKey = "";
if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
$sThisKey .= $row['CCEStudentAssigID'];
$conn->raiseErrorFn = 'ew_ErrorFn';
$DeleteRows = $conn->Execute($CCEStudentActivities->DeleteSQL($row)); // Delete
$conn->raiseErrorFn = '';
if ($DeleteRows === FALSE)
break;
if ($sKey <> "") $sKey .= ", ";
$sKey .= $sThisKey;
}
} else {
// Set up error message
if ($CCEStudentActivities->CancelMessage <> "") {
$this->setMessage($CCEStudentActivities->CancelMessage);
$CCEStudentActivities->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("DeleteCancelled"));
}
}
if ($DeleteRows) {
$conn->CommitTrans(); // Commit the changes
} else {
$conn->RollbackTrans(); // Rollback changes
}
// Call Row Deleted event
if ($DeleteRows) {
foreach ($rsold as $row) {
$CCEStudentActivities->Row_Deleted($row);
}
}
return $DeleteRows;
}
// 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
// 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();
}
// 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";
}
}
?>