Code Duplication    Length = 4-6 lines in 5 locations

main/exercice/hotspot_savescore.inc.php 1 location

@@ 33-36 (lines=4) @@
30
//round-up the coordinates
31
$coords = explode('/',$coordinates);
32
$coordinates = '';
33
foreach ($coords as $coord) {
34
    list($x,$y) = explode(';',$coord);
35
    $coordinates .= round($x).';'.round($y).'/';
36
}
37
$coordinates = substr($coordinates,0,-1);
38
39
$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);

main/exercice/hotspot_updatescore.inc.php 1 location

@@ 44-47 (lines=4) @@
41
//round-up the coordinates
42
$coords = explode('/',$coordinates);
43
$coordinates = '';
44
foreach ($coords as $coord) {
45
    list($x,$y) = explode(';',$coord);
46
    $coordinates .= round($x).';'.round($y).'/';
47
}
48
$coordinates = substr($coordinates,0,-1);
49
50
$TBL_TRACK_E_HOTSPOT   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);

main/exercice/exercise_submit_modal.php 1 location

@@ 76-81 (lines=6) @@
73
    $coords = explode('/', $_GET['hotspot']);
74
75
    if (is_array($coords) && count($coords) > 0) {
76
        foreach ($coords as $coord) {
77
            if (!empty($coord)) {
78
                list($x, $y) = explode(';', $coord);
79
                $user_array .= round($x).';'.round($y).'/';
80
            }
81
        }
82
    }
83
}
84

main/exercice/exercise.class.php 2 locations

@@ 4148-4151 (lines=4) @@
4145
                        // round-up the coordinates
4146
                        $coords = explode('/',$user_answer);
4147
                        $user_array = '';
4148
                        foreach ($coords as $coord) {
4149
                            list($x,$y) = explode(';',$coord);
4150
                            $user_array .= round($x).';'.round($y).'/';
4151
                        }
4152
                        $user_array = substr($user_array,0,-1);
4153
                    } else {
4154
                        if (!empty($studentChoice)) {
@@ 4303-4306 (lines=4) @@
4300
                            //round-up the coordinates
4301
                            $coords = explode('/',$user_answer);
4302
                            $user_array = '';
4303
                            foreach ($coords as $coord) {
4304
                                list($x,$y) = explode(';',$coord);
4305
                                $user_array .= round($x).';'.round($y).'/';
4306
                            }
4307
                            $user_array = substr($user_array,0,-1);
4308
4309
                            if ($next) {