| Current Path : /var/www/cesa.co.za/cceadmin/ |
| Current File : /var/www/cesa.co.za/cceadmin/CCEPopupMessagesadd.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 "CCEPopupMessagesinfo.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
$CCEPopupMessages_add = new cCCEPopupMessages_add();
$Page =& $CCEPopupMessages_add;
// Page init
$CCEPopupMessages_add->Page_Init();
// Page main
$CCEPopupMessages_add->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
// Create page object
var CCEPopupMessages_add = new ew_Page("CCEPopupMessages_add");
// page properties
CCEPopupMessages_add.PageID = "add"; // page ID
CCEPopupMessages_add.FormID = "fCCEPopupMessagesadd"; // form ID
var EW_PAGE_ID = CCEPopupMessages_add.PageID; // for backward compatibility
// extend page with ValidateForm function
CCEPopupMessages_add.ValidateForm = function(fobj) {
ew_PostAutoSuggest(fobj);
if (!this.ValidateRequired)
return true; // ignore validation
if (fobj.a_confirm && fobj.a_confirm.value == "F")
return true;
var i, elm, aelm, infix;
var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1;
for (i=0; i<rowcnt; i++) {
infix = (fobj.key_count) ? String(i+1) : "";
elm = fobj.elements["x" + infix + "_MessageText"];
if (elm && !ew_HasValue(elm))
return ew_OnError(this, elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($CCEPopupMessages->MessageText->FldCaption()) ?>");
elm = fobj.elements["x" + infix + "_StartDate"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEPopupMessages->StartDate->FldErrMsg()) ?>");
elm = fobj.elements["x" + infix + "_EndDate"];
if (elm && !ew_CheckDate(elm.value))
return ew_OnError(this, elm, "<?php echo ew_JsEncode2($CCEPopupMessages->EndDate->FldErrMsg()) ?>");
// Call Form Custom Validate event
if (!this.Form_CustomValidate(fobj)) return false;
}
return true;
}
// extend page with Form_CustomValidate function
CCEPopupMessages_add.Form_CustomValidate =
function(fobj) { // DO NOT CHANGE THIS LINE!
// Your custom validation code here, return false if invalid.
return true;
}
<?php if (EW_CLIENT_VALIDATE) { ?>
CCEPopupMessages_add.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEPopupMessages_add.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" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
<!--
_width_multiplier = 20;
_height_multiplier = 60;
var ew_DHTMLEditors = [];
// update value from editor to textarea
function ew_UpdateTextArea() {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst;
for (inst in CKEDITOR.instances)
CKEDITOR.instances[inst].updateElement();
}
}
// update value from textarea to editor
function ew_UpdateDHTMLEditor(name) {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst = CKEDITOR.instances[name];
if (inst)
inst.setData(inst.element.value);
}
}
// focus editor
function ew_FocusDHTMLEditor(name) {
if (typeof ew_DHTMLEditors != 'undefined' && typeof CKEDITOR != 'undefined') {
var inst = CKEDITOR.instances[name];
if (inst)
inst.focus();
}
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js");
//-->
</script>
<p><span class="phpmaker"><?php echo $Language->Phrase("Add") ?> <?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEPopupMessages->TableCaption() ?><br><br>
<a href="<?php echo $CCEPopupMessages->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
echo ew_DebugMsg();
$CCEPopupMessages_add->ShowMessage();
?>
<form name="fCCEPopupMessagesadd" id="fCCEPopupMessagesadd" action="<?php echo ew_CurrentPage() ?>" method="post" onsubmit="return CCEPopupMessages_add.ValidateForm(this);">
<p>
<input type="hidden" name="t" id="t" value="CCEPopupMessages">
<input type="hidden" name="a_add" id="a_add" value="A">
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEPopupMessages->MessageText->Visible) { // MessageText ?>
<tr<?php echo $CCEPopupMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEPopupMessages->MessageText->FldCaption() ?><?php echo $Language->Phrase("FieldRequiredIndicator") ?></td>
<td<?php echo $CCEPopupMessages->MessageText->CellAttributes() ?>><span id="el_MessageText">
<textarea name="x_MessageText" id="x_MessageText" title="<?php echo $CCEPopupMessages->MessageText->FldTitle() ?>" cols="35" rows="4"<?php echo $CCEPopupMessages->MessageText->EditAttributes() ?>><?php echo $CCEPopupMessages->MessageText->EditValue ?></textarea>
<script type="text/javascript">
<!--
ew_DHTMLEditors.push(new ew_DHTMLEditor("x_MessageText", function() {
var oCKeditor = CKEDITOR.replace('x_MessageText', { width: 35*_width_multiplier, height: 4*_height_multiplier, autoUpdateElement: false, baseHref: 'ckeditor/'});
this.active = true;
}));
-->
</script>
</span><?php echo $CCEPopupMessages->MessageText->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEPopupMessages->StartDate->Visible) { // StartDate ?>
<tr<?php echo $CCEPopupMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEPopupMessages->StartDate->FldCaption() ?></td>
<td<?php echo $CCEPopupMessages->StartDate->CellAttributes() ?>><span id="el_StartDate">
<input type="text" name="x_StartDate" id="x_StartDate" title="<?php echo $CCEPopupMessages->StartDate->FldTitle() ?>" value="<?php echo $CCEPopupMessages->StartDate->EditValue ?>"<?php echo $CCEPopupMessages->StartDate->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x_StartDate" name="cal_x_StartDate" 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_StartDate", // input field id
ifFormat: "%Y/%m/%d", // date format
button: "cal_x_StartDate" // button id
});
</script>
</span><?php echo $CCEPopupMessages->StartDate->CustomMsg ?></td>
</tr>
<?php } ?>
<?php if ($CCEPopupMessages->EndDate->Visible) { // EndDate ?>
<tr<?php echo $CCEPopupMessages->RowAttributes() ?>>
<td class="ewTableHeader"><?php echo $CCEPopupMessages->EndDate->FldCaption() ?></td>
<td<?php echo $CCEPopupMessages->EndDate->CellAttributes() ?>><span id="el_EndDate">
<input type="text" name="x_EndDate" id="x_EndDate" title="<?php echo $CCEPopupMessages->EndDate->FldTitle() ?>" value="<?php echo $CCEPopupMessages->EndDate->EditValue ?>"<?php echo $CCEPopupMessages->EndDate->EditAttributes() ?>>
<img src="images/calendar.png" id="cal_x_EndDate" name="cal_x_EndDate" 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_EndDate", // input field id
ifFormat: "%Y/%m/%d", // date format
button: "cal_x_EndDate" // button id
});
</script>
</span><?php echo $CCEPopupMessages->EndDate->CustomMsg ?></td>
</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="<?php echo ew_BtnCaption($Language->Phrase("AddBtn")) ?>">
</form>
<script type="text/javascript">
<!--
ew_CreateEditor(); // Create DHTML editor(s)
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<?php include "footer.php" ?>
<?php
$CCEPopupMessages_add->Page_Terminate();
?>
<?php
//
// Page class
//
class cCCEPopupMessages_add {
// Page ID
var $PageID = 'add';
// Table name
var $TableName = 'CCEPopupMessages';
// Page object name
var $PageObjName = 'CCEPopupMessages_add';
// Page name
function PageName() {
return ew_CurrentPage();
}
// Page URL
function PageUrl() {
$PageUrl = ew_CurrentPage() . "?";
global $CCEPopupMessages;
if ($CCEPopupMessages->UseTokenInUrl) $PageUrl .= "t=" . $CCEPopupMessages->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, $CCEPopupMessages;
if ($CCEPopupMessages->UseTokenInUrl) {
if ($objForm)
return ($CCEPopupMessages->TableVar == $objForm->GetValue("t"));
if (@$_GET["t"] <> "")
return ($CCEPopupMessages->TableVar == $_GET["t"]);
} else {
return TRUE;
}
}
//
// Page class constructor
//
function __construct() {
global $conn, $Language;
// Language object
$Language = new cLanguage();
// Table object (CCEPopupMessages)
$GLOBALS["CCEPopupMessages"] = new cCCEPopupMessages();
// Table object (CCEUsers)
$GLOBALS['CCEUsers'] = new cCCEUsers();
// Page ID
if (!defined("EW_PAGE_ID"))
define("EW_PAGE_ID", 'add', TRUE);
// Table name (for backward compatibility)
if (!defined("EW_TABLE_NAME"))
define("EW_TABLE_NAME", 'CCEPopupMessages', 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 $CCEPopupMessages;
// Security
$Security = new cAdvancedSecurity();
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
$Security->TablePermission_Loading();
$Security->LoadCurrentUserLevel($this->TableName);
$Security->TablePermission_Loaded();
if (!$Security->IsLoggedIn()) {
$Security->SaveLastUrl();
$this->Page_Terminate("login.php");
}
if (!$Security->CanAdd()) {
$Security->SaveLastUrl();
$this->Page_Terminate("CCEPopupMessageslist.php");
}
// Create form object
$objForm = new cFormObj();
// Global Page Loading event (in userfn*.php)
Page_Loading();
// Page Load event
$this->Page_Load();
}
//
// Page_Terminate
//
function Page_Terminate($url = "") {
global $conn;
// Page Unload event
$this->Page_Unload();
// Global Page Unloaded event (in userfn*.php)
Page_Unloaded();
// Close connection
$conn->Close();
// Go to URL if specified
$this->Page_Redirecting($url);
if ($url <> "") {
if (!EW_DEBUG_ENABLED && ob_get_length())
ob_end_clean();
header("Location: " . $url);
}
exit();
}
var $sDbMasterFilter = "";
var $sDbDetailFilter = "";
var $lPriv = 0;
//
// Page main
//
function Page_Main() {
global $objForm, $Language, $gsFormError, $CCEPopupMessages;
// Load key values from QueryString
$bCopy = TRUE;
if (@$_GET["MessageID"] != "") {
$CCEPopupMessages->MessageID->setQueryStringValue($_GET["MessageID"]);
} else {
$bCopy = FALSE;
}
// Process form if post back
if (@$_POST["a_add"] <> "") {
$CCEPopupMessages->CurrentAction = $_POST["a_add"]; // Get form action
$this->LoadFormValues(); // Load form values
// Validate form
if (!$this->ValidateForm()) {
$CCEPopupMessages->CurrentAction = "I"; // Form error, reset action
$this->setMessage($gsFormError);
}
} else { // Not post back
if ($bCopy) {
$CCEPopupMessages->CurrentAction = "C"; // Copy record
} else {
$CCEPopupMessages->CurrentAction = "I"; // Display blank record
$this->LoadDefaultValues(); // Load default values
}
}
// Perform action based on action code
switch ($CCEPopupMessages->CurrentAction) {
case "I": // Blank record, no action required
break;
case "C": // Copy an existing record
if (!$this->LoadRow()) { // Load record based on key
$this->setMessage($Language->Phrase("NoRecord")); // No record found
$this->Page_Terminate("CCEPopupMessageslist.php"); // No matching record, return to list
}
break;
case "A": // ' Add new record
$CCEPopupMessages->SendEmail = TRUE; // Send email on add success
if ($this->AddRow()) { // Add successful
$this->setMessage($Language->Phrase("AddSuccess")); // Set up success message
$sReturnUrl = $CCEPopupMessages->getReturnUrl();
if (ew_GetPageName($sReturnUrl) == "CCEPopupMessagesview.php")
$sReturnUrl = $CCEPopupMessages->ViewUrl(); // View paging, return to view page with keyurl directly
$this->Page_Terminate($sReturnUrl); // Clean up and return
} else {
$this->RestoreFormValues(); // Add failed, restore form values
}
}
// Render row based on row type
$CCEPopupMessages->RowType = EW_ROWTYPE_ADD; // Render add type
// Render row
$this->RenderRow();
}
// Get upload files
function GetUploadFiles() {
global $objForm, $CCEPopupMessages;
// Get upload data
}
// Load default values
function LoadDefaultValues() {
global $CCEPopupMessages;
}
// Load form values
function LoadFormValues() {
// Load from form
global $objForm, $CCEPopupMessages;
$CCEPopupMessages->MessageText->setFormValue($objForm->GetValue("x_MessageText"));
$CCEPopupMessages->StartDate->setFormValue($objForm->GetValue("x_StartDate"));
$CCEPopupMessages->StartDate->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->StartDate->CurrentValue, 5);
$CCEPopupMessages->EndDate->setFormValue($objForm->GetValue("x_EndDate"));
$CCEPopupMessages->EndDate->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->EndDate->CurrentValue, 5);
$CCEPopupMessages->DateCreated->setFormValue($objForm->GetValue("x_DateCreated"));
$CCEPopupMessages->DateCreated->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->DateCreated->CurrentValue, 5);
$CCEPopupMessages->MessageID->setFormValue($objForm->GetValue("x_MessageID"));
}
// Restore form values
function RestoreFormValues() {
global $objForm, $CCEPopupMessages;
$CCEPopupMessages->MessageID->CurrentValue = $CCEPopupMessages->MessageID->FormValue;
$CCEPopupMessages->MessageText->CurrentValue = $CCEPopupMessages->MessageText->FormValue;
$CCEPopupMessages->StartDate->CurrentValue = $CCEPopupMessages->StartDate->FormValue;
$CCEPopupMessages->StartDate->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->StartDate->CurrentValue, 5);
$CCEPopupMessages->EndDate->CurrentValue = $CCEPopupMessages->EndDate->FormValue;
$CCEPopupMessages->EndDate->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->EndDate->CurrentValue, 5);
$CCEPopupMessages->DateCreated->CurrentValue = $CCEPopupMessages->DateCreated->FormValue;
$CCEPopupMessages->DateCreated->CurrentValue = ew_UnFormatDateTime($CCEPopupMessages->DateCreated->CurrentValue, 5);
}
// Load row based on key values
function LoadRow() {
global $conn, $Security, $CCEPopupMessages;
$sFilter = $CCEPopupMessages->KeyFilter();
// Call Row Selecting event
$CCEPopupMessages->Row_Selecting($sFilter);
// Load SQL based on filter
$CCEPopupMessages->CurrentFilter = $sFilter;
$sSql = $CCEPopupMessages->SQL();
$res = FALSE;
$rs = ew_LoadRecordset($sSql);
if ($rs && !$rs->EOF) {
$res = TRUE;
$this->LoadRowValues($rs); // Load row values
// Call Row Selected event
$CCEPopupMessages->Row_Selected($rs);
$rs->Close();
}
return $res;
}
// Load row values from recordset
function LoadRowValues(&$rs) {
global $conn, $CCEPopupMessages;
$CCEPopupMessages->MessageID->setDbValue($rs->fields('MessageID'));
$CCEPopupMessages->MessageText->setDbValue($rs->fields('MessageText'));
$CCEPopupMessages->StartDate->setDbValue($rs->fields('StartDate'));
$CCEPopupMessages->EndDate->setDbValue($rs->fields('EndDate'));
$CCEPopupMessages->DateCreated->setDbValue($rs->fields('DateCreated'));
$CCEPopupMessages->Archived->setDbValue($rs->fields('Archived'));
$CCEPopupMessages->ArchiveYear->setDbValue($rs->fields('ArchiveYear'));
}
// Render row values based on field settings
function RenderRow() {
global $conn, $Security, $Language, $CCEPopupMessages;
// Initialize URLs
// Call Row_Rendering event
$CCEPopupMessages->Row_Rendering();
// Common render codes for all row types
// MessageText
$CCEPopupMessages->MessageText->CellCssStyle = ""; $CCEPopupMessages->MessageText->CellCssClass = "";
$CCEPopupMessages->MessageText->CellAttrs = array(); $CCEPopupMessages->MessageText->ViewAttrs = array(); $CCEPopupMessages->MessageText->EditAttrs = array();
// StartDate
$CCEPopupMessages->StartDate->CellCssStyle = ""; $CCEPopupMessages->StartDate->CellCssClass = "";
$CCEPopupMessages->StartDate->CellAttrs = array(); $CCEPopupMessages->StartDate->ViewAttrs = array(); $CCEPopupMessages->StartDate->EditAttrs = array();
// EndDate
$CCEPopupMessages->EndDate->CellCssStyle = ""; $CCEPopupMessages->EndDate->CellCssClass = "";
$CCEPopupMessages->EndDate->CellAttrs = array(); $CCEPopupMessages->EndDate->ViewAttrs = array(); $CCEPopupMessages->EndDate->EditAttrs = array();
// DateCreated
$CCEPopupMessages->DateCreated->CellCssStyle = ""; $CCEPopupMessages->DateCreated->CellCssClass = "";
$CCEPopupMessages->DateCreated->CellAttrs = array(); $CCEPopupMessages->DateCreated->ViewAttrs = array(); $CCEPopupMessages->DateCreated->EditAttrs = array();
if ($CCEPopupMessages->RowType == EW_ROWTYPE_VIEW) { // View row
// MessageID
$CCEPopupMessages->MessageID->ViewValue = $CCEPopupMessages->MessageID->CurrentValue;
$CCEPopupMessages->MessageID->CssStyle = "";
$CCEPopupMessages->MessageID->CssClass = "";
$CCEPopupMessages->MessageID->ViewCustomAttributes = "";
// MessageText
$CCEPopupMessages->MessageText->ViewValue = $CCEPopupMessages->MessageText->CurrentValue;
$CCEPopupMessages->MessageText->CssStyle = "";
$CCEPopupMessages->MessageText->CssClass = "";
$CCEPopupMessages->MessageText->ViewCustomAttributes = "";
// StartDate
$CCEPopupMessages->StartDate->ViewValue = $CCEPopupMessages->StartDate->CurrentValue;
$CCEPopupMessages->StartDate->ViewValue = ew_FormatDateTime($CCEPopupMessages->StartDate->ViewValue, 5);
$CCEPopupMessages->StartDate->CssStyle = "";
$CCEPopupMessages->StartDate->CssClass = "";
$CCEPopupMessages->StartDate->ViewCustomAttributes = "";
// EndDate
$CCEPopupMessages->EndDate->ViewValue = $CCEPopupMessages->EndDate->CurrentValue;
$CCEPopupMessages->EndDate->ViewValue = ew_FormatDateTime($CCEPopupMessages->EndDate->ViewValue, 5);
$CCEPopupMessages->EndDate->CssStyle = "";
$CCEPopupMessages->EndDate->CssClass = "";
$CCEPopupMessages->EndDate->ViewCustomAttributes = "";
// DateCreated
$CCEPopupMessages->DateCreated->ViewValue = $CCEPopupMessages->DateCreated->CurrentValue;
$CCEPopupMessages->DateCreated->ViewValue = ew_FormatDateTime($CCEPopupMessages->DateCreated->ViewValue, 5);
$CCEPopupMessages->DateCreated->CssStyle = "";
$CCEPopupMessages->DateCreated->CssClass = "";
$CCEPopupMessages->DateCreated->ViewCustomAttributes = "";
// Archived
$CCEPopupMessages->Archived->ViewValue = $CCEPopupMessages->Archived->CurrentValue;
$CCEPopupMessages->Archived->CssStyle = "";
$CCEPopupMessages->Archived->CssClass = "";
$CCEPopupMessages->Archived->ViewCustomAttributes = "";
// ArchiveYear
$CCEPopupMessages->ArchiveYear->ViewValue = $CCEPopupMessages->ArchiveYear->CurrentValue;
$CCEPopupMessages->ArchiveYear->CssStyle = "";
$CCEPopupMessages->ArchiveYear->CssClass = "";
$CCEPopupMessages->ArchiveYear->ViewCustomAttributes = "";
// MessageText
$CCEPopupMessages->MessageText->HrefValue = "";
$CCEPopupMessages->MessageText->TooltipValue = "";
// StartDate
$CCEPopupMessages->StartDate->HrefValue = "";
$CCEPopupMessages->StartDate->TooltipValue = "";
// EndDate
$CCEPopupMessages->EndDate->HrefValue = "";
$CCEPopupMessages->EndDate->TooltipValue = "";
// DateCreated
$CCEPopupMessages->DateCreated->HrefValue = "";
$CCEPopupMessages->DateCreated->TooltipValue = "";
} elseif ($CCEPopupMessages->RowType == EW_ROWTYPE_ADD) { // Add row
// MessageText
$CCEPopupMessages->MessageText->EditCustomAttributes = "";
$CCEPopupMessages->MessageText->EditValue = ew_HtmlEncode($CCEPopupMessages->MessageText->CurrentValue);
// StartDate
$CCEPopupMessages->StartDate->EditCustomAttributes = "";
$CCEPopupMessages->StartDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEPopupMessages->StartDate->CurrentValue, 5));
// EndDate
$CCEPopupMessages->EndDate->EditCustomAttributes = "";
$CCEPopupMessages->EndDate->EditValue = ew_HtmlEncode(ew_FormatDateTime($CCEPopupMessages->EndDate->CurrentValue, 5));
// DateCreated
}
// Call Row Rendered event
if ($CCEPopupMessages->RowType <> EW_ROWTYPE_AGGREGATEINIT)
$CCEPopupMessages->Row_Rendered();
}
// Validate form
function ValidateForm() {
global $Language, $gsFormError, $CCEPopupMessages;
// Initialize form error message
$gsFormError = "";
// Check if validation required
if (!EW_SERVER_VALIDATE)
return ($gsFormError == "");
if (!is_null($CCEPopupMessages->MessageText->FormValue) && $CCEPopupMessages->MessageText->FormValue == "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $Language->Phrase("EnterRequiredField") . " - " . $CCEPopupMessages->MessageText->FldCaption();
}
if (!ew_CheckDate($CCEPopupMessages->StartDate->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEPopupMessages->StartDate->FldErrMsg();
}
if (!ew_CheckDate($CCEPopupMessages->EndDate->FormValue)) {
if ($gsFormError <> "") $gsFormError .= "<br>";
$gsFormError .= $CCEPopupMessages->EndDate->FldErrMsg();
}
// Return validate result
$ValidateForm = ($gsFormError == "");
// Call Form_CustomValidate event
$sFormCustomError = "";
$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
if ($sFormCustomError <> "") {
$gsFormError .= ($gsFormError <> "") ? "<br>" : "";
$gsFormError .= $sFormCustomError;
}
return $ValidateForm;
}
// Add record
function AddRow() {
global $conn, $Language, $Security, $CCEPopupMessages;
$rsnew = array();
// MessageText
$CCEPopupMessages->MessageText->SetDbValueDef($rsnew, $CCEPopupMessages->MessageText->CurrentValue, NULL, FALSE);
// StartDate
$CCEPopupMessages->StartDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEPopupMessages->StartDate->CurrentValue, 5, FALSE), NULL);
// EndDate
$CCEPopupMessages->EndDate->SetDbValueDef($rsnew, ew_UnFormatDateTime($CCEPopupMessages->EndDate->CurrentValue, 5, FALSE), NULL);
// DateCreated
$CCEPopupMessages->DateCreated->SetDbValueDef($rsnew, ew_CurrentDateTime(), NULL);
$rsnew['DateCreated'] =& $CCEPopupMessages->DateCreated->DbValue;
// Call Row Inserting event
$bInsertRow = $CCEPopupMessages->Row_Inserting($rsnew);
if ($bInsertRow) {
$conn->raiseErrorFn = 'ew_ErrorFn';
$AddRow = $conn->Execute($CCEPopupMessages->InsertSQL($rsnew));
$conn->raiseErrorFn = '';
} else {
if ($CCEPopupMessages->CancelMessage <> "") {
$this->setMessage($CCEPopupMessages->CancelMessage);
$CCEPopupMessages->CancelMessage = "";
} else {
$this->setMessage($Language->Phrase("InsertCancelled"));
}
$AddRow = FALSE;
}
if ($AddRow) {
$CCEPopupMessages->MessageID->setDbValue($conn->Insert_ID());
$rsnew['MessageID'] = $CCEPopupMessages->MessageID->DbValue;
// Call Row Inserted event
$CCEPopupMessages->Row_Inserted($rsnew);
}
return $AddRow;
}
// Page Load event
function Page_Load() {
//echo "Page Load";
}
// Page Unload event
function Page_Unload() {
//echo "Page Unload";
}
// Page Redirecting event
function Page_Redirecting(&$url) {
// Example:
//$url = "your URL";
}
// Message Showing event
function Message_Showing(&$msg) {
// Example:
//$msg = "your new message";
}
// Form Custom Validate event
function Form_CustomValidate(&$CustomError) {
// Return error message in CustomError
return TRUE;
}
}
?>