Viewing file: rubrike_maint.php (21.97 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 @14-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
//Include Page implementation @20-9090FF7A
include_once(RelativePath . "/Header1.php");
//End Include Page implementation
class clsRecordrubrike { //rubrike Class @2-6D1A6F49
//Variables @2-B2F7A83E
// 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 $EditMode = false;
var $ds;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-B82518FD
function clsRecordrubrike()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record rubrike/Error";
$this->ds = new clsrubrikeDataSource();
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "rubrike";
$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->nazivrubr = new clsControl(ccsTextBox, "nazivrubr", "Nazivrubr", ccsMemo, "", CCGetRequestParam("nazivrubr", $Method));
$this->nazivrubr->Required = true;
$this->pripada = new clsControl(ccsListBox, "pripada", "Pripada", ccsInteger, "", CCGetRequestParam("pripada", $Method));
$this->pripada->DSType = dsTable;
list($this->pripada->BoundColumn, $this->pripada->TextColumn, $this->pripada->DBFormat) = array("idrubrike", "nazivrubr", "");
$this->pripada->ds = new clsDBConnection1();
$this->pripada->ds->SQL = "SELECT * " .
"FROM rubrike";
$this->CheckBox1 = new clsControl(ccsCheckBox, "CheckBox1", "CheckBox1", ccsInteger, "", CCGetRequestParam("CheckBox1", $Method));
$this->CheckBox1->CheckedValue = $this->CheckBox1->GetParsedValue(1);
$this->CheckBox1->UncheckedValue = $this->CheckBox1->GetParsedValue(0);
$this->CheckBox2 = new clsControl(ccsCheckBox, "CheckBox2", "CheckBox2", ccsInteger, "", CCGetRequestParam("CheckBox2", $Method));
$this->CheckBox2->CheckedValue = $this->CheckBox2->GetParsedValue(2);
$this->CheckBox2->UncheckedValue = $this->CheckBox2->GetParsedValue(0);
$this->CheckBox4 = new clsControl(ccsCheckBox, "CheckBox4", "CheckBox4", ccsInteger, "", CCGetRequestParam("CheckBox4", $Method));
$this->CheckBox4->CheckedValue = $this->CheckBox4->GetParsedValue(1);
$this->CheckBox4->UncheckedValue = $this->CheckBox4->GetParsedValue(0);
$this->CheckBox3 = new clsControl(ccsCheckBox, "CheckBox3", "CheckBox3", ccsInteger, "", CCGetRequestParam("CheckBox3", $Method));
$this->CheckBox3->CheckedValue = $this->CheckBox3->GetParsedValue(1);
$this->CheckBox3->UncheckedValue = $this->CheckBox3->GetParsedValue(0);
$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-77EBFDFB
function Initialize()
{
if(!$this->Visible)
return;
$this->ds->Parameters["urlidrubrike"] = CCGetFromGet("idrubrike", "");
}
//End Initialize Method
//Validate Method @2-248E94DB
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->nazivrubr->Validate() && $Validation);
$Validation = ($this->pripada->Validate() && $Validation);
$Validation = ($this->CheckBox1->Validate() && $Validation);
$Validation = ($this->CheckBox2->Validate() && $Validation);
$Validation = ($this->CheckBox4->Validate() && $Validation);
$Validation = ($this->CheckBox3->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
$Validation = $Validation && ($this->nazivrubr->Errors->Count() == 0);
$Validation = $Validation && ($this->pripada->Errors->Count() == 0);
$Validation = $Validation && ($this->CheckBox1->Errors->Count() == 0);
$Validation = $Validation && ($this->CheckBox2->Errors->Count() == 0);
$Validation = $Validation && ($this->CheckBox4->Errors->Count() == 0);
$Validation = $Validation && ($this->CheckBox3->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-CD10A0E2
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->nazivrubr->Errors->Count());
$errors = ($errors || $this->pripada->Errors->Count());
$errors = ($errors || $this->CheckBox1->Errors->Count());
$errors = ($errors || $this->CheckBox2->Errors->Count());
$errors = ($errors || $this->CheckBox4->Errors->Count());
$errors = ($errors || $this->CheckBox3->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-0238D3AC
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->ds->Prepare();
if(!$this->FormSubmitted) {
$this->EditMode = $this->ds->AllParametersSet;
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 = "rubrike_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-8147BD46
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->nazivrubr->SetValue($this->nazivrubr->GetValue());
$this->ds->pripada->SetValue($this->pripada->GetValue());
$this->ds->CheckBox1->SetValue($this->CheckBox1->GetValue());
$this->ds->CheckBox2->SetValue($this->CheckBox2->GetValue());
$this->ds->CheckBox4->SetValue($this->CheckBox4->GetValue());
$this->ds->CheckBox3->SetValue($this->CheckBox3->GetValue());
$this->ds->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-42388D68
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->nazivrubr->SetValue($this->nazivrubr->GetValue());
$this->ds->pripada->SetValue($this->pripada->GetValue());
$this->ds->CheckBox1->SetValue($this->CheckBox1->GetValue());
$this->ds->CheckBox2->SetValue($this->CheckBox2->GetValue());
$this->ds->CheckBox4->SetValue($this->CheckBox4->GetValue());
$this->ds->CheckBox3->SetValue($this->CheckBox3->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-8DB50DF1
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->pripada->Prepare();
$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 rubrike";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->nazivrubr->SetValue($this->ds->nazivrubr->GetValue());
$this->pripada->SetValue($this->ds->pripada->GetValue());
$this->CheckBox1->SetValue($this->ds->CheckBox1->GetValue());
$this->CheckBox2->SetValue($this->ds->CheckBox2->GetValue());
$this->CheckBox4->SetValue($this->ds->CheckBox4->GetValue());
$this->CheckBox3->SetValue($this->ds->CheckBox3->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->nazivrubr->Errors->ToString();
$Error .= $this->pripada->Errors->ToString();
$Error .= $this->CheckBox1->Errors->ToString();
$Error .= $this->CheckBox2->Errors->ToString();
$Error .= $this->CheckBox4->Errors->ToString();
$Error .= $this->CheckBox3->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->nazivrubr->Show();
$this->pripada->Show();
$this->CheckBox1->Show();
$this->CheckBox2->Show();
$this->CheckBox4->Show();
$this->CheckBox3->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 rubrike Class @2-FCB6E20C
class clsrubrikeDataSource extends clsDBConnection1 { //rubrikeDataSource Class @2-11F6F3B7
//DataSource Variables @2-FE6CC7A0
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $nazivrubr;
var $pripada;
var $CheckBox1;
var $CheckBox2;
var $CheckBox4;
var $CheckBox3;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-05591729
function clsrubrikeDataSource()
{
$this->ErrorBlock = "Record rubrike/Error";
$this->Initialize();
$this->nazivrubr = new clsField("nazivrubr", ccsMemo, "");
$this->pripada = new clsField("pripada", ccsInteger, "");
$this->CheckBox1 = new clsField("CheckBox1", ccsInteger, "");
$this->CheckBox2 = new clsField("CheckBox2", ccsInteger, "");
$this->CheckBox4 = new clsField("CheckBox4", ccsInteger, "");
$this->CheckBox3 = new clsField("CheckBox3", ccsInteger, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @2-CB797140
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlidrubrike", ccsInteger, "", "", $this->Parameters["urlidrubrike"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "idrubrike", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-C0B93FED
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM rubrike";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->PageSize = 1;
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
}
//End Open Method
//SetValues Method @2-012FC76D
function SetValues()
{
$this->nazivrubr->SetDBValue($this->f("nazivrubr"));
$this->pripada->SetDBValue(trim($this->f("pripada")));
$this->CheckBox1->SetDBValue(trim($this->f("wap")));
$this->CheckBox2->SetDBValue(trim($this->f("portal")));
$this->CheckBox4->SetDBValue(trim($this->f("prvastrana")));
$this->CheckBox3->SetDBValue(trim($this->f("podrubrika")));
}
//End SetValues Method
//Insert Method @2-4F2D2EFA
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO rubrike ("
. "nazivrubr, "
. "pripada, "
. "wap, "
. "portal, "
. "prvastrana, "
. "podrubrika"
. ") VALUES ("
. $this->ToSQL($this->nazivrubr->GetDBValue(), $this->nazivrubr->DataType) . ", "
. $this->ToSQL($this->pripada->GetDBValue(), $this->pripada->DataType) . ", "
. $this->ToSQL($this->CheckBox1->GetDBValue(), $this->CheckBox1->DataType) . ", "
. $this->ToSQL($this->CheckBox2->GetDBValue(), $this->CheckBox2->DataType) . ", "
. $this->ToSQL($this->CheckBox4->GetDBValue(), $this->CheckBox4->DataType) . ", "
. $this->ToSQL($this->CheckBox3->GetDBValue(), $this->CheckBox3->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert");
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert");
}
$this->close();
}
//End Insert Method
//Update Method @2-24BC4F17
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->SQL = "UPDATE rubrike SET "
. "nazivrubr=" . $this->ToSQL($this->nazivrubr->GetDBValue(), $this->nazivrubr->DataType) . ", "
. "pripada=" . $this->ToSQL($this->pripada->GetDBValue(), $this->pripada->DataType) . ", "
. "wap=" . $this->ToSQL($this->CheckBox1->GetDBValue(), $this->CheckBox1->DataType) . ", "
. "portal=" . $this->ToSQL($this->CheckBox2->GetDBValue(), $this->CheckBox2->DataType) . ", "
. "prvastrana=" . $this->ToSQL($this->CheckBox4->GetDBValue(), $this->CheckBox4->DataType) . ", "
. "podrubrika=" . $this->ToSQL($this->CheckBox3->GetDBValue(), $this->CheckBox3->DataType);
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
}
$this->close();
}
//End Update Method
//Delete Method @2-90A159ED
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->SQL = "DELETE FROM rubrike";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete");
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete");
}
$this->close();
}
//End Delete Method
} //End rubrikeDataSource Class @2-FCB6E20C
//Include Page implementation @15-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-0F15B2B7
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "rubrike_maint.php";
$Redirect = "";
$TemplateFileName = "rubrike_maint.html";
$BlockToParse = "main";
$TemplateEncoding = "";
$FileEncoding = "";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-77AD4150
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader("");
$Header->BindEvents();
$Header->Initialize();
$Header1 = new clsHeader1("");
$Header1->BindEvents();
$Header1->Initialize();
$rubrike = new clsRecordrubrike();
$Footer = new clsFooter("");
$Footer->BindEvents();
$Footer->Initialize();
$rubrike->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
$Charset = $Charset ? $Charset : $TemplateEncoding;
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-51DB8464
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView");
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main", $TemplateEncoding);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow");
//End Initialize HTML Template
//Execute Components @1-C2D31972
$Header->Operations();
$Header1->Operations();
$rubrike->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-4F13F05C
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($rubrike);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-FBC66EB9
$Header->Show("Header");
$Header1->Show("Header1");
$rubrike->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-F7D2685E
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($rubrike);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|