Code Duplication    Length = 21-24 lines in 2 locations

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

@@ 7216-7236 (lines=21) @@
7213
        $courseId = api_get_course_int_id($courseCode);
7214
        $userId = intval($userId);
7215
        $line = null;
7216
    	if (substr($view,3,1) == '1') {
7217
    		$new_view = substr_replace($view,'0',3,1);
7218
    		$title[1]=get_lang('LinksDetails');
7219
    		$sql = "SELECT cl.title, cl.url
7220
                        FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7221
                        WHERE sl.links_link_id = cl.id
7222
                            AND sl.c_id = $courseId
7223
                            AND sl.links_user_id = $userId
7224
                        GROUP BY cl.title, cl.url";
7225
    		$results = StatsUtils::getManyResults2Col($sql);
7226
    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7227
    		if (is_array($results)) {
7228
    			for ($j = 0 ; $j < count($results) ; $j++) {
7229
    				$line .= $results[$j][0]."\n";
7230
    			}
7231
    		} else {
7232
    			$line=get_lang('NoResult');
7233
    		}
7234
    	} else {
7235
    		$new_view = substr_replace($view,'1',3,1);
7236
    	}
7237
    	return array($title_line, $line);
7238
    }
7239
@@ 7257-7280 (lines=24) @@
7254
7255
    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7256
7257
    	if (substr($view,4,1) == '1') {
7258
    		$new_view = substr_replace($view,'0',4,1);
7259
    		$title[1]= get_lang('DocumentsDetails');
7260
7261
    		$sql = "SELECT down_doc_path
7262
                        FROM $downloads_table
7263
                        WHERE c_id = $courseId
7264
                            AND down_user_id = $user_id
7265
                            AND down_session_id = $session_id
7266
                        GROUP BY down_doc_path";
7267
7268
    		$results = StatsUtils::getManyResults1Col($sql);
7269
    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7270
            $line = null;
7271
    		if (is_array($results)) {
7272
    			for ($j = 0 ; $j < count($results) ; $j++) {
7273
    				$line .= $results[$j]."\n";
7274
    			}
7275
    		} else {
7276
    			$line = get_lang('NoResult');
7277
    		}
7278
    	} else {
7279
    		$new_view = substr_replace($view,'1',4,1);
7280
    	}
7281
    	return array($title_line, $line);
7282
    }
7283