Qual: Still work onto menu management rewrite.
This commit is contained in:
parent
7238c5156e
commit
b61c576343
@ -385,19 +385,16 @@ class Menubase
|
||||
*/
|
||||
function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
$newTabMenu=array();
|
||||
if (is_array($tabMenu))
|
||||
foreach($tabMenu as $val)
|
||||
{
|
||||
foreach($tabMenu as $val)
|
||||
{
|
||||
if ($val['type']=='top') $newTabMenu[]=$val;
|
||||
}
|
||||
if ($val['type']=='top') $newTabMenu[]=$val;
|
||||
}
|
||||
|
||||
return $newTabMenu;
|
||||
@ -411,80 +408,78 @@ class Menubase
|
||||
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
|
||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
|
||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||
* @param array &$tabMenu Array with menu entries already loaded
|
||||
* @return array Menu array for particular mainmenu value or full tabArray
|
||||
*/
|
||||
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
|
||||
{
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
|
||||
// We initialize newmenu with first already found menu entries
|
||||
$this->newmenu = $newmenu;
|
||||
global $langs, $user, $conf; // To export to dol_eval function
|
||||
global $mainmenu,$leftmenu; // To export to dol_eval function
|
||||
|
||||
$mainmenu=$mymainmenu; // To export to dol_eval function
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
if (is_array($tabMenu))
|
||||
// Detect what is top mainmenu id
|
||||
$menutopid='';
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
$menutopid='';
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu)
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed, using the fk_menu link (old method)
|
||||
$this->recur($tabMenu, $menutopid, 1);
|
||||
// We initialize newmenu with first already found menu entries
|
||||
$this->newmenu = $newmenu;
|
||||
|
||||
// Now update this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
//var_dump($tabMenu);
|
||||
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
|
||||
{
|
||||
//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
|
||||
//var_dump($this->newmenu->liste);exit;
|
||||
// Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed, using the fk_menu link (old method)
|
||||
$this->recur($tabMenu, $menutopid, 1);
|
||||
|
||||
if (empty($val['fk_leftmenu']))
|
||||
{
|
||||
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']); // TODO Add position
|
||||
//var_dump($this->newmenu->liste);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
|
||||
$searchlastsub=0;$lastid=0;$nextid=0;$found=0;
|
||||
foreach($this->newmenu->liste as $keyparent => $valparent)
|
||||
{
|
||||
//var_dump($valparent);
|
||||
if ($searchlastsub) // If we started to search for last submenu
|
||||
{
|
||||
if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
|
||||
if ($valparent['level'] < $searchlastsub)
|
||||
{
|
||||
$nextid=$keyparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
|
||||
{
|
||||
//print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
|
||||
// Now we look to find last subelement of this parent (we add at end)
|
||||
$searchlastsub=($valparent['level']+1);
|
||||
$lastid=$keyparent;
|
||||
$found=1;
|
||||
}
|
||||
}
|
||||
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
|
||||
if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now update this->newmenu->list when fk_menu value is -1 (left menu added by modules with no top menu)
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
//var_dump($tabMenu);
|
||||
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu) // We found a menu entry not linked to parent with good mainmenu
|
||||
{
|
||||
//print 'Try to add menu (current is mainmenu='.$mainmenu.' leftmenu='.$leftmenu.') for '.join(',',$val).' fk_mainmenu='.$val['fk_mainmenu'].' fk_leftmenu='.$val['fk_leftmenu'].'<br>';
|
||||
//var_dump($this->newmenu->liste);exit;
|
||||
|
||||
if (empty($val['fk_leftmenu']))
|
||||
{
|
||||
$this->newmenu->add($val['url'], $val['titre'], 0, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']); // TODO Add position
|
||||
//var_dump($this->newmenu->liste);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu)
|
||||
$searchlastsub=0;$lastid=0;$nextid=0;$found=0;
|
||||
foreach($this->newmenu->liste as $keyparent => $valparent)
|
||||
{
|
||||
//var_dump($valparent);
|
||||
if ($searchlastsub) // If we started to search for last submenu
|
||||
{
|
||||
if ($valparent['level'] >= $searchlastsub) $lastid=$keyparent;
|
||||
if ($valparent['level'] < $searchlastsub)
|
||||
{
|
||||
$nextid=$keyparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
|
||||
{
|
||||
//print "We found parent: keyparent='.$keyparent.' - level=".$valparent['level'].' - '.join(',',$valparent).'<br>';
|
||||
// Now we look to find last subelement of this parent (we add at end)
|
||||
$searchlastsub=($valparent['level']+1);
|
||||
$lastid=$keyparent;
|
||||
$found=1;
|
||||
}
|
||||
}
|
||||
//print 'We must insert menu entry between entry '.$lastid.' and '.$nextid.'<br>';
|
||||
if ($found) $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->newmenu;
|
||||
|
||||
@ -51,12 +51,47 @@ $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
*/
|
||||
|
||||
// URL http://mydolibarr/core/getmenu_jmobime?mainmenu=mainmenu&leftmenu=leftmenu can be used for tests
|
||||
$arrayofjs=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css');
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
print '<body>'."\n";
|
||||
|
||||
print 'zzz'."\n";
|
||||
if (empty($user->societe_id)) // If internal user or not defined
|
||||
{
|
||||
$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);
|
||||
$conf->smart_menu=(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENU_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENU_SMARTPHONE):$conf->global->MAIN_MENU_SMARTPHONE_FORCED);
|
||||
}
|
||||
else // If external user
|
||||
{
|
||||
$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);
|
||||
$conf->smart_menu=(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)?(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE)?'smartphone_menu.php':$conf->global->MAIN_MENUFRONT_SMARTPHONE):$conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED);
|
||||
}
|
||||
|
||||
// Load the menu manager (only if not already done)
|
||||
$file_menu=empty($conf->browser->phone)?$conf->standard_menu:$conf->smart_menu;
|
||||
if (GETPOST('menu')) $file_menu=GETPOST('menu'); // example: menu=eldy_menu.php
|
||||
if (! class_exists('MenuManager'))
|
||||
{
|
||||
$menufound=0;
|
||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||
foreach($dirmenus as $dirmenu)
|
||||
{
|
||||
$menufound=dol_include_once($dirmenu."standard/".$file_menu);
|
||||
if ($menufound) break;
|
||||
}
|
||||
if (! $menufound) // If failed to include, we try with standard
|
||||
{
|
||||
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
|
||||
$file_menu='eldy_menu.php';
|
||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
||||
}
|
||||
}
|
||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||
|
||||
$menumanager->showmenu('jmobile');
|
||||
|
||||
print '</body></html>'."\n";
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -40,7 +40,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu)
|
||||
|
||||
$mainmenu=$_SESSION["mainmenu"];
|
||||
$leftmenu=$_SESSION["leftmenu"];
|
||||
|
||||
|
||||
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
|
||||
//$tabMenu=array();
|
||||
@ -55,7 +55,6 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu)
|
||||
$idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']);
|
||||
|
||||
$showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
// Define url
|
||||
@ -163,7 +162,7 @@ function print_end_menu_entry_auguria()
|
||||
function print_end_menu_array_auguria()
|
||||
{
|
||||
print '</ul>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -180,135 +179,133 @@ function print_end_menu_array_auguria()
|
||||
*/
|
||||
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu)
|
||||
{
|
||||
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
||||
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
||||
|
||||
$overwritemenufor = array();
|
||||
$newmenu = new Menu();
|
||||
$overwritemenufor = array();
|
||||
$newmenu = new Menu();
|
||||
|
||||
$mainmenu=$_SESSION["mainmenu"];
|
||||
$leftmenu=$_SESSION["leftmenu"];
|
||||
|
||||
// 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?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_mini);
|
||||
print "\n".'<!-- Show logo on menu -->'."\n";
|
||||
print '<div class="blockvmenuimpair">'."\n";
|
||||
print '<div class="menu_titre" id="menu_titre_logo"></div>';
|
||||
print '<div class="menu_top" id="menu_top_logo"></div>';
|
||||
print '<div class="menu_contenu" id="menu_contenu_logo">';
|
||||
print '<center><img title="" src="'.$urllogo.'"></center>'."\n";
|
||||
print '</div>';
|
||||
print '<div class="menu_end" id="menu_end_logo"></div>';
|
||||
print '</div>'."\n";
|
||||
}
|
||||
}
|
||||
$mainmenu=$_SESSION["mainmenu"];
|
||||
$leftmenu=$_SESSION["leftmenu"];
|
||||
|
||||
/**
|
||||
* We update newmenu with entries found into database
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
$menuArbo = new Menubase($db,'auguria');
|
||||
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
|
||||
// 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?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_mini);
|
||||
print "\n".'<!-- Show logo on menu -->'."\n";
|
||||
print '<div class="blockvmenuimpair">'."\n";
|
||||
print '<div class="menu_titre" id="menu_titre_logo"></div>';
|
||||
print '<div class="menu_top" id="menu_top_logo"></div>';
|
||||
print '<div class="menu_contenu" id="menu_contenu_logo">';
|
||||
print '<center><img title="" src="'.$urllogo.'"></center>'."\n";
|
||||
print '</div>';
|
||||
print '<div class="menu_end" id="menu_end_logo"></div>';
|
||||
print '</div>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($menu_array_before);exit;
|
||||
//var_dump($menu_array_after);exit;
|
||||
$menu_array=$newmenu->liste;
|
||||
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;
|
||||
/**
|
||||
* We update newmenu with entries found into database
|
||||
* --------------------------------------------------
|
||||
*/
|
||||
$menuArbo = new Menubase($db,'auguria');
|
||||
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
|
||||
|
||||
// Show menu
|
||||
$alt=0;
|
||||
if (is_array($menu_array))
|
||||
{
|
||||
$num=count($menu_array);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$alt++;
|
||||
if (empty($menu_array[$i]['level']))
|
||||
{
|
||||
if (($alt%2==0))
|
||||
{
|
||||
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION))
|
||||
{
|
||||
print '<div class="blockvmenupair">'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenuimpair">'."\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenupair">'."\n";
|
||||
}
|
||||
}
|
||||
//var_dump($menu_array_before);exit;
|
||||
//var_dump($menu_array_after);exit;
|
||||
$menu_array=$newmenu->liste;
|
||||
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;
|
||||
if (! is_array($menu_array)) return 0;
|
||||
|
||||
// Place tabulation
|
||||
$tabstring='';
|
||||
$tabul=($menu_array[$i]['level'] - 1);
|
||||
if ($tabul > 0)
|
||||
{
|
||||
for ($j=0; $j < $tabul; $j++)
|
||||
{
|
||||
$tabstring.=' ';
|
||||
}
|
||||
}
|
||||
// Show menu
|
||||
$alt=0;
|
||||
$num=count($menu_array);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$alt++;
|
||||
if (empty($menu_array[$i]['level']))
|
||||
{
|
||||
if (($alt%2==0))
|
||||
{
|
||||
if ($conf->use_javascript_ajax && ! empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION))
|
||||
{
|
||||
print '<div class="blockvmenupair">'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenuimpair">'."\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenupair">'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
|
||||
$url=dol_buildpath($menu_array[$i]['url'],1);
|
||||
// Place tabulation
|
||||
$tabstring='';
|
||||
$tabul=($menu_array[$i]['level'] - 1);
|
||||
if ($tabul > 0)
|
||||
{
|
||||
for ($j=0; $j < $tabul; $j++)
|
||||
{
|
||||
$tabstring.=' ';
|
||||
}
|
||||
}
|
||||
|
||||
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
|
||||
{
|
||||
if (! preg_match('/\?/',$url)) $url.='?';
|
||||
else $url.='&';
|
||||
$url.='mainmenu='.$mainmenu;
|
||||
}
|
||||
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
|
||||
$url=dol_buildpath($menu_array[$i]['url'],1);
|
||||
|
||||
print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['mainmenu'].' -->'."\n";
|
||||
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 '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
|
||||
}
|
||||
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
|
||||
{
|
||||
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
|
||||
}
|
||||
print "\n".'<div id="section_content_'.$i.'">'."\n";
|
||||
print '<div class="menu_top"></div>'."\n";
|
||||
}
|
||||
// Menu niveau > 0
|
||||
if ($menu_array[$i]['level'] > 0)
|
||||
{
|
||||
if ($menu_array[$i]['enabled'])
|
||||
{
|
||||
print '<div class="menu_contenu">'.$tabstring.'<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
|
||||
}
|
||||
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
|
||||
{
|
||||
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
|
||||
}
|
||||
}
|
||||
print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['mainmenu'].' -->'."\n";
|
||||
|
||||
// If next is a new block or end
|
||||
if (empty($menu_array[$i+1]['level']))
|
||||
{
|
||||
print '<div class="menu_end"></div>'."\n";
|
||||
print "</div><!-- end section content -->\n";
|
||||
print "</div><!-- end blockvmenu pair/impair -->\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Menu niveau 0
|
||||
if ($menu_array[$i]['level'] == 0)
|
||||
{
|
||||
if ($menu_array[$i]['enabled'])
|
||||
{
|
||||
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
|
||||
}
|
||||
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
|
||||
{
|
||||
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
|
||||
}
|
||||
print "\n".'<div id="section_content_'.$i.'">'."\n";
|
||||
print '<div class="menu_top"></div>'."\n";
|
||||
}
|
||||
// Menu niveau > 0
|
||||
if ($menu_array[$i]['level'] > 0)
|
||||
{
|
||||
if ($menu_array[$i]['enabled'])
|
||||
{
|
||||
print '<div class="menu_contenu">'.$tabstring.'<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
|
||||
}
|
||||
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
|
||||
{
|
||||
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
return count($menu_array);
|
||||
// If next is a new block or end
|
||||
if (empty($menu_array[$i+1]['level']))
|
||||
{
|
||||
print '<div class="menu_end"></div>'."\n";
|
||||
print "</div><!-- end section content -->\n";
|
||||
print "</div><!-- end blockvmenu pair/impair -->\n";
|
||||
}
|
||||
}
|
||||
|
||||
return count($menu_array);
|
||||
}
|
||||
|
||||
|
||||
@ -332,7 +329,9 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna
|
||||
$found=0;
|
||||
foreach($tmploops as $tmploop)
|
||||
{
|
||||
if (in_array($tmploop, $listofmodulesforexternal)) { $found++; break; }
|
||||
if (in_array($tmploop, $listofmodulesforexternal)) {
|
||||
$found++; break;
|
||||
}
|
||||
}
|
||||
if (! $found) return 0; // Entry is for menus all excluded to external users
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -98,7 +98,7 @@ class MenuManager
|
||||
/**
|
||||
* Show menu
|
||||
*
|
||||
* @param string $mode 'top' or 'left'
|
||||
* @param string $mode 'top', 'left', 'jmobile'
|
||||
* @return int Number of menu entries shown
|
||||
*/
|
||||
function showmenu($mode)
|
||||
@ -116,6 +116,7 @@ class MenuManager
|
||||
$res='ErrorBadParameterForMode';
|
||||
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu);
|
||||
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
|
||||
if ($mode == 'jmobile') $res=print_jmobile_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -28,12 +28,10 @@ define('NOCSRFCHECK',1); // This is login page. We must be able to go on it from
|
||||
require 'main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
|
||||
// If not defined, we select menu "home"
|
||||
$_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'home';
|
||||
$action=GETPOST('action');
|
||||
|
||||
|
||||
$hookmanager->initHooks(array('index'));
|
||||
|
||||
|
||||
@ -54,28 +52,14 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
|
||||
* View
|
||||
*/
|
||||
|
||||
// If smartphone mode, we do not show main page, we show only menu
|
||||
// If smartphone mode, we do not show main page, we show only menu. TODO Remove this
|
||||
if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone))
|
||||
{
|
||||
$limitmenuto=GETPOST('limitmenuto')?GETPOST('limitmenuto'):0;
|
||||
$limitmenuto=1; // A virer
|
||||
|
||||
// Load the smartphone menu manager
|
||||
$result=@include_once DOL_DOCUMENT_ROOT ."/core/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 ."/core/menus/smartphone/".$conf->smart_menu;
|
||||
}
|
||||
|
||||
$menusmart = new MenuSmart($db, $user->societe_id?1:0);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/theme/phones/smartphone/tpl/menu.tpl.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
llxHeader('',$langs->trans("HomeArea"));
|
||||
|
||||
print_fiche_titre($langs->trans("HomeArea"));
|
||||
|
||||
|
||||
@ -920,7 +920,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
|
||||
if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
|
||||
print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n";
|
||||
$jquerytheme = 'smoothness';
|
||||
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
|
||||
if (constant('JS_JQUERY_UI')) print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery
|
||||
@ -951,7 +951,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
}
|
||||
}
|
||||
|
||||
print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n";
|
||||
print '<!-- Includes CSS for Dolibarr theme -->'."\n";
|
||||
// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
|
||||
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
|
||||
$themesubdir='';
|
||||
@ -982,7 +982,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
foreach($filescss as $cssfile)
|
||||
{
|
||||
// cssfile is a relative path
|
||||
print '<!-- Added by module '.$modcss. '-->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
print '<!-- Includes CSS added by module '.$modcss. '-->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
|
||||
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||
print '">'."\n";
|
||||
@ -994,7 +994,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
{
|
||||
foreach($arrayofcss as $cssfile)
|
||||
{
|
||||
print '<!-- Added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1);
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
|
||||
if (!preg_match('/\.css$/i',$cssfile)) print $themeparam;
|
||||
print '">'."\n";
|
||||
@ -1142,14 +1142,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
foreach($filesjs as $jsfile)
|
||||
{
|
||||
// jsfile is a relative path
|
||||
print '<!-- Added by module '.$modjs. '-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n";
|
||||
print '<!-- Include JS added by module '.$modjs. '-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile,1).'"></script>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// JS forced by page in top_htmlhead (relative url starting with /)
|
||||
if (is_array($arrayofjs))
|
||||
{
|
||||
print '<!-- Includes JS specific to page -->'."\n";
|
||||
print '<!-- Includes JS added by page -->'."\n";
|
||||
foreach($arrayofjs as $jsfile)
|
||||
{
|
||||
if (preg_match('/^http/i',$jsfile))
|
||||
|
||||
@ -13,13 +13,23 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// Load the smartphone menu manager
|
||||
$result=@include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
|
||||
if (! $result) // If failed to include, we try with standard
|
||||
{
|
||||
$conf->smart_menu='smartphone_menu.php';
|
||||
include_once DOL_DOCUMENT_ROOT ."/core/menus/smartphone/".$conf->smart_menu;
|
||||
}
|
||||
$menusmart = new MenuSmart($db, $user->societe_id?1:0);
|
||||
|
||||
|
||||
top_httphead();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
<?php
|
||||
require 'header.tpl.php';
|
||||
?>
|
||||
<body>
|
||||
@ -50,7 +60,7 @@ jQuery(document).bind("mobileinit", function(){
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<?php $menusmart->showmenu($limitmenuto); ?>
|
||||
<?php $menusmart->showmenu(1); ?>
|
||||
|
||||
</div><!-- /content -->
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user