Code Duplication    Length = 4-6 lines in 5 locations

main/exercise/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/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.class.php 2 locations

@@ 4179-4182 (lines=4) @@
4176
                        // round-up the coordinates
4177
                        $coords = explode('/',$user_answer);
4178
                        $user_array = '';
4179
                        foreach ($coords as $coord) {
4180
                            list($x,$y) = explode(';',$coord);
4181
                            $user_array .= round($x).';'.round($y).'/';
4182
                        }
4183
                        $user_array = substr($user_array,0,-1);
4184
                    } else {
4185
                        if (!empty($studentChoice)) {
@@ 4335-4338 (lines=4) @@
4332
                            //round-up the coordinates
4333
                            $coords = explode('/',$user_answer);
4334
                            $user_array = '';
4335
                            foreach ($coords as $coord) {
4336
                                list($x,$y) = explode(';',$coord);
4337
                                $user_array .= round($x).';'.round($y).'/';
4338
                            }
4339
                            $user_array = substr($user_array,0,-1);
4340
4341
                            if ($next) {