Visible = true;
$this->Errors = new clsErrors();
if($this->Visible)
{
$this->ComponentName = "newsSearch";
$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->s_keyword = new clsControl(ccsTextBox, "s_keyword", "s_keyword", ccsText, "", CCGetRequestParam("s_keyword", $Method));
$this->DoSearch = new clsButton("DoSearch");
}
}
//End Class_Initialize Event
//Validate Method @2-F230E30A
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->s_keyword->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-D6729123
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_keyword->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-E1B471CB
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->EditMode = false;
if(!$this->FormSubmitted)
return;
if($this->FormSubmitted) {
$this->PressedButton = "DoSearch";
if(strlen(CCGetParam("DoSearch", ""))) {
$this->PressedButton = "DoSearch";
}
}
$Redirect = "sitenews.php?" . CCGetQueryString("Form", Array("ccsForm", "DoSearch"));
if($this->Validate()) {
if($this->PressedButton == "DoSearch") {
if(!CCGetEvent($this->DoSearch->CCSEvents, "OnClick")) {
$Redirect = "";
} else {
$Redirect = "sitenews.php?" . CCMergeQueryStrings(CCGetQueryString("Form", Array("DoSearch")));
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @2-818B04F7
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->s_keyword->Errors->ToString();
$Error .= $this->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->s_keyword->Show();
$this->DoSearch->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End newsSearch Class @2-FCB6E20C
class clsGridnews { //news class @5-6436B12B
//Variables @5-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 @5-FBEFF99F
function clsGridnews()
{
global $FileName;
$this->ComponentName = "news";
$this->Visible = True;
$this->IsAltRow = false;
$this->Errors = new clsErrors();
$this->ds = new clsnewsDataSource();
$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->newstitle = new clsControl(ccsLabel, "newstitle", "newstitle", ccsText, "", CCGetRequestParam("newstitle", ccsGet));
$this->newsdate = new clsControl(ccsLabel, "newsdate", "newsdate", ccsDate, Array("LongDate"), CCGetRequestParam("newsdate", ccsGet));
$this->newstext = new clsControl(ccsLabel, "newstext", "newstext", ccsMemo, "", CCGetRequestParam("newstext", ccsGet));
$this->newstext->HTML = true;
$this->Alt_newstitle = new clsControl(ccsLabel, "Alt_newstitle", "Alt_newstitle", ccsText, "", CCGetRequestParam("Alt_newstitle", ccsGet));
$this->Alt_newsdate = new clsControl(ccsLabel, "Alt_newsdate", "Alt_newsdate", ccsDate, Array("LongDate"), CCGetRequestParam("Alt_newsdate", ccsGet));
$this->Alt_newstext = new clsControl(ccsLabel, "Alt_newstext", "Alt_newstext", ccsMemo, "", CCGetRequestParam("Alt_newstext", ccsGet));
$this->Alt_newstext->HTML = true;
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple);
}
//End Class_Initialize Event
//Initialize Method @5-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 @5-F1D2253D
function Show()
{
global $Tpl;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->ds->Parameters["urls_keyword"] = CCGetFromGet("s_keyword", "");
$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->newstitle->SetValue($this->ds->newstitle->GetValue());
$this->newsdate->SetValue($this->ds->newsdate->GetValue());
$this->newstext->SetValue($this->ds->newstext->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->newstitle->Show();
$this->newsdate->Show();
$this->newstext->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
}
else
{
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/AltRow";
$this->Alt_newstitle->SetValue($this->ds->Alt_newstitle->GetValue());
$this->Alt_newsdate->SetValue($this->ds->Alt_newsdate->GetValue());
$this->Alt_newstext->SetValue($this->ds->Alt_newstext->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->Alt_newstitle->Show();
$this->Alt_newsdate->Show();
$this->Alt_newstext->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parseto("AltRow", true, "Row");
}
$this->IsAltRow = (!$this->IsAltRow);
$ShownRecords++;
$is_next_record = $this->ds->next_record();
} 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 @5-36B87EBB
function GetErrors()
{
$errors = "";
$errors .= $this->newstitle->Errors->ToString();
$errors .= $this->newsdate->Errors->ToString();
$errors .= $this->newstext->Errors->ToString();
$errors .= $this->Alt_newstitle->Errors->ToString();
$errors .= $this->Alt_newsdate->Errors->ToString();
$errors .= $this->Alt_newstext->Errors->ToString();
$errors .= $this->Errors->ToString();
$errors .= $this->ds->Errors->ToString();
return $errors;
}
//End GetErrors Method
} //End news Class @5-FCB6E20C
class clsnewsDataSource extends clsDBbeVisitorPortal { //newsDataSource Class @5-A3B29CBC
//DataSource Variables @5-50D13D0B
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CountSQL;
var $wp;
// Datasource fields
var $newstitle;
var $newsdate;
var $newstext;
var $Alt_newstitle;
var $Alt_newsdate;
var $Alt_newstext;
//End DataSource Variables
//Class_Initialize Event @5-07DCE821
function clsnewsDataSource()
{
$this->ErrorBlock = "Grid news";
$this->Initialize();
$this->newstitle = new clsField("newstitle", ccsText, "");
$this->newsdate = new clsField("newsdate", ccsDate, Array("yyyy", "-", "mm", "-", "dd"));
$this->newstext = new clsField("newstext", ccsMemo, "");
$this->Alt_newstitle = new clsField("Alt_newstitle", ccsText, "");
$this->Alt_newsdate = new clsField("Alt_newsdate", ccsDate, Array("yyyy", "-", "mm", "-", "dd"));
$this->Alt_newstext = new clsField("Alt_newstext", ccsMemo, "");
}
//End Class_Initialize Event
//SetOrder Method @5-645AA215
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "newsdate desc";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @5-02C9E907
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "");
$this->wp->AddParameter("2", "urls_keyword", ccsMemo, "", "", $this->Parameters["urls_keyword"], "");
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "newstitle", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText));
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "newstext", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsMemo));
$this->Where = $this->wp->opOR(false, $this->wp->Criterion[1], $this->wp->Criterion[2]);
}
//End Prepare Method
//Open Method @5-07E296C2
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM news";
$this->SQL = "SELECT * " .
"FROM news";
$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 @5-31D91BF8
function SetValues()
{
$this->newstitle->SetDBValue($this->f("newstitle"));
$this->newsdate->SetDBValue(trim($this->f("newsdate")));
$this->newstext->SetDBValue($this->f("newstext"));
$this->Alt_newstitle->SetDBValue($this->f("newstitle"));
$this->Alt_newsdate->SetDBValue(trim($this->f("newsdate")));
$this->Alt_newstext->SetDBValue($this->f("newstext"));
}
//End SetValues Method
} //End newsDataSource Class @5-FCB6E20C
//Include Page implementation @19-EFAB2CA0
include_once("./footer.php");
//End Include Page implementation
//Initialize Page @1-D2A9A024
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "sitenews.php";
$Redirect = "";
$TemplateFileName = "sitenews.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Initialize Objects @1-0128A9D6
$DBbeVisitorPortal = new clsDBbeVisitorPortal();
// Controls
$header = new clsheader();
$header->BindEvents();
$header->TemplatePath = "./";
$header->Initialize();
$newsSearch = new clsRecordnewsSearch();
$news = new clsGridnews();
$footer = new clsfooter();
$footer->BindEvents();
$footer->TemplatePath = "./";
$footer->Initialize();
$news->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-797487A0
$header->Operations();
$newsSearch->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-8275EA4B
$footer->Show("footer");
$news->Show();
$newsSearch->Show();
$header->Show("header");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-AB7622EF
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
unset($Tpl);
//End Unload Page
?>