Просмотр исходного кода

#43 - special visibility checking for friend requests notifications

Alex Trofimov 12 лет назад
Родитель
Сommit
fa7b27b5dd
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      template/scripts/BxBaseMenuAccountNotifications.php

+ 23 - 0
template/scripts/BxBaseMenuAccountNotifications.php

@@ -19,6 +19,29 @@ class BxBaseMenuAccountNotifications extends BxTemplMenu
     {
     {
         parent::__construct ($aObject, $oTemplate);
         parent::__construct ($aObject, $oTemplate);
     }
     }
+
+    /**
+     * Check if menu items is visible with extended checking for friends notifications
+     * @param $a menu item array
+     * @return boolean
+     */ 
+    protected function _isVisible ($a) 
+    {
+        // default visible settings
+        bx_import('BxDolAcl');
+        if (!BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']))
+            return false;
+
+        // show only friends for currently active profile for friend request notification
+        if ('notifications-friend-requests' == $a['name']) {
+            $oProfile = BxDolProfile::getInstance();
+            $aInfo = $oProfile->getInfo();
+            if ($a['module'] != $aInfo['type'])
+                return false;
+        }
+
+        return true;
+    }
 }
 }
 
 
 /** @} */
 /** @} */