1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : Advanced Menu Manager |
---|
4 | Author : Grum |
---|
5 | email : grum@grum.dnsalias.com |
---|
6 | website : http://photos.grum.dnsalias.com |
---|
7 | PWG user : http://forum.phpwebgallery.net/profile.php?id=3706 |
---|
8 | |
---|
9 | << May the Little SpaceFrog be with you ! >> |
---|
10 | ------------------------------------------------------------------------------ |
---|
11 | See main.inc.php for release information |
---|
12 | |
---|
13 | PIP classe => manage integration in public interface |
---|
14 | |
---|
15 | --------------------------------------------------------------------------- */ |
---|
16 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
17 | |
---|
18 | include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php'); |
---|
19 | |
---|
20 | class AMM_PIP extends AMM_root |
---|
21 | { |
---|
22 | function AMM_PIP($prefixeTable, $filelocation) |
---|
23 | { |
---|
24 | parent::__construct($prefixeTable, $filelocation); |
---|
25 | |
---|
26 | $this->load_config(); |
---|
27 | $this->init_events(); |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | /* --------------------------------------------------------------------------- |
---|
32 | Public classe functions |
---|
33 | --------------------------------------------------------------------------- */ |
---|
34 | |
---|
35 | |
---|
36 | /* |
---|
37 | initialize events call for the plugin |
---|
38 | */ |
---|
39 | public function init_events() |
---|
40 | { |
---|
41 | add_event_handler('loc_begin_menubar', array(&$this, 'modify_menu') ); |
---|
42 | } |
---|
43 | |
---|
44 | /* --------------------------------------------------------------------------- |
---|
45 | protected classe functions |
---|
46 | --------------------------------------------------------------------------- */ |
---|
47 | public function modify_menu() |
---|
48 | { |
---|
49 | global $menu, $user; |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | /* |
---|
54 | Add a new section (links) |
---|
55 | */ |
---|
56 | $urls=$this->get_urls(true); |
---|
57 | if(($this->my_config['amm_links_active']=='y')and(count($urls)>0)) |
---|
58 | { |
---|
59 | if($this->my_config['amm_links_show_icons']=='y') |
---|
60 | { |
---|
61 | for($i=0;$i<count($urls);$i++) |
---|
62 | { |
---|
63 | $urls[$i]['icon']=AMM_PATH."links_pictures/".$urls[$i]['icon']; |
---|
64 | } |
---|
65 | } |
---|
66 | |
---|
67 | $section = new Section('mbAMM_links', base64_decode($this->my_config['amm_links_title'][$user['language']]), dirname(__FILE__).'/menu_templates/menubar_links.tpl'); |
---|
68 | $section->set_items(array( |
---|
69 | 'LINKS' => $urls, |
---|
70 | 'icons' => 'y' |
---|
71 | )); |
---|
72 | $menu->add($section->get()); |
---|
73 | } |
---|
74 | |
---|
75 | /* |
---|
76 | Hide sections |
---|
77 | */ |
---|
78 | foreach($this->my_config['amm_sections_visible'] as $key => $val) |
---|
79 | { |
---|
80 | if($val=='n') |
---|
81 | { |
---|
82 | $menu->remove($key); |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | } // AMM_PIP class |
---|
90 | |
---|
91 | |
---|
92 | ?> |
---|