Visible = true; $this->Errors = new clsErrors(); $this->ds = new clsrlink_logDataSource(); $this->InsertAllowed = true; if($this->Visible) { $this->ComponentName = "rlink_log"; $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->name = new clsControl(ccsTextBox, "name", "Name", ccsText, "", CCGetRequestParam("name", $Method)); $this->name->Required = true; $this->email = new clsControl(ccsTextBox, "email", "Email", ccsText, "", CCGetRequestParam("email", $Method)); $this->email->Required = true; $this->siteurl = new clsControl(ccsTextBox, "siteurl", "Siteurl", ccsText, "", CCGetRequestParam("siteurl", $Method)); $this->siteurl->Required = true; $this->Insert = new clsButton("Insert"); $this->date = new clsControl(ccsHidden, "date", "Date", ccsDate, Array("yyyy", "/", "mm", "/", "dd"), CCGetRequestParam("date", $Method)); } } //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-504F4F47 function Validate() { $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("Mask validation failed for field Email."); } $Validation = ($this->name->Validate() && $Validation); $Validation = ($this->email->Validate() && $Validation); $Validation = ($this->siteurl->Validate() && $Validation); $Validation = ($this->date->Validate() && $Validation); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method //CheckErrors Method @4-1CCCAEB6 function CheckErrors() { $errors = false; $errors = ($errors || $this->name->Errors->Count()); $errors = ($errors || $this->email->Errors->Count()); $errors = ($errors || $this->siteurl->Errors->Count()); $errors = ($errors || $this->date->Errors->Count()); $errors = ($errors || $this->Errors->Count()); $errors = ($errors || $this->ds->Errors->Count()); return $errors; } //End CheckErrors Method //Operation Method @4-777FB265 function Operation() { if(!$this->Visible) return; global $Redirect; global $FileName; $this->ds->Prepare(); $this->EditMode = $this->ds->AllParametersSet; if(!$this->FormSubmitted) return; if($this->FormSubmitted) { $this->PressedButton = "Insert"; if(strlen(CCGetParam("Insert", ""))) { $this->PressedButton = "Insert"; } } $Redirect = "rlink.php?" . CCGetQueryString("QueryString", Array("ccsForm", "Insert")); if($this->Validate()) { if($this->PressedButton == "Insert") { if(!CCGetEvent($this->Insert->CCSEvents, "OnClick") || !$this->InsertRow()) { $Redirect = ""; } } } else { $Redirect = ""; } } //End Operation Method //InsertRow Method @4-1B13AF8D function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert"); if(!$this->InsertAllowed) return false; $this->ds->name->SetValue($this->name->GetValue()); $this->ds->email->SetValue($this->email->GetValue()); $this->ds->siteurl->SetValue($this->siteurl->GetValue()); $this->ds->date->SetValue($this->date->GetValue()); $this->ds->Insert(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert"); if($this->ds->Errors->Count() > 0) { echo "Error in Record " . $this->ComponentName . " / Insert Operation"; $this->ds->Errors->Clear(); $this->Errors->AddError("Database command error."); } return ($this->Errors->Count() == 0); } //End InsertRow Method //Show Method @4-DF4F3E1E 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 rlink_log"; } else if($this->ds->next_record()) { $this->ds->SetValues(); if(!$this->FormSubmitted) { $this->name->SetValue($this->ds->name->GetValue()); $this->email->SetValue($this->ds->email->GetValue()); $this->siteurl->SetValue($this->ds->siteurl->GetValue()); $this->date->SetValue($this->ds->date->GetValue()); } } else { $this->EditMode = false; } } } if(!$this->FormSubmitted) { } if($this->FormSubmitted || $this->CheckErrors()) { $Error .= $this->name->Errors->ToString(); $Error .= $this->email->Errors->ToString(); $Error .= $this->siteurl->Errors->ToString(); $Error .= $this->date->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->Insert->Visible = !$this->EditMode; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); if(!$this->Visible) { $Tpl->block_path = $ParentPath; return; } $this->name->Show(); $this->email->Show(); $this->siteurl->Show(); $this->Insert->Show(); $this->date->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method } //End rlink_log Class @4-FCB6E20C class clsrlink_logDataSource extends clsDBbeVisitorPortal { //rlink_logDataSource Class @4-872507FF //DataSource Variables @4-E4DBA794 var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $InsertParameters; var $wp; var $AllParametersSet; // Datasource fields var $name; var $email; var $siteurl; var $date; //End DataSource Variables //Class_Initialize Event @4-87E24559 function clsrlink_logDataSource() { $this->ErrorBlock = "Record rlink_log/Error"; $this->Initialize(); $this->name = new clsField("name", ccsText, ""); $this->email = new clsField("email", ccsText, ""); $this->siteurl = new clsField("siteurl", ccsText, ""); $this->date = new clsField("date", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")); } //End Class_Initialize Event //Prepare Method @4-31D2066F 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->Where = $this->wp->Criterion[1]; } //End Prepare Method //Open Method @4-CCDB60CE function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->SQL = "SELECT * " . "FROM rlink_log"; $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-852A5F52 function SetValues() { $this->name->SetDBValue($this->f("name")); $this->email->SetDBValue($this->f("email")); $this->siteurl->SetDBValue($this->f("siteurl")); $this->date->SetDBValue(trim($this->f("date"))); } //End SetValues Method //Insert Method @4-F18A1DDE function Insert() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert"); $this->SQL = "INSERT INTO rlink_log (" . "name, " . "email, " . "siteurl, " . "`date`" . ") VALUES (" . $this->ToSQL($this->name->GetDBValue(), $this->name->DataType) . ", " . $this->ToSQL($this->email->GetDBValue(), $this->email->DataType) . ", " . $this->ToSQL($this->siteurl->GetDBValue(), $this->siteurl->DataType) . ", " . $this->ToSQL($this->date->GetDBValue(), $this->date->DataType) . ")"; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert"); $this->query($this->SQL); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert"); if($this->Errors->Count() > 0) $this->Errors->AddError($this->Errors->ToString()); $this->close(); } //End Insert Method } //End rlink_logDataSource Class @4-FCB6E20C class clsGridrlink_code1 { //rlink_code1 class @15-CA2426BB //Variables @15-10869FDF // Public variables var $ComponentName; var $Visible; var $Errors; var $ds; var $PageSize; var $SorterName = ""; var $SorterDirection = ""; var $PageNumber; var $CCSEvents = ""; var $CCSEventResult; // Grid Controls var $StaticControls; var $RowControls; var $AltRowControls; var $IsAltRow; var $Navigator; //End Variables //Class_Initialize Event @15-C97FEF32 function clsGridrlink_code1() { global $FileName; $this->ComponentName = "rlink_code1"; $this->Visible = True; $this->IsAltRow = false; $this->Errors = new clsErrors(); $this->ds = new clsrlink_code1DataSource(); $this->PageSize = CCGetParam($this->ComponentName . "PageSize", ""); if(!is_numeric($this->PageSize) || !strlen($this->PageSize)) $this->PageSize = 10; else $this->PageSize = intval($this->PageSize); if($this->PageSize == 0) $this->Errors->addError("

