Code Duplication    Length = 21-24 lines in 2 locations

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

@@ 7174-7194 (lines=21) @@
7171
        $courseId = api_get_course_int_id($courseCode);
7172
        $userId = intval($userId);
7173
        $line = null;
7174
    	if (substr($view,3,1) == '1') {
7175
    		$new_view = substr_replace($view,'0',3,1);
7176
    		$title[1]=get_lang('LinksDetails');
7177
    		$sql = "SELECT cl.title, cl.url
7178
                        FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7179
                        WHERE sl.links_link_id = cl.id
7180
                            AND sl.c_id = $courseId
7181
                            AND sl.links_user_id = $userId
7182
                        GROUP BY cl.title, cl.url";
7183
    		$results = StatsUtils::getManyResults2Col($sql);
7184
    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7185
    		if (is_array($results)) {
7186
    			for ($j = 0 ; $j < count($results) ; $j++) {
7187
    				$line .= $results[$j][0]."\n";
7188
    			}
7189
    		} else {
7190
    			$line=get_lang('NoResult');
7191
    		}
7192
    	} else {
7193
    		$new_view = substr_replace($view,'1',3,1);
7194
    	}
7195
    	return array($title_line, $line);
7196
    }
7197
@@ 7215-7238 (lines=24) @@
7212
7213
    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7214
7215
    	if (substr($view,4,1) == '1') {
7216
    		$new_view = substr_replace($view,'0',4,1);
7217
    		$title[1]= get_lang('DocumentsDetails');
7218
7219
    		$sql = "SELECT down_doc_path
7220
                        FROM $downloads_table
7221
                        WHERE c_id = $courseId
7222
                            AND down_user_id = $user_id
7223
                            AND down_session_id = $session_id
7224
                        GROUP BY down_doc_path";
7225
7226
    		$results = StatsUtils::getManyResults1Col($sql);
7227
    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7228
            $line = null;
7229
    		if (is_array($results)) {
7230
    			for ($j = 0 ; $j < count($results) ; $j++) {
7231
    				$line .= $results[$j]."\n";
7232
    			}
7233
    		} else {
7234
    			$line = get_lang('NoResult');
7235
    		}
7236
    	} else {
7237
    		$new_view = substr_replace($view,'1',4,1);
7238
    	}
7239
    	return array($title_line, $line);
7240
    }
7241