Visible = true;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record tb_retailersSearch/Error";
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "tb_retailersSearch";
$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_retailer = new clsControl(ccsTextBox, "s_retailer", "s_retailer", ccsText, "", CCGetRequestParam("s_retailer", $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 @23-FCE5E85F
function Validate()
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = ($this->s_retailer->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_retailer->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 @23-B02825FA
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_retailer->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 @23-ED598703
function SetPrimaryKeys($keyArray)
{
$this->PrimaryKeys = $keyArray;
}
function GetPrimaryKeys()
{
return $this->PrimaryKeys;
}
function GetPrimaryKey($keyName)
{
return $this->PrimaryKeys[$keyName];
}
//End MasterDetail
//Operation Method @23-D59A6DE8
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_retailer", "s_region", "s_city", "ccsForm")));
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick", $this->Button_DoSearch)) {
$Redirect = "";
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @23-9FD8B2C6
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_retailer->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_retailer->Show();
$this->s_region->Show();
$this->s_city->Show();
$this->Button_DoSearch->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End tb_retailersSearch Class @23-FCB6E20C
class clsGridtb_retailers { //tb_retailers class @30-5A584017
//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-632389F7
function clsGridtb_retailers($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "tb_retailers";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid tb_retailers";
$this->Attributes = new clsAttributes($this->ComponentName . ":");
$this->DataSource = new clstb_retailersDataSource($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->retailer = new clsControl(ccsLink, "retailer", "retailer", ccsText, "", CCGetRequestParam("retailer", ccsGet, NULL), $this);
$this->retailer->Page = "r2.php";
$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->suburb = new clsControl(ccsLabel, "suburb", "suburb", ccsText, "", CCGetRequestParam("suburb", ccsGet, NULL), $this);
$this->city = new clsControl(ccsLabel, "city", "city", ccsText, "", CCGetRequestParam("city", ccsGet, NULL), $this);
$this->tb_retailers_TotalRecords = new clsControl(ccsLabel, "tb_retailers_TotalRecords", "tb_retailers_TotalRecords", ccsText, "", CCGetRequestParam("tb_retailers_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-32ADAC12
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$this->RowNumber = 0;
$this->DataSource->Parameters["urls_retailer"] = CCGetFromGet("s_retailer", NULL);
$this->DataSource->Parameters["urls_region"] = CCGetFromGet("s_region", NULL);
$this->DataSource->Parameters["urls_city"] = CCGetFromGet("s_city", NULL);
$this->DataSource->Parameters["expr36"] = "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["retailer"] = $this->retailer->Visible;
$this->ControlsVisible["contactperson"] = $this->contactperson->Visible;
$this->ControlsVisible["contact_tel"] = $this->contact_tel->Visible;
$this->ControlsVisible["suburb"] = $this->suburb->Visible;
$this->ControlsVisible["city"] = $this->city->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->retailer->SetValue($this->DataSource->retailer->GetValue());
$this->retailer->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->retailer->Parameters = CCAddParam($this->retailer->Parameters, "retailer_id", $this->DataSource->f("retailer_id"));
$this->contactperson->SetValue($this->DataSource->contactperson->GetValue());
$this->contact_tel->SetValue($this->DataSource->contact_tel->GetValue());
$this->suburb->SetValue($this->DataSource->suburb->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->retailer->Show();
$this->contactperson->Show();
$this->contact_tel->Show();
$this->suburb->Show();
$this->city->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_retailers_TotalRecords->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @30-54C0AD20
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->retailer->Errors->ToString());
$errors = ComposeStrings($errors, $this->contactperson->Errors->ToString());
$errors = ComposeStrings($errors, $this->contact_tel->Errors->ToString());
$errors = ComposeStrings($errors, $this->suburb->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_retailers Class @30-FCB6E20C
class clstb_retailersDataSource extends clsDBeasy { //tb_retailersDataSource Class @30-461F8130
//DataSource Variables @30-01A5969E
public $Parent = "";
public $CCSEvents = "";
public $CCSEventResult;
public $ErrorBlock;
public $CmdExecution;
public $CountSQL;
public $wp;
// Datasource fields
public $retailer;
public $contactperson;
public $contact_tel;
public $suburb;
public $city;
//End DataSource Variables
//DataSourceClass_Initialize Event @30-0AD74114
function clstb_retailersDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid tb_retailers";
$this->Initialize();
$this->retailer = new clsField("retailer", ccsText, "");
$this->contactperson = new clsField("contactperson", ccsText, "");
$this->contact_tel = new clsField("contact_tel", ccsText, "");
$this->suburb = new clsField("suburb", ccsText, "");
$this->city = new clsField("city", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @30-0C5A241F
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "retailer";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
"");
}
//End SetOrder Method
//Prepare Method @30-770AF976
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_retailer", ccsText, "", "", $this->Parameters["urls_retailer"], "", 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", "urls_city", ccsText, "", "", $this->Parameters["urls_city"], "", false);
$this->wp->AddParameter("5", "expr36", ccsText, "", "", $this->Parameters["expr36"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "retailer", $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(opContains, "suburb", $this->wp->GetDBValue("4"), $this->ToSQL($this->wp->GetDBValue("4"), ccsText),false);
$this->wp->Criterion[5] = $this->wp->Operation(opEqual, "confirmed", $this->wp->GetDBValue("5"), $this->ToSQL($this->wp->GetDBValue("5"), ccsText),false);
$this->Where = $this->wp->opAND(
false, $this->wp->opOR(
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]),
$this->wp->Criterion[5]);
}
//End Prepare Method
//Open Method @30-9942D93D
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*)\n\n" .
"FROM tb_retailers";
$this->SQL = "SELECT * \n\n" .
"FROM tb_retailers {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-38B839B1
function SetValues()
{
$this->retailer->SetDBValue($this->f("retailer"));
$this->contactperson->SetDBValue($this->f("contactperson"));
$this->contact_tel->SetDBValue($this->f("contact_tel"));
$this->suburb->SetDBValue($this->f("suburb"));
$this->city->SetDBValue($this->f("city"));
}
//End SetValues Method
} //End tb_retailersDataSource Class @30-FCB6E20C
//Initialize Page @1-EA03AED0
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "r1.html";
$BlockToParse = "main";
$TemplateEncoding = "UTF-8";
$ContentType = "text/html";
$PathToRoot = "./";
$Charset = $Charset ? $Charset : "utf-8";
//End Initialize Page
//Include events file @1-06D5C4E1
include_once("./r1_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-13276256
$DBeasy = new clsDBeasy();
$MainPage->Connections["easy"] = & $DBeasy;
$Attributes = new clsAttributes("page:");
$MainPage->Attributes = & $Attributes;
// Controls
$Panel1 = new clsPanel("Panel1", $MainPage);
$tb_retailersSearch = new clsRecordtb_retailersSearch("", $MainPage);
$tb_retailers = new clsGridtb_retailers("", $MainPage);
$MainPage->Panel1 = & $Panel1;
$MainPage->tb_retailersSearch = & $tb_retailersSearch;
$MainPage->tb_retailers = & $tb_retailers;
$Panel1->AddComponent("tb_retailersSearch", $tb_retailersSearch);
$Panel1->AddComponent("tb_retailers", $tb_retailers);
$tb_retailers->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-30EDC738
$tb_retailersSearch->Operation();
//End Execute Components
//Go to destination page @1-525C80B2
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
header("Location: " . $Redirect);
unset($tb_retailersSearch);
unset($tb_retailers);
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-BDAA1EA7
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBeasy->close();
unset($tb_retailersSearch);
unset($tb_retailers);
unset($Tpl);
//End Unload Page
?>