Adding missing function (due recent merge of social group into social class) + using api_get_user_language() instead of a $_SESSION variable

skala
Julio Montoya 12 years ago
parent d9e1759718
commit cae3b1e818
  1. 2
      main/admin/system_announcements.php
  2. 21
      main/inc/lib/usergroup.lib.php

@ -33,7 +33,7 @@ $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAd
$tool_name = null;
if (empty($_GET['lang'])) {
$_GET['lang'] = $_SESSION['user_language_choice'];
$_GET['lang'] = api_get_user_language();
}
$usergroup = new UserGroup();

@ -1514,4 +1514,25 @@ class UserGroup extends Model
public function getAllowedPictureExtensions() {
return $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
}
/**
* Gets a list of all group
* @param id of a group not to include (i.e. to exclude)
* @return array : id => name
**/
public static function get_groups_list($without_this_one = NULL ) {
$where='';
if ( isset($without_this_one) && (intval($without_this_one) == $without_this_one) ) {
$where = "WHERE id <> $without_this_one";
}
$table = Database :: get_main_table(TABLE_USERGROUP);
$sql = "SELECT id, name FROM $table $where order by name";
$res = Database::query($sql);
$list = array ();
while ($item = Database::fetch_assoc($res)) {
$list[$item['id']] = $item['name'];
}
return $list;
}
}
Loading…
Cancel
Save