Code Duplication    Length = 21-24 lines in 2 locations

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

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