Code Duplication    Length = 21-24 lines in 2 locations

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

@@ 7206-7226 (lines=21) @@
7203
        $courseId = api_get_course_int_id($courseCode);
7204
        $userId = intval($userId);
7205
        $line = null;
7206
    	if (substr($view,3,1) == '1') {
7207
    		$new_view = substr_replace($view,'0',3,1);
7208
    		$title[1]=get_lang('LinksDetails');
7209
    		$sql = "SELECT cl.title, cl.url
7210
                        FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7211
                        WHERE sl.links_link_id = cl.id
7212
                            AND sl.c_id = $courseId
7213
                            AND sl.links_user_id = $userId
7214
                        GROUP BY cl.title, cl.url";
7215
    		$results = StatsUtils::getManyResults2Col($sql);
7216
    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7217
    		if (is_array($results)) {
7218
    			for ($j = 0 ; $j < count($results) ; $j++) {
7219
    				$line .= $results[$j][0]."\n";
7220
    			}
7221
    		} else {
7222
    			$line=get_lang('NoResult');
7223
    		}
7224
    	} else {
7225
    		$new_view = substr_replace($view,'1',3,1);
7226
    	}
7227
    	return array($title_line, $line);
7228
    }
7229
@@ 7247-7270 (lines=24) @@
7244
7245
    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7246
7247
    	if (substr($view,4,1) == '1') {
7248
    		$new_view = substr_replace($view,'0',4,1);
7249
    		$title[1]= get_lang('DocumentsDetails');
7250
7251
    		$sql = "SELECT down_doc_path
7252
                        FROM $downloads_table
7253
                        WHERE c_id = $courseId
7254
                            AND down_user_id = $user_id
7255
                            AND down_session_id = $session_id
7256
                        GROUP BY down_doc_path";
7257
7258
    		$results = StatsUtils::getManyResults1Col($sql);
7259
    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7260
            $line = null;
7261
    		if (is_array($results)) {
7262
    			for ($j = 0 ; $j < count($results) ; $j++) {
7263
    				$line .= $results[$j]."\n";
7264
    			}
7265
    		} else {
7266
    			$line = get_lang('NoResult');
7267
    		}
7268
    	} else {
7269
    		$new_view = substr_replace($view,'1',4,1);
7270
    	}
7271
    	return array($title_line, $line);
7272
    }
7273