cMenu
Implements the standard Bootstrap Menu. It also allows to bind to tabbed forms.
The menu follows the Bootstrap rules, like left / right menu items, collapsible. If you use the RBA (user access) module then the menu items are automatically controlled by this module.
The bootstrap menu consists of a basic navigator using a logo (brandLogo, optional) and title (brandTitle, optional). In general this is used to navigate to the homepage of the application (brandLink, optional). Then there are two menu locations, left and right, which are different properties in the component (menuItemsLeft and menuItemsRight). If you write code, you have access to these properties, but it is advised to use the exported methods to maintain the menu item. Due to the event structure of PHsPeed, you need to be aware of the state your program is in. The supplied methods takes care of that.
The functions to manipulate the menu items are based upon the menu id. It does not matter if they are in the left- or right menu list. Therefore keep the id's of each menu element unique. One way is to sequence the menuitems left starting with 1 and right starting with 10, depending on the amount of elements.
The collapse class will decide when the menu will collapse and show the condensed icon the you are familiar with on mobile devices.
Properties
|
Description |
Barheight |
Heigth of the menu bar |
Brand |
Title |
Brandlogo |
Image |
BrandLogoLink |
Link to a phspeed module (i.e. the main form) |
CollapseClass |
Device context where the menu will collapse |
Margin |
|
MenuBGColor |
Bootstrap background color |
MenuColor |
Bootstrap foreground color |
MenuitemsLeft |
Menu items that are left positioned |
MenuItemsRight |
Menu items that are right alligned |
Padding |
|
PHP Events
|
Description |
onMenuClick |
Triggers when the user clicks on a menu item |
JavaScript events
|
Description |
onChange |
|
Methods
|
Description |
public function addMenuItem($id, $caption, $url, $parm, $sub, $active, $level, $pos, $cid, $icon) |
adds a menu item to the end of the menu on the given level |
public function alterMenuItem($id, $caption, $url, $parm, $active, $cid, $icon) |
alters the properties of the selected menu item |
public function delAllmenuItems() |
clears all menu items |
public function delMenuItem($id) |
deletes the selected menu item |
public function findMenuItem($id) |
returns the menu item of the given id |
public function hasAccessTo($url) |
verifies the access rights to the url. This controls the accessibility/visibilty of the menu item. |
public function insertMenuItem($id, $caption, $url, $parm, $sub, $active, $level, $pos, $cid, $icon, $after) |
inserts a menu item after the given id |
Examples and remarks
|
Description |
|
|
id |
unique identifier of the menu item |
caption |
the text of the menu item |
url |
the url to call when the item is being clicked |
parm |
the parameters that are send with the url |
sub |
top level ('N') or sub level ('Y') |
active |
the element is active ('Y') or inactive ('N') |
level |
top level or sub level sequence |
pos |
L for left menu, R for right menu |
cid |
additional id (not used) |
icon |
icon to show in the menu item (depending on Bootstrap version) |
after |
id of the element where an append should take place. |
|
|
Samples |
// add a menu item at the end of the list on the given level
|