Code Duplication    Length = 21-24 lines in 2 locations

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

@@ 7135-7155 (lines=21) @@
7132
        $courseId = api_get_course_int_id($courseCode);
7133
        $userId = intval($userId);
7134
        $line = null;
7135
    	if (substr($view,3,1) == '1') {
7136
    		$new_view = substr_replace($view,'0',3,1);
7137
    		$title[1]=get_lang('LinksDetails');
7138
    		$sql = "SELECT cl.title, cl.url
7139
                        FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7140
                        WHERE sl.links_link_id = cl.id
7141
                            AND sl.c_id = $courseId
7142
                            AND sl.links_user_id = $userId
7143
                        GROUP BY cl.title, cl.url";
7144
    		$results = StatsUtils::getManyResults2Col($sql);
7145
    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7146
    		if (is_array($results)) {
7147
    			for ($j = 0 ; $j < count($results) ; $j++) {
7148
    				$line .= $results[$j][0]."\n";
7149
    			}
7150
    		} else {
7151
    			$line=get_lang('NoResult');
7152
    		}
7153
    	} else {
7154
    		$new_view = substr_replace($view,'1',3,1);
7155
    	}
7156
    	return array($title_line, $line);
7157
    }
7158
@@ 7176-7199 (lines=24) @@
7173
7174
    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7175
7176
    	if (substr($view,4,1) == '1') {
7177
    		$new_view = substr_replace($view,'0',4,1);
7178
    		$title[1]= get_lang('DocumentsDetails');
7179
7180
    		$sql = "SELECT down_doc_path
7181
                        FROM $downloads_table
7182
                        WHERE c_id = $courseId
7183
                            AND down_user_id = $user_id
7184
                            AND down_session_id = $session_id
7185
                        GROUP BY down_doc_path";
7186
7187
    		$results = StatsUtils::getManyResults1Col($sql);
7188
    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7189
            $line = null;
7190
    		if (is_array($results)) {
7191
    			for ($j = 0 ; $j < count($results) ; $j++) {
7192
    				$line .= $results[$j]."\n";
7193
    			}
7194
    		} else {
7195
    			$line = get_lang('NoResult');
7196
    		}
7197
    	} else {
7198
    		$new_view = substr_replace($view,'1',4,1);
7199
    	}
7200
    	return array($title_line, $line);
7201
    }
7202