diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-08-28 00:32:39 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-08-28 00:32:39 +0000 |
commit | abb2f22b2e96a89a44ad9d36db3bf612c6f88b9f (patch) | |
tree | ca36d7b1bd7035f9952c4f564406eaa87c954cdb /plugins/AMenuManager/amm_root.class.inc.php | |
parent | 7f956e71b91f32ff6ca87ea6a0f56cc0f02c7005 (diff) |
- based on test_menu by grum (thanks to you) - integration of dynamic menu bar to pwg
- the menubar is composed now of dynamic blocks that can be ordered/hidden
- plugins can add their own blocks
git-svn-id: http://piwigo.org/svn/trunk@2488 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/AMenuManager/amm_root.class.inc.php')
-rw-r--r-- | plugins/AMenuManager/amm_root.class.inc.php | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/plugins/AMenuManager/amm_root.class.inc.php b/plugins/AMenuManager/amm_root.class.inc.php index 2dfa604e0..38440a2d0 100644 --- a/plugins/AMenuManager/amm_root.class.inc.php +++ b/plugins/AMenuManager/amm_root.class.inc.php @@ -37,33 +37,28 @@ class AMM_root extends common_plugin /* this function initialize var $my_config with default values */ public function init_config() { - global $menu; - $this->my_config=array( 'amm_links_show_icons' => 'y', - 'amm_links_active' => 'y', 'amm_links_title' => array(), - 'amm_sections_visible' => array(), - 'amm_randompicture_active' => 'n', 'amm_randompicture_showname' => 'n', //n:no, o:over, u:under 'amm_randompicture_showcomment' => 'n', //n:no, o:over, u:under 'amm_randompicture_title' => array(), - 'amm_sections_modspecial' => array( - 'favorite_cat' => 'y', - 'most_visited_cat' => 'y', - 'best_rated_cat' => 'y', - 'random_cat' => 'y', - 'recent_pics_cat' => 'y', - 'recent_cats_cat' => 'y', + 'amm_sections_modspecials' => array( + 'favorites' => 'y', + 'most_visited' => 'y', + 'best_rated' => 'y', + 'random' => 'y', + 'recent_pics' => 'y', + 'recent_cats' => 'y', 'calendar' => 'y' ), 'amm_sections_modmenu' => array( 'qsearch' => 'y', - 'Tags' => 'y', - 'Search' => 'y', + 'tags' => 'y', + 'search' => 'y', 'comments' => 'y', - 'About' => 'y', - 'Notification' => 'y' + 'about' => 'y', + 'notification' => 'y' ) ); @@ -82,28 +77,39 @@ class AMM_root extends common_plugin } } - $sections=$menu->registered(); - foreach($sections as $key => $val) - { - $this->my_config['amm_sections_visible'][$key]='y'; - } } public function load_config() { - global $menu; - parent::load_config(); + } - $sections=$menu->registered(); - foreach($sections as $key => $val) + public function init_events() + { + add_event_handler('blockmanager_register_blocks', array(&$this, 'register_blocks') ); + } + + public function register_blocks( $menu_ref_arr ) + { + $menu = & $menu_ref_arr[0]; + if ($menu->get_id() != 'menubar') + return; + $menu->register_block( new RegisteredBlock( 'mbAMM_randompict', 'Random pictures', 'AMM')); + $menu->register_block( new RegisteredBlock( 'mbAMM_links', 'Links', 'AMM')); + + $sections=$this->get_sections(true); + if(count($sections)) { - if(!isset($this->my_config['amm_sections_visible'][$key])) + $id_done=array(); + foreach($sections as $key => $val) { - $this->my_config['amm_sections_visible'][$key]='y'; + if(!isset($id_done[$val['id']])) + { + $menu->register_block( new RegisteredBlock( 'mbAMM_personalised'.$val['id'], $val['title'], 'AMM')); + $id_done[$val['id']]=""; + } } } - } // return an array of urls (each url is an array) |