themes
[ class tree: themes ] [ index: themes ] [ all elements ]

Source for file menu_register_inc.php

Documentation is available at menu_register_inc.php

  1. <?php
  2. /**
  3.  * @package themes
  4.  * @subpackage functions
  5.  */
  6.  
  7. /**
  8.  * Required setup
  9.  */
  10. global $gBitUser, $gBitSystem, $gBitSmarty;
  11.  
  12. // Global menu
  13. //    $gBitSystem->registerAppMenu( 'global', NULL, NULL, 'bitpackage:kernel/menu_global.tpl' );
  14.  
  15. // Application menu
  16. uasort( $gBitSystem->mAppMenu, "mAppMenu_sort" );
  17.  
  18. // Admin menu
  19. $adminMenu = array();
  20. foreach( array_keys( $gBitSystem->mPackages ) as $package ) {
  21.     if( $gBitUser->hasPermission( 'p_'.$package.'_admin' ) ) {
  22.         $package = strtolower( $package );
  23.         $tpl = "bitpackage:$package/menu_".$package."_admin.tpl";
  24.         if(( $gBitSystem->isPackageActive( $package ) || $package == 'kernel') && $gBitSmarty->template_exists( $tpl )) {
  25.             $adminMenu[$package]['tpl'] = $tpl;
  26.             $adminMenu[$package]['display'] = 'display:'.( empty( $package ) || ( isset( $_COOKIE[$package.'admenu'] ) && ( $_COOKIE[$package.'admenu'] == 'o' ) ) ? 'block;' : 'none;' );
  27.         }
  28.     }
  29. }
  30.  
  31. if( !empty( $adminMenu ) ) {
  32.     ksort( $adminMenu );
  33.     $gBitSmarty->assign_by_ref( 'adminMenu', $adminMenu );
  34. }
  35.  
  36. /**
  37.  * mAppMenu_sort
  38.  */
  39. function mAppMenu_sort( $a, $b ) {
  40.     if( @is_numeric( $a['menu_position'] ) ) {
  41.         return( (int)$a['menu_position'] > (int)$b['menu_position'] );
  42.     } elseif( !empty( $a['menu_title'] ) ) {
  43.         return( strcmp( $a['menu_title'], $b['menu_title'] ) );
  44.     }
  45. }
  46. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:04 +0000 by phpDocumentor 1.5.0-lsces