Code Duplication    Length = 7-7 lines in 2 locations

main/exercice/exercise.class.php 2 locations

@@ 5665-5671 (lines=7) @@
5662
        }
5663
5664
        // Deleted exercise.
5665
        if ($this->active == -1) {
5666
            return array(
5667
                'value' => false,
5668
                'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5669
                'rawMessage' => get_lang('ExerciseNotFound')
5670
            );
5671
        }
5672
5673
        // Checking visibility in the item_property table.
5674
        $visibility = api_get_item_visibility(
@@ 5688-5694 (lines=7) @@
5685
        // 2. If the exercise is not active.
5686
        if (empty($lpId)) {
5687
            // 2.1 LP is OFF
5688
            if ($this->active == 0) {
5689
                return array(
5690
                    'value' => false,
5691
                    'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false),
5692
                    'rawMessage' => get_lang('ExerciseNotFound')
5693
                );
5694
            }
5695
        } else {
5696
            // 2.1 LP is loaded
5697
            if ($this->active == 0 && !learnpath::is_lp_visible_for_student($lpId, api_get_user_id())) {