diff --git a/htdocs/includes/menus/standard/bureau2crea.lib.php b/htdocs/includes/menus/standard/bureau2crea.lib.php new file mode 100644 index 00000000000..68152c4be24 --- /dev/null +++ b/htdocs/includes/menus/standard/bureau2crea.lib.php @@ -0,0 +1,325 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/includes/menus/standard/bureau2crea.lib.php + * \brief Library for file bureau2crea menus + * \version $Id$ + */ + + + +/** + * Core function to output top menu bureau2crea + * + * @param $db + * @param $atarget + * @param $type_user 0=Internal,1=External,2=All + */ +function print_bureau2crea_menu($db,$atarget,$type_user) +{ + require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php"); + + global $user,$conf,$langs,$dolibarr_main_db_name; + + // On sauve en session le menu principal choisi + if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; + if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; + $_SESSION["leftmenuopened"]=""; + + $menuArbo = new Menubase($db,'bureau2crea','top'); + $tabMenu = $menuArbo->menuTopCharger($type_user,$_SESSION['mainmenu'], 'bureau2crea'); + + print_start_menu_array_bureau2crea(); + + for($i=0; $i'; + print ''; + print_text_menu_entry_bureau2crea($tabMenu[$i]['titre']); + print ''; + print_end_menu_entry_bureau2crea(); + } + else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + { + if (! $type_user) + { + print_start_menu_entry_bureau2crea($idsel); + print ''; + print ''; + print_text_menu_entry_bureau2crea($tabMenu[$i]['titre']); + print ''; + print_end_menu_entry_bureau2crea(); + } + } + } + } + + print_end_menu_array_bureau2crea(); + + print "\n"; +} + + + +function print_start_menu_array_bureau2crea() +{ + global $conf; + if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print ''; + else print ''; + else print ''; + print "\n"; +} + +function print_end_menu_array_bureau2crea() +{ + global $conf; + if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '
'; + else print ''; + print "\n"; +} + + + +/** + * Core function to output left menu bureau2crea + * + * @param db Database handler + * @param menu_array_before Table of menu entries to show before entries of menu handler + * @param menu_array_after Table of menu entries to show after entries of menu handler + */ +function print_left_bureau2crea_menu($db,$menu_array_before,$menu_array_after) +{ + global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; + + $overwritemenufor = array(); + $newmenu = new Menu(); + + // Read mainmenu and leftmenu that define which menu to show + if (isset($_GET["mainmenu"])) { + // On sauve en session le menu principal choisi + $mainmenu=$_GET["mainmenu"]; + $_SESSION["mainmenu"]=$mainmenu; + $_SESSION["leftmenuopened"]=""; + } else { + // On va le chercher en session si non defini par le lien + $mainmenu=$_SESSION["mainmenu"]; + } + + if (isset($_GET["leftmenu"])) { + // On sauve en session le menu principal choisi + $leftmenu=$_GET["leftmenu"]; + $_SESSION["leftmenu"]=$leftmenu; + if ($_SESSION["leftmenuopened"]==$leftmenu) { + //$leftmenu=""; + $_SESSION["leftmenuopened"]=""; + } + else { + $_SESSION["leftmenuopened"]=$leftmenu; + } + } else { + // On va le chercher en session si non defini par le lien + $leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:''; + } + + //this->menu_array contains menu in pre.inc.php + + + // Show logo company + if (! empty($conf->global->MAIN_SHOW_LOGO)) + { + $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; + if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_mini); + print "\n".''."\n"; + print '
'."\n"; + print '
'."\n"; + print '
'."\n"; + } + } + + /** + * On definit newmenu en fonction de mainmenu et leftmenu + * ------------------------------------------------------ + */ + if ($mainmenu) + { + require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php"); + + $menuArbo = new Menubase($db,'bureau2crea','left'); + $overwritemenufor = $menuArbo->listeMainmenu(); + $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'bureau2crea'); + //var_dump($newmenu); + + /* + * Menu AUTRES (Pour les menus du haut qui ne serait pas geres) + */ + if ($mainmenu && ! in_array($mainmenu,$overwritemenufor)) { $mainmenu=""; } + } + + + /** + * Si on est sur un cas gere de surcharge du menu, on ecrase celui par defaut + */ + //var_dump($menu_array_before);exit; + //var_dump($menu_array_after);exit; + $menu_array=$newmenu->liste; + //if ($mainmenu) { + if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array); + if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after); + //} + //var_dump($menu_array);exit; + + // Affichage du menu + $alt=0; + if (is_array($menu_array)) + { + for ($i = 0 ; $i < sizeof($menu_array) ; $i++) + { + $alt++; + if (empty($menu_array[$i]['level'])) + { + if (($alt%2==0)) + { + if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) + { + print '
'."\n"; + } + else + { + print '
'."\n"; + } + } + else + { + print '
'."\n"; + } + } + + // Place tabulation + $tabstring=''; + $tabul=($menu_array[$i]['level'] - 1); + if ($tabul > 0) + { + for ($j=0; $j < $tabul; $j++) + { + $tabstring.='   '; + } + } + + // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser. + $url=$menu_array[$i]['url']; + if (! preg_match('/mainmenu=/i',$menu_array[$i]['url'])) + { + if (! preg_match('/\?/',$url)) $url.='?'; + else $url.='&'; + $url.='mainmenu='.$mainmenu; + } + + // Menu niveau 0 + if ($menu_array[$i]['level'] == 0) + { + if ($menu_array[$i]['enabled']) + { + print ''; + } + else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + { + print ''; + } + print "\n".'
'."\n"; + print ''."\n"; + } + // Menu niveau > 0 + if ($menu_array[$i]['level'] > 0) + { + if ($menu_array[$i]['enabled']) + { + print ''; + } + else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) + { + print ''; + } + } + + // If next is a new block or end + if (empty($menu_array[$i+1]['level'])) + { + print ''."\n"; + print "
\n"; + print "
\n"; + } + } + } + + return sizeof($menu_array); +} + +?> diff --git a/htdocs/includes/menus/standard/bureau2crea_backoffice.php b/htdocs/includes/menus/standard/bureau2crea_backoffice.php new file mode 100644 index 00000000000..2ae1cf9af04 --- /dev/null +++ b/htdocs/includes/menus/standard/bureau2crea_backoffice.php @@ -0,0 +1,110 @@ + + * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2008-2009 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/includes/menus/standard/bureau2crea_backoffice.php + * \brief Gestionnaire nomme Auguria du menu du haut + * \version $Id$ + * + * \remarks La construction d'un gestionnaire pour le menu du haut est simple: + * \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut + * \remarks doivent etre affichees par ... + * \remarks ou si menu selectionne ... + */ + + +/** + * \class MenuTop + * \brief Classe permettant la gestion du menu du haut Auguria + */ + +class MenuTop { + + var $require_left=array("bureau2crea_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier + var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu + var $atarget=""; // Valeur du target a utiliser dans les liens + + + /** + * \brief Constructeur + * \param db Database access handler + */ + function MenuTop($db) + { + $this->db=$db; + } + + + /** + * \brief Show menu + */ + function showmenu() + { + require_once(DOL_DOCUMENT_ROOT.'/includes/menus/standard/bureau2crea.lib.php'); + + print_bureau2crea_menu($this->db,$this->atarget,$this->hideifnotallowed); + } + +} + + +/** + * \class MenuLeft + * \brief Classe permettant la gestion du menu du gauche Auguria + */ +class MenuLeft { + + var $require_top=array("bureau2crea_backoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier + + var $db; + var $menu_array; + var $menu_array_after; + + + /** + * Constructor + * @param db Database handler + * @param menu_array Table of menu entries to show before entries of menu handler + * @param menu_array_after Table of menu entries to show after entries of menu handler + * + */ + function MenuLeft($db,&$menu_array,&$menu_array_after) + { + $this->db=$db; + $this->menu_array=$menu_array; + $this->menu_array_after=$menu_array_after; + } + + + /** + * \brief Show menu + * \return int Number of menu entries shown + */ + function showmenu() + { + require_once(DOL_DOCUMENT_ROOT.'/includes/menus/standard/bureau2crea.lib.php'); + + $res=print_left_bureau2crea_menu($this->db,$this->menu_array,$this->menu_array_after); + + return $res; + } +} + +?> diff --git a/htdocs/includes/menus/standard/bureau2crea_frontoffice.php b/htdocs/includes/menus/standard/bureau2crea_frontoffice.php new file mode 100644 index 00000000000..500dcd0af65 --- /dev/null +++ b/htdocs/includes/menus/standard/bureau2crea_frontoffice.php @@ -0,0 +1,113 @@ + + * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2008-2009 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/includes/menus/standard/bureau2crea_frontoffice.php + * \brief Gestionnaire nomme Auguria du menu du haut + * \version $Id$ + * + * \remarks La construction d'un gestionnaire pour le menu du haut est simple: + * \remarks Toutes les entrees de menu a faire apparaitre dans la barre du haut + * \remarks doivent etre affichees par ... + * \remarks ou si menu selectionne ... + */ + + +/** + * \class MenuTop + * \brief Classe permettant la gestion du menu du haut Auguria + */ + +class MenuTop { + + var $require_left=array("bureau2crea_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier + var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu + var $atarget=""; // Valeur du target a utiliser dans les liens + + + /** + * \brief Constructeur + * \param db Database access handler + */ + function MenuTop($db) + { + $this->db=$db; + } + + + + /** + * \brief Show menu + */ + function showmenu() + { + require_once(DOL_DOCUMENT_ROOT.'/includes/menus/standard/bureau2crea.lib.php'); + + print_bureau2crea_menu($this->db,$this->atarget,$this->hideifnotallowed); + } + +} + + +/** + * \class MenuLeft + * \brief Classe permettant la gestion du menu du gauche Auguria + */ +class MenuLeft { + + var $require_top=array("bureau2crea_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier + + var $db; + var $menu_array; + var $menu_array_after; + + + /** + * Constructor + * @param db Database handler + * @param menu_array Table of menu entries to show before entries of menu handler + * @param menu_array_after Table of menu entries to show after entries of menu handler + */ + function MenuLeft($db,&$menu_array,&$menu_array_after) + { + $this->db=$db; + $this->menu_array=$menu_array; + $this->menu_array_after=$menu_array_after; + } + + + /** + * \brief Show menu + * \return int Number of menu entries shown + */ + function showmenu() + { + require_once(DOL_DOCUMENT_ROOT.'/includes/menus/standard/bureau2crea.lib.php'); + + $res=print_left_bureau2crea_menu($this->db,$this->menu_array,$this->menu_array_after); + + $conf->global->MAIN_SEARCHFORM_SOCIETE=0; + $conf->global->MAIN_SEARCHFORM_CONTACT=0; + + return $res; + } +} + +?>