dolibarr  7.0.0-beta
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_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
41 if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1);
42 if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1);
43 if (! defined('DISABLE_BROWSER_NOTIF')) define('DISABLE_BROWSER_NOTIF',1);
44 if (! defined('DISABLE_DATE_PICKER')) define('DISABLE_DATE_PICKER',1);
45 if (! defined('DISABLE_SELECT2')) define('DISABLE_SELECT2',1);
46 
47 require_once '../main.inc.php';
48 
49 if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
50 
51 $langs->load("main");
52 $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
53 $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
54 
55 
56 /*
57  * View
58  */
59 
60 $title=$langs->trans("Menu");
61 
62 // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests
63 $head='<!-- Menu -->'."\n";
64 $arrayofjs=array();
65 $arrayofcss=array();
66 top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
67 
68 print '<body>'."\n";
69 
70 // Javascript to make menu active like Jmobile did.
71 print '
72 <style>
73  /*Lets hide the non active LIs by default*/
74  body {
75  font-size: 16px;
76  }
77  body ul {
78  margin: 0;
79  padding-left: 0;
80  }
81  body ul li {
82  list-style: none;
83  }
84  body ul ul {
85  display: none;
86  }
87 
88  a.alilevel0 {
89  background-image: url(\''.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/next.png\') !important;
90  background-repeat: no-repeat !important;
91  background-position-x: 10px;
92  background-position-y: 16px;
93  padding: 1em 15px 1em 40px;
94  }
95  li.lilevel0 font.vsmenudisabled {
96  /* background-image: url(/dolibarr_dev/htdocs/theme/eldy/img/next.png) !important; */
97  background-repeat: no-repeat !important;
98  background-position-x: 10px;
99  background-position-y: 16px;
100  padding: 1em 15px 1em 40px;
101  background: #f8f8f8;
102  display: block;
103  font-size: 16px !important;
104  }
105  li.lilevel1 {
106  padding: 1em 15px 0.5em 40px;
107  border-top: 1px solid #aaa;
108  margin-right: 0px;
109  margin-left: 0px;
110  border-right: 0px ! important;
111  }
112  li.lilevel1:first-child {
113  margin-right: 0px;
114  margin-left: 0px;
115  }
116  li.lilevel1 a {
117  padding-bottom: 5px;
118  }
119  li.lilevel1 a, li.lilevel1 {
120  color: #000;
121  cursor: pointer;
122  display: block;
123  }
124  li.lilevel2 a {
125  padding: 0.7em 15px 0.7em 40px;
126  color: #000;
127  cursor: pointer;
128  display: block;
129  }
130  li.lilevel3 a {
131  padding: 0.2em 15px 0.2em 60px;
132  color: #000;
133  cursor: pointer;
134  display: block;
135  }
136  li.lilevel4 a {
137  padding: 0.2em 15px 8px 60px;
138  color: #000;
139  cursor: pointer;
140  display: block;
141  }
142  li.lilevel5 a {
143  padding: 0.2em 15px 0.2em 60px;
144  color: #000;
145  cursor: pointer;
146  display: block;
147  }
148  li.lilevel3:last-child {
149  padding-bottom: 10px;
150  }
151  a.alilevel0, li.lilevel1 a {
152  text-overflow: ellipsis;
153  overflow: hidden;
154  white-space: nowrap;
155  display: block;
156  }
157 </style>
158 
159 <script type="text/javascript">
160 $(document).ready(function(){
161  $("body ul").click(function(){
162  console.log("We click on body ul");
163 
164  $(this).siblings().find("li ul").slideUp(0);
165 
166  $(this).find("li ul").slideToggle(200);
167 
168  target = $(this);
169  $(\'html, body\').animate({
170  scrollTop: target.offset().top
171  }, 300);
172 
173  })
174 });
175 </script>
176 ';
177 
178 
179 if (empty($user->societe_id)) // If internal user or not defined
180 {
181  $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);
182 }
183 else // If external user
184 {
185  $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);
186 }
187 
188 // Load the menu manager (only if not already done)
189 $file_menu=$conf->standard_menu;
190 if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
191 if (! class_exists('MenuManager'))
192 {
193  $menufound=0;
194  $dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
195  foreach($dirmenus as $dirmenu)
196  {
197  $menufound=dol_include_once($dirmenu."standard/".$file_menu);
198  if ($menufound) break;
199  }
200  if (! $menufound) // If failed to include, we try with standard
201  {
202  dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
203  $file_menu='eldy_menu.php';
204  include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
205  }
206 }
207 $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
208 $menumanager->loadMenu('all','all');
209 //var_dump($menumanager);exit;
210 $menumanager->showmenu('jmobile');
211 
212 print '</body>';
213 
214 print '</html>'."\n";
215 
216 $db->close();
loadMenu($forcemainmenu='', $forceleftmenu='')
Load this->tabMenu.
Class to manage menu Auguria.
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1091
print
Draft customers invoices.
Definition: index.php:91
showmenu($mode, $moredata=null)
Show menu.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Return a prefix to use for this Dolibarr instance, for session/cookie names or email id...