| @@ 416-428 (lines=13) @@ | ||
| 413 | * Get platform language ID |
|
| 414 | * @return int The platform language ID |
|
| 415 | */ |
|
| 416 | public static function get_platform_language_id() |
|
| 417 | { |
|
| 418 | $name = api_get_setting('platformLanguage'); |
|
| 419 | $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE); |
|
| 420 | $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'"; |
|
| 421 | $res = Database::query($sql); |
|
| 422 | if (Database::num_rows($res) < 1) { |
|
| 423 | return false; |
|
| 424 | } |
|
| 425 | $row = Database::fetch_array($res); |
|
| 426 | ||
| 427 | return $row['id']; |
|
| 428 | } |
|
| 429 | ||
| 430 | /** |
|
| 431 | * Get parent language path (or null if no parent) |
|
| @@ 5583-5597 (lines=15) @@ | ||
| 5580 | * @author Julio Montoya <[email protected]> |
|
| 5581 | * @return int access_url_id of the current Chamilo Installation |
|
| 5582 | */ |
|
| 5583 | function api_get_current_access_url_id() { |
|
| 5584 | $access_url_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
| 5585 | $path = Database::escape_string(api_get_path(WEB_PATH)); |
|
| 5586 | $sql = "SELECT id FROM $access_url_table WHERE url = '".$path."'"; |
|
| 5587 | $result = Database::query($sql); |
|
| 5588 | if (Database::num_rows($result) > 0) { |
|
| 5589 | $access_url_id = Database::result($result, 0, 0); |
|
| 5590 | return $access_url_id; |
|
| 5591 | } |
|
| 5592 | //if the url in WEB_PATH was not found, it can only mean that there is |
|
| 5593 | // either a configuration problem or the first URL has not been defined yet |
|
| 5594 | // (by default it is http://localhost/). Thus the more sensible thing we can |
|
| 5595 | // do is return 1 (the main URL) as the user cannot hack this value anyway |
|
| 5596 | return 1; |
|
| 5597 | } |
|
| 5598 | ||
| 5599 | /** |
|
| 5600 | * Gets the registered urls from a given user id |
|
| @@ 51-66 (lines=16) @@ | ||
| 48 | * @param int $userId The user for which we need the unread messages count |
|
| 49 | * @return int The number of unread messages in the database for the given user |
|
| 50 | */ |
|
| 51 | private static function getCountNewMessagesFromDB($userId) |
|
| 52 | { |
|
| 53 | if (empty($userId)) { |
|
| 54 | return 0; |
|
| 55 | } |
|
| 56 | $table = Database::get_main_table(TABLE_MESSAGE); |
|
| 57 | $sql = "SELECT COUNT(id) as count |
|
| 58 | FROM $table |
|
| 59 | WHERE |
|
| 60 | user_receiver_id=" . api_get_user_id() . " AND |
|
| 61 | msg_status = " . MESSAGE_STATUS_UNREAD; |
|
| 62 | $result = Database::query($sql); |
|
| 63 | $row = Database::fetch_assoc($result); |
|
| 64 | ||
| 65 | return $row['count']; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Get the list of user_ids of users who are online. |
|
| @@ 785-799 (lines=15) @@ | ||
| 782 | /** |
|
| 783 | * Shows all information of an category |
|
| 784 | */ |
|
| 785 | public function shows_all_information_an_category($selectcat = '') |
|
| 786 | { |
|
| 787 | if ($selectcat == '') { |
|
| 788 | return null; |
|
| 789 | } else { |
|
| 790 | $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
|
| 791 | $sql = 'SELECT |
|
| 792 | name, |
|
| 793 | description, |
|
| 794 | user_id, |
|
| 795 | c_id, |
|
| 796 | parent_id, |
|
| 797 | weight, |
|
| 798 | visible, |
|
| 799 | certif_min_score, |
|
| 800 | session_id, |
|
| 801 | generate_certificates, |
|
| 802 | is_requirement |
|