| @@ 95-107 (lines=13) @@ | ||
| 92 | * @param int Link/Resource ID |
|
| 93 | * @return bool false on error, true on success |
|
| 94 | */ |
|
| 95 | public static function remove_resource_from_course_gradebook($link_id) |
|
| 96 | { |
|
| 97 | if (empty($link_id)) { |
|
| 98 | return false; |
|
| 99 | } |
|
| 100 | ||
| 101 | // TODO find the corresponding category (the first one for this course, ordered by ID) |
|
| 102 | $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 103 | $sql = "DELETE FROM $l WHERE id = ".(int)$link_id; |
|
| 104 | Database::query($sql); |
|
| 105 | ||
| 106 | return true; |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Block students |
|
| @@ 792-803 (lines=12) @@ | ||
| 789 | * |
|
| 790 | * @return boolean true if success |
|
| 791 | * */ |
|
| 792 | public static function deleteUserFromAllUrls($userId) |
|
| 793 | { |
|
| 794 | $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 795 | $result = true; |
|
| 796 | if (!empty($userId)) { |
|
| 797 | $sql= "DELETE FROM $table_url_rel_user |
|
| 798 | WHERE user_id = ".intval($userId); |
|
| 799 | Database::query($sql); |
|
| 800 | } |
|
| 801 | ||
| 802 | return $result; |
|
| 803 | } |
|
| 804 | ||
| 805 | /** |
|
| 806 | * Deletes an url and course relationship |
|
| @@ 1654-1665 (lines=12) @@ | ||
| 1651 | * |
|
| 1652 | * @return bool |
|
| 1653 | */ |
|
| 1654 | public static function clear_session_ref_promotion($id) |
|
| 1655 | { |
|
| 1656 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
|
| 1657 | $id = intval($id); |
|
| 1658 | $sql = "UPDATE $tbl_session |
|
| 1659 | SET promotion_id = 0 |
|
| 1660 | WHERE promotion_id = $id"; |
|
| 1661 | if (Database::query($sql)) { |
|
| 1662 | return true; |
|
| 1663 | } else { |
|
| 1664 | return false; |
|
| 1665 | } |
|
| 1666 | } |
|
| 1667 | ||
| 1668 | /** |
|
| @@ 2989-3006 (lines=18) @@ | ||
| 2986 | * @param int $sessionId |
|
| 2987 | * @return bool |
|
| 2988 | */ |
|
| 2989 | public static function removeAllDrhFromSession($sessionId) |
|
| 2990 | { |
|
| 2991 | $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
|
| 2992 | ||
| 2993 | $sessionId = (int) $sessionId; |
|
| 2994 | ||
| 2995 | if (empty($sessionId)) { |
|
| 2996 | return false; |
|
| 2997 | } |
|
| 2998 | ||
| 2999 | $sql = "DELETE FROM $tbl_session_rel_user |
|
| 3000 | WHERE |
|
| 3001 | session_id = $sessionId AND |
|
| 3002 | relation_type =" . SESSION_RELATION_TYPE_RRHH; |
|
| 3003 | Database::query($sql); |
|
| 3004 | ||
| 3005 | return true; |
|
| 3006 | } |
|
| 3007 | ||
| 3008 | /** |
|
| 3009 | * Subscribes sessions to human resource manager (Dashboard feature) |
|