source: trunk/plugins/AMenuManager/amm_pip.class.inc.php @ 2467

Last change on this file since 2467 was 2466, checked in by grum, 16 years ago

Asked by rvelices on this topic
http://forum.phpwebgallery.net/viewtopic.php?pid=92097#p92097

A plugin to integrate the menu class

see test_menu directory

A plugin to show how to use the menu class

see AMenuManager directory

And common classes needed for the AMenuManager plugin

see grum_plugins_classes-2 directory

See topic http://forum.phpwebgallery.net/viewtopic.php?pid=92637#p92637 for more
informations

File size: 2.4 KB
Line 
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  --------------------------------------------------------------------------- */
16if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
17
18include_once(PHPWG_PLUGINS_PATH.'AMenuManager/amm_root.class.inc.php');
19
20class 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?>
Note: See TracBrowser for help on using the repository browser.