| @@ 1710-1726 (lines=17) @@ | ||
| 1707 | * @param array $groupInfo |
|
| 1708 | * @return bool TRUE if successful |
|
| 1709 | */ |
|
| 1710 | public static function unsubscribe_all_users($groupInfo) |
|
| 1711 | { |
|
| 1712 | $course_id = api_get_course_int_id(); |
|
| 1713 | $groupId = (int) $groupInfo['id']; |
|
| 1714 | if (empty($course_id) || empty($groupId)) { |
|
| 1715 | return false; |
|
| 1716 | } |
|
| 1717 | ||
| 1718 | $table_group_user = Database::get_course_table(TABLE_GROUP_USER); |
|
| 1719 | $sql = "DELETE FROM $table_group_user |
|
| 1720 | WHERE |
|
| 1721 | group_id = $groupId AND |
|
| 1722 | c_id = $course_id"; |
|
| 1723 | $result = Database::query($sql); |
|
| 1724 | ||
| 1725 | return $result; |
|
| 1726 | } |
|
| 1727 | ||
| 1728 | /** |
|
| 1729 | * Unsubscribe all tutors from one or more groups |
|
| @@ 1735-1752 (lines=18) @@ | ||
| 1732 | * @return bool TRUE if successful |
|
| 1733 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1734 | */ |
|
| 1735 | public static function unsubscribe_all_tutors($groupId) |
|
| 1736 | { |
|
| 1737 | $courseId = api_get_course_int_id(); |
|
| 1738 | $groupId = (int) $groupId; |
|
| 1739 | ||
| 1740 | if (empty($courseId) || empty($groupId)) { |
|
| 1741 | return false; |
|
| 1742 | } |
|
| 1743 | ||
| 1744 | if (!empty($groupId) > 0) { |
|
| 1745 | $table_group_tutor = Database::get_course_table(TABLE_GROUP_TUTOR); |
|
| 1746 | $sql = "DELETE FROM $table_group_tutor |
|
| 1747 | WHERE group_id = $groupId AND c_id = $courseId"; |
|
| 1748 | $result = Database::query($sql); |
|
| 1749 | return $result; |
|
| 1750 | } |
|
| 1751 | return true; |
|
| 1752 | } |
|
| 1753 | ||
| 1754 | /** |
|
| 1755 | * Is the user a tutor of this group? |
|
| @@ 8303-8317 (lines=15) @@ | ||
| 8300 | * |
|
| 8301 | * @return array |
|
| 8302 | */ |
|
| 8303 | public static function searchCourseInSessionsFromUser($userId, $courseId) |
|
| 8304 | { |
|
| 8305 | $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 8306 | $userId = (int) $userId; |
|
| 8307 | $courseId = (int) $courseId; |
|
| 8308 | if (empty($userId) || empty($courseId)) { |
|
| 8309 | return []; |
|
| 8310 | } |
|
| 8311 | ||
| 8312 | $sql = "SELECT * FROM $table |
|
| 8313 | WHERE c_id = $courseId AND user_id = $userId"; |
|
| 8314 | $result = Database::query($sql); |
|
| 8315 | ||
| 8316 | return Database::store_result($result, 'ASSOC'); |
|
| 8317 | } |
|
| 8318 | ||
| 8319 | /** |
|
| 8320 | * Subscribe and redirect to session after inscription |
|