| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEExamAnswerslist.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 "CCEExamAnswersinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "CCEExamQuestionsinfo.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
$CCEExamAnswers_list = new cCCEExamAnswers_list();
$Page =& $CCEExamAnswers_list;
// Page init
$CCEExamAnswers_list->Page_Init();
// Page main
$CCEExamAnswers_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEExamAnswers->Export == "") { ?>
<script type="text/javascript">
<!--
// Create page object
var CCEExamAnswers_list = new ew_Page("CCEExamAnswers_list");
// page properties
CCEExamAnswers_list.PageID = "list"; // page ID
CCEExamAnswers_list.FormID = "fCCEExamAnswerslist"; // form ID
var EW_PAGE_ID = CCEExamAnswers_list.PageID; // for backward compatibility
// extend page with validate function for search
CCEExamAnswers_list.ValidateSearch = function(fobj) {
ew_PostAutoSuggest(fobj);
if (this.ValidateRequired) {
var infix = "";
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj))
return false;
}
for (var i=0; i<fobj.elements.length; i++) {
var elem = fobj.elements[i];
if (elem.name.substring(0,2) == "s_" || elem.name.substring(0,3) == "sv_")
elem.value = "";
}
return true;
}
// extend page with Form_CustomValidate function
CCEExamAnswers_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) { ?>
CCEExamAnswers_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEExamAnswers_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 ($CCEExamAnswers->Export == "") { ?>
<?php
$gsMasterReturnUrl = "CCEExamQuestionslist.php";
if ($CCEExamAnswers_list->sDbMasterFilter <> "" && $CCEExamAnswers->getCurrentMasterTable() == "CCEExamQuestions") {
if ($CCEExamAnswers_list->bMasterRecordExists) {
if ($CCEExamAnswers->getCurrentMasterTable() == $CCEExamAnswers->TableVar) $gsMasterReturnUrl .= "?" . EW_TABLE_SHOW_MASTER . "=";
?>
<?php include "CCEExamQuestionsmaster.php" ?>
<?php
}
}
?>
<?php } ?>
<?php
$bSelectLimit = EW_SELECT_LIMIT;
if ($bSelectLimit) {
$CCEExamAnswers_list->lTotalRecs = $CCEExamAnswers->SelectRecordCount();
} else {
if ($rs = $CCEExamAnswers_list->LoadRecordset())
$CCEExamAnswers_list->lTotalRecs = $rs->RecordCount();
}
$CCEExamAnswers_list->lStartRec = 1;
if ($CCEExamAnswers_list->lDisplayRecs <= 0 || ($CCEExamAnswers->Export <> "" && $CCEExamAnswers->ExportAll)) // Display all records
$CCEExamAnswers_list->lDisplayRecs = $CCEExamAnswers_list->lTotalRecs;
if (!($CCEExamAnswers->Export <> "" && $CCEExamAnswers->ExportAll))
$CCEExamAnswers_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
$rs = $CCEExamAnswers_list->LoadRecordset($CCEExamAnswers_list->lStartRec-1, $CCEExamAnswers_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEExamAnswers->TableCaption() ?>
<?php if ($CCEExamAnswers->Export == "" && $CCEExamAnswers->CurrentAction == "") { ?>
<a href="<?php echo $CCEExamAnswers_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 $CCEExamAnswers_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 $CCEExamAnswers_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_CCEExamAnswers" id="emf_CCEExamAnswers" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEExamAnswers',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fCCEExamAnswerslist,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 ($CCEExamAnswers->Export == "" && $CCEExamAnswers->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(CCEExamAnswers_list);" style="text-decoration: none;"><img id="CCEExamAnswers_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="CCEExamAnswers_list_SearchPanel">
<form name="fCCEExamAnswerslistsrch" id="fCCEExamAnswerslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>" onsubmit="return CCEExamAnswers_list.ValidateSearch(this);">
<input type="hidden" id="t" name="t" value="CCEExamAnswers">
<?php
if ($gsSearchError == "")
$CCEExamAnswers_list->LoadAdvancedSearch(); // Load advanced search
// Render for search
$CCEExamAnswers->RowType = EW_ROWTYPE_SEARCH;
// Render row
$CCEExamAnswers_list->RenderRow();
?>
<table class="ewBasicSearch">
<tr>
<td><span class="phpmaker"><?php echo $CCEExamAnswers->Question_ID->FldCaption() ?></span></td>
<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Question_ID" id="z_Question_ID" value="="></span></td>
<td>
<div style="white-space: nowrap;">
<span class="phpmaker" style="float: left;">
<?php if ($CCEExamAnswers->Question_ID->getSessionValue() <> "") { ?>
<div<?php echo $CCEExamAnswers->Question_ID->ViewAttributes() ?>><?php echo $CCEExamAnswers->Question_ID->ListViewValue() ?></div>
<input type="hidden" id="x_Question_ID" name="x_Question_ID" value="<?php echo ew_HtmlEncode($CCEExamAnswers->Question_ID->AdvancedSearch->SearchValue) ?>">
<?php } else { ?>
<select id="x_Question_ID" name="x_Question_ID" title="<?php echo $CCEExamAnswers->Question_ID->FldTitle() ?>"<?php echo $CCEExamAnswers->Question_ID->EditAttributes() ?>>
<?php
if (is_array($CCEExamAnswers->Question_ID->EditValue)) {
$arwrk = $CCEExamAnswers->Question_ID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamAnswers->Question_ID->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
<?php if ($arwrk[$rowcntwrk][2] <> "") { ?>
<?php echo ew_ValueSeparator($rowcntwrk) ?><?php echo $arwrk[$rowcntwrk][2] ?>
<?php } ?>
</option>
<?php
}
}
?>
</select>
<?php } ?>
</span>
</div>
</td>
</tr>
</table>
<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($CCEExamAnswers->getSessionBasicSearchKeyword()) ?>">
<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">
<a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>
<a href="CCEExamAnswerssrch.php"><?php echo $Language->Phrase("AdvancedSearch") ?></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 ($CCEExamAnswers->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 ($CCEExamAnswers->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 ($CCEExamAnswers->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();
$CCEExamAnswers_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($CCEExamAnswers->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($CCEExamAnswers->CurrentAction <> "gridadd" && $CCEExamAnswers->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($CCEExamAnswers_list->Pager)) $CCEExamAnswers_list->Pager = new cPrevNextPager($CCEExamAnswers_list->lStartRec, $CCEExamAnswers_list->lDisplayRecs, $CCEExamAnswers_list->lTotalRecs) ?>
<?php if ($CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 $CCEExamAnswers_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEExamAnswers_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 $CCEExamAnswers_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEExamAnswers_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEExamAnswers_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEExamAnswers_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEExamAnswers_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 $CCEExamAnswers_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
</div>
<?php } ?>
<form name="fCCEExamAnswerslist" id="fCCEExamAnswerslist" class="ewForm" action="" method="post">
<div id="gmp_CCEExamAnswers" class="ewGridMiddlePanel">
<?php if ($CCEExamAnswers_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $CCEExamAnswers->TableCustomInnerHtml ?>
<thead><!-- Table header -->
<tr class="ewTableHeader">
<?php
// Render list options
$CCEExamAnswers_list->RenderListOptions();
// Render list options (header, left)
$CCEExamAnswers_list->ListOptions->Render("header", "left");
?>
<?php if ($CCEExamAnswers->Answer_ID->Visible) { // Answer_ID ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_ID) == "") { ?>
<td><?php echo $CCEExamAnswers->Answer_ID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_ID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Answer_ID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Answer_ID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Answer_ID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->Question_ID->Visible) { // Question_ID ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Question_ID) == "") { ?>
<td><?php echo $CCEExamAnswers->Question_ID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Question_ID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Question_ID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Question_ID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Question_ID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->Answer->Visible) { // Answer ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Answer) == "") { ?>
<td><?php echo $CCEExamAnswers->Answer->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Answer) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Answer->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Answer->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Answer->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->Answer_Score->Visible) { // Answer_Score ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_Score) == "") { ?>
<td><?php echo $CCEExamAnswers->Answer_Score->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_Score) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Answer_Score->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Answer_Score->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Answer_Score->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->Display_Order->Visible) { // Display_Order ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Display_Order) == "") { ?>
<td><?php echo $CCEExamAnswers->Display_Order->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Display_Order) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Display_Order->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Display_Order->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Display_Order->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->Answer_Text_Len->Visible) { // Answer_Text_Len ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_Text_Len) == "") { ?>
<td><?php echo $CCEExamAnswers->Answer_Text_Len->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->Answer_Text_Len) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->Answer_Text_Len->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->Answer_Text_Len->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->Answer_Text_Len->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->TextAfter->Visible) { // TextAfter ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->TextAfter) == "") { ?>
<td><?php echo $CCEExamAnswers->TextAfter->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->TextAfter) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->TextAfter->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->TextAfter->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->TextAfter->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->BarColour->Visible) { // BarColour ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->BarColour) == "") { ?>
<td><?php echo $CCEExamAnswers->BarColour->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->BarColour) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->BarColour->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->BarColour->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->BarColour->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
</div></td>
<?php } ?>
<?php } ?>
<?php if ($CCEExamAnswers->ParentAnswerID->Visible) { // ParentAnswerID ?>
<?php if ($CCEExamAnswers->SortUrl($CCEExamAnswers->ParentAnswerID) == "") { ?>
<td><?php echo $CCEExamAnswers->ParentAnswerID->FldCaption() ?></td>
<?php } else { ?>
<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $CCEExamAnswers->SortUrl($CCEExamAnswers->ParentAnswerID) ?>',2);">
<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $CCEExamAnswers->ParentAnswerID->FldCaption() ?></td><td style="width: 10px;"><?php if ($CCEExamAnswers->ParentAnswerID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($CCEExamAnswers->ParentAnswerID->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)
$CCEExamAnswers_list->ListOptions->Render("header", "right");
?>
</tr>
</thead>
<?php
if ($CCEExamAnswers->ExportAll && $CCEExamAnswers->Export <> "") {
$CCEExamAnswers_list->lStopRec = $CCEExamAnswers_list->lTotalRecs;
} else {
$CCEExamAnswers_list->lStopRec = $CCEExamAnswers_list->lStartRec + $CCEExamAnswers_list->lDisplayRecs - 1; // Set the last record to display
}
$CCEExamAnswers_list->lRecCount = $CCEExamAnswers_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
$rs->MoveFirst();
if (!$bSelectLimit && $CCEExamAnswers_list->lStartRec > 1)
$rs->Move($CCEExamAnswers_list->lStartRec - 1);
}
// Initialize aggregate
$CCEExamAnswers->RowType = EW_ROWTYPE_AGGREGATEINIT;
$CCEExamAnswers_list->RenderRow();
$CCEExamAnswers_list->lRowCnt = 0;
while (($CCEExamAnswers->CurrentAction == "gridadd" || !$rs->EOF) &&
$CCEExamAnswers_list->lRecCount < $CCEExamAnswers_list->lStopRec) {
$CCEExamAnswers_list->lRecCount++;
if (intval($CCEExamAnswers_list->lRecCount) >= intval($CCEExamAnswers_list->lStartRec)) {
$CCEExamAnswers_list->lRowCnt++;
// Init row class and style
$CCEExamAnswers->CssClass = "";
$CCEExamAnswers->CssStyle = "";
$CCEExamAnswers->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
if ($CCEExamAnswers->CurrentAction == "gridadd") {
$CCEExamAnswers_list->LoadDefaultValues(); // Load default values
} else {
$CCEExamAnswers_list->LoadRowValues($rs); // Load row values
}
$CCEExamAnswers->RowType = EW_ROWTYPE_VIEW; // Render view
// Render row
$CCEExamAnswers_list->RenderRow();
// Render list options
$CCEExamAnswers_list->RenderListOptions();
?>
<tr<?php echo $CCEExamAnswers->RowAttributes() ?>>
<?php
// Render list options (body, left)
$CCEExamAnswers_list->ListOptions->Render("body", "left");
?>
<?php if ($CCEExamAnswers->Answer_ID->Visible) { // Answer_ID ?>
<td<?php echo $CCEExamAnswers->Answer_ID->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Answer_ID->ViewAttributes() ?>><?php echo $CCEExamAnswers->Answer_ID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->Question_ID->Visible) { // Question_ID ?>
<td<?php echo $CCEExamAnswers->Question_ID->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Question_ID->ViewAttributes() ?>><?php echo $CCEExamAnswers->Question_ID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->Answer->Visible) { // Answer ?>
<td<?php echo $CCEExamAnswers->Answer->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Answer->ViewAttributes() ?>><?php echo $CCEExamAnswers->Answer->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->Answer_Score->Visible) { // Answer_Score ?>
<td<?php echo $CCEExamAnswers->Answer_Score->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Answer_Score->ViewAttributes() ?>><?php echo $CCEExamAnswers->Answer_Score->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->Display_Order->Visible) { // Display_Order ?>
<td<?php echo $CCEExamAnswers->Display_Order->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Display_Order->ViewAttributes() ?>><?php echo $CCEExamAnswers->Display_Order->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->Answer_Text_Len->Visible) { // Answer_Text_Len ?>
<td<?php echo $CCEExamAnswers->Answer_Text_Len->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->Answer_Text_Len->ViewAttributes() ?>><?php echo $CCEExamAnswers->Answer_Text_Len->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->TextAfter->Visible) { // TextAfter ?>
<td<?php echo $CCEExamAnswers->TextAfter->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->TextAfter->ViewAttributes() ?>><?php echo $CCEExamAnswers->TextAfter->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->BarColour->Visible) { // BarColour ?>
<td<?php echo $CCEExamAnswers->BarColour->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->BarColour->ViewAttributes() ?>><?php echo $CCEExamAnswers->BarColour->ListViewValue() ?></div>
</td>
<?php } ?>
<?php if ($CCEExamAnswers->ParentAnswerID->Visible) { // ParentAnswerID ?>
<td<?php echo $CCEExamAnswers->ParentAnswerID->CellAttributes() ?>>
<div<?php echo $CCEExamAnswers->ParentAnswerID->ViewAttributes() ?>><?php echo $CCEExamAnswers->ParentAnswerID->ListViewValue() ?></div>
</td>
<?php } ?>
<?php
// Render list options (body, right)
$CCEExamAnswers_list->ListOptions->Render("body", "right");
?>
</tr>
<?php
}
if ($CCEExamAnswers->CurrentAction <> "gridadd")
$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php
// Close recordset
if ($rs)
$rs->Close();
?>
<?php if ($CCEExamAnswers_list->lTotalRecs > 0) { ?>
<?php if ($CCEExamAnswers->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($CCEExamAnswers->CurrentAction <> "gridadd" && $CCEExamAnswers->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($CCEExamAnswers_list->Pager)) $CCEExamAnswers_list->Pager = new cPrevNextPager($CCEExamAnswers_list->lStartRec, $CCEExamAnswers_list->lDisplayRecs, $CCEExamAnswers_list->lTotalRecs) ?>
<?php if ($CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->FirstButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->PrevButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 $CCEExamAnswers_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
<?php if ($CCEExamAnswers_list->Pager->NextButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 ($CCEExamAnswers_list->Pager->LastButton->Enabled) { ?>
<td><a href="<?php echo $CCEExamAnswers_list->PageUrl() ?>start=<?php echo $CCEExamAnswers_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 $CCEExamAnswers_list->Pager->PageCount ?></span></td>
</tr></table>
</td>
<td> </td>
<td>
<span class="phpmaker"><?php echo $Language->Phrase("Record") ?> <?php echo $CCEExamAnswers_list->Pager->FromIndex ?> <?php echo $Language->Phrase("To") ?> <?php echo $CCEExamAnswers_list->Pager->ToIndex ?> <?php echo $Language->Phrase("Of") ?> <?php echo $CCEExamAnswers_list->Pager->RecordCount ?></span>
<?php } else { ?>
<?php if ($Security->CanList()) { ?>
<?php if ($CCEExamAnswers_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 ($CCEExamAnswers_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEExamAnswers_list->AddUrl ?>"><?php echo $Language->Phrase("AddLink") ?></a>
<?php } ?>
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($CCEExamAnswers->Export == "" && $CCEExamAnswers->CurrentAction == "") { ?>
<?php } ?>
<?php if ($CCEExamAnswers->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
$CCEExamAnswers_list->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEExamAnswers_list {
// Page ID
var $PageID = 'list';
// Table name
var $TableName = 'CCEExamAnswers';
// Page object name
var $PageObjName = 'CCEExamAnswers_list';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEExamAnswers;
if ($CCEExamAnswers->UseTokenInUrl) $PageUrl .= "t=" . $CCEExamAnswers->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, $CCEExamAnswers;
if ($CCEExamAnswers->UseTokenInUrl) {
if ($objForm)
return ($CCEExamAnswers->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEExamAnswers->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEExamAnswers)
$GLOBALS["CCEExamAnswers"] = new cCCEExamAnswers();
// 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["CCEExamAnswers"]->AddUrl();
$this->InlineAddUrl = $this->PageUrl() . "a=add";
$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
$this->MultiDeleteUrl = "CCEExamAnswersdelete.php";
$this->MultiUpdateUrl = "CCEExamAnswersupdate.php";
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// Table object (CCEExamQuestions)
$GLOBALS['CCEExamQuestions'] = new cCCEExamQuestions();
// 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", 'CCEExamAnswers', 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 $CCEExamAnswers;
// 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"] <> "") {
$CCEExamAnswers->Export = $_GET["export"];
} elseif (ew_IsHttpPost()) {
if (@$_POST["exporttype"] <> "")
$CCEExamAnswers->Export = $_POST["exporttype"];
} else {
$CCEExamAnswers->setExportReturnUrl(ew_CurrentUrl());
}
$gsExport = $CCEExamAnswers->Export; // Get export parameter, used in header
$gsExportFile = $CCEExamAnswers->TableVar; // Get export file, used in header
if ($CCEExamAnswers->Export == "excel") {
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
}
if ($CCEExamAnswers->Export == "word") {
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
}
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
// Class variables
var $ListOptions; // List options
var $lDisplayRecs = 40;
var $lStartRec;
var $lStopRec;
var $lTotalRecs = 0;
var $lRecRange = 10;
var $sSrchWhere = ""; // Search WHERE clause
var $lRecCnt = 0; // Record count
var $lEditRowCnt;
var $lRowCnt;
var $lRowIndex; // Row index
var $lRecPerRow = 0;
var $lColCnt = 0;
var $sDbMasterFilter = ""; // Master filter
var $sDbDetailFilter = ""; // Detail filter
var $bMasterRecordExists;
var $sMultiSelectKey;
var $RestoreSearch;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsSearchError, $Security, $CCEExamAnswers;
// 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();
// Get and validate search values for advanced search
$this->LoadSearchValues(); // Get search values
if (!$this->ValidateSearch())
$this->setMessage($gsSearchError);
// Restore search parms from Session
$this->RestoreSearchParms();
// Call Recordset SearchValidated event
$CCEExamAnswers->Recordset_SearchValidated();
// Set up sorting order
$this->SetUpSortOrder();
// Get basic search criteria
if ($gsSearchError == "")
$sSrchBasic = $this->BasicSearchWhere();
// Get search criteria for advanced search
if ($gsSearchError == "")
$sSrchAdvanced = $this->AdvancedSearchWhere();
}
// Restore display records
if ($CCEExamAnswers->getRecordsPerPage() <> "") {
$this->lDisplayRecs = $CCEExamAnswers->getRecordsPerPage(); // Restore from Session
} else {
$this->lDisplayRecs = 40; // Load default
}
// Load Sorting Order
$this->LoadSortOrder();
// Build search criteria
if ($sSrchAdvanced <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
if ($sSrchBasic <> "")
$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;
// Call Recordset_Searching event
$CCEExamAnswers->Recordset_Searching($this->sSrchWhere);
// Save search criteria
if ($this->sSrchWhere <> "") {
if ($sSrchBasic == "")
$this->ResetBasicSearchParms();
if ($sSrchAdvanced == "")
$this->ResetAdvancedSearchParms();
$CCEExamAnswers->setSearchWhere($this->sSrchWhere); // Save to Session
if (!$this->RestoreSearch) {
$this->lStartRec = 1; // Reset start record counter
$CCEExamAnswers->setStartRecordNumber($this->lStartRec);
}
} else {
$this->sSrchWhere = $CCEExamAnswers->getSearchWhere();
}
// Build filter
$sFilter = "";
if (!$Security->CanList())
$sFilter = "(0=1)"; // Filter all records
// Restore master/detail filter
$this->sDbMasterFilter = $CCEExamAnswers->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEExamAnswers->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 ($CCEExamAnswers->getMasterFilter() <> "" && $CCEExamAnswers->getCurrentMasterTable() == "CCEExamQuestions") {
global $CCEExamQuestions;
$rsmaster = $CCEExamQuestions->LoadRs($this->sDbMasterFilter);
$this->bMasterRecordExists = ($rsmaster && !$rsmaster->EOF);
if (!$this->bMasterRecordExists) {
$CCEExamAnswers->setMasterFilter(""); // Clear master filter
$CCEExamAnswers->setDetailFilter(""); // Clear detail filter
$this->setMessage($Language->Phrase("NoRecord")); // Set no record found
$this->Page_Terminate($CCEExamAnswers->getReturnUrl()); // Return to caller
} else {
$CCEExamQuestions->LoadListRowValues($rsmaster);
$CCEExamQuestions->RowType = EW_ROWTYPE_MASTER; // Master row
$CCEExamQuestions->RenderListRow();
$rsmaster->Close();
}
}
// Set up filter in session
$CCEExamAnswers->setSessionWhere($sFilter);
$CCEExamAnswers->CurrentFilter = "";
// Export data only
if (in_array($CCEExamAnswers->Export, array("html","word","excel","xml","csv","email"))) {
$this->ExportData();
if ($CCEExamAnswers->Export <> "email")
$this->Page_Terminate(); // Terminate response
exit();
}
}
// Advanced search WHERE clause based on QueryString
function AdvancedSearchWhere() {
global $Security, $CCEExamAnswers;
$sWhere = "";
if (!$Security->CanSearch()) return "";
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Answer_ID, FALSE); // Answer_ID
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Question_ID, FALSE); // Question_ID
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Answer, FALSE); // Answer
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Answer_Score, FALSE); // Answer_Score
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Display_Order, FALSE); // Display_Order
$this->BuildSearchSql($sWhere, $CCEExamAnswers->Answer_Text_Len, FALSE); // Answer_Text_Len
$this->BuildSearchSql($sWhere, $CCEExamAnswers->TextAfter, FALSE); // TextAfter
$this->BuildSearchSql($sWhere, $CCEExamAnswers->BarColour, FALSE); // BarColour
$this->BuildSearchSql($sWhere, $CCEExamAnswers->ParentAnswerID, FALSE); // ParentAnswerID
// Set up search parm
if ($sWhere <> "") {
$this->SetSearchParm($CCEExamAnswers->Answer_ID); // Answer_ID
$this->SetSearchParm($CCEExamAnswers->Question_ID); // Question_ID
$this->SetSearchParm($CCEExamAnswers->Answer); // Answer
$this->SetSearchParm($CCEExamAnswers->Answer_Score); // Answer_Score
$this->SetSearchParm($CCEExamAnswers->Display_Order); // Display_Order
$this->SetSearchParm($CCEExamAnswers->Answer_Text_Len); // Answer_Text_Len
$this->SetSearchParm($CCEExamAnswers->TextAfter); // TextAfter
$this->SetSearchParm($CCEExamAnswers->BarColour); // BarColour
$this->SetSearchParm($CCEExamAnswers->ParentAnswerID); // ParentAnswerID
}
return $sWhere;
}
// Build search SQL
function BuildSearchSql(&$Where, &$Fld, $MultiValue) {
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldOpr = $Fld->AdvancedSearch->SearchOperator; // @$_GET["z_$FldParm"]
$FldCond = $Fld->AdvancedSearch->SearchCondition; // @$_GET["v_$FldParm"]
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldOpr2 = $Fld->AdvancedSearch->SearchOperator2; // @$_GET["w_$FldParm"]
$sWrk = "";
//$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
//$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$FldOpr = strtoupper(trim($FldOpr));
if ($FldOpr == "") $FldOpr = "=";
$FldOpr2 = strtoupper(trim($FldOpr2));
if ($FldOpr2 == "") $FldOpr2 = "=";
if (EW_SEARCH_MULTI_VALUE_OPTION == 1 || $FldOpr <> "LIKE" ||
($FldOpr2 <> "LIKE" && $FldVal2 <> ""))
$MultiValue = FALSE;
if ($MultiValue) {
$sWrk1 = ($FldVal <> "") ? ew_GetMultiSearchSql($Fld, $FldVal) : ""; // Field value 1
$sWrk2 = ($FldVal2 <> "") ? ew_GetMultiSearchSql($Fld, $FldVal2) : ""; // Field value 2
$sWrk = $sWrk1; // Build final SQL
if ($sWrk2 <> "")
$sWrk = ($sWrk <> "") ? "($sWrk) $FldCond ($sWrk2)" : $sWrk2;
} else {
$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
$sWrk = ew_GetSearchSql($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2);
}
if ($sWrk <> "") {
if ($Where <> "") $Where .= " AND ";
$Where .= "(" . $sWrk . ")";
}
}
// Set search parameters
function SetSearchParm(&$Fld) {
global $CCEExamAnswers;
$FldParm = substr($Fld->FldVar, 2);
$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
$FldVal = ew_StripSlashes($FldVal);
if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
$FldVal2 = ew_StripSlashes($FldVal2);
if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
$CCEExamAnswers->setAdvancedSearch("x_$FldParm", $FldVal);
$CCEExamAnswers->setAdvancedSearch("z_$FldParm", $Fld->AdvancedSearch->SearchOperator); // @$_GET["z_$FldParm"]
$CCEExamAnswers->setAdvancedSearch("v_$FldParm", $Fld->AdvancedSearch->SearchCondition); // @$_GET["v_$FldParm"]
$CCEExamAnswers->setAdvancedSearch("y_$FldParm", $FldVal2);
$CCEExamAnswers->setAdvancedSearch("w_$FldParm", $Fld->AdvancedSearch->SearchOperator2); // @$_GET["w_$FldParm"]
}
// Get search parameters
function GetSearchParm(&$Fld) {
global $CCEExamAnswers;
$FldParm = substr($Fld->FldVar, 2);
$Fld->AdvancedSearch->SearchValue = $CCEExamAnswers->GetAdvancedSearch("x_$FldParm");
$Fld->AdvancedSearch->SearchOperator = $CCEExamAnswers->GetAdvancedSearch("z_$FldParm");
$Fld->AdvancedSearch->SearchCondition = $CCEExamAnswers->GetAdvancedSearch("v_$FldParm");
$Fld->AdvancedSearch->SearchValue2 = $CCEExamAnswers->GetAdvancedSearch("y_$FldParm");
$Fld->AdvancedSearch->SearchOperator2 = $CCEExamAnswers->GetAdvancedSearch("w_$FldParm");
}
// Convert search value
function ConvertSearchValue(&$Fld, $FldVal) {
$Value = $FldVal;
if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
if ($FldVal <> "") $Value = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
} elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
if ($FldVal <> "") $Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
}
return $Value;
}
// Return basic search SQL
function BasicSearchSQL($Keyword) {
global $CCEExamAnswers;
$sKeyword = ew_AdjustSql($Keyword);
$sWhere = "";
if (is_numeric($Keyword)) $this->BuildBasicSearchSQL($sWhere, $CCEExamAnswers->Question_ID, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEExamAnswers->TextAfter, $Keyword);
$this->BuildBasicSearchSQL($sWhere, $CCEExamAnswers->BarColour, $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, $CCEExamAnswers;
$sSearchStr = "";
if (!$Security->CanSearch()) return "";
$sSearchKeyword = $CCEExamAnswers->BasicSearchKeyword;
$sSearchType = $CCEExamAnswers->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 <> "") {
$CCEExamAnswers->setSessionBasicSearchKeyword($sSearchKeyword);
$CCEExamAnswers->setSessionBasicSearchType($sSearchType);
}
return $sSearchStr;
}
// Clear all search parameters
function ResetSearchParms() {
global $CCEExamAnswers;
// Clear search WHERE clause
$this->sSrchWhere = "";
$CCEExamAnswers->setSearchWhere($this->sSrchWhere);
// Clear basic search parameters
$this->ResetBasicSearchParms();
// Clear advanced search parameters
$this->ResetAdvancedSearchParms();
}
// Clear all basic search parameters
function ResetBasicSearchParms() {
global $CCEExamAnswers;
$CCEExamAnswers->setSessionBasicSearchKeyword("");
$CCEExamAnswers->setSessionBasicSearchType("");
}
// Clear all advanced search parameters
function ResetAdvancedSearchParms() {
global $CCEExamAnswers;
$CCEExamAnswers->setAdvancedSearch("x_Answer_ID", "");
$CCEExamAnswers->setAdvancedSearch("x_Question_ID", "");
$CCEExamAnswers->setAdvancedSearch("x_Answer", "");
$CCEExamAnswers->setAdvancedSearch("x_Answer_Score", "");
$CCEExamAnswers->setAdvancedSearch("x_Display_Order", "");
$CCEExamAnswers->setAdvancedSearch("x_Answer_Text_Len", "");
$CCEExamAnswers->setAdvancedSearch("x_TextAfter", "");
$CCEExamAnswers->setAdvancedSearch("x_BarColour", "");
$CCEExamAnswers->setAdvancedSearch("x_ParentAnswerID", "");
}
// Restore all search parameters
function RestoreSearchParms() {
global $CCEExamAnswers;
$bRestore = TRUE;
if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
if (@$_GET["x_Answer_ID"] <> "") $bRestore = FALSE;
if (@$_GET["x_Question_ID"] <> "") $bRestore = FALSE;
if (@$_GET["x_Answer"] <> "") $bRestore = FALSE;
if (@$_GET["x_Answer_Score"] <> "") $bRestore = FALSE;
if (@$_GET["x_Display_Order"] <> "") $bRestore = FALSE;
if (@$_GET["x_Answer_Text_Len"] <> "") $bRestore = FALSE;
if (@$_GET["x_TextAfter"] <> "") $bRestore = FALSE;
if (@$_GET["x_BarColour"] <> "") $bRestore = FALSE;
if (@$_GET["x_ParentAnswerID"] <> "") $bRestore = FALSE;
$this->RestoreSearch = $bRestore;
if ($bRestore) {
// Restore basic search values
$CCEExamAnswers->BasicSearchKeyword = $CCEExamAnswers->getSessionBasicSearchKeyword();
$CCEExamAnswers->BasicSearchType = $CCEExamAnswers->getSessionBasicSearchType();
// Restore advanced search values
$this->GetSearchParm($CCEExamAnswers->Answer_ID);
$this->GetSearchParm($CCEExamAnswers->Question_ID);
$this->GetSearchParm($CCEExamAnswers->Answer);
$this->GetSearchParm($CCEExamAnswers->Answer_Score);
$this->GetSearchParm($CCEExamAnswers->Display_Order);
$this->GetSearchParm($CCEExamAnswers->Answer_Text_Len);
$this->GetSearchParm($CCEExamAnswers->TextAfter);
$this->GetSearchParm($CCEExamAnswers->BarColour);
$this->GetSearchParm($CCEExamAnswers->ParentAnswerID);
}
}
// Set up sort parameters
function SetUpSortOrder() {
global $CCEExamAnswers;
// Check for Ctrl pressed
$bCtrl = (@$_GET["ctrl"] <> "");
// Check for "order" parameter
if (@$_GET["order"] <> "") {
$CCEExamAnswers->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
$CCEExamAnswers->CurrentOrderType = @$_GET["ordertype"];
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Answer_ID, $bCtrl); // Answer_ID
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Question_ID, $bCtrl); // Question_ID
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Answer, $bCtrl); // Answer
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Answer_Score, $bCtrl); // Answer_Score
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Display_Order, $bCtrl); // Display_Order
$CCEExamAnswers->UpdateSort($CCEExamAnswers->Answer_Text_Len, $bCtrl); // Answer_Text_Len
$CCEExamAnswers->UpdateSort($CCEExamAnswers->TextAfter, $bCtrl); // TextAfter
$CCEExamAnswers->UpdateSort($CCEExamAnswers->BarColour, $bCtrl); // BarColour
$CCEExamAnswers->UpdateSort($CCEExamAnswers->ParentAnswerID, $bCtrl); // ParentAnswerID
$CCEExamAnswers->setStartRecordNumber(1); // Reset start position
}
}
// Load sort order parameters
function LoadSortOrder() {
global $CCEExamAnswers;
$sOrderBy = $CCEExamAnswers->getSessionOrderBy(); // Get ORDER BY from Session
if ($sOrderBy == "") {
if ($CCEExamAnswers->SqlOrderBy() <> "") {
$sOrderBy = $CCEExamAnswers->SqlOrderBy();
$CCEExamAnswers->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 $CCEExamAnswers;
// 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") {
$CCEExamAnswers->getCurrentMasterTable = ""; // Clear master table
$CCEExamAnswers->setMasterFilter(""); // Clear master filter
$this->sDbMasterFilter = "";
$CCEExamAnswers->setDetailFilter(""); // Clear detail filter
$this->sDbDetailFilter = "";
$CCEExamAnswers->Question_ID->setSessionValue("");
}
// Reset sorting order
if (strtolower($sCmd) == "resetsort") {
$sOrderBy = "";
$CCEExamAnswers->setSessionOrderBy($sOrderBy);
$CCEExamAnswers->Answer_ID->setSort("");
$CCEExamAnswers->Question_ID->setSort("");
$CCEExamAnswers->Answer->setSort("");
$CCEExamAnswers->Answer_Score->setSort("");
$CCEExamAnswers->Display_Order->setSort("");
$CCEExamAnswers->Answer_Text_Len->setSort("");
$CCEExamAnswers->TextAfter->setSort("");
$CCEExamAnswers->BarColour->setSort("");
$CCEExamAnswers->ParentAnswerID->setSort("");
}
// Reset start position
$this->lStartRec = 1;
$CCEExamAnswers->setStartRecordNumber($this->lStartRec);
}
}
// Set up list options
function SetupListOptions() {
global $Security, $CCEExamAnswers;
// "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;
// "copy"
$this->ListOptions->Add("copy");
$item =& $this->ListOptions->Items["copy"];
$item->CssStyle = "white-space: nowrap;";
$item->Visible = $Security->CanAdd();
$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 ($CCEExamAnswers->Export <> "" ||
$CCEExamAnswers->CurrentAction == "gridadd" ||
$CCEExamAnswers->CurrentAction == "gridedit")
$this->ListOptions->HideAllOptions();
}
// Render list options
function RenderListOptions() {
global $Security, $Language, $CCEExamAnswers;
$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>";
}
// "copy"
$oListOpt =& $this->ListOptions->Items["copy"];
if ($Security->CanAdd() && $oListOpt->Visible) {
$oListOpt->Body = "<a href=\"" . $this->CopyUrl . "\">" . "<img src=\"images/copy.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("CopyLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("CopyLink")) . "\" 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, $CCEExamAnswers;
}
// Set up starting record parameters
function SetUpStartRec() {
global $CCEExamAnswers;
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];
$CCEExamAnswers->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;
}
$CCEExamAnswers->setStartRecordNumber($this->lStartRec);
}
}
}
$this->lStartRec = $CCEExamAnswers->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
$CCEExamAnswers->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
$CCEExamAnswers->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
$CCEExamAnswers->setStartRecordNumber($this->lStartRec);
}
}
// Load basic search values
function LoadBasicSearchValues() {
global $CCEExamAnswers;
$CCEExamAnswers->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
$CCEExamAnswers->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
}
// Load search values for validation
function LoadSearchValues() {
global $objForm, $CCEExamAnswers;
// Load search values
// Answer_ID
$CCEExamAnswers->Answer_ID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Answer_ID"]);
$CCEExamAnswers->Answer_ID->AdvancedSearch->SearchOperator = @$_GET["z_Answer_ID"];
// Question_ID
$CCEExamAnswers->Question_ID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Question_ID"]);
$CCEExamAnswers->Question_ID->AdvancedSearch->SearchOperator = @$_GET["z_Question_ID"];
// Answer
$CCEExamAnswers->Answer->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Answer"]);
$CCEExamAnswers->Answer->AdvancedSearch->SearchOperator = @$_GET["z_Answer"];
// Answer_Score
$CCEExamAnswers->Answer_Score->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Answer_Score"]);
$CCEExamAnswers->Answer_Score->AdvancedSearch->SearchOperator = @$_GET["z_Answer_Score"];
// Display_Order
$CCEExamAnswers->Display_Order->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Display_Order"]);
$CCEExamAnswers->Display_Order->AdvancedSearch->SearchOperator = @$_GET["z_Display_Order"];
// Answer_Text_Len
$CCEExamAnswers->Answer_Text_Len->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Answer_Text_Len"]);
$CCEExamAnswers->Answer_Text_Len->AdvancedSearch->SearchOperator = @$_GET["z_Answer_Text_Len"];
// TextAfter
$CCEExamAnswers->TextAfter->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_TextAfter"]);
$CCEExamAnswers->TextAfter->AdvancedSearch->SearchOperator = @$_GET["z_TextAfter"];
// BarColour
$CCEExamAnswers->BarColour->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_BarColour"]);
$CCEExamAnswers->BarColour->AdvancedSearch->SearchOperator = @$_GET["z_BarColour"];
// ParentAnswerID
$CCEExamAnswers->ParentAnswerID->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_ParentAnswerID"]);
$CCEExamAnswers->ParentAnswerID->AdvancedSearch->SearchOperator = @$_GET["z_ParentAnswerID"];
}
// Load recordset
function LoadRecordset($offset = -1, $rowcnt = -1) {
global $conn, $CCEExamAnswers;
// Call Recordset Selecting event
$CCEExamAnswers->Recordset_Selecting($CCEExamAnswers->CurrentFilter);
// Load List page SQL
$sSql = $CCEExamAnswers->SelectSQL();
if ($offset > -1 && $rowcnt > -1)
$sSql .= " LIMIT $offset, $rowcnt";
// Load recordset
$rs = ew_LoadRecordset($sSql);
// Call Recordset Selected event
$CCEExamAnswers->Recordset_Selected($rs);
return $rs;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEExamAnswers;
$sFilter = $CCEExamAnswers->KeyFilter();
// Call Row Selecting event
$CCEExamAnswers->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEExamAnswers->CurrentFilter = $sFilter;
$sSql = $CCEExamAnswers->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEExamAnswers->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEExamAnswers;
$CCEExamAnswers->Answer_ID->setDbValue($rs->fields('Answer_ID'));
$CCEExamAnswers->Question_ID->setDbValue($rs->fields('Question_ID'));
$CCEExamAnswers->Answer->setDbValue($rs->fields('Answer'));
$CCEExamAnswers->Answer_Score->setDbValue($rs->fields('Answer_Score'));
$CCEExamAnswers->Display_Order->setDbValue($rs->fields('Display_Order'));
$CCEExamAnswers->Answer_Text_Len->setDbValue($rs->fields('Answer_Text_Len'));
$CCEExamAnswers->TextAfter->setDbValue($rs->fields('TextAfter'));
$CCEExamAnswers->BarColour->setDbValue($rs->fields('BarColour'));
$CCEExamAnswers->ParentAnswerID->setDbValue($rs->fields('ParentAnswerID'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEExamAnswers;
// Initialize URLs
$this->ViewUrl = $CCEExamAnswers->ViewUrl();
$this->EditUrl = $CCEExamAnswers->EditUrl();
$this->InlineEditUrl = $CCEExamAnswers->InlineEditUrl();
$this->CopyUrl = $CCEExamAnswers->CopyUrl();
$this->InlineCopyUrl = $CCEExamAnswers->InlineCopyUrl();
$this->DeleteUrl = $CCEExamAnswers->DeleteUrl();
// Call Row_Rendering event
$CCEExamAnswers->Row_Rendering();
// Common render codes for all row types
// Answer_ID
$CCEExamAnswers->Answer_ID->CellCssStyle = ""; $CCEExamAnswers->Answer_ID->CellCssClass = "";
$CCEExamAnswers->Answer_ID->CellAttrs = array(); $CCEExamAnswers->Answer_ID->ViewAttrs = array(); $CCEExamAnswers->Answer_ID->EditAttrs = array();
// Question_ID
$CCEExamAnswers->Question_ID->CellCssStyle = ""; $CCEExamAnswers->Question_ID->CellCssClass = "";
$CCEExamAnswers->Question_ID->CellAttrs = array(); $CCEExamAnswers->Question_ID->ViewAttrs = array(); $CCEExamAnswers->Question_ID->EditAttrs = array();
// Answer
$CCEExamAnswers->Answer->CellCssStyle = ""; $CCEExamAnswers->Answer->CellCssClass = "";
$CCEExamAnswers->Answer->CellAttrs = array(); $CCEExamAnswers->Answer->ViewAttrs = array(); $CCEExamAnswers->Answer->EditAttrs = array();
// Answer_Score
$CCEExamAnswers->Answer_Score->CellCssStyle = ""; $CCEExamAnswers->Answer_Score->CellCssClass = "";
$CCEExamAnswers->Answer_Score->CellAttrs = array(); $CCEExamAnswers->Answer_Score->ViewAttrs = array(); $CCEExamAnswers->Answer_Score->EditAttrs = array();
// Display_Order
$CCEExamAnswers->Display_Order->CellCssStyle = ""; $CCEExamAnswers->Display_Order->CellCssClass = "";
$CCEExamAnswers->Display_Order->CellAttrs = array(); $CCEExamAnswers->Display_Order->ViewAttrs = array(); $CCEExamAnswers->Display_Order->EditAttrs = array();
// Answer_Text_Len
$CCEExamAnswers->Answer_Text_Len->CellCssStyle = ""; $CCEExamAnswers->Answer_Text_Len->CellCssClass = "";
$CCEExamAnswers->Answer_Text_Len->CellAttrs = array(); $CCEExamAnswers->Answer_Text_Len->ViewAttrs = array(); $CCEExamAnswers->Answer_Text_Len->EditAttrs = array();
// TextAfter
$CCEExamAnswers->TextAfter->CellCssStyle = ""; $CCEExamAnswers->TextAfter->CellCssClass = "";
$CCEExamAnswers->TextAfter->CellAttrs = array(); $CCEExamAnswers->TextAfter->ViewAttrs = array(); $CCEExamAnswers->TextAfter->EditAttrs = array();
// BarColour
$CCEExamAnswers->BarColour->CellCssStyle = ""; $CCEExamAnswers->BarColour->CellCssClass = "";
$CCEExamAnswers->BarColour->CellAttrs = array(); $CCEExamAnswers->BarColour->ViewAttrs = array(); $CCEExamAnswers->BarColour->EditAttrs = array();
// ParentAnswerID
$CCEExamAnswers->ParentAnswerID->CellCssStyle = ""; $CCEExamAnswers->ParentAnswerID->CellCssClass = "";
$CCEExamAnswers->ParentAnswerID->CellAttrs = array(); $CCEExamAnswers->ParentAnswerID->ViewAttrs = array(); $CCEExamAnswers->ParentAnswerID->EditAttrs = array();
if ($CCEExamAnswers->RowType == EW_ROWTYPE_VIEW) { // View row
// Answer_ID
$CCEExamAnswers->Answer_ID->ViewValue = $CCEExamAnswers->Answer_ID->CurrentValue;
$CCEExamAnswers->Answer_ID->CssStyle = "";
$CCEExamAnswers->Answer_ID->CssClass = "";
$CCEExamAnswers->Answer_ID->ViewCustomAttributes = "";
// Question_ID
if (strval($CCEExamAnswers->Question_ID->CurrentValue) <> "") {
$sFilterWrk = "`Question_ID` = " . ew_AdjustSql($CCEExamAnswers->Question_ID->CurrentValue) . "";
$sSqlWrk = "SELECT `QuestionTitle`, `Question` FROM `CCEExamQuestions`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `Display_Order` Asc";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEExamAnswers->Question_ID->ViewValue = $rswrk->fields('QuestionTitle');
$CCEExamAnswers->Question_ID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Question');
$rswrk->Close();
} else {
$CCEExamAnswers->Question_ID->ViewValue = $CCEExamAnswers->Question_ID->CurrentValue;
}
} else {
$CCEExamAnswers->Question_ID->ViewValue = NULL;
}
$CCEExamAnswers->Question_ID->CssStyle = "";
$CCEExamAnswers->Question_ID->CssClass = "";
$CCEExamAnswers->Question_ID->ViewCustomAttributes = "";
// Answer
$CCEExamAnswers->Answer->ViewValue = $CCEExamAnswers->Answer->CurrentValue;
$CCEExamAnswers->Answer->CssStyle = "";
$CCEExamAnswers->Answer->CssClass = "";
$CCEExamAnswers->Answer->ViewCustomAttributes = "";
// Answer_Score
$CCEExamAnswers->Answer_Score->ViewValue = $CCEExamAnswers->Answer_Score->CurrentValue;
$CCEExamAnswers->Answer_Score->CssStyle = "";
$CCEExamAnswers->Answer_Score->CssClass = "";
$CCEExamAnswers->Answer_Score->ViewCustomAttributes = "";
// Display_Order
$CCEExamAnswers->Display_Order->ViewValue = $CCEExamAnswers->Display_Order->CurrentValue;
$CCEExamAnswers->Display_Order->CssStyle = "";
$CCEExamAnswers->Display_Order->CssClass = "";
$CCEExamAnswers->Display_Order->ViewCustomAttributes = "";
// Answer_Text_Len
$CCEExamAnswers->Answer_Text_Len->ViewValue = $CCEExamAnswers->Answer_Text_Len->CurrentValue;
$CCEExamAnswers->Answer_Text_Len->CssStyle = "";
$CCEExamAnswers->Answer_Text_Len->CssClass = "";
$CCEExamAnswers->Answer_Text_Len->ViewCustomAttributes = "";
// TextAfter
$CCEExamAnswers->TextAfter->ViewValue = $CCEExamAnswers->TextAfter->CurrentValue;
$CCEExamAnswers->TextAfter->CssStyle = "";
$CCEExamAnswers->TextAfter->CssClass = "";
$CCEExamAnswers->TextAfter->ViewCustomAttributes = "";
// BarColour
$CCEExamAnswers->BarColour->ViewValue = $CCEExamAnswers->BarColour->CurrentValue;
$CCEExamAnswers->BarColour->CssStyle = "";
$CCEExamAnswers->BarColour->CssClass = "";
$CCEExamAnswers->BarColour->ViewCustomAttributes = "";
// ParentAnswerID
$CCEExamAnswers->ParentAnswerID->ViewValue = $CCEExamAnswers->ParentAnswerID->CurrentValue;
$CCEExamAnswers->ParentAnswerID->CssStyle = "";
$CCEExamAnswers->ParentAnswerID->CssClass = "";
$CCEExamAnswers->ParentAnswerID->ViewCustomAttributes = "";
// Answer_ID
$CCEExamAnswers->Answer_ID->HrefValue = "";
$CCEExamAnswers->Answer_ID->TooltipValue = "";
// Question_ID
$CCEExamAnswers->Question_ID->HrefValue = "";
$CCEExamAnswers->Question_ID->TooltipValue = "";
// Answer
$CCEExamAnswers->Answer->HrefValue = "";
$CCEExamAnswers->Answer->TooltipValue = "";
// Answer_Score
$CCEExamAnswers->Answer_Score->HrefValue = "";
$CCEExamAnswers->Answer_Score->TooltipValue = "";
// Display_Order
$CCEExamAnswers->Display_Order->HrefValue = "";
$CCEExamAnswers->Display_Order->TooltipValue = "";
// Answer_Text_Len
$CCEExamAnswers->Answer_Text_Len->HrefValue = "";
$CCEExamAnswers->Answer_Text_Len->TooltipValue = "";
// TextAfter
$CCEExamAnswers->TextAfter->HrefValue = "";
$CCEExamAnswers->TextAfter->TooltipValue = "";
// BarColour
$CCEExamAnswers->BarColour->HrefValue = "";
$CCEExamAnswers->BarColour->TooltipValue = "";
// ParentAnswerID
$CCEExamAnswers->ParentAnswerID->HrefValue = "";
$CCEExamAnswers->ParentAnswerID->TooltipValue = "";
} elseif ($CCEExamAnswers->RowType == EW_ROWTYPE_SEARCH) { // Search row
// Answer_ID
$CCEExamAnswers->Answer_ID->EditCustomAttributes = "";
$CCEExamAnswers->Answer_ID->EditValue = ew_HtmlEncode($CCEExamAnswers->Answer_ID->AdvancedSearch->SearchValue);
// Question_ID
$CCEExamAnswers->Question_ID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `Question_ID`, `QuestionTitle`, `Question`, '' AS SelectFilterFld FROM `CCEExamQuestions`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `Display_Order` Asc";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
$CCEExamAnswers->Question_ID->EditValue = $arwrk;
// Answer
$CCEExamAnswers->Answer->EditCustomAttributes = "";
$CCEExamAnswers->Answer->EditValue = ew_HtmlEncode($CCEExamAnswers->Answer->AdvancedSearch->SearchValue);
// Answer_Score
$CCEExamAnswers->Answer_Score->EditCustomAttributes = "";
$CCEExamAnswers->Answer_Score->EditValue = ew_HtmlEncode($CCEExamAnswers->Answer_Score->AdvancedSearch->SearchValue);
// Display_Order
$CCEExamAnswers->Display_Order->EditCustomAttributes = "";
$CCEExamAnswers->Display_Order->EditValue = ew_HtmlEncode($CCEExamAnswers->Display_Order->AdvancedSearch->SearchValue);
// Answer_Text_Len
$CCEExamAnswers->Answer_Text_Len->EditCustomAttributes = "";
$CCEExamAnswers->Answer_Text_Len->EditValue = ew_HtmlEncode($CCEExamAnswers->Answer_Text_Len->AdvancedSearch->SearchValue);
// TextAfter
$CCEExamAnswers->TextAfter->EditCustomAttributes = "";
$CCEExamAnswers->TextAfter->EditValue = ew_HtmlEncode($CCEExamAnswers->TextAfter->AdvancedSearch->SearchValue);
// BarColour
$CCEExamAnswers->BarColour->EditCustomAttributes = "";
$CCEExamAnswers->BarColour->EditValue = ew_HtmlEncode($CCEExamAnswers->BarColour->AdvancedSearch->SearchValue);
// ParentAnswerID
$CCEExamAnswers->ParentAnswerID->EditCustomAttributes = "";
$CCEExamAnswers->ParentAnswerID->EditValue = ew_HtmlEncode($CCEExamAnswers->ParentAnswerID->AdvancedSearch->SearchValue);
}
// Call Row Rendered event
if ($CCEExamAnswers->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEExamAnswers->Row_Rendered();
}
// Validate search
function ValidateSearch() {
global $gsSearchError, $CCEExamAnswers;
// Initialize
$gsSearchError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return TRUE;
// Return validate result
$ValidateSearch = ($gsSearchError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
if ($gsSearchError <> "") $gsSearchError .= "<br>";
$gsSearchError .= $sFormCustomError;
}
return $ValidateSearch;
}
// Load advanced search
function LoadAdvancedSearch() {
global $CCEExamAnswers;
$CCEExamAnswers->Answer_ID->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Answer_ID");
$CCEExamAnswers->Question_ID->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Question_ID");
$CCEExamAnswers->Answer->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Answer");
$CCEExamAnswers->Answer_Score->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Answer_Score");
$CCEExamAnswers->Display_Order->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Display_Order");
$CCEExamAnswers->Answer_Text_Len->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_Answer_Text_Len");
$CCEExamAnswers->TextAfter->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_TextAfter");
$CCEExamAnswers->BarColour->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_BarColour");
$CCEExamAnswers->ParentAnswerID->AdvancedSearch->SearchValue = $CCEExamAnswers->getAdvancedSearch("x_ParentAnswerID");
}
// Export data in HTML/CSV/Word/Excel/XML/Email format
function ExportData() {
global $CCEExamAnswers;
$utf8 = FALSE;
$bSelectLimit = EW_SELECT_LIMIT;
// Load recordset
if ($bSelectLimit) {
$this->lTotalRecs = $CCEExamAnswers->SelectRecordCount();
} else {
if ($rs = $this->LoadRecordset())
$this->lTotalRecs = $rs->RecordCount();
}
$this->lStartRec = 1;
// Export all
if ($CCEExamAnswers->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 ($CCEExamAnswers->Export == "xml") {
$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
$XmlDoc->AddRoot();
} else {
$ExportDoc = new cExportDocument($CCEExamAnswers, "h");
$ExportDoc->ExportHeader();
if ($ExportDoc->Horizontal) { // Horizontal format, write header
$ExportDoc->BeginExportRow();
$ExportDoc->ExportCaption($CCEExamAnswers->Answer_ID);
$ExportDoc->ExportCaption($CCEExamAnswers->Question_ID);
$ExportDoc->ExportCaption($CCEExamAnswers->Answer);
$ExportDoc->ExportCaption($CCEExamAnswers->Answer_Score);
$ExportDoc->ExportCaption($CCEExamAnswers->Display_Order);
$ExportDoc->ExportCaption($CCEExamAnswers->Answer_Text_Len);
$ExportDoc->ExportCaption($CCEExamAnswers->TextAfter);
$ExportDoc->ExportCaption($CCEExamAnswers->BarColour);
$ExportDoc->ExportCaption($CCEExamAnswers->ParentAnswerID);
$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
$CCEExamAnswers->CssClass = "";
$CCEExamAnswers->CssStyle = "";
$CCEExamAnswers->RowType = EW_ROWTYPE_VIEW; // Render view
$this->RenderRow();
if ($CCEExamAnswers->Export == "xml") {
$XmlDoc->AddRow();
$XmlDoc->AddField('Answer_ID', $CCEExamAnswers->Answer_ID->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('Question_ID', $CCEExamAnswers->Question_ID->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('Answer', $CCEExamAnswers->Answer->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('Answer_Score', $CCEExamAnswers->Answer_Score->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('Display_Order', $CCEExamAnswers->Display_Order->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('Answer_Text_Len', $CCEExamAnswers->Answer_Text_Len->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('TextAfter', $CCEExamAnswers->TextAfter->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('BarColour', $CCEExamAnswers->BarColour->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
$XmlDoc->AddField('ParentAnswerID', $CCEExamAnswers->ParentAnswerID->ExportValue($CCEExamAnswers->Export, $CCEExamAnswers->ExportOriginalValue));
} else {
$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
$ExportDoc->ExportField($CCEExamAnswers->Answer_ID);
$ExportDoc->ExportField($CCEExamAnswers->Question_ID);
$ExportDoc->ExportField($CCEExamAnswers->Answer);
$ExportDoc->ExportField($CCEExamAnswers->Answer_Score);
$ExportDoc->ExportField($CCEExamAnswers->Display_Order);
$ExportDoc->ExportField($CCEExamAnswers->Answer_Text_Len);
$ExportDoc->ExportField($CCEExamAnswers->TextAfter);
$ExportDoc->ExportField($CCEExamAnswers->BarColour);
$ExportDoc->ExportField($CCEExamAnswers->ParentAnswerID);
$ExportDoc->EndExportRow();
}
}
$rs->MoveNext();
}
if ($CCEExamAnswers->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($CCEExamAnswers->Export, array("email", "xml")))
echo "\xEF\xBB\xBF";
// Write debug message if enabled
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
// Output data
if ($CCEExamAnswers->Export == "xml") {
header("Content-Type: text/xml");
echo $XmlDoc->XML();
} elseif ($CCEExamAnswers->Export == "email") {
$this->ExportEmail($ExportDoc->Text);
$this->Page_Terminate($CCEExamAnswers->ExportReturnUrl());
} else {
echo $ExportDoc->Text;
}
}
// Export email
function ExportEmail($EmailContent) {
global $Language, $CCEExamAnswers;
$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 ($CCEExamAnswers->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 $CCEExamAnswers;
// Initialize
$sQry = "export=html";
// Build QueryString for search
if ($CCEExamAnswers->getSessionBasicSearchKeyword() <> "") {
$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $CCEExamAnswers->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $CCEExamAnswers->getSessionBasicSearchType();
}
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Answer_ID); // Answer_ID
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Question_ID); // Question_ID
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Answer); // Answer
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Answer_Score); // Answer_Score
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Display_Order); // Display_Order
$this->AddSearchQueryString($sQry, $CCEExamAnswers->Answer_Text_Len); // Answer_Text_Len
$this->AddSearchQueryString($sQry, $CCEExamAnswers->TextAfter); // TextAfter
$this->AddSearchQueryString($sQry, $CCEExamAnswers->BarColour); // BarColour
$this->AddSearchQueryString($sQry, $CCEExamAnswers->ParentAnswerID); // ParentAnswerID
// Build QueryString for pager
$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $CCEExamAnswers->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $CCEExamAnswers->getStartRecordNumber();
return $sQry;
}
// Add search QueryString
function AddSearchQueryString(&$Qry, &$Fld) {
global $CCEExamAnswers;
$FldParm = substr($Fld->FldVar, 2);
$FldSearchValue = $CCEExamAnswers->GetAdvancedSearch("x_" . $FldParm);
if (strval($FldSearchValue) <> "") {
$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
"&z_" . $FldParm . "=" . $CCEExamAnswers->GetAdvancedSearch("z_" . $FldParm);
}
$FldSearchValue2 = $CCEExamAnswers->GetAdvancedSearch("y_" . $FldParm);
if (strval($FldSearchValue2) <> "") {
$Qry .= "&v_" . $FldParm . "=" . $CCEExamAnswers->GetAdvancedSearch("v_" . $FldParm) .
"&y_" . $FldParm . "=" . $FldSearchValue2 .
"&w_" . $FldParm . "=" . $CCEExamAnswers->GetAdvancedSearch("w_" . $FldParm);
}
}
// Set up master/detail based on QueryString
function SetUpMasterDetail() {
global $CCEExamAnswers;
$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 == "CCEExamQuestions") {
$bValidMaster = TRUE;
$this->sDbMasterFilter = $CCEExamAnswers->SqlMasterFilter_CCEExamQuestions();
$this->sDbDetailFilter = $CCEExamAnswers->SqlDetailFilter_CCEExamQuestions();
if (@$_GET["Question_ID"] <> "") {
$GLOBALS["CCEExamQuestions"]->Question_ID->setQueryStringValue($_GET["Question_ID"]);
$CCEExamAnswers->Question_ID->setQueryStringValue($GLOBALS["CCEExamQuestions"]->Question_ID->QueryStringValue);
$CCEExamAnswers->Question_ID->setSessionValue($CCEExamAnswers->Question_ID->QueryStringValue);
if (!is_numeric($GLOBALS["CCEExamQuestions"]->Question_ID->QueryStringValue)) $bValidMaster = FALSE;
$this->sDbMasterFilter = str_replace("@Question_ID@", ew_AdjustSql($GLOBALS["CCEExamQuestions"]->Question_ID->QueryStringValue), $this->sDbMasterFilter);
$this->sDbDetailFilter = str_replace("@Question_ID@", ew_AdjustSql($GLOBALS["CCEExamQuestions"]->Question_ID->QueryStringValue), $this->sDbDetailFilter);
} else {
$bValidMaster = FALSE;
}
}
}
if ($bValidMaster) {
// Save current master table
$CCEExamAnswers->setCurrentMasterTable($sMasterTblVar);
// Reset start record counter (new master key)
$this->lStartRec = 1;
$CCEExamAnswers->setStartRecordNumber($this->lStartRec);
$CCEExamAnswers->setMasterFilter($this->sDbMasterFilter); // Set up master filter
$CCEExamAnswers->setDetailFilter($this->sDbDetailFilter); // Set up detail filter
// Clear previous master key from Session
if ($sMasterTblVar <> "CCEExamQuestions") {
if ($CCEExamAnswers->Question_ID->QueryStringValue == "") $CCEExamAnswers->Question_ID->setSessionValue("");
}
} else {
$this->sDbMasterFilter = $CCEExamAnswers->getMasterFilter(); // Restore master filter
$this->sDbDetailFilter = $CCEExamAnswers->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";
}
}
?>