ComponentName = "occasion2";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid occasion2";
$this->DataSource = new clsoccasion2DataSource($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->cat = & new clsControl(ccsLink, "cat", "cat", ccsText, "", CCGetRequestParam("cat", ccsGet), $this);
$this->cat->Page = "liste.php";
$this->id = & new clsControl(ccsHidden, "id", "id", ccsInteger, "", CCGetRequestParam("id", ccsGet), $this);
}
//End Class_Initialize Event
//Initialize Method @2-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 @2-B900D039
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$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(($ShownRecords < $this->PageSize) && $this->DataSource->next_record())
{
do {
$this->DataSource->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->cat->SetValue($this->DataSource->cat->GetValue());
$this->cat->Parameters = CCGetQueryString("Form", array("ccsForm"));
$this->cat->Parameters = CCAddParam($this->cat->Parameters, "cat", $this->DataSource->f("id"));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->cat->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
$ShownRecords++;
} while (($ShownRecords < $this->PageSize) && $this->DataSource->next_record());
}
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->id->SetValue($this->DataSource->id->GetValue());
$this->id->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @2-C5276DAD
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->cat->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End occasion2 Class @2-FCB6E20C
class clsoccasion2DataSource extends clsDBoccasion { //occasion2DataSource Class @2-6BD19168
//DataSource Variables @2-DDC0A755
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $id;
var $cat;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-AFADD2AF
function clsoccasion2DataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid occasion2";
$this->Initialize();
$this->id = new clsField("id", ccsInteger, "");
$this->cat = new clsField("cat", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @2-9E1383D1
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @2-14D6CD9D
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
}
//End Prepare Method
//Open Method @2-7E5C08E0
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*) FROM occasion2";
$this->SQL = "SELECT DISTINCT cat FROM occasion2";
$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 @2-EB6F829F
function SetValues()
{
$this->id->SetDBValue(trim($this->f("id")));
$this->cat->SetDBValue($this->f("cat"));
}
//End SetValues Method
} //End occasion2DataSource Class @2-FCB6E20C
//Initialize Page @1-6F38AB77
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "categorie.html";
$BlockToParse = "main";
$TemplateEncoding = "ISO-8859-1";
$PathToRoot = "./";
//End Initialize Page
//Include events file @1-58AD14A9
include("./categorie_events.php");
//End Include events file
//Initialize Objects @1-0D758C2E
$DBoccasion = new clsDBoccasion();
$MainPage->Connections["occasion"] = & $DBoccasion;
// Controls
$occasion2 = & new clsGridoccasion2("", $MainPage);
$MainPage->occasion2 = & $occasion2;
$occasion2->Initialize();
BindEvents();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
$Charset = $Charset ? $Charset : "iso-8859-1";
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-6CC97037
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "ISO-8859-1");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
//End Initialize HTML Template
//Go to destination page @1-A71F06B8
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBoccasion->close();
header("Location: " . $Redirect);
unset($occasion2);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-7511A57D
$occasion2->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
$main_block = $Tpl->GetVar($BlockToParse);
if(preg_match("/<\/body>/i", $main_block)) {
$main_block = preg_replace("/<\/body>/i", "Generated with CodeCharge Studio." . "