Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEStudentActivitiesedit.php

<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "CCEStudentActivitiesinfo.php" ?>
<?php include "CCEAssignmentsinfo.php" ?>
<?php include "CCEStudentsinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$CCEStudentActivities_edit = new cCCEStudentActivities_edit();
$Page =& $CCEStudentActivities_edit;

// Page init
$CCEStudentActivities_edit->Page_Init();

// Page main
$CCEStudentActivities_edit->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--

// Create page object
var CCEStudentActivities_edit = new ew_Page("CCEStudentActivities_edit");

// page properties
CCEStudentActivities_edit.PageID = "edit"; // page ID
CCEStudentActivities_edit.FormID = "fCCEStudentActivitiesedit"; // form ID
var EW_PAGE_ID = CCEStudentActivities_edit.PageID; // for backward compatibility

// extend page with ValidateForm function
CCEStudentActivities_edit.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 + "_CCEActivityID"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEStudentActivities->CCEActivityID->FldCaption()) ?>");
		elm = fobj.elements["x" + infix + "_ActivityRef"];
		if (elm && !ew_HasValue(elm))
			return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEStudentActivities->ActivityRef->FldCaption()) ?>");
		elm = fobj.elements["x" + infix + "_AssignmentFile1"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_AssignmentFile2"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_AssignmentFile3"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_AssignmentFile4"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_AssignmentFile5"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_AssignmentFile6"];
		if (elm && !ew_CheckFileType(elm.value))
			return ew_OnError(this, elm, ewLanguage.Phrase("WrongFileType"));
		elm = fobj.elements["x" + infix + "_DateAccepted"];
		if (elm && !ew_CheckDate(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEStudentActivities->DateAccepted->FldErrMsg()) ?>");

		// Call Form Custom Validate event
		if (!this.Form_CustomValidate(fobj)) return false;
	}
	return true;
}

// extend page with Form_CustomValidate function
CCEStudentActivities_edit.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
CCEStudentActivities_edit.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEStudentActivities_edit.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-cold-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></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>
<p><span class="phpmaker"><?php echo $Language->Phrase("Edit") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEStudentActivities->TableCaption() ?><br><br>
<a href="<?php echo $CCEStudentActivities->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEStudentActivities_edit->ShowMessage();
?>
<form name="fCCEStudentActivitiesedit" id="fCCEStudentActivitiesedit" action="<?php echo ew_CurrentPage() ?>" method="post" enctype="multipart/form-data" onsubmit="return CCEStudentActivities_edit.ValidateForm(this);">
<p>
<input type="hidden" name="a_table" id="a_table" value="CCEStudentActivities">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<input type="hidden" name="x_CCEStudentAssigID" id="x_CCEStudentAssigID" value="<?php echo ew_HtmlEncode($CCEStudentActivities->CCEStudentAssigID->CurrentValue) ?>">
<?php if ($CCEStudentActivities->CCEStudentID->Visible) { // CCEStudentID ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->CCEStudentID->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->CCEStudentID->CellAttributes() ?>><span id="el_CCEStudentID">
<?php if ($CCEStudentActivities->CCEStudentID->getSessionValue() <> "") { ?>
<div<?php echo $CCEStudentActivities->CCEStudentID->ViewAttributes() ?>><?php echo $CCEStudentActivities->CCEStudentID->ViewValue ?></div>
<input type="hidden" id="x_CCEStudentID" name="x_CCEStudentID" value="<?php echo ew_HtmlEncode($CCEStudentActivities->CCEStudentID->CurrentValue) ?>">
<?php } else { ?>
<select id="x_CCEStudentID" name="x_CCEStudentID" title="<?php echo $CCEStudentActivities->CCEStudentID->FldTitle() ?>"<?php echo $CCEStudentActivities->CCEStudentID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentActivities->CCEStudentID->EditValue)) {
	$arwrk = $CCEStudentActivities->CCEStudentID->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEStudentActivities->CCEStudentID->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 } ?>
</span><?php echo $CCEStudentActivities->CCEStudentID->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->CCEActivityID->Visible) { // CCEActivityID ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->CCEActivityID->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
		<td<?php echo $CCEStudentActivities->CCEActivityID->CellAttributes() ?>><span id="el_CCEActivityID">
<?php $CCEStudentActivities->CCEActivityID->EditAttrs["onchange"] = "ew_UpdateOpt('x_ActivityRef','x_CCEActivityID',CCEStudentActivities_edit.ar_x_ActivityRef); " . @$CCEStudentActivities->CCEActivityID->EditAttrs["onchange"]; ?>
<select id="x_CCEActivityID" name="x_CCEActivityID" title="<?php echo $CCEStudentActivities->CCEActivityID->FldTitle() ?>"<?php echo $CCEStudentActivities->CCEActivityID->EditAttributes() ?>>
<?php
if (is_array($CCEStudentActivities->CCEActivityID->EditValue)) {
	$arwrk = $CCEStudentActivities->CCEActivityID->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEStudentActivities->CCEActivityID->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 $CCEStudentActivities->CCEActivityID->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->ActivityRef->Visible) { // ActivityRef ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->ActivityRef->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
		<td<?php echo $CCEStudentActivities->ActivityRef->CellAttributes() ?>><span id="el_ActivityRef">
<select id="x_ActivityRef" name="x_ActivityRef" title="<?php echo $CCEStudentActivities->ActivityRef->FldTitle() ?>"<?php echo $CCEStudentActivities->ActivityRef->EditAttributes() ?>>
<?php
if (is_array($CCEStudentActivities->ActivityRef->EditValue)) {
	$arwrk = $CCEStudentActivities->ActivityRef->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEStudentActivities->ActivityRef->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
$jswrk = "";
if (is_array($CCEStudentActivities->ActivityRef->EditValue)) {
	$arwrk = $CCEStudentActivities->ActivityRef->EditValue;
	$arwrkcnt = count($arwrk);
	for ($rowcntwrk = 1; $rowcntwrk < $arwrkcnt; $rowcntwrk++) {
		if ($jswrk <> "") $jswrk .= ",";
		$jswrk .= "['" . ew_JsEncode($arwrk[$rowcntwrk][0]) . "',"; // Value
		$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][1]) . "',"; // Display field 1
		$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][2]) . "',"; // Display field 2
		$jswrk .= "'" . ew_JsEncode($arwrk[$rowcntwrk][3]) . "']"; // Filter field
	}
}
?>
<script type="text/javascript">
<!--
CCEStudentActivities_edit.ar_x_ActivityRef = [<?php echo $jswrk ?>];

