diff --git a/VERSIONS_WIP/60900 b/VERSIONS_WIP/60900 new file mode 100644 index 0000000000000000000000000000000000000000..31b977c3248b05ccede5756ca712efd7048d41f2 --- /dev/null +++ b/VERSIONS_WIP/60900 @@ -0,0 +1 @@ + - ticket #60900 : Ajouter un menu admin en front pour regrouper les actions / outils de l'adminstrateur. \ No newline at end of file diff --git a/application/modules/opac/views/scripts/module.phtml b/application/modules/opac/views/scripts/module.phtml index 6503a2e423148756fcac7425bb88689b8f75e339..4140cc16bef07938c44f1022f601d6933b13beac 100644 --- a/application/modules/opac/views/scripts/module.phtml +++ b/application/modules/opac/views/scripts/module.phtml @@ -3,7 +3,7 @@ ob_start(); echo '<body '.$this->bodyParam.'>'; echo $this->partial('contenu.phtml', ['profil' => $this->profil, - 'actionContent' => $this->fonctionsAdmin().$this->render($this->actionScript)]); + 'actionContent' => $this->fonctionsAdmin() . $this->render($this->actionScript)]); echo $this->partial('footer.phtml', ['portail_cfg_site' => $this->profil->getCfgSiteAsArray()]); diff --git a/application/modules/opac/views/scripts/portail.phtml b/application/modules/opac/views/scripts/portail.phtml index 27c6e6dc9b16613fb2bf9b54331801b6d583e27d..6698b48df4198321e3bbd1436401be2d30fd747f 100644 --- a/application/modules/opac/views/scripts/portail.phtml +++ b/application/modules/opac/views/scripts/portail.phtml @@ -1,6 +1,7 @@ <?php ob_start(); echo '<body '.$this->bodyParam.'>'; +echo $this->Admin_FrontNav(); if ((new Class_UserAgent())->isMobile() && Class_Profil::isAPhoneProfilEnabled()) echo sprintf('<div class="back_to_phone">%s</div>', $this->tagAnchor($this->url(['module' => 'telephone'], null, true), diff --git a/library/Class/Admin/Skin.php b/library/Class/Admin/Skin.php index b4bb2640302a62ee0e748931eece6917ecafbfb5..97622f7a3eda0c05c993460b1838647954ee8a43 100644 --- a/library/Class/Admin/Skin.php +++ b/library/Class/Admin/Skin.php @@ -145,6 +145,11 @@ class Class_Admin_Skin { } + public function renderAdminFrontNavCssOn($script_loader) { + return $this->_renderCssOn($script_loader, 'front_nav.css'); + } + + public function renderJQueryCssOn($script_loader) { return $this->_renderCssOn($script_loader, 'jquery.css'); } diff --git a/library/Class/Users.php b/library/Class/Users.php index 409db473e1279c5de5a39b329defca59a7bcb11b..bb73c5ac9348c4e3c44b29aa607a8ff4f733d73d 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -1145,7 +1145,7 @@ class Class_Users extends Storm_Model_Abstract { public function getNomAff($id_user = null, $complet = false) { if ($id_user != null) { - if (null === $user = $this->getLoader()->find($id_user)) + if (null === $user = Class_Users::find($id_user)) return ''; } else { $user = $this; diff --git a/library/ZendAfi/View/Helper/Admin/Button.php b/library/ZendAfi/View/Helper/Admin/Button.php index db08a1632bf5aa2660e323d4b19edc791c16ad70..36a1f80ce700e3ad56c2f9d7132d7d192fb46aec 100644 --- a/library/ZendAfi/View/Helper/Admin/Button.php +++ b/library/ZendAfi/View/Helper/Admin/Button.php @@ -21,6 +21,11 @@ class ZendAfi_View_Helper_Admin_Button extends ZendAfi_View_Helper_Button { + public function Admin_Button($button) { + return $this->button($button); + } + + public function button($button) { if(!$button) return ''; diff --git a/library/ZendAfi/View/Helper/Admin/FrontNav.php b/library/ZendAfi/View/Helper/Admin/FrontNav.php new file mode 100644 index 0000000000000000000000000000000000000000..25528ae50462392988e37c3e26de47bc998560f9 --- /dev/null +++ b/library/ZendAfi/View/Helper/Admin/FrontNav.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * 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 + */ + + +class ZendAfi_View_Helper_Admin_FrontNav extends ZendAfi_View_Helper_BaseHelper { + + public function Admin_FrontNav() { + if(!Class_Users::isCurrentUserCanAccesBackend()) + return ''; + + (new Class_Admin_Skin)->renderAdminFrontNavCssOn(Class_ScriptLoader::getInstance()); + + $html = [$this->view->Admin_Button((new Class_Entity()) + ->setText($this->_('Administration')) + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', + 'configuration'))) + ->setAttribs(['onclick' => '$(\'.menu_admin_front\').toggleClass(\'hidden\');return false;'])), + $this->_tag('div', + $this->_tag('ul', implode($this->_getEntries())))]; + + return $this->_tag('div', + implode($html), + ['class' => 'menu_admin_front hidden']); + } + + + protected function _getEntries() { + $entries = [$this->_myAccount(), + $this->_myNotifications(), + $this->_adminActions(), + $this->_adminLinks()]; + + return array_map(function($entry) + { + return $this->_tag('li', $entry); + }, $entries); + } + + + protected function _myAccount() { + $id = Class_Users::getIdentity()->getId(); + return $this->view->tagAnchor(['module' => 'admin', + 'controller' => 'users', + 'action' => 'edit', + 'id' => $id], + $this->_('Mon compte : %s', Class_Users::getNomAff($id))); + } + + + protected function _myNotifications() { + return ''; + } + + + protected function _adminActions() { + return ''; + } + + + protected function _adminLinks() { + return ''; + } +} \ No newline at end of file diff --git a/public/admin/skins/bokeh74/front_nav.css b/public/admin/skins/bokeh74/front_nav.css new file mode 100644 index 0000000000000000000000000000000000000000..537ec4a3a2c97b184e33441b339675c4b4b9ed5a --- /dev/null +++ b/public/admin/skins/bokeh74/front_nav.css @@ -0,0 +1,31 @@ +.menu_admin_front { + position: fixed; + top: 0; + left: 0; + z-index: 101; +} + +.menu_admin_front > button, +.menu_admin_front > div { + transition: all 0.4s; +} + +.menu_admin_front > div { + overflow: hidden; + background-color: var(--nav-background); + width: 300px; + height: 500px; +} + +.menu_admin_front.hidden > div { + width: 0; +} + +.menu_admin_front > button { + position: absolute; + white-space: nowrap; +} + +.menu_admin_front:not(.hidden) > button > img { + transform: rotate(45deg); +} \ No newline at end of file