Code Duplication    Length = 11-18 lines in 6 locations

main/inc/lib/blog.lib.php 2 locations

@@ 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

main/group/group_space.php 1 location

@@ 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

main/survey/survey.lib.php 1 location

@@ 3623-3640 (lines=18) @@
3620
     * @author Patrick Cool <[email protected]>, Ghent University
3621
     * @version January 2007
3622
     */
3623
    public static function get_number_of_survey_invitations()
3624
    {
3625
        $course_id = api_get_course_int_id();
3626
3627
        // Database table definition
3628
        $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
3629
3630
        $sql = "SELECT count(user) AS total
3631
		        FROM $table_survey_invitation
3632
		        WHERE
3633
                    c_id = $course_id AND
3634
                    survey_id='".intval($_GET['survey_id'])."' AND
3635
                    session_id='".api_get_session_id()."' ";
3636
        $res = Database::query($sql);
3637
        $row = Database::fetch_array($res,'ASSOC');
3638
3639
        return $row['total'];
3640
    }
3641
3642
    /**
3643
     * Save the invitation mail

main/forum/forumfunction.inc.php 1 location

@@ 5370-5380 (lines=11) @@
5367
 * @author Christian Fasanando
5368
 * @author Julio Montoya <[email protected]> Adding security
5369
 */
5370
function get_name_thread_by_id($thread_id)
5371
{
5372
    $t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
5373
    $course_id = api_get_course_int_id();
5374
    $sql = "SELECT thread_title FROM ".$t_forum_thread."
5375
            WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' ";
5376
    $result = Database::query($sql);
5377
    $row = Database::fetch_array($result);
5378
5379
    return $row[0];
5380
}
5381
5382
/**
5383
 * This function gets all the post written by an user

main/work/work.lib.php 1 location

@@ 4389-4405 (lines=17) @@
4386
 * @param int $item_id
4387
 * @param array $course_info
4388
 */
4389
function makeInvisible($item_id, $course_info)
4390
{
4391
    $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4392
    $item_id = intval($item_id);
4393
    $course_id = $course_info['real_id'];
4394
    $sql = "UPDATE  " . $work_table . "
4395
            SET accepted = 0
4396
            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4397
    Database::query($sql);
4398
    api_item_property_update(
4399
        $course_info,
4400
        'work',
4401
        $item_id,
4402
        'invisible',
4403
        api_get_user_id()
4404
    );
4405
}
4406
4407
/**
4408
 * @param int $item_id