Visible = true; $this->Parent = & $Parent; $this->RelativePath = $RelativePath; $this->Errors = new clsErrors(); $this->ErrorBlock = "Record user/Error"; $this->DataSource = new clsuserDataSource($this); $this->ds = & $this->DataSource; $this->ReadAllowed = true; $this->Visible = (CCSecurityAccessCheck("90;70;60") == "success"); if($this->Visible) { $this->ReadAllowed = $this->ReadAllowed && CCUserInGroups(CCGetGroupID(), "90;70;60"); $this->InsertAllowed = CCUserInGroups(CCGetGroupID(), "90;70;60"); $this->UpdateAllowed = CCUserInGroups(CCGetGroupID(), "90;70;60"); $this->DeleteAllowed = CCUserInGroups(CCGetGroupID(), "90;70;60"); $this->ComponentName = "user"; $this->Attributes = new clsAttributes($this->ComponentName . ":"); $CCSForm = explode(":", 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->Name = new clsControl(ccsTextBox, "Name", $CCSLocales->GetText("Name"), ccsText, "", CCGetRequestParam("Name", $Method, NULL), $this); $this->Name->Required = true; $this->Login = new clsControl(ccsTextBox, "Login", $CCSLocales->GetText("Login"), ccsText, "", CCGetRequestParam("Login", $Method, NULL), $this); $this->Login->Required = true; $this->Password = new clsControl(ccsTextBox, "Password", $CCSLocales->GetText("Password"), ccsText, "", CCGetRequestParam("Password", $Method, NULL), $this); $this->Password->Required = true; $this->Level = new clsControl(ccsListBox, "Level", $CCSLocales->GetText("Level"), ccsInteger, "", CCGetRequestParam("Level", $Method, NULL), $this); $this->Level->DSType = dsListOfValues; $this->Level->Values = array(array("30", "Vendég"), array("50", "Bíró"), array("60", "MVK adminisztrátor"), array("70", "VSZB adminisztrátor"), array("90", "Site adminisztrátor")); $this->Level->Required = true; $this->Email = new clsControl(ccsTextBox, "Email", $CCSLocales->GetText("Email"), ccsText, "", CCGetRequestParam("Email", $Method, NULL), $this); $this->Email->Required = true; $this->Telefon = new clsControl(ccsTextBox, "Telefon", "Telefon", ccsText, "", CCGetRequestParam("Telefon", $Method, NULL), $this); $this->Button_Insert1 = new clsButton("Button_Insert1", $Method, $this); $this->Button_Update1 = new clsButton("Button_Update1", $Method, $this); $this->Button_Delete = new clsButton("Button_Delete", $Method, $this); $this->ImageLink1 = new clsControl(ccsImageLink, "ImageLink1", "ImageLink1", ccsText, "", CCGetRequestParam("ImageLink1", $Method, NULL), $this); $this->ImageLink1->Parameters = CCGetQueryString("QueryString", array("ccsForm")); $this->ImageLink1->Page = "user_list.php"; } } //End Class_Initialize Event //Initialize Method @2-D6CB1C94 function Initialize() { if(!$this->Visible) return; $this->DataSource->Parameters["urlID"] = CCGetFromGet("ID", NULL); } //End Initialize Method //Validate Method @2-75EA6A26 function Validate() { global $CCSLocales; $Validation = true; $Where = ""; if(strlen($this->Email->GetText()) && !preg_match ("/^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]+$/", $this->Email->GetText())) { $this->Email->Errors->addError($CCSLocales->GetText("CCS_MaskValidation", $CCSLocales->GetText("Email"))); } $Validation = ($this->Name->Validate() && $Validation); $Validation = ($this->Login->Validate() && $Validation); $Validation = ($this->Password->Validate() && $Validation); $Validation = ($this->Level->Validate() && $Validation); $Validation = ($this->Email->Validate() && $Validation); $Validation = ($this->Telefon->Validate() && $Validation); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this); $Validation = $Validation && ($this->Name->Errors->Count() == 0); $Validation = $Validation && ($this->Login->Errors->Count() == 0); $Validation = $Validation && ($this->Password->Errors->Count() == 0); $Validation = $Validation && ($this->Level->Errors->Count() == 0); $Validation = $Validation && ($this->Email->Errors->Count() == 0); $Validation = $Validation && ($this->Telefon->Errors->Count() == 0); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method //CheckErrors Method @2-5A050F9C function CheckErrors() { $errors = false; $errors = ($errors || $this->Name->Errors->Count()); $errors = ($errors || $this->Login->Errors->Count()); $errors = ($errors || $this->Password->Errors->Count()); $errors = ($errors || $this->Level->Errors->Count()); $errors = ($errors || $this->Email->Errors->Count()); $errors = ($errors || $this->Telefon->Errors->Count()); $errors = ($errors || $this->ImageLink1->Errors->Count()); $errors = ($errors || $this->Errors->Count()); $errors = ($errors || $this->DataSource->Errors->Count()); return $errors; } //End CheckErrors Method //MasterDetail @2-ED598703 function SetPrimaryKeys($keyArray) { $this->PrimaryKeys = $keyArray; } function GetPrimaryKeys() { return $this->PrimaryKeys; } function GetPrimaryKey($keyName) { return $this->PrimaryKeys[$keyName]; } //End MasterDetail //Operation Method @2-A17AB698 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_Update1" : "Button_Insert1"; if($this->Button_Insert1->Pressed) { $this->PressedButton = "Button_Insert1"; } else if($this->Button_Update1->Pressed) { $this->PressedButton = "Button_Update1"; } else if($this->Button_Delete->Pressed) { $this->PressedButton = "Button_Delete"; } } $Redirect = "user_list.php" . "?" . CCGetQueryString("QueryString", array("ccsForm")); if($this->PressedButton == "Button_Delete" && $this->DeleteAllowed) { $Redirect = "user_list.php" . "?" . CCGetQueryString("QueryString", array("ccsForm")); if(!CCGetEvent($this->Button_Delete->CCSEvents, "OnClick", $this->Button_Delete) || !$this->DeleteRow()) { $Redirect = ""; } } else if($this->Validate()) { if($this->PressedButton == "Button_Insert1" && $this->InsertAllowed) { $Redirect = "user_list.php" . "?" . CCGetQueryString("QueryString", array("ccsForm")); if(!CCGetEvent($this->Button_Insert1->CCSEvents, "OnClick", $this->Button_Insert1) || !$this->InsertRow()) { $Redirect = ""; } } else if($this->PressedButton == "Button_Update1" && $this->UpdateAllowed) { $Redirect = "user_list.php" . "?" . CCGetQueryString("QueryString", array("ccsForm")); if(!CCGetEvent($this->Button_Update1->CCSEvents, "OnClick", $this->Button_Update1) || !$this->UpdateRow()) { $Redirect = ""; } } } else { $Redirect = ""; } if ($Redirect) $this->DataSource->close(); } //End Operation Method //InsertRow Method @2-318AF856 function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this); if(!$this->InsertAllowed) return false; $this->DataSource->Name->SetValue($this->Name->GetValue(true)); $this->DataSource->Login->SetValue($this->Login->GetValue(true)); $this->DataSource->Password->SetValue($this->Password->GetValue(true)); $this->DataSource->Level->SetValue($this->Level->GetValue(true)); $this->DataSource->Email->SetValue($this->Email->GetValue(true)); $this->DataSource->Telefon->SetValue($this->Telefon->GetValue(true)); $this->DataSource->ImageLink1->SetValue($this->ImageLink1->GetValue(true)); $this->DataSource->Insert(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this); return (!$this->CheckErrors()); } //End InsertRow Method //UpdateRow Method @2-B2AE9776 function UpdateRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeUpdate", $this); if(!$this->UpdateAllowed) return false; $this->DataSource->Name->SetValue($this->Name->GetValue(true)); $this->DataSource->Login->SetValue($this->Login->GetValue(true)); $this->DataSource->Password->SetValue($this->Password->GetValue(true)); $this->DataSource->Level->SetValue($this->Level->GetValue(true)); $this->DataSource->Email->SetValue($this->Email->GetValue(true)); $this->DataSource->Telefon->SetValue($this->Telefon->GetValue(true)); $this->DataSource->ImageLink1->SetValue($this->ImageLink1->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-EA2A17CC function Show() { global $CCSUseAmp; global $Tpl; global $FileName; global $CCSLocales; $Error = ""; if(!$this->Visible) return; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this); $this->Level->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->Name->SetValue($this->DataSource->Name->GetValue()); $this->Login->SetValue($this->DataSource->Login->GetValue()); $this->Password->SetValue($this->DataSource->Password->GetValue()); $this->Level->SetValue($this->DataSource->Level->GetValue()); $this->Email->SetValue($this->DataSource->Email->GetValue()); $this->Telefon->SetValue($this->DataSource->Telefon->GetValue()); } } else { $this->EditMode = false; } } if($this->FormSubmitted || $this->CheckErrors()) { $Error = ""; $Error = ComposeStrings($Error, $this->Name->Errors->ToString()); $Error = ComposeStrings($Error, $this->Login->Errors->ToString()); $Error = ComposeStrings($Error, $this->Password->Errors->ToString()); $Error = ComposeStrings($Error, $this->Level->Errors->ToString()); $Error = ComposeStrings($Error, $this->Email->Errors->ToString()); $Error = ComposeStrings($Error, $this->Telefon->Errors->ToString()); $Error = ComposeStrings($Error, $this->ImageLink1->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", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&", $this->HTMLFormAction)); $Tpl->SetVar("HTMLFormName", $this->ComponentName); $Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype); $this->Button_Insert1->Visible = !$this->EditMode && $this->InsertAllowed; $this->Button_Update1->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->Name->Show(); $this->Login->Show(); $this->Password->Show(); $this->Level->Show(); $this->Email->Show(); $this->Telefon->Show(); $this->Button_Insert1->Show(); $this->Button_Update1->Show(); $this->Button_Delete->Show(); $this->ImageLink1->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->DataSource->close(); } //End Show Method } //End user Class @2-FCB6E20C class clsuserDataSource extends clsDBConnection1 { //userDataSource Class @2-93B04756 //DataSource Variables @2-E962D32F 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 $Name; public $Login; public $Password; public $Level; public $Email; public $Telefon; public $ImageLink1; //End DataSource Variables //DataSourceClass_Initialize Event @2-89F708F4 function clsuserDataSource(& $Parent) { $this->Parent = & $Parent; $this->ErrorBlock = "Record user/Error"; $this->Initialize(); $this->Name = new clsField("Name", ccsText, ""); $this->Login = new clsField("Login", ccsText, ""); $this->Password = new clsField("Password", ccsText, ""); $this->Level = new clsField("Level", ccsInteger, ""); $this->Email = new clsField("Email", ccsText, ""); $this->Telefon = new clsField("Telefon", ccsText, ""); $this->ImageLink1 = new clsField("ImageLink1", ccsText, ""); $this->InsertFields["Name"] = array("Name" => "Name", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->InsertFields["Login"] = array("Name" => "Login", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->InsertFields["Password"] = array("Name" => "Password", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->InsertFields["Level"] = array("Name" => "Level", "Value" => "", "DataType" => ccsInteger, "OmitIfEmpty" => 1); $this->InsertFields["Email"] = array("Name" => "Email", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->InsertFields["Telefon"] = array("Name" => "Telefon", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->UpdateFields["Name"] = array("Name" => "Name", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->UpdateFields["Login"] = array("Name" => "Login", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->UpdateFields["Password"] = array("Name" => "Password", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->UpdateFields["Level"] = array("Name" => "Level", "Value" => "", "DataType" => ccsInteger, "OmitIfEmpty" => 1); $this->UpdateFields["Email"] = array("Name" => "Email", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); $this->UpdateFields["Telefon"] = array("Name" => "Telefon", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1); } //End DataSourceClass_Initialize Event //Prepare Method @2-C6736E1B 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-9031260D function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent); $this->SQL = "SELECT * \n\n" . "FROM user {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-F66BCC4C function SetValues() { $this->Name->SetDBValue($this->f("Name")); $this->Login->SetDBValue($this->f("Login")); $this->Password->SetDBValue($this->f("Password")); $this->Level->SetDBValue(trim($this->f("Level"))); $this->Email->SetDBValue($this->f("Email")); $this->Telefon->SetDBValue($this->f("Telefon")); } //End SetValues Method //Insert Method @2-A8783601 function Insert() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent); $this->InsertFields["Name"]["Value"] = $this->Name->GetDBValue(true); $this->InsertFields["Login"]["Value"] = $this->Login->GetDBValue(true); $this->InsertFields["Password"]["Value"] = $this->Password->GetDBValue(true); $this->InsertFields["Level"]["Value"] = $this->Level->GetDBValue(true); $this->InsertFields["Email"]["Value"] = $this->Email->GetDBValue(true); $this->InsertFields["Telefon"]["Value"] = $this->Telefon->GetDBValue(true); $this->SQL = CCBuildInsert("user", $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-9A33945E function Update() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildUpdate", $this->Parent); $this->UpdateFields["Name"]["Value"] = $this->Name->GetDBValue(true); $this->UpdateFields["Login"]["Value"] = $this->Login->GetDBValue(true); $this->UpdateFields["Password"]["Value"] = $this->Password->GetDBValue(true); $this->UpdateFields["Level"]["Value"] = $this->Level->GetDBValue(true); $this->UpdateFields["Email"]["Value"] = $this->Email->GetDBValue(true); $this->UpdateFields["Telefon"]["Value"] = $this->Telefon->GetDBValue(true); $this->SQL = CCBuildUpdate("user", $this->UpdateFields, $this); $this->SQL .= strlen($this->Where) ? " WHERE " . $this->Where : $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-82D0FEF5 function Delete() { global $CCSLocales; global $DefaultDateFormat; $this->CmdExecution = true; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildDelete", $this->Parent); $this->SQL = "DELETE FROM user"; $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 userDataSource Class @2-FCB6E20C //Initialize Page @1-74823E00 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; $Attributes = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = FileName; $Redirect = ""; $TemplateFileName = "user_maint.html"; $BlockToParse = "main"; $TemplateEncoding = "UTF-8"; $ContentType = "text/html"; $PathToRoot = "./"; $Charset = $Charset ? $Charset : "utf-8"; //End Initialize Page //Authenticate User @1-9F5E49F1 CCSecurityRedirect("90", ""); //End Authenticate User //Before Initialize @1-E870CEBC $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage); //End Before Initialize //Initialize Objects @1-51DA3BCC $DBConnection1 = new clsDBConnection1(); $MainPage->Connections["Connection1"] = & $DBConnection1; $Attributes = new clsAttributes("page:"); $MainPage->Attributes = & $Attributes; // Controls $user = new clsRecorduser("", $MainPage); $MainPage->user = & $user; $user->Initialize(); $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage); if ($Charset) { header("Content-Type: " . $ContentType . "; charset=" . $Charset); } else { header("Content-Type: " . $ContentType); } //End Initialize Objects //Initialize HTML Template @1-A06E9207 $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage); $Tpl = new clsTemplate($FileEncoding, $TemplateEncoding); $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "UTF-8", "replace"); $Tpl->block_path = "/$BlockToParse"; $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage); $Attributes->SetValue("pathToRoot", ""); $Attributes->Show(); //End Initialize HTML Template //Execute Components @1-18C055D0 $user->Operation(); //End Execute Components //Go to destination page @1-9EBACD99 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); $DBConnection1->close(); header("Location: " . $Redirect); unset($user); unset($Tpl); exit; } //End Go to destination page //Show Page @1-EA3209EF $user->Show(); $Tpl->block_path = ""; $Tpl->Parse($BlockToParse, false); if (!isset($main_block)) $main_block = $Tpl->GetVar($BlockToParse); $MNNIB6G3J8H = "