| @@ 3645-3662 (lines=18) @@ | ||
| 3642 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 3643 | * @version January 2007 |
|
| 3644 | */ |
|
| 3645 | static function get_number_of_survey_invitations() |
|
| 3646 | { |
|
| 3647 | $course_id = api_get_course_int_id(); |
|
| 3648 | ||
| 3649 | // Database table definition |
|
| 3650 | $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
| 3651 | ||
| 3652 | $sql = "SELECT count(user) AS total |
|
| 3653 | FROM $table_survey_invitation |
|
| 3654 | WHERE |
|
| 3655 | c_id = $course_id AND |
|
| 3656 | survey_id='".intval($_GET['survey_id'])."' AND |
|
| 3657 | session_id='".api_get_session_id()."' "; |
|
| 3658 | $res = Database::query($sql); |
|
| 3659 | $row = Database::fetch_array($res,'ASSOC'); |
|
| 3660 | ||
| 3661 | return $row['total']; |
|
| 3662 | } |
|
| 3663 | ||
| 3664 | /** |
|
| 3665 | * Save the invitation mail |
|
| @@ 4333-4349 (lines=17) @@ | ||
| 4330 | * @param int $item_id |
|
| 4331 | * @param array $course_info |
|
| 4332 | */ |
|
| 4333 | function makeInvisible($item_id, $course_info) |
|
| 4334 | { |
|
| 4335 | $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
| 4336 | $item_id = intval($item_id); |
|
| 4337 | $course_id = $course_info['real_id']; |
|
| 4338 | $sql = "UPDATE " . $work_table . " |
|
| 4339 | SET accepted = 0 |
|
| 4340 | WHERE c_id = $course_id AND id = '" . $item_id . "'"; |
|
| 4341 | Database::query($sql); |
|
| 4342 | api_item_property_update( |
|
| 4343 | $course_info, |
|
| 4344 | 'work', |
|
| 4345 | $item_id, |
|
| 4346 | 'invisible', |
|
| 4347 | api_get_user_id() |
|
| 4348 | ); |
|
| 4349 | } |
|
| 4350 | ||
| 4351 | /** |
|
| 4352 | * @param int $item_id |
|
| @@ 5351-5361 (lines=11) @@ | ||
| 5348 | * @author Christian Fasanando |
|
| 5349 | * @author Julio Montoya <[email protected]> Adding security |
|
| 5350 | */ |
|
| 5351 | function get_name_thread_by_id($thread_id) |
|
| 5352 | { |
|
| 5353 | $t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD); |
|
| 5354 | $course_id = api_get_course_int_id(); |
|
| 5355 | $sql = "SELECT thread_title FROM ".$t_forum_thread." |
|
| 5356 | WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' "; |
|
| 5357 | $result = Database::query($sql); |
|
| 5358 | $row = Database::fetch_array($result); |
|
| 5359 | ||
| 5360 | return $row[0]; |
|
| 5361 | } |
|
| 5362 | ||
| 5363 | /** |
|
| 5364 | * This function gets all the post written by an user |
|
| @@ 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 |
|