pageId = 1; $webpage = new WebPage(); $pageElements = $webpage->getPageElements($this->pageId); $this->template->pageElements = $pageElements; $this->template->imgx = $this->thumbX; $this->template->imgy = $this->thumbY; } public function renderPrizemneDomy($id) { $this->pageId = 2; $this->prepareData($id); } public function renderDomyVSvahu($id) { $this->pageId = 3; $this->prepareData($id); } public function renderTradicneDomy($id) { $this->pageId = 4; $this->prepareData($id); } public function renderRekonstrukcie($id) { $this->pageId = 6;// 5-page je kontakt $this->prepareData($id); } public function renderRekreacneObjekty($id) { $this->pageId = 7; $this->prepareData($id); } private function prepareData($id) { $this->template->multiplepages = false; $this->template->showOneHouse = false; $webpage = new WebPage(); // defaultne chcem nahlad konkretneho domu tak vynulujem current pagination $this->pageIndex = 0; // ak nemam parameter robim nahlady vsetkych domov if(strlen($id) === 0) { $this->pageIndex = 1; } // ak je cast uvodneho pametra zhodna s "pg=" zistim si current pagination if(substr($id,0,3) === 'pg=') { $params = explode('=', $id); $this->pageIndex = $params[1]; } // Ak current pagination > 0 znamena ze chcem robit nahlady vsetkych domov if($this->pageIndex > 0) { $numberOfPages = $webpage->getNumberOfPages($this->pageId, 6); $this->template->multiplepages = $numberOfPages > 1; $this->template->isPrevious = ($this->pageIndex - 1) > 0; $this->template->isNext = ($this->pageIndex + 1) <= $numberOfPages; if ($this->template->multiplepages === true) { $this->template->apageback = 'pg='.($this->pageIndex - 1); $this->template->apageforward = 'pg='.($this->pageIndex + 1); } $pageElements = $webpage->getPageElements($this->pageId, 6, $this->pageIndex); } else { // Inak zobrazim uz nahlady konretneho domu $pageElements = array(); //$this->template->apageback = ''; //$this->template->apageforward = ''; $res = $webpage->getTextsForHouse($this->pageId, $id); $this->template->showOneHouse = true; $this->template->houseName = $res[0]['title']; $this->template->houseDesc = $res[0]['txt']; $pathParts = pathinfo($res[0]['bgImage']); $path = $pathParts['dirname']; $okImages = array(); if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $path_parts = pathinfo($path.'/'.$file); if (in_array(strtolower($path_parts['extension']), $this->imageExt) === true) { $okImages[] = $path.'/'.$file; } } } } closedir($handle); $this->template->mainImgTb = $okImages[0]; $this->template->altDesc = $okImages[0]; $this->template->smallTb = $okImages; } $navMenuTitle = $webpage->getPageMenuTitle($this->pageId); $subUrlPart = $webpage->getPageParentPath($this->pageId); $this->template->navMenuTitle = $navMenuTitle[0]['menuTitle']; $this->template->pageElements = $pageElements; $this->template->imgx = $this->thumbX; $this->template->imgy = $this->thumbY; $this->template->subUrl = $subUrlPart[0]['name']; //$this->template->objectPath = $subUrlPart[0]['name']. } public function afterRender() { parent::afterRender(); } }//end class