| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEExamsinfo.php |
<?php
// Global variable for table object
$CCEExams = NULL;
//
// Table class for CCEExams
//
class cCCEExams {
var $TableVar = 'CCEExams';
var $TableName = 'CCEExams';
var $TableType = 'TABLE';
var $Questionnaire_ID;
var $Questionnaire_Name;
var $Score;
var $PassPerc;
var $GoodResultText;
var $BadResultText;
var $HasScore;
var $TopicID;
var $CanDistrib;
var $DistribAccessCode;
var $Anonymous;
var $ShowSubscribeOption;
var $StartDate;
var $CloseDate;
var $Introduction;
var $DateCreated;
var $Website;
var $ServiceProviderID;
var $ServiceProviderID2;
var $ServiceProviderID3;
var $ServiceProviderID4;
var $QuestionnaireType;
var $MarkerUser;
var $CCEModuleID;
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;
// Questionnaire_ID
$this->Questionnaire_ID = new cField('CCEExams', 'CCEExams', 'x_Questionnaire_ID', 'Questionnaire_ID', '`Questionnaire_ID`', 3, -1, FALSE, '`Questionnaire_ID`', FALSE);
$this->Questionnaire_ID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['Questionnaire_ID'] =& $this->Questionnaire_ID;
// Questionnaire_Name
$this->Questionnaire_Name = new cField('CCEExams', 'CCEExams', 'x_Questionnaire_Name', 'Questionnaire_Name', '`Questionnaire_Name`', 200, -1, FALSE, '`Questionnaire_Name`', FALSE);
$this->fields['Questionnaire_Name'] =& $this->Questionnaire_Name;
// Score
$this->Score = new cField('CCEExams', 'CCEExams', 'x_Score', 'Score', '`Score`', 3, -1, FALSE, '`Score`', FALSE);
$this->Score->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['Score'] =& $this->Score;
// PassPerc
$this->PassPerc = new cField('CCEExams', 'CCEExams', 'x_PassPerc', 'PassPerc', '`PassPerc`', 3, -1, FALSE, '`PassPerc`', FALSE);
$this->PassPerc->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['PassPerc'] =& $this->PassPerc;
// GoodResultText
$this->GoodResultText = new cField('CCEExams', 'CCEExams', 'x_GoodResultText', 'GoodResultText', '`GoodResultText`', 201, -1, FALSE, '`GoodResultText`', FALSE);
$this->fields['GoodResultText'] =& $this->GoodResultText;
// BadResultText
$this->BadResultText = new cField('CCEExams', 'CCEExams', 'x_BadResultText', 'BadResultText', '`BadResultText`', 201, -1, FALSE, '`BadResultText`', FALSE);
$this->fields['BadResultText'] =& $this->BadResultText;
// HasScore
$this->HasScore = new cField('CCEExams', 'CCEExams', 'x_HasScore', 'HasScore', '`HasScore`', 16, -1, FALSE, '`HasScore`', FALSE);
$this->HasScore->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['HasScore'] =& $this->HasScore;
// TopicID
$this->TopicID = new cField('CCEExams', 'CCEExams', 'x_TopicID', 'TopicID', '`TopicID`', 3, -1, FALSE, '`TopicID`', FALSE);
$this->TopicID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['TopicID'] =& $this->TopicID;
// CanDistrib
$this->CanDistrib = new cField('CCEExams', 'CCEExams', 'x_CanDistrib', 'CanDistrib', '`CanDistrib`', 16, -1, FALSE, '`CanDistrib`', FALSE);
$this->CanDistrib->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CanDistrib'] =& $this->CanDistrib;
// DistribAccessCode
$this->DistribAccessCode = new cField('CCEExams', 'CCEExams', 'x_DistribAccessCode', 'DistribAccessCode', '`DistribAccessCode`', 200, -1, FALSE, '`DistribAccessCode`', FALSE);
$this->fields['DistribAccessCode'] =& $this->DistribAccessCode;
// Anonymous
$this->Anonymous = new cField('CCEExams', 'CCEExams', 'x_Anonymous', 'Anonymous', '`Anonymous`', 16, -1, FALSE, '`Anonymous`', FALSE);
$this->Anonymous->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['Anonymous'] =& $this->Anonymous;
// ShowSubscribeOption
$this->ShowSubscribeOption = new cField('CCEExams', 'CCEExams', 'x_ShowSubscribeOption', 'ShowSubscribeOption', '`ShowSubscribeOption`', 16, -1, FALSE, '`ShowSubscribeOption`', FALSE);
$this->ShowSubscribeOption->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['ShowSubscribeOption'] =& $this->ShowSubscribeOption;
// StartDate
$this->StartDate = new cField('CCEExams', 'CCEExams', 'x_StartDate', 'StartDate', '`StartDate`', 135, 11, FALSE, '`StartDate`', FALSE);
$this->fields['StartDate'] =& $this->StartDate;
// CloseDate
$this->CloseDate = new cField('CCEExams', 'CCEExams', 'x_CloseDate', 'CloseDate', '`CloseDate`', 135, 11, FALSE, '`CloseDate`', FALSE);
$this->fields['CloseDate'] =& $this->CloseDate;
// Introduction
$this->Introduction = new cField('CCEExams', 'CCEExams', 'x_Introduction', 'Introduction', '`Introduction`', 201, -1, FALSE, '`Introduction`', FALSE);
$this->fields['Introduction'] =& $this->Introduction;
// DateCreated
$this->DateCreated = new cField('CCEExams', 'CCEExams', 'x_DateCreated', 'DateCreated', '`DateCreated`', 135, 5, FALSE, '`DateCreated`', FALSE);
$this->DateCreated->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateYMD"));
$this->fields['DateCreated'] =& $this->DateCreated;
// Website
$this->Website = new cField('CCEExams', 'CCEExams', 'x_Website', 'Website', '`Website`', 200, -1, FALSE, '`Website`', FALSE);
$this->fields['Website'] =& $this->Website;
// ServiceProviderID
$this->ServiceProviderID = new cField('CCEExams', 'CCEExams', 'x_ServiceProviderID', 'ServiceProviderID', '`ServiceProviderID`', 3, -1, FALSE, '`ServiceProviderID`', FALSE);
$this->ServiceProviderID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['ServiceProviderID'] =& $this->ServiceProviderID;
// ServiceProviderID2
$this->ServiceProviderID2 = new cField('CCEExams', 'CCEExams', 'x_ServiceProviderID2', 'ServiceProviderID2', '`ServiceProviderID2`', 3, -1, FALSE, '`ServiceProviderID2`', FALSE);
$this->ServiceProviderID2->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['ServiceProviderID2'] =& $this->ServiceProviderID2;
// ServiceProviderID3
$this->ServiceProviderID3 = new cField('CCEExams', 'CCEExams', 'x_ServiceProviderID3', 'ServiceProviderID3', '`ServiceProviderID3`', 3, -1, FALSE, '`ServiceProviderID3`', FALSE);
$this->ServiceProviderID3->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['ServiceProviderID3'] =& $this->ServiceProviderID3;
// ServiceProviderID4
$this->ServiceProviderID4 = new cField('CCEExams', 'CCEExams', 'x_ServiceProviderID4', 'ServiceProviderID4', '`ServiceProviderID4`', 3, -1, FALSE, '`ServiceProviderID4`', FALSE);
$this->ServiceProviderID4->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['ServiceProviderID4'] =& $this->ServiceProviderID4;
// QuestionnaireType
$this->QuestionnaireType = new cField('CCEExams', 'CCEExams', 'x_QuestionnaireType', 'QuestionnaireType', '`QuestionnaireType`', 200, -1, FALSE, '`QuestionnaireType`', FALSE);
$this->fields['QuestionnaireType'] =& $this->QuestionnaireType;
// MarkerUser
$this->MarkerUser = new cField('CCEExams', 'CCEExams', 'x_MarkerUser', 'MarkerUser', '`MarkerUser`', 200, -1, FALSE, '`MarkerUser`', FALSE);
$this->fields['MarkerUser'] =& $this->MarkerUser;
// CCEModuleID
$this->CCEModuleID = new cField('CCEExams', 'CCEExams', 'x_CCEModuleID', 'CCEModuleID', '`CCEModuleID`', 3, -1, FALSE, '`CCEModuleID`', FALSE);
$this->CCEModuleID->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
$this->fields['CCEModuleID'] =& $this->CCEModuleID;
}
// 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 "CCEExams_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;
}
// Table level SQL
function SqlFrom() { // From
return "`CCEExams`";
}
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 "";
}
// 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 `CCEExams` ($names) VALUES ($values)";
}
// UPDATE statement
function UpdateSQL(&$rs) {
global $conn;
$SQL = "UPDATE `CCEExams` 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 `CCEExams` WHERE ";
$SQL .= ew_QuotedName('Questionnaire_ID') . '=' . ew_QuotedValue($rs['Questionnaire_ID'], $this->Questionnaire_ID->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 "`Questionnaire_ID` = @Questionnaire_ID@";
}
// Key filter
function KeyFilter() {
$sKeyFilter = $this->SqlKeyFilter();
if (!is_numeric($this->Questionnaire_ID->CurrentValue))
$sKeyFilter = "0=1"; // Invalid key
$sKeyFilter = str_replace("@Questionnaire_ID@", ew_AdjustSql($this->Questionnaire_ID->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 "CCEExamslist.php";
}
}
function setReturnUrl($v) {
$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v;
}
// List URL
function ListUrl() {
return "CCEExamslist.php";
}
// View URL
function ViewUrl() {
return $this->KeyUrl("CCEExamsview.php", $this->UrlParm());
}
// Add URL
function AddUrl() {
$AddUrl = "CCEExamsadd.php";
$sUrlParm = $this->UrlParm();
if ($sUrlParm <> "")
$AddUrl .= "?" . $sUrlParm;
return $AddUrl;
}
// Edit URL
function EditUrl() {
return $this->KeyUrl("CCEExamsedit.php", $this->UrlParm());
}
// Inline edit URL
function InlineEditUrl() {
return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit"));
}
// Copy URL
function CopyUrl() {
return $this->KeyUrl("CCEExamsadd.php", $this->UrlParm());
}
// Inline copy URL
function InlineCopyUrl() {
return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy"));
}
// Delete URL
function DeleteUrl() {
return $this->KeyUrl("CCEExamsdelete.php", $this->UrlParm());
}
// Add key value to URL
function KeyUrl($url, $parm = "") {
$sUrl = $url . "?";
if ($parm <> "") $sUrl .= $parm . "&";
if (!is_null($this->Questionnaire_ID->CurrentValue)) {
$sUrl .= "Questionnaire_ID=" . urlencode($this->Questionnaire_ID->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=CCEExams" : "";
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->Questionnaire_ID->setDbValue($rs->fields('Questionnaire_ID'));
$this->Questionnaire_Name->setDbValue($rs->fields('Questionnaire_Name'));
$this->Score->setDbValue($rs->fields('Score'));
$this->PassPerc->setDbValue($rs->fields('PassPerc'));
$this->GoodResultText->setDbValue($rs->fields('GoodResultText'));
$this->BadResultText->setDbValue($rs->fields('BadResultText'));
$this->HasScore->setDbValue($rs->fields('HasScore'));
$this->TopicID->setDbValue($rs->fields('TopicID'));
$this->CanDistrib->setDbValue($rs->fields('CanDistrib'));
$this->DistribAccessCode->setDbValue($rs->fields('DistribAccessCode'));
$this->Anonymous->setDbValue($rs->fields('Anonymous'));
$this->ShowSubscribeOption->setDbValue($rs->fields('ShowSubscribeOption'));
$this->StartDate->setDbValue($rs->fields('StartDate'));
$this->CloseDate->setDbValue($rs->fields('CloseDate'));
$this->Introduction->setDbValue($rs->fields('Introduction'));
$this->DateCreated->setDbValue($rs->fields('DateCreated'));
$this->Website->setDbValue($rs->fields('Website'));
$this->ServiceProviderID->setDbValue($rs->fields('ServiceProviderID'));
$this->ServiceProviderID2->setDbValue($rs->fields('ServiceProviderID2'));
$this->ServiceProviderID3->setDbValue($rs->fields('ServiceProviderID3'));
$this->ServiceProviderID4->setDbValue($rs->fields('ServiceProviderID4'));
$this->QuestionnaireType->setDbValue($rs->fields('QuestionnaireType'));
$this->MarkerUser->setDbValue($rs->fields('MarkerUser'));
$this->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
}
// Render list row values
function RenderListRow() {
global $conn, $Security;
// Call Row Rendering event
$this->Row_Rendering();
// Common render codes
// Questionnaire_Name
$this->Questionnaire_Name->CellCssStyle = ""; $this->Questionnaire_Name->CellCssClass = "";
$this->Questionnaire_Name->CellAttrs = array(); $this->Questionnaire_Name->ViewAttrs = array(); $this->Questionnaire_Name->EditAttrs = array();
// StartDate
$this->StartDate->CellCssStyle = ""; $this->StartDate->CellCssClass = "";
$this->StartDate->CellAttrs = array(); $this->StartDate->ViewAttrs = array(); $this->StartDate->EditAttrs = array();
// CloseDate
$this->CloseDate->CellCssStyle = ""; $this->CloseDate->CellCssClass = "";
$this->CloseDate->CellAttrs = array(); $this->CloseDate->ViewAttrs = array(); $this->CloseDate->EditAttrs = array();
// Introduction
$this->Introduction->CellCssStyle = ""; $this->Introduction->CellCssClass = "";
$this->Introduction->CellAttrs = array(); $this->Introduction->ViewAttrs = array(); $this->Introduction->EditAttrs = array();
// MarkerUser
$this->MarkerUser->CellCssStyle = ""; $this->MarkerUser->CellCssClass = "";
$this->MarkerUser->CellAttrs = array(); $this->MarkerUser->ViewAttrs = array(); $this->MarkerUser->EditAttrs = array();
// Questionnaire_Name
$this->Questionnaire_Name->ViewValue = $this->Questionnaire_Name->CurrentValue;
$this->Questionnaire_Name->CssStyle = "";
$this->Questionnaire_Name->CssClass = "";
$this->Questionnaire_Name->ViewCustomAttributes = "";
// StartDate
$this->StartDate->ViewValue = $this->StartDate->CurrentValue;
$this->StartDate->ViewValue = ew_FormatDateTime($this->StartDate->ViewValue, 11);
$this->StartDate->CssStyle = "";
$this->StartDate->CssClass = "";
$this->StartDate->ViewCustomAttributes = "";
// CloseDate
$this->CloseDate->ViewValue = $this->CloseDate->CurrentValue;
$this->CloseDate->ViewValue = ew_FormatDateTime($this->CloseDate->ViewValue, 11);
$this->CloseDate->CssStyle = "";
$this->CloseDate->CssClass = "";
$this->CloseDate->ViewCustomAttributes = "";
// Introduction
$this->Introduction->ViewValue = $this->Introduction->CurrentValue;
$this->Introduction->CssStyle = "";
$this->Introduction->CssClass = "";
$this->Introduction->ViewCustomAttributes = "";
// MarkerUser
$this->MarkerUser->ViewValue = $this->MarkerUser->CurrentValue;
$this->MarkerUser->CssStyle = "";
$this->MarkerUser->CssClass = "";
$this->MarkerUser->ViewCustomAttributes = "";
// Questionnaire_Name
$this->Questionnaire_Name->HrefValue = "";
$this->Questionnaire_Name->TooltipValue = "";
// StartDate
$this->StartDate->HrefValue = "";
$this->StartDate->TooltipValue = "";
// CloseDate
$this->CloseDate->HrefValue = "";
$this->CloseDate->TooltipValue = "";
// Introduction
$this->Introduction->HrefValue = "";
$this->Introduction->TooltipValue = "";
// MarkerUser
$this->MarkerUser->HrefValue = "";
$this->MarkerUser->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;
}
}
?>