| @@ 1708-1724 (lines=17) @@ | ||
| 1705 | * @param array $groupInfo |
|
| 1706 | * @return bool TRUE if successful |
|
| 1707 | */ |
|
| 1708 | public static function unsubscribe_all_users($groupInfo) |
|
| 1709 | { |
|
| 1710 | $course_id = api_get_course_int_id(); |
|
| 1711 | $groupId = (int) $groupInfo['id']; |
|
| 1712 | if (empty($course_id) || empty($groupId)) { |
|
| 1713 | return false; |
|
| 1714 | } |
|
| 1715 | ||
| 1716 | $table_group_user = Database::get_course_table(TABLE_GROUP_USER); |
|
| 1717 | $sql = "DELETE FROM $table_group_user |
|
| 1718 | WHERE |
|
| 1719 | group_id = $groupId AND |
|
| 1720 | c_id = $course_id"; |
|
| 1721 | $result = Database::query($sql); |
|
| 1722 | ||
| 1723 | return $result; |
|
| 1724 | } |
|
| 1725 | ||
| 1726 | /** |
|
| 1727 | * Unsubscribe all tutors from one or more groups |
|
| @@ 1733-1750 (lines=18) @@ | ||
| 1730 | * @return bool TRUE if successful |
|
| 1731 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1732 | */ |
|
| 1733 | public static function unsubscribe_all_tutors($groupId) |
|
| 1734 | { |
|
| 1735 | $courseId = api_get_course_int_id(); |
|
| 1736 | $groupId = (int) $groupId; |
|
| 1737 | ||
| 1738 | if (empty($courseId) || empty($groupId)) { |
|
| 1739 | return false; |
|
| 1740 | } |
|
| 1741 | ||
| 1742 | if (!empty($groupId) > 0) { |
|
| 1743 | $table_group_tutor = Database::get_course_table(TABLE_GROUP_TUTOR); |
|
| 1744 | $sql = "DELETE FROM $table_group_tutor |
|
| 1745 | WHERE group_id = $groupId AND c_id = $courseId"; |
|
| 1746 | $result = Database::query($sql); |
|
| 1747 | return $result; |
|
| 1748 | } |
|
| 1749 | return true; |
|
| 1750 | } |
|
| 1751 | ||
| 1752 | /** |
|
| 1753 | * Is the user a tutor of this group? |
|
| @@ 8474-8488 (lines=15) @@ | ||
| 8471 | * |
|
| 8472 | * @return array |
|
| 8473 | */ |
|
| 8474 | public static function searchCourseInSessionsFromUser($userId, $courseId) |
|
| 8475 | { |
|
| 8476 | $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 8477 | $userId = (int) $userId; |
|
| 8478 | $courseId = (int) $courseId; |
|
| 8479 | if (empty($userId) || empty($courseId)) { |
|
| 8480 | return []; |
|
| 8481 | } |
|
| 8482 | ||
| 8483 | $sql = "SELECT * FROM $table |
|
| 8484 | WHERE c_id = $courseId AND user_id = $userId"; |
|
| 8485 | $result = Database::query($sql); |
|
| 8486 | ||
| 8487 | return Database::store_result($result, 'ASSOC'); |
|
| 8488 | } |
|
| 8489 | ||
| 8490 | /** |
|
| 8491 | * Subscribe and redirect to session after inscription |
|