Viewing file: izdanja2.php (42.01 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-9E315808
// Public variables public $ComponentType = "Record"; public $ComponentName; public $Parent; public $HTMLFormAction; public $PressedButton; public $Errors; public $ErrorBlock; public $FormSubmitted; public $FormEnctype; public $Visible; public $IsEmpty;
public $CCSEvents = ""; public $CCSEventResult;
public $RelativePath = "";
public $InsertAllowed = false; public $UpdateAllowed = false; public $DeleteAllowed = false; public $ReadAllowed = false; public $EditMode = false; public $ds; public $DataSource; public $ValidatingControls; public $Controls; public $Attributes;
// Class variables //End Variables
//Class_Initialize Event @2-1BE67BB4 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"; $this->Attributes = new clsAttributes($this->ComponentName . ":"); $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, NULL), $this); $this->subject->Required = true; $this->body = new clsControl(ccsTextArea, "body", "Body", ccsMemo, "", CCGetRequestParam("body", $Method, NULL), $this); $this->body->Required = true; $this->lista = new clsControl(ccsListBox, "lista", "lista", ccsText, "", CCGetRequestParam("lista", $Method, NULL), $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 * \n" . "FROM e_mail_izdanja {SQL_Where} {SQL_OrderBy}"; $this->datum = new clsControl(ccsHidden, "datum", "Datum", ccsDate, $DefaultDateFormat, CCGetRequestParam("datum", $Method, NULL), $this); $this->datum->Required = true; $this->ListBox1 = new clsControl(ccsListBox, "ListBox1", "ListBox1", ccsText, "", CCGetRequestParam("ListBox1", $Method, NULL), $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 * \n" . "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-0FFC61CE function Initialize() {
if(!$this->Visible) return;
$this->DataSource->Parameters["urlbr_izdanja"] = CCGetFromGet("br_izdanja", NULL); } //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-DF395E8B function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this); if(!$this->InsertAllowed) return false; $this->DataSource->subject->SetValue($this->subject->GetValue(true)); $this->DataSource->body->SetValue($this->body->GetValue(true)); $this->DataSource->lista->SetValue($this->lista->GetValue(true)); $this->DataSource->datum->SetValue($this->datum->GetValue(true)); $this->DataSource->ListBox1->SetValue($this->ListBox1->GetValue(true)); $this->DataSource->Insert(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this); return (!$this->CheckErrors()); } //End InsertRow Method
//UpdateRow Method @2-6B920D5C function UpdateRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this); if(!$this->UpdateAllowed) return false; $this->DataSource->subject->SetValue($this->subject->GetValue(true)); $this->DataSource->body->SetValue($this->body->GetValue(true)); $this->DataSource->lista->SetValue($this->lista->GetValue(true)); $this->DataSource->datum->SetValue($this->datum->GetValue(true)); $this->DataSource->ListBox1->SetValue($this->ListBox1->GetValue(true)); $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-4BB655A8 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); $this->Attributes->Show(); 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-835A0D80 public $Parent = ""; public $CCSEvents = ""; public $CCSEventResult; public $ErrorBlock; public $CmdExecution;
public $InsertParameters; public $UpdateParameters; public $DeleteParameters; public $wp; public $AllParametersSet;
public $InsertFields = array(); public $UpdateFields = array();
// Datasource fields public $subject; public $body; public $lista; public $datum; public $ListBox1; //End DataSource Variables
//DataSourceClass_Initialize Event @2-A5CC21AC 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, "");
$this->InsertFields["subject"] = array("Name" => "subject", "Value" => "", "DataType" => ccsMemo); $this->InsertFields["body"] = array("Name" => "body", "Value" => "", "DataType" => ccsMemo); $this->InsertFields["tip_zidanja"] = array("Name" => "tip_zidanja", "Value" => "", "DataType" => ccsText); $this->InsertFields["datum"] = array("Name" => "datum", "Value" => "", "DataType" => ccsDate); $this->InsertFields["file_izdanja"] = array("Name" => "file_izdanja", "Value" => "", "DataType" => ccsText); $this->UpdateFields["subject"] = array("Name" => "subject", "Value" => "", "DataType" => ccsMemo); $this->UpdateFields["body"] = array("Name" => "body", "Value" => "", "DataType" => ccsMemo); $this->UpdateFields["tip_zidanja"] = array("Name" => "tip_zidanja", "Value" => "", "DataType" => ccsText); $this->UpdateFields["datum"] = array("Name" => "datum", "Value" => "", "DataType" => ccsDate); $this->UpdateFields["file_izdanja"] = array("Name" => "file_izdanja", "Value" => "", "DataType" => 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-C968C7C2 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent); $this->SQL = "SELECT * \n\n" . "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-79C1544C function Insert() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent); $this->InsertFields["subject"]["Value"] = $this->subject->GetDBValue(true); $this->InsertFields["body"]["Value"] = $this->body->GetDBValue(true); $this->InsertFields["tip_zidanja"]["Value"] = $this->lista->GetDBValue(true); $this->InsertFields["datum"]["Value"] = $this->datum->GetDBValue(true); $this->InsertFields["file_izdanja"]["Value"] = $this->ListBox1->GetDBValue(true); $this->SQL = CCBuildInsert("izdanja", $this->InsertFields, $this); $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-3A6CB328 function Update() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent); $this->UpdateFields["subject"]["Value"] = $this->subject->GetDBValue(true); $this->UpdateFields["body"]["Value"] = $this->body->GetDBValue(true); $this->UpdateFields["tip_zidanja"]["Value"] = $this->lista->GetDBValue(true); $this->UpdateFields["datum"]["Value"] = $this->datum->GetDBValue(true); $this->UpdateFields["file_izdanja"]["Value"] = $this->ListBox1->GetDBValue(true); $this->SQL = CCBuildUpdate("izdanja", $this->UpdateFields, $this); $this->SQL = CCBuildSQL($this->SQL, $this->Where, ""); if (!strlen($this->Where) && $this->Errors->Count() == 0) $this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters")); $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-92C1B4C4 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, ""); if (!strlen($this->Where) && $this->Errors->Count() == 0) $this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters")); $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-9E315808
// Public variables public $ComponentType = "Record"; public $ComponentName; public $Parent; public $HTMLFormAction; public $PressedButton; public $Errors; public $ErrorBlock; public $FormSubmitted; public $FormEnctype; public $Visible; public $IsEmpty;
public $CCSEvents = ""; public $CCSEventResult;
public $RelativePath = "";
public $InsertAllowed = false; public $UpdateAllowed = false; public $DeleteAllowed = false; public $ReadAllowed = false; public $EditMode = false; public $ds; public $DataSource; public $ValidatingControls; public $Controls; public $Attributes;
// Class variables //End Variables
//Class_Initialize Event @21-1105A58D 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"; $this->Attributes = new clsAttributes($this->ComponentName . ":"); $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, NULL), $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 * \n" . "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, NULL), $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-551CAEEF function Initialize() {
if(!$this->Visible) return;
$this->DataSource->Parameters["urlid_fajla"] = CCGetFromGet("id_fajla", NULL); } //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-0DA3EDBA function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this); if(!$this->InsertAllowed) return false; $this->DataSource->FileUpload1->SetValue($this->FileUpload1->GetValue(true)); $this->DataSource->id_izdanja->SetValue($this->id_izdanja->GetValue(true)); $this->DataSource->datum_fajla->SetValue($this->datum_fajla->GetValue(true)); $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-2F6329A3 function UpdateRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this); if(!$this->UpdateAllowed) return false; $this->DataSource->FileUpload1->SetValue($this->FileUpload1->GetValue(true)); $this->DataSource->id_izdanja->SetValue($this->id_izdanja->GetValue(true)); $this->DataSource->datum_fajla->SetValue($this->datum_fajla->GetValue(true)); $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-762443E2 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); $this->Attributes->Show(); 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-3128A4D2 public $Parent = ""; public $CCSEvents = ""; public $CCSEventResult; public $ErrorBlock; public $CmdExecution;
public $InsertParameters; public $UpdateParameters; public $DeleteParameters; public $wp; public $AllParametersSet;
public $InsertFields = array(); public $UpdateFields = array();
// Datasource fields public $FileUpload1; public $id_izdanja; public $datum_fajla; //End DataSource Variables
//DataSourceClass_Initialize Event @21-1AC88838 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"));
$this->InsertFields["nazivfajla"] = array("Name" => "nazivfajla", "Value" => "", "DataType" => ccsText); $this->InsertFields["id_izdanja"] = array("Name" => "id_izdanja", "Value" => "", "DataType" => ccsInteger); $this->InsertFields["datum_fajla"] = array("Name" => "datum_fajla", "Value" => "", "DataType" => ccsDate); $this->UpdateFields["nazivfajla"] = array("Name" => "nazivfajla", "Value" => "", "DataType" => ccsText); $this->UpdateFields["id_izdanja"] = array("Name" => "id_izdanja", "Value" => "", "DataType" => ccsInteger); $this->UpdateFields["datum_fajla"] = array("Name" => "datum_fajla", "Value" => "", "DataType" => ccsDate); } //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-CBC37819 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent); $this->SQL = "SELECT * \n\n" . "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-5E67359F function Insert() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent); $this->InsertFields["nazivfajla"]["Value"] = $this->FileUpload1->GetDBValue(true); $this->InsertFields["id_izdanja"]["Value"] = $this->id_izdanja->GetDBValue(true); $this->InsertFields["datum_fajla"]["Value"] = $this->datum_fajla->GetDBValue(true); $this->SQL = CCBuildInsert("fajlovi", $this->InsertFields, $this); $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-D07583F4 function Update() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent); $this->UpdateFields["nazivfajla"]["Value"] = $this->FileUpload1->GetDBValue(true); $this->UpdateFields["id_izdanja"]["Value"] = $this->id_izdanja->GetDBValue(true); $this->UpdateFields["datum_fajla"]["Value"] = $this->datum_fajla->GetDBValue(true); $this->SQL = CCBuildUpdate("fajlovi", $this->UpdateFields, $this); $this->SQL = CCBuildSQL($this->SQL, $this->Where, ""); if (!strlen($this->Where) && $this->Errors->Count() == 0) $this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters")); $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-8FA1A8E3 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, ""); if (!strlen($this->Where) && $this->Errors->Count() == 0) $this->Errors->addError($CCSLocales->GetText("CCS_CustomOperationError_MissingParameters")); $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-B0D96763 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; $Attributes = "";
// 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
//Before Initialize @1-E870CEBC $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage); //End Before Initialize
//Initialize Objects @1-72B3F3E5 $DBConnection1 = new clsDBConnection1(); $MainPage->Connections["Connection1"] = & $DBConnection1; $Attributes = new clsAttributes("page:"); $MainPage->Attributes = & $Attributes;
// 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-593C2978 $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); $Attributes->Show(); //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
?>
|