ComponentName = "articoli";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid articoli";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clsarticoliDataSource($this);
$this->ds = & $this->DataSource;
$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 > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("
Form: Grid " . $this->ComponentName . "
Error: (CCS06) Invalid page size.
");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
if ($this->PageNumber <= 0) $this->PageNumber = 1;
$this->titolo = new clsControl(ccsLabel, "titolo", "titolo", ccsText, "", CCGetRequestParam("titolo", ccsGet, NULL), $this);
$this->sommario = new clsControl(ccsLabel, "sommario", "sommario", ccsMemo, "", CCGetRequestParam("sommario", ccsGet, NULL), $this);
$this->DatePub = new clsControl(ccsLabel, "DatePub", "DatePub", ccsText, "", CCGetRequestParam("DatePub", ccsGet, NULL), $this);
}
//End Class_Initialize Event
//Initialize Method @4-90E704C5
function Initialize()
{
if(!$this->Visible) return;
$this->DataSource->PageSize = & $this->PageSize;
$this->DataSource->AbsolutePage = & $this->PageNumber;
$this->DataSource->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//Show Method @4-21FB9C1B
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["urlidarticolocat"] = CCGetFromGet("idarticolocat", NULL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$this->HasRecord = $this->DataSource->has_next_record();
$this->IsEmpty = ! $this->HasRecord;
$this->Attributes->Show();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
if(!$this->Visible) return;
$GridBlock = "Grid " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
if (!$this->IsEmpty) {
$this->ControlsVisible["titolo"] = $this->titolo->Visible;
$this->ControlsVisible["sommario"] = $this->sommario->Visible;
$this->ControlsVisible["DatePub"] = $this->DatePub->Visible;
while ($this->ForceIteration || (($this->RowNumber < $this->PageSize) && ($this->HasRecord = $this->DataSource->has_next_record()))) {
$this->RowNumber++;
if ($this->HasRecord) {
$this->DataSource->next_record();
$this->DataSource->SetValues();
}
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->titolo->SetValue($this->DataSource->titolo->GetValue());
$this->sommario->SetValue($this->DataSource->sommario->GetValue());
$this->DatePub->SetValue($this->DataSource->DatePub->GetValue());
$this->Attributes->SetValue("rowNumber", $this->RowNumber);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->Attributes->Show();
$this->titolo->Show();
$this->sommario->Show();
$this->DatePub->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
}
}
else { // Show NoRecords block if no records are found
$this->Attributes->Show();
$Tpl->parse("NoRecords", false);
}
$errors = $this->GetErrors();
if(strlen($errors))
{
$Tpl->replaceblock("", $errors);
$Tpl->block_path = $ParentPath;
return;
}
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @4-DA58E04E
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->titolo->Errors->ToString());
$errors = ComposeStrings($errors, $this->sommario->Errors->ToString());
$errors = ComposeStrings($errors, $this->DatePub->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End articoli Class @4-FCB6E20C
class clsarticoliDataSource extends clsDBConnection1 { //articoliDataSource Class @4-B363F20E
//DataSource Variables @4-D8FB624A
public $Parent = "";
public $CCSEvents = "";
public $CCSEventResult;
public $ErrorBlock;
public $CmdExecution;
public $CountSQL;
public $wp;
// Datasource fields
public $titolo;
public $sommario;
public $DatePub;
//End DataSource Variables
//DataSourceClass_Initialize Event @4-0C8972EB
function clsarticoliDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid articoli";
$this->Initialize();
$this->titolo = new clsField("titolo", ccsText, "");
$this->sommario = new clsField("sommario", ccsMemo, "");
$this->DatePub = new clsField("DatePub", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @4-04BB9701
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "datafine desc";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @4-BC814507
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlidarticolocat", ccsInteger, "", "", $this->Parameters["urlidarticolocat"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "idarticolocat", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @4-DCF90621
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM articoli";
$this->SQL = "SELECT *, date_format(datainizio, \"%a, %d %b %Y %H:%i:%s GMT\") AS datePub\n\n" .
"FROM articoli {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
if ($this->CountSQL)
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
else
$this->RecordsCount = "CCS not counted";
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @4-E6C4DDDC
function SetValues()
{
$this->titolo->SetDBValue($this->f("titolo"));
$this->sommario->SetDBValue($this->f("sommario"));
$this->DatePub->SetDBValue($this->f("datePub"));
}
//End SetValues Method
} //End articoliDataSource Class @4-FCB6E20C
//Initialize Page @1-81F3814A
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "rss.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$ContentType = "text/html";
$PathToRoot = "../";
//End Initialize Page
//Include events file @1-BBF3A5A8
include_once("./rss_events.php");
//End Include events file
//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize
//Initialize Objects @1-BDBEFC0B
$DBConnection1 = new clsDBConnection1();
$MainPage->Connections["Connection1"] = & $DBConnection1;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$articoli = new clsGridarticoli("", $MainPage);
$lblTitolo = new clsControl(ccsLabel, "lblTitolo", "lblTitolo", ccsText, "", CCGetRequestParam("lblTitolo", ccsGet, NULL), $MainPage);
$lblLink = new clsControl(ccsLabel, "lblLink", "lblLink", ccsText, "", CCGetRequestParam("lblLink", ccsGet, NULL), $MainPage);
$lblDescrizione = new clsControl(ccsLabel, "lblDescrizione", "lblDescrizione", ccsText, "", CCGetRequestParam("lblDescrizione", ccsGet, NULL), $MainPage);
$MainPage->articoli = & $articoli;
$MainPage->lblTitolo = & $lblTitolo;
$MainPage->lblLink = & $lblLink;
$MainPage->lblDescrizione = & $lblDescrizione;
$articoli->Initialize();
BindEvents();
$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-52F9C312
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
$Attributes->SetValue("pathToRoot", "../");
$Attributes->Show();
//End Initialize HTML Template
//Go to destination page @1-3F3346BF
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
header("Location: " . $Redirect);
unset($articoli);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-50F024C3
$articoli->Show();
$lblTitolo->Show();
$lblLink->Show();
$lblDescrizione->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
if (!isset($main_block)) $main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page
//Unload Page @1-7476A512
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
unset($articoli);
unset($Tpl);
//End Unload Page
?>