Code Duplication    Length = 4-6 lines in 5 locations

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/hotspot_savescore.inc.php 1 location

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

main/exercice/exercise_submit_modal.php 1 location

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

main/exercice/exercise.class.php 2 locations

@@ 4091-4094 (lines=4) @@
4088
                        // round-up the coordinates
4089
                        $coords = explode('/',$user_answer);
4090
                        $user_array = '';
4091
                        foreach ($coords as $coord) {
4092
                            list($x,$y) = explode(';',$coord);
4093
                            $user_array .= round($x).';'.round($y).'/';
4094
                        }
4095
                        $user_array = substr($user_array,0,-1);
4096
                    } else {
4097
                        if (!empty($studentChoice)) {
@@ 4246-4249 (lines=4) @@
4243
                            //round-up the coordinates
4244
                            $coords = explode('/',$user_answer);
4245
                            $user_array = '';
4246
                            foreach ($coords as $coord) {
4247
                                list($x,$y) = explode(';',$coord);
4248
                                $user_array .= round($x).';'.round($y).'/';
4249
                            }
4250
                            $user_array = substr($user_array,0,-1);
4251
4252
                            if ($next) {