Code Duplication    Length = 11-21 lines in 2 locations

main/exercise/exercise.class.php 1 location

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

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

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