Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
m_menu Class Reference

This class manage menu. More...

Public Member Functions

 m_menu ()
 Constructor menu([$mid]) Constructeur de la classe menu, ne fait rien pour le moment.
 getmenu ()
 order_menu ($a, $b)
 system_menu ()

Detailed Description

This class manage menu.

Definition at line 31 of file m_menu.php.

Member Function Documentation

getmenu ( )

Definition at line 40 of file m_menu.php.

References $hooks, $mem, isset, and system_menu().

{
global $hooks, $quota, $mem;
// Force rebuilding quota, in case of add or edit of the quota and cache not up-to-date
$mesq = $quota->getquota("",true); // rebuild quota
// Get menu objects
$lsto = $hooks->invoke('hook_menu');
// Get system menu
$sm = $this->system_menu();
// Merge it !
$lst = array_merge($sm,$lsto);
// Sort it
uasort($lst, 'm_menu::order_menu');
// Get user specific menu visibility options
$mop = $mem->session_tempo_params_get('menu_toggle') ;
foreach( $lst as $k => $v ) {
if (empty($v)) {
unset($lst[$k]);
continue;
}
// Set the javascript toggle link for menu asking for it
if ($v['link'] == 'toggle') {
$lst[$k]['link'] = 'javascript:menu_toggle(\'menu-'.$k.'\');';
}
// Be sure that the default visibility is true
if (! isset($lst[$k]['visibility'])) $lst[$k]['visibility'] = true;
// Set the user's specific visibility option
if (isset($mop["menu-$k"])) {
if ($mop["menu-$k"] == "hidden") $lst[$k]['visibility'] = false;
if ($mop["menu-$k"] == "visible") $lst[$k]['visibility'] = true;
}
if ( isset($mesq[$k])) { // if there are some quota for this class
// Hide the menu if there are none and not allowed to create
if ( $mesq[$k]['t'] < 1 && $mesq[$k]['u'] < 1 ) {
unset($lst[$k]);
continue;
}
// Set the quota in the menu object
$lst[$k]['quota_used'] = $mesq[$k]['u'] ;
$lst[$k]['quota_total'] = $mesq[$k]['t'] ;
} // end if there are some quota for this class
}
return $lst;
} //getmenu
m_menu ( )

Constructor menu([$mid]) Constructeur de la classe menu, ne fait rien pour le moment.

Definition at line 37 of file m_menu.php.

{
}
order_menu (   $a,
  $b 
)

Definition at line 100 of file m_menu.php.

{
// Use to order the menu with a usort
return $a['pos'] > $b['pos'];
}
system_menu ( )

Definition at line 105 of file m_menu.php.

References $help_baseurl, and isset.

Referenced by getmenu().

{
// Here some needed menu who don't have a class
global $help_baseurl, $lang_translation, $locales;
$m =
array(
'home' =>
array(
'title' => _("Home / Information"),
'ico' => 'images/home.png',
'link' => 'main.php',
'pos' => 0,
),
'logout' =>
array(
'title' => _("Logout"),
'ico' => 'images/exit.png',
'link' => 'mem_logout.php',
'pos' => 170,
),
'help' =>
array(
'title' => _("Online help"),
'ico' => 'images/help.png',
'target' => 'help',
'link' => $help_baseurl,
'pos' => 140,
),
'lang' =>
array(
'title' => _("Languages"),
'ico' => '/images/lang.png',
'visibility' => false,
'link' => 'toggle',
'links' => array(),
'pos' => 150,
)
) ;
foreach($locales as $l) {
$m['lang']['links'][] = array ( 'txt' => (isset($lang_translation[$l]))?$lang_translation[$l]:$l, 'url' => "/login.php?setlang=$l");
}
return $m;
/*
<div class="menu-box">
<a href="javascript:menu_toggle('menu-lang');">
<div class="menu-title">
<img src="/images/lang.png" alt="<?php __("Languages"); ?>" />&nbsp;<?php __("Languages"); ?>
<img src="/images/menu_moins.png" alt="" style="float:right;" id="menu-lang-img"/>
</div>
</a>
<div class="menu-content" id="menu-lang">
<ul>
<?php foreach($locales as $l) { ?>
<li><a href="/login.php?setlang=<?php echo $l; ?>" target="_top"><?php if (isset($lang_translation[$l])) echo $lang_translation[$l]; else echo $l; ?></a></li>
<?php } ?>
</ul>
</div>
</div>
*/
} //system_menu

The documentation for this class was generated from the following file: