Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record tb_subdealersSearch/Error";
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "tb_subdealersSearch";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->s_company = new clsControl(ccsTextBox, "s_company", "s_company", ccsText, "", CCGetRequestParam("s_company", $Method, NULL), $this);
$this->s_region = new clsControl(ccsListBox, "s_region", "s_region", ccsText, "", CCGetRequestParam("s_region", $Method, NULL), $this);
$this->s_region->DSType = dsTable;
$this->s_region->DataSource = new clsDBeasy();
$this->s_region->ds = & $this->s_region->DataSource;
$this->s_region->DataSource->SQL = "SELECT * \n" .
"FROM tb_regions {SQL_Where} {SQL_OrderBy}";
list($this->s_region->BoundColumn, $this->s_region->TextColumn, $this->s_region->DBFormat) = array("region", "region", "");
$this->s_city = new clsControl(ccsTextBox, "s_city", "s_city", ccsText, "", CCGetRequestParam("s_city", $Method, NULL), $this);
$this->Button_DoSearch = new clsButton("Button_DoSearch", $Method, $this);
}
}
//End Class_Initialize Event
//Validate Method @3-6A4A0BBB
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->s_company->Validate() && $Validation);
$Validation = ($this->s_region->Validate() && $Validation);
$Validation = ($this->s_city->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
$Validation = $Validation && ($this->s_company->Errors->Count() == 0);
$Validation = $Validation && ($this->s_region->Errors->Count() == 0);
$Validation = $Validation && ($this->s_city->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @3-8D4104DB
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_company->Errors->Count());
$errors = ($errors || $this->s_region->Errors->Count());
$errors = ($errors || $this->s_city->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//MasterDetail @3-ED598703
function SetPrimaryKeys($keyArray)
{
$this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
return $this->PrimaryKeys[$keyName];
}
//End MasterDetail
//Operation Method @3-D706BD0B
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
if(!$this->FormSubmitted) {
return;
}
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoSearch";
if($this->Button_DoSearch->Pressed) {
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = $FileName . "?" . CCGetQueryString("QueryString", array("ccsForm"));
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
$Redirect = $FileName . "?" . CCMergeQueryStrings(CCGetQueryString("Form", array("Button_DoSearch", "Button_DoSearch_x", "Button_DoSearch_y")), CCGetQueryString("QueryString", array("s_company", "s_region", "s_city", "ccsForm")));
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick", $this->Button_DoSearch)) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @3-4E81088B
function Show()
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->s_region->Prepare();
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if (!$this->FormSubmitted) {
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error = "";
$Error = ComposeStrings($Error, $this->s_company->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_region->Errors->ToString());
$Error = ComposeStrings($Error, $this->s_city->Errors->ToString());
$Error = ComposeStrings($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", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&", $this->HTMLFormAction));
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
$this->Attributes->Show();
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->s_company->Show();
$this->s_region->Show();
$this->s_city->Show();
$this->Button_DoSearch->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End tb_subdealersSearch Class @3-FCB6E20C
class clsGridtb_companies { //tb_companies class @30-606B4665
//Variables @30-6E51DF5A
// Public variables
public $ComponentType = "Grid";
public $ComponentName;
public $Visible;
public $Errors;
public $ErrorBlock;
public $ds;
public $DataSource;
public $PageSize;
public $IsEmpty;
public $ForceIteration = false;
public $HasRecord = false;
public $SorterName = "";
public $SorterDirection = "";
public $PageNumber;
public $RowNumber;
public $ControlsVisible = array();
public $CCSEvents = "";
public $CCSEventResult;
public $RelativePath = "";
public $Attributes;
// Grid Controls
public $StaticControls;
public $RowControls;
//End Variables
//Class_Initialize Event @30-6AA151B8
function clsGridtb_companies($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "tb_companies";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid tb_companies";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clstb_companiesDataSource($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->company_name = new clsControl(ccsLink, "company_name", "company_name", ccsText, "", CCGetRequestParam("company_name", ccsGet, NULL), $this);
$this->company_name->Page = "c2.php";
$this->contact_tel = new clsControl(ccsLabel, "contact_tel", "contact_tel", ccsText, "", CCGetRequestParam("contact_tel", ccsGet, NULL), $this);
$this->region = new clsControl(ccsLabel, "region", "region", ccsText, "", CCGetRequestParam("region", ccsGet, NULL), $this);
$this->Label1 = new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet, NULL), $this);
$this->tb_companies_TotalRecords = new clsControl(ccsLabel, "tb_companies_TotalRecords", "tb_companies_TotalRecords", ccsText, "", CCGetRequestParam("tb_companies_TotalRecords", ccsGet, NULL), $this);
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpCentered, $this);
$this->Navigator->PageSizes = array("1", "5", "10", "25", "50");
}
//End Class_Initialize Event
//Initialize Method @30-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 @30-D07D6FB3
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["urls_company"] = CCGetFromGet("s_company", NULL);
$this->DataSource->Parameters["urls_region"] = CCGetFromGet("s_region", NULL);
$this->DataSource->Parameters["urls_city"] = CCGetFromGet("s_city", NULL);
$this->DataSource->Parameters["expr35"] = "Yes";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$this->HasRecord = $this->DataSource->has_next_record();
$this->IsEmpty = ! $this->HasRecord;
if ($this->DataSource->PageCount() <= 1) {
$this->Navigator->Visible = false;
}
$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["company_name"] = $this->company_name->Visible;
$this->ControlsVisible["contact_tel"] = $this->contact_tel->Visible;
$this->ControlsVisible["region"] = $this->region->Visible;
$this->ControlsVisible["Label1"] = $this->Label1->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->company_name->SetValue($this->DataSource->company_name->GetValue());
$this->company_name->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->company_name->Parameters = CCAddParam($this->company_name->Parameters, "company_id", $this->DataSource->f("company_id"));
$this->contact_tel->SetValue($this->DataSource->contact_tel->GetValue());
$this->region->SetValue($this->DataSource->region->GetValue());
$this->Label1->SetValue($this->DataSource->Label1->GetValue());
$this->Attributes->SetValue("rowNumber", $this->RowNumber);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->Attributes->Show();
$this->company_name->Show();
$this->contact_tel->Show();
$this->region->Show();
$this->Label1->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;
}
$this->Navigator->PageNumber = $this->DataSource->AbsolutePage;
$this->Navigator->PageSize = $this->PageSize;
if ($this->DataSource->RecordsCount == "CCS not counted")
$this->Navigator->TotalPages = $this->DataSource->AbsolutePage + ($this->DataSource->next_record() ? 1 : 0);
else
$this->Navigator->TotalPages = $this->DataSource->PageCount();
$this->tb_companies_TotalRecords->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @30-698DB6F1
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->company_name->Errors->ToString());
$errors = ComposeStrings($errors, $this->contact_tel->Errors->ToString());
$errors = ComposeStrings($errors, $this->region->Errors->ToString());
$errors = ComposeStrings($errors, $this->Label1->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End tb_companies Class @30-FCB6E20C
class clstb_companiesDataSource extends clsDBeasy { //tb_companiesDataSource Class @30-EEC81867
//DataSource Variables @30-6AA0E288
public $Parent = "";
public $CCSEvents = "";
public $CCSEventResult;
public $ErrorBlock;
public $CmdExecution;
public $CountSQL;
public $wp;
// Datasource fields
public $company_name;
public $contact_tel;
public $region;
public $Label1;
//End DataSource Variables
//DataSourceClass_Initialize Event @30-A6DE40F5
function clstb_companiesDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid tb_companies";
$this->Initialize();
$this->company_name = new clsField("company_name", ccsText, "");
$this->contact_tel = new clsField("contact_tel", ccsText, "");
$this->region = new clsField("region", ccsText, "");
$this->Label1 = new clsField("Label1", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @30-44464C8A
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "company_name";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @30-AF039BCD
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_company", ccsText, "", "", $this->Parameters["urls_company"], "", false);
$this->wp->AddParameter("2", "urls_region", ccsText, "", "", $this->Parameters["urls_region"], "", false);
$this->wp->AddParameter("3", "urls_city", ccsText, "", "", $this->Parameters["urls_city"], "", false);
$this->wp->AddParameter("4", "expr35", ccsText, "", "", $this->Parameters["expr35"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "company_name", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "region", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsText),false);
$this->wp->Criterion[3] = $this->wp->Operation(opContains, "city", $this->wp->GetDBValue("3"), $this->ToSQL($this->wp->GetDBValue("3"), ccsText),false);
$this->wp->Criterion[4] = $this->wp->Operation(opEqual, "confirmed", $this->wp->GetDBValue("4"), $this->ToSQL($this->wp->GetDBValue("4"), ccsText),false);
$this->Where = $this->wp->opAND(
false, $this->wp->opAND(
false, $this->wp->opAND(
false,
$this->wp->Criterion[1],
$this->wp->Criterion[2]),
$this->wp->Criterion[3]),
$this->wp->Criterion[4]);
}
//End Prepare Method
//Open Method @30-2FDDB594
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM tb_companies";
$this->SQL = "SELECT company_id, company_name, contactperson, contact_tel, emailaddress, mainaccount, region, city \n\n" .
"FROM tb_companies {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 @30-00645D9D
function SetValues()
{
$this->company_name->SetDBValue($this->f("company_name"));
$this->contact_tel->SetDBValue($this->f("contact_tel"));
$this->region->SetDBValue($this->f("region"));
$this->Label1->SetDBValue($this->f("city"));
}
//End SetValues Method
} //End tb_companiesDataSource Class @30-FCB6E20C
//Initialize Page @1-F01F8C6F
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "c1.html";
$BlockToParse = "main";
$TemplateEncoding = "UTF-8";
$ContentType = "text/html";
$PathToRoot = "./";
$Charset = $Charset ? $Charset : "utf-8";
//End Initialize Page
//Include events file @1-4E9A6BEE
include_once("./c1_events.php");
//End Include events file
//BeforeInitialize Binding @1-17AC9191
$CCSEvents["BeforeInitialize"] = "Page_BeforeInitialize";
//End BeforeInitialize Binding
//Before Initialize @1-E870CEBC
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
//End Before Initialize
//Initialize Objects @1-92A617AB
$DBeasy = new clsDBeasy();
$MainPage->Connections["easy"] = & $DBeasy;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$Panel1 = new clsPanel("Panel1", $MainPage);
$tb_subdealersSearch = new clsRecordtb_subdealersSearch("", $MainPage);
$tb_companies = new clsGridtb_companies("", $MainPage);
$MainPage->Panel1 = & $Panel1;
$MainPage->tb_subdealersSearch = & $tb_subdealersSearch;
$MainPage->tb_companies = & $tb_companies;
$Panel1->AddComponent("tb_subdealersSearch", $tb_subdealersSearch);
$Panel1->AddComponent("tb_companies", $tb_companies);
$tb_companies->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
//Execute Components @1-A38ABCB4
$tb_subdealersSearch->Operation();
//End Execute Components
//Go to destination page @1-BA440268
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
header("Location: " . $Redirect);
unset($tb_subdealersSearch);
unset($tb_companies);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-1DB0DD34
$Panel1->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-6407AB5D
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
unset($tb_subdealersSearch);
unset($tb_companies);
unset($Tpl);
//End Unload Page
?>