-
Notifications
You must be signed in to change notification settings - Fork 82
Feat: add quiz type circle image #2347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saadman30
wants to merge
11
commits into
4.0.0-dev
Choose a base branch
from
feat/quiz-type-circle-image
base: 4.0.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Introduced a new question type 'draw_image' in the curriculum components. - Updated Question, QuestionConditions, QuestionForm, and QuestionList to support the new question type. - Implemented DrawImage component for handling drawing on images. - Enhanced Quiz class to process answers for draw_image questions. - Added necessary translations and icons for the new question type.
- Added support for 'draw_image' question type in the quiz, allowing users to draw on images. - Updated JavaScript logic to handle answer validation and reveal mode for draw_image questions. - Enhanced PHP classes to save and process the drawn image mask. - Improved UI to display student submissions and instructor references for draw_image questions. - Added necessary translations and updated quiz attempt details to reflect new functionality.
- Removed "(R&D)" from the label of the 'draw_image' question type in both QuestionConditions and QuestionList components for clarity and consistency. - Ensured translations are updated accordingly in the 'tutor' text domain.
- Streamlined the logic for handling student-submitted masks in the 'draw_image' question type. - Removed redundant code and ensured that the answer is processed correctly from the nested structure. - Improved code readability and maintainability by consolidating answer extraction logic.
- Updated comments for clarity on handling raw base64 or URL inputs in the 'draw_image' question type. - Ensured that the URL returned from saving the drawn image mask is properly sanitized using esc_url_raw. - Enhanced code readability by clarifying the sanitization process for different input types.
- Improved handling of base64 and URL inputs for the 'draw_image' question type. - Added security checks to ensure only local uploads are accepted, rejecting external URLs. - Clarified comments and improved code readability regarding image saving and processing. - Ensured that the saved image is always stored with a .png extension for consistency.
… type - Updated comments to specify that masks are stored as local file URLs only. - Improved condition checks to ensure only valid local URLs are processed for student and instructor submitted drawings. - Enhanced code readability by removing redundant checks and ensuring consistent use of esc_url for outputting image URLs.
harunollyo
requested changes
Feb 3, 2026
views/quiz/attempt-details.php
Outdated
|
|
||
| if ( $instructor_answer && $ref_mask_is_url ) { | ||
| $ref_bg = ''; | ||
| if ( ! empty( $instructor_answer->image_id ) ) { |
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of code is duplicate. We can reuse it by moving to to QuizModel with a method
- Refactored the draw image mask functionality by moving the saving logic from Utils to QuizModel for better organization. - Updated references in Quiz and QuizBuilder classes to utilize the new QuizModel method. - Improved code clarity by enhancing comments and ensuring consistent handling of base64 and URL inputs. - Removed deprecated save_quiz_draw_image_mask method from Utils to streamline the codebase.
- Updated the URL validation logic for student and instructor submitted drawing masks to use wp_http_validate_url for enhanced security. - Ensured consistent handling of URLs across the quiz attempt details view. - Improved code clarity by maintaining a uniform approach to URL checks.
- Updated the upload_base64_image method to include an optional parameter for adding the uploaded file to the WordPress media library. - Improved documentation to clarify the behavior of the method when the new parameter is set to false, ensuring it returns an ID of 0. - Streamlined the image upload process in QuizModel by utilizing the updated method for handling base64 images.
- Added a new filter for processing draw image answers in the Quiz class to allow for custom handling. - Introduced a method in QuizModel to retrieve the full image URL for quiz answers, improving code reusability and clarity. - Updated the quiz attempt details view to utilize the new method for fetching image URLs, streamlining the code and enhancing maintainability.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.