| @@ 1328-1340 (lines=13) @@ | ||
| 1325 | * @param int $group_id iid |
|
| 1326 | * @return int Maximum number of students in the given group. |
|
| 1327 | */ |
|
| 1328 | public static function maximum_number_of_students($group_id) |
|
| 1329 | { |
|
| 1330 | $table_group = Database :: get_course_table(TABLE_GROUP); |
|
| 1331 | $group_id = intval($group_id); |
|
| 1332 | $course_id = api_get_course_int_id(); |
|
| 1333 | $sql = "SELECT max_student FROM $table_group WHERE c_id = $course_id AND iid = $group_id"; |
|
| 1334 | $db_result = Database::query($sql); |
|
| 1335 | $db_object = Database::fetch_object($db_result); |
|
| 1336 | if ($db_object->max_student == 0) { |
|
| 1337 | return self::INFINITE; |
|
| 1338 | } |
|
| 1339 | return $db_object->max_student; |
|
| 1340 | } |
|
| 1341 | ||
| 1342 | /** |
|
| 1343 | * Number of groups of a user |
|
| @@ 47-62 (lines=16) @@ | ||
| 44 | * Get the total number of thematic inside current course and current session |
|
| 45 | * @see SortableTable#get_total_number_of_items() |
|
| 46 | */ |
|
| 47 | public function get_number_of_thematics() |
|
| 48 | { |
|
| 49 | $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
| 50 | $condition_session = ''; |
|
| 51 | if (!api_get_session_id()) { |
|
| 52 | $condition_session = api_get_session_condition(0); |
|
| 53 | } |
|
| 54 | $course_id = api_get_course_int_id(); |
|
| 55 | $sql = "SELECT COUNT(id) AS total_number_of_items |
|
| 56 | FROM $tbl_thematic |
|
| 57 | WHERE c_id = $course_id AND active = 1 $condition_session "; |
|
| 58 | $res = Database::query($sql); |
|
| 59 | $obj = Database::fetch_object($res); |
|
| 60 | ||
| 61 | return $obj->total_number_of_items; |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Get the thematics to display on the current page (fill the sortable-table) |
|