protected function updateTemplate_CollectionPhotos(HTML_Indexer $index = null, Kiwi_Product $product_data = null) { if ($index === null) { $index = $this->_index; } if ($product_data === null) { $product_data = $this->_product_data; } $vars = array('obrazek_kolekce', 'ma_fotografie_kolekce', 'nema_fotografie_kolekce', 'fotografie_kolekce'); foreach ($vars as $varname) { ${$varname} = $index->{$varname}; } $collection = $product_data->collection; foreach ($ma_fotografie_kolekce as $elem) { $elem->active = !empty($collection); } foreach ($nema_fotografie_kolekce as $elem) { $elem->active = empty($collection); } if (!empty($fotografie_kolekce)) { if (empty($obrazek_kolekce)) { throw new Template_Element_Missing_Exception('obrazek_kolekce'); } if (count($obrazek_kolekce) !== 1) { throw new Template_Invalid_Structure_Exception('The "obrazek_kolekce" element duplicity'); } $obrazek_kolekce = $obrazek_kolekce[0]; if (!empty($collection)) { $nav = new Project_Navigator(); $collection_photos_dir = $nav->get($this->name . '_photos_collection'); $max_cp = 60; foreach ($collection as $citem) { if ($max_cp-- == 0) { break; } $photo_small = $collection_photos_dir . $citem['FileName']; $img = clone $obrazek_kolekce; $img->src = $photo_small; $a = new HTML_A(); $qso = new Query_String(); if ($citem['URL'] == '') { $qso->set($this->ns . 'p', $citem['ID']); $a->href = $this->_catalog_href . $qso->__toString(); } else { $a->href = $this->_catalog_urlbase . $citem['URL'] . $qso->__toString(); } $a->title = $citem['Title']; $a->add($img); foreach ($fotografie_kolekce as $elem) { $elem->add($a); } } } } }
protected function updateNewsDetailTemplate() { $vars = array('je_novinka', 'neni_novinka', 'nadpis', 'obsah', 'datum', 'autor', 'autor_jako_link'); foreach ($vars as $varname) { ${$varname} = $this->_index->{$varname}; } foreach ($je_novinka as $elem) { $elem->active = !empty($this->_items); } foreach ($neni_novinka as $elem) { $elem->active = empty($this->_items); } if (!empty($this->_items)) { $item =& $this->_items[0]; foreach ($nadpis as $elem) { $elem->text = $item->Name; } if (!empty($obsah)) { $content = $item->Content !== '' ? $item->Content : $item->Sample; $content_elem = new HTML_Text(Images_JS_Support::updateHTMLRaw($this->images, $content)); $content_elem->raw = true; foreach ($obsah as $elem) { $elem->add($content_elem); } } foreach ($datum as $elem) { try { $elem->vo->timestamp = $item->When; } 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); } } } }
protected function generateNavNumber(HTML_Inline $node, $num) { $link = new HTML_A(); $link->href = $this->getHRef($num); $link->title = ''; $link->add(new HTML_Text($num)); $node->add($link); }