Esempio n. 1
0
 /**
  * Returns false if the current user is not allowed to see this item
  *
  * @return bool
  */
 public function isVisible()
 {
     $user = JFactory::getUser();
     $params = JComponentHelper::getParams('com_eventgallery');
     $minUserGroups = $params->get('eventgallery_default_usergroup');
     // if no user groups are set at all
     if (strlen($this->getUserGroupIds()) == 0 && count($minUserGroups) == 0) {
         return true;
     }
     // use the default usergroups if the folder does not define any
     if (strlen($this->getUserGroupIds()) == 0) {
         $folderUserGroups = $minUserGroups;
     } else {
         $folderUserGroups = explode(',', $this->getUserGroupIds());
     }
     // if the public user group is part of the folder user groups
     if (in_array(1, $folderUserGroups)) {
         return true;
     }
     $userUserGroups = $user->groups;
     foreach ($userUserGroups as $userUserGroup) {
         if (count(array_intersect(EventgalleryHelpersUsergroups::getGroupPath($userUserGroup), $folderUserGroups)) > 0) {
             return true;
         }
     }
     return false;
 }