Ignore:
Timestamp:
Nov 28, 2009, 7:20:01 PM (14 years ago)
Author:
grum
Message:

<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>[AMM] allow to group and reorder menu items (mantis 1132,1133)</p>
</body></html>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/amm_pip.class.inc.php

    r4363 r4382  
    2222{
    2323  protected $ajax;
     24  protected $displayRandomImageBlock=true;
    2425
    2526  function AMM_PIP($prefixeTable, $filelocation)
     
    6869  public function blockmanager_apply( $menu_ref_arr )
    6970  {
    70     global $user;
     71    global $user, $page;
    7172    $menu = & $menu_ref_arr[0];
    7273
    73 global $page;
    7474
    7575    /*
     
    8585      );
    8686      $block->template = dirname(__FILE__).'/menu_templates/menubar_randompic.tpl';
     87    }
     88    else
     89    {
     90      $this->displayRandomImageBlock=false;
    8791    }
    8892
     
    136140    }
    137141
     142
    138143    /*
    139144      hide items from special & menu sections
    140145    */
    141     foreach(array('mbMenu' => 'amm_sections_modmenu', 'mbSpecials' =>'amm_sections_modspecials') as $key0 => $val0)
    142     {
    143       if ( ($block = $menu->get_block( $key0 ) ) != null )
    144       {
    145         foreach($this->my_config[$val0] as $key => $val)
    146         {
    147           if($val=='n')
    148           {
    149             unset( $block->data[$key] );
    150           }
    151         }
    152       }
    153     }
    154 }
     146    $blocks=Array();
     147    $blocks['menu']=$menu->get_block('mbMenu');
     148    $blocks['special']=$menu->get_block('mbSpecials');
     149
     150    $menuItems=array_merge($blocks['menu']->data, $blocks['special']->data);
     151    $this->sortSectionsItems();
     152
     153    $blocks['menu']->data=Array();
     154    $blocks['special']->data=Array();
     155
     156    foreach($this->my_config['amm_sections_items'] as $key => $val)
     157    {
     158      if(isset($menuItems[$key]))
     159      {
     160        $blocks[$val['container']]->data[$key]=$menuItems[$key];
     161      }
     162    }
     163    if(count($blocks['menu']->data)==0) $menu->hide_block('mbMenu');
     164    if(count($blocks['special']->data)==0) $menu->hide_block('mbSpecials');
     165  }
    155166
    156167  /*
     
    236247    global $user, $template;
    237248
    238     $menu = new BlockManager("menubar");
    239     $menu->load_registered_blocks();
    240     $menu->prepare_display();
    241 
    242     if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) )
     249    if($this->displayRandomImageBlock)
    243250    {
    244251      $local_tpl = new Template(AMM_PATH."admin/", "");
Note: See TracChangeset for help on using the changeset viewer.