Ejemplo n.º 1
0
 /**
  * Returns HTML anchor for the given pages
  *
  * @param  Zym_Navigation_Page $page  page to get anchor for
  * @return string
  */
 public function getPageAnchor(Zym_Navigation_Page $page)
 {
     // get attribs for anchor element
     $attribs = array('id' => $page->getId(), 'title' => $page->getTitle(), 'class' => $page->getClass());
     $href = $page->getHref();
     if ($href) {
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
         $element = 'a';
     } else {
         $element = 'span';
     }
     return '<' . $element . ' ' . $this->_htmlAttribs($attribs) . '>' . $page->getLabel() . '</' . $element . '>';
 }
Ejemplo n.º 2
0
 /**
  * Returns HTML anchor for the given pages
  *
  * @param  Zym_Navigation_Page $page  page to get anchor for
  * @return string
  */
 public function getPageAnchor(Zym_Navigation_Page $page)
 {
     // get label and title for translating
     $label = $page->getLabel();
     $title = $page->getTitle();
     if ($this->_useTranslator && ($t = $this->_getTranslator())) {
         $label = $t->translate($label);
         $title = $t->translate($title);
     }
     // get attribs for anchor element
     $attribs = array('id' => $page->getId(), 'title' => $title, 'class' => $page->getClass());
     $href = $page->getHref();
     if ($href) {
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
         $element = 'a';
     } else {
         $element = 'span';
     }
     return '<' . $element . ' ' . $this->_htmlAttribs($attribs) . '>' . $this->getView()->escape($label) . '</' . $element . '>';
 }
Ejemplo n.º 3
0
 /**
  * Returns an absolute URL for the given page
  *
  * @param  Zym_Navigation_Page $page  page to get URL from
  * @return string
  */
 protected function _getUrl(Zym_Navigation_Page $page)
 {
     $href = $page->getHref();
     if ($href[0] == '/') {
         $url = $this->_getServerUrl() . $href;
     } elseif (@preg_match('/^https?:\\/\\//m', $href)) {
         $url = $href;
     } else {
         $url = $this->_getServerUrl() . rtrim($this->getView()->url(), '/') . '/' . $href;
         //exit("got url '$url'\n");
     }
     return $this->_xmlEscape($url);
 }
Ejemplo n.º 4
0
 /**
  * Returns HTML anchor for the given pages
  *
  * @param  Zym_Navigation_Page $page  page to get anchor for
  * @return string
  */
 public function getPageAnchor(Zym_Navigation_Page $page)
 {
     // get attribs for anchor element
     $attribs = array('id' => $page->getId(), 'title' => $page->getTitle(), 'class' => $page->getClass(), 'href' => $page->getHref(), 'target' => $page->getTarget());
     return '<a ' . $this->_htmlAttribs($attribs) . '>' . $page->getLabel() . '</a>';
 }