Location: PHPKode > projects > Bug Jr. Support System > dist/issues_maint.php
<?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 @13-503267A8
include("./Header.php");
//End Include Page implementation

Class clsRecordissues { //issues Class @2-5DF0066C

//Variables @2-D65AB00C

    // 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 $ds;
    var $EditMode;
    var $ValidatingControls;
    var $Controls;

    // Class variables
//End Variables

//Class_Initialize Event @2-D8AA5501
    function clsRecordissues()
    {

        global $FileName;
        $this->Visible = true;
        $this->Errors = new clsErrors();
        $this->ds = new clsissuesDataSource();
        $this->InsertAllowed = true;
        $this->UpdateAllowed = true;
        $this->DeleteAllowed = true;
        if($this->Visible)
        {
            $this->ComponentName = "issues";
            $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $this->ComponentName);
            $CCSForm = CCGetFromGet("ccsForm", "");
            $this->FormSubmitted = ($CCSForm == $this->ComponentName);
            $Method = $this->FormSubmitted ? ccsPost : ccsGet;
            $this->issue_title = new clsControl(ccsTextArea, "issue_title", " Title", ccsMemo, "", CCGetRequestParam("issue_title", $Method));
            $this->issue_symptoms = new clsControl(ccsTextArea, "issue_symptoms", " Symptoms", ccsMemo, "", CCGetRequestParam("issue_symptoms", $Method));
            $this->issue_problem = new clsControl(ccsTextArea, "issue_problem", " Problem", ccsMemo, "", CCGetRequestParam("issue_problem", $Method));
            $this->issue_solution = new clsControl(ccsTextArea, "issue_solution", " Solution", ccsMemo, "", CCGetRequestParam("issue_solution", $Method));
            $this->issue_employee_id = new clsControl(ccsHidden, "issue_employee_id", " Employee_id", ccsInteger, "", CCGetRequestParam("issue_employee_id", $Method));
            $this->Insert = new clsButton("Insert");
            $this->Update = new clsButton("Update");
            $this->Delete = new clsButton("Delete");
        }
    }
//End Class_Initialize Event

//Initialize Method @2-1F39AD86
    function Initialize()
    {

        if(!$this->Visible)
            return;

        $this->ds->Parameters["urlissue_id"] = CCGetFromGet("issue_id", "");
    }
//End Initialize Method

//Validate Method @2-0B455E55
    function Validate()
    {
        $Validation = true;
        $Where = "";
        $Validation = ($this->issue_title->Validate() && $Validation);
        $Validation = ($this->issue_symptoms->Validate() && $Validation);
        $Validation = ($this->issue_problem->Validate() && $Validation);
        $Validation = ($this->issue_solution->Validate() && $Validation);
        $Validation = ($this->issue_employee_id->Validate() && $Validation);
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
        return (($this->Errors->Count() == 0) && $Validation);
    }
//End Validate Method

//Operation Method @2-0CC1BB2C
    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 = "issues_list.php?" . CCGetQueryString("QueryString", Array("Insert","Update","Delete","ccsForm"));
        if($this->PressedButton == "Delete") {
            if(!CCGetEvent($this->Delete->CCSEvents, "OnClick") || !$this->DeleteRow()) {
                $Redirect = "";
            }
        } else if($this->Validate()) {
            if($this->PressedButton == "Insert") {
                if(!CCGetEvent($this->Insert->CCSEvents, "OnClick") || !$this->InsertRow()) {
                    $Redirect = "";
                }
            } else if($this->PressedButton == "Update") {
                if(!CCGetEvent($this->Update->CCSEvents, "OnClick") || !$this->UpdateRow()) {
                    $Redirect = "";
                }
            }
        } else {
            $Redirect = "";
        }
    }
//End Operation Method

//InsertRow Method @2-7A5AE49C
    function InsertRow()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
        if(!$this->InsertAllowed) return false;
        $this->ds->issue_title->SetValue($this->issue_title->GetValue());
        $this->ds->issue_symptoms->SetValue($this->issue_symptoms->GetValue());
        $this->ds->issue_problem->SetValue($this->issue_problem->GetValue());
        $this->ds->issue_solution->SetValue($this->issue_solution->GetValue());
        $this->ds->issue_employee_id->SetValue($this->issue_employee_id->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-D54865FF
    function UpdateRow()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
        if(!$this->UpdateAllowed) return false;
        $this->ds->issue_title->SetValue($this->issue_title->GetValue());
        $this->ds->issue_symptoms->SetValue($this->issue_symptoms->GetValue());
        $this->ds->issue_problem->SetValue($this->issue_problem->GetValue());
        $this->ds->issue_solution->SetValue($this->issue_solution->GetValue());
        $this->ds->issue_employee_id->SetValue($this->issue_employee_id->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-1A8FA1FB
    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)
        {
            if($this->Errors->Count() == 0)
            {
                if($this->ds->Errors->Count() > 0)
                {
                    echo "Error in Record issues";
                }
                else if($this->ds->next_record())
                {
                    $this->ds->SetValues();
                    if(!$this->FormSubmitted)
                    {
                        $this->issue_title->SetValue($this->ds->issue_title->GetValue());
                        $this->issue_symptoms->SetValue($this->ds->issue_symptoms->GetValue());
                        $this->issue_problem->SetValue($this->ds->issue_problem->GetValue());
                        $this->issue_solution->SetValue($this->ds->issue_solution->GetValue());
                        $this->issue_employee_id->SetValue($this->ds->issue_employee_id->GetValue());
                    }
                }
                else
                {
                    $this->EditMode = false;
                }
            }
        }
        if(!$this->FormSubmitted)
        {
        }

        if($this->FormSubmitted) {
            $Error .= $this->issue_title->Errors->ToString();
            $Error .= $this->issue_symptoms->Errors->ToString();
            $Error .= $this->issue_problem->Errors->ToString();
            $Error .= $this->issue_solution->Errors->ToString();
            $Error .= $this->issue_employee_id->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->Update->Visible = $this->EditMode;
        $this->Delete->Visible = $this->EditMode;
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
        $this->issue_title->Show();
        $this->issue_symptoms->Show();
        $this->issue_problem->Show();
        $this->issue_solution->Show();
        $this->issue_employee_id->Show();
        $this->Insert->Show();
        $this->Update->Show();
        $this->Delete->Show();
        $Tpl->parse("", false);
        $Tpl->block_path = "";
    }
//End Show Method

} //End issues Class @2-FCB6E20C

