dolibarr  9.0.0
get_menudiv.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This file is a modified version of datepicker.php from phpBSM to fix some
5  * bugs, to add new features and to dramatically increase speed.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
27 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
28 //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
29 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
30 if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
31 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
32 //if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
33 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
34 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
35 
36 if (! defined('DISABLE_JQUERY_TABLEDND')) define('DISABLE_JQUERY_TABLEDND',1);
37 if (! defined('DISABLE_JQUERY_JNOTIFY')) define('DISABLE_JQUERY_JNOTIFY',1);
38 if (! defined('DISABLE_JQUERY_FLOT')) define('DISABLE_JQUERY_FLOT',1);
39 if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
40 if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1);
41 if (! defined('DISABLE_BROWSER_NOTIF')) define('DISABLE_BROWSER_NOTIF',1);
42 if (! defined('DISABLE_DATE_PICKER')) define('DISABLE_DATE_PICKER',1);
43 if (! defined('DISABLE_SELECT2')) define('DISABLE_SELECT2',1);
44 
45 require_once '../main.inc.php';
46 
47 if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
48 
49 $langs->load("main");
50 $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
51 $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
52 
53 
54 /*
55  * View
56  */
57 
58 $title=$langs->trans("Menu");
59 
60 // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests
61 $head='<!-- Menu -->'."\n";
62 $arrayofjs=array();
63 $arrayofcss=array();
64 top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
65 
66 print '<body>'."\n";
67 
68 // Javascript to make menu active like Jmobile did.
69 print '
70 <style>
71  /*Lets hide the non active LIs by default*/
72  body {
73  font-size: 16px;
74  }
75  body ul {
76  margin: 0;
77  padding-left: 0;
78  }
79  body ul li {
80  list-style: none;
81  }
82  body ul ul {
83  display: none;
84  }
85 
86  a.alilevel0 {
87  background-image: url(\''.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/next.png\') !important;
88  background-repeat: no-repeat !important;
89  background-position-x: 10px;
90  background-position-y: 16px;
91  padding: 1em 15px 1em 40px;
92  }
93  li.lilevel0 font.vsmenudisabled {
94  /* background-image: url(/dolibarr_dev/htdocs/theme/eldy/img/next.png) !important; */
95  background-repeat: no-repeat !important;
96  background-position-x: 10px;
97  background-position-y: 16px;
98  padding: 1em 15px 1em 40px;
99  background: #f8f8f8;
100  display: block;
101  font-size: 16px !important;
102  }
103  li.lilevel1 {
104  padding: 1em 15px 0.5em 40px;
105  border-top: 1px solid #aaa;
106  margin-right: 0px;
107  margin-left: 0px;
108  border-right: 0px ! important;
109  }
110  li.lilevel1:first-child {
111  margin-right: 0px;
112  margin-left: 0px;
113  }
114  li.lilevel1 a {
115  padding-bottom: 5px;
116  }
117  li.lilevel1 a, li.lilevel1 {
118  color: #000;
119  cursor: pointer;
120  display: block;
121  }
122  li.lilevel2 a {
123  padding: 0.7em 15px 0.7em 40px;
124  color: #000;
125  cursor: pointer;
126  display: block;
127  }
128  li.lilevel3 a {
129  padding: 0.2em 15px 0.2em 60px;
130  color: #000;
131  cursor: pointer;
132  display: block;
133  }
134  li.lilevel4 a {
135  padding: 0.2em 15px 8px 60px;
136  color: #000;
137  cursor: pointer;
138  display: block;
139  }
140  li.lilevel5 a {
141  padding: 0.2em 15px 0.2em 60px;
142  color: #000;
143  cursor: pointer;
144  display: block;
145  }
146  li.lilevel3:last-child {
147  padding-bottom: 10px;
148  }
149  a.alilevel0, li.lilevel1 a {
150  text-overflow: ellipsis;
151  overflow: hidden;
152  white-space: nowrap;
153  display: block;
154  }
155 </style>
156 
157 <script type="text/javascript">
158 $(document).ready(function(){
159  $("body ul").click(function(){
160  console.log("We click on body ul");
161 
162  $(this).siblings().find("li ul").slideUp(0);
163 
164  $(this).find("li ul").slideToggle(200);
165 
166  target = $(this);
167  $(\'html, body\').animate({
168  scrollTop: target.offset().top
169  }, 300);
170 
171  })
172 });
173 </script>
174 ';
175 
176 
177 if (empty($user->societe_id)) // If internal user or not defined
178 {
179  $conf->standard_menu=(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?(empty($conf->global->MAIN_MENU_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENU_STANDARD):$conf->global->MAIN_MENU_STANDARD_FORCED);
180 }
181 else // If external user
182 {
183  $conf->standard_menu=(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED)?(empty($conf->global->MAIN_MENUFRONT_STANDARD)?'eldy_menu.php':$conf->global->MAIN_MENUFRONT_STANDARD):$conf->global->MAIN_MENUFRONT_STANDARD_FORCED);
184 }
185 
186 // Load the menu manager (only if not already done)
187 $file_menu=$conf->standard_menu;
188 if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
189 if (! class_exists('MenuManager'))
190 {
191  $menufound=0;
192  $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
193  foreach($dirmenus as $dirmenu)
194  {
195  $menufound=dol_include_once($dirmenu."standard/".$file_menu);
196  if ($menufound) break;
197  }
198  if (! $menufound) // If failed to include, we try with standard
199  {
200  dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
201  $file_menu='eldy_menu.php';
202  include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
203  }
204 }
205 $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
206 $menumanager->loadMenu('all','all'); // Load this->tabMenu with sql menu entries
207 //var_dump($menumanager);exit;
208 $menumanager->showmenu('jmobile');
209 
210 print '</body>';
211 
212 print '</html>'."\n";
213 
214 $db->close();
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
loadMenu($forcemainmenu='', $forceleftmenu='')
Load this->tabMenu.
Class to manage menu Auguria.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
if(! function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1172
showmenu($mode, $moredata=null)
Show menu.