Visible = true; $this->Errors = new clsErrors(); $this->ds = new clspagecontentDataSource(); if($this->Visible) { $this->ComponentName = "pagecontent"; $CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2); if(sizeof($CCSForm) == 1) $CCSForm[1] = ""; list($FormName, $FormMethod) = $CCSForm; $this->EditMode = ($FormMethod == "Edit"); $this->FormSubmitted = ($FormName == $this->ComponentName); $Method = $this->FormSubmitted ? ccsPost : ccsGet; $this->title = new clsControl(ccsLabel, "title", "Title", ccsText, "", CCGetRequestParam("title", $Method)); $this->body = new clsControl(ccsLabel, "body", "Body", ccsMemo, "", CCGetRequestParam("body", $Method)); $this->body->HTML = true; } } //End Class_Initialize Event //Initialize Method @4-F98A764E function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["urlid"] = CCGetFromGet("id", ""); } //End Initialize Method //Validate Method @4-7E1FC38C function Validate() { $Validation = true; $Where = ""; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method //CheckErrors Method @4-288591D9 function CheckErrors() { $errors = false; $errors = ($errors || $this->title->Errors->Count()); $errors = ($errors || $this->body->Errors->Count()); $errors = ($errors || $this->Errors->Count()); $errors = ($errors || $this->ds->Errors->Count()); return $errors; } //End CheckErrors Method //Operation Method @4-4E516CC9 function Operation() { if(!$this->Visible) return; global $Redirect; global $FileName; $this->ds->Prepare(); $this->EditMode = $this->ds->AllParametersSet; if(!$this->FormSubmitted) return; $Redirect = "content.php?" . CCGetQueryString("QueryString", Array("ccsForm")); } //End Operation Method //Show Method @4-37352F31 function Show() { global $Tpl; global $FileName; $Error = ""; if(!$this->Visible) return; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect"); $this->ds->open(); $RecordBlock = "Record " . $this->ComponentName; $ParentPath = $Tpl->block_path; $Tpl->block_path = $ParentPath . "/" . $RecordBlock; if($this->EditMode) { if($this->Errors->Count() == 0) { if($this->ds->Errors->Count() > 0) { echo "Error in Record pagecontent"; } else if($this->ds->next_record()) { $this->ds->SetValues(); $this->title->SetValue($this->ds->title->GetValue()); $this->body->SetValue($this->ds->body->GetValue()); if(!$this->FormSubmitted) { } } else { $this->EditMode = false; } } } if($this->FormSubmitted || $this->CheckErrors()) { $Error .= $this->title->Errors->ToString(); $Error .= $this->body->Errors->ToString(); $Error .= $this->Errors->ToString(); $Error .= $this->ds->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); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); if(!$this->Visible) { $Tpl->block_path = $ParentPath; return; } $this->title->Show(); $this->body->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method } //End pagecontent Class @4-FCB6E20C class clspagecontentDataSource extends clsDBbeVisitorPortal { //pagecontentDataSource Class @4-C566C7D4 //DataSource Variables @4-7FE434F4 var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $wp; var $AllParametersSet; // Datasource fields var $title; var $body; //End DataSource Variables //Class_Initialize Event @4-FE5618E4 function clspagecontentDataSource() { $this->ErrorBlock = "Record pagecontent/Error"; $this->Initialize(); $this->title = new clsField("title", ccsText, ""); $this->body = new clsField("body", ccsMemo, ""); } //End Class_Initialize Event //Prepare Method @4-F5935574 function Prepare() { $this->wp = new clsSQLParameters($this->ErrorBlock); $this->wp->AddParameter("1", "urlid", ccsInteger, "", "", $this->Parameters["urlid"], ""); $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)); $this->wp->Criterion[2] = "active = 1"; $this->Where = $this->wp->opAND(false, $this->wp->Criterion[1], $this->wp->Criterion[2]); } //End Prepare Method //Open Method @4-9FFB61DF function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->SQL = "SELECT * " . "FROM pagecontent"; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect"); $this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order)); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect"); $this->MoveToPage($this->AbsolutePage); } //End Open Method //SetValues Method @4-DF000622 function SetValues() { $this->title->SetDBValue($this->f("title")); $this->body->SetDBValue($this->f("body")); } //End SetValues Method } //End pagecontentDataSource Class @4-FCB6E20C //Include Page implementation @3-EFAB2CA0 include_once("./footer.php"); //End Include Page implementation //Initialize Page @1-3EFBB560 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = "content.php"; $Redirect = ""; $TemplateFileName = "content.html"; $BlockToParse = "main"; $PathToRoot = "./"; //End Initialize Page //Initialize Objects @1-DD137EBA $DBbeVisitorPortal = new clsDBbeVisitorPortal(); // Controls $header = new clsheader(); $header->BindEvents(); $header->TemplatePath = "./"; $header->Initialize(); $pagecontent = new clsRecordpagecontent(); $footer = new clsfooter(); $footer->BindEvents(); $footer->TemplatePath = "./"; $footer->Initialize(); $pagecontent->Initialize(); $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize"); //End Initialize Objects //Initialize HTML Template @1-A0111C9D $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView"); $Tpl = new clsTemplate(); $Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main"); $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow"); //End Initialize HTML Template //Execute Components @1-BE52FAB7 $header->Operations(); $pagecontent->Operation(); $footer->Operations(); //End Execute Components //Go to destination page @1-BEB91355 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); header("Location: " . $Redirect); exit; } //End Go to destination page //Show Page @1-B5FD1DFD $footer->Show("footer"); $pagecontent->Show(); $header->Show("header"); $Tpl->PParse("main", false); //End Show Page //Unload Page @1-AB7622EF $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); unset($Tpl); //End Unload Page ?>