Code Duplication    Length = 18-19 lines in 2 locations

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

@@ 4039-4057 (lines=19) @@
4036
     * @param    int $session_id Session id (optional)
4037
     * @return    int        count of visited links
4038
     */
4039
    public static function count_student_visited_links($student_id, $courseId, $session_id = 0)
4040
    {
4041
        $student_id  = intval($student_id);
4042
        $courseId = intval($courseId);
4043
        $session_id  = intval($session_id);
4044
4045
        // table definition
4046
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
4047
4048
        $sql = 'SELECT 1
4049
                FROM '.$table.'
4050
                WHERE
4051
                    links_user_id= '.$student_id.' AND
4052
                    c_id = "'.$courseId.'" AND
4053
                    links_session_id = '.$session_id.' ';
4054
4055
        $rs = Database::query($sql);
4056
        return Database::num_rows($rs);
4057
    }
4058
4059
    /**
4060
     * Get count student downloaded documents
@@ 4066-4083 (lines=18) @@
4063
     * @param    int        Session id (optional)
4064
     * @return    int        Count downloaded documents
4065
     */
4066
    public static function count_student_downloaded_documents($student_id, $courseId, $session_id = 0)
4067
    {
4068
        $student_id  = intval($student_id);
4069
        $courseId = intval($courseId);
4070
        $session_id  = intval($session_id);
4071
4072
        // table definition
4073
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4074
4075
        $sql = 'SELECT 1
4076
                FROM '.$table.'
4077
                WHERE down_user_id = '.$student_id.'
4078
                AND c_id  = "'.$courseId.'"
4079
                AND down_session_id = '.$session_id.' ';
4080
        $rs = Database::query($sql);
4081
4082
        return Database::num_rows($rs);
4083
    }
4084
4085
    /**
4086
     * Get course list inside a session from a student