UNA
Loading...
Searching...
No Matches
BxDolMenu Class Reference
Inheritance diagram for BxDolMenu:
BxDolFactory iBxDolFactoryObject iBxDolReplaceable BxBaseMenu BxDolStudioMenu BxTemplMenu BxTemplMenu BxTemplMenu BxBaseStudioMenu BxBaseMenuAccountDashboard BxBaseMenuAccountNotifications BxBaseMenuAddRelation BxBaseMenuDashboardManageTools BxBaseMenuFooter BxBaseMenuHomepage BxBaseMenuInteractive BxBaseMenuManage BxBaseMenuMoreAuto BxBaseMenuPanel BxBaseMenuProfileAdd BxBaseMenuProfileFollowings BxBaseMenuSetAclLevel BxBaseMenuSetBadges BxBaseMenuSite BxBaseMenuSocialSharing BxBaseMenuSubmenu BxBaseMenuSubmenuWithAddons BxBaseMenuSwitchLanguage BxBaseMenuSwitchTemplate BxBaseMenuTagsCloud BxBaseMenuToolbar BxBaseMenuWiki BxBaseModGeneralMenuManageTools BxBaseModGeneralMenuView BxBaseModTextMenuAttachments BxBaseVoteReactionsMenuDo BxForumMenuCategories BxPaymentMenuSbsActions BxShopifyMenuSubmenu BxTemplMenuDropdownSite BxTemplMenuDropdownSite BxTemplMenuSidebarSite BxTemplMenuSite BxTimelineMenuFeeds BxTimelineMenuItemShare BxTimelineMenuPostAttachments BxBaseMenuAccountDashboard BxBaseMenuAccountNotifications BxBaseMenuAddRelation BxBaseMenuDashboardManageTools BxBaseMenuFooter BxBaseMenuHomepage BxBaseMenuInteractive BxBaseMenuManage BxBaseMenuMoreAuto BxBaseMenuPanel BxBaseMenuProfileAdd BxBaseMenuProfileFollowings BxBaseMenuSetAclLevel BxBaseMenuSetBadges BxBaseMenuSite BxBaseMenuSocialSharing BxBaseMenuSubmenu BxBaseMenuSubmenuWithAddons BxBaseMenuSwitchLanguage BxBaseMenuSwitchTemplate BxBaseMenuTagsCloud BxBaseMenuToolbar BxBaseMenuWiki BxBaseModGeneralMenuManageTools BxBaseModGeneralMenuView BxBaseModTextMenuAttachments BxBaseVoteReactionsMenuDo BxForumMenuCategories BxPaymentMenuSbsActions BxShopifyMenuSubmenu BxTemplMenuDropdownSite BxTemplMenuDropdownSite BxTemplMenuSidebarSite BxTemplMenuSite BxTimelineMenuFeeds BxTimelineMenuItemShare BxTimelineMenuPostAttachments BxBaseMenuAccountDashboard BxBaseMenuAccountNotifications BxBaseMenuAddRelation BxBaseMenuDashboardManageTools BxBaseMenuFooter BxBaseMenuHomepage BxBaseMenuInteractive BxBaseMenuManage BxBaseMenuMoreAuto BxBaseMenuPanel BxBaseMenuProfileAdd BxBaseMenuProfileFollowings BxBaseMenuSetAclLevel BxBaseMenuSetBadges BxBaseMenuSite BxBaseMenuSocialSharing BxBaseMenuSubmenu BxBaseMenuSubmenuWithAddons BxBaseMenuSwitchLanguage BxBaseMenuSwitchTemplate BxBaseMenuTagsCloud BxBaseMenuToolbar BxBaseMenuWiki BxBaseModGeneralMenuManageTools BxBaseModGeneralMenuView BxBaseModTextMenuAttachments BxBaseVoteReactionsMenuDo BxForumMenuCategories BxPaymentMenuSbsActions BxShopifyMenuSubmenu BxTemplMenuDropdownSite BxTemplMenuDropdownSite BxTemplMenuSidebarSite BxTemplMenuSite BxTimelineMenuFeeds BxTimelineMenuItemShare BxTimelineMenuPostAttachments

