]> dev.renevier.net Git - syj.git/blob - application/views/helpers/FooterLink.php
version 0.1
[syj.git] / application / views / helpers / FooterLink.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5 class Syj_View_Helper_FooterLink extends Zend_View_Helper_Abstract
6 {
7     public function FooterLink($routeoptions, $text, $redirect=true) {
8         $page = new Zend_Navigation_Page_Mvc($routeoptions);
9         if ($page->isActive()) {
10             $link = $this->view->escape($text);
11         } else {
12             $href = $page->getHRef();
13             if ($redirect) {
14                 $currentUri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
15                 if (strpos($currentUri, '?') !== false) {
16                     $currentUri = strstr($currentUri, '?', true);
17                 }
18                 $href = $this->view->addParamToUrl($href, 'redirect', $currentUri, true);
19             }
20             $link = $this->view->anchor($href, $text, array('class' => 'footer-anchor'));
21         }
22         return '<div class="footer-link">' . $link . '</div>' . PHP_EOL;
23     }
24 }
25
26 ?>