Code Duplication    Length = 11-21 lines in 2 locations

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

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

main/exercise/exercise.class.php 1 location

@@ 7606-7616 (lines=11) @@
7603
        } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
7604
            // Question is a HOT_SPOT
7605
            //checking document/images visibility
7606
            if (api_is_platform_admin() || api_is_course_admin()) {
7607
                $course = api_get_course_info();
7608
                $doc_id = DocumentManager::get_document_id($course, '/images/'.$pictureName);
7609
                if (is_numeric($doc_id)) {
7610
                    $images_folder_visibility = api_get_item_visibility($course, 'document', $doc_id, api_get_session_id());
7611
                    if (!$images_folder_visibility) {
7612
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
7613
                        Display::display_warning_message(get_lang('ChangeTheVisibilityOfTheCurrentImage'));
7614
                    }
7615
                }
7616
            }
7617
            $questionName = $objQuestionTmp->selectTitle();
7618
            $questionDescription = $objQuestionTmp->selectDescription();
7619