Public Member Functions

 isVisible ()
 
 getTemplateId ()
 
 getTemplateName ($sName='')
 
 setTemplateById ($iTemplateId)
 
 setSelected ($sModule, $sName)
 
 setDynamicMode ($bDynamicMode)
 
 getMarkers ()
 
 addMarkers ($a)
 
 removeMarker ($s)
 
 performActionSetCollapsed ($mixedValue)
 
 performActionSetCollapsedSubmenu ($sMenuItem, $mixedValue)
 
 getUserChoiceCollapsed ($sObject='')
 
 getUserChoiceCollapsedSubmenu ($mixedItem, $sObject='')
 

Static Public Member Functions

static getObjectInstance ($sObject, $oTemplate=false)
 
static setSelectedGlobal ($sModule, $sName)
 
static processMenuTrigger ($sMenuTriggerName)
 
- Static Public Member Functions inherited from iBxDolFactoryObject
static getObjectInstance ($sObject)
 

Protected Member Functions

 __construct ($aObject)
 
 _setCollapsed ($sName, $mixedValue)
 
 _isSelected ($a)
 
 _isActive ($a)
 
 _isVisible ($a)
 
 _getVisibilityClass ($a)
 
 _replaceMarkers ($a)
 

Protected Attributes

 $_bIsApi
 
 $_bHx
 
 $_bHxHead
 
 $_mHxPreload
 
 $_aHx
 
 $_bDynamicMode
 
 $_bAddNoFollow
 
 $_bSelModuleCheck
 
 $_sSelModule
 
 $_sSelName
 
 $_sObject
 
 $_aObject
 
 $_oQuery
 
 $_oPermalinks
 
 $_aMarkers = array()
 
 $_bMultilevel = false
 
 $_sSessionKeyCollapsed
 

Static Protected Attributes

static $SEL_MODULE = ''
 
static $SEL_NAME = ''
 

Detailed Description

Menus.

Menu uses some set of items and the template to display it, so it is possible to have several menus which uses the same set of items but different templates.

Menu is any set of some links or actions, for example menu can be links in site's footer or actions in profile view.

Creating the Menu object:

  1. Add record to 'sys_objects_menu' table:
  • object: name of the menu object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing; for example: bx_groups_actions - actions menu in group view.
  • title: name of the menu, displayed in the studio menu builder.
  • set_name: name of items' set.
  • module: the module this menu belongs to.
  • template_id: the template to use for menu displaying, this is id from 'sys_menu_templates' table.
  • deletable: it determines if menu can be deleted from the studio menu builder.
  • active: it is possible to disable particular menu, then it will not be displayed.
  • override_class_name: user defined class name which is derived from BxTemplMenu.
  • override_class_file: the location of the user defined class, leave it empty if class is located in system folders.

Menu templates are stored in 'sys_menu_templates' table:

  • id: template id.
  • template: template file.
  • title: template title to display in the studio menu builder. All menu templates iterate through 'bx_repeat:menu_items' and use the following template variables for each menu item: link, target, onclick, title, class_add.
  1. Add menu an empty menu set to 'sys_menu_sets' table (if you want to use new set of items for created menu):
  • set_name: the set name.
  • module: the module this set belongs to.
  • title: name of the set, displayed in studio menu builder.
  • deletable: it determines if the set can be deleted from menu builder.
  1. Add menu items to the set by adding records to 'sys_menu_items' table:
  • set_name: the set name this item belogs to.
  • module: the module this item belongs to.
  • name: name of the item (not displayed to the end user), unique in the particular set.
  • title: menu item title to display to the end user, please note that some templates can still display menu as icons without text titles.
  • link: menu item URL.
  • onclick: menu item onclick event.
  • target: menu item target.
  • icon: menu item icon, please note that some templates can still display menu as text without icons.
  • addon: display additional data near menu item, only for supported menu templates, this is serialized array of service call parameters: module - module name, method - service method name, params - array of parameters.
  • markers: service method to provide additional replacement markers, this is serialized array of service call parameters: module - module name, method - service method name, params - array of parameters.
  • visible_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example:
    • user level id = 1 -> 2^(1-1) = 1
    • user level id = 2 -> 2^(2-1) = 2
    • user level id = 3 -> 2^(3-1) = 4
    • user level id = 4 -> 2^(4-1) = 8
  • active: it is possible to disable particular menu item, then it will not be displayed.
  • order: menu item order in the particular set.
  1. Display Menu. Use the following sample code to display menu:
    $oMenu = BxTemplMenu::getObjectInstance('sample_menu'); // 'sample_menu' is 'object' field from 'sys_objects_menu' table.
    if ($oMenu)
    echo $oMenu->getCode; // display menu
    static getObjectInstance($sObject, $oTemplate=false)
    Definition BxDolMenu.php:157

