Fixing group member subscriptions.

1.9.x
Julio Montoya 11 years ago
parent 0503684637
commit 2cd592d727
  1. 10
      main/group/member_settings.php
  2. 1
      main/group/tutor_settings.php
  3. 16
      main/inc/lib/groupmanager.lib.php

@ -117,13 +117,9 @@ $form->addElement('hidden', 'action');
$form->addElement('hidden', 'max_student', $current_group['max_student']);
$complete_user_list = GroupManager::fill_groups_list($current_group['id']);
usort($complete_user_list, 'sort_users');
$possible_users = array();
foreach ($complete_user_list as $index => $user) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
}
// Group members
$group_member_list = GroupManager :: get_subscribed_users($current_group['id']);
$group_member_list = GroupManager::get_subscribed_users($current_group['id']);
$selected_users = array ();
foreach ($group_member_list as $index => $user) {
@ -133,9 +129,7 @@ foreach ($group_member_list as $index => $user) {
// possible : number_groups_left > 0 and is group member
$possible_users = array();
foreach ($complete_user_list as $index => $user) {
if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) {
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
}
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
}
$group_members_element = $form->addElement('advmultiselect', 'group_members', get_lang('GroupMembers'), $possible_users, 'style="width: 280px;"');

@ -104,7 +104,6 @@ $form->addElement('hidden', 'action');
// Group tutors
$group_tutor_list = GroupManager :: get_subscribed_tutors($current_group['id']);
$selected_users = array();
$selected_tutors = array();
foreach ($group_tutor_list as $index => $user) {
$selected_tutors[] = $user['user_id'];

@ -1347,19 +1347,21 @@ class GroupManager
$course_id = api_get_course_int_id();
$sql = "SELECT ug.id, u.user_id, u.lastname, u.firstname, u.email, u.username
FROM $table_user u INNER JOIN $table_group_user ug ON (ug.user_id = u.user_id)
FROM $table_user u INNER JOIN $table_group_user ug
ON (ug.user_id = u.user_id)
WHERE ug.c_id = $course_id AND
ug.group_id = $group_id
$order_clause";
$db_result = Database::query($sql);
$users = array();
while ($user = Database::fetch_object($db_result)) {
$member['user_id'] = $user->user_id;
$member['firstname'] = $user->firstname;
$member['lastname'] = $user->lastname;
$member['email'] = $user->email;
$member['username'] = $user->username;
$users[$member['user_id']] = $member;
$users[$user->user_id] = array(
'user_id' => $user->user_id,
'firstname' => $user->firstname,
'lastname' => $user->lastname,
'email' => $user->email,
'username' => $user->username
);
}
return $users;
}

Loading…
Cancel
Save