Add feature to get nb of top menu entrie
Fix translation of units
This commit is contained in:
parent
1f4742b77b
commit
2bd0f04d8f
@ -98,4 +98,18 @@ class Menu
|
|||||||
if (count($this->liste) > 1) array_pop($this->liste);
|
if (count($this->liste) > 1) array_pop($this->liste);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return number of visible entries (gray or not)
|
||||||
|
*
|
||||||
|
* @return int Number of visible (gray or not) menu entries
|
||||||
|
*/
|
||||||
|
function getNbOfVisibleMenuEntries()
|
||||||
|
{
|
||||||
|
$nb=0;
|
||||||
|
foreach($this->liste as $val)
|
||||||
|
{
|
||||||
|
if (! empty($val['enabled'])) $nb++;
|
||||||
|
}
|
||||||
|
return $nb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class MenuManager
|
|||||||
*
|
*
|
||||||
* @param string $mode 'top', 'left', 'jmobile'
|
* @param string $mode 'top', 'left', 'jmobile'
|
||||||
* @param array $moredata An array with more data to output
|
* @param array $moredata An array with more data to output
|
||||||
* @return string
|
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||||
*/
|
*/
|
||||||
function showmenu($mode, $moredata=null)
|
function showmenu($mode, $moredata=null)
|
||||||
{
|
{
|
||||||
@ -169,8 +169,8 @@ class MenuManager
|
|||||||
|
|
||||||
if ($this->type_user == 1)
|
if ($this->type_user == 1)
|
||||||
{
|
{
|
||||||
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
|
$conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED=1;
|
||||||
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
$conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
|
||||||
@ -178,6 +178,13 @@ class MenuManager
|
|||||||
|
|
||||||
if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
|
if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
|
||||||
if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0,'','',$moredata);
|
if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0,'','',$moredata);
|
||||||
|
|
||||||
|
if ($mode == 'topnb')
|
||||||
|
{
|
||||||
|
print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
||||||
|
return $this->menu->getNbOfVisibleMenuEntries();
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode == 'jmobile')
|
if ($mode == 'jmobile')
|
||||||
{
|
{
|
||||||
print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class MenuManager
|
|||||||
*
|
*
|
||||||
* @param string $mode 'top', 'left', 'jmobile'
|
* @param string $mode 'top', 'left', 'jmobile'
|
||||||
* @param array $moredata An array with more data to output
|
* @param array $moredata An array with more data to output
|
||||||
* @return string
|
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||||
*/
|
*/
|
||||||
function showmenu($mode, $moredata=null)
|
function showmenu($mode, $moredata=null)
|
||||||
{
|
{
|
||||||
@ -123,8 +123,8 @@ class MenuManager
|
|||||||
|
|
||||||
if ($this->type_user == 1)
|
if ($this->type_user == 1)
|
||||||
{
|
{
|
||||||
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
|
$conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED=0;
|
||||||
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
$conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
|
||||||
@ -142,6 +142,12 @@ class MenuManager
|
|||||||
if ($mode == 'left') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
|
if ($mode == 'left') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mode == 'topnb')
|
||||||
|
{
|
||||||
|
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
||||||
|
return $this->menu->getNbOfVisibleMenuEntries();
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode == 'jmobile')
|
if ($mode == 'jmobile')
|
||||||
{
|
{
|
||||||
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
|
||||||
@ -238,6 +244,7 @@ class MenuManager
|
|||||||
unset($this->menu);
|
unset($this->menu);
|
||||||
|
|
||||||
//print 'xx'.$mode;
|
//print 'xx'.$mode;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class MenuManager
|
|||||||
*
|
*
|
||||||
* @param string $mode 'top', 'left', 'jmobile'
|
* @param string $mode 'top', 'left', 'jmobile'
|
||||||
* @param array $moredata An array with more data to output
|
* @param array $moredata An array with more data to output
|
||||||
* @return string
|
* @return int 0 or nb of top menu entries if $mode = 'topnb'
|
||||||
*/
|
*/
|
||||||
function showmenu($mode, $moredata=null)
|
function showmenu($mode, $moredata=null)
|
||||||
{
|
{
|
||||||
@ -78,6 +78,11 @@ class MenuManager
|
|||||||
$noout=0;
|
$noout=0;
|
||||||
if ($mode == 'jmobile') $noout=1;
|
if ($mode == 'jmobile') $noout=1;
|
||||||
|
|
||||||
|
if ($mode == 'topnb')
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode == 'top' || $mode == 'jmobile')
|
if ($mode == 'top' || $mode == 'jmobile')
|
||||||
{
|
{
|
||||||
if (empty($noout)) print_start_menu_array_empty();
|
if (empty($noout)) print_start_menu_array_empty();
|
||||||
|
|||||||
@ -121,20 +121,20 @@ LengthUnitdm=dm
|
|||||||
LengthUnitcm=cm
|
LengthUnitcm=cm
|
||||||
LengthUnitmm=mm
|
LengthUnitmm=mm
|
||||||
Surface=Area
|
Surface=Area
|
||||||
SurfaceUnitm2=m2
|
SurfaceUnitm2=m²
|
||||||
SurfaceUnitdm2=dm2
|
SurfaceUnitdm2=dm²
|
||||||
SurfaceUnitcm2=cm2
|
SurfaceUnitcm2=cm²
|
||||||
SurfaceUnitmm2=mm2
|
SurfaceUnitmm2=mm²
|
||||||
SurfaceUnitfoot2=ft2
|
SurfaceUnitfoot2=ft²
|
||||||
SurfaceUnitinch2=in2
|
SurfaceUnitinch2=in²
|
||||||
Volume=Volume
|
Volume=Volume
|
||||||
TotalVolume=Total volume
|
TotalVolume=Total volume
|
||||||
VolumeUnitm3=m3
|
VolumeUnitm3=m³
|
||||||
VolumeUnitdm3=dm3
|
VolumeUnitdm3=dm³ (L)
|
||||||
VolumeUnitcm3=cm3
|
VolumeUnitcm3=cm³ (ml)
|
||||||
VolumeUnitmm3=mm3
|
VolumeUnitmm3=mm³ (µl)
|
||||||
VolumeUnitfoot3=ft3
|
VolumeUnitfoot3=ft³
|
||||||
VolumeUnitinch3=in3
|
VolumeUnitinch3=in³
|
||||||
VolumeUnitounce=ounce
|
VolumeUnitounce=ounce
|
||||||
VolumeUnitlitre=litre
|
VolumeUnitlitre=litre
|
||||||
VolumeUnitgallon=gallon
|
VolumeUnitgallon=gallon
|
||||||
|
|||||||
@ -31,7 +31,7 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
|||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||||
if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login
|
if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login
|
||||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
|
||||||
@ -214,6 +214,11 @@ print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n";
|
|||||||
print '*/'."\n";
|
print '*/'."\n";
|
||||||
|
|
||||||
if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11;
|
if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11;
|
||||||
|
|
||||||
|
|
||||||
|
//$nb=$menumanager->showmenu('topnb');
|
||||||
|
//print $nb;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user