Code Duplication    Length = 11-21 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 7515-7525 (lines=11) @@
7512
        } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
7513
            // Question is a HOT_SPOT
7514
            //checking document/images visibility
7515
            if (api_is_platform_admin() || api_is_course_admin()) {
7516
                $course = api_get_course_info();
7517
                $doc_id = DocumentManager::get_document_id($course, '/images/'.$pictureName);
7518
                if (is_numeric($doc_id)) {
7519
                    $images_folder_visibility = api_get_item_visibility($course, 'document', $doc_id, api_get_session_id());
7520
                    if (!$images_folder_visibility) {
7521
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
7522
                        Display::display_warning_message(get_lang('ChangeTheVisibilityOfTheCurrentImage'));
7523
                    }
7524
                }
7525
            }
7526
            $questionName = $objQuestionTmp->selectTitle();
7527
            $questionDescription = $objQuestionTmp->selectDescription();
7528

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

@@ 1120-1140 (lines=21) @@
1117
            global $exerciseId, $exe_id;
1118
            // Question is a HOT_SPOT
1119
            //checking document/images visibility
1120
            if (api_is_platform_admin() || api_is_course_admin()) {
1121
                $course = api_get_course_info();
1122
                $doc_id = DocumentManager::get_document_id(
1123
                    $course,
1124
                    '/images/' . $pictureName
1125
                );
1126
                if (is_numeric($doc_id)) {
1127
                    $images_folder_visibility = api_get_item_visibility(
1128
                        $course,
1129
                        'document',
1130
                        $doc_id,
1131
                        api_get_session_id()
1132
                    );
1133
                    if (!$images_folder_visibility) {
1134
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
1135
                        Display::display_warning_message(
1136
                            get_lang('ChangeTheVisibilityOfTheCurrentImage')
1137
                        );
1138
                    }
1139
                }
1140
            }
1141
            $questionName = $objQuestionTmp->selectTitle();
1142
            $questionDescription = $objQuestionTmp->selectDescription();
1143