本文整理汇总了PHP中BxDolMenu类的典型用法代码示例。如果您正苦于以下问题:PHP BxDolMenu类的具体用法?PHP BxDolMenu怎么用?PHP BxDolMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxDolMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$this->sModule = 'bx_notifications';
bx_import('BxDolMenu');
BxDolMenu::getObjectInstance('sys_account_dashboard_submenu')->setSelected($this->sModule, 'account-dashboard-notifications');
}
示例2: getCode
public function getCode()
{
// check if content exists
if (!$this->_aContentInfo) {
// if entry is not found - display standard "404 page not found" page
$this->_oTemplate->displayPageNotFound();
exit;
}
// permissions check
if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($this->_aContentInfo))) {
$this->_oTemplate->displayAccessDenied($sMsg);
exit;
}
$this->_oModule->checkAllowedView($this->_aContentInfo, true);
// count views
$CNF =& $this->_oModule->_oConfig->CNF;
if (!empty($CNF['OBJECT_VIEWS'])) {
BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $this->_aContentInfo[$CNF['FIELD_ID']])->doView();
}
// add content metatags
if (!empty($CNF['OBJECT_METATAGS'])) {
$o = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
if ($o) {
$o->metaAdd($this->_aContentInfo[$CNF['FIELD_ID']], $this->_getThumbForMetaObject());
}
}
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
// add actions menu to submenu
if (isset($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP'])) {
$oMenuSubmenu->setObjectActionsMenu($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP']);
}
// add social sharing menu to submenu
$oMenuSubmenu->setServiceSocialSharing(array('module' => $this->MODULE, 'method' => 'entity_social_sharing'));
return parent::getCode();
}
示例3: getCode
/**
* Get menu code.
* @return string
*/
public function getCode()
{
$aMenuItemSelected = $this->_getSelectedMenuItem();
if (isset($aMenuItemSelected['set_name']) && 'sys_site' == $aMenuItemSelected['set_name'] && 'home' == $aMenuItemSelected['name']) {
return '';
}
$this->_addJsCss();
$oMenuSubmenu = BxDolMenu::getObjectInstance($this->_sObjectSubmenu);
$aVars = array('object' => $this->_sObject, 'id' => 'bx-menu-submenu-menu', 'title' => $aMenuItemSelected['title'], 'link' => BxDolPermalinks::getInstance()->permalink($aMenuItemSelected['link']), 'popup' => $oMenuSubmenu ? BxTemplFunctions::getInstance()->transBox('bx-menu-submenu-menu', '<div class="bx-def-padding">' . $oMenuSubmenu->getCode() . '</div>', true) : '', 'bx_if:menu' => array('condition' => $oMenuSubmenu, 'content' => array()), 'bx_if:image' => array('condition' => false !== strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon_url' => $aMenuItemSelected['icon'])), 'bx_if:icon' => array('condition' => false === strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon' => $aMenuItemSelected['icon'])), 'bx_repeat:menus' => array());
$aMenus = $this->getSubmenuParams($aMenuItemSelected);
foreach ($aMenus as $aMenu) {
$sPopupContent = '';
if (isset($aMenu['object']) && ($oMenu = BxDolMenu::getObjectInstance($aMenu['object']))) {
$sPopupContent = $oMenu->getCode();
} elseif (isset($aMenu['service']) && is_array($aMenu['service'])) {
$sPopupContent = BxDolService::call($aMenu['service']['module'], $aMenu['service']['method'], isset($aMenu['service']['params']) ? $aMenu['service']['params'] : array(), isset($aMenu['service']['class']) ? $aMenu['service']['class'] : 'Module');
}
if (!$sPopupContent) {
continue;
}
$aVars['bx_repeat:menus'][] = array('id' => $aMenu['id'], 'icon' => $aMenu['icon'], 'popup' => BxTemplFunctions::getInstance()->transBox($aMenu['id'], '<div class="bx-def-padding">' . $sPopupContent . '</div>', true));
}
if (!$aVars['bx_repeat:menus'] && (!$oMenuSubmenu || !$aMenuItemSelected)) {
return '';
}
$sMenu = $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars);
return $this->_oTemplate->parseHtmlByName('menu_main_submenu_wrapper.html', array('menu' => $sMenu));
}
示例4: serviceManageTools
public function serviceManageTools($sType = 'common')
{
$oGrid = BxDolGrid::getObjectInstance($this->_oConfig->getGridObject($sType));
if (!$oGrid) {
return '';
}
$CNF =& $this->_oConfig->CNF;
$sMenu = '';
if (BxDolAcl::getInstance()->isMemberLevelInSet(192)) {
$oPermalink = BxDolPermalinks::getInstance();
$aMenuItems = array();
if (!empty($CNF['OBJECT_GRID_COMMON']) && !empty($CNF['T']['menu_item_manage_my'])) {
$aMenuItems[] = array('id' => 'manage-common', 'name' => 'manage-common', 'class' => '', 'link' => $oPermalink->permalink($CNF['URL_MANAGE_COMMON']), 'target' => '_self', 'title' => _t($CNF['T']['menu_item_manage_my']), 'active' => 1);
}
if (!empty($CNF['OBJECT_GRID_ADMINISTRATION']) && !empty($CNF['T']['menu_item_manage_all'])) {
$aMenuItems[] = array('id' => 'manage-administration', 'name' => 'manage-administration', 'class' => '', 'link' => $oPermalink->permalink($CNF['URL_MANAGE_ADMINISTRATION']), 'target' => '_self', 'title' => _t($CNF['T']['menu_item_manage_all']), 'active' => 1);
}
if (count($aMenuItems) > 1) {
$oMenu = new BxTemplMenu(array('template' => 'menu_vertical.html', 'menu_items' => $aMenuItems), $this->_oTemplate);
$oMenu->setSelected($this->_aModule['name'], 'manage-' . $sType);
$sMenu = $oMenu->getCode();
}
}
if (!empty($CNF['OBJECT_MENU_SUBMENU'])) {
BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU'])->setSelected($this->_aModule['name'], $CNF['URI_MANAGE_COMMON']);
}
$this->_oTemplate->addCss(array('manage_tools.css'));
$this->_oTemplate->addJs(array('manage_tools.js'));
$this->_oTemplate->addJsTranslation(array('_sys_grid_search'));
return array('content' => $this->_oTemplate->getJsCode('manage_tools', array('sObjNameGrid' => $this->_oConfig->getGridObject($sType))) . $oGrid->getCode(), 'menu' => $sMenu);
}
示例5: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
// get profile info
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
$this->_aProfileInfo = $this->_oProfile ? $this->_oProfile->getInfo() : false;
}
if (!$this->_aProfileInfo || !$this->_oProfile) {
return;
}
// select view profile submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if ($oMenuSubmenu) {
$oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array('title' => $this->_oProfile->getDisplayName(), 'link' => $this->_oProfile->getUrl(), 'icon' => $this->_oProfile->getIcon()));
}
// add replaceable markers
$this->addMarkers($this->_aProfileInfo);
// every profile field can be used as marker
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
// profile id field is also suported
$this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName()));
// profile display name is also suported
}
示例6: performActionSetAclLevel
public function performActionSetAclLevel()
{
$oMenu = BxDolMenu::getObjectInstance('sys_set_acl_level');
$aIds = bx_get('ids');
if (!$aIds || !is_array($aIds) || !$oMenu) {
$this->_echoResultJson(array());
return;
}
$aIdsResult = array();
foreach ($aIds as $iId) {
$aContentInfo = $this->_oModule->_oDb->getContentInfoById($iId);
if ($this->_oModule->checkAllowedSetMembership($aContentInfo) !== CHECK_ACTION_RESULT_ALLOWED) {
continue;
}
$aIdsResult[] = $this->_getProfileId($iId);
}
if (empty($aIdsResult)) {
$this->_echoResultJson(array());
return;
}
if (count($aIdsResult) == 1) {
$aIdsResult = $aIdsResult[0];
}
$sContent = $this->_oTemplate->parseHtmlByName('set_acl_popup.html', array('content' => $oMenu->getCode($aIdsResult)));
$sContent = BxTemplFunctions::getInstance()->transBox($this->_oModule->_oConfig->getName() . 'set_acl_level_popup', $sContent);
$this->_echoResultJson(array('popup' => $sContent), true);
}
示例7: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$this->_oModule = BxDolModule::getInstance($this->MODULE);
// select module submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSubmenu->setObjectSubmenu($this->_oModule->_oConfig->CNF['OBJECT_MENU_SUBMENU']);
}
示例8: _getTemplateVars
protected function _getTemplateVars()
{
$aVars = parent::_getTemplateVars();
$aVars['bx_repeat:menu_items'] = array(true);
$aVars['profile_display_name'] = BxDolProfile::getInstance()->getDisplayName();
$aVars['url_switch_profile'] = BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher');
$aVars['menu_account'] = BxDolMenu::getObjectInstance('sys_account')->getCode();
$aVars['menu_notifications'] = BxDolMenu::getObjectInstance('sys_account_notifications')->getCode();
return $aVars;
}
示例9: __construct
public function __construct($aObject, $oTemplate = false)
{
parent::__construct($aObject, $oTemplate);
$CNF =& $this->_oModule->_oConfig->CNF;
$aInformers = array();
// get profile info
$iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
$iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
if ($iProfileId) {
$this->_oProfile = BxDolProfile::getInstance($iProfileId);
}
if (!$this->_oProfile && $iContentId) {
$this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->MODULE);
}
if ($this->_oProfile) {
$this->_aProfileInfo = $this->_oProfile->getInfo();
$this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
}
if (!$this->_aContentInfo || !$this->_oProfile) {
return;
}
// select view profile submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
$oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $this->_oProfile->getDisplayName(), 'link' => $this->_oProfile->getUrl(), 'icon' => $CNF['ICON']));
// add replaceable markers
$this->addMarkers($this->_aProfileInfo);
// every content field can be used as marker
$this->addMarkers(array('profile_id' => $this->_oProfile->id()));
// profile id field
$this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName()));
// profile display name
$this->addMarkers(array('profile_link' => $this->_oProfile->getUrl()));
// profile link
// display message if profile isn't active
if (bx_get_logged_profile_id() == $this->_oProfile->id() && !empty($CNF['INFORMERS']['status'])) {
$sStatus = $this->_aContentInfo['profile_status'];
if (isset($CNF['INFORMERS']['status']['map'][$sStatus])) {
$aInformers[] = array('name' => $CNF['INFORMERS']['status']['name'], 'msg' => _t($CNF['INFORMERS']['status']['map'][$sStatus]), 'type' => BX_INFORMER_ALERT);
}
}
// display message if it is possible to switch to this profile
$oProfile = $this->_aContentInfo ? BxDolProfile::getInstanceByContentTypeAccount($this->_aContentInfo['id'], $this->MODULE) : false;
if ($oProfile) {
$oProfile->checkSwitchToProfile($this->_oTemplate);
}
// add informers
if ($aInformers) {
$oInformer = BxDolInformer::getInstance($this->_oTemplate);
if ($oInformer) {
foreach ($aInformers as $a) {
$oInformer->add($a['name'], $this->_replaceMarkers($a['msg']), $a['type']);
}
}
}
}
示例10: __construct
public function __construct($aObject, $oTemplate)
{
parent::__construct($aObject, $oTemplate);
// set dashboard submenu
bx_import('BxDolMenu');
bx_import('BxDolPermalinks');
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if ($oMenuSubmenu) {
$oMenuSubmenu->setObjectSubmenu('sys_account_dashboard_submenu', array('title' => _t('_sys_menu_item_title_account_dashboard'), 'link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=dashboard'), 'icon' => ''));
}
}
示例11: PageCompMainCode
/**
* page code function
*/
function PageCompMainCode()
{
ob_start();
$oMenu = BxDolMenu::getObjectInstance('samples');
// it automatically creates instance of default or custom class by object name
if ($oMenu) {
echo $oMenu->getCode();
}
// print menu object
return DesignBoxContent("Sample menu", ob_get_clean(), BX_DB_PADDING_DEF);
}
示例12: _getActionSettings
protected function _getActionSettings($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
{
$sJsObject = $this->_oModule->_oConfig->getJsObject('manage_tools');
$sMenuName = $this->_oModule->_oConfig->CNF['OBJECT_MENU_MANAGE_TOOLS'];
bx_import('BxDolMenu');
$sMenu = BxDolMenu::getObjectInstance($sMenuName)->getCode();
if (empty($sMenu)) {
return '';
}
$a['attr'] = array_merge($a['attr'], array("bx-popup-id" => $sMenuName . "-" . $aRow['id'], "onclick" => "\$(this).off('click'); " . $sJsObject . ".onClickSettings('" . $sMenuName . "', this);"));
return $this->_getActionDefault($sType, $sKey, $a, $isSmall, $isDisabled, $aRow);
}
示例13: setSubmenu
public function setSubmenu($sSelected)
{
$oSubmenuSystem = BxDolMenu::getObjectInstance('sys_site_submenu');
if (!$oSubmenuSystem) {
return;
}
$CNF =& $this->_oConfig->CNF;
$oSubmenuSystem->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU'], array('title' => _t('_bx_ntfs'), 'link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($CNF['URL_HOME']), 'icon' => ''));
$oSubmenuModule = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU']);
if ($oSubmenuModule) {
$oSubmenuModule->setSelected($this->_oConfig->getName(), $sSelected);
}
}
示例14: BxBaseMenu
function BxBaseMenu()
{
BxDolMenu::BxDolMenu();
$this->iElementsCntInLine = (int) getParam('nav_menu_elements_on_line_' . (isLogged() ? 'usr' : 'gst'));
$this->sSiteUrl = BX_DOL_URL_ROOT;
$this->iJumpedMenuID = 0;
$this->sCustomSubIconUrl = '';
$this->sCustomSubHeader = '';
$this->sCustomActions = '';
$this->sBreadCrumb = '';
$this->bDebugMode = false;
$this->sWidth = $GLOBALS['oSysTemplate']->getPageWidth();
}
示例15: setModuleSubmenu
public function setModuleSubmenu($iCurrentFolderId = 0)
{
$CNF =& $this->_oConfig->CNF;
$aMapFolderId2MenuName = array(BX_CNV_FOLDER_INBOX => 'convos-folder-inbox', BX_CNV_FOLDER_DRAFTS => 'convos-drafts', BX_CNV_FOLDER_SPAM => 'convos-spam', BX_CNV_FOLDER_TRASH => 'convos-trash');
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if (!$oMenuSubmenu) {
return;
}
$oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU'], array('title' => _t('_bx_cnv'), 'link' => BX_DOL_URL_ROOT . $CNF['URL_HOME'], 'icon' => ''));
$oMenuModule = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU']);
if ($oMenuModule && isset($aMapFolderId2MenuName[$iCurrentFolderId])) {
$oMenuModule->setSelected($this->_aModule['name'], $aMapFolderId2MenuName[$iCurrentFolderId]);
}
}