@@ 167-173 (lines=7) @@ | ||
164 | * @param int User ID |
|
165 | * @return void |
|
166 | */ |
|
167 | function LoginDelete($user_id) |
|
168 | { |
|
169 | $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); |
|
170 | $user_id = intval($user_id); |
|
171 | $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; |
|
172 | Database::query($query); |
|
173 | } |
|
174 | ||
175 | /** |
|
176 | * @param int $user_id |
@@ 1652-1660 (lines=9) @@ | ||
1649 | * @param int $id id message to delete. |
|
1650 | * @return bool status query |
|
1651 | */ |
|
1652 | public static function deleteMessage($id) |
|
1653 | { |
|
1654 | $id = intval($id); |
|
1655 | $tblMessage = Database::get_main_table(TABLE_MESSAGE); |
|
1656 | $statusMessage = MESSAGE_STATUS_WALL_DELETE; |
|
1657 | $sql = "UPDATE $tblMessage SET msg_status = '$statusMessage' WHERE id = '{$id}' "; |
|
1658 | ||
1659 | return Database::query($sql); |
|
1660 | } |
|
1661 | ||
1662 | /** |
|
1663 | * Generate the social block for a user |
@@ 4757-4766 (lines=10) @@ | ||
4754 | /** |
|
4755 | * @param int $userId |
|
4756 | */ |
|
4757 | static function add_user_as_admin($userId) |
|
4758 | { |
|
4759 | $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); |
|
4760 | $userId = intval($userId); |
|
4761 | ||
4762 | if (!self::is_admin($userId)) { |
|
4763 | $sql = "INSERT INTO $table_admin SET user_id = $userId"; |
|
4764 | Database::query($sql); |
|
4765 | } |
|
4766 | } |
|
4767 | ||
4768 | /** |
|
4769 | * @param int $userId |
|
@@ 4771-4779 (lines=9) @@ | ||
4768 | /** |
|
4769 | * @param int $userId |
|
4770 | */ |
|
4771 | public static function remove_user_admin($userId) |
|
4772 | { |
|
4773 | $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); |
|
4774 | $userId = intval($userId); |
|
4775 | if (self::is_admin($userId)) { |
|
4776 | $sql = "DELETE FROM $table_admin WHERE user_id = $userId"; |
|
4777 | Database::query($sql); |
|
4778 | } |
|
4779 | } |
|
4780 | ||
4781 | /** |
|
4782 | * @param string $from |
@@ 177-187 (lines=11) @@ | ||
174 | * @param int $url_id |
|
175 | * @return array |
|
176 | * */ |
|
177 | public static function get_url_data_from_id($url_id) |
|
178 | { |
|
179 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
180 | $sql = "SELECT id, url, description, active |
|
181 | FROM $table |
|
182 | WHERE id = ".intval($url_id); |
|
183 | $res = Database::query($sql); |
|
184 | $row = Database::fetch_array($res); |
|
185 | ||
186 | return $row; |
|
187 | } |
|
188 | ||
189 | /** |
|
190 | * Gets the inner join of users and urls table |
|
@@ 258-268 (lines=11) @@ | ||
255 | * |
|
256 | * @return int Database::num_rows($res); |
|
257 | **/ |
|
258 | public static function getCountUrlRelCourse($courseId) |
|
259 | { |
|
260 | $courseId = intval($courseId); |
|
261 | $tableUrlRelCourse = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
262 | $sql = "SELECT * |
|
263 | FROM $tableUrlRelCourse |
|
264 | WHERE c_id = '$courseId'"; |
|
265 | $res = Database::query($sql); |
|
266 | ||
267 | return Database::num_rows($res); |
|
268 | } |
|
269 | ||
270 | /** |
|
271 | * Gets the inner join of access_url and the session table |
|
@@ 786-797 (lines=12) @@ | ||
783 | * |
|
784 | * @return boolean true if success |
|
785 | * */ |
|
786 | public static function deleteUserFromAllUrls($userId) |
|
787 | { |
|
788 | $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
789 | $result = true; |
|
790 | if (!empty($userId)) { |
|
791 | $sql= "DELETE FROM $table_url_rel_user |
|
792 | WHERE user_id = ".intval($userId); |
|
793 | Database::query($sql); |
|
794 | } |
|
795 | ||
796 | return $result; |
|
797 | } |
|
798 | ||
799 | /** |
|
800 | * Deletes an url and course relationship |