diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index 926b6b555aee9bb63c50c6e32e7ec498710256ae..9dfd8207184b2d942b935df8049eb56b26b8566a 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -304,7 +304,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { public function recordAction() { $codif = Class_Codification::getInstance(); $this->view->titre = $this->_('Configuration de l\'affichage du type %s', - $codif->getLibelleFacette('T' . $this->_getParam('action2'))); + $codif->getLibelleFacette(Class_CodifTypeDoc::CODE_FACETTE . $this->_getParam('action2'))); if ($this->isValidPostNotice()) return $this->updateEtRetour($this->getPostNotice()); diff --git a/library/Class/Systeme/Widget/Menu.php b/library/Class/Systeme/Widget/Menu.php index 3114fab3b2c4c57cd9b6d1c8cf561d20598d9a53..8b4d2ee71a6668b08d63b4dae33cf88ce6763bf1 100644 --- a/library/Class/Systeme/Widget/Menu.php +++ b/library/Class/Systeme/Widget/Menu.php @@ -22,9 +22,12 @@ class Class_Systeme_Widget_Menu extends Class_Systeme_Widget_Abstract { - public static function findAllAsArray() { + public static function findAllAsArray($id_profil) { + if(!$profil = Class_Profil::find($id_profil)) + return []; + $all = []; - $profil = Class_Profil::getCurrentProfil(); + $datas = $profil->getCfgMenusAsArray(); foreach($datas as $key => $params) $all[$key] = (new static()) diff --git a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php index b9e66873235a0a6391b5bc76cb45c5f68fd98567..69c170da16f6d2fc838d3af474e74624c5dce217 100644 --- a/library/ZendAfi/View/Helper/Accueil/MenuVertical.php +++ b/library/ZendAfi/View/Helper/Accueil/MenuVertical.php @@ -64,13 +64,13 @@ class ZendAfi_View_Helper_Accueil_MenuVertical extends ZendAfi_View_Helper_Accue $menu_deplie ? "" : "display:none"); $id_profil = $profil->getId(); - $menus = Class_Systeme_Widget_Menu::findAllAsArray(); + $menus = Class_Systeme_Widget_Menu::findAllAsArray($id_profil); if (!isset($menus[$menu])) $menus = Class_Profil::getPortail()->getCfgMenusAsArray(); if (!isset($menus[$menu])) - return $this->retourErreur($this->translate()->_('Ce menu ne contient aucune entrée.')); + return $this->retourErreur($this->_('Ce menu ne contient aucune entrée.')); $config = $menus[$menu]; diff --git a/library/ZendAfi/View/Helper/Admin/Menus.php b/library/ZendAfi/View/Helper/Admin/Menus.php index 947d81c9d315f81348a0b31cf40064e1ec0eff30..43c22593de9ac6b20e79b79c7b5d4c283b72c4ad 100644 --- a/library/ZendAfi/View/Helper/Admin/Menus.php +++ b/library/ZendAfi/View/Helper/Admin/Menus.php @@ -26,7 +26,7 @@ class ZendAfi_View_Helper_Admin_Menus extends Zendafi_View_Helper_Basehelper { public function menus() { $this->_profil = Class_Profil::getCurrentProfil(); - $datas = Class_Systeme_Widget_Menu::findAllAsArray(); + $datas = Class_Systeme_Widget_Menu::findAllAsArray($this->_profil->getId()); $html = [$this->_renderNav($datas['H'])]; unset($datas['H']); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php b/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php index e3db7630c478a260883bb62ba1b966a10e9eea43..848cbdb0e52538198448bb44cdbf1d32d4da3405 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; @@ -273,7 +273,7 @@ class MenuVerticalSitothequeWithManyItemsTest extends MenuVerticalWithManyItemsT 'titre' => 'Hurd', 'description' => 'Pour tous les Gnus', 'url' => 'http://hurd.gnu.org']); - + $this->_parentLabel = 'Nos Sites'; $this->_firstItemLabel = 'LinuxFr'; $this->_secondItemLabel = 'Hurd'; @@ -445,16 +445,16 @@ class MenuVerticalWithMenuTest extends MenuVerticalTestCase { /** @test */ public function menuForProfilAdulteShouldHaveUrlIdProfilFourSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', 'Profil adulte'); } /** @test */ public function menuForProfilJeunesseShouldHaveUrlIdProfilHeightNotSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/8")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[not(contains(@class, "selected_profil"))]/a[contains(@href, "/id_profil/8")]', 'Profil jeunesse'); } } @@ -493,21 +493,16 @@ class MenuVerticalWithMenuFromOtherProfilTest extends ViewHelperTestCase { public function setUp() { parent::setUp(); - - + Zend_Controller_Front::getInstance()->setRequest(new Zend_Controller_Request_Http()); $this->fixture('Class_Profil', ['id' => 28, - 'cfg_menus' => [ - '9' => ['libelle' => 'Menu vertical', - 'menus' => [ - ['type_menu' => 'RSS', - 'libelle' => 'Flux', - 'picto' => 'vide.gif', - 'preferences' => ['id_items' => 2, - 'id_categorie' => '', - 'nb' => 5]]] - ] - ]]); + 'cfg_menus' => ['9' => ['libelle' => 'Menu vertical', + 'menus' => [['type_menu' => 'RSS', + 'libelle' => 'Flux', + 'picto' => 'vide.gif', + 'preferences' => ['id_items' => 2, + 'id_categorie' => '', + 'nb' => 5]]]]]]); $this->helper = new ZendAfi_View_Helper_Accueil_MenuVertical(12, [ @@ -649,8 +644,8 @@ class MenuVerticalWithMenuAsLinkToProfilTest extends MenuVerticalTestCase { /** @test */ public function menuForProfilAdulteShouldHaveUrlIdProfilHeightSelected() { - $this->assertXPathContentContains($this->_html, - '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', + $this->assertXPathContentContains($this->_html, + '//ul/li[contains(@class, "selected_profil")]/a[contains(@href, "/id_profil/4")]', 'Menu'); }