Viewing file: valute_maint.php (17.06 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 @10-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
//Include Page implementation @12-9090FF7A
include_once(RelativePath . "/Header1.php");
//End Include Page implementation
class clsRecordvalute { //valute Class @2-F67C10C0
//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-7690F02A
function clsRecordvalute()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record valute/Error";
$this->ds = new clsvaluteDataSource();
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "valute";
$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->naziv_valute = new clsControl(ccsTextBox, "naziv_valute", "Naziv Valute", ccsMemo, "", CCGetRequestParam("naziv_valute", $Method));
$this->naziv_valute->Required = true;
$this->vrijednost_valute = new clsControl(ccsTextBox, "vrijednost_valute", "Vrijednost Valute", ccsFloat, "", CCGetRequestParam("vrijednost_valute", $Method));
$this->vrijednost_valute->Required = true;
$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-F92F8918
function Initialize()
{
if(!$this->Visible)
return;
$this->ds->Parameters["urlid_valute"] = CCGetFromGet("id_valute", "");
}
//End Initialize Method
//Validate Method @2-8B0BC125
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->naziv_valute->Validate() && $Validation);
$Validation = ($this->vrijednost_valute->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
$Validation = $Validation && ($this->naziv_valute->Errors->Count() == 0);
$Validation = $Validation && ($this->vrijednost_valute->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-76722F6A
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->naziv_valute->Errors->Count());
$errors = ($errors || $this->vrijednost_valute->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-5D57A05C
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 = "valute_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-CC8E2720
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->naziv_valute->SetValue($this->naziv_valute->GetValue());
$this->ds->vrijednost_valute->SetValue($this->vrijednost_valute->GetValue());
$this->ds->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-78F6BAE7
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->naziv_valute->SetValue($this->naziv_valute->GetValue());
$this->ds->vrijednost_valute->SetValue($this->vrijednost_valute->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-EAC7148C
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 valute";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->naziv_valute->SetValue($this->ds->naziv_valute->GetValue());
$this->vrijednost_valute->SetValue($this->ds->vrijednost_valute->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->naziv_valute->Errors->ToString();
$Error .= $this->vrijednost_valute->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->naziv_valute->Show();
$this->vrijednost_valute->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 valute Class @2-FCB6E20C
class clsvaluteDataSource extends clsDBConnection1 { //valuteDataSource Class @2-D6ADAE9B
//DataSource Variables @2-C657D54C
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $naziv_valute;
var $vrijednost_valute;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-80A72861
function clsvaluteDataSource()
{
$this->ErrorBlock = "Record valute/Error";
$this->Initialize();
$this->naziv_valute = new clsField("naziv_valute", ccsMemo, "");
$this->vrijednost_valute = new clsField("vrijednost_valute", ccsFloat, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @2-AE844590
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlid_valute", ccsInteger, "", "", $this->Parameters["urlid_valute"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "id_valute", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-3F525F9C
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM valute";
$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-871D926C
function SetValues()
{
$this->naziv_valute->SetDBValue($this->f("naziv_valute"));
$this->vrijednost_valute->SetDBValue(trim($this->f("vrijednost_valute")));
}
//End SetValues Method
//Insert Method @2-2B2DFD62
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO valute ("
. "naziv_valute, "
. "vrijednost_valute"
. ") VALUES ("
. $this->ToSQL($this->naziv_valute->GetDBValue(), $this->naziv_valute->DataType) . ", "
. $this->ToSQL($this->vrijednost_valute->GetDBValue(), $this->vrijednost_valute->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-39D8ED1A
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->SQL = "UPDATE valute SET "
. "naziv_valute=" . $this->ToSQL($this->naziv_valute->GetDBValue(), $this->naziv_valute->DataType) . ", "
. "vrijednost_valute=" . $this->ToSQL($this->vrijednost_valute->GetDBValue(), $this->vrijednost_valute->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-30FF6885
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->SQL = "DELETE FROM valute";
$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 valuteDataSource Class @2-FCB6E20C
//Include Page implementation @11-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-0ACC51B6
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "valute_maint.php";
$Redirect = "";
$TemplateFileName = "valute_maint.html";
$BlockToParse = "main";
$TemplateEncoding = "";
$FileEncoding = "";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-25BA55B3
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader("");
$Header->BindEvents();
$Header->Initialize();
$Header1 = new clsHeader1("");
$Header1->BindEvents();
$Header1->Initialize();
$valute = new clsRecordvalute();
$Footer = new clsFooter("");
$Footer->BindEvents();
$Footer->Initialize();
$valute->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
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-D48526D8
$Header->Operations();
$Header1->Operations();
$valute->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-87C2F732
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($valute);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-0BBE181A
$Header->Show("Header");
$Header1->Show("Header1");
$valute->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-09E7441A
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($valute);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|