2 /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Syj_View_Helper_Returnto extends Zend_View_Helper_HtmlElement
8 protected function getHref() {
9 $param = Zend_Controller_Front::getInstance()->getRequest()->getQuery('redirect');
13 $href = $this->view->escape(implode('/', array_map('urlencode', explode('/', $param ))));
17 public function returnto() {
18 $returnto = $this->getHref();
19 $baseurl = $this->view->baseUrl();
21 if ($returnto === false) {
22 return $this->view->translate('You can now') . ' '
23 . $this->view->anchor($baseurl, $this->view->translate('go to main page'));
24 } else if ($returnto == $baseurl) {
25 return $this->view->translate('You can now') . ' '
26 . $this->view->anchor($returnto, $this->view->translate('go back to %s', $returnto));
28 return $this->view->translate('You can now') . ' ' .
29 $this->view->anchor($returnto, $this->view->translate('go back to %s', $returnto)) .
30 ' ' . $this->view->translate('or you can') . ' ' .
31 $this->view->anchor($baseurl, $this->view->translate('go to main page'));