| @@ 372-388 (lines=17) @@ | ||
| 369 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
|
| 370 | * @version April 2008 |
|
| 371 | */ |
|
| 372 | function get_number_of_group_users() |
|
| 373 | { |
|
| 374 | global $current_group; |
|
| 375 | $course_id = api_get_course_int_id(); |
|
| 376 | ||
| 377 | // Database table definition |
|
| 378 | $table = Database :: get_course_table(TABLE_GROUP_USER); |
|
| 379 | ||
| 380 | // Query |
|
| 381 | $sql = "SELECT count(iid) AS number_of_users |
|
| 382 | FROM ".$table." |
|
| 383 | WHERE c_id = $course_id AND group_id='".intval($current_group['id'])."'"; |
|
| 384 | $result = Database::query($sql); |
|
| 385 | $return = Database::fetch_array($result, 'ASSOC'); |
|
| 386 | ||
| 387 | return $return['number_of_users']; |
|
| 388 | } |
|
| 389 | ||
| 390 | /** |
|
| 391 | * Get the details of the users in a group |
|
| @@ 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 |
|
| @@ 5355-5365 (lines=11) @@ | ||
| 5352 | * @author Christian Fasanando |
|
| 5353 | * @author Julio Montoya <[email protected]> Adding security |
|
| 5354 | */ |
|
| 5355 | function get_name_thread_by_id($thread_id) |
|
| 5356 | { |
|
| 5357 | $t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); |
|
| 5358 | $course_id = api_get_course_int_id(); |
|
| 5359 | $sql = "SELECT thread_title FROM ".$t_forum_thread." |
|
| 5360 | WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' "; |
|
| 5361 | $result = Database::query($sql); |
|
| 5362 | $row = Database::fetch_array($result); |
|
| 5363 | ||
| 5364 | return $row[0]; |
|
| 5365 | } |
|
| 5366 | ||
| 5367 | /** |
|
| 5368 | * This function gets all the post written by an user |
|
| @@ 4340-4356 (lines=17) @@ | ||
| 4337 | * @param int $item_id |
|
| 4338 | * @param array $course_info |
|
| 4339 | */ |
|
| 4340 | function makeInvisible($item_id, $course_info) |
|
| 4341 | { |
|
| 4342 | $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
| 4343 | $item_id = intval($item_id); |
|
| 4344 | $course_id = $course_info['real_id']; |
|
| 4345 | $sql = "UPDATE " . $work_table . " |
|
| 4346 | SET accepted = 0 |
|
| 4347 | WHERE c_id = $course_id AND id = '" . $item_id . "'"; |
|
| 4348 | Database::query($sql); |
|
| 4349 | api_item_property_update( |
|
| 4350 | $course_info, |
|
| 4351 | 'work', |
|
| 4352 | $item_id, |
|
| 4353 | 'invisible', |
|
| 4354 | api_get_user_id() |
|
| 4355 | ); |
|
| 4356 | } |
|
| 4357 | ||
| 4358 | /** |
|
| 4359 | * @param int $item_id |
|