diff --git a/htdocs/includes/menus/smartphone/smartphone.lib.php b/htdocs/includes/menus/smartphone/smartphone.lib.php
index 245e6e55c8a..eca3201552d 100755
--- a/htdocs/includes/menus/smartphone/smartphone.lib.php
+++ b/htdocs/includes/menus/smartphone/smartphone.lib.php
@@ -31,8 +31,9 @@
* @param $db
* @param $atarget
* @param $type_user 0=Internal,1=External,2=All
+ * @param $limitmenuto To limit menu to a top or left menu value
*/
-function print_smartphone_menu($db,$atarget,$type_user)
+function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto)
{
require_once(DOL_DOCUMENT_ROOT."/core/class/menubase.class.php");
@@ -66,28 +67,36 @@ function print_smartphone_menu($db,$atarget,$type_user)
}
else
{
+ $menus='';
+
+ if ($limitmenuto != 'top')
+ {
+ $newmenu = new Menu();
+ $leftmenu = $menuleft->menuLeftCharger($newmenu,$tabMenu[$i]['mainmenu'],'',($user->societe_id?1:0),'smartphone');
+ $menus = $leftmenu->liste;
+ //var_dump($menus);
+ }
+
print_start_menu_entry();
- $title=$tabMenu[$i]['titre'];
- // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($tabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&')));
- print_text_menu_entry($title);
- $newmenu = new Menu();
- $leftmenu = $menuleft->menuLeftCharger($newmenu,$tabMenu[$i]['mainmenu'],'',($user->societe_id?1:0),'smartphone');
- $menus = $leftmenu->liste;
- //var_dump($menus);
-
- print_start_submenu_array();
if (is_array($menus) && !empty($menus))
{
- $num = count($menus);
+ $title=$tabMenu[$i]['titre'];
+ // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($tabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&')));
+ print_text_menu_entry($title);
+
+ $num = count($menus);
//var_dump($menus);
-
+
+ if ($num > 0) print_start_submenu_array();
+
for($j=0; $j<$num; $j++)
{
+ $url=dol_buildpath($menus[$j]['url'],1);
+ $url=preg_replace('/&.*/i','',$url);
+
if ($menus[$j]['level'] == 0)
{
- $url=dol_buildpath($menus[$j]['url'],1);
- $url=preg_replace('/&.*/i','',$url);
print_start_menu_entry();
if (empty($menus[$j+1]['level'])) print '';
$title=$menus[$j]['titre'];
@@ -100,8 +109,6 @@ function print_smartphone_menu($db,$atarget,$type_user)
{
if ($menus[$j-1]['level'] == 0) print_start_submenu_array();
- $url=dol_buildpath($menus[$j]['url'],1);
- $url=preg_replace('/&.*/i','',$url);
print_start_menu_entry();
print '';
$title=$menus[$j]['titre'];
@@ -115,8 +122,20 @@ function print_smartphone_menu($db,$atarget,$type_user)
if (empty($menus[$j+1]['level'])) print_end_menu_entry();
}
+
+ if ($num > 0) print_end_menu();
+ }
+ else
+ {
+ $url=dol_buildpath($tabMenu[$i]['url'],1);
+ $url=preg_replace('/&.*/i','',$url);
+
+ print '';
+ $title=$tabMenu[$i]['titre'];
+ // To remove & and special chars: $title=dol_string_unaccent(dol_string_nospecial(dol_html_entity_decode($tabMenu[$i]['titre'],ENT_QUOTES,'UTF-8'),'',array('&')));
+ print_text_menu_entry($title);
+ print '';
}
- print_end_menu();
print_end_menu_entry();
}
diff --git a/htdocs/includes/menus/smartphone/smartphone_backoffice.php b/htdocs/includes/menus/smartphone/smartphone_backoffice.php
index 153437a7dcf..a6dc623c5f2 100755
--- a/htdocs/includes/menus/smartphone/smartphone_backoffice.php
+++ b/htdocs/includes/menus/smartphone/smartphone_backoffice.php
@@ -47,12 +47,13 @@ class MenuSmart {
/**
* Show menu
+ * @param limitmenuto To limit menu to a top or left menu value
*/
- function showmenu()
+ function showmenu($limitmenuto)
{
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/smartphone.lib.php');
- print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
+ print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$limitmenuto);
}
}
diff --git a/htdocs/includes/menus/smartphone/smartphone_frontoffice.php b/htdocs/includes/menus/smartphone/smartphone_frontoffice.php
index ce1e39d64aa..d99170fa79c 100755
--- a/htdocs/includes/menus/smartphone/smartphone_frontoffice.php
+++ b/htdocs/includes/menus/smartphone/smartphone_frontoffice.php
@@ -46,13 +46,14 @@ class MenuSmart {
/**
- * \brief Show menu
+ * Show menu
+ * @param limitmenuto To limit menu to a top or left menu value
*/
- function showmenu()
+ function showmenu($limitmenuto)
{
require_once(DOL_DOCUMENT_ROOT.'/includes/menus/smartphone/smartphone.lib.php');
- print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed);
+ print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$limitmenuto);
}
}
diff --git a/htdocs/index.php b/htdocs/index.php
index 03edfcdaaec..1b3495dbb7a 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -57,18 +57,18 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
// If smartphone mode, we do no show main page, we show only menu
if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone))
{
- $smart_menu=$conf->smart_menu;
-
+ $limitmenu=GETPOST('limitmenuto')?GETPOST('limitmenuto'):'top';
+ $limitmenu=''; // A virer
+
// Load the smartphone menu manager
- $result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
+ $result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$conf->smart_menu);
if (! $result) // If failed to include, we try with standard
{
$conf->smart_menu='smartphone_backoffice.php';
- include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$smart_menu);
+ include_once(DOL_DOCUMENT_ROOT ."/includes/menus/smartphone/".$conf->smart_menu);
}
$menusmart = new MenuSmart($db);
- $menusmart->atarget=$target;
include_once(DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php');
exit;
diff --git a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php
index 1f96e88b8e1..83e321ca6fa 100644
--- a/htdocs/theme/phones/smartphone/tpl/menu.tpl.php
+++ b/htdocs/theme/phones/smartphone/tpl/menu.tpl.php
@@ -40,7 +40,7 @@ require('header.tpl.php');
-->
- showmenu(); ?>
+ showmenu($limitmenuto); ?>