Viewing file: tekstovi_z_maint.php (21.45 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 @16-39DC296A
include_once("./Header.php");
//End Include Page implementation
Class clsRecordtekstovi_zakona { //tekstovi_zakona Class @2-77A2C8C5
//Variables @2-4A82E0A3
// 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;
var $UpdateAllowed;
var $DeleteAllowed;
var $ds;
var $EditMode;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-D625B77A
function clsRecordtekstovi_zakona()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record tekstovi_zakona/Error";
$this->ds = new clstekstovi_zakonaDataSource();
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
if($this->Visible)
{
$this->ComponentName = "tekstovi_zakona";
$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->id_zakona = new clsControl(ccsTextBox, "id_zakona", "Id Zakona", ccsText, "", CCGetRequestParam("id_zakona", $Method));
$this->naslov = new clsControl(ccsTextArea, "naslov", "Naslov", ccsMemo, "", CCGetRequestParam("naslov", $Method));
$this->podnaslov = new clsControl(ccsTextArea, "podnaslov", "Podnaslov", ccsMemo, "", CCGetRequestParam("podnaslov", $Method));
$this->tekst = new clsControl(ccsTextArea, "tekst", "Tekst", ccsMemo, "", CCGetRequestParam("tekst", $Method));
$this->datum = new clsControl(ccsTextBox, "datum", "Datum", ccsDate, Array("GeneralDate"), CCGetRequestParam("datum", $Method));
$this->DatePicker_datum = new clsDatePicker("DatePicker_datum", "tekstovi_zakona", "datum");
$this->podnosilac = new clsControl(ccsTextArea, "podnosilac", "Podnosilac", ccsMemo, "", CCGetRequestParam("podnosilac", $Method));
$this->tip_dokumenta = new clsControl(ccsTextBox, "tip_dokumenta", "Tip Dokumenta", ccsText, "", CCGetRequestParam("tip_dokumenta", $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-08B8FF43
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->id_zakona->Validate() && $Validation);
$Validation = ($this->naslov->Validate() && $Validation);
$Validation = ($this->podnaslov->Validate() && $Validation);
$Validation = ($this->tekst->Validate() && $Validation);
$Validation = ($this->datum->Validate() && $Validation);
$Validation = ($this->podnosilac->Validate() && $Validation);
$Validation = ($this->tip_dokumenta->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-4414DD8F
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->id_zakona->Errors->Count());
$errors = ($errors || $this->naslov->Errors->Count());
$errors = ($errors || $this->podnaslov->Errors->Count());
$errors = ($errors || $this->tekst->Errors->Count());
$errors = ($errors || $this->datum->Errors->Count());
$errors = ($errors || $this->DatePicker_datum->Errors->Count());
$errors = ($errors || $this->podnosilac->Errors->Count());
$errors = ($errors || $this->tip_dokumenta->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-4F8A1777
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 = "tekstovi_z_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-98680C5F
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert");
if(!$this->InsertAllowed) return false;
$this->ds->id_zakona->SetValue($this->id_zakona->GetValue());
$this->ds->naslov->SetValue($this->naslov->GetValue());
$this->ds->podnaslov->SetValue($this->podnaslov->GetValue());
$this->ds->tekst->SetValue($this->tekst->GetValue());
$this->ds->datum->SetValue($this->datum->GetValue());
$this->ds->podnosilac->SetValue($this->podnosilac->GetValue());
$this->ds->tip_dokumenta->SetValue($this->tip_dokumenta->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->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-0C1369F4
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate");
if(!$this->UpdateAllowed) return false;
$this->ds->id_zakona->SetValue($this->id_zakona->GetValue());
$this->ds->naslov->SetValue($this->naslov->GetValue());
$this->ds->podnaslov->SetValue($this->podnaslov->GetValue());
$this->ds->tekst->SetValue($this->tekst->GetValue());
$this->ds->datum->SetValue($this->datum->GetValue());
$this->ds->podnosilac->SetValue($this->podnosilac->GetValue());
$this->ds->tip_dokumenta->SetValue($this->tip_dokumenta->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->CheckErrors());
}
//End UpdateRow Method
//DeleteRow Method @2-EA88835F
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() > 0) {
echo "Error in Record " . ComponentName . " / Delete Operation";
$this->ds->Errors->Clear();
$this->Errors->AddError("Database command error.");
}
return (!$this->CheckErrors());
}
//End DeleteRow Method
//Show Method @2-9D2B7BEE
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->ds->open();
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
if($this->EditMode)
{
if($this->Errors->Count() == 0)
{
if($this->ds->Errors->Count() > 0)
{
echo "Error in Record tekstovi_zakona";
}
else if($this->ds->next_record())
{
$this->ds->SetValues();
if(!$this->FormSubmitted)
{
$this->id_zakona->SetValue($this->ds->id_zakona->GetValue());
$this->naslov->SetValue($this->ds->naslov->GetValue());
$this->podnaslov->SetValue($this->ds->podnaslov->GetValue());
$this->tekst->SetValue($this->ds->tekst->GetValue());
$this->datum->SetValue($this->ds->datum->GetValue());
$this->podnosilac->SetValue($this->ds->podnosilac->GetValue());
$this->tip_dokumenta->SetValue($this->ds->tip_dokumenta->GetValue());
}
}
else
{
$this->EditMode = false;
}
}
}
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->id_zakona->Errors->ToString();
$Error .= $this->naslov->Errors->ToString();
$Error .= $this->podnaslov->Errors->ToString();
$Error .= $this->tekst->Errors->ToString();
$Error .= $this->datum->Errors->ToString();
$Error .= $this->DatePicker_datum->Errors->ToString();
$Error .= $this->podnosilac->Errors->ToString();
$Error .= $this->tip_dokumenta->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->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$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->id_zakona->Show();
$this->naslov->Show();
$this->podnaslov->Show();
$this->tekst->Show();
$this->datum->Show();
$this->DatePicker_datum->Show();
$this->podnosilac->Show();
$this->tip_dokumenta->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 tekstovi_zakona Class @2-FCB6E20C
class clstekstovi_zakonaDataSource extends clsDBConnection1 { //tekstovi_zakonaDataSource Class @2-E502AD50
//DataSource Variables @2-269A8B7E
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $id_zakona;
var $naslov;
var $podnaslov;
var $tekst;
var $datum;
var $podnosilac;
var $tip_dokumenta;
//End DataSource Variables
//Class_Initialize Event @2-DF851EF0
function clstekstovi_zakonaDataSource()
{
$this->ErrorBlock = "Record tekstovi_zakona/Error";
$this->Initialize();
$this->id_zakona = new clsField("id_zakona", ccsText, "");
$this->naslov = new clsField("naslov", ccsMemo, "");
$this->podnaslov = new clsField("podnaslov", ccsMemo, "");
$this->tekst = new clsField("tekst", ccsMemo, "");
$this->datum = new clsField("datum", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->podnosilac = new clsField("podnosilac", ccsMemo, "");
$this->tip_dokumenta = new clsField("tip_dokumenta", 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-583EA1BA
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->SQL = "SELECT * " .
"FROM tekstovi_zakona";
$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-A508AF59
function SetValues()
{
$this->id_zakona->SetDBValue($this->f("id_zakona"));
$this->naslov->SetDBValue($this->f("naslov"));
$this->podnaslov->SetDBValue($this->f("podnaslov"));
$this->tekst->SetDBValue($this->f("tekst"));
$this->datum->SetDBValue(trim($this->f("datum")));
$this->podnosilac->SetDBValue($this->f("podnosilac"));
$this->tip_dokumenta->SetDBValue($this->f("tip_dokumenta"));
}
//End SetValues Method
//Insert Method @2-6D655FC1
function Insert()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO tekstovi_zakona ("
. "id_zakona, "
. "naslov, "
. "podnaslov, "
. "tekst, "
. "datum, "
. "podnosilac, "
. "tip_dokumenta"
. ") VALUES ("
. $this->ToSQL($this->id_zakona->GetDBValue(), $this->id_zakona->DataType) . ", "
. $this->ToSQL($this->naslov->GetDBValue(), $this->naslov->DataType) . ", "
. $this->ToSQL($this->podnaslov->GetDBValue(), $this->podnaslov->DataType) . ", "
. $this->ToSQL($this->tekst->GetDBValue(), $this->tekst->DataType) . ", "
. $this->ToSQL($this->datum->GetDBValue(), $this->datum->DataType) . ", "
. $this->ToSQL($this->podnosilac->GetDBValue(), $this->podnosilac->DataType) . ", "
. $this->ToSQL($this->tip_dokumenta->GetDBValue(), $this->tip_dokumenta->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert");
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
$this->close();
}
//End Insert Method
//Update Method @2-5D4C8CDF
function Update()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->SQL = "UPDATE tekstovi_zakona SET "
. "id_zakona=" . $this->ToSQL($this->id_zakona->GetDBValue(), $this->id_zakona->DataType) . ", "
. "naslov=" . $this->ToSQL($this->naslov->GetDBValue(), $this->naslov->DataType) . ", "
. "podnaslov=" . $this->ToSQL($this->podnaslov->GetDBValue(), $this->podnaslov->DataType) . ", "
. "tekst=" . $this->ToSQL($this->tekst->GetDBValue(), $this->tekst->DataType) . ", "
. "datum=" . $this->ToSQL($this->datum->GetDBValue(), $this->datum->DataType) . ", "
. "podnosilac=" . $this->ToSQL($this->podnosilac->GetDBValue(), $this->podnosilac->DataType) . ", "
. "tip_dokumenta=" . $this->ToSQL($this->tip_dokumenta->GetDBValue(), $this->tip_dokumenta->DataType);
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
$this->close();
}
//End Update Method
//Delete Method @2-C1F6F54E
function Delete()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->SQL = "DELETE FROM tekstovi_zakona";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete");
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
$this->close();
}
//End Delete Method
} //End tekstovi_zakonaDataSource Class @2-FCB6E20C
//Include Page implementation @17-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-0E1935DD
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "tekstovi_z_maint.php";
$Redirect = "";
$TemplateFileName = "tekstovi_z_maint.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-78F3D5D5
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$tekstovi_zakona = new clsRecordtekstovi_zakona();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$tekstovi_zakona->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
//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-3744F33F
$Header->Operations();
$tekstovi_zakona->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-68A42479
$Header->Show("Header");
$tekstovi_zakona->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
?>
|