Fixes #149
[akelos.git] / lib / AkActionView / AkActionViewHelper.php
blob9071920076d2fc82b51fcb33d8d801270bb3d819
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4 // +----------------------------------------------------------------------+
5 // | Akelos Framework - http://www.akelos.org |
6 // +----------------------------------------------------------------------+
7 // | Copyright (c) 2002-2006, Akelos Media, S.L. & Bermi Ferrer Martinez |
8 // | Released under the GNU Lesser General Public License, see LICENSE.txt|
9 // +----------------------------------------------------------------------+
11 /**
12 * @package ActionView
13 * @subpackage Helpers
14 * @author Bermi Ferrer <bermi a.t akelos c.om>
15 * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
16 * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
19 class AkActionViewHelper extends AkObject
21 var $locales_namespace = 'helpers';
23 function AkActionViewHelper()
25 $args = func_get_args();
26 if(!empty($args[0]) && is_array($args[0])){
27 foreach (array_keys($args[0]) as $object_name){
28 $this->addObject($object_name, $args[0][$object_name]);
33 function addObject($object_name, &$object)
35 $this->_object[$object_name] =& $object;
36 if(!isset($this->_controller->$object_name)){
37 $this->_controller->$object_name =& $object;
41 function &getObject($object_name)
43 return $this->_object[$object_name];
46 function setController(&$controller)
48 $this->_controller =& $controller;
51 function t($string, $array = null, $name_space = null)
53 $name_space = empty($name_space) ? $this->locales_namespace : $name_space;
54 return Ak::t($string, $array, $name_space);