| @@ 253-264 (lines=12) @@ | ||
| 250 | * @param int user receiver id |
|
| 251 | * @return int |
|
| 252 | */ |
|
| 253 | public static function get_message_number_invitation_by_user_id($user_receiver_id) |
|
| 254 | { |
|
| 255 | $tbl_message = Database::get_main_table(TABLE_MESSAGE); |
|
| 256 | $sql = 'SELECT COUNT(*) as count_message_in_box FROM '.$tbl_message.' |
|
| 257 | WHERE |
|
| 258 | user_receiver_id='.intval($user_receiver_id).' AND |
|
| 259 | msg_status='.MESSAGE_STATUS_INVITATION_PENDING; |
|
| 260 | $res = Database::query($sql); |
|
| 261 | $row = Database::fetch_array($res, 'ASSOC'); |
|
| 262 | ||
| 263 | return $row['count_message_in_box']; |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * Get invitation list received by user |
|
| @@ 2384-2395 (lines=12) @@ | ||
| 2381 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 2382 | * @version february 2006, dokeos 1.8 |
|
| 2383 | */ |
|
| 2384 | function count_number_of_forums_in_category($cat_id) |
|
| 2385 | { |
|
| 2386 | $table_forums = Database :: get_course_table(TABLE_FORUM); |
|
| 2387 | $course_id = api_get_course_int_id(); |
|
| 2388 | $sql = "SELECT count(*) AS number_of_forums |
|
| 2389 | FROM ".$table_forums." |
|
| 2390 | WHERE c_id = $course_id AND forum_category='".Database::escape_string($cat_id)."'"; |
|
| 2391 | $result = Database::query($sql); |
|
| 2392 | $row = Database::fetch_array($result); |
|
| 2393 | ||
| 2394 | return $row['number_of_forums']; |
|
| 2395 | } |
|
| 2396 | ||
| 2397 | /** |
|
| 2398 | * This function update a thread |
|
| @@ 5598-5608 (lines=11) @@ | ||
| 5595 | * Returns the course name from a given code |
|
| 5596 | * @param string $code |
|
| 5597 | */ |
|
| 5598 | public static function getCourseNameFromCode($code) |
|
| 5599 | { |
|
| 5600 | $tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE); |
|
| 5601 | $sql = 'SELECT title |
|
| 5602 | FROM ' . $tbl_main_categories . ' |
|
| 5603 | WHERE code = "' . Database::escape_string($code) . '"'; |
|
| 5604 | $result = Database::query($sql); |
|
| 5605 | if ($col = Database::fetch_array($result)) { |
|
| 5606 | return $col['title']; |
|
| 5607 | } |
|
| 5608 | } |
|
| 5609 | ||
| 5610 | /** |
|
| 5611 | * Generates a course code from a course title |
|
| @@ 1653-1666 (lines=14) @@ | ||
| 1650 | * |
|
| 1651 | * @return string the comment |
|
| 1652 | */ |
|
| 1653 | public static function get_comments($exe_id, $question_id) |
|
| 1654 | { |
|
| 1655 | $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
| 1656 | $sql = "SELECT teacher_comment |
|
| 1657 | FROM $table_track_attempt |
|
| 1658 | WHERE |
|
| 1659 | exe_id='".Database::escape_string($exe_id)."' AND |
|
| 1660 | question_id = '".Database::escape_string($question_id)."' |
|
| 1661 | ORDER by question_id"; |
|
| 1662 | $sqlres = Database::query($sql); |
|
| 1663 | $comm = Database::result($sqlres, 0, 'teacher_comment'); |
|
| 1664 | ||
| 1665 | return $comm; |
|
| 1666 | } |
|
| 1667 | ||
| 1668 | /** |
|
| 1669 | * @param int $exe_id |
|