But in most cases you don't need to use above code to display menu, menu objects are integrated into pages - there is special 'menu' page block type for it.

Constructor & Destructor Documentation

◆ __construct()

BxDolMenu::__construct ( $aObject)
protected

Constructor

Parameters
$aObjectarray of menu options

Member Function Documentation

◆ _isActive()

BxDolMenu::_isActive ( $a)
protected

Check if menu items is active.

Parameters
$amenu item array
Returns
boolean

◆ _isSelected()

BxDolMenu::_isSelected ( $a)
protected

Check if menu items is selected.

Parameters
$amenu item array
Returns
boolean

Reimplemented in BxBaseMenuDashboardReportsManage, BxBaseMenuSetBadges, and BxBaseStudioMenu.

◆ _isVisible()

◆ _replaceMarkers()

BxDolMenu::_replaceMarkers ( $a)
protected

Replace provided markers in menu item array, curently markers are replaced in title, link and onclick fields.

Parameters
$amenu item array
Returns
array where markes are replaced with real values

◆ addMarkers()

BxDolMenu::addMarkers ( $a)

Add replace markers.

Parameters
$aarray of markers as key => value
Returns
true on success or false on error

Implements iBxDolReplaceable.

Reimplemented in BxBaseMenuSocialSharing, and BxBaseModGeneralMenuViewActions.

◆ getMarkers()

BxDolMenu::getMarkers ( )

Get an arrey of replacable markers.

Returns
an array with markers

◆ getObjectInstance()

static BxDolMenu::getObjectInstance ( $sObject,
$oTemplate = false )
static

Get menu object instance by object name

Parameters
$sObjectobject name
Returns
object instance or false on error

Hooks:

'system', 'get_object' - hook to override menu object

  • $unit_name - equals system
  • $action - equals get_object
  • $object_id - not used
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:

◆ getTemplateName()

BxDolMenu::getTemplateName ( $sName = '')

Get template name with checking for custom template related to exactly this menu object.

Returns
string with template name.

◆ isVisible()

BxDolMenu::isVisible ( )

Check if the menu is visible. The menu is visible if at least one menu item is visible.

Returns
boolean

Reimplemented in BxBaseMenuManage, and BxBaseMenuSubmenu.

◆ processMenuTrigger()

static BxDolMenu::processMenuTrigger ( $sMenuTriggerName)
static

Process menu triggers. Menu triggers allow to automatically add menu items to modules with no different if dependant module was install before or after the module menu item belongs to. For example module "Notes" adds menu items to all profiles modules (Persons, Organizations, etc) with no difference if persons module was installed before or after "Notes" module was installed.

Parameters
$sMenuTriggerNametrigger name to process, usually specified in module installer class -
See also
BxBaseModGeneralInstaller
Returns
always true, always success

◆ removeMarker()

BxDolMenu::removeMarker ( $s)

Remove marker

Parameters
$smarker key

◆ setSelected()

BxDolMenu::setSelected ( $sModule,
$sName )

Set selected menu item for current menu object only.

Parameters
$sModulemenu item module to set as selected
$sNamemenu item name to set as selected

◆ setSelectedGlobal()

static BxDolMenu::setSelectedGlobal ( $sModule,
$sName )
static

Set selected menu item globally.

Parameters
$sModulemenu item module to set as selected
$sNamemenu item name to set as selected

The documentation for this class was generated from the following file: