Visible = true; $this->Errors = new clsErrors(); $this->ds = new clsdownloadlogDataSource(); $this->InsertAllowed = true; if($this->Visible) { $this->ComponentName = "downloadlog"; $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->email = new clsControl(ccsTextBox, "email", "Email", ccsText, "", CCGetRequestParam("email", $Method)); $this->email->Required = true; $this->user = new clsControl(ccsTextBox, "user", "Name", ccsText, "", CCGetRequestParam("user", $Method)); $this->user->Required = true; $this->fileid = new clsControl(ccsListBox, "fileid", "File to Download", ccsInteger, "", CCGetRequestParam("fileid", $Method)); $this->fileid->DSType = dsTable; list($this->fileid->BoundColumn, $this->fileid->TextColumn) = array("id", "filedesc"); $this->fileid->ds = new clsDBbeVisitorPortal(); $this->fileid->ds->SQL = "SELECT * " . "FROM downloaddb"; $this->fileid->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-16F7924E function Initialize() { if(!$this->Visible) return; $this->ds->Parameters["urldate"] = CCGetFromGet("date", ""); } //End Initialize Method //Validate Method @4-D10290E2 function Validate() { $Validation = true; $Where = ""; $Validation = ($this->email->Validate() && $Validation); $Validation = ($this->user->Validate() && $Validation); $Validation = ($this->fileid->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-415EB4DB function CheckErrors() { $errors = false; $errors = ($errors || $this->email->Errors->Count()); $errors = ($errors || $this->user->Errors->Count()); $errors = ($errors || $this->fileid->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-547A44A8 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 = "downloads.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-3BC7C0AD function InsertRow() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert"); if(!$this->InsertAllowed) return false; $this->ds->email->SetValue($this->email->GetValue()); $this->ds->user->SetValue($this->user->GetValue()); $this->ds->fileid->SetValue($this->fileid->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-84470781 function Show() { global $Tpl; global $FileName; $Error = ""; if(!$this->Visible) return; $this->fileid->Prepare(); $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 downloadlog"; } else if($this->ds->next_record()) { $this->ds->SetValues(); if(!$this->FormSubmitted) { $this->email->SetValue($this->ds->email->GetValue()); $this->user->SetValue($this->ds->user->GetValue()); $this->fileid->SetValue($this->ds->fileid->GetValue()); $this->date->SetValue($this->ds->date->GetValue()); } } else { $this->EditMode = false; } } } if(!$this->FormSubmitted) { } if($this->FormSubmitted || $this->CheckErrors()) { $Error .= $this->email->Errors->ToString(); $Error .= $this->user->Errors->ToString(); $Error .= $this->fileid->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->email->Show(); $this->user->Show(); $this->fileid->Show(); $this->Insert->Show(); $this->date->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method } //End downloadlog Class @4-FCB6E20C class clsdownloadlogDataSource extends clsDBbeVisitorPortal { //downloadlogDataSource Class @4-5D71C9E6 //DataSource Variables @4-EBC43767 var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $InsertParameters; var $wp; var $AllParametersSet; // Datasource fields var $email; var $user; var $fileid; var $date; //End DataSource Variables //Class_Initialize Event @4-EA5E44DB function clsdownloadlogDataSource() { $this->ErrorBlock = "Record downloadlog/Error"; $this->Initialize(); $this->email = new clsField("email", ccsText, ""); $this->user = new clsField("user", ccsText, ""); $this->fileid = new clsField("fileid", ccsInteger, ""); $this->date = new clsField("date", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss")); } //End Class_Initialize Event //Prepare Method @4-E2DD2E66 function Prepare() { $this->wp = new clsSQLParameters($this->ErrorBlock); $this->wp->AddParameter("1", "urldate", ccsDate, Array("yyyy", "/", "mm", "/", "dd"), Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), $this->Parameters["urldate"], ""); $this->AllParametersSet = $this->wp->AllParamsSet(); $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "`date`", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsDate)); $this->Where = $this->wp->Criterion[1]; } //End Prepare Method //Open Method @4-7EF12FA4 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->SQL = "SELECT * " . "FROM downloadlog"; $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-D19A8028 function SetValues() { $this->email->SetDBValue($this->f("email")); $this->user->SetDBValue($this->f("user")); $this->fileid->SetDBValue(trim($this->f("fileid"))); $this->date->SetDBValue(trim($this->f("date"))); } //End SetValues Method //Insert Method @4-F20507DF function Insert() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert"); $this->SQL = "INSERT INTO downloadlog (" . "email, " . "`user`, " . "fileid, " . "`date`" . ") VALUES (" . $this->ToSQL($this->email->GetDBValue(), $this->email->DataType) . ", " . $this->ToSQL($this->user->GetDBValue(), $this->user->DataType) . ", " . $this->ToSQL($this->fileid->GetDBValue(), $this->fileid->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 downloadlogDataSource Class @4-FCB6E20C //Include Page implementation @3-EFAB2CA0 include_once("./footer.php"); //End Include Page implementation //Initialize Page @1-B47DB347 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = "downloads.php"; $Redirect = ""; $TemplateFileName = "downloads.html"; $BlockToParse = "main"; $PathToRoot = "./"; //End Initialize Page //Initialize Objects @1-8A162A87 $DBbeVisitorPortal = new clsDBbeVisitorPortal(); // Controls $header = new clsheader(); $header->BindEvents(); $header->TemplatePath = "./"; $header->Initialize(); $downloadlog = new clsRecorddownloadlog(); $footer = new clsfooter(); $footer->BindEvents(); $footer->TemplatePath = "./"; $footer->Initialize(); $downloadlog->Initialize(); // Events include("./downloads_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-2AE7060F $header->Operations(); $downloadlog->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-E87AF326 $footer->Show("footer"); $downloadlog->Show(); $header->Show("header"); $Tpl->PParse("main", false); //End Show Page //Unload Page @1-AB7622EF $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); unset($Tpl); //End Unload Page ?>