From b6d082be84bf7113800d211859307240f168202b Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Sat, 12 Jan 2013 16:27:17 +0000 Subject: [PATCH] =?UTF-8?q?Refacto=20pour=20compatibilit=C3=A9=20skins=20e?= =?UTF-8?q?xistants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/ZendAfi/View/Helper/Menu/Boite.php | 7 ++++-- library/ZendAfi/View/Helper/Menu/Entry.php | 16 ++++++------ library/ZendAfi/View/Helper/Menu/Menus.php | 25 ++++++++----------- .../ZendAfi/View/Helper/Menu/SousMenus.php | 7 ++++-- public/opac/css/global.css | 2 +- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/library/ZendAfi/View/Helper/Menu/Boite.php b/library/ZendAfi/View/Helper/Menu/Boite.php index 15166bfba2c..7ab534d35a6 100644 --- a/library/ZendAfi/View/Helper/Menu/Boite.php +++ b/library/ZendAfi/View/Helper/Menu/Boite.php @@ -30,11 +30,14 @@ class ZendAfi_View_Helper_Menu_Boite extends ZendAfi_View_Helper_BaseHelper { $this->_params['type_module'] = Class_Systeme_ModulesMenu::moduleAccueilType($params); } - public function getBoite() { + + public function getBoite($li_class='') { $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams($this->_id_module, $this->_params); $helper->setView($this->view); - return $helper->getBoite(); + + $class = $li_class ? $li_class.' boite' : 'boite'; + return '<li class="'.$class.'">'.$helper->getBoite().'</li>'; } } diff --git a/library/ZendAfi/View/Helper/Menu/Entry.php b/library/ZendAfi/View/Helper/Menu/Entry.php index 851192ce56d..6207752412e 100644 --- a/library/ZendAfi/View/Helper/Menu/Entry.php +++ b/library/ZendAfi/View/Helper/Menu/Entry.php @@ -34,16 +34,18 @@ class ZendAfi_View_Helper_Menu_Entry extends ZendAfi_View_Helper_Menu_Base { } - public function getBoite() { + public function getBoite($li_class = '') { $html = $this->getTagAnchor(); if ($this->_sous_menus) { - $helper = new ZendAfi_View_Helper_Menu_SousMenus($this->_sous_menus); - $helper->setView($this->view); - $html .= $helper->getBoite(); - } + $helper = new ZendAfi_View_Helper_Menu_SousMenus($this->_sous_menus); + $helper->setView($this->view); + $html .= $helper->getBoite(); + } - return $html; + return $li_class + ? '<li class="'.$li_class.'">'.$html.'</li>' + : '<li>'.$html.'</li>'; } @@ -52,7 +54,7 @@ class ZendAfi_View_Helper_Menu_Entry extends ZendAfi_View_Helper_Menu_Base { $params = $modMenus->getUrl($this->_type_module, $this->_preferences); $url = $params['url']; $target = $params['target'] - ? "target='".$params['target']."'"; + ? "target='".$params['target']."'" : ''; $anchor='<a href="'.htmlspecialchars($url).'" '.$target.'>'; diff --git a/library/ZendAfi/View/Helper/Menu/Menus.php b/library/ZendAfi/View/Helper/Menu/Menus.php index 663e1226620..238d24a6315 100644 --- a/library/ZendAfi/View/Helper/Menu/Menus.php +++ b/library/ZendAfi/View/Helper/Menu/Menus.php @@ -20,29 +20,26 @@ */ class ZendAfi_View_Helper_Menu_Menus extends ZendAfi_View_Helper_BaseHelper { - protected $_ul_class = ''; - protected $_li_class = 'menu'; protected $_menus = []; + protected $_menu_class = 'menu'; public function __construct($menus) { parent::__construct(); $this->_menus = $menus; } + public function getBoite() { - $html = '<ul class="'.$this->_ul_class.'">'; - - foreach($this->_menus as $id_menu => $entree) { - $li_class = Class_Systeme_ModulesMenu::isModuleAccueil($entree) - ? $this->_li_class.' boite' - : $this->_li_class; - - $html.= '<li class="'.$li_class.'">'; + return '<ul>'.$this->renderMenus().'</ul>'; + } + + + public function renderMenus() { + $html = ''; + + foreach($this->_menus as $id_menu => $entree) $html.= $this->renderModule($id_menu, $entree); - $html.='</li>'; - } - $html.='</ul>'; return $html; } @@ -50,7 +47,7 @@ class ZendAfi_View_Helper_Menu_Menus extends ZendAfi_View_Helper_BaseHelper { function renderModule($id_menu, $menu){ $helper = ZendAfi_View_Helper_Menu_Base::getModuleHelperFromParams($id_menu, $menu); $helper->setView($this->view); - return $helper->getBoite(); + return $helper->getBoite($this->_menu_class); } } diff --git a/library/ZendAfi/View/Helper/Menu/SousMenus.php b/library/ZendAfi/View/Helper/Menu/SousMenus.php index 02480cf4bc3..6ce32eb62f1 100644 --- a/library/ZendAfi/View/Helper/Menu/SousMenus.php +++ b/library/ZendAfi/View/Helper/Menu/SousMenus.php @@ -20,8 +20,11 @@ */ class ZendAfi_View_Helper_Menu_SousMenus extends ZendAfi_View_Helper_Menu_Menus { - protected $_ul_class = 'sous-menus'; - protected $_li_class = ''; + protected $_menu_class = ''; + + public function getBoite() { + return '<ul>'.$this->renderMenus().'</ul>'; + } } ?> \ No newline at end of file diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 46b8bed8e8d..97b73572747 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -1112,7 +1112,7 @@ body.abonne_multimedia-hold-view .actions a { } -#menu_horizontal ul.sous_menu li.boite { +#menu_horizontal li.menu ul li.boite { width: 200px; float: left; white-space: normal; -- GitLab