ComponentName = "tb_subdealers";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid tb_subdealers";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clstb_subdealersDataSource($this);
$this->ds = & $this->DataSource;
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 1;
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->RowOpenTag = new clsPanel("RowOpenTag", $this);
$this->RowComponents = new clsPanel("RowComponents", $this);
$this->logo = new clsControl(ccsImage, "logo", "logo", ccsText, "", CCGetRequestParam("logo", ccsGet, NULL), $this);
$this->wholesaler = new clsControl(ccsLabel, "wholesaler", "wholesaler", ccsText, "", CCGetRequestParam("wholesaler", ccsGet, NULL), $this);
$this->region = new clsControl(ccsLabel, "region", "region", ccsText, "", CCGetRequestParam("region", ccsGet, NULL), $this);
$this->emailaddress = new clsControl(ccsLink, "emailaddress", "emailaddress", ccsText, "", CCGetRequestParam("emailaddress", ccsGet, NULL), $this);
$this->contactperson = new clsControl(ccsLabel, "contactperson", "contactperson", ccsText, "", CCGetRequestParam("contactperson", ccsGet, NULL), $this);
$this->contact_tel = new clsControl(ccsLabel, "contact_tel", "contact_tel", ccsText, "", CCGetRequestParam("contact_tel", ccsGet, NULL), $this);
$this->maincontact = new clsControl(ccsLabel, "maincontact", "maincontact", ccsText, "", CCGetRequestParam("maincontact", ccsGet, NULL), $this);
$this->telephone = new clsControl(ccsLabel, "telephone", "telephone", ccsText, "", CCGetRequestParam("telephone", ccsGet, NULL), $this);
$this->Label1 = new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet, NULL), $this);
$this->Label2 = new clsControl(ccsLabel, "Label2", "Label2", ccsText, "", CCGetRequestParam("Label2", ccsGet, NULL), $this);
$this->city = new clsControl(ccsLabel, "city", "city", ccsText, "", CCGetRequestParam("city", ccsGet, NULL), $this);
$this->RowCloseTag = new clsPanel("RowCloseTag", $this);
$this->RowComponents->AddComponent("logo", $this->logo);
$this->RowComponents->AddComponent("wholesaler", $this->wholesaler);
$this->RowComponents->AddComponent("region", $this->region);
$this->RowComponents->AddComponent("emailaddress", $this->emailaddress);
$this->RowComponents->AddComponent("contactperson", $this->contactperson);
$this->RowComponents->AddComponent("contact_tel", $this->contact_tel);
$this->RowComponents->AddComponent("maincontact", $this->maincontact);
$this->RowComponents->AddComponent("telephone", $this->telephone);
$this->RowComponents->AddComponent("Label1", $this->Label1);
$this->RowComponents->AddComponent("Label2", $this->Label2);
$this->RowComponents->AddComponent("city", $this->city);
}
//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-E3BF4937
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["urlwholesaler_id"] = CCGetFromGet("wholesaler_id", 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->SetValue("numberOfColumns", 1);
$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["RowOpenTag"] = $this->RowOpenTag->Visible;
$this->ControlsVisible["RowComponents"] = $this->RowComponents->Visible;
$this->ControlsVisible["logo"] = $this->logo->Visible;
$this->ControlsVisible["wholesaler"] = $this->wholesaler->Visible;
$this->ControlsVisible["region"] = $this->region->Visible;
$this->ControlsVisible["emailaddress"] = $this->emailaddress->Visible;
$this->ControlsVisible["contactperson"] = $this->contactperson->Visible;
$this->ControlsVisible["contact_tel"] = $this->contact_tel->Visible;
$this->ControlsVisible["maincontact"] = $this->maincontact->Visible;
$this->ControlsVisible["telephone"] = $this->telephone->Visible;
$this->ControlsVisible["Label1"] = $this->Label1->Visible;
$this->ControlsVisible["Label2"] = $this->Label2->Visible;
$this->ControlsVisible["city"] = $this->city->Visible;
$this->ControlsVisible["RowCloseTag"] = $this->RowCloseTag->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->logo->SetValue($this->DataSource->logo->GetValue());
$this->wholesaler->SetValue($this->DataSource->wholesaler->GetValue());
$this->region->SetValue($this->DataSource->region->GetValue());
$this->emailaddress->SetValue($this->DataSource->emailaddress->GetValue());
$this->emailaddress->Page = $this->DataSource->f("emailaddress");
$this->contactperson->SetValue($this->DataSource->contactperson->GetValue());
$this->contact_tel->SetValue($this->DataSource->contact_tel->GetValue());
$this->maincontact->SetValue($this->DataSource->maincontact->GetValue());
$this->telephone->SetValue($this->DataSource->telephone->GetValue());
$this->Label1->SetValue($this->DataSource->Label1->GetValue());
$this->Label2->SetValue($this->DataSource->Label2->GetValue());
$this->city->SetValue($this->DataSource->city->GetValue());
$this->Attributes->SetValue("rowNumber", $this->RowNumber);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->Attributes->Show();
$this->RowOpenTag->Show();
$this->RowComponents->Show();
$this->RowCloseTag->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
}
}
$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 @2-02CCF23B
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->logo->Errors->ToString());
$errors = ComposeStrings($errors, $this->wholesaler->Errors->ToString());
$errors = ComposeStrings($errors, $this->region->Errors->ToString());
$errors = ComposeStrings($errors, $this->emailaddress->Errors->ToString());
$errors = ComposeStrings($errors, $this->contactperson->Errors->ToString());
$errors = ComposeStrings($errors, $this->contact_tel->Errors->ToString());
$errors = ComposeStrings($errors, $this->maincontact->Errors->ToString());
$errors = ComposeStrings($errors, $this->telephone->Errors->ToString());
$errors = ComposeStrings($errors, $this->Label1->Errors->ToString());
$errors = ComposeStrings($errors, $this->Label2->Errors->ToString());
$errors = ComposeStrings($errors, $this->city->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End tb_subdealers Class @2-FCB6E20C
class clstb_subdealersDataSource extends clsDBeasy { //tb_subdealersDataSource Class @2-3BEDF3EE
//DataSource Variables @2-9214AEB3
public $Parent = "";
public $CCSEvents = "";
public $CCSEventResult;
public $ErrorBlock;
public $CmdExecution;
public $CountSQL;
public $wp;
// Datasource fields
public $logo;
public $wholesaler;
public $region;
public $emailaddress;
public $contactperson;
public $contact_tel;
public $maincontact;
public $telephone;
public $Label1;
public $Label2;
public $city;
//End DataSource Variables
//DataSourceClass_Initialize Event @2-8D187D3E
function clstb_subdealersDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid tb_subdealers";
$this->Initialize();
$this->logo = new clsField("logo", ccsText, "");
$this->wholesaler = new clsField("wholesaler", ccsText, "");
$this->region = new clsField("region", ccsText, "");
$this->emailaddress = new clsField("emailaddress", ccsText, "");
$this->contactperson = new clsField("contactperson", ccsText, "");
$this->contact_tel = new clsField("contact_tel", ccsText, "");
$this->maincontact = new clsField("maincontact", ccsText, "");
$this->telephone = new clsField("telephone", ccsText, "");
$this->Label1 = new clsField("Label1", ccsText, "");
$this->Label2 = new clsField("Label2", ccsText, "");
$this->city = new clsField("city", 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-DA64B541
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urlwholesaler_id", ccsInteger, "", "", $this->Parameters["urlwholesaler_id"], "", true);
$this->wp->Criterion[1] = $this->wp->Operation(opEqual, "wholesaler_id", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),true);
$this->Where =
$this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @2-9A3C4E25
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM tb_subdealers";
$this->SQL = "SELECT * \n\n" .
"FROM tb_subdealers {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 @2-409F2BB0
function SetValues()
{
$this->logo->SetDBValue($this->f("logo"));
$this->wholesaler->SetDBValue($this->f("wholesaler"));
$this->region->SetDBValue($this->f("region"));
$this->emailaddress->SetDBValue($this->f("emailaddress"));
$this->contactperson->SetDBValue($this->f("contactperson"));
$this->contact_tel->SetDBValue($this->f("contact_tel"));
$this->maincontact->SetDBValue($this->f("maincontact"));
$this->telephone->SetDBValue($this->f("telephone"));
$this->Label1->SetDBValue($this->f("direction"));
$this->Label2->SetDBValue($this->f("suburb"));
$this->city->SetDBValue($this->f("city"));
}
//End SetValues Method
} //End tb_subdealersDataSource Class @2-FCB6E20C
//Initialize Page @1-706655FE
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "s2.html";
$BlockToParse = "main";
$TemplateEncoding = "UTF-8";
$ContentType = "text/html";
$PathToRoot = "./";
$Charset = $Charset ? $Charset : "utf-8";
//End Initialize Page
//Include events file @1-B9C03F09
include_once("./s2_events.php");
//End Include events file
//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize
//Initialize Objects @1-F2FF9160
$DBeasy = new clsDBeasy();
$MainPage->Connections["easy"] = & $DBeasy;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$tb_subdealers = new clsGridtb_subdealers("", $MainPage);
$MainPage->tb_subdealers = & $tb_subdealers;
$tb_subdealers->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-51EC165D
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "UTF-8");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
$Attributes->SetValue("pathToRoot", "");
$Attributes->Show();
//End Initialize HTML Template
//Go to destination page @1-6C64E5B8
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
header("Location: " . $Redirect);
unset($tb_subdealers);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-33CB6E24
$tb_subdealers->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-B5D29558
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
unset($tb_subdealers);
unset($Tpl);
//End Unload Page
?>