Code Duplication    Length = 11-21 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 7464-7474 (lines=11) @@
7461
        } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
7462
            // Question is a HOT_SPOT
7463
            //checking document/images visibility
7464
            if (api_is_platform_admin() || api_is_course_admin()) {
7465
                $course = api_get_course_info();
7466
                $doc_id = DocumentManager::get_document_id($course, '/images/'.$pictureName);
7467
                if (is_numeric($doc_id)) {
7468
                    $images_folder_visibility = api_get_item_visibility($course, 'document', $doc_id, api_get_session_id());
7469
                    if (!$images_folder_visibility) {
7470
                        //This message is shown only to the course/platform admin if the image is set to visibility = false
7471
                        Display::display_warning_message(get_lang('ChangeTheVisibilityOfTheCurrentImage'));
7472
                    }
7473
                }
7474
            }
7475
            $questionName = $objQuestionTmp->selectTitle();
7476
            $questionDescription = $objQuestionTmp->selectDescription();
7477

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

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