//-->
</script>
</span><?php echo $CCEStudentActivities->ActivityRef->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile1->Visible) { // AssignmentFile1 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile1->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile1->CellAttributes() ?>><span id="el_AssignmentFile1">
<div id="old_x_AssignmentFile1">
<?php if ($CCEStudentActivities->AssignmentFile1->HrefValue <> "" || $CCEStudentActivities->AssignmentFile1->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile1->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile1->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile1->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile1">
<?php if (!empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile1" id="a_AssignmentFile1" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile1" id="a_AssignmentFile1" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile1" id="a_AssignmentFile1" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile1->EditAttrs["onchange"] = "this.form.a_AssignmentFile1[2].checked=true;" . @$CCEStudentActivities->AssignmentFile1->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile1" id="a_AssignmentFile1" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile1" id="x_AssignmentFile1" title="<?php echo $CCEStudentActivities->AssignmentFile1->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile1->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile1->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile2->Visible) { // AssignmentFile2 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile2->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile2->CellAttributes() ?>><span id="el_AssignmentFile2">
<div id="old_x_AssignmentFile2">
<?php if ($CCEStudentActivities->AssignmentFile2->HrefValue <> "" || $CCEStudentActivities->AssignmentFile2->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile2->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile2->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile2->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile2">
<?php if (!empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile2" id="a_AssignmentFile2" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile2" id="a_AssignmentFile2" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile2" id="a_AssignmentFile2" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile2->EditAttrs["onchange"] = "this.form.a_AssignmentFile2[2].checked=true;" . @$CCEStudentActivities->AssignmentFile2->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile2" id="a_AssignmentFile2" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile2" id="x_AssignmentFile2" title="<?php echo $CCEStudentActivities->AssignmentFile2->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile2->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile2->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile3->Visible) { // AssignmentFile3 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile3->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile3->CellAttributes() ?>><span id="el_AssignmentFile3">
<div id="old_x_AssignmentFile3">
<?php if ($CCEStudentActivities->AssignmentFile3->HrefValue <> "" || $CCEStudentActivities->AssignmentFile3->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile3->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile3->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile3->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile3">
<?php if (!empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile3" id="a_AssignmentFile3" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile3" id="a_AssignmentFile3" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile3" id="a_AssignmentFile3" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile3->EditAttrs["onchange"] = "this.form.a_AssignmentFile3[2].checked=true;" . @$CCEStudentActivities->AssignmentFile3->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile3" id="a_AssignmentFile3" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile3" id="x_AssignmentFile3" title="<?php echo $CCEStudentActivities->AssignmentFile3->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile3->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile3->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile4->Visible) { // AssignmentFile4 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile4->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile4->CellAttributes() ?>><span id="el_AssignmentFile4">
<div id="old_x_AssignmentFile4">
<?php if ($CCEStudentActivities->AssignmentFile4->HrefValue <> "" || $CCEStudentActivities->AssignmentFile4->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile4->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile4->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile4->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile4">
<?php if (!empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile4" id="a_AssignmentFile4" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile4" id="a_AssignmentFile4" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile4" id="a_AssignmentFile4" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile4->EditAttrs["onchange"] = "this.form.a_AssignmentFile4[2].checked=true;" . @$CCEStudentActivities->AssignmentFile4->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile4" id="a_AssignmentFile4" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile4" id="x_AssignmentFile4" title="<?php echo $CCEStudentActivities->AssignmentFile4->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile4->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile4->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile5->Visible) { // AssignmentFile5 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile5->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile5->CellAttributes() ?>><span id="el_AssignmentFile5">
<div id="old_x_AssignmentFile5">
<?php if ($CCEStudentActivities->AssignmentFile5->HrefValue <> "" || $CCEStudentActivities->AssignmentFile5->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile5->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile5->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile5->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile5">
<?php if (!empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile5" id="a_AssignmentFile5" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile5" id="a_AssignmentFile5" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile5" id="a_AssignmentFile5" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile5->EditAttrs["onchange"] = "this.form.a_AssignmentFile5[2].checked=true;" . @$CCEStudentActivities->AssignmentFile5->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile5" id="a_AssignmentFile5" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile5" id="x_AssignmentFile5" title="<?php echo $CCEStudentActivities->AssignmentFile5->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile5->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile5->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AssignmentFile6->Visible) { // AssignmentFile6 ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AssignmentFile6->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AssignmentFile6->CellAttributes() ?>><span id="el_AssignmentFile6">
<div id="old_x_AssignmentFile6">
<?php if ($CCEStudentActivities->AssignmentFile6->HrefValue <> "" || $CCEStudentActivities->AssignmentFile6->TooltipValue <> "") { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) { ?>
<a href="<?php echo $CCEStudentActivities->AssignmentFile6->HrefValue ?>"><?php echo $CCEStudentActivities->AssignmentFile6->EditValue ?></a>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) { ?>
<?php echo $CCEStudentActivities->AssignmentFile6->EditValue ?>
<?php } elseif (!in_array($CCEStudentActivities->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</div>
<div id="new_x_AssignmentFile6">
<?php if (!empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) { ?>
<label><input type="radio" name="a_AssignmentFile6" id="a_AssignmentFile6" value="1" checked="checked"><?php echo $Language->Phrase("Keep") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile6" id="a_AssignmentFile6" value="2"><?php echo $Language->Phrase("Remove") ?></label>&nbsp;
<label><input type="radio" name="a_AssignmentFile6" id="a_AssignmentFile6" value="3"><?php echo $Language->Phrase("Replace") ?><br></label>
<?php $CCEStudentActivities->AssignmentFile6->EditAttrs["onchange"] = "this.form.a_AssignmentFile6[2].checked=true;" . @$CCEStudentActivities->AssignmentFile6->EditAttrs["onchange"]; ?>
<?php } else { ?>
<input type="hidden" name="a_AssignmentFile6" id="a_AssignmentFile6" value="3">
<?php } ?>
<input type="file" name="x_AssignmentFile6" id="x_AssignmentFile6" title="<?php echo $CCEStudentActivities->AssignmentFile6->FldTitle() ?>" size="30"<?php echo $CCEStudentActivities->AssignmentFile6->EditAttributes() ?>>
</div>
</span><?php echo $CCEStudentActivities->AssignmentFile6->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->DateSubmitted->Visible) { // DateSubmitted ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->DateSubmitted->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->DateSubmitted->CellAttributes() ?>><span id="el_DateSubmitted">
<div<?php echo $CCEStudentActivities->DateSubmitted->ViewAttributes() ?>><?php echo $CCEStudentActivities->DateSubmitted->EditValue ?></div><input type="hidden" name="x_DateSubmitted" id="x_DateSubmitted" value="<?php echo ew_HtmlEncode($CCEStudentActivities->DateSubmitted->CurrentValue) ?>">
</span><?php echo $CCEStudentActivities->DateSubmitted->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AcceptStatus->Visible) { // AcceptStatus ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AcceptStatus->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
		<td<?php echo $CCEStudentActivities->AcceptStatus->CellAttributes() ?>><span id="el_AcceptStatus">
<div id="tp_x_AcceptStatus" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME ?>"><label><input type="radio" name="x_AcceptStatus" id="x_AcceptStatus" title="<?php echo $CCEStudentActivities->AcceptStatus->FldTitle() ?>" value="{value}"<?php echo $CCEStudentActivities->AcceptStatus->EditAttributes() ?>></label></div>
<div id="dsl_x_AcceptStatus" repeatcolumn="5">
<?php
$arwrk = $CCEStudentActivities->AcceptStatus->EditValue;
if (is_array($arwrk)) {
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEStudentActivities->AcceptStatus->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_AcceptStatus" id="x_AcceptStatus" title="<?php echo $CCEStudentActivities->AcceptStatus->FldTitle() ?>" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $CCEStudentActivities->AcceptStatus->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
?>
</div>
</span><?php echo $CCEStudentActivities->AcceptStatus->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->AcceptedBy->Visible) { // AcceptedBy ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->AcceptedBy->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->AcceptedBy->CellAttributes() ?>><span id="el_AcceptedBy">
<select id="x_AcceptedBy" name="x_AcceptedBy" title="<?php echo $CCEStudentActivities->AcceptedBy->FldTitle() ?>"<?php echo $CCEStudentActivities->AcceptedBy->EditAttributes() ?>>
<?php
if (is_array($CCEStudentActivities->AcceptedBy->EditValue)) {
	$arwrk = $CCEStudentActivities->AcceptedBy->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($CCEStudentActivities->AcceptedBy->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 $CCEStudentActivities->AcceptedBy->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->DateAccepted->Visible) { // DateAccepted ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->DateAccepted->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->DateAccepted->CellAttributes() ?>><span id="el_DateAccepted">
<input type="text" name="x_DateAccepted" id="x_DateAccepted" title="<?php echo $CCEStudentActivities->DateAccepted->FldTitle() ?>" value="<?php echo $CCEStudentActivities->DateAccepted->EditValue ?>"<?php echo $CCEStudentActivities->DateAccepted->EditAttributes() ?>>
&nbsp;<img src="images/calendar.png" id="cal_x_DateAccepted" name="cal_x_DateAccepted" alt="<?php echo $Language->Phrase("PickDate") ?>" title="<?php echo $Language->Phrase("PickDate") ?>" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup({
	inputField: "x_DateAccepted", // input field id
	ifFormat: "%Y/%m/%d", // date format
	button: "cal_x_DateAccepted" // button id
});
</script>
</span><?php echo $CCEStudentActivities->DateAccepted->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($CCEStudentActivities->Comments->Visible) { // Comments ?>
	<tr<?php echo $CCEStudentActivities->RowAttributes() ?>>
		<td class="ewTableHeader"><?php echo $CCEStudentActivities->Comments->FldCaption() ?></td>
		<td<?php echo $CCEStudentActivities->Comments->CellAttributes() ?>><span id="el_Comments">
<textarea name="x_Comments" id="x_Comments" title="<?php echo $CCEStudentActivities->Comments->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEStudentActivities->Comments->EditAttributes() ?>><?php echo $CCEStudentActivities->Comments->EditValue ?></textarea>
</span><?php echo $CCEStudentActivities->Comments->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("EditBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x_ActivityRef','x_CCEActivityID',CCEStudentActivities_edit.ar_x_ActivityRef]]);

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php include "footer.php" ?>
<?php
$CCEStudentActivities_edit->Page_Terminate();
?>
<?php

//
// Page class
//
class cCCEStudentActivities_edit {

	// Page ID
	var $PageID = 'edit';

	// Table name
	var $TableName = 'CCEStudentActivities';

	// Page object name
	var $PageObjName = 'CCEStudentActivities_edit';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $CCEStudentActivities;
		if ($CCEStudentActivities->UseTokenInUrl) $PageUrl .= "t=" . $CCEStudentActivities->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $CCEStudentActivities;
		if ($CCEStudentActivities->UseTokenInUrl) {
			if ($objForm)
				return ($CCEStudentActivities->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($CCEStudentActivities->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (CCEStudentActivities)
		$GLOBALS["CCEStudentActivities"] = new cCCEStudentActivities();

		// Table object (CCEAssignments)
		$GLOBALS['CCEAssignments'] = new cCCEAssignments();

		// Table object (CCEStudents)
		$GLOBALS['CCEStudents'] = new cCCEStudents();

		// Table object (CCEUsers)
		$GLOBALS['CCEUsers'] = new cCCEUsers();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'edit', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'CCEStudentActivities', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $CCEStudentActivities;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanEdit()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCEStudentActivitieslist.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;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError, $CCEStudentActivities;

		// Load key from QueryString
		if (@$_GET["CCEStudentAssigID"] <> "")
			$CCEStudentActivities->CCEStudentAssigID->setQueryStringValue($_GET["CCEStudentAssigID"]);

		// Set up master detail parameters
		$this->SetUpMasterDetail();
		if (@$_POST["a_edit"] <> "") {
			$CCEStudentActivities->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->GetUploadFiles(); // Get upload files
			$this->LoadFormValues(); // Get form values

			// Validate form
			if (!$this->ValidateForm()) {
				$CCEStudentActivities->CurrentAction = ""; // Form error, reset action
				$this->setMessage($gsFormError);
				$CCEStudentActivities->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		} else {
			$CCEStudentActivities->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($CCEStudentActivities->CCEStudentAssigID->CurrentValue == "")
			$this->Page_Terminate("CCEStudentActivitieslist.php"); // Invalid key, return to list
		switch ($CCEStudentActivities->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					$this->setMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("CCEStudentActivitieslist.php"); // No matching record, return to list
				}
				break;
			Case "U": // Update
				$CCEStudentActivities->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					$this->setMessage($Language->Phrase("UpdateSuccess")); // Update success
					$sReturnUrl = $CCEStudentActivities->getReturnUrl();
					if (ew_GetPageName($sReturnUrl) == "CCEStudentActivitiesview.php")
						$sReturnUrl = $CCEStudentActivities->ViewUrl(); // View paging, return to View page directly
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$CCEStudentActivities->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed
				}
		}

		// Render the record
		$CCEStudentActivities->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->RenderRow();
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm, $CCEStudentActivities;

		// Get upload data
			if ($CCEStudentActivities->AssignmentFile1->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile1->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCEStudentActivities->AssignmentFile2->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile2->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCEStudentActivities->AssignmentFile3->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile3->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCEStudentActivities->AssignmentFile4->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile4->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCEStudentActivities->AssignmentFile5->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile5->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
			if ($CCEStudentActivities->AssignmentFile6->Upload->UploadFile()) {

				// No action required
			} else {
				echo $CCEStudentActivities->AssignmentFile6->Upload->Message;
				$this->Page_Terminate();
				exit();
			}
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm, $CCEStudentActivities;
		$CCEStudentActivities->CCEStudentAssigID->setFormValue($objForm->GetValue("x_CCEStudentAssigID"));
		$CCEStudentActivities->CCEStudentID->setFormValue($objForm->GetValue("x_CCEStudentID"));
		$CCEStudentActivities->CCEActivityID->setFormValue($objForm->GetValue("x_CCEActivityID"));
		$CCEStudentActivities->ActivityRef->setFormValue($objForm->GetValue("x_ActivityRef"));
		$CCEStudentActivities->DateSubmitted->setFormValue($objForm->GetValue("x_DateSubmitted"));
		$CCEStudentActivities->DateSubmitted->CurrentValue = ew_UnFormatDateTime($CCEStudentActivities->DateSubmitted->CurrentValue, 5);
		$CCEStudentActivities->AcceptStatus->setFormValue($objForm->GetValue("x_AcceptStatus"));
		$CCEStudentActivities->AcceptedBy->setFormValue($objForm->GetValue("x_AcceptedBy"));
		$CCEStudentActivities->DateAccepted->setFormValue($objForm->GetValue("x_DateAccepted"));
		$CCEStudentActivities->DateAccepted->CurrentValue = ew_UnFormatDateTime($CCEStudentActivities->DateAccepted->CurrentValue, 5);
		$CCEStudentActivities->Comments->setFormValue($objForm->GetValue("x_Comments"));
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm, $CCEStudentActivities;
		$this->LoadRow();
		$CCEStudentActivities->CCEStudentAssigID->CurrentValue = $CCEStudentActivities->CCEStudentAssigID->FormValue;
		$CCEStudentActivities->CCEStudentID->CurrentValue = $CCEStudentActivities->CCEStudentID->FormValue;
		$CCEStudentActivities->CCEActivityID->CurrentValue = $CCEStudentActivities->CCEActivityID->FormValue;
		$CCEStudentActivities->ActivityRef->CurrentValue = $CCEStudentActivities->ActivityRef->FormValue;
		$CCEStudentActivities->DateSubmitted->CurrentValue = $CCEStudentActivities->DateSubmitted->FormValue;
		$CCEStudentActivities->DateSubmitted->CurrentValue = ew_UnFormatDateTime($CCEStudentActivities->DateSubmitted->CurrentValue, 5);
		$CCEStudentActivities->AcceptStatus->CurrentValue = $CCEStudentActivities->AcceptStatus->FormValue;
		$CCEStudentActivities->AcceptedBy->CurrentValue = $CCEStudentActivities->AcceptedBy->FormValue;
		$CCEStudentActivities->DateAccepted->CurrentValue = $CCEStudentActivities->DateAccepted->FormValue;
		$CCEStudentActivities->DateAccepted->CurrentValue = ew_UnFormatDateTime($CCEStudentActivities->DateAccepted->CurrentValue, 5);
		$CCEStudentActivities->Comments->CurrentValue = $CCEStudentActivities->Comments->FormValue;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $CCEStudentActivities;
		$sFilter = $CCEStudentActivities->KeyFilter();

		// Call Row Selecting event
		$CCEStudentActivities->Row_Selecting($sFilter);

		// Load SQL based on filter
		$CCEStudentActivities->CurrentFilter = $sFilter;
		$sSql = $CCEStudentActivities->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$CCEStudentActivities->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCEStudentActivities;
		$CCEStudentActivities->CCEStudentAssigID->setDbValue($rs->fields('CCEStudentAssigID'));
		$CCEStudentActivities->CCEStudentID->setDbValue($rs->fields('CCEStudentID'));
		$CCEStudentActivities->CCEAssignmentID->setDbValue($rs->fields('CCEAssignmentID'));
		$CCEStudentActivities->CCEActivityID->setDbValue($rs->fields('CCEActivityID'));
		$CCEStudentActivities->CCEModuleID->setDbValue($rs->fields('CCEModuleID'));
		$CCEStudentActivities->ActivityRef->setDbValue($rs->fields('ActivityRef'));
		$CCEStudentActivities->AssignmentFile1->Upload->DbValue = $rs->fields('AssignmentFile1');
		$CCEStudentActivities->AssignmentFile2->Upload->DbValue = $rs->fields('AssignmentFile2');
		$CCEStudentActivities->AssignmentFile3->Upload->DbValue = $rs->fields('AssignmentFile3');
		$CCEStudentActivities->AssignmentFile4->Upload->DbValue = $rs->fields('AssignmentFile4');
		$CCEStudentActivities->AssignmentFile5->Upload->DbValue = $rs->fields('AssignmentFile5');
		$CCEStudentActivities->AssignmentFile6->Upload->DbValue = $rs->fields('AssignmentFile6');
		$CCEStudentActivities->DateSubmitted->setDbValue($rs->fields('DateSubmitted'));
		$CCEStudentActivities->AcceptStatus->setDbValue($rs->fields('AcceptStatus'));
		$CCEStudentActivities->AcceptedBy->setDbValue($rs->fields('AcceptedBy'));
		$CCEStudentActivities->DateAccepted->setDbValue($rs->fields('DateAccepted'));
		$CCEStudentActivities->Comments->setDbValue($rs->fields('Comments'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $CCEStudentActivities;

		// Initialize URLs
		// Call Row_Rendering event

		$CCEStudentActivities->Row_Rendering();

		// Common render codes for all row types
		// CCEStudentAssigID

		$CCEStudentActivities->CCEStudentAssigID->CellCssStyle = ""; $CCEStudentActivities->CCEStudentAssigID->CellCssClass = "";
		$CCEStudentActivities->CCEStudentAssigID->CellAttrs = array(); $CCEStudentActivities->CCEStudentAssigID->ViewAttrs = array(); $CCEStudentActivities->CCEStudentAssigID->EditAttrs = array();

		// CCEStudentID
		$CCEStudentActivities->CCEStudentID->CellCssStyle = ""; $CCEStudentActivities->CCEStudentID->CellCssClass = "";
		$CCEStudentActivities->CCEStudentID->CellAttrs = array(); $CCEStudentActivities->CCEStudentID->ViewAttrs = array(); $CCEStudentActivities->CCEStudentID->EditAttrs = array();

		// CCEActivityID
		$CCEStudentActivities->CCEActivityID->CellCssStyle = ""; $CCEStudentActivities->CCEActivityID->CellCssClass = "";
		$CCEStudentActivities->CCEActivityID->CellAttrs = array(); $CCEStudentActivities->CCEActivityID->ViewAttrs = array(); $CCEStudentActivities->CCEActivityID->EditAttrs = array();

		// ActivityRef
		$CCEStudentActivities->ActivityRef->CellCssStyle = ""; $CCEStudentActivities->ActivityRef->CellCssClass = "";
		$CCEStudentActivities->ActivityRef->CellAttrs = array(); $CCEStudentActivities->ActivityRef->ViewAttrs = array(); $CCEStudentActivities->ActivityRef->EditAttrs = array();

		// AssignmentFile1
		$CCEStudentActivities->AssignmentFile1->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile1->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile1->CellAttrs = array(); $CCEStudentActivities->AssignmentFile1->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile1->EditAttrs = array();

		// AssignmentFile2
		$CCEStudentActivities->AssignmentFile2->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile2->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile2->CellAttrs = array(); $CCEStudentActivities->AssignmentFile2->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile2->EditAttrs = array();

		// AssignmentFile3
		$CCEStudentActivities->AssignmentFile3->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile3->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile3->CellAttrs = array(); $CCEStudentActivities->AssignmentFile3->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile3->EditAttrs = array();

		// AssignmentFile4
		$CCEStudentActivities->AssignmentFile4->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile4->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile4->CellAttrs = array(); $CCEStudentActivities->AssignmentFile4->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile4->EditAttrs = array();

		// AssignmentFile5
		$CCEStudentActivities->AssignmentFile5->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile5->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile5->CellAttrs = array(); $CCEStudentActivities->AssignmentFile5->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile5->EditAttrs = array();

		// AssignmentFile6
		$CCEStudentActivities->AssignmentFile6->CellCssStyle = ""; $CCEStudentActivities->AssignmentFile6->CellCssClass = "";
		$CCEStudentActivities->AssignmentFile6->CellAttrs = array(); $CCEStudentActivities->AssignmentFile6->ViewAttrs = array(); $CCEStudentActivities->AssignmentFile6->EditAttrs = array();

		// DateSubmitted
		$CCEStudentActivities->DateSubmitted->CellCssStyle = ""; $CCEStudentActivities->DateSubmitted->CellCssClass = "";
		$CCEStudentActivities->DateSubmitted->CellAttrs = array(); $CCEStudentActivities->DateSubmitted->ViewAttrs = array(); $CCEStudentActivities->DateSubmitted->EditAttrs = array();

		// AcceptStatus
		$CCEStudentActivities->AcceptStatus->CellCssStyle = ""; $CCEStudentActivities->AcceptStatus->CellCssClass = "";
		$CCEStudentActivities->AcceptStatus->CellAttrs = array(); $CCEStudentActivities->AcceptStatus->ViewAttrs = array(); $CCEStudentActivities->AcceptStatus->EditAttrs = array();

		// AcceptedBy
		$CCEStudentActivities->AcceptedBy->CellCssStyle = ""; $CCEStudentActivities->AcceptedBy->CellCssClass = "";
		$CCEStudentActivities->AcceptedBy->CellAttrs = array(); $CCEStudentActivities->AcceptedBy->ViewAttrs = array(); $CCEStudentActivities->AcceptedBy->EditAttrs = array();

		// DateAccepted
		$CCEStudentActivities->DateAccepted->CellCssStyle = ""; $CCEStudentActivities->DateAccepted->CellCssClass = "";
		$CCEStudentActivities->DateAccepted->CellAttrs = array(); $CCEStudentActivities->DateAccepted->ViewAttrs = array(); $CCEStudentActivities->DateAccepted->EditAttrs = array();

		// Comments
		$CCEStudentActivities->Comments->CellCssStyle = ""; $CCEStudentActivities->Comments->CellCssClass = "";
		$CCEStudentActivities->Comments->CellAttrs = array(); $CCEStudentActivities->Comments->ViewAttrs = array(); $CCEStudentActivities->Comments->EditAttrs = array();
		if ($CCEStudentActivities->RowType == EW_ROWTYPE_VIEW) { // View row

			// CCEStudentAssigID
			$CCEStudentActivities->CCEStudentAssigID->ViewValue = $CCEStudentActivities->CCEStudentAssigID->CurrentValue;
			$CCEStudentActivities->CCEStudentAssigID->CssStyle = "";
			$CCEStudentActivities->CCEStudentAssigID->CssClass = "";
			$CCEStudentActivities->CCEStudentAssigID->ViewCustomAttributes = "";

			// CCEStudentID
			if (strval($CCEStudentActivities->CCEStudentID->CurrentValue) <> "") {
				$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentActivities->CCEStudentID->CurrentValue) . "";
			$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FirstName`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
					$CCEStudentActivities->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->CCEStudentID->ViewValue = $CCEStudentActivities->CCEStudentID->CurrentValue;
				}
			} else {
				$CCEStudentActivities->CCEStudentID->ViewValue = NULL;
			}
			$CCEStudentActivities->CCEStudentID->CssStyle = "";
			$CCEStudentActivities->CCEStudentID->CssClass = "";
			$CCEStudentActivities->CCEStudentID->ViewCustomAttributes = "";

			// CCEAssignmentID
			if (strval($CCEStudentActivities->CCEAssignmentID->CurrentValue) <> "") {
				$sFilterWrk = "`CCEAssignmentID` = " . ew_AdjustSql($CCEStudentActivities->CCEAssignmentID->CurrentValue) . "";
			$sSqlWrk = "SELECT `RefNum`, `AssignmentName` FROM `CCEAssignments`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `RefNum`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->CCEAssignmentID->ViewValue = $rswrk->fields('RefNum');
					$CCEStudentActivities->CCEAssignmentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('AssignmentName');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->CCEAssignmentID->ViewValue = $CCEStudentActivities->CCEAssignmentID->CurrentValue;
				}
			} else {
				$CCEStudentActivities->CCEAssignmentID->ViewValue = NULL;
			}
			$CCEStudentActivities->CCEAssignmentID->CssStyle = "";
			$CCEStudentActivities->CCEAssignmentID->CssClass = "";
			$CCEStudentActivities->CCEAssignmentID->ViewCustomAttributes = "";

			// CCEActivityID
			if (strval($CCEStudentActivities->CCEActivityID->CurrentValue) <> "") {
				$sFilterWrk = "`CCEActivityID` = " . ew_AdjustSql($CCEStudentActivities->CCEActivityID->CurrentValue) . "";
			$sSqlWrk = "SELECT `WorkbookName` FROM `CCEActivities`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `WorkbookName`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->CCEActivityID->ViewValue = $rswrk->fields('WorkbookName');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->CCEActivityID->ViewValue = $CCEStudentActivities->CCEActivityID->CurrentValue;
				}
			} else {
				$CCEStudentActivities->CCEActivityID->ViewValue = NULL;
			}
			$CCEStudentActivities->CCEActivityID->CssStyle = "";
			$CCEStudentActivities->CCEActivityID->CssClass = "";
			$CCEStudentActivities->CCEActivityID->ViewCustomAttributes = "";

			// CCEModuleID
			if (strval($CCEStudentActivities->CCEModuleID->CurrentValue) <> "") {
				$sFilterWrk = "CCEModules.CCEModuleID = " . ew_AdjustSql($CCEStudentActivities->CCEModuleID->CurrentValue) . "";
			$sSqlWrk = "SELECT CCEModules.ModuleNum AS `ModuleNum`, CCEModules.ModuleName AS `ModuleName` FROM CCECourses Inner Join CCEModules On CCECourses.CCECourseID = CCEModules.CCECourseID";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY CCECourses.CCECourseID, CCEModules.ModuleNum";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->CCEModuleID->ViewValue = $rswrk->fields('ModuleNum');
					$CCEStudentActivities->CCEModuleID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('ModuleName');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->CCEModuleID->ViewValue = $CCEStudentActivities->CCEModuleID->CurrentValue;
				}
			} else {
				$CCEStudentActivities->CCEModuleID->ViewValue = NULL;
			}
			$CCEStudentActivities->CCEModuleID->CssStyle = "";
			$CCEStudentActivities->CCEModuleID->CssClass = "";
			$CCEStudentActivities->CCEModuleID->ViewCustomAttributes = "";

			// ActivityRef
			if (strval($CCEStudentActivities->ActivityRef->CurrentValue) <> "") {
				$sFilterWrk = "`RefNum` = '" . ew_AdjustSql($CCEStudentActivities->ActivityRef->CurrentValue) . "'";
			$sSqlWrk = "SELECT `RefNum` FROM `CCEActivities`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `RefNum`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->ActivityRef->ViewValue = $rswrk->fields('RefNum');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->ActivityRef->ViewValue = $CCEStudentActivities->ActivityRef->CurrentValue;
				}
			} else {
				$CCEStudentActivities->ActivityRef->ViewValue = NULL;
			}
			$CCEStudentActivities->ActivityRef->CssStyle = "";
			$CCEStudentActivities->ActivityRef->CssClass = "";
			$CCEStudentActivities->ActivityRef->ViewCustomAttributes = "";

			// AssignmentFile1
			if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile1->ViewValue = $CCEStudentActivities->AssignmentFile1->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile1->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile1->CssStyle = "";
			$CCEStudentActivities->AssignmentFile1->CssClass = "";
			$CCEStudentActivities->AssignmentFile1->ViewCustomAttributes = "";

			// AssignmentFile2
			if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile2->ViewValue = $CCEStudentActivities->AssignmentFile2->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile2->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile2->CssStyle = "";
			$CCEStudentActivities->AssignmentFile2->CssClass = "";
			$CCEStudentActivities->AssignmentFile2->ViewCustomAttributes = "";

			// AssignmentFile3
			if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile3->ViewValue = $CCEStudentActivities->AssignmentFile3->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile3->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile3->CssStyle = "";
			$CCEStudentActivities->AssignmentFile3->CssClass = "";
			$CCEStudentActivities->AssignmentFile3->ViewCustomAttributes = "";

			// AssignmentFile4
			if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile4->ViewValue = $CCEStudentActivities->AssignmentFile4->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile4->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile4->CssStyle = "";
			$CCEStudentActivities->AssignmentFile4->CssClass = "";
			$CCEStudentActivities->AssignmentFile4->ViewCustomAttributes = "";

			// AssignmentFile5
			if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile5->ViewValue = $CCEStudentActivities->AssignmentFile5->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile5->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile5->CssStyle = "";
			$CCEStudentActivities->AssignmentFile5->CssClass = "";
			$CCEStudentActivities->AssignmentFile5->ViewCustomAttributes = "";

			// AssignmentFile6
			if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile6->ViewValue = $CCEStudentActivities->AssignmentFile6->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile6->ViewValue = "";
			}
			$CCEStudentActivities->AssignmentFile6->CssStyle = "";
			$CCEStudentActivities->AssignmentFile6->CssClass = "";
			$CCEStudentActivities->AssignmentFile6->ViewCustomAttributes = "";

			// DateSubmitted
			$CCEStudentActivities->DateSubmitted->ViewValue = $CCEStudentActivities->DateSubmitted->CurrentValue;
			$CCEStudentActivities->DateSubmitted->ViewValue = ew_FormatDateTime($CCEStudentActivities->DateSubmitted->ViewValue, 5);
			$CCEStudentActivities->DateSubmitted->CssStyle = "";
			$CCEStudentActivities->DateSubmitted->CssClass = "";
			$CCEStudentActivities->DateSubmitted->ViewCustomAttributes = "";

			// AcceptStatus
			if (strval($CCEStudentActivities->AcceptStatus->CurrentValue) <> "") {
				switch ($CCEStudentActivities->AcceptStatus->CurrentValue) {
					case "1":
						$CCEStudentActivities->AcceptStatus->ViewValue = "Yes";
						break;
					case "0":
						$CCEStudentActivities->AcceptStatus->ViewValue = "No";
						break;
					default:
						$CCEStudentActivities->AcceptStatus->ViewValue = $CCEStudentActivities->AcceptStatus->CurrentValue;
				}
			} else {
				$CCEStudentActivities->AcceptStatus->ViewValue = NULL;
			}
			$CCEStudentActivities->AcceptStatus->CssStyle = "";
			$CCEStudentActivities->AcceptStatus->CssClass = "";
			$CCEStudentActivities->AcceptStatus->ViewCustomAttributes = "";

			// AcceptedBy
			if (strval($CCEStudentActivities->AcceptedBy->CurrentValue) <> "") {
				$sFilterWrk = "`FacilitatorName` = '" . ew_AdjustSql($CCEStudentActivities->AcceptedBy->CurrentValue) . "'";
			$sSqlWrk = "SELECT `FacilitatorName` FROM `CCEFacilitators`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FacilitatorName`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->AcceptedBy->ViewValue = $rswrk->fields('FacilitatorName');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->AcceptedBy->ViewValue = $CCEStudentActivities->AcceptedBy->CurrentValue;
				}
			} else {
				$CCEStudentActivities->AcceptedBy->ViewValue = NULL;
			}
			$CCEStudentActivities->AcceptedBy->CssStyle = "";
			$CCEStudentActivities->AcceptedBy->CssClass = "";
			$CCEStudentActivities->AcceptedBy->ViewCustomAttributes = "";

			// DateAccepted
			$CCEStudentActivities->DateAccepted->ViewValue = $CCEStudentActivities->DateAccepted->CurrentValue;
			$CCEStudentActivities->DateAccepted->ViewValue = ew_FormatDateTime($CCEStudentActivities->DateAccepted->ViewValue, 5);
			$CCEStudentActivities->DateAccepted->CssStyle = "";
			$CCEStudentActivities->DateAccepted->CssClass = "";
			$CCEStudentActivities->DateAccepted->ViewCustomAttributes = "";

			// Comments
			$CCEStudentActivities->Comments->ViewValue = $CCEStudentActivities->Comments->CurrentValue;
			$CCEStudentActivities->Comments->CssStyle = "";
			$CCEStudentActivities->Comments->CssClass = "";
			$CCEStudentActivities->Comments->ViewCustomAttributes = "";

			// CCEStudentAssigID
			$CCEStudentActivities->CCEStudentAssigID->HrefValue = "";
			$CCEStudentActivities->CCEStudentAssigID->TooltipValue = "";

			// CCEStudentID
			$CCEStudentActivities->CCEStudentID->HrefValue = "";
			$CCEStudentActivities->CCEStudentID->TooltipValue = "";

			// CCEActivityID
			$CCEStudentActivities->CCEActivityID->HrefValue = "";
			$CCEStudentActivities->CCEActivityID->TooltipValue = "";

			// ActivityRef
			$CCEStudentActivities->ActivityRef->HrefValue = "";
			$CCEStudentActivities->ActivityRef->TooltipValue = "";

			// AssignmentFile1
			if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile1->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile1->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile1->ViewValue)) ? $CCEStudentActivities->AssignmentFile1->ViewValue : $CCEStudentActivities->AssignmentFile1->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile1->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile1->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile1->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile1->TooltipValue = "";

			// AssignmentFile2
			if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile2->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile2->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile2->ViewValue)) ? $CCEStudentActivities->AssignmentFile2->ViewValue : $CCEStudentActivities->AssignmentFile2->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile2->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile2->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile2->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile2->TooltipValue = "";

			// AssignmentFile3
			if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile3->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile3->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile3->ViewValue)) ? $CCEStudentActivities->AssignmentFile3->ViewValue : $CCEStudentActivities->AssignmentFile3->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile3->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile3->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile3->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile3->TooltipValue = "";

			// AssignmentFile4
			if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile4->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile4->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile4->ViewValue)) ? $CCEStudentActivities->AssignmentFile4->ViewValue : $CCEStudentActivities->AssignmentFile4->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile4->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile4->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile4->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile4->TooltipValue = "";

			// AssignmentFile5
			if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile5->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile5->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile5->ViewValue)) ? $CCEStudentActivities->AssignmentFile5->ViewValue : $CCEStudentActivities->AssignmentFile5->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile5->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile5->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile5->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile5->TooltipValue = "";

			// AssignmentFile6
			if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile6->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile6->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile6->ViewValue)) ? $CCEStudentActivities->AssignmentFile6->ViewValue : $CCEStudentActivities->AssignmentFile6->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile6->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile6->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile6->HrefValue = "";
			}
			$CCEStudentActivities->AssignmentFile6->TooltipValue = "";

			// DateSubmitted
			$CCEStudentActivities->DateSubmitted->HrefValue = "";
			$CCEStudentActivities->DateSubmitted->TooltipValue = "";

			// AcceptStatus
			$CCEStudentActivities->AcceptStatus->HrefValue = "";
			$CCEStudentActivities->AcceptStatus->TooltipValue = "";

			// AcceptedBy
			$CCEStudentActivities->AcceptedBy->HrefValue = "";
			$CCEStudentActivities->AcceptedBy->TooltipValue = "";

			// DateAccepted
			$CCEStudentActivities->DateAccepted->HrefValue = "";
			$CCEStudentActivities->DateAccepted->TooltipValue = "";

			// Comments
			$CCEStudentActivities->Comments->HrefValue = "";
			$CCEStudentActivities->Comments->TooltipValue = "";
		} elseif ($CCEStudentActivities->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// CCEStudentAssigID
			$CCEStudentActivities->CCEStudentAssigID->EditCustomAttributes = "";

			// CCEStudentID
			$CCEStudentActivities->CCEStudentID->EditCustomAttributes = "";
			if ($CCEStudentActivities->CCEStudentID->getSessionValue() <> "") {
				$CCEStudentActivities->CCEStudentID->CurrentValue = $CCEStudentActivities->CCEStudentID->getSessionValue();
			if (strval($CCEStudentActivities->CCEStudentID->CurrentValue) <> "") {
				$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEStudentActivities->CCEStudentID->CurrentValue) . "";
			$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FirstName`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEStudentActivities->CCEStudentID->ViewValue = $rswrk->fields('FirstName');
					$CCEStudentActivities->CCEStudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
					$rswrk->Close();
				} else {
					$CCEStudentActivities->CCEStudentID->ViewValue = $CCEStudentActivities->CCEStudentID->CurrentValue;
				}
			} else {
				$CCEStudentActivities->CCEStudentID->ViewValue = NULL;
			}
			$CCEStudentActivities->CCEStudentID->CssStyle = "";
			$CCEStudentActivities->CCEStudentID->CssClass = "";
			$CCEStudentActivities->CCEStudentID->ViewCustomAttributes = "";
			} else {
				$sFilterWrk = "";
			$sSqlWrk = "SELECT `CCEStudentID`, `FirstName`, `Surname`, '' AS SelectFilterFld FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FirstName`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
			$CCEStudentActivities->CCEStudentID->EditValue = $arwrk;
			}

			// CCEActivityID
			$CCEStudentActivities->CCEActivityID->EditCustomAttributes = "";
				$sFilterWrk = "";
			$sSqlWrk = "SELECT `CCEActivityID`, `WorkbookName`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEActivities`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `WorkbookName`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$CCEStudentActivities->CCEActivityID->EditValue = $arwrk;

			// ActivityRef
			$CCEStudentActivities->ActivityRef->EditCustomAttributes = "";
				$sFilterWrk = "";
			$sSqlWrk = "SELECT `RefNum`, `RefNum`, '' AS Disp2Fld, `CCEActivityID` FROM `CCEActivities`";
			$sWhereWrk = "";
			if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
			$sWhereWrk .= "(" . "Archived=0" . ")";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `RefNum`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect"), ""));
			$CCEStudentActivities->ActivityRef->EditValue = $arwrk;

			// AssignmentFile1
			$CCEStudentActivities->AssignmentFile1->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile1->EditValue = $CCEStudentActivities->AssignmentFile1->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile1->EditValue = "";
			}

			// AssignmentFile2
			$CCEStudentActivities->AssignmentFile2->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile2->EditValue = $CCEStudentActivities->AssignmentFile2->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile2->EditValue = "";
			}

			// AssignmentFile3
			$CCEStudentActivities->AssignmentFile3->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile3->EditValue = $CCEStudentActivities->AssignmentFile3->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile3->EditValue = "";
			}

			// AssignmentFile4
			$CCEStudentActivities->AssignmentFile4->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile4->EditValue = $CCEStudentActivities->AssignmentFile4->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile4->EditValue = "";
			}

			// AssignmentFile5
			$CCEStudentActivities->AssignmentFile5->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile5->EditValue = $CCEStudentActivities->AssignmentFile5->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile5->EditValue = "";
			}

			// AssignmentFile6
			$CCEStudentActivities->AssignmentFile6->EditCustomAttributes = "";
			if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile6->EditValue = $CCEStudentActivities->AssignmentFile6->Upload->DbValue;
			} else {
				$CCEStudentActivities->AssignmentFile6->EditValue = "";
			}

			// DateSubmitted
			$CCEStudentActivities->DateSubmitted->EditCustomAttributes = "";
			$CCEStudentActivities->DateSubmitted->EditValue = $CCEStudentActivities->DateSubmitted->CurrentValue;
			$CCEStudentActivities->DateSubmitted->EditValue = ew_FormatDateTime($CCEStudentActivities->DateSubmitted->EditValue, 5);
			$CCEStudentActivities->DateSubmitted->CssStyle = "";
			$CCEStudentActivities->DateSubmitted->CssClass = "";
			$CCEStudentActivities->DateSubmitted->ViewCustomAttributes = "";

			// AcceptStatus
			$CCEStudentActivities->AcceptStatus->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array("1", "Yes");
			$arwrk[] = array("0", "No");
			$CCEStudentActivities->AcceptStatus->EditValue = $arwrk;

			// AcceptedBy
			$CCEStudentActivities->AcceptedBy->EditCustomAttributes = "";
				$sFilterWrk = "";
			$sSqlWrk = "SELECT `FacilitatorName`, `FacilitatorName`, '' AS Disp2Fld, '' AS SelectFilterFld FROM `CCEFacilitators`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `FacilitatorName`";
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$CCEStudentActivities->AcceptedBy->EditValue = $arwrk;

			// DateAccepted
			$CCEStudentActivities->DateAccepted->EditCustomAttributes = "";
			$CCEStudentActivities->DateAccepted->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEStudentActivities->DateAccepted->CurrentValue, 5));

			// Comments
			$CCEStudentActivities->Comments->EditCustomAttributes = "";
			$CCEStudentActivities->Comments->EditValue = ew_HtmlEncode($CCEStudentActivities->Comments->CurrentValue);

			// Edit refer script
			// CCEStudentAssigID

			$CCEStudentActivities->CCEStudentAssigID->HrefValue = "";

			// CCEStudentID
			$CCEStudentActivities->CCEStudentID->HrefValue = "";

			// CCEActivityID
			$CCEStudentActivities->CCEActivityID->HrefValue = "";

			// ActivityRef
			$CCEStudentActivities->ActivityRef->HrefValue = "";

			// AssignmentFile1
			if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile1->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile1->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile1->EditValue)) ? $CCEStudentActivities->AssignmentFile1->EditValue : $CCEStudentActivities->AssignmentFile1->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile1->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile1->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile1->HrefValue = "";
			}

			// AssignmentFile2
			if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile2->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile2->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile2->EditValue)) ? $CCEStudentActivities->AssignmentFile2->EditValue : $CCEStudentActivities->AssignmentFile2->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile2->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile2->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile2->HrefValue = "";
			}

			// AssignmentFile3
			if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile3->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile3->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile3->EditValue)) ? $CCEStudentActivities->AssignmentFile3->EditValue : $CCEStudentActivities->AssignmentFile3->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile3->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile3->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile3->HrefValue = "";
			}

			// AssignmentFile4
			if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile4->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile4->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile4->EditValue)) ? $CCEStudentActivities->AssignmentFile4->EditValue : $CCEStudentActivities->AssignmentFile4->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile4->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile4->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile4->HrefValue = "";
			}

			// AssignmentFile5
			if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile5->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile5->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile5->EditValue)) ? $CCEStudentActivities->AssignmentFile5->EditValue : $CCEStudentActivities->AssignmentFile5->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile5->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile5->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile5->HrefValue = "";
			}

			// AssignmentFile6
			if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->DbValue)) {
				$CCEStudentActivities->AssignmentFile6->HrefValue = ew_UploadPathEx(FALSE, $CCEStudentActivities->AssignmentFile6->UploadPath) . ((!empty($CCEStudentActivities->AssignmentFile6->EditValue)) ? $CCEStudentActivities->AssignmentFile6->EditValue : $CCEStudentActivities->AssignmentFile6->CurrentValue);
				if ($CCEStudentActivities->Export <> "") $CCEStudentActivities->AssignmentFile6->HrefValue = ew_ConvertFullUrl($CCEStudentActivities->AssignmentFile6->HrefValue);
			} else {
				$CCEStudentActivities->AssignmentFile6->HrefValue = "";
			}

			// DateSubmitted
			$CCEStudentActivities->DateSubmitted->HrefValue = "";

			// AcceptStatus
			$CCEStudentActivities->AcceptStatus->HrefValue = "";

			// AcceptedBy
			$CCEStudentActivities->AcceptedBy->HrefValue = "";

			// DateAccepted
			$CCEStudentActivities->DateAccepted->HrefValue = "";

			// Comments
			$CCEStudentActivities->Comments->HrefValue = "";
		}

		// Call Row Rendered event
		if ($CCEStudentActivities->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$CCEStudentActivities->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError, $CCEStudentActivities;

		// Initialize form error message
		$gsFormError = "";
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile1->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile1->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile1->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile1->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile1->Upload->Error);
		}
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile2->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile2->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile2->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile2->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile2->Upload->Error);
		}
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile3->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile3->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile3->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile3->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile3->Upload->Error);
		}
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile4->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile4->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile4->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile4->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile4->Upload->Error);
		}
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile5->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile5->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile5->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile5->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile5->Upload->Error);
		}
		if (!ew_CheckFileType($CCEStudentActivities->AssignmentFile6->Upload->FileName)) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("WrongFileType");
		}
		if ($CCEStudentActivities->AssignmentFile6->Upload->FileSize > 0 && EW_MAX_FILE_SIZE > 0 && $CCEStudentActivities->AssignmentFile6->Upload->FileSize > EW_MAX_FILE_SIZE) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= str_replace("%s", EW_MAX_FILE_SIZE, $Language->Phrase("MaxFileSize"));
		}
		if (in_array($CCEStudentActivities->AssignmentFile6->Upload->Error, array(1, 2, 3, 6, 7, 8))) {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("PhpUploadErr" . $CCEStudentActivities->AssignmentFile6->Upload->Error);
		}

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!is_null($CCEStudentActivities->CCEActivityID->FormValue) && $CCEStudentActivities->CCEActivityID->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEStudentActivities->CCEActivityID->FldCaption();
		}
		if (!is_null($CCEStudentActivities->ActivityRef->FormValue) && $CCEStudentActivities->ActivityRef->FormValue == "") {
			$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
			$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEStudentActivities->ActivityRef->FldCaption();
		}
		if (!ew_CheckDate($CCEStudentActivities->DateAccepted->FormValue)) {
			if ($gsFormError <> "") $gsFormError .= "<br>";
			$gsFormError .= $CCEStudentActivities->DateAccepted->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;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language, $CCEStudentActivities;
		$sFilter = $CCEStudentActivities->KeyFilter();
		$CCEStudentActivities->CurrentFilter = $sFilter;
		$sSql = $CCEStudentActivities->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Save old values
			$rsold =& $rs->fields;
			$rsnew = array();

			// CCEStudentID
			$CCEStudentActivities->CCEStudentID->SetDbValueDef($rsnew, $CCEStudentActivities->CCEStudentID->CurrentValue, NULL, FALSE);

			// CCEActivityID
			$CCEStudentActivities->CCEActivityID->SetDbValueDef($rsnew, $CCEStudentActivities->CCEActivityID->CurrentValue, NULL, FALSE);

			// ActivityRef
			$CCEStudentActivities->ActivityRef->SetDbValueDef($rsnew, $CCEStudentActivities->ActivityRef->CurrentValue, NULL, FALSE);

			// AssignmentFile1
			$CCEStudentActivities->AssignmentFile1->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile1->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile1->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile1->Upload->DbValue = $rs->fields('AssignmentFile1'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile1->Upload->Value)) {
				$rsnew['AssignmentFile1'] = NULL;
			} else {
				$rsnew['AssignmentFile1'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile1->UploadPath), $CCEStudentActivities->AssignmentFile1->Upload->FileName);
			}
			}

			// AssignmentFile2
			$CCEStudentActivities->AssignmentFile2->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile2->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile2->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile2->Upload->DbValue = $rs->fields('AssignmentFile2'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile2->Upload->Value)) {
				$rsnew['AssignmentFile2'] = NULL;
			} else {
				$rsnew['AssignmentFile2'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile2->UploadPath), $CCEStudentActivities->AssignmentFile2->Upload->FileName);
			}
			}

			// AssignmentFile3
			$CCEStudentActivities->AssignmentFile3->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile3->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile3->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile3->Upload->DbValue = $rs->fields('AssignmentFile3'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile3->Upload->Value)) {
				$rsnew['AssignmentFile3'] = NULL;
			} else {
				$rsnew['AssignmentFile3'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile3->UploadPath), $CCEStudentActivities->AssignmentFile3->Upload->FileName);
			}
			}

			// AssignmentFile4
			$CCEStudentActivities->AssignmentFile4->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile4->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile4->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile4->Upload->DbValue = $rs->fields('AssignmentFile4'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile4->Upload->Value)) {
				$rsnew['AssignmentFile4'] = NULL;
			} else {
				$rsnew['AssignmentFile4'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile4->UploadPath), $CCEStudentActivities->AssignmentFile4->Upload->FileName);
			}
			}

			// AssignmentFile5
			$CCEStudentActivities->AssignmentFile5->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile5->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile5->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile5->Upload->DbValue = $rs->fields('AssignmentFile5'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile5->Upload->Value)) {
				$rsnew['AssignmentFile5'] = NULL;
			} else {
				$rsnew['AssignmentFile5'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile5->UploadPath), $CCEStudentActivities->AssignmentFile5->Upload->FileName);
			}
			}

			// AssignmentFile6
			$CCEStudentActivities->AssignmentFile6->Upload->SaveToSession(); // Save file value to Session
						if ($CCEStudentActivities->AssignmentFile6->Upload->Action == "2" || $CCEStudentActivities->AssignmentFile6->Upload->Action == "3") { // Update/Remove
			$CCEStudentActivities->AssignmentFile6->Upload->DbValue = $rs->fields('AssignmentFile6'); // Get original value
			if (is_null($CCEStudentActivities->AssignmentFile6->Upload->Value)) {
				$rsnew['AssignmentFile6'] = NULL;
			} else {
				$rsnew['AssignmentFile6'] = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $CCEStudentActivities->AssignmentFile6->UploadPath), $CCEStudentActivities->AssignmentFile6->Upload->FileName);
			}
			}

			// AcceptStatus
			$CCEStudentActivities->AcceptStatus->SetDbValueDef($rsnew, $CCEStudentActivities->AcceptStatus->CurrentValue, 0, FALSE);

			// AcceptedBy
			$CCEStudentActivities->AcceptedBy->SetDbValueDef($rsnew, $CCEStudentActivities->AcceptedBy->CurrentValue, NULL, FALSE);

			// DateAccepted
			$CCEStudentActivities->DateAccepted->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEStudentActivities->DateAccepted->CurrentValue, 5, FALSE), NULL);

			// Comments
			$CCEStudentActivities->Comments->SetDbValueDef($rsnew, $CCEStudentActivities->Comments->CurrentValue, NULL, FALSE);

			// Call Row Updating event
			$bUpdateRow = $CCEStudentActivities->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
			if (!ew_Empty($CCEStudentActivities->AssignmentFile1->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile1->Upload->SaveToFile($CCEStudentActivities->AssignmentFile1->UploadPath, $rsnew['AssignmentFile1'], FALSE);
			}
			if (!ew_Empty($CCEStudentActivities->AssignmentFile2->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile2->Upload->SaveToFile($CCEStudentActivities->AssignmentFile2->UploadPath, $rsnew['AssignmentFile2'], FALSE);
			}
			if (!ew_Empty($CCEStudentActivities->AssignmentFile3->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile3->Upload->SaveToFile($CCEStudentActivities->AssignmentFile3->UploadPath, $rsnew['AssignmentFile3'], FALSE);
			}
			if (!ew_Empty($CCEStudentActivities->AssignmentFile4->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile4->Upload->SaveToFile($CCEStudentActivities->AssignmentFile4->UploadPath, $rsnew['AssignmentFile4'], FALSE);
			}
			if (!ew_Empty($CCEStudentActivities->AssignmentFile5->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile5->Upload->SaveToFile($CCEStudentActivities->AssignmentFile5->UploadPath, $rsnew['AssignmentFile5'], FALSE);
			}
			if (!ew_Empty($CCEStudentActivities->AssignmentFile6->Upload->Value)) {
				$CCEStudentActivities->AssignmentFile6->Upload->SaveToFile($CCEStudentActivities->AssignmentFile6->UploadPath, $rsnew['AssignmentFile6'], FALSE);
			}
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$EditRow = $conn->Execute($CCEStudentActivities->UpdateSQL($rsnew));
				$conn->raiseErrorFn = '';
			} else {
				if ($CCEStudentActivities->CancelMessage <> "") {
					$this->setMessage($CCEStudentActivities->CancelMessage);
					$CCEStudentActivities->CancelMessage = "";
				} else {
					$this->setMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$CCEStudentActivities->Row_Updated($rsold, $rsnew);
		$rs->Close();

		// AssignmentFile1
		$CCEStudentActivities->AssignmentFile1->Upload->RemoveFromSession(); // Remove file value from Session

		// AssignmentFile2
		$CCEStudentActivities->AssignmentFile2->Upload->RemoveFromSession(); // Remove file value from Session

		// AssignmentFile3
		$CCEStudentActivities->AssignmentFile3->Upload->RemoveFromSession(); // Remove file value from Session

		// AssignmentFile4
		$CCEStudentActivities->AssignmentFile4->Upload->RemoveFromSession(); // Remove file value from Session

		// AssignmentFile5
		$CCEStudentActivities->AssignmentFile5->Upload->RemoveFromSession(); // Remove file value from Session

		// AssignmentFile6
		$CCEStudentActivities->AssignmentFile6->Upload->RemoveFromSession(); // Remove file value from Session
		return $EditRow;
	}

	// Set up master/detail based on QueryString
	function SetUpMasterDetail() {
		global $CCEStudentActivities;
		$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 == "CCEAssignments") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $CCEStudentActivities->SqlMasterFilter_CCEAssignments();
				$this->sDbDetailFilter = $CCEStudentActivities->SqlDetailFilter_CCEAssignments();
				if (@$_GET["CCEAssignmentID"] <> "") {
					$GLOBALS["CCEAssignments"]->CCEAssignmentID->setQueryStringValue($_GET["CCEAssignmentID"]);
					$CCEStudentActivities->CCEAssignmentID->setQueryStringValue($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue);
					$CCEStudentActivities->CCEAssignmentID->setSessionValue($CCEStudentActivities->CCEAssignmentID->QueryStringValue);
					if (!is_numeric($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@CCEAssignmentID@", ew_AdjustSql($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@CCEAssignmentID@", ew_AdjustSql($GLOBALS["CCEAssignments"]->CCEAssignmentID->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
			if ($sMasterTblVar == "CCEStudents") {
				$bValidMaster = TRUE;
				$this->sDbMasterFilter = $CCEStudentActivities->SqlMasterFilter_CCEStudents();
				$this->sDbDetailFilter = $CCEStudentActivities->SqlDetailFilter_CCEStudents();
				if (@$_GET["CCEStudentID"] <> "") {
					$GLOBALS["CCEStudents"]->CCEStudentID->setQueryStringValue($_GET["CCEStudentID"]);
					$CCEStudentActivities->CCEStudentID->setQueryStringValue($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue);
					$CCEStudentActivities->CCEStudentID->setSessionValue($CCEStudentActivities->CCEStudentID->QueryStringValue);
					if (!is_numeric($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue)) $bValidMaster = FALSE;
					$this->sDbMasterFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbMasterFilter);
					$this->sDbDetailFilter = str_replace("@CCEStudentID@", ew_AdjustSql($GLOBALS["CCEStudents"]->CCEStudentID->QueryStringValue), $this->sDbDetailFilter);
				} else {
					$bValidMaster = FALSE;
				}
			}
		}
		if ($bValidMaster) {

			// Save current master table
			$CCEStudentActivities->setCurrentMasterTable($sMasterTblVar);

			// Reset start record counter (new master key)
			$this->lStartRec = 1;
			$CCEStudentActivities->setStartRecordNumber($this->lStartRec);
			$CCEStudentActivities->setMasterFilter($this->sDbMasterFilter); // Set up master filter
			$CCEStudentActivities->setDetailFilter($this->sDbDetailFilter); // Set up detail filter

			// Clear previous master key from Session
			if ($sMasterTblVar <> "CCEAssignments") {
				if ($CCEStudentActivities->CCEAssignmentID->QueryStringValue == "") $CCEStudentActivities->CCEAssignmentID->setSessionValue("");
			}
			if ($sMasterTblVar <> "CCEStudents") {
				if ($CCEStudentActivities->CCEStudentID->QueryStringValue == "") $CCEStudentActivities->CCEStudentID->setSessionValue("");
			}
		} else {
			$this->sDbMasterFilter = $CCEStudentActivities->getMasterFilter(); //  Restore master filter
			$this->sDbDetailFilter = $CCEStudentActivities->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;
	}
}
?>