| @@ 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 |
|
| @@ 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 |
|
| @@ 1654-1662 (lines=9) @@ | ||
| 1651 | * @param int $id id message to delete. |
|
| 1652 | * @return bool status query |
|
| 1653 | */ |
|
| 1654 | public static function deleteMessage($id) |
|
| 1655 | { |
|
| 1656 | $id = intval($id); |
|
| 1657 | $tblMessage = Database::get_main_table(TABLE_MESSAGE); |
|
| 1658 | $statusMessage = MESSAGE_STATUS_WALL_DELETE; |
|
| 1659 | $sql = "UPDATE $tblMessage SET msg_status = '$statusMessage' WHERE id = '{$id}' "; |
|
| 1660 | ||
| 1661 | return Database::query($sql); |
|
| 1662 | } |
|
| 1663 | ||
| 1664 | /** |
|
| 1665 | * Generate the social block for a user |
|
| @@ 4777-4786 (lines=10) @@ | ||
| 4774 | /** |
|
| 4775 | * @param int $userId |
|
| 4776 | */ |
|
| 4777 | static function add_user_as_admin($userId) |
|
| 4778 | { |
|
| 4779 | $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); |
|
| 4780 | $userId = intval($userId); |
|
| 4781 | ||
| 4782 | if (!self::is_admin($userId)) { |
|
| 4783 | $sql = "INSERT INTO $table_admin SET user_id = $userId"; |
|
| 4784 | Database::query($sql); |
|
| 4785 | } |
|
| 4786 | } |
|
| 4787 | ||
| 4788 | /** |
|
| 4789 | * @param int $userId |
|
| @@ 4791-4799 (lines=9) @@ | ||
| 4788 | /** |
|
| 4789 | * @param int $userId |
|
| 4790 | */ |
|
| 4791 | public static function remove_user_admin($userId) |
|
| 4792 | { |
|
| 4793 | $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); |
|
| 4794 | $userId = intval($userId); |
|
| 4795 | if (self::is_admin($userId)) { |
|
| 4796 | $sql = "DELETE FROM $table_admin WHERE user_id = $userId"; |
|
| 4797 | Database::query($sql); |
|
| 4798 | } |
|
| 4799 | } |
|
| 4800 | ||
| 4801 | /** |
|
| 4802 | * @param string $from |
|