Example #1
0
 public static function multi($name, $selected = true, $allow_empty = true, $own_groups_only = true)
 {
     $user = GWF_User::getStaticOrGuest();
     if (false === ($groups = GDO::table('GWF_Group')->select('group_id, group_name'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($selected === true) {
         $selected = Common::getPostArray($name, array());
     }
     $data = array();
     if ($allow_empty) {
         $data[] = array('0', GWF_HTML::lang('sel_group'));
     }
     while (false !== ($group = GDO::table('GWF_Group')->fetch($groups, GDO::ARRAY_N))) {
         if ($own_groups_only && !$user->isInGroupName($group[1])) {
             continue;
         }
         $data[] = $group;
     }
     return GWF_Select::multi($name, $data, $selected);
 }