Beispiel #1
0
 public function __construct($arrayRestFolder = NULL)
 {
     parent::__construct($arrayRestFolder);
     if ($arrayRestFolder != NULL) {
         $this->arrayRestFolder = $arrayRestFolder;
         $this->arrayVariable = Navigation::getVariableArraySlug($this->arrayRestFolder);
     }
     $this->module = DataHandler::getValueByArrayIndex($this->arrayVariable, "module") ? DataHandler::getValueByArrayIndex($this->arrayVariable, "module") : "theme";
     switch ($this->module) {
         case "style":
             $this->DAO = StyleDAO::getInstance();
             break;
         case "technique":
             $this->DAO = TechniqueDAO::getInstance();
             break;
         case "type":
             $this->DAO = TypeDAO::getInstance();
             break;
         case "format":
             $this->DAO = FormatDAO::getInstance();
             break;
         case "composition":
             $this->DAO = CompositionDAO::getInstance();
             break;
         case "theme":
             $this->DAO = ThemeDAO::getInstance();
             break;
         default:
             $this->DAO = ThemeDAO::getInstance();
             break;
     }
 }
Beispiel #2
0
 private function consultValues()
 {
     $ProductModelQuadroDAO = ProductModelQuadroDAO::getInstance();
     $this->MaterialDAO = MaterialDAO::getInstance();
     $this->ColorDAO = ColorDAO::getInstance();
     $this->StyleDAO = StyleDAO::getInstance();
     $this->FormatDAO = FormatDAO::getInstance();
     $this->ThemeDAO = ThemeDAO::getInstance();
     $this->CompositionDAO = CompositionDAO::getInstance();
     $this->TechniqueDAO = TechniqueDAO::getInstance();
     $this->TypeDAO = TypeDAO::getInstance();
     //fazendo o que precisa fazer para ter os dados do menu
     $this->arrayMaterial = $this->MaterialDAO->select(MaterialDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayMaterial);
     $this->arrayColor = $this->ColorDAO->select(ColorDAO::RETURN_VO, NULL, 1);
     // $this->addTotal($this->arrayColor);
     //Debug::print_r($this->arrayColor);
     //busca as imagens
     if ($this->arrayColor->success) {
         $tempVO = array();
         foreach ($this->arrayColor->result as $ColorVO) {
             $tempStdColor = $ColorVO->toStdClass();
             //primeira letra maiuscula
             $tempStdColor->name = ucfirst($tempStdColor->name);
             $tempVO[] = $tempStdColor;
             //Debug::print_r($tempVO);
         }
         $this->arrayColor->result = $tempVO;
     }
     $this->arrayStyle = $this->StyleDAO->select(StyleDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayStyle);
     $this->arrayFormat = $this->FormatDAO->select(FormatDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayFormat);
     $this->arrayTheme = $this->ThemeDAO->select(ThemeDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayTheme);
     $this->arrayComposition = $this->CompositionDAO->select(CompositionDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayComposition);
     $this->arrayTechnique = $this->TechniqueDAO->select(TechniqueDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayTechnique);
     $this->arrayType = $this->TypeDAO->select(TypeDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayType);
     //define a base da url
     $this->url_final = Config::getRootPath("quadros/filter");
     $this->arrayBreadCrumb = array();
     if ($this->arrayVariable != NULL) {
         $temp_array = array_splice($this->arrayRestFolder, 2, count($this->arrayRestFolder) - 1);
         //Debug::print_r($temp_array);
         //exit();
         if ($this->arrayRestFolder[1] == "filter") {
             $this->url_final .= "/" . implode("/", $temp_array);
             //tirando a página da url final
             $this->url_final = preg_replace("/\\/pag\\.[0-9]+?/", "", $this->url_final);
         }
         $array_relacao_variavel_resultado = array();
         $array_relacao_variavel_resultado["search"] = "requestSearch";
         $array_relacao_variavel_resultado["material"] = "requestMaterial";
         $array_relacao_variavel_resultado["color"] = "requestColor";
         $array_relacao_variavel_resultado["style"] = "requestStyle";
         $array_relacao_variavel_resultado["format"] = "requestFormat";
         $array_relacao_variavel_resultado["theme"] = "requestTheme";
         $array_relacao_variavel_resultado["composition"] = "requestComposition";
         $array_relacao_variavel_resultado["technique"] = "requestTechnique";
         $array_relacao_variavel_resultado["type"] = "requestType";
         $array_relacao_variavel_resultado["promocoes"] = "requestPromocao";
         foreach ($this->arrayVariable as $variable => $value) {
             if ($variable == "search" && DataHandler::forceString($value) != NULL) {
                 $this->requestResumeSearch = DataHandler::forceString(urldecode($value));
                 if (strlen($this->requestResumeSearch) > 10) {
                     $this->requestResumeSearch = substr($this->requestResumeSearch, 0, 10) . "...";
                 }
             }
             if (DataHandler::forceInt($value) > 0) {
                 if (isset($array_relacao_variavel_resultado[$variable]) && $array_relacao_variavel_resultado[$variable] != null) {
                     $this->{$array_relacao_variavel_resultado}[$variable] = DataHandler::forceInt(trim($value));
                 }
             } else {
                 //se não nenhum desses itens segnifica q é sujeira por isso não grava na url
                 continue;
             }
             //popula o bread crumb de maneira incompleta pois seria esforço a toa procurar o título aqui
             $this->arrayBreadCrumb[] = new BreadCrumbInfoVO("", $variable, $value);
             //concatena as veriaveis ja enviadas para fazer a base do link
             //$this->url_final .= "/".$variable.".".$value;
         }
     }
 }