Some fix in smartphone menu manager
This commit is contained in:
parent
638cb105df
commit
54ff3ba28b
@ -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 '<a href="'.$url.'"'.($menus[$j]['atarget']?" target='".$menus[$j]['atarget']."'":($atarget?" target=$atarget":'')).'>';
|
||||
$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 '<a href="'.$url.'"'.($menus[$j]['atarget']?" target='".$menus[$j]['atarget']."'":($atarget?" target=$atarget":'')).'>';
|
||||
$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 '<a href="'.$url.'"'.($tabMenu[$i]['atarget']?" target='".$tabMenu[$i]['atarget']."'":($atarget?" target=$atarget":'')).'>';
|
||||
$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 '</a>';
|
||||
}
|
||||
print_end_menu();
|
||||
|
||||
print_end_menu_entry();
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -40,7 +40,7 @@ require('header.tpl.php');
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<?php $menusmart->showmenu(); ?>
|
||||
<?php $menusmart->showmenu($limitmenuto); ?>
|
||||
|
||||
</div><!-- /content -->
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user