Little bugfix in the ConfList view helper in using the translate view helper.
[pivip.git] / project / modules / admin / views / helpers / ConfList.php
blobb83145febd0ec48ab85f0fe9bbfbfccd9e55bf01
1 <?php
3 /**
4 * Pivip
5 * Copyright (C) 2008 Vincent Tunru
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 * @license http://www.fsf.org/licensing/licenses/info/GPLv2.html GPL v.2
21 * @category PivipModulesDefault
22 * @package Module_Admin
23 * @subpackage ViewHelpers
24 * @copyright (C) 2008 Vincent Tunru
25 * @author Vincent Tunru <email@vincentt.org>
28 /**
29 * Create a list of modules to configure
31 class Admin_View_Helper_ConfList
33 protected $_list = '';
35 public $view;
37 public function setView($view)
39 $this->view = $view;
42 /**
43 * Manipulate this object
45 * @return Navigation_View_Helper_ConfList
47 public function confList()
49 return $this;
52 /**
53 * Add an item to the list
55 * @param string $module Name of the module to add to the list
57 public function add($module)
59 $params = array('name' => $module);
60 $li = '
61 <li>
62 <a href="' . $this->view->url($params, 'Admin_ViewModule') . '"
63 title="' . $this->view->translate('Configure the %s module.', $module)
64 . '">' . $module . '</a>
65 </li>';
66 $this->_list .= $li;
69 /**
70 * Retrieve the list
72 * @return string The list
74 public function __toString()
76 if(!empty($this->_list))
78 return '
79 <div class="block admin">
80 <h1>' . $this->view->translate('Configure modules') . '
81 </h1>
82 <ul class="admin modules">' . $this->_list . '
83 </ul>
84 </div>';
86 return $this->_list;