Viewing file: e_mail_adr_maint.php (19.96 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-5FB4B541
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "e_mail_adr_maint.php");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @11-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
class clsRecorde_mail_adrese_korisnika { //e_mail_adrese_korisnika Class @2-E85A46FB
//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-8AF3450C
function clsRecorde_mail_adrese_korisnika($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record e_mail_adrese_korisnika/Error";
$this->DataSource = new clse_mail_adrese_korisnikaDataSource($this);
$this->ds = & $this->DataSource;
$this->InsertAllowed = true;
$this->UpdateAllowed = true;
$this->DeleteAllowed = true;
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "e_mail_adrese_korisnika";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->id_korisnika = & new clsControl(ccsTextBox, "id_korisnika", "Id Korisnika", ccsInteger, "", CCGetRequestParam("id_korisnika", $Method), $this);
$this->id_korisnika->Required = true;
$this->e_mail_korisnika = & new clsControl(ccsTextBox, "e_mail_korisnika", "E Mail Korisnika", ccsText, "", CCGetRequestParam("e_mail_korisnika", $Method), $this);
$this->e_mail_korisnika->Required = true;
$this->id_izdanja = & new clsControl(ccsTextBox, "id_izdanja", "Id Izdanja", ccsInteger, "", CCGetRequestParam("id_izdanja", $Method), $this);
$this->id_izdanja->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);
}
}
//End Class_Initialize Event
//Initialize Method @2-5D41EB7D
function Initialize()
{
if(!$this->Visible)
return;
$this->DataSource->Parameters["urlid_email_adr"] = CCGetFromGet("id_email_adr", "");
}
//End Initialize Method
//Validate Method @2-89068EF9
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->id_korisnika->Validate() && $Validation);
$Validation = ($this->e_mail_korisnika->Validate() && $Validation);
$Validation = ($this->id_izdanja->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->id_korisnika->Errors->Count() == 0);
$Validation = $Validation && ($this->e_mail_korisnika->Errors->Count() == 0);
$Validation = $Validation && ($this->id_izdanja->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-355BB036
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->id_korisnika->Errors->Count());
$errors = ($errors || $this->e_mail_korisnika->Errors->Count());
$errors = ($errors || $this->id_izdanja->Errors->Count());
$errors = ($errors || $this->Errors->Count());
$errors = ($errors || $this->DataSource->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-1206B7DF
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 = "e_mail_adr_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-10B75DD6
function InsertRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
if(!$this->InsertAllowed) return false;
$this->DataSource->id_korisnika->SetValue($this->id_korisnika->GetValue());
$this->DataSource->e_mail_korisnika->SetValue($this->e_mail_korisnika->GetValue());
$this->DataSource->id_izdanja->SetValue($this->id_izdanja->GetValue());
$this->DataSource->Insert();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
return (!$this->CheckErrors());
}
//End InsertRow Method
//UpdateRow Method @2-5D25A463
function UpdateRow()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this);
if(!$this->UpdateAllowed) return false;
$this->DataSource->id_korisnika->SetValue($this->id_korisnika->GetValue());
$this->DataSource->e_mail_korisnika->SetValue($this->e_mail_korisnika->GetValue());
$this->DataSource->id_izdanja->SetValue($this->id_izdanja->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-3B8EEF8C
function Show()
{
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$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->id_korisnika->SetValue($this->DataSource->id_korisnika->GetValue());
$this->e_mail_korisnika->SetValue($this->DataSource->e_mail_korisnika->GetValue());
$this->id_izdanja->SetValue($this->DataSource->id_izdanja->GetValue());
}
} else {
$this->EditMode = false;
}
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->id_korisnika->Errors->ToString());
$Error = ComposeStrings($Error, $this->e_mail_korisnika->Errors->ToString());
$Error = ComposeStrings($Error, $this->id_izdanja->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->id_korisnika->Show();
$this->e_mail_korisnika->Show();
$this->id_izdanja->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 e_mail_adrese_korisnika Class @2-FCB6E20C
class clse_mail_adrese_korisnikaDataSource extends clsDBConnection1 { //e_mail_adrese_korisnikaDataSource Class @2-5E68E873
//DataSource Variables @2-F49FE7D7
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $InsertParameters;
var $UpdateParameters;
var $DeleteParameters;
var $wp;
var $AllParametersSet;
// Datasource fields
var $id_korisnika;
var $e_mail_korisnika;
var $id_izdanja;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-78E90852
function clse_mail_adrese_korisnikaDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Record e_mail_adrese_korisnika/Error";
$this->Initialize();
$this->id_korisnika = new clsField("id_korisnika", ccsInteger, "");
$this->e_mail_korisnika = new clsField("e_mail_korisnika", ccsText, "");
$this->id_izdanja = new clsField("id_izdanja", ccsInteger, "");
}
//End DataSourceClass_Initialize Event
//Prepare Method @2-83007B11
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlid_email_adr", ccsInteger, "", "", $this->Parameters["urlid_email_adr"], "", false);
$this->AllParametersSet = $this->wp->AllParamsSet();
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "id_email_adr", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-3D3C1B99
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->SQL = "SELECT * " .
"FROM e_mail_adrese_korisnika {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-CDCB02F8
function SetValues()
{
$this->id_korisnika->SetDBValue(trim($this->f("id_korisnika")));
$this->e_mail_korisnika->SetDBValue($this->f("e_mail_korisnika"));
$this->id_izdanja->SetDBValue(trim($this->f("id_izdanja")));
}
//End SetValues Method
//Insert Method @2-94245E5E
function Insert()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent);
$this->SQL = "INSERT INTO e_mail_adrese_korisnika ("
. "id_korisnika, "
. "e_mail_korisnika, "
. "id_izdanja"
. ") VALUES ("
. $this->ToSQL($this->id_korisnika->GetDBValue(), $this->id_korisnika->DataType) . ", "
. $this->ToSQL($this->e_mail_korisnika->GetDBValue(), $this->e_mail_korisnika->DataType) . ", "
. $this->ToSQL($this->id_izdanja->GetDBValue(), $this->id_izdanja->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-C8689C32
function Update()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent);
$this->SQL = "UPDATE e_mail_adrese_korisnika SET "
. "id_korisnika=" . $this->ToSQL($this->id_korisnika->GetDBValue(), $this->id_korisnika->DataType) . ", "
. "e_mail_korisnika=" . $this->ToSQL($this->e_mail_korisnika->GetDBValue(), $this->e_mail_korisnika->DataType) . ", "
. "id_izdanja=" . $this->ToSQL($this->id_izdanja->GetDBValue(), $this->id_izdanja->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-73AEF081
function Delete()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->CmdExecution = true;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent);
$this->SQL = "DELETE FROM e_mail_adrese_korisnika";
$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 e_mail_adrese_korisnikaDataSource Class @2-FCB6E20C
//Include Page implementation @12-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-5CF59BFA
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "e_mail_adr_maint.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-F62A756B
$DBConnection1 = new clsDBConnection1();
$MainPage->Connections["Connection1"] = & $DBConnection1;
// Controls
$Header = & new clsHeader("", "Header", $MainPage);
$Header->Initialize();
$e_mail_adrese_korisnika = & new clsRecorde_mail_adrese_korisnika("", $MainPage);
$Footer = & new clsFooter("", "Footer", $MainPage);
$Footer->Initialize();
$MainPage->Header = & $Header;
$MainPage->e_mail_adrese_korisnika = & $e_mail_adrese_korisnika;
$MainPage->Footer = & $Footer;
$e_mail_adrese_korisnika->Initialize();
$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-5ACC608F
$Header->Operations();
$e_mail_adrese_korisnika->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-96622627
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
unset($e_mail_adrese_korisnika);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-68883E57
$Header->Show();
$e_mail_adrese_korisnika->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-FE4771AE
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
unset($e_mail_adrese_korisnika);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|