Viewing file: vrijeme_maint.php (21.42 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 @11-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
//Include Page implementation @25-9090FF7A
include_once(RelativePath . "/Header1.php");
//End Include Page implementation
class clsRecordvrijeme { //vrijeme Class @2-58FBB0B7
//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-1D3BFDC6
function clsRecordvrijeme()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record vrijeme/Error";
$this->ds = new clsvrijemeDataSource();
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "vrijeme";
$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->grad_id = new clsControl(ccsListBox, "grad_id", "Grad Id", ccsInteger, "", CCGetRequestParam("grad_id", $Method));
$this->grad_id->DSType = dsTable;
list($this->grad_id->BoundColumn, $this->grad_id->TextColumn, $this->grad_id->DBFormat) = array("sity_id", "name", "");
$this->grad_id->ds = new clsDBConnection1();
$this->grad_id->ds->SQL = "SELECT * " .
"FROM grad";
$this->temperature = new clsControl(ccsTextBox, "temperature", "Temperature", ccsFloat, "", CCGetRequestParam("temperature", $Method));
$this->TextBox1 = new clsControl(ccsTextBox, "TextBox1", "TextBox1", ccsDate, Array("dd", "/", "mm", "/", "yyyy"), CCGetRequestParam("TextBox1", $Method));
$this->DatePicker1 = new clsDatePicker("DatePicker1", "vrijeme", "TextBox1");
$this->ListBox1 = new clsControl(ccsListBox, "ListBox1", "ListBox1", ccsText, "", CCGetRequestParam("ListBox1", $Method));
$this->ListBox1->DSType = dsSQL;
list($this->ListBox1->BoundColumn, $this->ListBox1->TextColumn, $this->ListBox1->DBFormat) = array("idslike", "nazivslike", "");
$this->ListBox1->ds = new clsDBConnection1();
$this->ListBox1->ds->Parameters["url1"] = CCGetFromGet("1", "");
$this->ListBox1->ds->wp = new clsSQLParameters();
$this->ListBox1->ds->wp->AddParameter("1", "url1", ccsInteger, "", "", $this->ListBox1->ds->Parameters["url1"], 1, false);
$this->ListBox1->ds->SQL = "SELECT * " .
"FROM slike " .
"WHERE vremenskaprognoza = 1";
$this->prognoza = new clsControl(ccsTextArea, "prognoza", "Prognoza", ccsMemo, "", CCGetRequestParam("prognoza", $Method));
$this->prognoza->Required = true;
$this->Button_Insert = new clsButton("Button_Insert");
$this->Button_Update = new clsButton("Button_Update");
$this->Button_Delete = new clsButton("Button_Delete");
if(!$this->FormSubmitted) {
if(!is_array($this->TextBox1->Value) && !strlen($this->TextBox1->Value) && $this->TextBox1->Value !== false)
$this->TextBox1->SetValue(time());
}
}
}
//End Class_Initialize Event
//Initialize Method @2-8AB62812
function Initialize()
{
if(!$this->Visible)
return;
$this->ds->Parameters["urlvrijeme_id"] = CCGetFromGet("vrijeme_id", "");
}
//End Initialize Method
//Validate Method @2-C69FB19D
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->grad_id->Validate() && $Validation);
$Validation = ($this->temperature->Validate() && $Validation);
$Validation = ($this->TextBox1->Validate() && $Validation);
$Validation = ($this->ListBox1->Validate() && $Validation);
$Validation = ($this->prognoza->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
$Validation = $Validation && ($this->grad_id->Errors->Count() == 0);
$Validation = $Validation && ($this->temperature->Errors->Count() == 0);
$Validation = $Validation && ($this->TextBox1->Errors->Count() == 0);
$Validation = $Validation && ($this->ListBox1->Errors->Count() == 0);
$Validation = $Validation && ($this->prognoza->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-DD40A153
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->grad_id->Errors->Count());
$errors = ($errors || $this->temperature->Errors->Count());
$errors = ($errors || $this->TextBox1->Errors->Count());
$errors = ($errors || $this->DatePicker1->Errors->Count());
$errors = ($errors || $this->ListBox1->Errors->Count());
$errors = ($errors || $this->prognoza->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-C70C48B6
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 = "vrijeme_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-B0C91452
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->grad_id->SetValue($this->grad_id->GetValue());
$this->ds->temperature->SetValue($this->temperature->GetValue());
$this->ds->TextBox1->SetValue($this->TextBox1->GetValue());
$this->ds->ListBox1->SetValue($this->ListBox1->GetValue());
$this->ds->prognoza->SetValue($this->prognoza->GetValue());
$this->ds->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert");
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-58D7972D
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->grad_id->SetValue($this->grad_id->GetValue());
$this->ds->temperature->SetValue($this->temperature->GetValue());
$this->ds->TextBox1->SetValue($this->TextBox1->GetValue());
$this->ds->ListBox1->SetValue($this->ListBox1->GetValue());
$this->ds->prognoza->SetValue($this->prognoza->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-6E061201
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->grad_id->Prepare();
$this->ListBox1->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 vrijeme";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->grad_id->SetValue($this->ds->grad_id->GetValue());
$this->temperature->SetValue($this->ds->temperature->GetValue());
$this->TextBox1->SetValue($this->ds->TextBox1->GetValue());
$this->ListBox1->SetValue($this->ds->ListBox1->GetValue());
$this->prognoza->SetValue($this->ds->prognoza->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->grad_id->Errors->ToString();
$Error .= $this->temperature->Errors->ToString();
$Error .= $this->TextBox1->Errors->ToString();
$Error .= $this->DatePicker1->Errors->ToString();
$Error .= $this->ListBox1->Errors->ToString();
$Error .= $this->prognoza->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->grad_id->Show();
$this->temperature->Show();
$this->TextBox1->Show();
$this->DatePicker1->Show();
$this->ListBox1->Show();
$this->prognoza->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 vrijeme Class @2-FCB6E20C
class clsvrijemeDataSource extends clsDBConnection1 { //vrijemeDataSource Class @2-4ED10050
//DataSource Variables @2-5CB63C30
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $grad_id;
var $temperature;
var $TextBox1;
var $ListBox1;
var $prognoza;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-68796D04
function clsvrijemeDataSource()
{
$this->ErrorBlock = "Record vrijeme/Error";
$this->Initialize();
$this->grad_id = new clsField("grad_id", ccsInteger, "");
$this->temperature = new clsField("temperature", ccsFloat, "");
$this->TextBox1 = new clsField("TextBox1", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->ListBox1 = new clsField("ListBox1", ccsText, "");
$this->prognoza = new clsField("prognoza", ccsMemo, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @2-B7854570
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlvrijeme_id", ccsInteger, "", "", $this->Parameters["urlvrijeme_id"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "vrijeme_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-29413229
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM vrijeme";
$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-0A1CEA49
function SetValues()
{
$this->grad_id->SetDBValue(trim($this->f("grad_id")));
$this->temperature->SetDBValue(trim($this->f("temperature")));
$this->TextBox1->SetDBValue(trim($this->f("datum")));
$this->ListBox1->SetDBValue($this->f("slikavrijeme"));
$this->prognoza->SetDBValue($this->f("prognoza"));
}
//End SetValues Method
//Insert Method @2-D3F73ABA
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO vrijeme ("
. "grad_id, "
. "temperature, "
. "datum, "
. "slikavrijeme, "
. "prognoza"
. ") VALUES ("
. $this->ToSQL($this->grad_id->GetDBValue(), $this->grad_id->DataType) . ", "
. $this->ToSQL($this->temperature->GetDBValue(), $this->temperature->DataType) . ", "
. $this->ToSQL($this->TextBox1->GetDBValue(), $this->TextBox1->DataType) . ", "
. $this->ToSQL($this->ListBox1->GetDBValue(), $this->ListBox1->DataType) . ", "
. $this->ToSQL($this->prognoza->GetDBValue(), $this->prognoza->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-70C61BD5
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->SQL = "UPDATE vrijeme SET "
. "grad_id=" . $this->ToSQL($this->grad_id->GetDBValue(), $this->grad_id->DataType) . ", "
. "temperature=" . $this->ToSQL($this->temperature->GetDBValue(), $this->temperature->DataType) . ", "
. "datum=" . $this->ToSQL($this->TextBox1->GetDBValue(), $this->TextBox1->DataType) . ", "
. "slikavrijeme=" . $this->ToSQL($this->ListBox1->GetDBValue(), $this->ListBox1->DataType) . ", "
. "prognoza=" . $this->ToSQL($this->prognoza->GetDBValue(), $this->prognoza->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-D07FA781
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->SQL = "DELETE FROM vrijeme";
$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 vrijemeDataSource Class @2-FCB6E20C
//Include Page implementation @12-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-F5F94EB8
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "vrijeme_maint.php";
$Redirect = "";
$TemplateFileName = "vrijeme_maint.html";
$BlockToParse = "main";
$TemplateEncoding = "";
$FileEncoding = "";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-9883B690
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader("");
$Header->BindEvents();
$Header->Initialize();
$Header1 = new clsHeader1("");
$Header1->BindEvents();
$Header1->Initialize();
$vrijeme = new clsRecordvrijeme();
$Footer = new clsFooter("");
$Footer->BindEvents();
$Footer->Initialize();
$vrijeme->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-F75880D8
$Header->Operations();
$Header1->Operations();
$vrijeme->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-F1CF5A32
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($vrijeme);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-4C6AF258
$Header->Show("Header");
$Header1->Show("Header1");
$vrijeme->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-183A7424
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($vrijeme);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|