| Current Path : /var/www/cesa.co.za/cceconvenors/ |
| Current File : /var/www/cesa.co.za/cceconvenors/CCEStudentActivitiesinfo.php |
<?php
// Global variable for table object
$CCEStudentActivities = NULL;
//
// Table class for CCEStudentActivities
//
class cCCEStudentActivities {
var $TableVar = 'CCEStudentActivities';
var $TableName = 'CCEStudentActivities';
var $TableType = 'TABLE';
var $CCEStudentAssigID;
var $CCEStudentID;
var $CCEActivityID;
var $CCEAssignmentID;
var $CCEModuleID;
var $ActivityRef;
var $AssignmentFile1;
var $AssignmentFile2;
var $AssignmentFile3;
var $AssignmentFile4;
var $AssignmentFile5;
var $AssignmentFile6;
var $DateSubmitted;
var $AcceptStatus;
var $AcceptedBy;
var $DateAccepted;
var $Comments;
var $fields = array();
var $UseTokenInUrl = EW_USE_TOKEN_IN_URL;
var $Export; // Export
var $ExportOriginalValue = EW_EXPORT_ORIGINAL_VALUE;
var $ExportAll = TRUE;
var $SendEmail; // Send email
var $TableCustomInnerHtml; // Custom inner HTML
var $BasicSearchKeyword; // Basic search keyword
var $BasicSearchType; // Basic search type
var $CurrentFilter; // Current filter
var $CurrentOrder; // Current order
var $CurrentOrderType; // Current order type
var $RowType; // Row type
var $CssClass; // CSS class
var $CssStyle; // CSS style
var $RowAttrs = array(); // Row custom attributes
var $TableFilter = "";
var $CurrentAction; // Current action
var $UpdateConflict; // Update conflict
var $EventName; // Event name
var $EventCancelled; // Event cancelled
var $CancelMessage; // Cancel message
//
// Table class constructor
//
function __construct() {
global $Language;
// CCEStudentAssigID
$this->CCEStudentAssigID = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_CCEStudentAssigID', 'CCEStudentAssigID', '`CCEStudentAssigID`', 3, -1, FALSE, '`CCEStudentAssigID`', FALSE);
$this->CCEStudentAssigID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEStudentAssigID'] =& $this->CCEStudentAssigID;
// CCEStudentID
$this->CCEStudentID = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_CCEStudentID', 'CCEStudentID', '`CCEStudentID`', 3, -1, FALSE, '`CCEStudentID`', FALSE);
$this->CCEStudentID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEStudentID'] =& $this->CCEStudentID;
// CCEActivityID
$this->CCEActivityID = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_CCEActivityID', 'CCEActivityID', '`CCEActivityID`', 3, -1, FALSE, '`CCEActivityID`', FALSE);
$this->CCEActivityID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEActivityID'] =& $this->CCEActivityID;
// CCEAssignmentID
$this->CCEAssignmentID = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_CCEAssignmentID', 'CCEAssignmentID', '`CCEAssignmentID`', 3, -1, FALSE, '`CCEAssignmentID`', FALSE);
$this->CCEAssignmentID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEAssignmentID'] =& $this->CCEAssignmentID;
// CCEModuleID
$this->CCEModuleID = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_CCEModuleID', 'CCEModuleID', '`CCEModuleID`', 3, -1, FALSE, '`CCEModuleID`', FALSE);
$this->CCEModuleID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEModuleID'] =& $this->CCEModuleID;
// ActivityRef
$this->ActivityRef = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_ActivityRef', 'ActivityRef', '`ActivityRef`', 200, -1, FALSE, '`ActivityRef`', FALSE);
$this->fields['ActivityRef'] =& $this->ActivityRef;
// AssignmentFile1
$this->AssignmentFile1 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile1', 'AssignmentFile1', '`AssignmentFile1`', 200, -1, TRUE, '`AssignmentFile1`', FALSE);
$this->AssignmentFile1->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile1'] =& $this->AssignmentFile1;
// AssignmentFile2
$this->AssignmentFile2 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile2', 'AssignmentFile2', '`AssignmentFile2`', 200, -1, TRUE, '`AssignmentFile2`', FALSE);
$this->AssignmentFile2->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile2'] =& $this->AssignmentFile2;
// AssignmentFile3
$this->AssignmentFile3 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile3', 'AssignmentFile3', '`AssignmentFile3`', 200, -1, TRUE, '`AssignmentFile3`', FALSE);
$this->AssignmentFile3->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile3'] =& $this->AssignmentFile3;
// AssignmentFile4
$this->AssignmentFile4 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile4', 'AssignmentFile4', '`AssignmentFile4`', 200, -1, TRUE, '`AssignmentFile4`', FALSE);
$this->AssignmentFile4->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile4'] =& $this->AssignmentFile4;
// AssignmentFile5
$this->AssignmentFile5 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile5', 'AssignmentFile5', '`AssignmentFile5`', 200, -1, TRUE, '`AssignmentFile5`', FALSE);
$this->AssignmentFile5->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile5'] =& $this->AssignmentFile5;
// AssignmentFile6
$this->AssignmentFile6 = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AssignmentFile6', 'AssignmentFile6', '`AssignmentFile6`', 200, -1, TRUE, '`AssignmentFile6`', FALSE);
$this->AssignmentFile6->UploadPath = "../cceadmin/activitiesupload";
$this->fields['AssignmentFile6'] =& $this->AssignmentFile6;
// DateSubmitted
$this->DateSubmitted = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_DateSubmitted', 'DateSubmitted', '`DateSubmitted`', 135, 5, FALSE, '`DateSubmitted`', FALSE);
$this->DateSubmitted->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateYMD"));
$this->fields['DateSubmitted'] =& $this->DateSubmitted;
// AcceptStatus
$this->AcceptStatus = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AcceptStatus', 'AcceptStatus', '`AcceptStatus`', 16, -1, FALSE, '`AcceptStatus`', FALSE);
$this->AcceptStatus->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['AcceptStatus'] =& $this->AcceptStatus;
// AcceptedBy
$this->AcceptedBy = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_AcceptedBy', 'AcceptedBy', '`AcceptedBy`', 200, -1, FALSE, '`AcceptedBy`', FALSE);
$this->fields['AcceptedBy'] =& $this->AcceptedBy;
// DateAccepted
$this->DateAccepted = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_DateAccepted', 'DateAccepted', '`DateAccepted`', 135, 5, FALSE, '`DateAccepted`', FALSE);
$this->DateAccepted->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateYMD"));
$this->fields['DateAccepted'] =& $this->DateAccepted;
// Comments
$this->Comments = new cField('CCEStudentActivities', 'CCEStudentActivities', 'x_Comments', 'Comments', '`Comments`', 201, -1, FALSE, '`Comments`', FALSE);
$this->fields['Comments'] =& $this->Comments;
}
// Table caption
function TableCaption() {
global $Language;
return $Language->TablePhrase($this->TableVar, "TblCaption");
}
// Page caption
function PageCaption($Page) {
global $Language;
$Caption = $Language->TablePhrase($this->TableVar, "TblPageCaption" . $Page);
if ($Caption == "") $Caption = "Page " . $Page;
return $Caption;
}
// Export return page
function ExportReturnUrl() {
$url = @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_EXPORT_RETURN_URL];
return ($url <> "") ? $url : ew_CurrentPage();
}
function setExportReturnUrl($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_EXPORT_RETURN_URL] = $v;
}
// Records per page
function getRecordsPerPage() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_REC_PER_PAGE];
}
function setRecordsPerPage($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_REC_PER_PAGE] = $v;
}
// Start record number
function getStartRecordNumber() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_START_REC];
}
function setStartRecordNumber($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_START_REC] = $v;
}
// Search highlight name
function HighlightName() {
return "CCEStudentActivities_Highlight";
}
// Advanced search
function getAdvancedSearch($fld) {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ADVANCED_SEARCH . "_" . $fld];
}
function setAdvancedSearch($fld, $v) {
if (@$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ADVANCED_SEARCH . "_" . $fld] <> $v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ADVANCED_SEARCH . "_" . $fld] = $v;
}
}
// Basic search keyword
function getSessionBasicSearchKeyword() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_BASIC_SEARCH];
}
function setSessionBasicSearchKeyword($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_BASIC_SEARCH] = $v;
}
// Basic search type
function getSessionBasicSearchType() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_BASIC_SEARCH_TYPE];
}
function setSessionBasicSearchType($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_BASIC_SEARCH_TYPE] = $v;
}
// Search WHERE clause
function getSearchWhere() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_SEARCH_WHERE];
}
function setSearchWhere($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_SEARCH_WHERE] = $v;
}
// Multiple column sort
function UpdateSort(&$ofld, $ctrl) {
if ($this->CurrentOrder == $ofld->FldName) {
$sSortField = $ofld->FldExpression;
$sLastSort = $ofld->getSort();
if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
$sThisSort = $this->CurrentOrderType;
} else {
$sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
}
$ofld->setSort($sThisSort);
if ($ctrl) {
$sOrderBy = $this->getSessionOrderBy();
if (strpos($sOrderBy, $sSortField . " " . $sLastSort) !== FALSE) {
$sOrderBy = str_replace($sSortField . " " . $sLastSort, $sSortField . " " . $sThisSort, $sOrderBy);
} else {
if ($sOrderBy <> "") $sOrderBy .= ", ";
$sOrderBy .= $sSortField . " " . $sThisSort;
}
$this->setSessionOrderBy($sOrderBy); // Save to Session
} else {
$this->setSessionOrderBy($sSortField . " " . $sThisSort); // Save to Session
}
} else {
if (!$ctrl) $ofld->setSort("");
}
}
// Session WHERE clause
function getSessionWhere() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_WHERE];
}
function setSessionWhere($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_WHERE] = $v;
}
// Session ORDER BY
function getSessionOrderBy() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ORDER_BY];
}
function setSessionOrderBy($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ORDER_BY] = $v;
}
// Session key
function getKey($fld) {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_KEY . "_" . $fld];
}
function setKey($fld, $v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_KEY . "_" . $fld] = $v;
}
// Current master table name
function getCurrentMasterTable() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_TABLE];
}
function setCurrentMasterTable($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_TABLE] = $v;
}
// Session master WHERE clause
function getMasterFilter() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_FILTER];
}
function setMasterFilter($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_FILTER] = $v;
}
// Session detail WHERE clause
function getDetailFilter() {
return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_DETAIL_FILTER];
}
function setDetailFilter($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_DETAIL_FILTER] = $v;
}
// Master filter
function SqlMasterFilter_CCEAssignments() {
return "`CCEAssignmentID`=@CCEAssignmentID@";
}
// Detail filter
function SqlDetailFilter_CCEAssignments() {
return "`CCEAssignmentID`=@CCEAssignmentID@";
}
// Master filter
function SqlMasterFilter_CCEStudents() {
return "`CCEStudentID`=@CCEStudentID@";
}
// Detail filter
function SqlDetailFilter_CCEStudents() {
return "`CCEStudentID`=@CCEStudentID@";
}
// Table level SQL
function SqlFrom() { // From
return "`CCEStudentActivities`";
}
function SqlSelect() { // Select
return "SELECT * FROM " . $this->SqlFrom();
}
function SqlWhere() { // Where
$sWhere = "";
$this->TableFilter = "";
if ($this->TableFilter <> "") {
if ($sWhere <> "") $sWhere = "(" . $sWhere . ") AND (";
$sWhere .= "(" . $this->TableFilter . ")";
}
return $sWhere;
}
function SqlGroupBy() { // Group By
return "";
}
function SqlHaving() { // Having
return "";
}
function SqlOrderBy() { // Order By
return "`ActivityRef` ASC";
}
// Check if Anonymous User is allowed
function AllowAnonymousUser() {
switch (EW_PAGE_ID) {
case "add":
case "register":
case "addopt":
return FALSE;
case "edit":
case "update":
return FALSE;
case "delete":
return FALSE;
case "view":
return FALSE;
case "search":
return FALSE;
default:
return FALSE;
}
}
// Apply User ID filters
function ApplyUserIDFilters($sFilter) {
return $sFilter;
}
// Get SQL
function GetSQL($where, $orderby) {
return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
$where, $orderby);
}
// Table SQL
function SQL() {
$sFilter = $this->CurrentFilter;
$sFilter = $this->ApplyUserIDFilters($sFilter);
$sSort = $this->getSessionOrderBy();
return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
$sFilter, $sSort);
}
// Table SQL with List page filter
function SelectSQL() {
$sFilter = $this->getSessionWhere();
if ($this->CurrentFilter <> "") {
if ($sFilter <> "") $sFilter = "(" . $sFilter . ") AND ";
$sFilter .= "(" . $this->CurrentFilter . ")";
}
$sFilter = $this->ApplyUserIDFilters($sFilter);
$sSort = $this->getSessionOrderBy();
return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(), $this->SqlGroupBy(),
$this->SqlHaving(), $this->SqlOrderBy(), $sFilter, $sSort);
}
// Try to get record count
function TryGetRecordCount($sSql) {
global $conn;
$cnt = -1;
if ($this->TableType == 'TABLE' || $this->TableType == 'VIEW') {
$sSql = "SELECT COUNT(*) FROM" . substr($sSql, 13);
} else {
$sSql = "SELECT COUNT(*) FROM (" . $sSql . ") EW_COUNT_TABLE";
}
if ($rs = $conn->Execute($sSql)) {
if (!$rs->EOF && $rs->FieldCount() > 0) {
$cnt = $rs->fields[0];
$rs->Close();
}
}
return intval($cnt);
}
// Get record count based on filter (for detail record count in master table pages)
function LoadRecordCount($sFilter) {
$origFilter = $this->CurrentFilter;
$this->CurrentFilter = $sFilter;
$this->Recordset_Selecting($this->CurrentFilter);
$sSql = $this->SQL();
$cnt = $this->TryGetRecordCount($sSql);
if ($cnt == -1) {
if ($rs = $this->LoadRs($this->CurrentFilter)) {
$cnt = $rs->RecordCount();
$rs->Close();
}
}
$this->CurrentFilter = $origFilter;
return intval($cnt);
}
// Get record count (for current List page)
function SelectRecordCount() {
global $conn;
$origFilter = $this->CurrentFilter;
$this->Recordset_Selecting($this->CurrentFilter);
$sSql = $this->SelectSQL();
$cnt = $this->TryGetRecordCount($sSql);
if ($cnt == -1) {
if ($rs = $conn->Execute($this->SelectSQL())) {
$cnt = $rs->RecordCount();
$rs->Close();
}
}
$this->CurrentFilter = $origFilter;
return intval($cnt);
}
// INSERT statement
function InsertSQL(&$rs) {
global $conn;
$names = "";
$values = "";
foreach ($rs as $name => $value) {
$names .= $this->fields[$name]->FldExpression . ",";
$values .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
}
if (substr($names, -1) == ",") $names = substr($names, 0, strlen($names)-1);
if (substr($values, -1) == ",") $values = substr($values, 0, strlen($values)-1);
return "INSERT INTO `CCEStudentActivities` ($names) VALUES ($values)";
}
// UPDATE statement
function UpdateSQL(&$rs) {
global $conn;
$SQL = "UPDATE `CCEStudentActivities` SET ";
foreach ($rs as $name => $value) {
$SQL .= $this->fields[$name]->FldExpression . "=";
$SQL .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
}
if (substr($SQL, -1) == ",") $SQL = substr($SQL, 0, strlen($SQL)-1);
if ($this->CurrentFilter <> "") $SQL .= " WHERE " . $this->CurrentFilter;
return $SQL;
}
// DELETE statement
function DeleteSQL(&$rs) {
$SQL = "DELETE FROM `CCEStudentActivities` WHERE ";
$SQL .= ew_QuotedName('CCEStudentAssigID') . '=' . ew_QuotedValue($rs['CCEStudentAssigID'], $this->CCEStudentAssigID->FldDataType) . ' AND ';
if (substr($SQL, -5) == " AND ") $SQL = substr($SQL, 0, strlen($SQL)-5);
if ($this->CurrentFilter <> "") $SQL .= " AND " . $this->CurrentFilter;
return $SQL;
}
// Key filter WHERE clause
function SqlKeyFilter() {
return "`CCEStudentAssigID` = @CCEStudentAssigID@";
}
// Key filter
function KeyFilter() {
$sKeyFilter = $this->SqlKeyFilter();
if (!is_numeric($this->CCEStudentAssigID->CurrentValue))
$sKeyFilter = "0=1"; // Invalid key
$sKeyFilter = str_replace("@CCEStudentAssigID@", ew_AdjustSql($this->CCEStudentAssigID->CurrentValue), $sKeyFilter); // Replace key value
return $sKeyFilter;
}
// Return page URL
function getReturnUrl() {
$name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL;
// Get referer URL automatically
if (ew_ServerVar("HTTP_REFERER") <> "" && ew_ReferPage() <> ew_CurrentPage() && ew_ReferPage() <> "login.php") // Referer not same page or login page
$_SESSION[$name] = ew_ServerVar("HTTP_REFERER"); // Save to Session
if (@$_SESSION[$name] <> "") {
return $_SESSION[$name];
} else {
return "CCEStudentActivitieslist.php";
}
}
function setReturnUrl($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v;
}
// List URL
function ListUrl() {
return "CCEStudentActivitieslist.php";
}
// View URL
function ViewUrl() {
return $this->KeyUrl("CCEStudentActivitiesview.php", $this->UrlParm());
}
// Add URL
function AddUrl() {
$AddUrl = "CCEStudentActivitiesadd.php";
$sUrlParm = $this->UrlParm();
if ($sUrlParm <> "")
$AddUrl .= "?" . $sUrlParm;
return $AddUrl;
}
// Edit URL
function EditUrl() {
return $this->KeyUrl("CCEStudentActivitiesedit.php", $this->UrlParm());
}
// Inline edit URL
function InlineEditUrl() {
return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit"));
}
// Copy URL
function CopyUrl() {
return $this->KeyUrl("CCEStudentActivitiesadd.php", $this->UrlParm());
}
// Inline copy URL
function InlineCopyUrl() {
return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy"));
}
// Delete URL
function DeleteUrl() {
return $this->KeyUrl("CCEStudentActivitiesdelete.php", $this->UrlParm());
}
// Add key value to URL
function KeyUrl($url, $parm = "") {
$sUrl = $url . "?";
if ($parm <> "") $sUrl .= $parm . "&";
if (!is_null($this->CCEStudentAssigID->CurrentValue)) {
$sUrl .= "CCEStudentAssigID=" . urlencode($this->CCEStudentAssigID->CurrentValue);
} else {
return "javascript:alert(ewLanguage.Phrase(\"InvalidRecord\"));";
}
return $sUrl;
}
// Sort URL
function SortUrl(&$fld) {
if ($this->CurrentAction <> "" || $this->Export <> "" ||
in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
return "";
} elseif ($fld->Sortable) {
$sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort());
return ew_CurrentPage() . "?" . $sUrlParm;
} else {
return "";
}
}
// Add URL parameter
function UrlParm($parm = "") {
$UrlParm = ($this->UseTokenInUrl) ? "t=CCEStudentActivities" : "";
if ($parm <> "") {
if ($UrlParm <> "")
$UrlParm .= "&";
$UrlParm .= $parm;
}
return $UrlParm;
}
// Load rows based on filter
function &LoadRs($sFilter) {
global $conn;
// Set up filter (SQL WHERE clause) and get return SQL
$this->CurrentFilter = $sFilter;
$sSql = $this->SQL();
return $conn->Execute($sSql);
}
// Load row values from recordset
function LoadListRowValues(&$rs) {
$this->CCEStudentAssigID->setDbValue($rs->fields('CCEStudentAssigID'));
$this->CCEStudentID->setDbValue($rs->fields('CCEStudentID'));
$this->CCEActivityID->setDbValue($rs->fields('CCEActivityID'));
$this->CCEAssignmentID->setDbValue($rs->fields('CCEAssignmentID'));
$this->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
$this->ActivityRef->setDbValue($rs->fields('ActivityRef'));
$this->AssignmentFile1->Upload->DbValue = $rs->fields('AssignmentFile1');
$this->AssignmentFile2->Upload->DbValue = $rs->fields('AssignmentFile2');
$this->AssignmentFile3->Upload->DbValue = $rs->fields('AssignmentFile3');
$this->AssignmentFile4->Upload->DbValue = $rs->fields('AssignmentFile4');
$this->AssignmentFile5->Upload->DbValue = $rs->fields('AssignmentFile5');
$this->AssignmentFile6->Upload->DbValue = $rs->fields('AssignmentFile6');
$this->DateSubmitted->setDbValue($rs->fields('DateSubmitted'));
$this->AcceptStatus->setDbValue($rs->fields('AcceptStatus'));
$this->AcceptedBy->setDbValue($rs->fields('AcceptedBy'));
$this->DateAccepted->setDbValue($rs->fields('DateAccepted'));
$this->Comments->setDbValue($rs->fields('Comments'));
}
// Render list row values
function RenderListRow() {
global $conn, $Security;
// Call Row Rendering event
$this->Row_Rendering();
// Common render codes
// CCEStudentID
$this->CCEStudentID->CellCssStyle = ""; $this->CCEStudentID->CellCssClass = "";
$this->CCEStudentID->CellAttrs = array(); $this->CCEStudentID->ViewAttrs = array(); $this->CCEStudentID->EditAttrs = array();
// CCEActivityID
$this->CCEActivityID->CellCssStyle = ""; $this->CCEActivityID->CellCssClass = "";
$this->CCEActivityID->CellAttrs = array(); $this->CCEActivityID->ViewAttrs = array(); $this->CCEActivityID->EditAttrs = array();
// ActivityRef
$this->ActivityRef->CellCssStyle = ""; $this->ActivityRef->CellCssClass = "";
$this->ActivityRef->CellAttrs = array(); $this->ActivityRef->ViewAttrs = array(); $this->ActivityRef->EditAttrs = array();
// AcceptStatus
$this->AcceptStatus->CellCssStyle = ""; $this->AcceptStatus->CellCssClass = "";
$this->AcceptStatus->CellAttrs = array(); $this->AcceptStatus->ViewAttrs = array(); $this->AcceptStatus->EditAttrs = array();
// CCEStudentID
if (strval($this->CCEStudentID->CurrentValue) <> "") {
$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($this->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
$this->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
$this->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
$rswrk->Close();
} else {
$this->CCEStudentID->ViewValue = $this->CCEStudentID->CurrentValue;
}
} else {
$this->CCEStudentID->ViewValue = NULL;
}
$this->CCEStudentID->CssStyle = "";
$this->CCEStudentID->CssClass = "";
$this->CCEStudentID->ViewCustomAttributes = "";
// CCEActivityID
if (strval($this->CCEActivityID->CurrentValue) <> "") {
$sFilterWrk = "`CCEActivityID` = " . ew_AdjustSql($this->CCEActivityID->CurrentValue) . "";
$sSqlWrk = "SELECT `WorkbookName` FROM `CCEActivities`";
$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
$this->CCEActivityID->ViewValue = $rswrk->fields('WorkbookName');
$rswrk->Close();
} else {
$this->CCEActivityID->ViewValue = $this->CCEActivityID->CurrentValue;
}
} else {
$this->CCEActivityID->ViewValue = NULL;
}
$this->CCEActivityID->CssStyle = "";
$this->CCEActivityID->CssClass = "";
$this->CCEActivityID->ViewCustomAttributes = "";
// ActivityRef
$this->ActivityRef->ViewValue = $this->ActivityRef->CurrentValue;
$this->ActivityRef->CssStyle = "";
$this->ActivityRef->CssClass = "";
$this->ActivityRef->ViewCustomAttributes = "";
// AcceptStatus
if (strval($this->AcceptStatus->CurrentValue) <> "") {
switch ($this->AcceptStatus->CurrentValue) {
case "1":
$this->AcceptStatus->ViewValue = "Yes";
break;
case "0":
$this->AcceptStatus->ViewValue = "No";
break;
default:
$this->AcceptStatus->ViewValue = $this->AcceptStatus->CurrentValue;
}
} else {
$this->AcceptStatus->ViewValue = NULL;
}
$this->AcceptStatus->CssStyle = "";
$this->AcceptStatus->CssClass = "";
$this->AcceptStatus->ViewCustomAttributes = "";
// CCEStudentID
$this->CCEStudentID->HrefValue = "";
$this->CCEStudentID->TooltipValue = "";
// CCEActivityID
$this->CCEActivityID->HrefValue = "";
$this->CCEActivityID->TooltipValue = "";
// ActivityRef
$this->ActivityRef->HrefValue = "";
$this->ActivityRef->TooltipValue = "";
// AcceptStatus
$this->AcceptStatus->HrefValue = "";
$this->AcceptStatus->TooltipValue = "";
// Call Row Rendered event
$this->Row_Rendered();
}
// Aggregate list row values
function AggregateListRowValues() {
}
// Aggregate list row (for rendering)
function AggregateListRow() {
}
// Row styles
function RowStyles() {
$sAtt = "";
$sStyle = trim($this->CssStyle);
if (@$this->RowAttrs["style"] <> "")
$sStyle .= " " . $this->RowAttrs["style"];
$sClass = trim($this->CssClass);
if (@$this->RowAttrs["class"] <> "")
$sClass .= " " . $this->RowAttrs["class"];
if (trim($sStyle) <> "")
$sAtt .= " style=\"" . trim($sStyle) . "\"";
if (trim($sClass) <> "")
$sAtt .= " class=\"" . trim($sClass) . "\"";
return $sAtt;
}
// Row attributes
function RowAttributes() {
$sAtt = $this->RowStyles();
if ($this->Export == "") {
foreach ($this->RowAttrs as $k => $v) {
if ($k <> "class" && $k <> "style" && trim($v) <> "")
$sAtt .= " " . $k . "=\"" . trim($v) . "\"";
}
}
return $sAtt;
}
// Field object by name
function fields($fldname) {
return $this->fields[$fldname];
}
// Table level events
// Recordset Selecting event
function Recordset_Selecting(&$filter) {
// Enter your code here
}
// Recordset Selected event
function Recordset_Selected(&$rs) {
//echo "Recordset Selected";
}
// Recordset Search Validated event
function Recordset_SearchValidated() {
// Example:
//$this->MyField1->AdvancedSearch->SearchValue = "your search criteria"; // Search value
}
// Recordset Searching event
function Recordset_Searching(&$filter) {
// Enter your code here
}
// Row_Selecting event
function Row_Selecting(&$filter) {
// Enter your code here
}
// Row Selected event
function Row_Selected(&$rs) {
//echo "Row Selected";
}
// Row Rendering event
function Row_Rendering() {
// Enter your code here
}
// Row Rendered event
function Row_Rendered() {
// To view properties of field class, use:
//var_dump($this-><FieldName>);
}
// Row Inserting event
function Row_Inserting(&$rs) {
// Enter your code here
// To cancel, set return value to FALSE
return TRUE;
}
// Row Inserted event
function Row_Inserted(&$rs) {
//echo "Row Inserted"
}
// Row Updating event
function Row_Updating(&$rsold, &$rsnew) {
// Enter your code here
// To cancel, set return value to FALSE
return TRUE;
}
// Row Updated event
function Row_Updated(&$rsold, &$rsnew) {
//echo "Row Updated";
}
// Row Update Conflict event
function Row_UpdateConflict(&$rsold, &$rsnew) {
// Enter your code here
// To ignore conflict, set return value to FALSE
return TRUE;
}
// Row Deleting event
function Row_Deleting(&$rs) {
// Enter your code here
// To cancel, set return value to False
return TRUE;
}
// Row Deleted event
function Row_Deleted(&$rs) {
//echo "Row Deleted";
}
// Email Sending event
function Email_Sending(&$Email, &$Args) {
//var_dump($Email); var_dump($Args); exit();
return TRUE;
}
}
?>