<?php
//Include Common Files @1-5471E0F2
define("RelativePath", ".");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @18-503267A8
include("./Header.php");
//End Include Page implementation
Class clsRecordsupport { //support Class @2-78B4E9D7
//Variables @2-457FA246
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $FormSubmitted;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed;
var $UpdateAllowed;
var $DeleteAllowed;
var $ReadAllowed;
var $ds;
var $EditMode;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-B37306A6
function clsRecordsupport()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ds = new clssupportDataSource();
$this->ReadAllowed = false;
$this->InsertAllowed = false;
$this->UpdateAllowed = false;
$this->DeleteAllowed = false;
$this->Visible = (CCSecurityAccessCheck("2") == "success");
if($this->Visible)
{
$this->ReadAllowed = CCUserInGroups(CCGetGroupID(), "2");
$this->InsertAllowed = CCUserInGroups(CCGetGroupID(), "2");
$this->UpdateAllowed = CCUserInGroups(CCGetGroupID(), "2");
$this->DeleteAllowed = CCUserInGroups(CCGetGroupID(), "2");
$this->ComponentName = "support";
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $this->ComponentName);
$CCSForm = CCGetFromGet("ccsForm", "");
$this->FormSubmitted = ($CCSForm == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->support_ticket_number = new clsControl(ccsTextBox, "support_ticket_number", " Ticket_number", ccsText, "", CCGetRequestParam("support_ticket_number", $Method));
$this->support_assigned_to = new clsControl(ccsTextBox, "support_assigned_to", " Assigned_to", ccsInteger, "", CCGetRequestParam("support_assigned_to", $Method));
$this->support_issue = new clsControl(ccsTextArea, "support_issue", " Issue", ccsMemo, "", CCGetRequestParam("support_issue", $Method));
$this->support_resolution = new clsControl(ccsTextArea, "support_resolution", " Resolution", ccsMemo, "", CCGetRequestParam("support_resolution", $Method));
$this->support_link_to_issue = new clsControl(ccsTextBox, "support_link_to_issue", " Link_to_issue", ccsInteger, "", CCGetRequestParam("support_link_to_issue", $Method));
$this->support_customer_name = new clsControl(ccsTextArea, "support_customer_name", " Customer_name", ccsMemo, "", CCGetRequestParam("support_customer_name", $Method));
$this->support_customer_email = new clsControl(ccsTextArea, "support_customer_email", " Customer_email", ccsMemo, "", CCGetRequestParam("support_customer_email", $Method));
$this->support_opened_datetime = new clsControl(ccsTextBox, "support_opened_datetime", " Opened_datetime", ccsDate, Array("GeneralDate"), CCGetRequestParam("support_opened_datetime", $Method));
$this->support_closed_datetime = new clsControl(ccsTextBox, "support_closed_datetime", " Closed_datetime", ccsDate, Array("GeneralDate"), CCGetRequestParam("support_closed_datetime", $Method));
$this->support_status = new clsControl(ccsTextBox, "support_status", " Status", ccsInteger, "", CCGetRequestParam("support_status", $Method));
$this->Insert = new clsButton("Insert");
$this->Update = new clsButton("Update");
$this->Delete = new clsButton("Delete");
}
}
//End Class_Initialize Event
//Initialize Method @2-BA0C79CA
function Initialize()
{
if(!$this->Visible)
return;
$this->ds->Parameters["urlsupport_id"] = CCGetFromGet("support_id", "");
}
//End Initialize Method
//Validate Method @2-61ED3A0C
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->support_ticket_number->Validate() && $Validation);
$Validation = ($this->support_assigned_to->Validate() && $Validation);
$Validation = ($this->support_issue->Validate() && $Validation);
$Validation = ($this->support_resolution->Validate() && $Validation);
$Validation = ($this->support_link_to_issue->Validate() && $Validation);
$Validation = ($this->support_customer_name->Validate() && $Validation);
$Validation = ($this->support_customer_email->Validate() && $Validation);
$Validation = ($this->support_opened_datetime->Validate() && $Validation);
$Validation = ($this->support_closed_datetime->Validate() && $Validation);
$Validation = ($this->support_status->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//Operation Method @2-BCBE0352
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->ds->Prepare();
$this->EditMode = $this->ds->AllParametersSet;
if(!$this->FormSubmitted)
return;
if($this->FormSubmitted) {
$this->PressedButton = $this->EditMode ? "Update" : "Insert";
if(strlen(CCGetParam("Insert", ""))) {
$this->PressedButton = "Insert";
} else if(strlen(CCGetParam("Update", ""))) {
$this->PressedButton = "Update";
} else if(strlen(CCGetParam("Delete", ""))) {
$this->PressedButton = "Delete";
}
}
$Redirect = "support_list.php?" . CCGetQueryString("QueryString", Array("Insert","Update","Delete","ccsForm"));
if($this->PressedButton == "Delete" && $this->DeleteAllowed) {
if(!CCGetEvent($this->Delete->CCSEvents, "OnClick") || !$this->DeleteRow()) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Insert" && $this->InsertAllowed) {
if(!CCGetEvent($this->Insert->CCSEvents, "OnClick") || !$this->InsertRow()) {
$Redirect = "";
}
} else if($this->PressedButton == "Update" && $this->UpdateAllowed) {
if(!CCGetEvent($this->Update->CCSEvents, "OnClick") || !$this->UpdateRow()) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//InsertRow Method @2-F188CCCA
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->support_ticket_number->SetValue($this->support_ticket_number->GetValue());
$this->ds->support_assigned_to->SetValue($this->support_assigned_to->GetValue());
$this->ds->support_issue->SetValue($this->support_issue->GetValue());
$this->ds->support_resolution->SetValue($this->support_resolution->GetValue());
$this->ds->support_link_to_issue->SetValue($this->support_link_to_issue->GetValue());
$this->ds->support_customer_name->SetValue($this->support_customer_name->GetValue());
$this->ds->support_customer_email->SetValue($this->support_customer_email->GetValue());
$this->ds->support_opened_datetime->SetValue($this->support_opened_datetime->GetValue());
$this->ds->support_closed_datetime->SetValue($this->support_closed_datetime->GetValue());
$this->ds->support_status->SetValue($this->support_status->GetValue());
$this->ds->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
if($this->ds->Errors->Count() > 0)
{
echo "Error in Record " . $this->ComponentName . " / Insert Operation";
$this->ds->Errors->Clear();
$this->Errors->AddError("Database command error.");
}
return ($this->Errors->Count() == 0);
}
//End InsertRow Method
//UpdateRow Method @2-73476185
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->support_ticket_number->SetValue($this->support_ticket_number->GetValue());
$this->ds->support_assigned_to->SetValue($this->support_assigned_to->GetValue());
$this->ds->support_issue->SetValue($this->support_issue->GetValue());
$this->ds->support_resolution->SetValue($this->support_resolution->GetValue());
$this->ds->support_link_to_issue->SetValue($this->support_link_to_issue->GetValue());
$this->ds->support_customer_name->SetValue($this->support_customer_name->GetValue());
$this->ds->support_customer_email->SetValue($this->support_customer_email->GetValue());
$this->ds->support_opened_datetime->SetValue($this->support_opened_datetime->GetValue());
$this->ds->support_closed_datetime->SetValue($this->support_closed_datetime->GetValue());
$this->ds->support_status->SetValue($this->support_status->GetValue());
$this->ds->Update();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate");
if($this->ds->Errors->Count() > 0)
{
echo "Error in Record " . $this->ComponentName . " / Update Operation";
$this->ds->Errors->Clear();
$this->Errors->AddError("Database command error.");
}
return ($this->Errors->Count() == 0);
}
//End UpdateRow Method
//DeleteRow Method @2-6A43D177
function DeleteRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete");
if(!$this->DeleteAllowed) return false;
$this->ds->Delete();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete");
if($this->ds->Errors->Count())
{
echo "Error in Record " . ComponentName . " / Delete Operation";
$this->ds->Errors->Clear();
$this->Errors->AddError("Database command error.");
}
return ($this->Errors->Count() == 0);
}
//End DeleteRow Method
//Show Method @2-DFA543FE
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->ds->open();
$RecordBlock = "Record " . $this->ComponentName;
$Tpl->block_path = $RecordBlock;
if($this->EditMode && $this->ReadAllowed)
{
if($this->Errors->Count() == 0)
{
if($this->ds->Errors->Count() > 0)
{
echo "Error in Record support";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->support_ticket_number->SetValue($this->ds->support_ticket_number->GetValue());
$this->support_assigned_to->SetValue($this->ds->support_assigned_to->GetValue());
$this->support_issue->SetValue($this->ds->support_issue->GetValue());
$this->support_resolution->SetValue($this->ds->support_resolution->GetValue());
$this->support_link_to_issue->SetValue($this->ds->support_link_to_issue->GetValue());
$this->support_customer_name->SetValue($this->ds->support_customer_name->GetValue());
$this->support_customer_email->SetValue($this->ds->support_customer_email->GetValue());
$this->support_opened_datetime->SetValue($this->ds->support_opened_datetime->GetValue());
$this->support_closed_datetime->SetValue($this->ds->support_closed_datetime->GetValue());
$this->support_status->SetValue($this->ds->support_status->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted) {
$Error .= $this->support_ticket_number->Errors->ToString();
$Error .= $this->support_assigned_to->Errors->ToString();
$Error .= $this->support_issue->Errors->ToString();
$Error .= $this->support_resolution->Errors->ToString();
$Error .= $this->support_link_to_issue->Errors->ToString();
$Error .= $this->support_customer_name->Errors->ToString();
$Error .= $this->support_customer_email->Errors->ToString();
$Error .= $this->support_opened_datetime->Errors->ToString();
$Error .= $this->support_closed_datetime->Errors->ToString();
$Error .= $this->support_status->Errors->ToString();
$Error .= $this->Errors->ToString();
$Error .= $this->ds->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$Tpl->SetVar("Action", $this->HTMLFormAction);
$this->Insert->Visible = !$this->EditMode && $this->InsertAllowed;
$this->Update->Visible = $this->EditMode && $this->UpdateAllowed;
$this->Delete->Visible = $this->EditMode && $this->DeleteAllowed;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
$this->support_ticket_number->Show();
$this->support_assigned_to->Show();
$this->support_issue->Show();
$this->support_resolution->Show();
$this->support_link_to_issue->Show();
$this->support_customer_name->Show();
$this->support_customer_email->Show();
$this->support_opened_datetime->Show();
$this->support_closed_datetime->Show();
$this->support_status->Show();
$this->Insert->Show();
$this->Update->Show();
$this->Delete->Show();
$Tpl->parse("", false);
$Tpl->block_path = "";
}
//End Show Method
} //End support Class @2-FCB6E20C
class clssupportDataSource extends clsDBBJSS { //supportDataSource Class @2-14CF4EED
//DataSource Variables @2-70F4D2FA
var $CCSEvents = "";
var $CCSEventResult;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $support_ticket_number;
var $support_assigned_to;
var $support_issue;
var $support_resolution;
var $support_link_to_issue;
var $support_customer_name;
var $support_customer_email;
var $support_opened_datetime;
var $support_closed_datetime;
var $support_status;
//End DataSource Variables
//Class_Initialize Event @2-4042318E
function clssupportDataSource()
{
$this->Initialize();
$this->support_ticket_number = new clsField("support_ticket_number", ccsText, "");
$this->support_assigned_to = new clsField("support_assigned_to", ccsInteger, "");
$this->support_issue = new clsField("support_issue", ccsMemo, "");
$this->support_resolution = new clsField("support_resolution", ccsMemo, "");
$this->support_link_to_issue = new clsField("support_link_to_issue", ccsInteger, "");
$this->support_customer_name = new clsField("support_customer_name", ccsMemo, "");
$this->support_customer_email = new clsField("support_customer_email", ccsMemo, "");
$this->support_opened_datetime = new clsField("support_opened_datetime", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->support_closed_datetime = new clsField("support_closed_datetime", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->support_status = new clsField("support_status", ccsInteger, "");
}
//End Class_Initialize Event
//Prepare Method @2-8E9B2AEF
function Prepare()
{
$this->wp = new clsSQLParameters();
$this->wp->AddParameter("1", "urlsupport_id", ccsInteger, "", "", $this->Parameters["urlsupport_id"], "");
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "`support_id`", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger));
$this->Where = $this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-569EFE12
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM support";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
$this->MoveToPage($this->AbsolutePage);
}
//End Open Method
//SetValues Method @2-93D53C54
function SetValues()
{
$this->support_ticket_number->SetDBValue($this->f("support_ticket_number"));
$this->support_assigned_to->SetDBValue($this->f("support_assigned_to"));
$this->support_issue->SetDBValue($this->f("support_issue"));
$this->support_resolution->SetDBValue($this->f("support_resolution"));
$this->support_link_to_issue->SetDBValue($this->f("support_link_to_issue"));
$this->support_customer_name->SetDBValue($this->f("support_customer_name"));
$this->support_customer_email->SetDBValue($this->f("support_customer_email"));
$this->support_opened_datetime->SetDBValue($this->f("support_opened_datetime"));
$this->support_closed_datetime->SetDBValue($this->f("support_closed_datetime"));
$this->support_status->SetDBValue($this->f("support_status"));
}
//End SetValues Method
//Insert Method @2-D347A0E7
function Insert()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$SQL = "INSERT INTO `support` ("
. "`support_ticket_number`, "
. "`support_assigned_to`, "
. "`support_issue`, "
. "`support_resolution`, "
. "`support_link_to_issue`, "
. "`support_customer_name`, "
. "`support_customer_email`, "
. "`support_opened_datetime`, "
. "`support_closed_datetime`, "
. "`support_status`"
. ") VALUES ("
. $this->ToSQL($this->support_ticket_number->GetDBValue(), $this->support_ticket_number->DataType) . ", "
. $this->ToSQL($this->support_assigned_to->GetDBValue(), $this->support_assigned_to->DataType) . ", "
. $this->ToSQL($this->support_issue->GetDBValue(), $this->support_issue->DataType) . ", "
. $this->ToSQL($this->support_resolution->GetDBValue(), $this->support_resolution->DataType) . ", "
. $this->ToSQL($this->support_link_to_issue->GetDBValue(), $this->support_link_to_issue->DataType) . ", "
. $this->ToSQL($this->support_customer_name->GetDBValue(), $this->support_customer_name->DataType) . ", "
. $this->ToSQL($this->support_customer_email->GetDBValue(), $this->support_customer_email->DataType) . ", "
. $this->ToSQL($this->support_opened_datetime->GetDBValue(), $this->support_opened_datetime->DataType) . ", "
. $this->ToSQL($this->support_closed_datetime->GetDBValue(), $this->support_closed_datetime->DataType) . ", "
. $this->ToSQL($this->support_status->GetDBValue(), $this->support_status->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert");
$this->query($SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
}
//End Insert Method
//Update Method @2-196276D8
function Update()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$SQL = "UPDATE `support` SET "
. "`support_ticket_number`=" . $this->ToSQL($this->support_ticket_number->GetDBValue(), $this->support_ticket_number->DataType) . ", "
. "`support_assigned_to`=" . $this->ToSQL($this->support_assigned_to->GetDBValue(), $this->support_assigned_to->DataType) . ", "
. "`support_issue`=" . $this->ToSQL($this->support_issue->GetDBValue(), $this->support_issue->DataType) . ", "
. "`support_resolution`=" . $this->ToSQL($this->support_resolution->GetDBValue(), $this->support_resolution->DataType) . ", "
. "`support_link_to_issue`=" . $this->ToSQL($this->support_link_to_issue->GetDBValue(), $this->support_link_to_issue->DataType) . ", "
. "`support_customer_name`=" . $this->ToSQL($this->support_customer_name->GetDBValue(), $this->support_customer_name->DataType) . ", "
. "`support_customer_email`=" . $this->ToSQL($this->support_customer_email->GetDBValue(), $this->support_customer_email->DataType) . ", "
. "`support_opened_datetime`=" . $this->ToSQL($this->support_opened_datetime->GetDBValue(), $this->support_opened_datetime->DataType) . ", "
. "`support_closed_datetime`=" . $this->ToSQL($this->support_closed_datetime->GetDBValue(), $this->support_closed_datetime->DataType) . ", "
. "`support_status`=" . $this->ToSQL($this->support_status->GetDBValue(), $this->support_status->DataType);
$SQL = CCBuildSQL($SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
$this->query($SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
}
//End Update Method
//Delete Method @2-244B117D
function Delete()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$SQL = "DELETE FROM `support` WHERE " . $this->Where;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete");
$this->query($SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
}
//End Delete Method
} //End supportDataSource Class @2-FCB6E20C
//Include Page implementation @19-353B2997
include("./Footer.php");
//End Include Page implementation
//Initialize Page @1-DFE04C65
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "support_maint.php";
$Redirect = "";
$TemplateFileName = "support_maint.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-45814D90
CCSecurityRedirect("2", "", $FileName, CCGetQueryString("QueryString", ""));
//End Authenticate User
//Initialize Objects @1-E5DE126A
$DBBJSS = new clsDBBJSS();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$support = new clsRecordsupport();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$support->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
//End Initialize Objects
//Execute Components @1-2DBEA46F
$Header->Operations();
$support->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-BEB91355
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
header("Location: " . $Redirect);
exit;
}
//End Go to destination page
//Initialize HTML Template @1-A0111C9D
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView");
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main");
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow");
//End Initialize HTML Template
//Show Page @1-52F0EA4C
$Header->Show("Header");
$support->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-AB7622EF
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
unset($Tpl);
//End Unload Page
?>