Viewing file: statistika_maint.php (21.94 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //Include Common Files @1-BCB0CB7F define("RelativePath", "."); define("PathToCurrentPage", "/"); define("FileName", "statistika_maint.php"); include(RelativePath . "/Common.php"); include(RelativePath . "/Template.php"); include(RelativePath . "/Sorter.php"); include(RelativePath . "/Navigator.php"); //End Include Common Files
class clsRecordstatistika { //statistika Class @2-F90517DD
//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-E9BA7991 function clsRecordstatistika($RelativePath, & $Parent) {
global $FileName; global $CCSLocales; global $DefaultDateFormat; $this->Visible = true; $this->Parent = & $Parent; $this->RelativePath = $RelativePath; $this->Errors = new clsErrors(); $this->ErrorBlock = "Record statistika/Error"; $this->DataSource = new clsstatistikaDataSource($this); $this->ds = & $this->DataSource; $this->InsertAllowed = true; $this->UpdateAllowed = true; $this->DeleteAllowed = true; $this->ReadAllowed = true; if($this->Visible) { $this->ComponentName = "statistika"; $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->request = new clsControl(ccsTextBox, "request", "Request", ccsText, "", CCGetRequestParam("request", $Method, NULL), $this); $this->request->Required = true; $this->host = new clsControl(ccsTextBox, "host", "Host", ccsText, "", CCGetRequestParam("host", $Method, NULL), $this); $this->host->Required = true; $this->address = new clsControl(ccsTextBox, "address", "Address", ccsText, "", CCGetRequestParam("address", $Method, NULL), $this); $this->address->Required = true; $this->user = new clsControl(ccsTextBox, "user", "User", ccsText, "", CCGetRequestParam("user", $Method, NULL), $this); $this->user->Required = true; $this->date = new clsControl(ccsTextBox, "date", "Date", ccsDate, $DefaultDateFormat, CCGetRequestParam("date", $Method, NULL), $this); $this->DatePicker_date = new clsDatePicker("DatePicker_date", "statistika", "date", $this); $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-2832F4DC function Initialize() {
if(!$this->Visible) return;
$this->DataSource->Parameters["urlid"] = CCGetFromGet("id", NULL); } //End Initialize Method
//Validate Method @2-F2524705 function Validate() { global $CCSLocales; $Validation = true; $Where = ""; $Validation = ($this->request->Validate() && $Validation); $Validation = ($this->host->Validate() && $Validation); $Validation = ($this->address->Validate() && $Validation); $Validation = ($this->user->Validate() && $Validation); $Validation = ($this->date->Validate() && $Validation); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this); $Validation = $Validation && ($this->request->Errors->Count() == 0); $Validation = $Validation && ($this->host->Errors->Count() == 0); $Validation = $Validation && ($this->address->Errors->Count() == 0); $Validation = $Validation && ($this->user->Errors->Count() == 0); $Validation = $Validation && ($this->date->Errors->Count() == 0); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method
//CheckErrors Method @2-98CE0B7D function CheckErrors() { $errors = false; $errors = ($errors || $this->request->Errors->Count()); $errors = ($errors || $this->host->Errors->Count()); $errors = ($errors || $this->address->Errors->Count()); $errors = ($errors || $this->user->Errors->Count()); $errors = ($errors || $this->date->Errors->Count()); $errors = ($errors || $this->DatePicker_date->Errors->Count()); $errors = ($errors || $this->Errors->Count()); $errors = ($errors || $this->DataSource->Errors->Count()); return $errors; } //End CheckErrors Method
//Operation Method @2-B6B68569 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 = "statistika_list2.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-3D2C8B94 function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this); if(!$this->InsertAllowed) return false; $this->DataSource->request->SetValue($this->request->GetValue(true)); $this->DataSource->host->SetValue($this->host->GetValue(true)); $this->DataSource->address->SetValue($this->address->GetValue(true)); $this->DataSource->user->SetValue($this->user->GetValue(true)); $this->DataSource->date->SetValue($this->date->GetValue(true)); $this->DataSource->Insert(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this); return (!$this->CheckErrors()); } //End InsertRow Method
//UpdateRow Method @2-3E4D6AED function UpdateRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this); if(!$this->UpdateAllowed) return false; $this->DataSource->request->SetValue($this->request->GetValue(true)); $this->DataSource->host->SetValue($this->host->GetValue(true)); $this->DataSource->address->SetValue($this->address->GetValue(true)); $this->DataSource->user->SetValue($this->user->GetValue(true)); $this->DataSource->date->SetValue($this->date->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-8CAB147F 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->request->SetValue($this->DataSource->request->GetValue()); $this->host->SetValue($this->DataSource->host->GetValue()); $this->address->SetValue($this->DataSource->address->GetValue()); $this->user->SetValue($this->DataSource->user->GetValue()); $this->date->SetValue($this->DataSource->date->GetValue()); } } else { $this->EditMode = false; } }
if($this->FormSubmitted || $this->CheckErrors()) { $Error = ""; $Error = ComposeStrings($Error, $this->request->Errors->ToString()); $Error = ComposeStrings($Error, $this->host->Errors->ToString()); $Error = ComposeStrings($Error, $this->address->Errors->ToString()); $Error = ComposeStrings($Error, $this->user->Errors->ToString()); $Error = ComposeStrings($Error, $this->date->Errors->ToString()); $Error = ComposeStrings($Error, $this->DatePicker_date->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->request->Show(); $this->host->Show(); $this->address->Show(); $this->user->Show(); $this->date->Show(); $this->DatePicker_date->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 statistika Class @2-FCB6E20C
class clsstatistikaDataSource extends clsDBConnection1 { //statistikaDataSource Class @2-E6ADE34E
//DataSource Variables @2-3C0360DB 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 $request; public $host; public $address; public $user; public $date; //End DataSource Variables
//DataSourceClass_Initialize Event @2-4F9AC53E function clsstatistikaDataSource(& $Parent) { $this->Parent = & $Parent; $this->ErrorBlock = "Record statistika/Error"; $this->Initialize(); $this->request = new clsField("request", ccsText, ""); $this->host = new clsField("host", ccsText, ""); $this->address = new clsField("address", ccsText, ""); $this->user = new clsField("user", ccsText, ""); $this->date = new clsField("date", ccsDate, array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->InsertFields["request"] = array("Name" => "request", "Value" => "", "DataType" => ccsText); $this->InsertFields["host"] = array("Name" => "host", "Value" => "", "DataType" => ccsText); $this->InsertFields["address"] = array("Name" => "address", "Value" => "", "DataType" => ccsText); $this->InsertFields["user"] = array("Name" => "user", "Value" => "", "DataType" => ccsText); $this->InsertFields["date"] = array("Name" => "date", "Value" => "", "DataType" => ccsDate); $this->UpdateFields["request"] = array("Name" => "request", "Value" => "", "DataType" => ccsText); $this->UpdateFields["host"] = array("Name" => "host", "Value" => "", "DataType" => ccsText); $this->UpdateFields["address"] = array("Name" => "address", "Value" => "", "DataType" => ccsText); $this->UpdateFields["user"] = array("Name" => "user", "Value" => "", "DataType" => ccsText); $this->UpdateFields["date"] = array("Name" => "date", "Value" => "", "DataType" => ccsDate); } //End DataSourceClass_Initialize Event
//Prepare Method @2-35B33087 function Prepare() { global $CCSLocales; global $DefaultDateFormat; $this->wp = new clsSQLParameters($this->ErrorBlock); $this->wp->AddParameter("1", "urlid", ccsInteger, "", "", $this->Parameters["urlid"], "", false); $this->AllParametersSet = $this->wp->AllParamsSet(); $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "id", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false); $this->Where = $this->wp->Criterion[1]; } //End Prepare Method
//Open Method @2-B5F7FBD0 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent); $this->SQL = "SELECT * \n\n" . "FROM statistika {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-58F050B0 function SetValues() { $this->request->SetDBValue($this->f("request")); $this->host->SetDBValue($this->f("host")); $this->address->SetDBValue($this->f("address")); $this->user->SetDBValue($this->f("user")); $this->date->SetDBValue(trim($this->f("date"))); } //End SetValues Method
//Insert Method @2-97D8E892 function Insert() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent); $this->InsertFields["request"]["Value"] = $this->request->GetDBValue(true); $this->InsertFields["host"]["Value"] = $this->host->GetDBValue(true); $this->InsertFields["address"]["Value"] = $this->address->GetDBValue(true); $this->InsertFields["user"]["Value"] = $this->user->GetDBValue(true); $this->InsertFields["date"]["Value"] = $this->date->GetDBValue(true); $this->SQL = CCBuildInsert("statistika", $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-94610C80 function Update() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent); $this->UpdateFields["request"]["Value"] = $this->request->GetDBValue(true); $this->UpdateFields["host"]["Value"] = $this->host->GetDBValue(true); $this->UpdateFields["address"]["Value"] = $this->address->GetDBValue(true); $this->UpdateFields["user"]["Value"] = $this->user->GetDBValue(true); $this->UpdateFields["date"]["Value"] = $this->date->GetDBValue(true); $this->SQL = CCBuildUpdate("statistika", $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-7A59CE53 function Delete() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent); $this->SQL = "DELETE FROM statistika"; $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 statistikaDataSource Class @2-FCB6E20C
//Initialize Page @1-D20C91B0 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; $Attributes = "";
// Events; $CCSEvents = ""; $CCSEventResult = "";
$FileName = FileName; $Redirect = ""; $TemplateFileName = "statistika_maint.html"; $BlockToParse = "main"; $TemplateEncoding = "ISO-8859-1"; $PathToRoot = "./"; //End Initialize Page
//Authenticate User @1-DC94A87D CCSecurityRedirect("1", ""); //End Authenticate User
//Before Initialize @1-E870CEBC $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage); //End Before Initialize
//Initialize Objects @1-316C7980 $DBConnection1 = new clsDBConnection1(); $MainPage->Connections["Connection1"] = & $DBConnection1; $Attributes = new clsAttributes("page:"); $MainPage->Attributes = & $Attributes;
// Controls $statistika = new clsRecordstatistika("", $MainPage); $MainPage->statistika = & $statistika; $statistika->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
$Charset = $Charset ? $Charset : "iso-8859-1"; if ($Charset) header("Content-Type: text/html; charset=" . $Charset); //End Initialize Objects
//Initialize HTML Template @1-A8C4B9DA $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage); $Tpl = new clsTemplate($FileEncoding, $TemplateEncoding); $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "ISO-8859-1"); $Tpl->block_path = "/$BlockToParse"; $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage); $Attributes->Show(); //End Initialize HTML Template
//Execute Components @1-8A596FD8 $statistika->Operation(); //End Execute Components
//Go to destination page @1-795918D9 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); $DBConnection1->close(); header("Location: " . $Redirect); unset($statistika); unset($Tpl); exit; } //End Go to destination page
//Show Page @1-E6B5F9DF $statistika->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-42396F03 $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); $DBConnection1->close(); unset($statistika); unset($Tpl); //End Unload Page
?>
|