Code Duplication    Length = 21-24 lines in 2 locations

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

@@ 7045-7065 (lines=21) @@
7042
        $courseId = api_get_course_int_id($courseCode);
7043
        $userId = intval($userId);
7044
        $line = null;
7045
    	if (substr($view,3,1) == '1') {
7046
    		$new_view = substr_replace($view,'0',3,1);
7047
    		$title[1]=get_lang('LinksDetails');
7048
    		$sql = "SELECT cl.title, cl.url
7049
                        FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7050
                        WHERE sl.links_link_id = cl.id
7051
                            AND sl.c_id = $courseId
7052
                            AND sl.links_user_id = $userId
7053
                        GROUP BY cl.title, cl.url";
7054
    		$results = StatsUtils::getManyResults2Col($sql);
7055
    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7056
    		if (is_array($results)) {
7057
    			for ($j = 0 ; $j < count($results) ; $j++) {
7058
    				$line .= $results[$j][0]."\n";
7059
    			}
7060
    		} else {
7061
    			$line=get_lang('NoResult');
7062
    		}
7063
    	} else {
7064
    		$new_view = substr_replace($view,'1',3,1);
7065
    	}
7066
    	return array($title_line, $line);
7067
    }
7068
@@ 7086-7109 (lines=24) @@
7083
7084
    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7085
7086
    	if (substr($view,4,1) == '1') {
7087
    		$new_view = substr_replace($view,'0',4,1);
7088
    		$title[1]= get_lang('DocumentsDetails');
7089
7090
    		$sql = "SELECT down_doc_path
7091
                        FROM $downloads_table
7092
                        WHERE c_id = $courseId
7093
                            AND down_user_id = $user_id
7094
                            AND down_session_id = $session_id
7095
                        GROUP BY down_doc_path";
7096
7097
    		$results = StatsUtils::getManyResults1Col($sql);
7098
    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7099
            $line = null;
7100
    		if (is_array($results)) {
7101
    			for ($j = 0 ; $j < count($results) ; $j++) {
7102
    				$line .= $results[$j]."\n";
7103
    			}
7104
    		} else {
7105
    			$line = get_lang('NoResult');
7106
    		}
7107
    	} else {
7108
    		$new_view = substr_replace($view,'1',4,1);
7109
    	}
7110
    	return array($title_line, $line);
7111
    }
7112