Code Duplication    Length = 11-14 lines in 4 locations

main/inc/lib/social.lib.php 1 location

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

main/inc/lib/events.lib.php 1 location

@@ 1650-1663 (lines=14) @@
1647
     *
1648
     * @return string the comment
1649
     */
1650
    public static function get_comments($exe_id, $question_id)
1651
    {
1652
        $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
1653
        $sql = "SELECT teacher_comment 
1654
                FROM $table_track_attempt
1655
                WHERE
1656
                    exe_id='".Database::escape_string($exe_id)."' AND
1657
                    question_id = '".Database::escape_string($question_id)."'
1658
                ORDER by question_id";
1659
        $sqlres = Database::query($sql);
1660
        $comm = Database::result($sqlres, 0, 'teacher_comment');
1661
1662
        return $comm;
1663
    }
1664
1665
    /**
1666
     * @param int $exe_id

main/inc/lib/course.lib.php 1 location

@@ 5583-5593 (lines=11) @@
5580
     * Returns the course name from a given code
5581
     * @param string $code
5582
     */
5583
    public static function getCourseNameFromCode($code)
5584
    {
5585
        $tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE);
5586
        $sql = 'SELECT title
5587
                FROM ' . $tbl_main_categories . '
5588
                WHERE code = "' . Database::escape_string($code) . '"';
5589
        $result = Database::query($sql);
5590
        if ($col = Database::fetch_array($result)) {
5591
            return $col['title'];
5592
        }
5593
    }
5594
5595
    /**
5596
     * Generates a course code from a course title

main/forum/forumfunction.inc.php 1 location

@@ 2370-2381 (lines=12) @@
2367
 * @author Patrick Cool <[email protected]>, Ghent University
2368
 * @version february 2006, dokeos 1.8
2369
 */
2370
function count_number_of_forums_in_category($cat_id)
2371
{
2372
    $table_forums = Database :: get_course_table(TABLE_FORUM);
2373
    $course_id = api_get_course_int_id();
2374
    $sql = "SELECT count(*) AS number_of_forums
2375
            FROM ".$table_forums."
2376
            WHERE c_id = $course_id AND forum_category='".Database::escape_string($cat_id)."'";
2377
    $result = Database::query($sql);
2378
    $row = Database::fetch_array($result);
2379
2380
    return $row['number_of_forums'];
2381
}
2382
2383
/**
2384
 * This function update a thread