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_root.class.inc.php

    r3690 r4382  
    44  Author     : Grum
    55    email    : grum@grum.fr
    6     website  : http://photos.fr
     6    website  : http://photos.grum.fr
    77    PWG user : http://forum.piwigo.org/profile.php?id=3706
    88
     
    1111  See main.inc.php for release information
    1212
    13   AMM_root : root classe for plugin
     13  AMM_root : root class for plugin
    1414
    1515  --------------------------------------------------------------------------- */
     
    1919include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/common_plugin.class.inc.php');
    2020include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/css.class.inc.php');
     21
    2122
    2223class AMM_root extends common_plugin
    2324{
    2425  protected $css;   //the css object
     26  protected $defaultMenus = array(
     27    'favorites' => array('container' => 'special', 'visibility' => '', 'order' => 0, 'translation' => 'favorite_cat'),
     28    'most_visited' => array('container' => 'special', 'visibility' => '', 'order' => 1, 'translation' => 'most_visited_cat'),
     29    'best_rated' => array('container' => 'special', 'visibility' => '', 'order' => 2, 'translation' => 'best_rated_cat'),
     30    'random' => array('container' => 'special', 'visibility' => '', 'order' => 3, 'translation' => 'random_cat'),
     31    'recent_pics' => array('container' => 'special', 'visibility' => '', 'order' => 4, 'translation' => 'recent_pics_cat'),
     32    'recent_cats' => array('container' => 'special', 'visibility' => '', 'order' => 5, 'translation' => 'recent_cats_cat'),
     33    'calendar' => array('container' => 'special', 'visibility' => '', 'order' => 6, 'translation' => 'calendar'),
     34    'qsearch' => array('container' => 'menu', 'visibility' => '', 'order' => 0, 'translation' => 'qsearch'),
     35    'tags' => array('container' => 'menu', 'visibility' => '', 'order' => 1, 'translation' => 'Tags'),
     36    'search' => array('container' => 'menu', 'visibility' => '', 'order' => 2, 'translation' => 'Search'),
     37    'comments' => array('container' => 'menu', 'visibility' => '', 'order' => 3, 'translation' => 'comments'),
     38    'about' => array('container' => 'menu', 'visibility' => '', 'order' => 4, 'translation' => 'About'),
     39    'rss' => array('container' => 'menu', 'visibility' => '', 'order' => 5, 'translation' => 'Notification')
     40  );
    2541
    2642  function AMM_root($prefixeTable, $filelocation)
     
    4965      'amm_randompicture_height' => 0,           //0: automatic, otherwise it's the fixed height in pixels
    5066      'amm_randompicture_title' => array(),
    51       'amm_sections_modspecials' => array(
    52         'favorites' => 'y',
    53         'most_visited' => 'y',
    54         'best_rated' => 'y',
    55         'random' => 'y',
    56         'recent_pics' => 'y',
    57         'recent_cats' => 'y',
    58         'calendar' => 'y'
    59       ),
    60       'amm_sections_modmenu' => array(
    61         'qsearch' => 'y',
    62         'tags' => 'y',
    63         'search' => 'y',
    64         'comments' => 'y',
    65         'about' => 'y',
    66         'rss' => 'y'
    67       )
     67      'amm_sections_items' => $this->defaultMenus
    6868    );
    6969
     
    191191
    192192
     193  protected function sortSectionsItemsCompare($a, $b)
     194  {
     195    if($a['container']==$b['container'])
     196    {
     197      if($a['order']==$b['order']) return(0);
     198      return(($a['order']<$b['order'])?-1:1);
     199    }
     200    else return(($a['container']<$b['container'])?-1:1);
     201  }
     202
     203  protected function sortSectionsItems()
     204  {
     205    uasort($this->my_config['amm_sections_items'], array($this, "sortSectionsItemsCompare"));
     206  }
    193207
    194208} // amm_root  class
    195209
    196210
     211
    197212?>
Note: See TracChangeset for help on using the changeset viewer.