Improve List users Annoucements CT#758

skala
Carlos Vargas 15 years ago
parent 2e31b79265
commit f19495f174
  1. 4
      main/announcements/announcements.inc.php
  2. 12
      main/inc/lib/course.lib.php

@ -306,7 +306,7 @@ function get_course_users()
//$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id());
$session_id = api_get_session_id();
if ($session_id) {
if ($session_id != 0) {
$user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $session_id);
} else {
$user_list = CourseManager::get_real_and_linked_user_list(api_get_course_id(), false, 0);
@ -323,7 +323,7 @@ function get_course_groups()
{
$session_id = api_get_session_id();
if ($session_id) {
if ($session_id != 0) {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), intval($session_id));
} else {
$new_group_list = CourseManager::get_group_list_of_course(api_get_course_id(), 0);

@ -1186,14 +1186,18 @@ class CourseManager {
$database_name = $course_info['db_name'];
$group_list = array();
$result = Database::query("SELECT g.id, g.name, COUNT(gu.id) userNb
$session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0';
$sql="SELECT g.id, g.name, COUNT(gu.id) userNb
FROM ".Database::get_course_table(TABLE_GROUP, $database_name)." AS g
LEFT JOIN ".Database::get_course_table(TABLE_GROUP_USER, $database_name)." gu
ON g.id = gu.group_id
WHERE g.session_id IN(0,".intval($session_id).")
$session_condition
GROUP BY g.id
ORDER BY g.name");
ORDER BY g.name";
//var_dump($sql);
//exit();
$result = Database::query($sql);
while ($group_data = Database::fetch_array($result)) {
$group_list[$group_data['id']] = $group_data;

Loading…
Cancel
Save