Code Duplication    Length = 4-6 lines in 5 locations

main/exercise/hotspot_savescore.inc.php 1 location

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

main/exercise/hotspot_updatescore.inc.php 1 location

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

main/exercise/exercise_submit_modal.php 1 location

@@ 63-68 (lines=6) @@
60
if (isset($_GET['hotspot'])) {
61
    $coords = explode('/', $_GET['hotspot']);
62
    if (is_array($coords) && count($coords) > 0) {
63
        foreach ($coords as $coord) {
64
            if (!empty($coord)) {
65
                list($x, $y) = explode(';', $coord);
66
                $user_array .= round($x).';'.round($y).'/';
67
            }
68
        }
69
    }
70
}
71

main/exercise/exercise.class.php 2 locations

@@ 4196-4199 (lines=4) @@
4193
                        // round-up the coordinates
4194
                        $coords = explode('/', $user_answer);
4195
                        $user_array = '';
4196
                        foreach ($coords as $coord) {
4197
                            list($x, $y) = explode(';', $coord);
4198
                            $user_array .= round($x).';'.round($y).'/';
4199
                        }
4200
                        $user_array = substr($user_array, 0, -1);
4201
                    } else {
4202
                        if (!empty($studentChoice)) {
@@ 4380-4383 (lines=4) @@
4377
                            //round-up the coordinates
4378
                            $coords = explode('/', $user_answer);
4379
                            $user_array = '';
4380
                            foreach ($coords as $coord) {
4381
                                list($x, $y) = explode(';', $coord);
4382
                                $user_array .= round($x).';'.round($y).'/';
4383
                            }
4384
                            $user_array = substr($user_array, 0, -1);
4385
4386
                            if ($next) {