| @@ 1725-1741 (lines=17) @@ | ||
| 1722 | * @param array $groupInfo |
|
| 1723 | * @return bool TRUE if successful |
|
| 1724 | */ |
|
| 1725 | public static function unsubscribe_all_users($groupInfo) |
|
| 1726 | { |
|
| 1727 | $course_id = api_get_course_int_id(); |
|
| 1728 | $groupId = (int) $groupInfo['id']; |
|
| 1729 | if (empty($course_id) || empty($groupId)) { |
|
| 1730 | return false; |
|
| 1731 | } |
|
| 1732 | ||
| 1733 | $table_group_user = Database::get_course_table(TABLE_GROUP_USER); |
|
| 1734 | $sql = "DELETE FROM $table_group_user |
|
| 1735 | WHERE |
|
| 1736 | group_id = $groupId AND |
|
| 1737 | c_id = $course_id"; |
|
| 1738 | $result = Database::query($sql); |
|
| 1739 | ||
| 1740 | return $result; |
|
| 1741 | } |
|
| 1742 | ||
| 1743 | /** |
|
| 1744 | * Unsubscribe all tutors from one or more groups |
|
| @@ 1750-1767 (lines=18) @@ | ||
| 1747 | * @return bool TRUE if successful |
|
| 1748 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1749 | */ |
|
| 1750 | public static function unsubscribe_all_tutors($groupId) |
|
| 1751 | { |
|
| 1752 | $courseId = api_get_course_int_id(); |
|
| 1753 | $groupId = (int) $groupId; |
|
| 1754 | ||
| 1755 | if (empty($courseId) || empty($groupId)) { |
|
| 1756 | return false; |
|
| 1757 | } |
|
| 1758 | ||
| 1759 | if (!empty($groupId) > 0) { |
|
| 1760 | $table_group_tutor = Database::get_course_table(TABLE_GROUP_TUTOR); |
|
| 1761 | $sql = "DELETE FROM $table_group_tutor |
|
| 1762 | WHERE group_id = $groupId AND c_id = $courseId"; |
|
| 1763 | $result = Database::query($sql); |
|
| 1764 | return $result; |
|
| 1765 | } |
|
| 1766 | return true; |
|
| 1767 | } |
|
| 1768 | ||
| 1769 | /** |
|
| 1770 | * Is the user a tutor of this group? |
|
| @@ 8534-8548 (lines=15) @@ | ||
| 8531 | * |
|
| 8532 | * @return array |
|
| 8533 | */ |
|
| 8534 | public static function searchCourseInSessionsFromUser($userId, $courseId) |
|
| 8535 | { |
|
| 8536 | $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 8537 | $userId = (int) $userId; |
|
| 8538 | $courseId = (int) $courseId; |
|
| 8539 | if (empty($userId) || empty($courseId)) { |
|
| 8540 | return []; |
|
| 8541 | } |
|
| 8542 | ||
| 8543 | $sql = "SELECT * FROM $table |
|
| 8544 | WHERE c_id = $courseId AND user_id = $userId"; |
|
| 8545 | $result = Database::query($sql); |
|
| 8546 | ||
| 8547 | return Database::store_result($result, 'ASSOC'); |
|
| 8548 | } |
|
| 8549 | ||
| 8550 | /** |
|
| 8551 | * Subscribe and redirect to session after inscription |
|