| @@ 24-40 (lines=17) @@ | ||
| 21 | * |
|
| 22 | * @return String Blog Title |
|
| 23 | */ |
|
| 24 | public static function get_blog_title ($blog_id) |
|
| 25 | { |
|
| 26 | $course_id = api_get_course_int_id(); |
|
| 27 | ||
| 28 | if (is_numeric($blog_id)) { |
|
| 29 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 30 | ||
| 31 | $sql = "SELECT blog_name |
|
| 32 | FROM " . $tbl_blogs . " |
|
| 33 | WHERE c_id = $course_id AND blog_id = " . intval($blog_id); |
|
| 34 | ||
| 35 | $result = Database::query($sql); |
|
| 36 | $blog = Database::fetch_array($result); |
|
| 37 | ||
| 38 | return stripslashes($blog['blog_name']); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | ||
| 43 | /** |
|
| @@ 51-61 (lines=11) @@ | ||
| 48 | * |
|
| 49 | * @return String Blog description |
|
| 50 | */ |
|
| 51 | public static function get_blog_subtitle($blog_id) |
|
| 52 | { |
|
| 53 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 54 | $course_id = api_get_course_int_id(); |
|
| 55 | $sql = "SELECT blog_subtitle FROM $tbl_blogs |
|
| 56 | WHERE c_id = $course_id AND blog_id ='".intval($blog_id)."'"; |
|
| 57 | $result = Database::query($sql); |
|
| 58 | $blog = Database::fetch_array($result); |
|
| 59 | ||
| 60 | return stripslashes($blog['blog_subtitle']); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Get the users of a blog |
|
| @@ 3625-3642 (lines=18) @@ | ||
| 3622 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 3623 | * @version January 2007 |
|
| 3624 | */ |
|
| 3625 | public static function get_number_of_survey_invitations() |
|
| 3626 | { |
|
| 3627 | $course_id = api_get_course_int_id(); |
|
| 3628 | ||
| 3629 | // Database table definition |
|
| 3630 | $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
| 3631 | ||
| 3632 | $sql = "SELECT count(user) AS total |
|
| 3633 | FROM $table_survey_invitation |
|
| 3634 | WHERE |
|
| 3635 | c_id = $course_id AND |
|
| 3636 | survey_id='".intval($_GET['survey_id'])."' AND |
|
| 3637 | session_id='".api_get_session_id()."' "; |
|
| 3638 | $res = Database::query($sql); |
|
| 3639 | $row = Database::fetch_array($res,'ASSOC'); |
|
| 3640 | ||
| 3641 | return $row['total']; |
|
| 3642 | } |
|
| 3643 | ||
| 3644 | /** |
|
| 3645 | * Save the invitation mail |
|
| @@ 382-398 (lines=17) @@ | ||
| 379 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
| 380 | * @version April 2008 |
|
| 381 | */ |
|
| 382 | function get_number_of_group_users() |
|
| 383 | { |
|
| 384 | global $current_group; |
|
| 385 | $course_id = api_get_course_int_id(); |
|
| 386 | ||
| 387 | // Database table definition |
|
| 388 | $table = Database :: get_course_table(TABLE_GROUP_USER); |
|
| 389 | ||
| 390 | // Query |
|
| 391 | $sql = "SELECT count(iid) AS number_of_users |
|
| 392 | FROM ".$table." |
|
| 393 | WHERE c_id = $course_id AND group_id='".intval($current_group['id'])."'"; |
|
| 394 | $result = Database::query($sql); |
|
| 395 | $return = Database::fetch_array($result, 'ASSOC'); |
|
| 396 | ||
| 397 | return $return['number_of_users']; |
|
| 398 | } |
|
| 399 | ||
| 400 | /** |
|
| 401 | * Get the details of the users in a group |
|
| @@ 5366-5376 (lines=11) @@ | ||
| 5363 | * @author Christian Fasanando |
|
| 5364 | * @author Julio Montoya <[email protected]> Adding security |
|
| 5365 | */ |
|
| 5366 | function get_name_thread_by_id($thread_id) |
|
| 5367 | { |
|
| 5368 | $t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); |
|
| 5369 | $course_id = api_get_course_int_id(); |
|
| 5370 | $sql = "SELECT thread_title FROM ".$t_forum_thread." |
|
| 5371 | WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' "; |
|
| 5372 | $result = Database::query($sql); |
|
| 5373 | $row = Database::fetch_array($result); |
|
| 5374 | ||
| 5375 | return $row[0]; |
|
| 5376 | } |
|
| 5377 | ||
| 5378 | /** |
|
| 5379 | * This function gets all the post written by an user |
|
| @@ 4367-4383 (lines=17) @@ | ||
| 4364 | * @param int $item_id |
|
| 4365 | * @param array $course_info |
|
| 4366 | */ |
|
| 4367 | function makeInvisible($item_id, $course_info) |
|
| 4368 | { |
|
| 4369 | $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
| 4370 | $item_id = intval($item_id); |
|
| 4371 | $course_id = $course_info['real_id']; |
|
| 4372 | $sql = "UPDATE " . $work_table . " |
|
| 4373 | SET accepted = 0 |
|
| 4374 | WHERE c_id = $course_id AND id = '" . $item_id . "'"; |
|
| 4375 | Database::query($sql); |
|
| 4376 | api_item_property_update( |
|
| 4377 | $course_info, |
|
| 4378 | 'work', |
|
| 4379 | $item_id, |
|
| 4380 | 'invisible', |
|
| 4381 | api_get_user_id() |
|
| 4382 | ); |
|
| 4383 | } |
|
| 4384 | ||
| 4385 | /** |
|
| 4386 | * @param int $item_id |
|