protected function resolveHRef() { if ($this->page !== null) { if ($this->page == 'current') { $page = Server::get('REQUEST_URL'); $qs = Server::get('REQUEST_QUERY_STRING'); if ($qs !== '') { $qs = "?{$qs}"; } } else { $page = Project_Navigator::getPage($this->page, $this->nobase !== null); $qs = $this->qs === null ? '' : "?{$this->qs}"; } $link = $page . $qs; $this->_a->href = $link; if ($this->popup !== null) { $onclick = $this->_a->onclick; if ($onclick === null) { $onclick = ''; } if ($onclick !== '' && substr($onclick, -1) != ';') { $onclick .= ';'; } if (substr($onclick, -13) == 'return false;') { $onclick = substr($onclick, 0, -13); } $onclick .= "window.open('{$link}','_blank','{$this->popup}');return false"; $this->_a->onclick = $onclick; } if ($this->content !== null) { $this->_a->clear(); $this->_a->add($this->content, false); } } else { throw new Data_Insufficient_Exception('page'); } }
protected function updateNewsListTemplate() { $vars = array('novinka_vzor', 'ma_detail', 'nema_detail', 'detail', 'nadpis', 'obsah', 'datum', 'autor', 'autor_jako_link', 'zadne_novinky', 'prazdna_stranka', 'horni_paginace', 'novinky', 'dolni_paginace'); foreach ($vars as $varname) { ${$varname} = $this->_index->{$varname}; } if (!$novinka_vzor) { throw new Template_Element_Missing_Exception('novinka_vzor'); } if (count($novinka_vzor) != 1) { throw new Template_Invalid_Structure_Exception('The "novinka_vzor" element duplicity'); } if ($horni_paginace && count($horni_paginace) != 1) { throw new Template_Invalid_Structure_Exception('The "horni_paginace" element duplicity'); } if ($dolni_paginace && count($dolni_paginace) != 1) { throw new Template_Invalid_Structure_Exception('The "dolni_paginace" element duplicity'); } $novinka_vzor = $novinka_vzor[0]; if ($horni_paginace) { $horni_paginace = $horni_paginace[0]; } if ($dolni_paginace) { $dolni_paginace = $dolni_paginace[0]; } $detailpage = $this->detailpage ? Project_Navigator::getPage($this->detailpage) : ''; $this->resolveQS(); $this->_qs->remove($this->nsd . 'ni'); $this->_qs->set($this->nsd . 'ni', ''); // nastavi query string tak, aby koncil na "ni=" $detail_link = $detailpage . $this->qs; if (!empty($novinky)) { foreach ($this->_items as &$item) { $ma_detail_val = $item->Content !== ''; foreach ($ma_detail as $elem) { $elem->active = $ma_detail_val; } foreach ($nema_detail as $elem) { $elem->active = !$ma_detail_val; } foreach ($nadpis as $elem) { $elem->text = $item->Name; } foreach ($detail as $elem) { $elem->href = $detail_link . $item->ID; } foreach ($obsah as $elem) { switch ($this->listmode) { case 'S': $content = $item->Sample; break; case 'C': $content = $item->Content; break; default: throw new Template_Invalid_Argument_Exception('listmode', $this->listmode); } $content_elem = new HTML_Text(Images_JS_Support::updateHTMLRaw($this->images, $content)); $content_elem->raw = true; $elem->clear(); $elem->add($content_elem); } foreach ($datum as $elem) { try { $elem->timestamp = $item->When; // nikoli view_object, protoze se to bude jeste klonovat } catch (HTML_No_Such_Element_Attribute_Exception $e) { $datum_spec = null; try { $datum_spec = $elem->specification; } catch (HTML_No_Such_Element_Attribute_Exception $e) { } $datetime = new Date_Time($item->When); $elem->add(new HTML_Text($datetime->format($datum_spec === null ? 'j.n. Y' : $datum_spec))); } } foreach ($autor as $elem) { $elem->text = $item->Author; } if (!empty($autor_jako_link)) { $autor_jako_link->clear(); $a = new HTML_A(); $a->href = 'http://' . $item->Author; $a->add(new HTML_Text($item->Author)); foreach ($autor_jako_link as $elem) { $elem->add($a); } } foreach ($novinky as $elem) { $elem->add(clone $novinka_vzor); } } } foreach ($zadne_novinky as $elem) { $elem->active = empty($this->_items) && $this->_total == 0; } foreach ($prazdna_stranka as $elem) { $elem->active = empty($this->_items) && $this->_total > 0; } $pages = (int) ($this->_total / $this->size); if ($pages * $this->size < $this->_total) { $pages++; } if ($horni_paginace) { $horni_paginace->vo->total = $pages; $horni_paginace->vo->current = $this->page; $horni_paginace->vo->qsvar = $this->ns . 'pg'; $horni_paginace->active = $this->pagination && $this->pagination != 'bottom'; } if ($dolni_paginace) { $dolni_paginace->vo->total = $pages; $dolni_paginace->vo->current = $this->page; $dolni_paginace->vo->qsvar = $this->ns . 'pg'; $dolni_paginace->active = $this->pagination && $this->pagination != 'top'; } }
protected function updateTemplate_DetailLink(Var_Pool $gallery) { $detail = $this->_index->detail; if (!empty($detail)) { $detailpage = $this->detailpage ? Project_Navigator::getPage($this->detailpage) : ''; $this->resolveQS(); $qso = clone $this->_qs; $qso->set($this->nsd . 'g', $gallery->GID); $qso->set($this->nsd . 'gg', $this->ggid); if ($this->ggpage > 1) { $qso->set($this->nsd . 'ggpg', $this->ggpage); } $detail_link = $detailpage . $qso->__toString(); foreach ($detail as $elem) { $elem->href = $detail_link; } } }
protected function getHRef($page) { $href = $this->link === null ? Server::get('REQUEST_URL') : Project_Navigator::getPage($this->link); $qso = clone $this->_qs; if ($page != 1) { $qso->set($this->qsvar, $page); } $qs = $qso->__toString(); return $href . $qs; }