diff options
Diffstat (limited to 'h-source/Library/Helper/Menu.php')
-rwxr-xr-x | h-source/Library/Helper/Menu.php | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/h-source/Library/Helper/Menu.php b/h-source/Library/Helper/Menu.php index 608795f..8fd4bf4 100755 --- a/h-source/Library/Helper/Menu.php +++ b/h-source/Library/Helper/Menu.php @@ -29,30 +29,46 @@ class Helper_Menu extends Helper_Html public $panelController; //panel controller public $controller; - public $links = array( + public $links = array(); + + //instance of Lang_{language}_Generic + public $strings = null; - 'back' => array( - 'title' => 'back', - 'class' => 'mainMenuItem', - 'text' => 'Back', - 'url' => 'main' - ), - - 'add' => array( - 'title' => 'add a new record', - 'class' => 'mainMenuItem', - 'text' => 'Add', - 'url' => 'form/insert' - ), + public function __construct() + { + $baseUrl = "http://".DOMAIN_NAME.'/Public/Img/Icons/elementary_2_5/'; - 'panel' => array( - 'title' => 'back to the Panel', - 'class' => 'mainMenuItem', - 'text' => 'Panel', - 'url' => 'main' - ) + //get the generic language class + $this->strings = Factory_Strings::generic(Params::$language); - ); + $this->links = array( + + 'back' => array( + 'title' => $this->strings->gtext('back'), + 'class' => 'mainMenuItem', + 'text' => $this->strings->gtext('Back'), + 'url' => 'main', + 'icon' => $baseUrl."left.png", + ), + + 'add' => array( + 'title' => $this->strings->gtext('add a new record'), + 'class' => 'mainMenuItem', + 'text' => $this->strings->gtext('Add'), + 'url' => 'form/insert', + 'icon' => $baseUrl."add.png", + ), + + 'panel' => array( + 'title' => $this->strings->gtext('back to the Panel'), + 'class' => 'mainMenuItem', + 'text' => $this->strings->gtext('Panel'), + 'url' => 'main', + 'icon' => $baseUrl."panel.png", + ) + + ); + } public function build($controller = null, $panelController = null) { @@ -75,6 +91,7 @@ class Helper_Menu extends Helper_Html { $title = isset($this->links[$linkName]['title']) ? "title='".$this->links[$linkName]['title']."'" : null; $class = isset($this->links[$linkName]['class']) ? "class='".$this->links[$linkName]['class']."'" : null; + $icon = isset($this->links[$linkName]['icon']) ? "<img class='top_menu_icon' src='".$this->links[$linkName]['icon']."'> " : null; //choose the controller (current or panel) $controller = (strcmp($linkName,'panel') === 0) ? $this->panelController.'/' : $this->controller.'/'; @@ -82,7 +99,7 @@ class Helper_Menu extends Helper_Html $href = Url::getRoot($controller.$this->links[$linkName]['url'].$viewStatus); $text = $this->links[$linkName]['text']; - $menu .= "<div $class><a $title href='$href'>$text</a></div>\n"; + $menu .= "<div $class>$icon <a $title href='$href'>$text</a></div>\n"; } } } |