コード例 #1
0
ファイル: imc.php プロジェクト: viru48/imc
 public static function getCategoriesByUserGroups($user = null)
 {
     if ($user == null) {
         $user = JFactory::getUser();
     }
     self::$catIds = array();
     ImcHelper::getCategoriesUserGroups();
     //populates self::catIds
     $categories = self::$catIds;
     $usergroups = JAccess::getGroupsByUser($user->id);
     $allowed_catIds = array();
     foreach ($categories as $category) {
         foreach ($category['usergroups'] as $groupid) {
             if (in_array($groupid, $usergroups)) {
                 array_push($allowed_catIds, $category['catid']);
             }
         }
     }
     return $allowed_catIds;
 }