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

@@ 4133-4136 (lines=4) @@
4130
                        // round-up the coordinates
4131
                        $coords = explode('/',$user_answer);
4132
                        $user_array = '';
4133
                        foreach ($coords as $coord) {
4134
                            list($x,$y) = explode(';',$coord);
4135
                            $user_array .= round($x).';'.round($y).'/';
4136
                        }
4137
                        $user_array = substr($user_array,0,-1);
4138
                    } else {
4139
                        if (!empty($studentChoice)) {
@@ 4288-4291 (lines=4) @@
4285
                            //round-up the coordinates
4286
                            $coords = explode('/',$user_answer);
4287
                            $user_array = '';
4288
                            foreach ($coords as $coord) {
4289
                                list($x,$y) = explode(';',$coord);
4290
                                $user_array .= round($x).';'.round($y).'/';
4291
                            }
4292
                            $user_array = substr($user_array,0,-1);
4293
4294
                            if ($next) {