| @@ 5648-5658 (lines=11) @@ | ||
| 5645 | * Returns the course name from a given code |
|
| 5646 | * @param string $code |
|
| 5647 | */ |
|
| 5648 | public static function getCourseNameFromCode($code) |
|
| 5649 | { |
|
| 5650 | $tbl_main_categories = Database::get_main_table(TABLE_MAIN_COURSE); |
|
| 5651 | $sql = 'SELECT title |
|
| 5652 | FROM ' . $tbl_main_categories . ' |
|
| 5653 | WHERE code = "' . Database::escape_string($code) . '"'; |
|
| 5654 | $result = Database::query($sql); |
|
| 5655 | if ($col = Database::fetch_array($result)) { |
|
| 5656 | return $col['title']; |
|
| 5657 | } |
|
| 5658 | } |
|
| 5659 | ||
| 5660 | /** |
|
| 5661 | * Generates a course code from a course title |
|
| @@ 1654-1667 (lines=14) @@ | ||
| 1651 | * |
|
| 1652 | * @return string the comment |
|
| 1653 | */ |
|
| 1654 | public static function get_comments($exe_id, $question_id) |
|
| 1655 | { |
|
| 1656 | $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
| 1657 | $sql = "SELECT teacher_comment |
|
| 1658 | FROM $table_track_attempt |
|
| 1659 | WHERE |
|
| 1660 | exe_id='".Database::escape_string($exe_id)."' AND |
|
| 1661 | question_id = '".Database::escape_string($question_id)."' |
|
| 1662 | ORDER by question_id"; |
|
| 1663 | $sqlres = Database::query($sql); |
|
| 1664 | $comm = Database::result($sqlres, 0, 'teacher_comment'); |
|
| 1665 | ||
| 1666 | return $comm; |
|
| 1667 | } |
|
| 1668 | ||
| 1669 | /** |
|
| 1670 | * @param int $exe_id |
|
| @@ 283-294 (lines=12) @@ | ||
| 280 | * @param int user receiver id |
|
| 281 | * @return int |
|
| 282 | */ |
|
| 283 | public static function get_message_number_invitation_by_user_id($user_receiver_id) |
|
| 284 | { |
|
| 285 | $tbl_message = Database::get_main_table(TABLE_MESSAGE); |
|
| 286 | $sql = 'SELECT COUNT(*) as count_message_in_box FROM '.$tbl_message.' |
|
| 287 | WHERE |
|
| 288 | user_receiver_id='.intval($user_receiver_id).' AND |
|
| 289 | msg_status='.MESSAGE_STATUS_INVITATION_PENDING; |
|
| 290 | $res = Database::query($sql); |
|
| 291 | $row = Database::fetch_array($res, 'ASSOC'); |
|
| 292 | ||
| 293 | return $row['count_message_in_box']; |
|
| 294 | } |
|
| 295 | ||
| 296 | /** |
|
| 297 | * Get number of messages sent to other users |
|
| @@ 2392-2403 (lines=12) @@ | ||
| 2389 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 2390 | * @version february 2006, dokeos 1.8 |
|
| 2391 | */ |
|
| 2392 | function count_number_of_forums_in_category($cat_id) |
|
| 2393 | { |
|
| 2394 | $table_forums = Database::get_course_table(TABLE_FORUM); |
|
| 2395 | $course_id = api_get_course_int_id(); |
|
| 2396 | $sql = "SELECT count(*) AS number_of_forums |
|
| 2397 | FROM ".$table_forums." |
|
| 2398 | WHERE c_id = $course_id AND forum_category='".Database::escape_string($cat_id)."'"; |
|
| 2399 | $result = Database::query($sql); |
|
| 2400 | $row = Database::fetch_array($result); |
|
| 2401 | ||
| 2402 | return $row['number_of_forums']; |
|
| 2403 | } |
|
| 2404 | ||
| 2405 | /** |
|
| 2406 | * This function update a thread |
|