| @@ 3621-3653 (lines=33) @@ | ||
| 3618 | * @param int $session_id |
|
| 3619 | * @return int |
|
| 3620 | */ |
|
| 3621 | public static function get_number_students_finish_exercise( |
|
| 3622 | $exercise_id, |
|
| 3623 | $course_code, |
|
| 3624 | $session_id |
|
| 3625 | ) { |
|
| 3626 | $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 3627 | $track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
| 3628 | ||
| 3629 | $exercise_id = intval($exercise_id); |
|
| 3630 | $course_code = Database::escape_string($course_code); |
|
| 3631 | $session_id = intval($session_id); |
|
| 3632 | ||
| 3633 | $sql = "SELECT DISTINCT exe_user_id |
|
| 3634 | FROM $track_exercises e |
|
| 3635 | INNER JOIN $track_attempt a |
|
| 3636 | ON (a.exe_id = e.exe_id) |
|
| 3637 | WHERE |
|
| 3638 | exe_exo_id = $exercise_id AND |
|
| 3639 | course_code = '$course_code' AND |
|
| 3640 | e.session_id = $session_id AND |
|
| 3641 | status = ''"; |
|
| 3642 | $result = Database::query($sql); |
|
| 3643 | $return = 0; |
|
| 3644 | if ($result) { |
|
| 3645 | $return = Database::num_rows($result); |
|
| 3646 | ||
| 3647 | } |
|
| 3648 | return $return; |
|
| 3649 | } |
|
| 3650 | ||
| 3651 | /** |
|
| 3652 | * @param string $in_name is the name and the id of the <select> |
|
| 3653 | * @param string $in_default default value for option |
|
| 3654 | * @param string $in_onchange |
|
| 3655 | * @return string the html code of the <select> |
|
| 3656 | */ |
|
| @@ 1380-1404 (lines=25) @@ | ||
| 1377 | * @param int $user_id |
|
| 1378 | * @return int The number of groups the user is subscribed in. |
|
| 1379 | */ |
|
| 1380 | public static function user_in_number_of_groups($user_id, $cat_id = null) |
|
| 1381 | { |
|
| 1382 | $table_group_user = Database::get_course_table(TABLE_GROUP_USER); |
|
| 1383 | $table_group = Database::get_course_table(TABLE_GROUP); |
|
| 1384 | $user_id = intval($user_id); |
|
| 1385 | $cat_id = intval($cat_id); |
|
| 1386 | ||
| 1387 | $course_id = api_get_course_int_id(); |
|
| 1388 | $cat_condition = ''; |
|
| 1389 | if (!empty($cat_id)) { |
|
| 1390 | $cat_condition = " AND g.category_id = $cat_id "; |
|
| 1391 | } |
|
| 1392 | ||
| 1393 | $sql = "SELECT COUNT(*) AS number_of_groups |
|
| 1394 | FROM $table_group_user gu, $table_group g |
|
| 1395 | WHERE |
|
| 1396 | gu.c_id = $course_id AND |
|
| 1397 | g.c_id = $course_id AND |
|
| 1398 | gu.user_id = $user_id AND |
|
| 1399 | g.iid = gu.group_id |
|
| 1400 | $cat_condition"; |
|
| 1401 | $result = Database::query($sql); |
|
| 1402 | $db_object = Database::fetch_object($result); |
|
| 1403 | ||
| 1404 | return $db_object->number_of_groups; |
|
| 1405 | } |
|
| 1406 | ||
| 1407 | /** |
|