Code Duplication    Length = 11-21 lines in 2 locations

main/inc/lib/exercise.lib.php 1 location

@@ 1101-1121 (lines=21) @@
1098
            global $exerciseId, $exe_id;
1099
            // Question is a HOT_SPOT
1100
            //checking document/images visibility
1101
            if (api_is_platform_admin() || api_is_course_admin()) {
1102
                $course = api_get_course_info();
1103
                $doc_id = DocumentManager::get_document_id(
1104
                    $course,
1105
                    '/images/' . $pictureName
1106
                );
1107
                if (is_numeric($doc_id)) {
1108
                    $images_folder_visibility = api_get_item_visibility(
1109
                        $course,
1110
                        'document',
1111
                        $doc_id,
1112
                        api_get_session_id()
1113
                    );
1114
                    if (!$images_folder_visibility) {
1115
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
1116
                        Display::display_warning_message(
1117
                            get_lang('ChangeTheVisibilityOfTheCurrentImage')
1118
                        );
1119
                    }
1120
                }
1121
            }
1122
            $questionName = $objQuestionTmp->selectTitle();
1123
            $questionDescription = $objQuestionTmp->selectDescription();
1124

main/exercice/exercise.class.php 1 location

@@ 7453-7463 (lines=11) @@
7450
        } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
7451
            // Question is a HOT_SPOT
7452
            //checking document/images visibility
7453
            if (api_is_platform_admin() || api_is_course_admin()) {
7454
                $course = api_get_course_info();
7455
                $doc_id = DocumentManager::get_document_id($course, '/images/'.$pictureName);
7456
                if (is_numeric($doc_id)) {
7457
                    $images_folder_visibility = api_get_item_visibility($course, 'document', $doc_id, api_get_session_id());
7458
                    if (!$images_folder_visibility) {
7459
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
7460
                        Display::display_warning_message(get_lang('ChangeTheVisibilityOfTheCurrentImage'));
7461
                    }
7462
                }
7463
            }
7464
            $questionName = $objQuestionTmp->selectTitle();
7465
            $questionDescription = $objQuestionTmp->selectDescription();
7466