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(); }
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); }
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); }
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 }
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'); }
/** * 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)); }
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']); }
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; }
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']); } } } }
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' => '')); } }
/** * 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); }
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); }
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); } }
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]); } }
public function serviceProfileNotifications($iProfileId = 0) { if (!$iProfileId) { $iProfileId = bx_get_logged_profile_id(); } bx_import('BxDolMenu'); $oMenu = BxDolMenu::getObjectInstance('sys_account_notifications'); $iNum = 0; $aMenuItems = $oMenu->getMenuItems(); foreach ($aMenuItems as $r) { if (isset($r['bx_if:addon']) && $r['bx_if:addon']['condition']) { $iNum += $r['bx_if:addon']['content']['addon']; } } return $iNum; }
public function __construct($aObject, $oTemplate = false) { parent::__construct($aObject, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; // select view entry submenu $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu'); $oMenuSumbemu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], $CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION']); $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if ($iContentId) { $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId); } if ($this->_aContentInfo) { $this->addMarkers($this->_aContentInfo); // every field can be used as marker $this->addMarkers(array('title' => strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...'))); } }
public function __construct($aObject, $oTemplate = false) { parent::__construct($aObject, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if ($iContentId) { $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId); } if ($this->_aContentInfo) { $sTitle = isset($this->_aContentInfo[$CNF['FIELD_TITLE']]) ? $this->_aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...'); $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aContentInfo[$CNF['FIELD_ID']]); $this->addMarkers($this->_aContentInfo); // every field can be used as marker $this->addMarkers(array('title' => $sTitle, 'entry_link' => $sUrl)); // select view entry submenu $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu'); $oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $sTitle, 'link' => $sUrl, 'icon' => $CNF['ICON'])); } }
public function __construct($aObject, $oTemplate) { parent::__construct($aObject, $oTemplate); bx_import('BxDolProfile'); $oProfile = BxDolProfile::getInstance(); $aProfileInfo = $oProfile ? $oProfile->getInfo() : false; $this->addMarkers(array('account_id' => $aProfileInfo ? $aProfileInfo['account_id'] : 0, 'profile_id' => $aProfileInfo ? $aProfileInfo['id'] : 0, 'profile_type' => $aProfileInfo ? $aProfileInfo['type'] : 0, 'profile_content_id' => $aProfileInfo ? $aProfileInfo['content_id'] : 0)); // set settings submenu bx_import('BxDolMenu'); $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu'); if ($oMenuSubmenu) { $oMenuSubmenu->setObjectSubmenu('sys_account_settings_submenu', array('title' => _t('_sys_menu_item_title_account_settings'), 'link' => BX_DOL_URL_ROOT . 'member.php', 'icon' => '')); } // display message if profile isn't active if ($oProfile) { $sStatus = $oProfile->getStatus(); if (isset($this->_aMapStatus2LangKey[$sStatus])) { bx_import('BxDolInformer'); $oInformer = BxDolInformer::getInstance($this->_oTemplate); if ($oInformer) { $oInformer->add('sys-account-status-not-active', _t($this->_aMapStatus2LangKey[$sStatus]), BX_INFORMER_ALERT); } } } // switch profile context if ($iSwitchToProfileId = (int) bx_get('switch_to_profile')) { bx_import('BxDolInformer'); $oInformer = BxDolInformer::getInstance($this->_oTemplate); $oProfile = BxDolProfile::getInstance($iSwitchToProfileId); $sInformerMsg = ''; if ($oProfile && $oProfile->getAccountId() == getLoggedId()) { bx_import('BxDolProfile'); $oAccount = BxDolAccount::getInstance(); if ($oAccount->updateProfileContext($iSwitchToProfileId)) { $sInformerMsg = _t('_sys_txt_account_profile_context_changed_success', $oProfile->getDisplayName()); } } if ($oInformer) { $oInformer->add('sys-account-profile-context-change-result', $sInformerMsg ? $sInformerMsg : _t('_error occured'), $sInformerMsg ? BX_INFORMER_INFO : BX_INFORMER_ERROR); } } }
/** * Get menu code. * @return string */ public function getCode() { $aMenuItemSelected = $this->_getSelectedMenuItem(); // if (!$aMenuItemSelected) // return false; if (!$this->_sObjectSubmenu && $aMenuItemSelected['submenu_object']) { $this->_sObjectSubmenu = $aMenuItemSelected['submenu_object']; } $oPermalinks = BxDolPermalinks::getInstance(); $aVars = array('object' => $this->_sObject, 'title' => $aMenuItemSelected['title'], 'link' => $oPermalinks->permalink($aMenuItemSelected['link']), 'icon' => $aMenuItemSelected['icon']); $this->_addJsCss(); $oSubmenu = null; if ($this->_sObjectSubmenu) { $oSubmenu = BxDolMenu::getObjectInstance($this->_sObjectSubmenu); } if (!$oSubmenu) { return ''; } $sMenu = $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars) . $oSubmenu->getCode(); $aVars = array('menu' => $sMenu); return $this->_oTemplate->parseHtmlByName('menu_main_submenu_wrapper.html', $aVars); }
/** * Get profile cover */ function cover($aData, $sTemplateName = 'cover.html') { $CNF =& $this->_oConfig->CNF; $oModule = BxDolModule::getInstance($this->MODULE); $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]); $sUrlPicture = $this->urlPicture($aData); $sUrlAvatar = $this->urlAvatar($aData); $sUrlPictureChange = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_EDIT_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]); $sUrlCover = $this->urlCover($aData); $sUrlCoverChange = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_EDIT_COVER'] . '&id=' . $aData[$CNF['FIELD_ID']]); $sCoverPopup = ''; $sCoverPopupId = $this->MODULE . '-popup-cover'; if ($aData[$CNF['FIELD_COVER']]) { $sCoverPopup = BxTemplFunctions::getInstance()->transBox($sCoverPopupId, $this->parseHtmlByName('image_popup.html', array('image_url' => $sUrlCover, 'bx_if:owner' => array('condition' => CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData), 'content' => array('change_image_url' => $sUrlCoverChange)))), true, true); } $sPicturePopup = ''; $sPicturePopupId = $this->MODULE . '-popup-picture'; if ($aData[$CNF['FIELD_PICTURE']]) { $sPicturePopup = BxTemplFunctions::getInstance()->transBox($sPicturePopupId, $this->parseHtmlByName('image_popup.html', array('image_url' => $sUrlPicture, 'bx_if:owner' => array('condition' => CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedEdit($aData), 'content' => array('change_image_url' => $sUrlPictureChange)))), true, true); } // generate html $aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => $aData[$CNF['FIELD_NAME']], 'menu' => BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_COVER'])->getCode(), 'picture_avatar_url' => $sUrlAvatar, 'picture_popup' => $sPicturePopup, 'picture_popup_id' => $sPicturePopupId, 'picture_url' => $sUrlPicture, 'picture_href' => !$aData[$CNF['FIELD_PICTURE']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedEdit($aData) ? $sUrlPictureChange : 'javascript:void(0);', 'cover_popup' => $sCoverPopup, 'cover_popup_id' => $sCoverPopupId, 'cover_url' => $sUrlCover, 'cover_href' => !$aData[$CNF['FIELD_COVER']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData) ? $sUrlCoverChange : 'javascript:void(0);'); return $this->parseHtmlByName($sTemplateName, $aVars); }
protected function _getActionsBox(&$aCmt, $aDp = array()) { $oTemplate = BxDolTemplate::getInstance(); $bViewOnly = isset($aDp['view_only']) && $aDp['view_only'] === true; $bMenuManage = false; $sMenuActions = $sMenuManage = ''; if (!$bViewOnly) { //--- Actions Menu $oMenuActions = BxDolMenu::getObjectInstance($this->_sMenuObjActions); $oMenuActions->setCmtsData($this, $aCmt['cmt_id']); $sMenuActions = $oMenuActions->getCode(); $oVote = $this->getVoteObject($aCmt['cmt_id']); if ($oVote !== false) { $sMenuActions .= $oVote->getJsScript(); } //--- Manage Menu $oMenuManage = BxDolMenu::getObjectInstance($this->_sMenuObjManage); $oMenuManage->setCmtsData($this, $aCmt['cmt_id']); $sMenuManage = $oMenuManage->getCode(); $bMenuManage = !empty($sMenuManage); if ($bMenuManage) { $sMenuManage = $oTemplate->parseHtmlByName('comment_manage.html', array('style_prefix' => $this->_sStylePrefix, 'content' => $sMenuManage)); $sMenuManage = BxTemplFunctions::getInstance()->transBox($this->_sSystem . '-manage-' . $aCmt['cmt_id'], $sMenuManage, true); } } return $oTemplate->parseHtmlByName('comment_actions.html', array('id' => $aCmt['cmt_id'], 'js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'menu_actions' => $sMenuActions, 'bx_if:show_menu_manage' => array('condition' => $bMenuManage, 'content' => array('js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'id' => $aCmt['cmt_id'], 'popup_text' => $sMenuManage)))); }
/** * Get menu. * @param $s menu object name * @return html or empty string */ function getMenu($s) { bx_import('BxDolMenu'); $oMenu = BxDolMenu::getObjectInstance($s); return $oMenu ? $oMenu->getCode() : ''; }
<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ * * @defgroup TridentCore Trident Core * @{ */ require_once './inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . "utils.inc.php"; bx_import('BxDolLanguages'); $sObject = bx_process_input(bx_get('o')); if (!$sObject) { exit; } $oMenu = BxDolMenu::getObjectInstance($sObject); if (!$oMenu) { exit; } header('Content-type: text/html; charset=utf-8'); echo $oMenu->getCode(); /** @} */
protected function _getTmplVarsMenuItemActions(&$aEvent, $aBrowseParams = array()) { $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_actions')); $oMenu->setEvent($aEvent); $oMenu->setDynamicMode(isset($aBrowseParams['dynamic_mode']) && $aBrowseParams['dynamic_mode'] === true); $sMenu = $oMenu->getCode(); if (empty($sMenu)) { return array(); } return array('style_prefix' => $this->_oConfig->getPrefix('style'), 'js_object' => $this->_oConfig->getJsObject('view'), 'menu_item_actions' => $sMenu); }
protected function _getTmplVarsMenuItemActions(&$aEvent) { bx_import('BxDolMenu'); $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_actions')); $oMenu->setEvent($aEvent); $sMenu = $oMenu->getCode(); if (empty($sMenu)) { return array(); } return array('style_prefix' => $this->_oConfig->getPrefix('style'), 'js_object' => $this->_oConfig->getJsObject('view'), 'menu_item_actions' => $sMenu); }
/** * Get menu. * @param $s menu object name * @return html or empty string */ function getMenu($s) { $oMenu = BxDolMenu::getObjectInstance($s); return $oMenu ? $oMenu->getCode() : ''; }
public function serviceAccountProfileSwitcher($iAccountId = false) { bx_import('BxDolProfileQuery'); $oProfilesQuery = BxDolProfileQuery::getInstance(); $aProfiles = $oProfilesQuery->getProfilesByAccount($iAccountId ? $iAccountId : getLoggedId()); if (!$aProfiles) { return false; } $iLoggedPofileId = bx_get_logged_profile_id(); $aVars = array('bx_repeat:row' => array()); foreach ($aProfiles as $aProfile) { if ($aProfile['type'] == 'system') { // skip system account profile continue; } $aVars['bx_repeat:row'][] = array('class' => $iLoggedPofileId == $aProfile['id'] ? '' : 'bx-def-color-bg-box', 'bx_if:active' => array('condition' => $iLoggedPofileId == $aProfile['id'], 'content' => array('id' => $aProfile['id'])), 'bx_if:inactive' => array('condition' => $iLoggedPofileId != $aProfile['id'], 'content' => array('id' => $aProfile['id'], 'url_switch' => BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher', array('switch_to_profile' => $aProfile['id'])))), 'unit' => BxDolService::call($aProfile['type'], 'profile_unit', array($aProfile['content_id']))); } if (!$aVars['bx_repeat:row']) { bx_import('BxDolMenu'); $oMenu = BxDolMenu::getObjectInstance('sys_add_profile'); return array('content' => $oMenu ? $oMenu->getCode() : MsgBox(_t('_sys_txt_empty')), 'menu' => 'sys_add_profile'); } bx_import('BxDolTemplate'); $oTemplate = BxDolTemplate::getInstance(); $oTemplate->addCss('account.css'); return array('content' => $oTemplate->parseHtmlByName('profile_switch_row.html', $aVars), 'menu' => 'sys_add_profile'); }
protected function _getActionsBox(&$aCmt, $aDp = array()) { $oTemplate = BxDolTemplate::getInstance(); //--- Actions Menu bx_import('BxDolMenu'); $oMenuActions = BxDolMenu::getObjectInstance($this->_sMenuObjActions); $oMenuActions->setCmtsData($this, $aCmt['cmt_id']); $sMenuActions = $oMenuActions->getCode(); $oVote = $this->getVoteObject($aCmt['cmt_id']); if ($oVote !== false) { $sMenuActions .= $oVote->getJsScript(); } //--- Manage Menu $oMenuManage = BxDolMenu::getObjectInstance($this->_sMenuObjManage); $oMenuManage->setCmtsData($this, $aCmt['cmt_id']); $sMenuManage = $oMenuManage->getCode(); $bMenuManage = !empty($sMenuManage); if ($bMenuManage) { $sMenuManage = $oTemplate->parseHtmlByName('comment_manage.html', array('style_prefix' => $this->_sStylePrefix, 'content' => $sMenuManage)); bx_import('BxTemplFunctions'); $sMenuManage = BxTemplFunctions::getInstance()->transBox($this->_sSystem . '-manage-' . $aCmt['cmt_id'], $sMenuManage, true); } $sAgo = bx_time_js($aCmt['cmt_time']); $bObjectTitle = !empty($this->_aSystem['trigger_field_title']); return $oTemplate->parseHtmlByName('comment_actions.html', array('id' => $aCmt['cmt_id'], 'js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'bx_if:show_ago_link' => array('condition' => $bObjectTitle, 'content' => array('style_prefix' => $this->_sStylePrefix, 'view_link' => bx_append_url_params($this->_sViewUrl, array('sys' => $this->_sSystem, 'id' => $this->_iId, 'cmt_id' => $aCmt['cmt_id'])), 'ago' => $sAgo)), 'bx_if:show_ago_text' => array('condition' => !$bObjectTitle, 'content' => array('ago' => $sAgo)), 'menu_actions' => $sMenuActions, 'bx_if:show_menu_manage' => array('condition' => $bMenuManage, 'content' => array('js_object' => $this->_sJsObjName, 'style_prefix' => $this->_sStylePrefix, 'id' => $aCmt['cmt_id'], 'popup_text' => $sMenuManage)))); }
public function getManageMenuObject() { return BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_manage'), $this->_oTemplate); }
public function getManageMenuObject($mixedEvent) { if (!is_array($mixedEvent)) { $mixedEvent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => (int) $mixedEvent)); } bx_import('BxDolMenu'); $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_manage')); $oMenu->setEvent($mixedEvent); return $oMenu; }