Code Duplication    Length = 10-11 lines in 3 locations

main/inc/lib/thematic.lib.php 3 locations

@@ 1138-1147 (lines=10) @@
1135
        $user_id       = api_get_user_id();
1136
1137
        $all = array();
1138
        if (!empty($thematic_data)) {
1139
            foreach ($thematic_data as $thematic) {
1140
                $thematic_id = $thematic['id'];
1141
                if (!empty($thematic_advance_data[$thematic['id']])) {
1142
                    foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
1143
                        $all[] = $thematic_advance['id'];
1144
                    }
1145
                }
1146
            }
1147
        }
1148
        $error = null;
1149
        $a_thematic_advance_ids = array();
1150
        $course_id = api_get_course_int_id();
@@ 1250-1260 (lines=11) @@
1247
1248
        $a_thematic_advance_ids = array();
1249
        $last_done_advance_id = 0;
1250
        if (!empty($thematic_data)) {
1251
            foreach ($thematic_data as $thematic) {
1252
                if (!empty($thematic_advance_data[$thematic['id']])) {
1253
                    foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
1254
                        if ($thematic_advance['done_advance'] == 1) {
1255
                            $a_thematic_advance_ids[] = $thematic_advance['id'];
1256
                        }
1257
                    }
1258
                }
1259
            }
1260
        }
1261
        if (!empty($a_thematic_advance_ids)) {
1262
            $last_done_advance_id = array_pop($a_thematic_advance_ids);
1263
            $last_done_advance_id = intval($last_done_advance_id);
@@ 1280-1290 (lines=11) @@
1277
        $thematic_advance_data = $this->get_thematic_advance_list();
1278
        $a_thematic_advance_ids = array();
1279
        $next_advance_not_done = 0;
1280
        if (!empty($thematic_data)) {
1281
            foreach ($thematic_data as $thematic) {
1282
                if (!empty($thematic_advance_data[$thematic['id']])) {
1283
                    foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
1284
                        if ($thematic_advance['done_advance'] == 0) {
1285
                            $a_thematic_advance_ids[] = $thematic_advance['id'];
1286
                        }
1287
                    }
1288
                }
1289
            }
1290
        }
1291
1292
        if (!empty($a_thematic_advance_ids)) {
1293
            for ($i = 0; $i < $offset; $i++) {