| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php defined('BX_DOL') or die('hack attempt');
- /**
- * Copyright (c) UNA, Inc - https://una.io
- * MIT License - https://opensource.org/licenses/MIT
- *
- * @defgroup UnaBaseView UNA Base Representation Classes
- * @{
- */
- /**
- * Menu representation.
- * @see BxDolMenu
- */
- class BxBaseMenuAccountNotifications extends BxTemplMenu
- {
- public function __construct ($aObject, $oTemplate)
- {
- parent::__construct ($aObject, $oTemplate);
- $this->addMarkers(array(
- 'studio_url' => BX_DOL_URL_STUDIO
- ));
- }
- protected function getMenuItemsRaw ()
- {
- $aItems = $this->_oQuery->getMenuItemsBy(array(
- 'type' => 'set_name',
- 'set_name' => $this->_aObject['set_name']
- ));
- $aDuplicates = $this->_oQuery->getMenuItemsBy(array(
- 'type' => 'set_name_duplicates',
- 'set_name' => $this->_aObject['set_name']
- ));
- $oProfile = BxDolProfile::getInstance();
- if(!$oProfile)
- return array();
- $sModule = $oProfile->getModule();
- $aResult = array();
- foreach($aItems as $aItem) {
- if(in_array($aItem['name'], $aDuplicates) && $aItem['module'] != $sModule)
- continue;
-
- $aResult[$aItem['name']] = $aItem;
- }
- return $aResult;
- }
- /**
- * Check if menu items is visible with extended checking for friends notifications
- * @param $a menu item array
- * @return boolean
- */
- protected function _isVisible ($a)
- {
- if(!parent::_isVisible($a))
- return false;
- switch ($a['name']) {
- case 'studio':
- if (!isAdmin())
- return false;
- break;
- case 'cart':
- $oPayments = BxDolPayments::getInstance();
- if(!$oPayments->isActive())
- return false;
- break;
- case 'orders':
- $oPayments = BxDolPayments::getInstance();
- if(!$oPayments->isActive())
- return false;
- break;
- }
- return true;
- }
- protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
- {
- return array(
- 'addon' => $mixedAddon,
- 'addonf' => $this->_oTemplate->parseHtmlByTemplateName('menu_item_addon', array(
- 'content' => $mixedAddon
- ))
-
- );
- }
- }
- /** @} */
|