Viewing file: telefoni_list.php (68 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-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
//Include Page implementation @23-9090FF7A
include_once(RelativePath . "/Header1.php");
//End Include Page implementation
class clsEditableGridkategorija { //kategorija Class @29-85FAB1E5
//Variables @29-3BFF4F34
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormParameters;
var $FormState;
var $FormEnctype;
var $CachedColumns;
var $TotalRows;
var $UpdatedRows;
var $EmptyRows;
var $Visible;
var $EditableGridset;
var $RowsErrors;
var $ds;
var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode;
var $ValidatingControls;
var $Controls;
var $ControlsErrors;
// Class variables
var $Sorter_kategorija;
var $Navigator;
//End Variables
//Class_Initialize Event @29-B63EC26D
function clsEditableGridkategorija()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "EditableGrid kategorija/Error";
$this->ComponentName = "kategorija";
$this->CachedColumns["id_kategorije"][0] = "id_kategorije";
$this->ds = new clskategorijaDataSource();
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 10;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: EditableGrid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
$this->EmptyRows = 3;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if(!$this->Visible) return;
$CCSForm = CCGetFromGet("ccsForm", "");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($CCSForm == $this->ComponentName);
if($this->FormSubmitted) {
$this->FormState = CCGetFromPost("FormState", "");
$this->SetFormState($this->FormState);
} else {
$this->FormState = "";
}
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->SorterName = CCGetParam("kategorijaOrder", "");
$this->SorterDirection = CCGetParam("kategorijaDir", "");
$this->Sorter_kategorija = new clsSorter($this->ComponentName, "Sorter_kategorija", $FileName);
$this->kategorija = new clsControl(ccsTextBox, "kategorija", "Kategorija", ccsText, "");
$this->kategorija->Required = true;
$this->CheckBox_Delete = new clsControl(ccsCheckBox, "CheckBox_Delete", "CheckBox_Delete", ccsBoolean, Array("True", "False", ""));
$this->CheckBox_Delete->CheckedValue = $this->CheckBox_Delete->GetParsedValue(true);
$this->CheckBox_Delete->UncheckedValue = $this->CheckBox_Delete->GetParsedValue(false);
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple);
$this->Button_Submit = new clsButton("Button_Submit");
}
//End Class_Initialize Event
//Initialize Method @29-03626367
function Initialize()
{
if(!$this->Visible) return;
$this->ds->PageSize = $this->PageSize;
$this->ds->AbsolutePage = $this->PageNumber;
$this->ds->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//GetFormParameters Method @29-E8E50247
function GetFormParameters()
{
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->FormParameters["kategorija"][$RowNumber] = CCGetFromPost("kategorija_" . $RowNumber);
$this->FormParameters["CheckBox_Delete"][$RowNumber] = CCGetFromPost("CheckBox_Delete_" . $RowNumber);
}
}
//End GetFormParameters Method
//Validate Method @29-46D02F16
function Validate()
{
$Validation = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["id_kategorije"] = $this->CachedColumns["id_kategorije"][$RowNumber];
$this->kategorija->SetText($this->FormParameters["kategorija"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if(!$this->CheckBox_Delete->Value)
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
else if($this->CheckInsert($RowNumber))
{
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
}
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//ValidateRow Method @29-39545F5B
function ValidateRow($RowNumber)
{
$this->kategorija->Validate();
$this->CheckBox_Delete->Validate();
$this->RowErrors = new clsErrors();
$errors = $this->kategorija->Errors->ToString();
$errors .= $this->CheckBox_Delete->Errors->ToString();
$this->kategorija->Errors->Clear();
$this->CheckBox_Delete->Errors->Clear();
$errors .=$this->RowErrors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
return $errors ? 0 : 1;
}
//End ValidateRow Method
//CheckInsert Method @29-A09D091D
function CheckInsert($RowNumber)
{
$filed = false;
$filed = ($filed || strlen($this->FormParameters["kategorija"][$RowNumber]));
return $filed;
}
//End CheckInsert Method
//CheckErrors Method @29-242E5992
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @29-6A172129
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->ds->Prepare();
if(!$this->FormSubmitted)
return;
$this->GetFormParameters();
$this->PressedButton = "Button_Submit";
if(strlen(CCGetParam("Button_Submit", ""))) {
$this->PressedButton = "Button_Submit";
}
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", Array("ccsForm"));
if($this->PressedButton == "Button_Submit") {
if(!CCGetEvent($this->Button_Submit->CCSEvents, "OnClick") || !$this->UpdateGrid()) {
$Redirect = "";
}
} else {
$Redirect = "";
}
}
//End Operation Method
//UpdateGrid Method @29-D863DC2C
function UpdateGrid()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSubmit");
if(!$this->Validate()) return;
$Validation = true;
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["id_kategorije"] = $this->CachedColumns["id_kategorije"][$RowNumber];
$this->kategorija->SetText($this->FormParameters["kategorija"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if($this->CheckBox_Delete->Value) {
if($this->DeleteAllowed) { $Validation = ($this->DeleteRow($RowNumber) && $Validation); }
} else if($this->UpdateAllowed) {
$Validation = ($this->UpdateRow($RowNumber) && $Validation);
}
}
else if($this->CheckInsert($RowNumber) && $this->InsertAllowed)
{
$Validation = ($this->InsertRow($RowNumber) && $Validation);
}
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterSubmit");
return ($this->Errors->Count() == 0 && $Validation);
}
//End UpdateGrid Method
//InsertRow Method @29-0EDC5E1E
function InsertRow($RowNumber)
{
if(!$this->InsertAllowed) return false;
$this->ds->kategorija->SetValue($this->kategorija->GetValue());
$this->ds->Insert();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End InsertRow Method
//UpdateRow Method @29-4DABA83E
function UpdateRow($RowNumber)
{
if(!$this->UpdateAllowed) return false;
$this->ds->kategorija->SetValue($this->kategorija->GetValue());
$this->ds->Update();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End UpdateRow Method
//DeleteRow Method @29-E90CB5E3
function DeleteRow($RowNumber)
{
if(!$this->DeleteAllowed) return false;
$this->ds->Delete();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End DeleteRow Method
//FormScript Method @29-59800DB5
function FormScript($TotalRows)
{
$script = "";
return $script;
}
//End FormScript Method
//SetFormState Method @29-CAFD6548
function SetFormState($FormState)
{
if(strlen($FormState)) {
$FormState = str_replace("\\\\", "\\" . ord("\\"), $FormState);
$FormState = str_replace("\\;", "\\" . ord(";"), $FormState);
$pieces = explode(";", $FormState);
$this->UpdatedRows = $pieces[0];
$this->EmptyRows = $pieces[1];
$this->TotalRows = $this->UpdatedRows + $this->EmptyRows;
$RowNumber = 0;
for($i = 2; $i < sizeof($pieces); $i = $i + 1) {
$piece = $pieces[$i + 0];
$piece = str_replace("\\" . ord("\\"), "\\", $piece);
$piece = str_replace("\\" . ord(";"), ";", $piece);
$this->CachedColumns["id_kategorije"][$RowNumber] = $piece;
$RowNumber++;
}
if(!$RowNumber) { $RowNumber = 1; }
for($i = 1; $i <= $this->EmptyRows; $i++) {
$this->CachedColumns["id_kategorije"][$RowNumber] = "";
$RowNumber++;
}
}
}
//End SetFormState Method
//GetFormState Method @29-37DAFCFA
function GetFormState($NonEmptyRows)
{
if(!$this->FormSubmitted) {
$this->FormState = $NonEmptyRows . ";";
$this->FormState .= $this->InsertAllowed ? $this->EmptyRows : "0";
if($NonEmptyRows) {
for($i = 0; $i <= $NonEmptyRows; $i++) {
$this->FormState .= ";" . str_replace(";", "\\;", str_replace("\\", "\\\\", $this->CachedColumns["id_kategorije"][$i]));
}
}
}
return $this->FormState;
}
//End GetFormState Method
//Show Method @29-E7950792
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible) { return; }
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->ds->open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) { return; }
$this->Button_Submit->Visible = $this->Button_Submit->Visible && ($this->InsertAllowed || $this->UpdateAllowed || $this->DeleteAllowed);
$ParentPath = $Tpl->block_path;
$EditableGridPath = $ParentPath . "/EditableGrid " . $this->ComponentName;
$EditableGridRowPath = $ParentPath . "/EditableGrid " . $this->ComponentName . "/Row";
$Tpl->block_path = $EditableGridRowPath;
$RowNumber = 0;
$NonEmptyRows = 0;
$EmptyRowsLeft = $this->EmptyRows;
$is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
if($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed))
{
do
{
$RowNumber++;
if($is_next_record) {
$NonEmptyRows++;
$this->ds->SetValues();
} else {
}
if(!$is_next_record || !$this->DeleteAllowed)
$this->CheckBox_Delete->Visible = false;
if(!$this->FormSubmitted && $is_next_record) {
$this->CachedColumns["id_kategorije"][$RowNumber] = $this->ds->CachedColumns["id_kategorije"];
$this->kategorija->SetValue($this->ds->kategorija->GetValue());
$this->ValidateRow($RowNumber);
} else if (!$this->FormSubmitted){
$this->CachedColumns["id_kategorije"][$RowNumber] = "";
$this->kategorija->SetText("");
$this->CheckBox_Delete->SetText("");
} else {
$this->kategorija->SetText($this->FormParameters["kategorija"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->kategorija->Show($RowNumber);
$this->CheckBox_Delete->Show($RowNumber);
if(isset($this->RowsErrors[$RowNumber]) && $this->RowsErrors[$RowNumber] !== "") {
$Tpl->setvar("Error", $this->RowsErrors[$RowNumber]);
$Tpl->parse("RowError", false);
} else {
$Tpl->setblockvar("RowError", "");
}
$Tpl->setvar("FormScript", $this->FormScript($RowNumber));
$Tpl->parse();
if($is_next_record) $is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
else $EmptyRowsLeft--;
} while($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed));
} else {
$Tpl->block_path = $EditableGridPath;
$Tpl->parse("NoRecords", false);
}
$Tpl->block_path = $EditableGridPath;
$this->Navigator->PageNumber = $this->ds->AbsolutePage;
$this->Navigator->TotalPages = $this->ds->PageCount();
$this->Sorter_kategorija->Show();
$this->Navigator->Show();
$this->Button_Submit->Show();
if($this->CheckErrors()) {
$Error .= $this->Errors->ToString();
$Error .= $this->ds->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $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);
$Tpl->SetVar("HTMLFormProperties", "method=\"POST\" action=\"" . $this->HTMLFormAction . "\" name=\"" . $this->ComponentName . "\"");
$Tpl->SetVar("FormState", htmlspecialchars($this->GetFormState($NonEmptyRows)));
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
} //End kategorija Class @29-FCB6E20C
class clskategorijaDataSource extends clsDBConnection1 { //kategorijaDataSource Class @29-8AB74312
//DataSource Variables @29-CF441701
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $CountSQL;
var $wp;
var $AllParametersSet;
var $CachedColumns;
// Datasource fields
var $kategorija;
var $CheckBox_Delete;
//End DataSource Variables
//DataSourceClass_Initialize Event @29-0A8D8BC0
function clskategorijaDataSource()
{
$this->ErrorBlock = "EditableGrid kategorija/Error";
$this->Initialize();
$this->kategorija = new clsField("kategorija", ccsText, "");
$this->CheckBox_Delete = new clsField("CheckBox_Delete", ccsBoolean, Array("true", "false", ""));
}
//End DataSourceClass_Initialize Event
//SetOrder Method @29-723DA233
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "kategorija";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_kategorija" => array("kategorija", "")));
}
//End SetOrder Method
//Prepare Method @29-DFF3DD87
function Prepare()
{
}
//End Prepare Method
//Open Method @29-A3B8CA0E
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM kategorija";
$this->SQL = "SELECT * " .
"FROM kategorija";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
}
//End Open Method
//SetValues Method @29-CEBAD1F6
function SetValues()
{
$this->CachedColumns["id_kategorije"] = $this->f("id_kategorije");
$this->kategorija->SetDBValue($this->f("kategorija"));
}
//End SetValues Method
//Insert Method @29-434D647A
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO kategorija ("
. "kategorija"
. ") VALUES ("
. $this->ToSQL($this->kategorija->GetDBValue(), $this->kategorija->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 @29-7B926FEC
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->Where = "id_kategorije=" . $this->ToSQL($this->CachedColumns["id_kategorije"], ccsInteger);
$this->SQL = "UPDATE kategorija SET "
. "kategorija=" . $this->ToSQL($this->kategorija->GetDBValue(), $this->kategorija->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 @29-78D2B637
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->Where = "id_kategorije=" . $this->ToSQL($this->CachedColumns["id_kategorije"], ccsInteger);
$this->SQL = "DELETE FROM kategorija";
$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 kategorijaDataSource Class @29-FCB6E20C
class clsEditableGridsekcija { //sekcija Class @36-B9B9EB92
//Variables @36-4664A965
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormParameters;
var $FormState;
var $FormEnctype;
var $CachedColumns;
var $TotalRows;
var $UpdatedRows;
var $EmptyRows;
var $Visible;
var $EditableGridset;
var $RowsErrors;
var $ds;
var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode;
var $ValidatingControls;
var $Controls;
var $ControlsErrors;
// Class variables
var $Sorter_nazivsekcije;
var $Sorter_pripada;
var $Navigator;
//End Variables
//Class_Initialize Event @36-99DF3D2C
function clsEditableGridsekcija()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "EditableGrid sekcija/Error";
$this->ComponentName = "sekcija";
$this->CachedColumns["idsekcije"][0] = "idsekcije";
$this->ds = new clssekcijaDataSource();
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 10;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: EditableGrid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
$this->EmptyRows = 3;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if(!$this->Visible) return;
$CCSForm = CCGetFromGet("ccsForm", "");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($CCSForm == $this->ComponentName);
if($this->FormSubmitted) {
$this->FormState = CCGetFromPost("FormState", "");
$this->SetFormState($this->FormState);
} else {
$this->FormState = "";
}
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->SorterName = CCGetParam("sekcijaOrder", "");
$this->SorterDirection = CCGetParam("sekcijaDir", "");
$this->Sorter_nazivsekcije = new clsSorter($this->ComponentName, "Sorter_nazivsekcije", $FileName);
$this->Sorter_pripada = new clsSorter($this->ComponentName, "Sorter_pripada", $FileName);
$this->nazivsekcije = new clsControl(ccsTextBox, "nazivsekcije", "Nazivsekcije", ccsText, "");
$this->nazivsekcije->Required = true;
$this->pripada = new clsControl(ccsListBox, "pripada", "Pripada", ccsInteger, "");
$this->pripada->DSType = dsTable;
list($this->pripada->BoundColumn, $this->pripada->TextColumn, $this->pripada->DBFormat) = array("id_kategorije", "kategorija", "");
$this->pripada->ds = new clsDBConnection1();
$this->pripada->ds->SQL = "SELECT * " .
"FROM kategorija";
$this->pripada->Required = true;
$this->CheckBox_Delete = new clsControl(ccsCheckBox, "CheckBox_Delete", "CheckBox_Delete", ccsBoolean, Array("True", "False", ""));
$this->CheckBox_Delete->CheckedValue = $this->CheckBox_Delete->GetParsedValue(true);
$this->CheckBox_Delete->UncheckedValue = $this->CheckBox_Delete->GetParsedValue(false);
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple);
$this->Button_Submit = new clsButton("Button_Submit");
}
//End Class_Initialize Event
//Initialize Method @36-03626367
function Initialize()
{
if(!$this->Visible) return;
$this->ds->PageSize = $this->PageSize;
$this->ds->AbsolutePage = $this->PageNumber;
$this->ds->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//GetFormParameters Method @36-9F3E374F
function GetFormParameters()
{
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->FormParameters["nazivsekcije"][$RowNumber] = CCGetFromPost("nazivsekcije_" . $RowNumber);
$this->FormParameters["pripada"][$RowNumber] = CCGetFromPost("pripada_" . $RowNumber);
$this->FormParameters["CheckBox_Delete"][$RowNumber] = CCGetFromPost("CheckBox_Delete_" . $RowNumber);
}
}
//End GetFormParameters Method
//Validate Method @36-8DF45B30
function Validate()
{
$Validation = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["idsekcije"] = $this->CachedColumns["idsekcije"][$RowNumber];
$this->nazivsekcije->SetText($this->FormParameters["nazivsekcije"][$RowNumber], $RowNumber);
$this->pripada->SetText($this->FormParameters["pripada"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if(!$this->CheckBox_Delete->Value)
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
else if($this->CheckInsert($RowNumber))
{
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
}
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//ValidateRow Method @36-DDD2F9DC
function ValidateRow($RowNumber)
{
$this->nazivsekcije->Validate();
$this->pripada->Validate();
$this->CheckBox_Delete->Validate();
$this->RowErrors = new clsErrors();
$errors = $this->nazivsekcije->Errors->ToString();
$errors .= $this->pripada->Errors->ToString();
$errors .= $this->CheckBox_Delete->Errors->ToString();
$this->nazivsekcije->Errors->Clear();
$this->pripada->Errors->Clear();
$this->CheckBox_Delete->Errors->Clear();
$errors .=$this->RowErrors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
return $errors ? 0 : 1;
}
//End ValidateRow Method
//CheckInsert Method @36-184391F5
function CheckInsert($RowNumber)
{
$filed = false;
$filed = ($filed || strlen($this->FormParameters["nazivsekcije"][$RowNumber]));
$filed = ($filed || strlen($this->FormParameters["pripada"][$RowNumber]));
return $filed;
}
//End CheckInsert Method
//CheckErrors Method @36-242E5992
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @36-6A172129
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->ds->Prepare();
if(!$this->FormSubmitted)
return;
$this->GetFormParameters();
$this->PressedButton = "Button_Submit";
if(strlen(CCGetParam("Button_Submit", ""))) {
$this->PressedButton = "Button_Submit";
}
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", Array("ccsForm"));
if($this->PressedButton == "Button_Submit") {
if(!CCGetEvent($this->Button_Submit->CCSEvents, "OnClick") || !$this->UpdateGrid()) {
$Redirect = "";
}
} else {
$Redirect = "";
}
}
//End Operation Method
//UpdateGrid Method @36-BFF8F469
function UpdateGrid()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSubmit");
if(!$this->Validate()) return;
$Validation = true;
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["idsekcije"] = $this->CachedColumns["idsekcije"][$RowNumber];
$this->nazivsekcije->SetText($this->FormParameters["nazivsekcije"][$RowNumber], $RowNumber);
$this->pripada->SetText($this->FormParameters["pripada"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if($this->CheckBox_Delete->Value) {
if($this->DeleteAllowed) { $Validation = ($this->DeleteRow($RowNumber) && $Validation); }
} else if($this->UpdateAllowed) {
$Validation = ($this->UpdateRow($RowNumber) && $Validation);
}
}
else if($this->CheckInsert($RowNumber) && $this->InsertAllowed)
{
$Validation = ($this->InsertRow($RowNumber) && $Validation);
}
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterSubmit");
return ($this->Errors->Count() == 0 && $Validation);
}
//End UpdateGrid Method
//InsertRow Method @36-F5BF4B1C
function InsertRow($RowNumber)
{
if(!$this->InsertAllowed) return false;
$this->ds->nazivsekcije->SetValue($this->nazivsekcije->GetValue());
$this->ds->pripada->SetValue($this->pripada->GetValue());
$this->ds->Insert();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End InsertRow Method
//UpdateRow Method @36-15720C71
function UpdateRow($RowNumber)
{
if(!$this->UpdateAllowed) return false;
$this->ds->nazivsekcije->SetValue($this->nazivsekcije->GetValue());
$this->ds->pripada->SetValue($this->pripada->GetValue());
$this->ds->Update();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End UpdateRow Method
//DeleteRow Method @36-E90CB5E3
function DeleteRow($RowNumber)
{
if(!$this->DeleteAllowed) return false;
$this->ds->Delete();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End DeleteRow Method
//FormScript Method @36-59800DB5
function FormScript($TotalRows)
{
$script = "";
return $script;
}
//End FormScript Method
//SetFormState Method @36-F159AC19
function SetFormState($FormState)
{
if(strlen($FormState)) {
$FormState = str_replace("\\\\", "\\" . ord("\\"), $FormState);
$FormState = str_replace("\\;", "\\" . ord(";"), $FormState);
$pieces = explode(";", $FormState);
$this->UpdatedRows = $pieces[0];
$this->EmptyRows = $pieces[1];
$this->TotalRows = $this->UpdatedRows + $this->EmptyRows;
$RowNumber = 0;
for($i = 2; $i < sizeof($pieces); $i = $i + 1) {
$piece = $pieces[$i + 0];
$piece = str_replace("\\" . ord("\\"), "\\", $piece);
$piece = str_replace("\\" . ord(";"), ";", $piece);
$this->CachedColumns["idsekcije"][$RowNumber] = $piece;
$RowNumber++;
}
if(!$RowNumber) { $RowNumber = 1; }
for($i = 1; $i <= $this->EmptyRows; $i++) {
$this->CachedColumns["idsekcije"][$RowNumber] = "";
$RowNumber++;
}
}
}
//End SetFormState Method
//GetFormState Method @36-7A47260E
function GetFormState($NonEmptyRows)
{
if(!$this->FormSubmitted) {
$this->FormState = $NonEmptyRows . ";";
$this->FormState .= $this->InsertAllowed ? $this->EmptyRows : "0";
if($NonEmptyRows) {
for($i = 0; $i <= $NonEmptyRows; $i++) {
$this->FormState .= ";" . str_replace(";", "\\;", str_replace("\\", "\\\\", $this->CachedColumns["idsekcije"][$i]));
}
}
}
return $this->FormState;
}
//End GetFormState Method
//Show Method @36-67BF70FB
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible) { return; }
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->pripada->Prepare();
$this->ds->open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) { return; }
$this->Button_Submit->Visible = $this->Button_Submit->Visible && ($this->InsertAllowed || $this->UpdateAllowed || $this->DeleteAllowed);
$ParentPath = $Tpl->block_path;
$EditableGridPath = $ParentPath . "/EditableGrid " . $this->ComponentName;
$EditableGridRowPath = $ParentPath . "/EditableGrid " . $this->ComponentName . "/Row";
$Tpl->block_path = $EditableGridRowPath;
$RowNumber = 0;
$NonEmptyRows = 0;
$EmptyRowsLeft = $this->EmptyRows;
$is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
if($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed))
{
do
{
$RowNumber++;
if($is_next_record) {
$NonEmptyRows++;
$this->ds->SetValues();
} else {
}
if(!$is_next_record || !$this->DeleteAllowed)
$this->CheckBox_Delete->Visible = false;
if(!$this->FormSubmitted && $is_next_record) {
$this->CachedColumns["idsekcije"][$RowNumber] = $this->ds->CachedColumns["idsekcije"];
$this->nazivsekcije->SetValue($this->ds->nazivsekcije->GetValue());
$this->pripada->SetValue($this->ds->pripada->GetValue());
$this->ValidateRow($RowNumber);
} else if (!$this->FormSubmitted){
$this->CachedColumns["idsekcije"][$RowNumber] = "";
$this->nazivsekcije->SetText("");
$this->pripada->SetText("");
$this->CheckBox_Delete->SetText("");
} else {
$this->nazivsekcije->SetText($this->FormParameters["nazivsekcije"][$RowNumber], $RowNumber);
$this->pripada->SetText($this->FormParameters["pripada"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->nazivsekcije->Show($RowNumber);
$this->pripada->Show($RowNumber);
$this->CheckBox_Delete->Show($RowNumber);
if(isset($this->RowsErrors[$RowNumber]) && $this->RowsErrors[$RowNumber] !== "") {
$Tpl->setvar("Error", $this->RowsErrors[$RowNumber]);
$Tpl->parse("RowError", false);
} else {
$Tpl->setblockvar("RowError", "");
}
$Tpl->setvar("FormScript", $this->FormScript($RowNumber));
$Tpl->parse();
if($is_next_record) $is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
else $EmptyRowsLeft--;
} while($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed));
} else {
$Tpl->block_path = $EditableGridPath;
$Tpl->parse("NoRecords", false);
}
$Tpl->block_path = $EditableGridPath;
$this->Navigator->PageNumber = $this->ds->AbsolutePage;
$this->Navigator->TotalPages = $this->ds->PageCount();
$this->Sorter_nazivsekcije->Show();
$this->Sorter_pripada->Show();
$this->Navigator->Show();
$this->Button_Submit->Show();
if($this->CheckErrors()) {
$Error .= $this->Errors->ToString();
$Error .= $this->ds->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $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);
$Tpl->SetVar("HTMLFormProperties", "method=\"POST\" action=\"" . $this->HTMLFormAction . "\" name=\"" . $this->ComponentName . "\"");
$Tpl->SetVar("FormState", htmlspecialchars($this->GetFormState($NonEmptyRows)));
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
} //End sekcija Class @36-FCB6E20C
class clssekcijaDataSource extends clsDBConnection1 { //sekcijaDataSource Class @36-7F84B572
//DataSource Variables @36-36D660AD
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $CountSQL;
var $wp;
var $AllParametersSet;
var $CachedColumns;
// Datasource fields
var $nazivsekcije;
var $pripada;
var $CheckBox_Delete;
//End DataSource Variables
//DataSourceClass_Initialize Event @36-8BCB1B38
function clssekcijaDataSource()
{
$this->ErrorBlock = "EditableGrid sekcija/Error";
$this->Initialize();
$this->nazivsekcije = new clsField("nazivsekcije", ccsText, "");
$this->pripada = new clsField("pripada", ccsInteger, "");
$this->CheckBox_Delete = new clsField("CheckBox_Delete", ccsBoolean, Array("true", "false", ""));
}
//End DataSourceClass_Initialize Event
//SetOrder Method @36-D692DB63
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_nazivsekcije" => array("nazivsekcije", ""),
"Sorter_pripada" => array("pripada", "")));
}
//End SetOrder Method
//Prepare Method @36-DFF3DD87
function Prepare()
{
}
//End Prepare Method
//Open Method @36-3F2B4094
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM sekcija";
$this->SQL = "SELECT * " .
"FROM sekcija";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
}
//End Open Method
//SetValues Method @36-B7F0B11C
function SetValues()
{
$this->CachedColumns["idsekcije"] = $this->f("idsekcije");
$this->nazivsekcije->SetDBValue($this->f("nazivsekcije"));
$this->pripada->SetDBValue(trim($this->f("pripada")));
}
//End SetValues Method
//Insert Method @36-07963F0A
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO sekcija ("
. "nazivsekcije, "
. "pripada"
. ") VALUES ("
. $this->ToSQL($this->nazivsekcije->GetDBValue(), $this->nazivsekcije->DataType) . ", "
. $this->ToSQL($this->pripada->GetDBValue(), $this->pripada->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 @36-EA182490
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->Where = "idsekcije=" . $this->ToSQL($this->CachedColumns["idsekcije"], ccsInteger);
$this->SQL = "UPDATE sekcija SET "
. "nazivsekcije=" . $this->ToSQL($this->nazivsekcije->GetDBValue(), $this->nazivsekcije->DataType) . ", "
. "pripada=" . $this->ToSQL($this->pripada->GetDBValue(), $this->pripada->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 @36-F2AAA794
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->Where = "idsekcije=" . $this->ToSQL($this->CachedColumns["idsekcije"], ccsInteger);
$this->SQL = "DELETE FROM sekcija";
$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 sekcijaDataSource Class @36-FCB6E20C
class clsEditableGridtelefoni1 { //telefoni1 Class @45-C142AA9F
//Variables @45-B677B764
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormParameters;
var $FormState;
var $FormEnctype;
var $CachedColumns;
var $TotalRows;
var $UpdatedRows;
var $EmptyRows;
var $Visible;
var $EditableGridset;
var $RowsErrors;
var $ds;
var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode;
var $ValidatingControls;
var $Controls;
var $ControlsErrors;
// Class variables
var $Navigator;
//End Variables
//Class_Initialize Event @45-08722206
function clsEditableGridtelefoni1()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "EditableGrid telefoni1/Error";
$this->ComponentName = "telefoni1";
$this->CachedColumns["idtelefona"][0] = "idtelefona";
$this->ds = new clstelefoni1DataSource();
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 10;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: EditableGrid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
$this->EmptyRows = 3;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if(!$this->Visible) return;
$CCSForm = CCGetFromGet("ccsForm", "");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($CCSForm == $this->ComponentName);
if($this->FormSubmitted) {
$this->FormState = CCGetFromPost("FormState", "");
$this->SetFormState($this->FormState);
} else {
$this->FormState = "";
}
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->naziv_telefona = new clsControl(ccsTextBox, "naziv_telefona", "Naziv Telefona", ccsMemo, "");
$this->naziv_telefona->Required = true;
$this->CheckBox_Delete = new clsControl(ccsCheckBox, "CheckBox_Delete", "CheckBox_Delete", ccsBoolean, Array("True", "False", ""));
$this->CheckBox_Delete->CheckedValue = $this->CheckBox_Delete->GetParsedValue(true);
$this->CheckBox_Delete->UncheckedValue = $this->CheckBox_Delete->GetParsedValue(false);
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple);
$this->Button_Submit = new clsButton("Button_Submit");
}
//End Class_Initialize Event
//Initialize Method @45-03626367
function Initialize()
{
if(!$this->Visible) return;
$this->ds->PageSize = $this->PageSize;
$this->ds->AbsolutePage = $this->PageNumber;
$this->ds->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//GetFormParameters Method @45-873D6C2E
function GetFormParameters()
{
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->FormParameters["naziv_telefona"][$RowNumber] = CCGetFromPost("naziv_telefona_" . $RowNumber);
$this->FormParameters["CheckBox_Delete"][$RowNumber] = CCGetFromPost("CheckBox_Delete_" . $RowNumber);
}
}
//End GetFormParameters Method
//Validate Method @45-9805FAFF
function Validate()
{
$Validation = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["idtelefona"] = $this->CachedColumns["idtelefona"][$RowNumber];
$this->naziv_telefona->SetText($this->FormParameters["naziv_telefona"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if(!$this->CheckBox_Delete->Value)
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
else if($this->CheckInsert($RowNumber))
{
$Validation = ($this->ValidateRow($RowNumber) && $Validation);
}
}
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//ValidateRow Method @45-1D5A2847
function ValidateRow($RowNumber)
{
$this->naziv_telefona->Validate();
$this->CheckBox_Delete->Validate();
$this->RowErrors = new clsErrors();
$errors = $this->naziv_telefona->Errors->ToString();
$errors .= $this->CheckBox_Delete->Errors->ToString();
$this->naziv_telefona->Errors->Clear();
$this->CheckBox_Delete->Errors->Clear();
$errors .=$this->RowErrors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
return $errors ? 0 : 1;
}
//End ValidateRow Method
//CheckInsert Method @45-FB107C5F
function CheckInsert($RowNumber)
{
$filed = false;
$filed = ($filed || strlen($this->FormParameters["naziv_telefona"][$RowNumber]));
return $filed;
}
//End CheckInsert Method
//CheckErrors Method @45-242E5992
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->ds->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @45-6A172129
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->ds->Prepare();
if(!$this->FormSubmitted)
return;
$this->GetFormParameters();
$this->PressedButton = "Button_Submit";
if(strlen(CCGetParam("Button_Submit", ""))) {
$this->PressedButton = "Button_Submit";
}
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", Array("ccsForm"));
if($this->PressedButton == "Button_Submit") {
if(!CCGetEvent($this->Button_Submit->CCSEvents, "OnClick") || !$this->UpdateGrid()) {
$Redirect = "";
}
} else {
$Redirect = "";
}
}
//End Operation Method
//UpdateGrid Method @45-4B2E6D5D
function UpdateGrid()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSubmit");
if(!$this->Validate()) return;
$Validation = true;
for($RowNumber = 1; $RowNumber <= $this->TotalRows; $RowNumber++)
{
$this->ds->CachedColumns["idtelefona"] = $this->CachedColumns["idtelefona"][$RowNumber];
$this->naziv_telefona->SetText($this->FormParameters["naziv_telefona"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
if ($this->UpdatedRows >= $RowNumber) {
if($this->CheckBox_Delete->Value) {
if($this->DeleteAllowed) { $Validation = ($this->DeleteRow($RowNumber) && $Validation); }
} else if($this->UpdateAllowed) {
$Validation = ($this->UpdateRow($RowNumber) && $Validation);
}
}
else if($this->CheckInsert($RowNumber) && $this->InsertAllowed)
{
$Validation = ($this->InsertRow($RowNumber) && $Validation);
}
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterSubmit");
return ($this->Errors->Count() == 0 && $Validation);
}
//End UpdateGrid Method
//InsertRow Method @45-CA57BA58
function InsertRow($RowNumber)
{
if(!$this->InsertAllowed) return false;
$this->ds->naziv_telefona->SetValue($this->naziv_telefona->GetValue());
$this->ds->Insert();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End InsertRow Method
//UpdateRow Method @45-C472C7EC
function UpdateRow($RowNumber)
{
if(!$this->UpdateAllowed) return false;
$this->ds->naziv_telefona->SetValue($this->naziv_telefona->GetValue());
$this->ds->Update();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End UpdateRow Method
//DeleteRow Method @45-E90CB5E3
function DeleteRow($RowNumber)
{
if(!$this->DeleteAllowed) return false;
$this->ds->Delete();
$errors = "";
if($this->ds->Errors->Count() > 0) {
$errors = $this->ds->Errors->ToString();
$this->RowsErrors[$RowNumber] = $errors;
$this->ds->Errors->Clear();
}
return (($this->Errors->Count() == 0) && !strlen($errors));
}
//End DeleteRow Method
//FormScript Method @45-59800DB5
function FormScript($TotalRows)
{
$script = "";
return $script;
}
//End FormScript Method
//SetFormState Method @45-B51882C7
function SetFormState($FormState)
{
if(strlen($FormState)) {
$FormState = str_replace("\\\\", "\\" . ord("\\"), $FormState);
$FormState = str_replace("\\;", "\\" . ord(";"), $FormState);
$pieces = explode(";", $FormState);
$this->UpdatedRows = $pieces[0];
$this->EmptyRows = $pieces[1];
$this->TotalRows = $this->UpdatedRows + $this->EmptyRows;
$RowNumber = 0;
for($i = 2; $i < sizeof($pieces); $i = $i + 1) {
$piece = $pieces[$i + 0];
$piece = str_replace("\\" . ord("\\"), "\\", $piece);
$piece = str_replace("\\" . ord(";"), ";", $piece);
$this->CachedColumns["idtelefona"][$RowNumber] = $piece;
$RowNumber++;
}
if(!$RowNumber) { $RowNumber = 1; }
for($i = 1; $i <= $this->EmptyRows; $i++) {
$this->CachedColumns["idtelefona"][$RowNumber] = "";
$RowNumber++;
}
}
}
//End SetFormState Method
//GetFormState Method @45-FFEDE308
function GetFormState($NonEmptyRows)
{
if(!$this->FormSubmitted) {
$this->FormState = $NonEmptyRows . ";";
$this->FormState .= $this->InsertAllowed ? $this->EmptyRows : "0";
if($NonEmptyRows) {
for($i = 0; $i <= $NonEmptyRows; $i++) {
$this->FormState .= ";" . str_replace(";", "\\;", str_replace("\\", "\\\\", $this->CachedColumns["idtelefona"][$i]));
}
}
}
return $this->FormState;
}
//End GetFormState Method
//Show Method @45-99A4B69A
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible) { return; }
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->ds->open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) { return; }
$this->Button_Submit->Visible = $this->Button_Submit->Visible && ($this->InsertAllowed || $this->UpdateAllowed || $this->DeleteAllowed);
$ParentPath = $Tpl->block_path;
$EditableGridPath = $ParentPath . "/EditableGrid " . $this->ComponentName;
$EditableGridRowPath = $ParentPath . "/EditableGrid " . $this->ComponentName . "/Row";
$Tpl->block_path = $EditableGridRowPath;
$RowNumber = 0;
$NonEmptyRows = 0;
$EmptyRowsLeft = $this->EmptyRows;
$is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
if($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed))
{
do
{
$RowNumber++;
if($is_next_record) {
$NonEmptyRows++;
$this->ds->SetValues();
} else {
}
if(!$is_next_record || !$this->DeleteAllowed)
$this->CheckBox_Delete->Visible = false;
if(!$this->FormSubmitted && $is_next_record) {
$this->CachedColumns["idtelefona"][$RowNumber] = $this->ds->CachedColumns["idtelefona"];
$this->naziv_telefona->SetValue($this->ds->naziv_telefona->GetValue());
$this->ValidateRow($RowNumber);
} else if (!$this->FormSubmitted){
$this->CachedColumns["idtelefona"][$RowNumber] = "";
$this->naziv_telefona->SetText("");
$this->CheckBox_Delete->SetText("");
} else {
$this->naziv_telefona->SetText($this->FormParameters["naziv_telefona"][$RowNumber], $RowNumber);
$this->CheckBox_Delete->SetText($this->FormParameters["CheckBox_Delete"][$RowNumber], $RowNumber);
}
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->naziv_telefona->Show($RowNumber);
$this->CheckBox_Delete->Show($RowNumber);
if(isset($this->RowsErrors[$RowNumber]) && $this->RowsErrors[$RowNumber] !== "") {
$Tpl->setvar("Error", $this->RowsErrors[$RowNumber]);
$Tpl->parse("RowError", false);
} else {
$Tpl->setblockvar("RowError", "");
}
$Tpl->setvar("FormScript", $this->FormScript($RowNumber));
$Tpl->parse();
if($is_next_record) $is_next_record = $this->ds->next_record() && $this->ReadAllowed && $RowNumber < $this->PageSize;
else $EmptyRowsLeft--;
} while($is_next_record || ($EmptyRowsLeft && $this->InsertAllowed));
} else {
$Tpl->block_path = $EditableGridPath;
$Tpl->parse("NoRecords", false);
}
$Tpl->block_path = $EditableGridPath;
$this->Navigator->PageNumber = $this->ds->AbsolutePage;
$this->Navigator->TotalPages = $this->ds->PageCount();
$this->Navigator->Show();
$this->Button_Submit->Show();
if($this->CheckErrors()) {
$Error .= $this->Errors->ToString();
$Error .= $this->ds->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $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);
$Tpl->SetVar("HTMLFormProperties", "method=\"POST\" action=\"" . $this->HTMLFormAction . "\" name=\"" . $this->ComponentName . "\"");
$Tpl->SetVar("FormState", htmlspecialchars($this->GetFormState($NonEmptyRows)));
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
} //End telefoni1 Class @45-FCB6E20C
class clstelefoni1DataSource extends clsDBConnection1 { //telefoni1DataSource Class @45-5A33F023
//DataSource Variables @45-5FB11416
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $CountSQL;
var $wp;
var $AllParametersSet;
var $CachedColumns;
// Datasource fields
var $naziv_telefona;
var $CheckBox_Delete;
//End DataSource Variables
//DataSourceClass_Initialize Event @45-55E4C0D7
function clstelefoni1DataSource()
{
$this->ErrorBlock = "EditableGrid telefoni1/Error";
$this->Initialize();
$this->naziv_telefona = new clsField("naziv_telefona", ccsMemo, "");
$this->CheckBox_Delete = new clsField("CheckBox_Delete", ccsBoolean, Array("true", "false", ""));
}
//End DataSourceClass_Initialize Event
//SetOrder Method @45-9E1383D1
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @45-DFF3DD87
function Prepare()
{
}
//End Prepare Method
//Open Method @45-23A4BA42
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM telefoni";
$this->SQL = "SELECT * " .
"FROM telefoni";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
}
//End Open Method
//SetValues Method @45-9C640B5C
function SetValues()
{
$this->CachedColumns["idtelefona"] = $this->f("idtelefona");
$this->naziv_telefona->SetDBValue($this->f("naziv_telefona"));
}
//End SetValues Method
//Insert Method @45-68CF0FCB
function Insert()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert");
$this->SQL = "INSERT INTO telefoni ("
. "naziv_telefona"
. ") VALUES ("
. $this->ToSQL($this->naziv_telefona->GetDBValue(), $this->naziv_telefona->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 @45-C25D3228
function Update()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate");
$this->Where = "idtelefona=" . $this->ToSQL($this->CachedColumns["idtelefona"], ccsInteger);
$this->SQL = "UPDATE telefoni SET "
. "naziv_telefona=" . $this->ToSQL($this->naziv_telefona->GetDBValue(), $this->naziv_telefona->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 @45-DFB6E170
function Delete()
{
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete");
$this->Where = "idtelefona=" . $this->ToSQL($this->CachedColumns["idtelefona"], ccsInteger);
$this->SQL = "DELETE FROM telefoni";
$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 telefoni1DataSource Class @45-FCB6E20C
//Include Page implementation @17-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-0938A77C
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "telefoni_list.php";
$Redirect = "";
$TemplateFileName = "telefoni_list.html";
$BlockToParse = "main";
$TemplateEncoding = "";
$FileEncoding = "";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-35987AC8
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader("");
$Header->BindEvents();
$Header->Initialize();
$Header1 = new clsHeader1("");
$Header1->BindEvents();
$Header1->Initialize();
$kategorija = new clsEditableGridkategorija();
$sekcija = new clsEditableGridsekcija();
$telefoni1 = new clsEditableGridtelefoni1();
$Footer = new clsFooter("");
$Footer->BindEvents();
$Footer->Initialize();
$kategorija->Initialize();
$sekcija->Initialize();
$telefoni1->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-B4D051D6
$Header->Operations();
$Header1->Operations();
$kategorija->Operation();
$sekcija->Operation();
$telefoni1->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-8387CF96
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($kategorija);
unset($sekcija);
unset($telefoni1);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-30E99C8A
$Header->Show("Header");
$Header1->Show("Header1");
$kategorija->Show();
$sekcija->Show();
$telefoni1->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-682D13BD
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($kategorija);
unset($sekcija);
unset($telefoni1);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|