Viewing file: izdanja2.php (40.04 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-67366330
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "izdanja2.php");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @13-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
class clsRecordizdanja { //izdanja Class @2-B3E3AB18
//Variables @2-F607D3A5
// Public variables
var $ComponentType = "Record";
var $ComponentName;
var $Parent;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $DataSource;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-B3AEFF0B
function clsRecordizdanja($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record izdanja/Error";
$this->DataSource = new clsizdanjaDataSource($this);
$this->ds = & $this->DataSource;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "izdanja";
$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->subject = & new clsControl(ccsTextArea, "subject", "Subject", ccsMemo, "", CCGetRequestParam("subject", $Method), $this);
$this->subject->Required = true;
$this->body = & new clsControl(ccsTextArea, "body", "Body", ccsMemo, "", CCGetRequestParam("body", $Method), $this);
$this->body->Required = true;
$this->lista = & new clsControl(ccsListBox, "lista", "lista", ccsText, "", CCGetRequestParam("lista", $Method), $this);
$this->lista->DSType = dsTable;
list($this->lista->BoundColumn, $this->lista->TextColumn, $this->lista->DBFormat) = array("id_email_izdanja", "naziv_email_izdanja", "");
$this->lista->DataSource = new clsDBConnection1();
$this->lista->ds = & $this->lista->DataSource;
$this->lista->DataSource->SQL = "SELECT * " .
"FROM e_mail_izdanja {SQL_Where} {SQL_OrderBy}";
$this->datum = & new clsControl(ccsHidden, "datum", "Datum", ccsDate, $DefaultDateFormat, CCGetRequestParam("datum", $Method), $this);
$this->datum->Required = true;
$this->ListBox1 = & new clsControl(ccsListBox, "ListBox1", "ListBox1", ccsText, "", CCGetRequestParam("ListBox1", $Method), $this);
$this->ListBox1->DSType = dsTable;
list($this->ListBox1->BoundColumn, $this->ListBox1->TextColumn, $this->ListBox1->DBFormat) = array("nazivfajla", "datum_fajla", "");
$this->ListBox1->DataSource = new clsDBConnection1();
$this->ListBox1->ds = & $this->ListBox1->DataSource;
$this->ListBox1->DataSource->SQL = "SELECT * " .
"FROM fajlovi {SQL_Where} {SQL_OrderBy}";
$this->ListBox1->DataSource->Order = "datum_fajla desc";
$this->ListBox1->DataSource->Order = "datum_fajla desc";
$this->Button_Insert = & new clsButton("Button_Insert", $Method, $this);
$this->Button_Update = & new clsButton("Button_Update", $Method, $this);
$this->Button_Delete = & new clsButton("Button_Delete", $Method, $this);
if(!$this->FormSubmitted) {
if(!is_array($this->datum->Value) && !strlen($this->datum->Value) && $this->datum->Value !== false)
$this->datum->SetValue(time());
}
}
}
//End Class_Initialize Event
//Initialize Method @2-ACDF5B71
function Initialize()
{
if(!$this->Visible)
return;
$this->DataSource->Parameters["urlbr_izdanja"] = CCGetFromGet("br_izdanja", "");
}
//End Initialize Method
//Validate Method @2-F287DA45
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->subject->Validate() && $Validation);
$Validation = ($this->body->Validate() && $Validation);
$Validation = ($this->lista->Validate() && $Validation);
$Validation = ($this->datum->Validate() && $Validation);
$Validation = ($this->ListBox1->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->subject->Errors->Count() == 0);
$Validation = $Validation && ($this->body->Errors->Count() == 0);
$Validation = $Validation && ($this->lista->Errors->Count() == 0);
$Validation = $Validation && ($this->datum->Errors->Count() == 0);
$Validation = $Validation && ($this->ListBox1->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-8042AF57
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->subject->Errors->Count());
$errors = ($errors || $this->body->Errors->Count());
$errors = ($errors || $this->lista->Errors->Count());
$errors = ($errors || $this->datum->Errors->Count());
$errors = ($errors || $this->ListBox1->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-62F205DB
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->DataSource->Prepare();
if(!$this->FormSubmitted) {
$this->EditMode = $this->DataSource->AllParametersSet;
return;
}
if($this->FormSubmitted) {
$this->PressedButton = $this->EditMode ? "Button_Update" : "Button_Insert";
if($this->Button_Insert->Pressed) {
$this->PressedButton = "Button_Insert";
} else if($this->Button_Update->Pressed) {
$this->PressedButton = "Button_Update";
} else if($this->Button_Delete->Pressed) {
$this->PressedButton = "Button_Delete";
}
}
$Redirect = "izdanja_list.php" . "?" . CCGetQueryString("QueryString", array("ccsForm"));
if($this->PressedButton == "Button_Delete") {
if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick", $this->Button_Delete) || !$this->DeleteRow()) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Button_Insert") {
if(!CCGetEvent($this->Button_Insert->CCSEvents, "OnClick", $this->Button_Insert) || !$this->InsertRow()) {
$Redirect = "";
}
} else if($this->PressedButton == "Button_Update") {
if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick", $this->Button_Update) || !$this->UpdateRow()) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
if ($Redirect)
$this->DataSource->close();
}
//End Operation Method
//InsertRow Method @2-9785F36D
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
if(!$this->InsertAllowed) return false;
$this->DataSource->subject->SetValue($this->subject->GetValue());
$this->DataSource->body->SetValue($this->body->GetValue());
$this->DataSource->lista->SetValue($this->lista->GetValue());
$this->DataSource->datum->SetValue($this->datum->GetValue());
$this->DataSource->ListBox1->SetValue($this->ListBox1->GetValue());
$this->DataSource->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-CEA1DC7B
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
if(!$this->UpdateAllowed) return false;
$this->DataSource->subject->SetValue($this->subject->GetValue());
$this->DataSource->body->SetValue($this->body->GetValue());
$this->DataSource->lista->SetValue($this->lista->GetValue());
$this->DataSource->datum->SetValue($this->datum->GetValue());
$this->DataSource->ListBox1->SetValue($this->ListBox1->GetValue());
$this->DataSource->Update();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate", $this);
return (!$this->CheckErrors());
}
//End UpdateRow Method
//DeleteRow Method @2-299D98C3
function DeleteRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete", $this);
if(!$this->DeleteAllowed) return false;
$this->DataSource->Delete();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete", $this);
return (!$this->CheckErrors());
}
//End DeleteRow Method
//Show Method @2-F23CA914
function Show()
{
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->lista->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) {
if($this->DataSource->Errors->Count()){
$this->Errors->AddErrors($this->DataSource->Errors);
$this->DataSource->Errors->clear();
}
$this->DataSource->Open();
if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
$this->DataSource->SetValues();
if(!$this->FormSubmitted){
$this->subject->SetValue($this->DataSource->subject->GetValue());
$this->body->SetValue($this->DataSource->body->GetValue());
$this->lista->SetValue($this->DataSource->lista->GetValue());
$this->datum->SetValue($this->DataSource->datum->GetValue());
$this->ListBox1->SetValue($this->DataSource->ListBox1->GetValue());
}
} else {
$this->EditMode = false;
}
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->subject->Errors->ToString());
$Error = ComposeStrings($Error, $this->body->Errors->ToString());
$Error = ComposeStrings($Error, $this->lista->Errors->ToString());
$Error = ComposeStrings($Error, $this->datum->Errors->ToString());
$Error = ComposeStrings($Error, $this->ListBox1->Errors->ToString());
$Error = ComposeStrings($Error, $this->Errors->ToString());
$Error = ComposeStrings($Error, $this->DataSource->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", $this);
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->subject->Show();
$this->body->Show();
$this->lista->Show();
$this->datum->Show();
$this->ListBox1->Show();
$this->Button_Insert->Show();
$this->Button_Update->Show();
$this->Button_Delete->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
} //End izdanja Class @2-FCB6E20C
class clsizdanjaDataSource extends clsDBConnection1 { //izdanjaDataSource Class @2-A8BDB0FC
//DataSource Variables @2-B7935B71
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $subject;
var $body;
var $lista;
var $datum;
var $ListBox1;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-39ABB27D
function clsizdanjaDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Record izdanja/Error";
$this->Initialize();
$this->subject = new clsField("subject", ccsMemo, "");
$this->body = new clsField("body", ccsMemo, "");
$this->lista = new clsField("lista", ccsText, "");
$this->datum = new clsField("datum", ccsDate, array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->ListBox1 = new clsField("ListBox1", ccsText, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @2-C7779FDE
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlbr_izdanja", ccsInteger, "", "", $this->Parameters["urlbr_izdanja"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "br_izdanja", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-4E6AABE4
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->SQL = "SELECT * " .
"FROM izdanja {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
$this->PageSize = 1;
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @2-7EA4BE17
function SetValues()
{
$this->subject->SetDBValue($this->f("subject"));
$this->body->SetDBValue($this->f("body"));
$this->lista->SetDBValue($this->f("tip_zidanja"));
$this->datum->SetDBValue(trim($this->f("datum")));
$this->ListBox1->SetDBValue($this->f("file_izdanja"));
}
//End SetValues Method
//Insert Method @2-FDE7C21D
function Insert()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent);
$this->SQL = "INSERT INTO izdanja ("
. "subject, "
. "body, "
. "tip_zidanja, "
. "datum, "
. "file_izdanja"
. ") VALUES ("
. $this->ToSQL($this->subject->GetDBValue(), $this->subject->DataType) . ", "
. $this->ToSQL($this->body->GetDBValue(), $this->body->DataType) . ", "
. $this->ToSQL($this->lista->GetDBValue(), $this->lista->DataType) . ", "
. $this->ToSQL($this->datum->GetDBValue(), $this->datum->DataType) . ", "
. $this->ToSQL($this->ListBox1->GetDBValue(), $this->ListBox1->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert", $this->Parent);
}
}
//End Insert Method
//Update Method @2-2D3BC93B
function Update()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
$this->SQL = "UPDATE izdanja SET "
. "subject=" . $this->ToSQL($this->subject->GetDBValue(), $this->subject->DataType) . ", "
. "body=" . $this->ToSQL($this->body->GetDBValue(), $this->body->DataType) . ", "
. "tip_zidanja=" . $this->ToSQL($this->lista->GetDBValue(), $this->lista->DataType) . ", "
. "datum=" . $this->ToSQL($this->datum->GetDBValue(), $this->datum->DataType) . ", "
. "file_izdanja=" . $this->ToSQL($this->ListBox1->GetDBValue(), $this->ListBox1->DataType);
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate", $this->Parent);
}
}
//End Update Method
//Delete Method @2-154A5FCF
function Delete()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent);
$this->SQL = "DELETE FROM izdanja";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete", $this->Parent);
}
}
//End Delete Method
} //End izdanjaDataSource Class @2-FCB6E20C
class clsRecordfajlovi { //fajlovi Class @21-A8D96338
//Variables @21-F607D3A5
// Public variables
var $ComponentType = "Record";
var $ComponentName;
var $Parent;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $DataSource;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @21-9DBC10C7
function clsRecordfajlovi($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record fajlovi/Error";
$this->DataSource = new clsfajloviDataSource($this);
$this->ds = & $this->DataSource;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "fajlovi";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$this->FormEnctype = "multipart/form-data";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->FileUpload1 = & new clsFileUpload("FileUpload1", "FileUpload1", "/home/mnnews/public_html/temp/", "/home/mnnews/public_html/dokumenti/", "*", "", 2000000, $this);
$this->id_izdanja = & new clsControl(ccsListBox, "id_izdanja", "Id Izdanja", ccsInteger, "", CCGetRequestParam("id_izdanja", $Method), $this);
$this->id_izdanja->DSType = dsTable;
list($this->id_izdanja->BoundColumn, $this->id_izdanja->TextColumn, $this->id_izdanja->DBFormat) = array("id_email_izdanja", "naziv_email_izdanja", "");
$this->id_izdanja->DataSource = new clsDBConnection1();
$this->id_izdanja->ds = & $this->id_izdanja->DataSource;
$this->id_izdanja->DataSource->SQL = "SELECT * " .
"FROM e_mail_izdanja {SQL_Where} {SQL_OrderBy}";
$this->id_izdanja->Required = true;
$this->datum_fajla = & new clsControl(ccsHidden, "datum_fajla", "Datum Fajla", ccsDate, $DefaultDateFormat, CCGetRequestParam("datum_fajla", $Method), $this);
$this->datum_fajla->Required = true;
$this->Button_Insert = & new clsButton("Button_Insert", $Method, $this);
$this->Button_Update = & new clsButton("Button_Update", $Method, $this);
$this->Button_Delete = & new clsButton("Button_Delete", $Method, $this);
if(!$this->FormSubmitted) {
if(!is_array($this->datum_fajla->Value) && !strlen($this->datum_fajla->Value) && $this->datum_fajla->Value !== false)
$this->datum_fajla->SetValue(time());
}
}
}
//End Class_Initialize Event
//Initialize Method @21-695BA8BC
function Initialize()
{
if(!$this->Visible)
return;
$this->DataSource->Parameters["urlid_fajla"] = CCGetFromGet("id_fajla", "");
}
//End Initialize Method
//Validate Method @21-9C5BC293
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->FileUpload1->Validate() && $Validation);
$Validation = ($this->id_izdanja->Validate() && $Validation);
$Validation = ($this->datum_fajla->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->FileUpload1->Errors->Count() == 0);
$Validation = $Validation && ($this->id_izdanja->Errors->Count() == 0);
$Validation = $Validation && ($this->datum_fajla->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @21-13883FD1
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->FileUpload1->Errors->Count());
$errors = ($errors || $this->id_izdanja->Errors->Count());
$errors = ($errors || $this->datum_fajla->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @21-F050A303
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->DataSource->Prepare();
if(!$this->FormSubmitted) {
$this->EditMode = $this->DataSource->AllParametersSet;
return;
}
$this->FileUpload1->Upload();
if($this->FormSubmitted) {
$this->PressedButton = $this->EditMode ? "Button_Update" : "Button_Insert";
if($this->Button_Insert->Pressed) {
$this->PressedButton = "Button_Insert";
} else if($this->Button_Update->Pressed) {
$this->PressedButton = "Button_Update";
} else if($this->Button_Delete->Pressed) {
$this->PressedButton = "Button_Delete";
}
}
$Redirect = "izdanja2.php" . "?" . CCGetQueryString("QueryString", array("ccsForm"));
if($this->PressedButton == "Button_Delete") {
if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick", $this->Button_Delete) || !$this->DeleteRow()) {
$Redirect = "";
}
} else if($this->Validate()) {
if($this->PressedButton == "Button_Insert") {
if(!CCGetEvent($this->Button_Insert->CCSEvents, "OnClick", $this->Button_Insert) || !$this->InsertRow()) {
$Redirect = "";
}
} else if($this->PressedButton == "Button_Update") {
if(!CCGetEvent($this->Button_Update->CCSEvents, "OnClick", $this->Button_Update) || !$this->UpdateRow()) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
if ($Redirect)
$this->DataSource->close();
}
//End Operation Method
//InsertRow Method @21-E5B43FC8
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
if(!$this->InsertAllowed) return false;
$this->DataSource->FileUpload1->SetValue($this->FileUpload1->GetValue());
$this->DataSource->id_izdanja->SetValue($this->id_izdanja->GetValue());
$this->DataSource->datum_fajla->SetValue($this->datum_fajla->GetValue());
$this->DataSource->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
if($this->DataSource->Errors->Count() == 0) {
$this->FileUpload1->Move();
}
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @21-B49D55DA
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
if(!$this->UpdateAllowed) return false;
$this->DataSource->FileUpload1->SetValue($this->FileUpload1->GetValue());
$this->DataSource->id_izdanja->SetValue($this->id_izdanja->GetValue());
$this->DataSource->datum_fajla->SetValue($this->datum_fajla->GetValue());
$this->DataSource->Update();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterUpdate", $this);
if($this->DataSource->Errors->Count() == 0) {
$this->FileUpload1->Move();
}
return (!$this->CheckErrors());
}
//End UpdateRow Method
//DeleteRow Method @21-2B077D44
function DeleteRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeDelete", $this);
if(!$this->DeleteAllowed) return false;
$this->DataSource->Delete();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterDelete", $this);
if($this->DataSource->Errors->Count() == 0) {
$this->FileUpload1->Delete();
}
return (!$this->CheckErrors());
}
//End DeleteRow Method
//Show Method @21-F06A922E
function Show()
{
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->id_izdanja->Prepare();
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if($this->EditMode) {
if($this->DataSource->Errors->Count()){
$this->Errors->AddErrors($this->DataSource->Errors);
$this->DataSource->Errors->clear();
}
$this->DataSource->Open();
if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
$this->DataSource->SetValues();
if(!$this->FormSubmitted){
$this->FileUpload1->SetValue($this->DataSource->FileUpload1->GetValue());
$this->id_izdanja->SetValue($this->DataSource->id_izdanja->GetValue());
$this->datum_fajla->SetValue($this->DataSource->datum_fajla->GetValue());
}
} else {
$this->EditMode = false;
}
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->FileUpload1->Errors->ToString());
$Error = ComposeStrings($Error, $this->id_izdanja->Errors->ToString());
$Error = ComposeStrings($Error, $this->datum_fajla->Errors->ToString());
$Error = ComposeStrings($Error, $this->Errors->ToString());
$Error = ComposeStrings($Error, $this->DataSource->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", $this);
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->FileUpload1->Show();
$this->id_izdanja->Show();
$this->datum_fajla->Show();
$this->Button_Insert->Show();
$this->Button_Update->Show();
$this->Button_Delete->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
} //End fajlovi Class @21-FCB6E20C
class clsfajloviDataSource extends clsDBConnection1 { //fajloviDataSource Class @21-33D94821
//DataSource Variables @21-CA5B4321
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $FileUpload1;
var $id_izdanja;
var $datum_fajla;
//End DataSource Variables
//DataSourceClass_Initialize Event @21-FC0DF01F
function clsfajloviDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Record fajlovi/Error";
$this->Initialize();
$this->FileUpload1 = new clsField("FileUpload1", ccsText, "");
$this->id_izdanja = new clsField("id_izdanja", ccsInteger, "");
$this->datum_fajla = new clsField("datum_fajla", ccsDate, array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
}
//End DataSourceClass_Initialize Event
//Prepare Method @21-E16EFDB8
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlid_fajla", ccsInteger, "", "", $this->Parameters["urlid_fajla"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "id_fajla", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @21-4CC1143F
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->SQL = "SELECT * " .
"FROM fajlovi {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
$this->PageSize = 1;
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @21-32C030AE
function SetValues()
{
$this->FileUpload1->SetDBValue($this->f("nazivfajla"));
$this->id_izdanja->SetDBValue(trim($this->f("id_izdanja")));
$this->datum_fajla->SetDBValue(trim($this->f("datum_fajla")));
}
//End SetValues Method
//Insert Method @21-001B920D
function Insert()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent);
$this->SQL = "INSERT INTO fajlovi ("
. "nazivfajla, "
. "id_izdanja, "
. "datum_fajla"
. ") VALUES ("
. $this->ToSQL($this->FileUpload1->GetDBValue(), $this->FileUpload1->DataType) . ", "
. $this->ToSQL($this->id_izdanja->GetDBValue(), $this->id_izdanja->DataType) . ", "
. $this->ToSQL($this->datum_fajla->GetDBValue(), $this->datum_fajla->DataType)
. ")";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert", $this->Parent);
}
}
//End Insert Method
//Update Method @21-F15CF1A3
function Update()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
$this->SQL = "UPDATE fajlovi SET "
. "nazivfajla=" . $this->ToSQL($this->FileUpload1->GetDBValue(), $this->FileUpload1->DataType) . ", "
. "id_izdanja=" . $this->ToSQL($this->id_izdanja->GetDBValue(), $this->id_izdanja->DataType) . ", "
. "datum_fajla=" . $this->ToSQL($this->datum_fajla->GetDBValue(), $this->datum_fajla->DataType);
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate", $this->Parent);
}
}
//End Update Method
//Delete Method @21-2C58EFAD
function Delete()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent);
$this->SQL = "DELETE FROM fajlovi";
$this->SQL = CCBuildSQL($this->SQL, $this->Where, "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteDelete", $this->Parent);
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteDelete", $this->Parent);
}
}
//End Delete Method
} //End fajloviDataSource Class @21-FCB6E20C
//Include Page implementation @14-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-6FB2FA47
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "izdanja2.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Include events file @1-DFF886A0
include("./izdanja2_events.php");
//End Include events file
//Initialize Objects @1-61657B47
$DBConnection1 = new clsDBConnection1();
$MainPage->Connections["Connection1"] = & $DBConnection1;
// Controls
$Header = & new clsHeader("", "Header", $MainPage);
$Header->Initialize();
$izdanja = & new clsRecordizdanja("", $MainPage);
$fajlovi = & new clsRecordfajlovi("", $MainPage);
$Footer = & new clsFooter("", "Footer", $MainPage);
$Footer->Initialize();
$MainPage->Header = & $Header;
$MainPage->izdanja = & $izdanja;
$MainPage->fajlovi = & $fajlovi;
$MainPage->Footer = & $Footer;
$izdanja->Initialize();
$fajlovi->Initialize();
BindEvents();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-8F4531F3
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
//End Initialize HTML Template
//Execute Components @1-D88B28EE
$Header->Operations();
$izdanja->Operation();
$fajlovi->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-C083C54A
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
unset($izdanja);
unset($fajlovi);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-4029C8FC
$Header->Show();
$izdanja->Show();
$fajlovi->Show();
$Footer->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
$main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page
//Unload Page @1-3E89D9F9
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
unset($izdanja);
unset($fajlovi);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|