Viewing file: baneri_maint.php (18.64 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?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-39DC296A
include_once("./Header.php");
//End Include Page implementation
class clsRecordbaneri { //baneri Class @2-E70C9F5C
//Variables @2-5C5E2D83
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $ds;
var $EditMode;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-F97424FE
function clsRecordbaneri()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record baneri/Error";
$this->ds = new clsbaneriDataSource();
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "baneri";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->description = new clsControl(ccsTextBox, "description", "Description", ccsText, "", CCGetRequestParam("description", $Method));
$this->bin_data = new clsControl(ccsTextArea, "bin_data", "Bin Data", ccsMemo, "", CCGetRequestParam("bin_data", $Method));
$this->filename = new clsControl(ccsTextBox, "filename", "Filename", ccsText, "", CCGetRequestParam("filename", $Method));
$this->filesize = new clsControl(ccsTextBox, "filesize", "Filesize", ccsText, "", CCGetRequestParam("filesize", $Method));
$this->filetype = new clsControl(ccsTextBox, "filetype", "Filetype", ccsText, "", CCGetRequestParam("filetype", $Method));
$this->Button_Insert = new clsButton("Button_Insert");
$this->Button_Update = new clsButton("Button_Update");
$this->Button_Delete = new clsButton("Button_Delete");
}
}
//End Class_Initialize Event
//Initialize Method @2-F98A764E
function Initialize()
{
if(!$this->Visible)
return;
$this->ds->Parameters["urlid"] = CCGetFromGet("id", "");
}
//End Initialize Method
//Validate Method @2-9051710F
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->description->Validate() && $Validation);
$Validation = ($this->bin_data->Validate() && $Validation);
$Validation = ($this->filename->Validate() && $Validation);
$Validation = ($this->filesize->Validate() && $Validation);
$Validation = ($this->filetype->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-537A2687
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->description->Errors->Count());
$errors = ($errors || $this->bin_data->Errors->Count());
$errors = ($errors || $this->filename->Errors->Count());
$errors = ($errors || $this->filesize->Errors->Count());
$errors = ($errors || $this->filetype->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-F19192A8
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 ? "Button_Update" : "Button_Insert";
if(strlen(CCGetParam("Button_Insert", ""))) {
$this->PressedButton = "Button_Insert";
} else if(strlen(CCGetParam("Button_Update", ""))) {
$this->PressedButton = "Button_Update";
} else if(strlen(CCGetParam("Button_Delete", ""))) {
$this->PressedButton = "Button_Delete";
}
}
$Redirect = "baneri_list.php" . "?" . CCGetQueryString("QueryString", Array("ccsForm"));
if($this->PressedButton == "Button_Delete") {
if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick") || !$this->DeleteRow()) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Button_Insert") {
if(!CCGetEvent($this->Button_Insert->CCSEvents, "OnClick") || !$this->InsertRow()) {
$Redirect = "";
}
} else if($this->PressedButton == "Button_Update") {
if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick") || !$this->UpdateRow()) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//InsertRow Method @2-8A1411F8
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->description->SetValue($this->description->GetValue());
$this->ds->bin_data->SetValue($this->bin_data->GetValue());
$this->ds->filename->SetValue($this->filename->GetValue());
$this->ds->filesize->SetValue($this->filesize->GetValue());
$this->ds->filetype->SetValue($this->filetype->GetValue());
$this->ds->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-F1220244
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->description->SetValue($this->description->GetValue());
$this->ds->bin_data->SetValue($this->bin_data->GetValue());
$this->ds->filename->SetValue($this->filename->GetValue());
$this->ds->filesize->SetValue($this->filesize->GetValue());
$this->ds->filetype->SetValue($this->filetype->GetValue());
$this->ds->Update();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate");
return (!$this->CheckErrors());
}
//End UpdateRow Method
//DeleteRow Method @2-91867A4A
function DeleteRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete");
if(!$this->DeleteAllowed) return false;
$this->ds->Delete();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete");
return (!$this->CheckErrors());
}
//End DeleteRow Method
//Show Method @2-09E9FF04
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if($this->EditMode)
{
$this->ds->open();
if($this->Errors->Count() == 0)
{
if($this->ds->Errors->Count() > 0)
{
echo "Error in Record baneri";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->description->SetValue($this->ds->description->GetValue());
$this->bin_data->SetValue($this->ds->bin_data->GetValue());
$this->filename->SetValue($this->ds->filename->GetValue());
$this->filesize->SetValue($this->ds->filesize->GetValue());
$this->filetype->SetValue($this->ds->filetype->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->description->Errors->ToString();
$Error .= $this->bin_data->Errors->ToString();
$Error .= $this->filename->Errors->ToString();
$Error .= $this->filesize->Errors->ToString();
$Error .= $this->filetype->Errors->ToString();
$Error .= $this->Errors->ToString();
$Error .= $this->ds->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
$Tpl->SetVar("Action", $this->HTMLFormAction);
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->Button_Insert->Visible = !$this->EditMode && $this->InsertAllowed;
$this->Button_Update->Visible = $this->EditMode && $this->UpdateAllowed;
$this->Button_Delete->Visible = $this->EditMode && $this->DeleteAllowed;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->description->Show();
$this->bin_data->Show();
$this->filename->Show();
$this->filesize->Show();
$this->filetype->Show();
$this->Button_Insert->Show();
$this->Button_Update->Show();
$this->Button_Delete->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
} //End baneri Class @2-FCB6E20C
class clsbaneriDataSource extends clsDBConnection1 { //baneriDataSource Class @2-DB884AD9
//DataSource Variables @2-02FD4A72
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $BlockExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $description;
var $bin_data;
var $filename;
var $filesize;
var $filetype;
//End DataSource Variables
//Class_Initialize Event @2-3658DC71
function clsbaneriDataSource()
{
$this->ErrorBlock = "Record baneri/Error";
$this->Initialize();
$this->description = new clsField("description", ccsText, "");
$this->bin_data = new clsField("bin_data", ccsMemo, "");
$this->filename = new clsField("filename", ccsText, "");
$this->filesize = new clsField("filesize", ccsText, "");
$this->filetype = new clsField("filetype", ccsText, "");
}
//End Class_Initialize Event
//Prepare Method @2-1A2D9971
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlid", ccsInteger, "", "", $this->Parameters["urlid"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "id", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where = $this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-26A89C17
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM baneri";
$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-38E4FB3C
function SetValues()
{
$this->description->SetDBValue($this->f("description"));
$this->bin_data->SetDBValue($this->f("bin_data"));
$this->filename->SetDBValue($this->f("filename"));
$this->filesize->SetDBValue($this->f("filesize"));
$this->filetype->SetDBValue($this->f("filetype"));
}
//End SetValues Method
//Insert Method @2-3A4EBA62
function Insert()
{
$this->BlockExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO baneri ("
. "description, "
. "bin_data, "
. "filename, "
. "filesize, "
. "filetype"
. ") VALUES ("
. $this->ToSQL($this->description->GetDBValue(), $this->description->DataType) . ", "
. $this->ToSQL($this->bin_data->GetDBValue(), $this->bin_data->DataType) . ", "
. $this->ToSQL($this->filename->GetDBValue(), $this->filename->DataType) . ", "
. $this->ToSQL($this->filesize->GetDBValue(), $this->filesize->DataType) . ", "
. $this->ToSQL($this->filetype->GetDBValue(), $this->filetype->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert");
if($this->Errors->Count() == 0 && $this->BlockExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert");
}
$this->close();
}
//End Insert Method
//Update Method @2-0A48866E
function Update()
{
$this->BlockExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->SQL = "UPDATE baneri SET "
. "description=" . $this->ToSQL($this->description->GetDBValue(), $this->description->DataType) . ", "
. "bin_data=" . $this->ToSQL($this->bin_data->GetDBValue(), $this->bin_data->DataType) . ", "
. "filename=" . $this->ToSQL($this->filename->GetDBValue(), $this->filename->DataType) . ", "
. "filesize=" . $this->ToSQL($this->filesize->GetDBValue(), $this->filesize->DataType) . ", "
. "filetype=" . $this->ToSQL($this->filetype->GetDBValue(), $this->filetype->DataType);
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
if($this->Errors->Count() == 0 && $this->BlockExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
}
$this->close();
}
//End Update Method
//Delete Method @2-0CC19144
function Delete()
{
$this->BlockExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->SQL = "DELETE FROM baneri";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete");
if($this->Errors->Count() == 0 && $this->BlockExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete");
}
$this->close();
}
//End Delete Method
} //End baneriDataSource Class @2-FCB6E20C
//Include Page implementation @14-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-E685AA48
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "baneri_maint.php";
$Redirect = "";
$TemplateFileName = "baneri_maint.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-FD2199FB
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$baneri = new clsRecordbaneri();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$baneri->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
if($Charset) {
header("Content-Type: text/html; charset=" . $Charset);
}
//End Initialize Objects
//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
//Execute Components @1-95BFF50E
$Header->Operations();
$baneri->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-6F9FD7CC
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
exit;
}
//End Go to destination page
//Show Page @1-741711C2
$Header->Show("Header");
$baneri->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-A4D34ABE
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
unset($Tpl);
//End Unload Page
?>
|