Form: Grid " . $this->ComponentName . "
Error: (CCS06) Invalid page size.

"); $this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1)); $this->title = new clsControl(ccsLabel, "title", "title", ccsText, "", CCGetRequestParam("title", ccsGet)); $this->linkex = new clsControl(ccsLabel, "linkex", "linkex", ccsMemo, "", CCGetRequestParam("linkex", ccsGet)); $this->linkex->HTML = true; $this->linkcode = new clsControl(ccsLabel, "linkcode", "linkcode", ccsMemo, "", CCGetRequestParam("linkcode", ccsGet)); $this->Alt_title = new clsControl(ccsLabel, "Alt_title", "Alt_title", ccsText, "", CCGetRequestParam("Alt_title", ccsGet)); $this->Alt_linkex = new clsControl(ccsLabel, "Alt_linkex", "Alt_linkex", ccsMemo, "", CCGetRequestParam("Alt_linkex", ccsGet)); $this->Alt_linkex->HTML = true; $this->Alt_linkcode = new clsControl(ccsLabel, "Alt_linkcode", "Alt_linkcode", ccsMemo, "", CCGetRequestParam("Alt_linkcode", ccsGet)); $this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple); } //End Class_Initialize Event //Initialize Method @15-03626367 function Initialize() { if(!$this->Visible) return; $this->ds->PageSize = $this->PageSize; $this->ds->AbsolutePage = $this->PageNumber; $this->ds->SetOrder($this->SorterName, $this->SorterDirection); } //End Initialize Method //Show Method @15-649801F9 function Show() { global $Tpl; if(!$this->Visible) return; $ShownRecords = 0; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect"); $this->ds->Prepare(); $this->ds->Open(); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); if(!$this->Visible) return; $GridBlock = "Grid " . $this->ComponentName; $ParentPath = $Tpl->block_path; $Tpl->block_path = $ParentPath . "/" . $GridBlock; $is_next_record = $this->ds->next_record(); if($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); if(!$this->IsAltRow) { $Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row"; $this->title->SetValue($this->ds->title->GetValue()); $this->linkex->SetValue($this->ds->linkex->GetValue()); $this->linkcode->SetValue($this->ds->linkcode->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->title->Show(); $this->linkex->Show(); $this->linkcode->Show(); $Tpl->block_path = $ParentPath . "/" . $GridBlock; $Tpl->parse("Row", true); } else { $Tpl->block_path = $ParentPath . "/" . $GridBlock . "/AltRow"; $this->Alt_title->SetValue($this->ds->Alt_title->GetValue()); $this->Alt_linkex->SetValue($this->ds->Alt_linkex->GetValue()); $this->Alt_linkcode->SetValue($this->ds->Alt_linkcode->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->Alt_title->Show(); $this->Alt_linkex->Show(); $this->Alt_linkcode->Show(); $Tpl->block_path = $ParentPath . "/" . $GridBlock; $Tpl->parseto("AltRow", true, "Row"); } $this->IsAltRow = (!$this->IsAltRow); $ShownRecords++; $is_next_record = $this->ds->next_record(); // Parse Separator if($is_next_record && $ShownRecords < $this->PageSize) $Tpl->parseto("Separator", true, "Row"); } while ($is_next_record && $ShownRecords < $this->PageSize); } else // Show NoRecords block if no records are found { $Tpl->parse("NoRecords", false); } $errors = $this->GetErrors(); if(strlen($errors)) { $Tpl->replaceblock("", $errors); $Tpl->block_path = $ParentPath; return; } $this->Navigator->PageNumber = $this->ds->AbsolutePage; $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Navigator->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method //GetErrors Method @15-7761798E function GetErrors() { $errors = ""; $errors .= $this->title->Errors->ToString(); $errors .= $this->linkex->Errors->ToString(); $errors .= $this->linkcode->Errors->ToString(); $errors .= $this->Alt_title->Errors->ToString(); $errors .= $this->Alt_linkex->Errors->ToString(); $errors .= $this->Alt_linkcode->Errors->ToString(); $errors .= $this->Errors->ToString(); $errors .= $this->ds->Errors->ToString(); return $errors; } //End GetErrors Method } //End rlink_code1 Class @15-FCB6E20C class clsrlink_code1DataSource extends clsDBbeVisitorPortal { //rlink_code1DataSource Class @15-DC590A42 //DataSource Variables @15-42D1104E var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $CountSQL; var $wp; // Datasource fields var $title; var $linkex; var $linkcode; var $Alt_title; var $Alt_linkex; var $Alt_linkcode; //End DataSource Variables //Class_Initialize Event @15-53BBEC75 function clsrlink_code1DataSource() { $this->ErrorBlock = "Grid rlink_code1"; $this->Initialize(); $this->title = new clsField("title", ccsText, ""); $this->linkex = new clsField("linkex", ccsMemo, ""); $this->linkcode = new clsField("linkcode", ccsMemo, ""); $this->Alt_title = new clsField("Alt_title", ccsText, ""); $this->Alt_linkex = new clsField("Alt_linkex", ccsMemo, ""); $this->Alt_linkcode = new clsField("Alt_linkcode", ccsMemo, ""); } //End Class_Initialize Event //SetOrder Method @15-D2DA0794 function SetOrder($SorterName, $SorterDirection) { $this->Order = "disp_order"; $this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection, ""); } //End SetOrder Method //Prepare Method @15-DFF3DD87 function Prepare() { } //End Prepare Method //Open Method @15-BD7DA6D0 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->CountSQL = "SELECT COUNT(*) " . "FROM rlink_code"; $this->SQL = "SELECT * " . "FROM rlink_code"; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect"); $this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this); $this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order)); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect"); $this->MoveToPage($this->AbsolutePage); } //End Open Method //SetValues Method @15-3D4EF0E8 function SetValues() { $this->title->SetDBValue($this->f("title")); $this->linkex->SetDBValue($this->f("linkcode")); $this->linkcode->SetDBValue($this->f("linkcode")); $this->Alt_title->SetDBValue($this->f("title")); $this->Alt_linkex->SetDBValue($this->f("linkcode")); $this->Alt_linkcode->SetDBValue($this->f("linkcode")); } //End SetValues Method } //End rlink_code1DataSource Class @15-FCB6E20C //Include Page implementation @3-EFAB2CA0 include_once("./footer.php"); //End Include Page implementation //Initialize Page @1-2E260EA0 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = "rlink.php"; $Redirect = ""; $TemplateFileName = "rlink.html"; $BlockToParse = "main"; $PathToRoot = "./"; //End Initialize Page //Initialize Objects @1-C17C3DC9 $DBbeVisitorPortal = new clsDBbeVisitorPortal(); // Controls $header = new clsheader(); $header->BindEvents(); $header->TemplatePath = "./"; $header->Initialize(); $rlink_log = new clsRecordrlink_log(); $rlink_code1 = new clsGridrlink_code1(); $footer = new clsfooter(); $footer->BindEvents(); $footer->TemplatePath = "./"; $footer->Initialize(); $rlink_log->Initialize(); $rlink_code1->Initialize(); // Events include("./rlink_events.php"); BindEvents(); $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-59881384 $header->Operations(); $rlink_log->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-1B7ABF9F $footer->Show("footer"); $rlink_code1->Show(); $rlink_log->Show(); $header->Show("header"); $Tpl->PParse("main", false); //End Show Page //Unload Page @1-AB7622EF $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); unset($Tpl); //End Unload Page ?>