| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEExamQuestionsadd.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 "CCEExamQuestionsinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
// Create page object
$CCEExamQuestions_add = new cCCEExamQuestions_add();
$Page =& $CCEExamQuestions_add;
// Page init
$CCEExamQuestions_add->Page_Init();
// Page main
$CCEExamQuestions_add->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEExamQuestions_add = new ew_Page("CCEExamQuestions_add");
// page properties
CCEExamQuestions_add.PageID = "add"; // page ID
CCEExamQuestions_add.FormID = "fCCEExamQuestionsadd"; // form ID
var EW_PAGE_ID = CCEExamQuestions_add.PageID; // for backward compatibility
// extend page with ValidateForm function
CCEExamQuestions_add.ValidateForm = function(fobj) {
ew_PostAutoSuggest(fobj);
if (!this.ValidateRequired)
return true; // ignore validation
if (fobj.a_confirm && fobj.a_confirm.value == "F")
return true;
var i, elm, aelm, infix;
var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
for (i=0; i<rowcnt; i++) {
infix = (fobj.key_count) ? String(i+1) : "";
elm = fobj.elements["x" + infix + "_Display_Order"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->Display_Order->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_Answer_Template"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->Answer_Template->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_RequireNumber"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->RequireNumber->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_MinNum"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->MinNum->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_MaxNum"];
if (elm && !ew_CheckInteger(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->MaxNum->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_NumMarks"];
if (elm && !ew_CheckNumber(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEExamQuestions->NumMarks->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with Form_CustomValidate function
CCEExamQuestions_add.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) { ?>
CCEExamQuestions_add.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEExamQuestions_add.ValidateRequired = false; // no JavaScript validation
<?php } ?>
//-->
</script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="js/ckeditor-patch.js"></script>
<script type="text/javascript">
<!--
_width_multiplier = 20;
_height_multiplier = 60;
var ew_DHTMLEditors = [];
// update value from editor to textarea
function ew_UpdateTextArea() {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst;
for (inst in CKEDITOR.instances)
CKEDITOR.instances[inst].updateElement();
}
}
// update value from textarea to editor
function ew_UpdateDHTMLEditor(name) {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst = CKEDITOR.instances[name];
if (inst)
inst.setData(inst.element.value);
}
}
// focus editor
function ew_FocusDHTMLEditor(name) {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst = CKEDITOR.instances[name];
if (inst)
inst.focus();
}
}
//-->
</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>
<p><span class="phpmaker"><?php echo $Language->Phrase("Add") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEExamQuestions->TableCaption() ?><br><br>
<a href="<?php echo $CCEExamQuestions->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEExamQuestions_add->ShowMessage();
?>
<form name="fCCEExamQuestionsadd" id="fCCEExamQuestionsadd" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEExamQuestions_add.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEExamQuestions">
<input type="hidden" name="a_add" id="a_add" value="A">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEExamQuestions->Questionnaire_ID->Visible) { // Questionnaire_ID ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Questionnaire_ID->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Questionnaire_ID->CellAttributes() ?>><span id="el_Questionnaire_ID">
<?php $CCEExamQuestions->Questionnaire_ID->EditAttrs["onchange"] = "ew_UpdateOpt('x_Section_ID','x_Questionnaire_ID',true); " . @$CCEExamQuestions->Questionnaire_ID->EditAttrs["onchange"]; ?>
<select id="x_Questionnaire_ID" name="x_Questionnaire_ID" title="<?php echo $CCEExamQuestions->Questionnaire_ID->FldTitle() ?>"<?php echo $CCEExamQuestions->Questionnaire_ID->EditAttributes() ?>>
<?php
if (is_array($CCEExamQuestions->Questionnaire_ID->EditValue)) {
$arwrk = $CCEExamQuestions->Questionnaire_ID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->Questionnaire_ID->CurrentValue) == 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] ?>
</option>
<?php
}
}
?>
</select>
</span><?php echo $CCEExamQuestions->Questionnaire_ID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Section_ID->Visible) { // Section_ID ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Section_ID->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Section_ID->CellAttributes() ?>><span id="el_Section_ID">
<?php $CCEExamQuestions->Section_ID->EditAttrs["onchange"] = "ew_UpdateOpt('x_ParentQuestionID','x_Section_ID',true); " . @$CCEExamQuestions->Section_ID->EditAttrs["onchange"]; ?>
<select id="x_Section_ID" name="x_Section_ID" title="<?php echo $CCEExamQuestions->Section_ID->FldTitle() ?>"<?php echo $CCEExamQuestions->Section_ID->EditAttributes() ?>>
<?php
if (is_array($CCEExamQuestions->Section_ID->EditValue)) {
$arwrk = $CCEExamQuestions->Section_ID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->Section_ID->CurrentValue) == 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] ?>
</option>
<?php
}
}
?>
</select>
<?php
$sSqlWrk = "SELECT `Section_ID`, `Section_Name`, '' AS Disp2Fld FROM `CCEExamSections`";
$sWhereWrk = "`Questionnaire_ID` IN ({filter_value})";
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `Display_Order` Asc";
$sSqlWrk = TEAencrypt($sSqlWrk, EW_RANDOM_KEY);
?>
<input type="hidden" name="s_x_Section_ID" id="s_x_Section_ID" value="<?php echo $sSqlWrk; ?>">
<input type="hidden" name="lft_x_Section_ID" id="lft_x_Section_ID" value="1">
</span><?php echo $CCEExamQuestions->Section_ID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Question->Visible) { // Question ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Question->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Question->CellAttributes() ?>><span id="el_Question">
<textarea name="x_Question" id="x_Question" title="<?php echo $CCEExamQuestions->Question->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEExamQuestions->Question->EditAttributes() ?>><?php echo $CCEExamQuestions->Question->EditValue ?></textarea>
<script type="text/javascript">
<!--
ew_DHTMLEditors.push(new ew_DHTMLEditor("x_Question", function() {
var oCKeditor = CKEDITOR.replace('x_Question', { width: 35*_width_multiplier, height: 4*_height_multiplier, autoUpdateElement: false, baseHref: 'ckeditor/'});
this.active = true;
}));
-->
</script>
</span><?php echo $CCEExamQuestions->Question->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Display_Order->Visible) { // Display_Order ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Display_Order->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Display_Order->CellAttributes() ?>><span id="el_Display_Order">
<input type="text" name="x_Display_Order" id="x_Display_Order" title="<?php echo $CCEExamQuestions->Display_Order->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->Display_Order->EditValue ?>"<?php echo $CCEExamQuestions->Display_Order->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->Display_Order->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->IsMulti->Visible) { // IsMulti ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->IsMulti->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->IsMulti->CellAttributes() ?>><span id="el_IsMulti">
<div id="tp_x_IsMulti" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_IsMulti" id="x_IsMulti" title="<?php echo $CCEExamQuestions->IsMulti->FldTitle() ?>" value="{value}"<?php echo $CCEExamQuestions->IsMulti->EditAttributes() ?>></label></div>
<div id="dsl_x_IsMulti" repeatcolumn="5">
<?php
$arwrk = $CCEExamQuestions->IsMulti->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->IsMulti->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_IsMulti" id="x_IsMulti" title="<?php echo $CCEExamQuestions->IsMulti->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEExamQuestions->IsMulti->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $CCEExamQuestions->IsMulti->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->IsOptional->Visible) { // IsOptional ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->IsOptional->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->IsOptional->CellAttributes() ?>><span id="el_IsOptional">
<div id="tp_x_IsOptional" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_IsOptional" id="x_IsOptional" title="<?php echo $CCEExamQuestions->IsOptional->FldTitle() ?>" value="{value}"<?php echo $CCEExamQuestions->IsOptional->EditAttributes() ?>></label></div>
<div id="dsl_x_IsOptional" repeatcolumn="5">
<?php
$arwrk = $CCEExamQuestions->IsOptional->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->IsOptional->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_IsOptional" id="x_IsOptional" title="<?php echo $CCEExamQuestions->IsOptional->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEExamQuestions->IsOptional->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $CCEExamQuestions->IsOptional->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Answer_Type->Visible) { // Answer_Type ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Answer_Type->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->Answer_Type->CellAttributes() ?>><span id="el_Answer_Type">
<select id="x_Answer_Type" name="x_Answer_Type" title="<?php echo $CCEExamQuestions->Answer_Type->FldTitle() ?>"<?php echo $CCEExamQuestions->Answer_Type->EditAttributes() ?>>
<?php
if (is_array($CCEExamQuestions->Answer_Type->EditValue)) {
$arwrk = $CCEExamQuestions->Answer_Type->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->Answer_Type->CurrentValue) == 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] ?>
</option>
<?php
}
}
?>
</select>
</span><?php echo $CCEExamQuestions->Answer_Type->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Answer_Template->Visible) { // Answer_Template ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Answer_Template->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Answer_Template->CellAttributes() ?>><span id="el_Answer_Template">
<input type="text" name="x_Answer_Template" id="x_Answer_Template" title="<?php echo $CCEExamQuestions->Answer_Template->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->Answer_Template->EditValue ?>"<?php echo $CCEExamQuestions->Answer_Template->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->Answer_Template->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->Model_Answer->Visible) { // Model_Answer ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->Model_Answer->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->Model_Answer->CellAttributes() ?>><span id="el_Model_Answer">
<textarea name="x_Model_Answer" id="x_Model_Answer" title="<?php echo $CCEExamQuestions->Model_Answer->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEExamQuestions->Model_Answer->EditAttributes() ?>><?php echo $CCEExamQuestions->Model_Answer->EditValue ?></textarea>
</span><?php echo $CCEExamQuestions->Model_Answer->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->ParentQuestionID->Visible) { // ParentQuestionID ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->ParentQuestionID->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->ParentQuestionID->CellAttributes() ?>><span id="el_ParentQuestionID">
<select id="x_ParentQuestionID" name="x_ParentQuestionID" title="<?php echo $CCEExamQuestions->ParentQuestionID->FldTitle() ?>"<?php echo $CCEExamQuestions->ParentQuestionID->EditAttributes() ?>>
<?php
if (is_array($CCEExamQuestions->ParentQuestionID->EditValue)) {
$arwrk = $CCEExamQuestions->ParentQuestionID->EditValue;
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->ParentQuestionID->CurrentValue) == 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
$sSqlWrk = "SELECT `Question_ID`, `QuestionTitle`, `Question` FROM `CCEExamQuestions`";
$sWhereWrk = "`Section_ID` IN ({filter_value})";
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `Display_Order`";
$sSqlWrk = TEAencrypt($sSqlWrk, EW_RANDOM_KEY);
?>
<input type="hidden" name="s_x_ParentQuestionID" id="s_x_ParentQuestionID" value="<?php echo $sSqlWrk; ?>">
<input type="hidden" name="lft_x_ParentQuestionID" id="lft_x_ParentQuestionID" value="1">
</span><?php echo $CCEExamQuestions->ParentQuestionID->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->RequireNumber->Visible) { // RequireNumber ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->RequireNumber->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->RequireNumber->CellAttributes() ?>><span id="el_RequireNumber">
<input type="text" name="x_RequireNumber" id="x_RequireNumber" title="<?php echo $CCEExamQuestions->RequireNumber->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->RequireNumber->EditValue ?>"<?php echo $CCEExamQuestions->RequireNumber->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->RequireNumber->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->MinNum->Visible) { // MinNum ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->MinNum->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->MinNum->CellAttributes() ?>><span id="el_MinNum">
<input type="text" name="x_MinNum" id="x_MinNum" title="<?php echo $CCEExamQuestions->MinNum->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->MinNum->EditValue ?>"<?php echo $CCEExamQuestions->MinNum->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->MinNum->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->MaxNum->Visible) { // MaxNum ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->MaxNum->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->MaxNum->CellAttributes() ?>><span id="el_MaxNum">
<input type="text" name="x_MaxNum" id="x_MaxNum" title="<?php echo $CCEExamQuestions->MaxNum->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->MaxNum->EditValue ?>"<?php echo $CCEExamQuestions->MaxNum->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->MaxNum->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->RecallPrevAnswer->Visible) { // RecallPrevAnswer ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->RecallPrevAnswer->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->RecallPrevAnswer->CellAttributes() ?>><span id="el_RecallPrevAnswer">
<div id="tp_x_RecallPrevAnswer" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_RecallPrevAnswer" id="x_RecallPrevAnswer" title="<?php echo $CCEExamQuestions->RecallPrevAnswer->FldTitle() ?>" value="{value}"<?php echo $CCEExamQuestions->RecallPrevAnswer->EditAttributes() ?>></label></div>
<div id="dsl_x_RecallPrevAnswer" repeatcolumn="5">
<?php
$arwrk = $CCEExamQuestions->RecallPrevAnswer->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->RecallPrevAnswer->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_RecallPrevAnswer" id="x_RecallPrevAnswer" title="<?php echo $CCEExamQuestions->RecallPrevAnswer->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEExamQuestions->RecallPrevAnswer->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $CCEExamQuestions->RecallPrevAnswer->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->QuestionTitle->Visible) { // QuestionTitle ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->QuestionTitle->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->QuestionTitle->CellAttributes() ?>><span id="el_QuestionTitle">
<input type="text" name="x_QuestionTitle" id="x_QuestionTitle" title="<?php echo $CCEExamQuestions->QuestionTitle->FldTitle() ?>" size="30" maxlength="255" value="<?php echo $CCEExamQuestions->QuestionTitle->EditValue ?>"<?php echo $CCEExamQuestions->QuestionTitle->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->QuestionTitle->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->NumMarks->Visible) { // NumMarks ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->NumMarks->FldCaption() ?></td>
<td<?php echo $CCEExamQuestions->NumMarks->CellAttributes() ?>><span id="el_NumMarks">
<input type="text" name="x_NumMarks" id="x_NumMarks" title="<?php echo $CCEExamQuestions->NumMarks->FldTitle() ?>" size="30" value="<?php echo $CCEExamQuestions->NumMarks->EditValue ?>"<?php echo $CCEExamQuestions->NumMarks->EditAttributes() ?>>
</span><?php echo $CCEExamQuestions->NumMarks->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEExamQuestions->InUse->Visible) { // InUse ?>
<tr<?php echo $CCEExamQuestions->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEExamQuestions->InUse->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEExamQuestions->InUse->CellAttributes() ?>><span id="el_InUse">
<div id="tp_x_InUse" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_InUse" id="x_InUse" title="<?php echo $CCEExamQuestions->InUse->FldTitle() ?>" value="{value}"<?php echo $CCEExamQuestions->InUse->EditAttributes() ?>></label></div>
<div id="dsl_x_InUse" repeatcolumn="5">
<?php
$arwrk = $CCEExamQuestions->InUse->EditValue;
if (is_array($arwrk)) {
$rowswrk = count($arwrk);
$emptywrk = TRUE;
for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
$selwrk = (strval($CCEExamQuestions->InUse->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " checked=\"checked\"" : "";
if ($selwrk <> "") $emptywrk = FALSE;
// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label><input type="radio" name="x_InUse" id="x_InUse" title="<?php echo $CCEExamQuestions->InUse->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEExamQuestions->InUse->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
}
}
?>
</div>
</span><?php echo $CCEExamQuestions->InUse->CustomMsg ?></td>
</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("AddBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x_Section_ID','x_Questionnaire_ID',false],
['x_ParentQuestionID','x_Section_ID',false]]);
//-->
</script>
<script type="text/javascript">
<!--
ew_CreateEditor(); // Create DHTML editor(s)
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$CCEExamQuestions_add->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEExamQuestions_add {
// Page ID
var $PageID = 'add';
// Table name
var $TableName = 'CCEExamQuestions';
// Page object name
var $PageObjName = 'CCEExamQuestions_add';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEExamQuestions;
if ($CCEExamQuestions->UseTokenInUrl) $PageUrl .= "t=" . $CCEExamQuestions->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, $CCEExamQuestions;
if ($CCEExamQuestions->UseTokenInUrl) {
if ($objForm)
return ($CCEExamQuestions->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEExamQuestions->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEExamQuestions)
$GLOBALS["CCEExamQuestions"] = new cCCEExamQuestions();
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'add', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCEExamQuestions', TRUE);
// Start timer
$GLOBALS["gsTimer"] = new cTimer();
// Open connection
$conn = ew_Connect();
}
//
// Page_Init
//
function Page_Init() {
global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
global $CCEExamQuestions;
// 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->CanAdd()) {
$Security->SaveLastUrl();
$this->Page_Terminate("CCEExamQuestionslist.php");
}
// Create form object
$objForm = new cFormObj();
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
var $sDbMasterFilter = "";
var $sDbDetailFilter = "";
var $lPriv = 0;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsFormError, $CCEExamQuestions;
// Load key values from QueryString
$bCopy = TRUE;
if (@$_GET["Question_ID"] != "") {
$CCEExamQuestions->Question_ID->setQueryStringValue($_GET["Question_ID"]);
} else {
$bCopy = FALSE;
}
// Process form if post back
if (@$_POST["a_add"] <> "") {
$CCEExamQuestions->CurrentAction = $_POST["a_add"]; // Get form action
$this->LoadFormValues(); // Load form values
// Validate form
if (!$this->ValidateForm()) {
$CCEExamQuestions->CurrentAction = "I"; // Form error, reset action
$this->setMessage($gsFormError);
}
} else { // Not post back
if ($bCopy) {
$CCEExamQuestions->CurrentAction = "C"; // Copy record
} else {
$CCEExamQuestions->CurrentAction = "I"; // Display blank record
$this->LoadDefaultValues(); // Load default values
}
}
// Perform action based on action code
switch ($CCEExamQuestions->CurrentAction) {
case "I": // Blank record, no action required
break;
case "C": // Copy an existing record
if (!$this->LoadRow()) { // Load record based on key
$this->setMessage($Language->Phrase("NoRecord")); // No record found
$this->Page_Terminate("CCEExamQuestionslist.php"); // No matching record, return to list
}
break;
case "A": // ' Add new record
$CCEExamQuestions->SendEmail = TRUE; // Send email on add success
if ($this->AddRow()) { // Add successful
$this->setMessage($Language->Phrase("AddSuccess")); // Set up success message
$sReturnUrl = $CCEExamQuestions->getReturnUrl();
if (ew_GetPageName($sReturnUrl) == "CCEExamQuestionsview.php")
$sReturnUrl = $CCEExamQuestions->ViewUrl(); // View paging, return to view page with keyurl directly
$this->Page_Terminate($sReturnUrl); // Clean up and return
} else {
$this->RestoreFormValues(); // Add failed, restore form values
}
}
// Render row based on row type
$CCEExamQuestions->RowType = EW_ROWTYPE_ADD; // Render add type
// Render row
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $CCEExamQuestions;
// Get upload data
}
// Load default values
function LoadDefaultValues() {
global $CCEExamQuestions;
$CCEExamQuestions->IsMulti->CurrentValue = 0;
$CCEExamQuestions->IsOptional->CurrentValue = 0;
$CCEExamQuestions->Answer_Type->CurrentValue = "a";
$CCEExamQuestions->RequireNumber->CurrentValue = 0;
$CCEExamQuestions->RecallPrevAnswer->CurrentValue = 0;
$CCEExamQuestions->InUse->CurrentValue = 1;
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $CCEExamQuestions;
$CCEExamQuestions->Questionnaire_ID->setFormValue($objForm->GetValue("x_Questionnaire_ID"));
$CCEExamQuestions->Section_ID->setFormValue($objForm->GetValue("x_Section_ID"));
$CCEExamQuestions->Question->setFormValue($objForm->GetValue("x_Question"));
$CCEExamQuestions->Display_Order->setFormValue($objForm->GetValue("x_Display_Order"));
$CCEExamQuestions->IsMulti->setFormValue($objForm->GetValue("x_IsMulti"));
$CCEExamQuestions->IsOptional->setFormValue($objForm->GetValue("x_IsOptional"));
$CCEExamQuestions->Answer_Type->setFormValue($objForm->GetValue("x_Answer_Type"));
$CCEExamQuestions->Answer_Template->setFormValue($objForm->GetValue("x_Answer_Template"));
$CCEExamQuestions->Model_Answer->setFormValue($objForm->GetValue("x_Model_Answer"));
$CCEExamQuestions->ParentQuestionID->setFormValue($objForm->GetValue("x_ParentQuestionID"));
$CCEExamQuestions->RequireNumber->setFormValue($objForm->GetValue("x_RequireNumber"));
$CCEExamQuestions->MinNum->setFormValue($objForm->GetValue("x_MinNum"));
$CCEExamQuestions->MaxNum->setFormValue($objForm->GetValue("x_MaxNum"));
$CCEExamQuestions->RecallPrevAnswer->setFormValue($objForm->GetValue("x_RecallPrevAnswer"));
$CCEExamQuestions->QuestionTitle->setFormValue($objForm->GetValue("x_QuestionTitle"));
$CCEExamQuestions->NumMarks->setFormValue($objForm->GetValue("x_NumMarks"));
$CCEExamQuestions->InUse->setFormValue($objForm->GetValue("x_InUse"));
$CCEExamQuestions->Question_ID->setFormValue($objForm->GetValue("x_Question_ID"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $CCEExamQuestions;
$CCEExamQuestions->Question_ID->CurrentValue = $CCEExamQuestions->Question_ID->FormValue;
$CCEExamQuestions->Questionnaire_ID->CurrentValue = $CCEExamQuestions->Questionnaire_ID->FormValue;
$CCEExamQuestions->Section_ID->CurrentValue = $CCEExamQuestions->Section_ID->FormValue;
$CCEExamQuestions->Question->CurrentValue = $CCEExamQuestions->Question->FormValue;
$CCEExamQuestions->Display_Order->CurrentValue = $CCEExamQuestions->Display_Order->FormValue;
$CCEExamQuestions->IsMulti->CurrentValue = $CCEExamQuestions->IsMulti->FormValue;
$CCEExamQuestions->IsOptional->CurrentValue = $CCEExamQuestions->IsOptional->FormValue;
$CCEExamQuestions->Answer_Type->CurrentValue = $CCEExamQuestions->Answer_Type->FormValue;
$CCEExamQuestions->Answer_Template->CurrentValue = $CCEExamQuestions->Answer_Template->FormValue;
$CCEExamQuestions->Model_Answer->CurrentValue = $CCEExamQuestions->Model_Answer->FormValue;
$CCEExamQuestions->ParentQuestionID->CurrentValue = $CCEExamQuestions->ParentQuestionID->FormValue;
$CCEExamQuestions->RequireNumber->CurrentValue = $CCEExamQuestions->RequireNumber->FormValue;
$CCEExamQuestions->MinNum->CurrentValue = $CCEExamQuestions->MinNum->FormValue;
$CCEExamQuestions->MaxNum->CurrentValue = $CCEExamQuestions->MaxNum->FormValue;
$CCEExamQuestions->RecallPrevAnswer->CurrentValue = $CCEExamQuestions->RecallPrevAnswer->FormValue;
$CCEExamQuestions->QuestionTitle->CurrentValue = $CCEExamQuestions->QuestionTitle->FormValue;
$CCEExamQuestions->NumMarks->CurrentValue = $CCEExamQuestions->NumMarks->FormValue;
$CCEExamQuestions->InUse->CurrentValue = $CCEExamQuestions->InUse->FormValue;
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEExamQuestions;
$sFilter = $CCEExamQuestions->KeyFilter();
// Call Row Selecting event
$CCEExamQuestions->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEExamQuestions->CurrentFilter = $sFilter;
$sSql = $CCEExamQuestions->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEExamQuestions->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEExamQuestions;
$CCEExamQuestions->Question_ID->setDbValue($rs->fields('Question_ID'));
$CCEExamQuestions->Questionnaire_ID->setDbValue($rs->fields('Questionnaire_ID'));
$CCEExamQuestions->Section_ID->setDbValue($rs->fields('Section_ID'));
$CCEExamQuestions->Question->setDbValue($rs->fields('Question'));
$CCEExamQuestions->Display_Order->setDbValue($rs->fields('Display_Order'));
$CCEExamQuestions->IsMulti->setDbValue($rs->fields('IsMulti'));
$CCEExamQuestions->IsOptional->setDbValue($rs->fields('IsOptional'));
$CCEExamQuestions->Answer_Type->setDbValue($rs->fields('Answer_Type'));
$CCEExamQuestions->Answer_Template->setDbValue($rs->fields('Answer_Template'));
$CCEExamQuestions->Model_Answer->setDbValue($rs->fields('Model_Answer'));
$CCEExamQuestions->ParentQuestionID->setDbValue($rs->fields('ParentQuestionID'));
$CCEExamQuestions->RequireNumber->setDbValue($rs->fields('RequireNumber'));
$CCEExamQuestions->MinNum->setDbValue($rs->fields('MinNum'));
$CCEExamQuestions->MaxNum->setDbValue($rs->fields('MaxNum'));
$CCEExamQuestions->RecallPrevAnswer->setDbValue($rs->fields('RecallPrevAnswer'));
$CCEExamQuestions->QuestionTitle->setDbValue($rs->fields('QuestionTitle'));
$CCEExamQuestions->NumMarks->setDbValue($rs->fields('NumMarks'));
$CCEExamQuestions->DropDown->setDbValue($rs->fields('DropDown'));
$CCEExamQuestions->InUse->setDbValue($rs->fields('InUse'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEExamQuestions;
// Initialize URLs
// Call Row_Rendering event
$CCEExamQuestions->Row_Rendering();
// Common render codes for all row types
// Questionnaire_ID
$CCEExamQuestions->Questionnaire_ID->CellCssStyle = ""; $CCEExamQuestions->Questionnaire_ID->CellCssClass = "";
$CCEExamQuestions->Questionnaire_ID->CellAttrs = array(); $CCEExamQuestions->Questionnaire_ID->ViewAttrs = array(); $CCEExamQuestions->Questionnaire_ID->EditAttrs = array();
// Section_ID
$CCEExamQuestions->Section_ID->CellCssStyle = ""; $CCEExamQuestions->Section_ID->CellCssClass = "";
$CCEExamQuestions->Section_ID->CellAttrs = array(); $CCEExamQuestions->Section_ID->ViewAttrs = array(); $CCEExamQuestions->Section_ID->EditAttrs = array();
// Question
$CCEExamQuestions->Question->CellCssStyle = ""; $CCEExamQuestions->Question->CellCssClass = "";
$CCEExamQuestions->Question->CellAttrs = array(); $CCEExamQuestions->Question->ViewAttrs = array(); $CCEExamQuestions->Question->EditAttrs = array();
// Display_Order
$CCEExamQuestions->Display_Order->CellCssStyle = ""; $CCEExamQuestions->Display_Order->CellCssClass = "";
$CCEExamQuestions->Display_Order->CellAttrs = array(); $CCEExamQuestions->Display_Order->ViewAttrs = array(); $CCEExamQuestions->Display_Order->EditAttrs = array();
// IsMulti
$CCEExamQuestions->IsMulti->CellCssStyle = ""; $CCEExamQuestions->IsMulti->CellCssClass = "";
$CCEExamQuestions->IsMulti->CellAttrs = array(); $CCEExamQuestions->IsMulti->ViewAttrs = array(); $CCEExamQuestions->IsMulti->EditAttrs = array();
// IsOptional
$CCEExamQuestions->IsOptional->CellCssStyle = ""; $CCEExamQuestions->IsOptional->CellCssClass = "";
$CCEExamQuestions->IsOptional->CellAttrs = array(); $CCEExamQuestions->IsOptional->ViewAttrs = array(); $CCEExamQuestions->IsOptional->EditAttrs = array();
// Answer_Type
$CCEExamQuestions->Answer_Type->CellCssStyle = ""; $CCEExamQuestions->Answer_Type->CellCssClass = "";
$CCEExamQuestions->Answer_Type->CellAttrs = array(); $CCEExamQuestions->Answer_Type->ViewAttrs = array(); $CCEExamQuestions->Answer_Type->EditAttrs = array();
// Answer_Template
$CCEExamQuestions->Answer_Template->CellCssStyle = ""; $CCEExamQuestions->Answer_Template->CellCssClass = "";
$CCEExamQuestions->Answer_Template->CellAttrs = array(); $CCEExamQuestions->Answer_Template->ViewAttrs = array(); $CCEExamQuestions->Answer_Template->EditAttrs = array();
// Model_Answer
$CCEExamQuestions->Model_Answer->CellCssStyle = ""; $CCEExamQuestions->Model_Answer->CellCssClass = "";
$CCEExamQuestions->Model_Answer->CellAttrs = array(); $CCEExamQuestions->Model_Answer->ViewAttrs = array(); $CCEExamQuestions->Model_Answer->EditAttrs = array();
// ParentQuestionID
$CCEExamQuestions->ParentQuestionID->CellCssStyle = ""; $CCEExamQuestions->ParentQuestionID->CellCssClass = "";
$CCEExamQuestions->ParentQuestionID->CellAttrs = array(); $CCEExamQuestions->ParentQuestionID->ViewAttrs = array(); $CCEExamQuestions->ParentQuestionID->EditAttrs = array();
// RequireNumber
$CCEExamQuestions->RequireNumber->CellCssStyle = ""; $CCEExamQuestions->RequireNumber->CellCssClass = "";
$CCEExamQuestions->RequireNumber->CellAttrs = array(); $CCEExamQuestions->RequireNumber->ViewAttrs = array(); $CCEExamQuestions->RequireNumber->EditAttrs = array();
// MinNum
$CCEExamQuestions->MinNum->CellCssStyle = ""; $CCEExamQuestions->MinNum->CellCssClass = "";
$CCEExamQuestions->MinNum->CellAttrs = array(); $CCEExamQuestions->MinNum->ViewAttrs = array(); $CCEExamQuestions->MinNum->EditAttrs = array();
// MaxNum
$CCEExamQuestions->MaxNum->CellCssStyle = ""; $CCEExamQuestions->MaxNum->CellCssClass = "";
$CCEExamQuestions->MaxNum->CellAttrs = array(); $CCEExamQuestions->MaxNum->ViewAttrs = array(); $CCEExamQuestions->MaxNum->EditAttrs = array();
// RecallPrevAnswer
$CCEExamQuestions->RecallPrevAnswer->CellCssStyle = ""; $CCEExamQuestions->RecallPrevAnswer->CellCssClass = "";
$CCEExamQuestions->RecallPrevAnswer->CellAttrs = array(); $CCEExamQuestions->RecallPrevAnswer->ViewAttrs = array(); $CCEExamQuestions->RecallPrevAnswer->EditAttrs = array();
// QuestionTitle
$CCEExamQuestions->QuestionTitle->CellCssStyle = ""; $CCEExamQuestions->QuestionTitle->CellCssClass = "";
$CCEExamQuestions->QuestionTitle->CellAttrs = array(); $CCEExamQuestions->QuestionTitle->ViewAttrs = array(); $CCEExamQuestions->QuestionTitle->EditAttrs = array();
// NumMarks
$CCEExamQuestions->NumMarks->CellCssStyle = ""; $CCEExamQuestions->NumMarks->CellCssClass = "";
$CCEExamQuestions->NumMarks->CellAttrs = array(); $CCEExamQuestions->NumMarks->ViewAttrs = array(); $CCEExamQuestions->NumMarks->EditAttrs = array();
// InUse
$CCEExamQuestions->InUse->CellCssStyle = ""; $CCEExamQuestions->InUse->CellCssClass = "";
$CCEExamQuestions->InUse->CellAttrs = array(); $CCEExamQuestions->InUse->ViewAttrs = array(); $CCEExamQuestions->InUse->EditAttrs = array();
if ($CCEExamQuestions->RowType == EW_ROWTYPE_VIEW) { // View row
// Question_ID
$CCEExamQuestions->Question_ID->ViewValue = $CCEExamQuestions->Question_ID->CurrentValue;
$CCEExamQuestions->Question_ID->CssStyle = "";
$CCEExamQuestions->Question_ID->CssClass = "";
$CCEExamQuestions->Question_ID->ViewCustomAttributes = "";
// Questionnaire_ID
if (strval($CCEExamQuestions->Questionnaire_ID->CurrentValue) <> "") {
$sFilterWrk = "`Questionnaire_ID` = " . ew_AdjustSql($CCEExamQuestions->Questionnaire_ID->CurrentValue) . "";
$sSqlWrk = "SELECT `Questionnaire_Name` FROM `CCEExams`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEExamQuestions->Questionnaire_ID->ViewValue = $rswrk->fields('Questionnaire_Name');
$rswrk->Close();
} else {
$CCEExamQuestions->Questionnaire_ID->ViewValue = $CCEExamQuestions->Questionnaire_ID->CurrentValue;
}
} else {
$CCEExamQuestions->Questionnaire_ID->ViewValue = NULL;
}
$CCEExamQuestions->Questionnaire_ID->CssStyle = "";
$CCEExamQuestions->Questionnaire_ID->CssClass = "";
$CCEExamQuestions->Questionnaire_ID->ViewCustomAttributes = "";
// Section_ID
if (strval($CCEExamQuestions->Section_ID->CurrentValue) <> "") {
$sFilterWrk = "`Section_ID` = " . ew_AdjustSql($CCEExamQuestions->Section_ID->CurrentValue) . "";
$sSqlWrk = "SELECT `Section_Name` FROM `CCEExamSections`";
$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
$CCEExamQuestions->Section_ID->ViewValue = $rswrk->fields('Section_Name');
$rswrk->Close();
} else {
$CCEExamQuestions->Section_ID->ViewValue = $CCEExamQuestions->Section_ID->CurrentValue;
}
} else {
$CCEExamQuestions->Section_ID->ViewValue = NULL;
}
$CCEExamQuestions->Section_ID->CssStyle = "";
$CCEExamQuestions->Section_ID->CssClass = "";
$CCEExamQuestions->Section_ID->ViewCustomAttributes = "";
// Question
$CCEExamQuestions->Question->ViewValue = $CCEExamQuestions->Question->CurrentValue;
$CCEExamQuestions->Question->CssStyle = "";
$CCEExamQuestions->Question->CssClass = "";
$CCEExamQuestions->Question->ViewCustomAttributes = "";
// Display_Order
$CCEExamQuestions->Display_Order->ViewValue = $CCEExamQuestions->Display_Order->CurrentValue;
$CCEExamQuestions->Display_Order->CssStyle = "";
$CCEExamQuestions->Display_Order->CssClass = "";
$CCEExamQuestions->Display_Order->ViewCustomAttributes = "";
// IsMulti
if (strval($CCEExamQuestions->IsMulti->CurrentValue) <> "") {
switch ($CCEExamQuestions->IsMulti->CurrentValue) {
case "1":
$CCEExamQuestions->IsMulti->ViewValue = "Yes";
break;
case "0":
$CCEExamQuestions->IsMulti->ViewValue = "No";
break;
default:
$CCEExamQuestions->IsMulti->ViewValue = $CCEExamQuestions->IsMulti->CurrentValue;
}
} else {
$CCEExamQuestions->IsMulti->ViewValue = NULL;
}
$CCEExamQuestions->IsMulti->CssStyle = "";
$CCEExamQuestions->IsMulti->CssClass = "";
$CCEExamQuestions->IsMulti->ViewCustomAttributes = "";
// IsOptional
if (strval($CCEExamQuestions->IsOptional->CurrentValue) <> "") {
switch ($CCEExamQuestions->IsOptional->CurrentValue) {
case "1":
$CCEExamQuestions->IsOptional->ViewValue = "Yes";
break;
case "0":
$CCEExamQuestions->IsOptional->ViewValue = "No";
break;
default:
$CCEExamQuestions->IsOptional->ViewValue = $CCEExamQuestions->IsOptional->CurrentValue;
}
} else {
$CCEExamQuestions->IsOptional->ViewValue = NULL;
}
$CCEExamQuestions->IsOptional->CssStyle = "";
$CCEExamQuestions->IsOptional->CssClass = "";
$CCEExamQuestions->IsOptional->ViewCustomAttributes = "";
// Answer_Type
if (strval($CCEExamQuestions->Answer_Type->CurrentValue) <> "") {
switch ($CCEExamQuestions->Answer_Type->CurrentValue) {
case "a":
$CCEExamQuestions->Answer_Type->ViewValue = "Text Box";
break;
case "m":
$CCEExamQuestions->Answer_Type->ViewValue = "Radio/ Check Box";
break;
case "s":
$CCEExamQuestions->Answer_Type->ViewValue = "Select";
break;
case "f":
$CCEExamQuestions->Answer_Type->ViewValue = "File";
break;
default:
$CCEExamQuestions->Answer_Type->ViewValue = $CCEExamQuestions->Answer_Type->CurrentValue;
}
} else {
$CCEExamQuestions->Answer_Type->ViewValue = NULL;
}
$CCEExamQuestions->Answer_Type->CssStyle = "";
$CCEExamQuestions->Answer_Type->CssClass = "";
$CCEExamQuestions->Answer_Type->ViewCustomAttributes = "";
// Answer_Template
$CCEExamQuestions->Answer_Template->ViewValue = $CCEExamQuestions->Answer_Template->CurrentValue;
$CCEExamQuestions->Answer_Template->CssStyle = "";
$CCEExamQuestions->Answer_Template->CssClass = "";
$CCEExamQuestions->Answer_Template->ViewCustomAttributes = "";
// Model_Answer
$CCEExamQuestions->Model_Answer->ViewValue = $CCEExamQuestions->Model_Answer->CurrentValue;
$CCEExamQuestions->Model_Answer->CssStyle = "";
$CCEExamQuestions->Model_Answer->CssClass = "";
$CCEExamQuestions->Model_Answer->ViewCustomAttributes = "";
// ParentQuestionID
if (strval($CCEExamQuestions->ParentQuestionID->CurrentValue) <> "") {
$sFilterWrk = "`Question_ID` = " . ew_AdjustSql($CCEExamQuestions->ParentQuestionID->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`";
$rswrk = $conn->Execute($sSqlWrk);
if ($rswrk && !$rswrk->EOF) { // Lookup values found
$CCEExamQuestions->ParentQuestionID->ViewValue = $rswrk->fields('QuestionTitle');
$CCEExamQuestions->ParentQuestionID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Question');
$rswrk->Close();
} else {
$CCEExamQuestions->ParentQuestionID->ViewValue = $CCEExamQuestions->ParentQuestionID->CurrentValue;
}
} else {
$CCEExamQuestions->ParentQuestionID->ViewValue = NULL;
}
$CCEExamQuestions->ParentQuestionID->CssStyle = "";
$CCEExamQuestions->ParentQuestionID->CssClass = "";
$CCEExamQuestions->ParentQuestionID->ViewCustomAttributes = "";
// RequireNumber
$CCEExamQuestions->RequireNumber->ViewValue = $CCEExamQuestions->RequireNumber->CurrentValue;
$CCEExamQuestions->RequireNumber->CssStyle = "";
$CCEExamQuestions->RequireNumber->CssClass = "";
$CCEExamQuestions->RequireNumber->ViewCustomAttributes = "";
// MinNum
$CCEExamQuestions->MinNum->ViewValue = $CCEExamQuestions->MinNum->CurrentValue;
$CCEExamQuestions->MinNum->CssStyle = "";
$CCEExamQuestions->MinNum->CssClass = "";
$CCEExamQuestions->MinNum->ViewCustomAttributes = "";
// MaxNum
$CCEExamQuestions->MaxNum->ViewValue = $CCEExamQuestions->MaxNum->CurrentValue;
$CCEExamQuestions->MaxNum->CssStyle = "";
$CCEExamQuestions->MaxNum->CssClass = "";
$CCEExamQuestions->MaxNum->ViewCustomAttributes = "";
// RecallPrevAnswer
if (strval($CCEExamQuestions->RecallPrevAnswer->CurrentValue) <> "") {
switch ($CCEExamQuestions->RecallPrevAnswer->CurrentValue) {
case "1":
$CCEExamQuestions->RecallPrevAnswer->ViewValue = "Yes";
break;
case "0":
$CCEExamQuestions->RecallPrevAnswer->ViewValue = "No";
break;
default:
$CCEExamQuestions->RecallPrevAnswer->ViewValue = $CCEExamQuestions->RecallPrevAnswer->CurrentValue;
}
} else {
$CCEExamQuestions->RecallPrevAnswer->ViewValue = NULL;
}
$CCEExamQuestions->RecallPrevAnswer->CssStyle = "";
$CCEExamQuestions->RecallPrevAnswer->CssClass = "";
$CCEExamQuestions->RecallPrevAnswer->ViewCustomAttributes = "";
// QuestionTitle
$CCEExamQuestions->QuestionTitle->ViewValue = $CCEExamQuestions->QuestionTitle->CurrentValue;
$CCEExamQuestions->QuestionTitle->CssStyle = "";
$CCEExamQuestions->QuestionTitle->CssClass = "";
$CCEExamQuestions->QuestionTitle->ViewCustomAttributes = "";
// NumMarks
$CCEExamQuestions->NumMarks->ViewValue = $CCEExamQuestions->NumMarks->CurrentValue;
$CCEExamQuestions->NumMarks->CssStyle = "";
$CCEExamQuestions->NumMarks->CssClass = "";
$CCEExamQuestions->NumMarks->ViewCustomAttributes = "";
// InUse
if (strval($CCEExamQuestions->InUse->CurrentValue) <> "") {
switch ($CCEExamQuestions->InUse->CurrentValue) {
case "1":
$CCEExamQuestions->InUse->ViewValue = "Yes";
break;
case "0":
$CCEExamQuestions->InUse->ViewValue = "No";
break;
default:
$CCEExamQuestions->InUse->ViewValue = $CCEExamQuestions->InUse->CurrentValue;
}
} else {
$CCEExamQuestions->InUse->ViewValue = NULL;
}
$CCEExamQuestions->InUse->CssStyle = "";
$CCEExamQuestions->InUse->CssClass = "";
$CCEExamQuestions->InUse->ViewCustomAttributes = "";
// Questionnaire_ID
$CCEExamQuestions->Questionnaire_ID->HrefValue = "";
$CCEExamQuestions->Questionnaire_ID->TooltipValue = "";
// Section_ID
$CCEExamQuestions->Section_ID->HrefValue = "";
$CCEExamQuestions->Section_ID->TooltipValue = "";
// Question
$CCEExamQuestions->Question->HrefValue = "";
$CCEExamQuestions->Question->TooltipValue = "";
// Display_Order
$CCEExamQuestions->Display_Order->HrefValue = "";
$CCEExamQuestions->Display_Order->TooltipValue = "";
// IsMulti
$CCEExamQuestions->IsMulti->HrefValue = "";
$CCEExamQuestions->IsMulti->TooltipValue = "";
// IsOptional
$CCEExamQuestions->IsOptional->HrefValue = "";
$CCEExamQuestions->IsOptional->TooltipValue = "";
// Answer_Type
$CCEExamQuestions->Answer_Type->HrefValue = "";
$CCEExamQuestions->Answer_Type->TooltipValue = "";
// Answer_Template
$CCEExamQuestions->Answer_Template->HrefValue = "";
$CCEExamQuestions->Answer_Template->TooltipValue = "";
// Model_Answer
$CCEExamQuestions->Model_Answer->HrefValue = "";
$CCEExamQuestions->Model_Answer->TooltipValue = "";
// ParentQuestionID
$CCEExamQuestions->ParentQuestionID->HrefValue = "";
$CCEExamQuestions->ParentQuestionID->TooltipValue = "";
// RequireNumber
$CCEExamQuestions->RequireNumber->HrefValue = "";
$CCEExamQuestions->RequireNumber->TooltipValue = "";
// MinNum
$CCEExamQuestions->MinNum->HrefValue = "";
$CCEExamQuestions->MinNum->TooltipValue = "";
// MaxNum
$CCEExamQuestions->MaxNum->HrefValue = "";
$CCEExamQuestions->MaxNum->TooltipValue = "";
// RecallPrevAnswer
$CCEExamQuestions->RecallPrevAnswer->HrefValue = "";
$CCEExamQuestions->RecallPrevAnswer->TooltipValue = "";
// QuestionTitle
$CCEExamQuestions->QuestionTitle->HrefValue = "";
$CCEExamQuestions->QuestionTitle->TooltipValue = "";
// NumMarks
$CCEExamQuestions->NumMarks->HrefValue = "";
$CCEExamQuestions->NumMarks->TooltipValue = "";
} elseif ($CCEExamQuestions->RowType == EW_ROWTYPE_ADD) { // Add row
// Questionnaire_ID
$CCEExamQuestions->Questionnaire_ID->EditCustomAttributes = "";
$sFilterWrk = "";
$sSqlWrk = "SELECT `Questionnaire_ID`, `Questionnaire_Name`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEExams`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEExamQuestions->Questionnaire_ID->EditValue = $arwrk;
// Section_ID
$CCEExamQuestions->Section_ID->EditCustomAttributes = "";
if (trim(strval($CCEExamQuestions->Section_ID->CurrentValue)) == "") {
$sFilterWrk = "0=1";
} else {
$sFilterWrk = "`Section_ID` = " . ew_AdjustSql($CCEExamQuestions->Section_ID->CurrentValue) . "";
}
$sSqlWrk = "SELECT `Section_ID`, `Section_Name`, '' AS Disp2Fld, `Questionnaire_ID` FROM `CCEExamSections`";
$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"), ""));
$CCEExamQuestions->Section_ID->EditValue = $arwrk;
// Question
$CCEExamQuestions->Question->EditCustomAttributes = "";
$CCEExamQuestions->Question->EditValue = ew_HtmlEncode($CCEExamQuestions->Question->CurrentValue);
// Display_Order
$CCEExamQuestions->Display_Order->EditCustomAttributes = "";
$CCEExamQuestions->Display_Order->EditValue = ew_HtmlEncode($CCEExamQuestions->Display_Order->CurrentValue);
// IsMulti
$CCEExamQuestions->IsMulti->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEExamQuestions->IsMulti->EditValue = $arwrk;
// IsOptional
$CCEExamQuestions->IsOptional->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEExamQuestions->IsOptional->EditValue = $arwrk;
// Answer_Type
$CCEExamQuestions->Answer_Type->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("a", "Text Box");
$arwrk[] = array("m", "Radio/ Check Box");
$arwrk[] = array("s", "Select");
$arwrk[] = array("f", "File");
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
$CCEExamQuestions->Answer_Type->EditValue = $arwrk;
// Answer_Template
$CCEExamQuestions->Answer_Template->EditCustomAttributes = "";
$CCEExamQuestions->Answer_Template->EditValue = ew_HtmlEncode($CCEExamQuestions->Answer_Template->CurrentValue);
// Model_Answer
$CCEExamQuestions->Model_Answer->EditCustomAttributes = "";
$CCEExamQuestions->Model_Answer->EditValue = ew_HtmlEncode($CCEExamQuestions->Model_Answer->CurrentValue);
// ParentQuestionID
$CCEExamQuestions->ParentQuestionID->EditCustomAttributes = "";
if (trim(strval($CCEExamQuestions->ParentQuestionID->CurrentValue)) == "") {
$sFilterWrk = "0=1";
} else {
$sFilterWrk = "`Question_ID` = " . ew_AdjustSql($CCEExamQuestions->ParentQuestionID->CurrentValue) . "";
}
$sSqlWrk = "SELECT `Question_ID`, `QuestionTitle`, `Question`, `Section_ID` FROM `CCEExamQuestions`";
$sWhereWrk = "";
if ($sFilterWrk <> "") {
if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
$sWhereWrk .= "(" . $sFilterWrk . ")";
}
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk .= " ORDER BY `Display_Order`";
$rswrk = $conn->Execute($sSqlWrk);
$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
if ($rswrk) $rswrk->Close();
array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), "", ""));
$CCEExamQuestions->ParentQuestionID->EditValue = $arwrk;
// RequireNumber
$CCEExamQuestions->RequireNumber->EditCustomAttributes = "";
$CCEExamQuestions->RequireNumber->EditValue = ew_HtmlEncode($CCEExamQuestions->RequireNumber->CurrentValue);
// MinNum
$CCEExamQuestions->MinNum->EditCustomAttributes = "";
$CCEExamQuestions->MinNum->EditValue = ew_HtmlEncode($CCEExamQuestions->MinNum->CurrentValue);
// MaxNum
$CCEExamQuestions->MaxNum->EditCustomAttributes = "";
$CCEExamQuestions->MaxNum->EditValue = ew_HtmlEncode($CCEExamQuestions->MaxNum->CurrentValue);
// RecallPrevAnswer
$CCEExamQuestions->RecallPrevAnswer->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEExamQuestions->RecallPrevAnswer->EditValue = $arwrk;
// QuestionTitle
$CCEExamQuestions->QuestionTitle->EditCustomAttributes = "";
$CCEExamQuestions->QuestionTitle->EditValue = ew_HtmlEncode($CCEExamQuestions->QuestionTitle->CurrentValue);
// NumMarks
$CCEExamQuestions->NumMarks->EditCustomAttributes = "";
$CCEExamQuestions->NumMarks->EditValue = ew_HtmlEncode($CCEExamQuestions->NumMarks->CurrentValue);
// InUse
$CCEExamQuestions->InUse->EditCustomAttributes = "";
$arwrk = array();
$arwrk[] = array("1", "Yes");
$arwrk[] = array("0", "No");
$CCEExamQuestions->InUse->EditValue = $arwrk;
}
// Call Row Rendered event
if ($CCEExamQuestions->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEExamQuestions->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $CCEExamQuestions;
// Initialize form error message
$gsFormError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!ew_CheckInteger($CCEExamQuestions->Display_Order->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->Display_Order->FldErrMsg();
}
if (!ew_CheckInteger($CCEExamQuestions->Answer_Template->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->Answer_Template->FldErrMsg();
}
if (!ew_CheckInteger($CCEExamQuestions->RequireNumber->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->RequireNumber->FldErrMsg();
}
if (!ew_CheckInteger($CCEExamQuestions->MinNum->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->MinNum->FldErrMsg();
}
if (!ew_CheckInteger($CCEExamQuestions->MaxNum->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->MaxNum->FldErrMsg();
}
if (!ew_CheckNumber($CCEExamQuestions->NumMarks->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEExamQuestions->NumMarks->FldErrMsg();
}
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Add record
function AddRow() {
global $conn, $Language, $Security, $CCEExamQuestions;
$rsnew = array();
// Questionnaire_ID
$CCEExamQuestions->Questionnaire_ID->SetDbValueDef($rsnew, $CCEExamQuestions->Questionnaire_ID->CurrentValue, NULL, FALSE);
// Section_ID
$CCEExamQuestions->Section_ID->SetDbValueDef($rsnew, $CCEExamQuestions->Section_ID->CurrentValue, NULL, FALSE);
// Question
$CCEExamQuestions->Question->SetDbValueDef($rsnew, $CCEExamQuestions->Question->CurrentValue, NULL, FALSE);
// Display_Order
$CCEExamQuestions->Display_Order->SetDbValueDef($rsnew, $CCEExamQuestions->Display_Order->CurrentValue, NULL, FALSE);
// IsMulti
$CCEExamQuestions->IsMulti->SetDbValueDef($rsnew, $CCEExamQuestions->IsMulti->CurrentValue, 0, TRUE);
// IsOptional
$CCEExamQuestions->IsOptional->SetDbValueDef($rsnew, $CCEExamQuestions->IsOptional->CurrentValue, 0, TRUE);
// Answer_Type
$CCEExamQuestions->Answer_Type->SetDbValueDef($rsnew, $CCEExamQuestions->Answer_Type->CurrentValue, "", TRUE);
// Answer_Template
$CCEExamQuestions->Answer_Template->SetDbValueDef($rsnew, $CCEExamQuestions->Answer_Template->CurrentValue, NULL, FALSE);
// Model_Answer
$CCEExamQuestions->Model_Answer->SetDbValueDef($rsnew, $CCEExamQuestions->Model_Answer->CurrentValue, NULL, FALSE);
// ParentQuestionID
$CCEExamQuestions->ParentQuestionID->SetDbValueDef($rsnew, $CCEExamQuestions->ParentQuestionID->CurrentValue, NULL, FALSE);
// RequireNumber
$CCEExamQuestions->RequireNumber->SetDbValueDef($rsnew, $CCEExamQuestions->RequireNumber->CurrentValue, 0, TRUE);
// MinNum
$CCEExamQuestions->MinNum->SetDbValueDef($rsnew, $CCEExamQuestions->MinNum->CurrentValue, NULL, FALSE);
// MaxNum
$CCEExamQuestions->MaxNum->SetDbValueDef($rsnew, $CCEExamQuestions->MaxNum->CurrentValue, NULL, FALSE);
// RecallPrevAnswer
$CCEExamQuestions->RecallPrevAnswer->SetDbValueDef($rsnew, $CCEExamQuestions->RecallPrevAnswer->CurrentValue, 0, TRUE);
// QuestionTitle
$CCEExamQuestions->QuestionTitle->SetDbValueDef($rsnew, $CCEExamQuestions->QuestionTitle->CurrentValue, NULL, FALSE);
// NumMarks
$CCEExamQuestions->NumMarks->SetDbValueDef($rsnew, $CCEExamQuestions->NumMarks->CurrentValue, NULL, FALSE);
// InUse
$CCEExamQuestions->InUse->SetDbValueDef($rsnew, $CCEExamQuestions->InUse->CurrentValue, 1, TRUE);
// Call Row Inserting event
$bInsertRow = $CCEExamQuestions->Row_Inserting($rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $conn->Execute($CCEExamQuestions->InsertSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($CCEExamQuestions->CancelMessage <> "") {
$this->setMessage($CCEExamQuestions->CancelMessage);
$CCEExamQuestions->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
if ($AddRow) {
$CCEExamQuestions->Question_ID->setDbValue($conn->Insert_ID());
$rsnew['Question_ID'] = $CCEExamQuestions->Question_ID->DbValue;
// Call Row Inserted event
$CCEExamQuestions->Row_Inserted($rsnew);
}
return $AddRow;
}
// 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;
}
}
?>