class clsissuesDataSource extends clsDBBJSS {  //issuesDataSource Class @2-83C9B2BC

//DataSource Variables @2-776F5AA3
    var $CCSEvents = "";
    var $CCSEventResult;

    var $InsertParameters;
    var $UpdateParameters;
    var $DeleteParameters;
    var $wp;
    var $AllParametersSet;

    // Datasource fields
    var $issue_title;
    var $issue_symptoms;
    var $issue_problem;
    var $issue_solution;
    var $issue_employee_id;
//End DataSource Variables

//Class_Initialize Event @2-2434E5E3
    function clsissuesDataSource()
    {
        $this->Initialize();
        $this->issue_title = new clsField("issue_title", ccsMemo, "");
        $this->issue_symptoms = new clsField("issue_symptoms", ccsMemo, "");
        $this->issue_problem = new clsField("issue_problem", ccsMemo, "");
        $this->issue_solution = new clsField("issue_solution", ccsMemo, "");
        $this->issue_employee_id = new clsField("issue_employee_id", ccsInteger, "");

    }
//End Class_Initialize Event

//Prepare Method @2-7AE3DFB0
    function Prepare()
    {
        $this->wp = new clsSQLParameters();
        $this->wp->AddParameter("1", "urlissue_id", ccsInteger, "", "", $this->Parameters["urlissue_id"], "");
        $this->AllParametersSet = $this->wp->AllParamsSet();
        $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "`issue_id`", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger));
        $this->Where = $this->wp->Criterion[1];
    }
//End Prepare Method

//Open Method @2-B18C9115
    function Open()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
        $this->SQL = "SELECT *  " .
        "FROM issues";
        $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-247C36F7
    function SetValues()
    {
        $this->issue_title->SetDBValue($this->f("issue_title"));
        $this->issue_symptoms->SetDBValue($this->f("issue_symptoms"));
        $this->issue_problem->SetDBValue($this->f("issue_problem"));
        $this->issue_solution->SetDBValue($this->f("issue_solution"));
        $this->issue_employee_id->SetDBValue($this->f("issue_employee_id"));
    }
//End SetValues Method

//Insert Method @2-4BFCB08C
    function Insert()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
        $SQL = "INSERT INTO `issues` ("
             . "`issue_title`, "
             . "`issue_symptoms`, "
             . "`issue_problem`, "
             . "`issue_solution`, "
             . "`issue_employee_id`"
             . ") VALUES ("
             . $this->ToSQL($this->issue_title->GetDBValue(), $this->issue_title->DataType) . ", "
             . $this->ToSQL($this->issue_symptoms->GetDBValue(), $this->issue_symptoms->DataType) . ", "
             . $this->ToSQL($this->issue_problem->GetDBValue(), $this->issue_problem->DataType) . ", "
             . $this->ToSQL($this->issue_solution->GetDBValue(), $this->issue_solution->DataType) . ", "
             . $this->ToSQL($this->issue_employee_id->GetDBValue(), $this->issue_employee_id->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-ED1251A0
    function Update()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
        $SQL = "UPDATE `issues` SET "
             . "`issue_title`=" . $this->ToSQL($this->issue_title->GetDBValue(), $this->issue_title->DataType) . ", "
             . "`issue_symptoms`=" . $this->ToSQL($this->issue_symptoms->GetDBValue(), $this->issue_symptoms->DataType) . ", "
             . "`issue_problem`=" . $this->ToSQL($this->issue_problem->GetDBValue(), $this->issue_problem->DataType) . ", "
             . "`issue_solution`=" . $this->ToSQL($this->issue_solution->GetDBValue(), $this->issue_solution->DataType) . ", "
             . "`issue_employee_id`=" . $this->ToSQL($this->issue_employee_id->GetDBValue(), $this->issue_employee_id->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-1D323DB1
    function Delete()
    {
        $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
        $SQL = "DELETE FROM `issues` 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 issuesDataSource Class @2-FCB6E20C

//Include Page implementation @14-353B2997
include("./Footer.php");
//End Include Page implementation

//Initialize Page @1-28506A37
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";

// Events;
$CCSEvents = "";
$CCSEventResult = "";

$FileName = "issues_maint.php";
$Redirect = "";
$TemplateFileName = "issues_maint.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page

//Authenticate User @1-45814D90
CCSecurityRedirect("2", "", $FileName, CCGetQueryString("QueryString", ""));
//End Authenticate User

//Initialize Objects @1-43759A4D
$DBBJSS = new clsDBBJSS();

// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$issues = new clsRecordissues();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$issues->Initialize();

// Events
include("./issues_maint_events.php");
BindEvents();

$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
//End Initialize Objects

//Execute Components @1-F0B67EA3
$Header->Operations();
$issues->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-C0FF38A3
$Header->Show("Header");
$issues->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page

//Unload Page @1-AB7622EF
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
unset($Tpl);
//End Unload Page



?>
Return current item: Bug Jr. Support System