Visible = true; $this->Errors = new clsErrors(); if($this->Visible) { $this->ComponentName = "artigosSearch"; $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $this->ComponentName); $CCSForm = CCGetFromGet("ccsForm", ""); $this->FormSubmitted = ($CCSForm == $this->ComponentName); $Method = $this->FormSubmitted ? ccsPost : ccsGet; $this->s_nome = new clsControl(ccsTextBox, "s_nome", "s_nome", ccsText, "", CCGetRequestParam("s_nome", $Method)); $this->s_familia = new clsControl(ccsTextBox, "s_familia", "s_familia", ccsText, "", CCGetRequestParam("s_familia", $Method)); $this->s_referencia = new clsControl(ccsTextBox, "s_referencia", "s_referencia", ccsText, "", CCGetRequestParam("s_referencia", $Method)); $this->s_codfamilia = new clsControl(ccsTextBox, "s_codfamilia", "s_codfamilia", ccsFloat, "", CCGetRequestParam("s_codfamilia", $Method)); $this->DoSearch = new clsButton("DoSearch"); } } //End Class_Initialize Event //Validate Method @2-59759D70 function Validate() { $Validation = true; $Where = ""; $Validation = ($this->s_nome->Validate() && $Validation); $Validation = ($this->s_familia->Validate() && $Validation); $Validation = ($this->s_referencia->Validate() && $Validation); $Validation = ($this->s_codfamilia->Validate() && $Validation); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate"); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method //Operation Method @2-2FB7F2AB function Operation() { if(!$this->Visible) return; global $Redirect; global $FileName; $this->EditMode = true; if(!$this->FormSubmitted) return; if($this->FormSubmitted) { $this->PressedButton = "DoSearch"; if(strlen(CCGetParam("DoSearch", ""))) { $this->PressedButton = "DoSearch"; } } $Redirect = "index.php?" . CCGetQueryString("Form", Array("DoSearch","ccsForm")) . "&"; if($this->Validate()) { if($this->PressedButton == "DoSearch") { if(!CCGetEvent($this->DoSearch->CCSEvents, "OnClick")) { $Redirect = ""; } else { $Redirect = "index.php?" . CCGetQueryString("Form", Array("DoSearch")) . "&"; } } } else { $Redirect = ""; } } //End Operation Method //Show Method @2-5A184D3F function Show() { global $Tpl; global $FileName; $Error = ""; if(!$this->Visible) return; $RecordBlock = "Record " . $this->ComponentName; $Tpl->block_path = $RecordBlock; if(!$this->FormSubmitted) { } if($this->FormSubmitted) { $Error .= $this->s_nome->Errors->ToString(); $Error .= $this->s_familia->Errors->ToString(); $Error .= $this->s_referencia->Errors->ToString(); $Error .= $this->s_codfamilia->Errors->ToString(); $Error .= $this->Errors->ToString(); $Tpl->SetVar("Error", $Error); $Tpl->Parse("Error", false); } $Tpl->SetVar("Action", $this->HTMLFormAction); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $this->s_nome->Show(); $this->s_familia->Show(); $this->s_referencia->Show(); $this->s_codfamilia->Show(); $this->DoSearch->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; } //End Show Method } //End artigosSearch Class @2-FCB6E20C class clsGridartigos { //artigos class @8-B421D1CD //Variables @8-6E3F89A3 // Public variables var $ComponentName; var $Visible; var $Errors; var $ds; var $PageSize; var $SorterName = ""; var $SorterDirection = ""; var $PageNumber; var $CCSEvents = ""; var $CCSEventResult; // Grid Controls var $StaticControls; var $RowControls; var $Sorter_codfamilia; var $Sorter_familia; var $Sorter_referencia; var $Sorter_nome; var $Sorter_pvp; var $Navigator; //End Variables //Class_Initialize Event @8-28077A85 function clsGridartigos() { global $FileName; $this->ComponentName = "artigos"; $this->Visible = True; $this->Errors = new clsErrors(); $this->ds = new clsartigosDataSource(); $this->PageSize = CCGetParam($this->ComponentName . "PageSize", ""); if(!is_numeric($this->PageSize) || !strlen($this->PageSize)) $this->PageSize = 20; else $this->PageSize = intval($this->PageSize); $this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1)); $this->SorterName = CCGetParam("artigosOrder", ""); $this->SorterDirection = CCGetParam("artigosDir", ""); $this->codfamilia = new clsControl(ccsLabel, "codfamilia", "codfamilia", ccsFloat, "", CCGetRequestParam("codfamilia", ccsGet)); $this->familia = new clsControl(ccsLabel, "familia", "familia", ccsText, "", CCGetRequestParam("familia", ccsGet)); $this->referencia = new clsControl(ccsLabel, "referencia", "referencia", ccsText, "", CCGetRequestParam("referencia", ccsGet)); $this->nome = new clsControl(ccsLabel, "nome", "nome", ccsText, "", CCGetRequestParam("nome", ccsGet)); $this->pvp = new clsControl(ccsLabel, "pvp", "pvp", ccsText, "", CCGetRequestParam("pvp", ccsGet)); $this->Sorter_codfamilia = new clsSorter($this->ComponentName, "Sorter_codfamilia", $FileName); $this->Sorter_familia = new clsSorter($this->ComponentName, "Sorter_familia", $FileName); $this->Sorter_referencia = new clsSorter($this->ComponentName, "Sorter_referencia", $FileName); $this->Sorter_nome = new clsSorter($this->ComponentName, "Sorter_nome", $FileName); $this->Sorter_pvp = new clsSorter($this->ComponentName, "Sorter_pvp", $FileName); $this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 5, tpCentered); } //End Class_Initialize Event //Initialize Method @8-383CA3E0 function Initialize() { if(!$this->Visible) return; $this->ds->PageSize = $this->PageSize; $this->ds->SetOrder($this->SorterName, $this->SorterDirection); $this->ds->AbsolutePage = $this->PageNumber; } //End Initialize Method //Show Method @8-CA316C09 function Show() { global $Tpl; if(!$this->Visible) return; $ShownRecords = 0; $this->ds->Parameters["urls_nome"] = CCGetFromGet("s_nome", ""); $this->ds->Parameters["urls_familia"] = CCGetFromGet("s_familia", ""); $this->ds->Parameters["urls_referencia"] = CCGetFromGet("s_referencia", ""); $this->ds->Parameters["urls_codfamilia"] = CCGetFromGet("s_codfamilia", ""); $this->ds->Prepare(); $this->ds->Open(); $GridBlock = "Grid " . $this->ComponentName; $Tpl->block_path = $GridBlock; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow"); $is_next_record = $this->ds->next_record(); if($is_next_record && $ShownRecords < $this->PageSize) { do { $this->ds->SetValues(); $Tpl->block_path = $GridBlock . "/Row"; $this->codfamilia->SetValue($this->ds->codfamilia->GetValue()); $this->familia->SetValue($this->ds->familia->GetValue()); $this->referencia->SetValue($this->ds->referencia->GetValue()); $this->nome->SetValue($this->ds->nome->GetValue()); $this->pvp->SetValue($this->ds->pvp->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->codfamilia->Show(); $this->familia->Show(); $this->referencia->Show(); $this->nome->Show(); $this->pvp->Show(); $Tpl->block_path = $GridBlock; $Tpl->parse("Row", true); $ShownRecords++; $is_next_record = $this->ds->next_record(); } while ($is_next_record && $ShownRecords < $this->PageSize); } else // Show NoRecords block if no records are found { $Tpl->parse("NoRecords", false); } $this->Navigator->TotalPages = $this->ds->PageCount(); $this->Sorter_codfamilia->Show(); $this->Sorter_familia->Show(); $this->Sorter_referencia->Show(); $this->Sorter_nome->Show(); $this->Sorter_pvp->Show(); $this->Navigator->Show(); $Tpl->parse("", false); $Tpl->block_path = ""; } //End Show Method } //End artigos Class @8-FCB6E20C class clsartigosDataSource extends clsDBConnection1 { //artigosDataSource Class @8-81A0A376 //DataSource Variables @8-876EE1C5 var $CCSEvents = ""; var $CCSEventResult; var $CountSQL; var $wp; // Datasource fields var $codfamilia; var $familia; var $referencia; var $nome; var $pvp; //End DataSource Variables //Class_Initialize Event @8-6FE60A23 function clsartigosDataSource() { $this->Initialize(); $this->codfamilia = new clsField("codfamilia", ccsFloat, ""); $this->familia = new clsField("familia", ccsText, ""); $this->referencia = new clsField("referencia", ccsText, ""); $this->nome = new clsField("nome", ccsText, ""); $this->pvp = new clsField("pvp", ccsText, ""); } //End Class_Initialize Event //SetOrder Method @8-3DDCE460 function SetOrder($SorterName, $SorterDirection) { $this->Order = ""; $this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection, array("Sorter_codfamilia" => array("codfamilia", ""), "Sorter_familia" => array("familia", ""), "Sorter_referencia" => array("referencia", ""), "Sorter_nome" => array("nome", ""), "Sorter_pvp" => array("pvp", ""))); } //End SetOrder Method //Prepare Method @8-27AE98C9 function Prepare() { $this->wp = new clsSQLParameters(); $this->wp->AddParameter("1", "urls_nome", ccsText, "", "", $this->Parameters["urls_nome"], ""); $this->wp->AddParameter("2", "urls_familia", ccsText, "", "", $this->Parameters["urls_familia"], ""); $this->wp->AddParameter("3", "urls_referencia", ccsText, "", "", $this->Parameters["urls_referencia"], ""); $this->wp->AddParameter("4", "urls_codfamilia", ccsFloat, "", "", $this->Parameters["urls_codfamilia"], ""); $this->wp->Criterion[1] = $this->wp->Operation(opContains, "`nome`", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText)); $this->wp->Criterion[2] = $this->wp->Operation(opContains, "`familia`", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsText)); $this->wp->Criterion[3] = $this->wp->Operation(opContains, "`referencia`", $this->wp->GetDBValue("3"), $this->ToSQL($this->wp->GetDBValue("3"), ccsText)); $this->wp->Criterion[4] = $this->wp->Operation(opEqual, "`codfamilia`", $this->wp->GetDBValue("4"), $this->ToSQL($this->wp->GetDBValue("4"), ccsFloat)); $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 @8-690FC560 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->CountSQL = "SELECT COUNT(*) " . "FROM artigos"; $this->SQL = "SELECT * " . "FROM artigos"; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect"); $this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this); $this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order)); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect"); $this->MoveToPage($this->AbsolutePage); } //End Open Method //SetValues Method @8-45420112 function SetValues() { $this->codfamilia->SetDBValue($this->f("codfamilia")); $this->familia->SetDBValue($this->f("familia")); $this->referencia->SetDBValue($this->f("referencia")); $this->nome->SetDBValue($this->f("nome")); $this->pvp->SetDBValue($this->f("pvp")); } //End SetValues Method } //End artigosDataSource Class @8-FCB6E20C //Initialize Page @1-FE486DDE // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = "index.php"; $Redirect = ""; $TemplateFileName = "index.html"; $BlockToParse = "main"; $PathToRoot = "./"; //End Initialize Page //Initialize Objects @1-07BAE4DA $DBConnection1 = new clsDBConnection1(); // Controls $artigosSearch = new clsRecordartigosSearch(); $artigos = new clsGridartigos(); $artigos->Initialize(); $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize"); //End Initialize Objects //Execute Components @1-5BA84512 $artigosSearch->Operation(); //End Execute Components //Go to destination page @1-BEB91355 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); header("Location: " . $Redirect); exit; } //End Go to destination page //Initialize HTML Template @1-A0111C9D $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView"); $Tpl = new clsTemplate(); $Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main"); $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow"); //End Initialize HTML Template //Show Page @1-D999EB83 $artigosSearch->Show(); $artigos->Show(); $Tpl->PParse("main", false); //End Show Page //Unload Page @1-AB7622EF $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); unset($Tpl); //End Unload Page ?>