Top Active Courses Block - Release Notes
🚀 New Features
Mustache Templating
- Switched to modern templating system: Replaced inline HTML generation with Mustache templates for better maintainability and customization
- Template-based course tiles: Course tiles are now rendered using
templates/course_tiles.mustache
Course Tags Display
- Tag display per course: Shows up to configurable number of tags under each course title
- Configurable tag limit: New setting
max_tags allows administrators to control how many tags are displayed per course (default: 5)
- Modern tag design: Tags are displayed as stylish badges with hover effects
Enhanced Enrolment Method Support
- Flexible enrolment filtering: Improved from hardcoded 'self' enrolment to dynamic
can_self_enrol() method checking
- Ignore enrolment methods option: New setting
ignore_enrolment_methods allows showing all active courses regardless of enrolment method
- Better compatibility: Works with various Moodle enrolment plugins that implement
can_self_enrol()
🎨 UI/UX Improvements
Responsive Design
- Drawer optimization: Course tiles automatically adapt to sidebar/drawer layout
- Improved CSS specificity: Fixed text decoration issues in various Moodle themes
- Modern badge styling: Course tags use consistent design language with other Moodle components
⚙️ New Settings
Max Tags per Course (max_tags)
- Controls number of tags displayed per course
- Default: 5 tags
- Validation: Must be numeric and > 0
Ignore Enrolment Methods (ignore_enrolment_methods)
- Checkbox to bypass enrolment method filtering
- Shows all active courses when enabled
- Useful for open course catalogs
🔧 Code Quality Improvements
Refactoring for Maintainability
- Reduced cyclomatic complexity: Split complex methods into smaller, focused functions
- Better separation of concerns: Course data preparation, enrolment checking, and rendering are now separate methods
- Improved testability: Smaller functions make unit testing easier
New Helper Methods
prepare_course_data(): Prepares course data for template rendering
can_user_access_course(): Centralized course access checking
get_course_image(): Course image retrieval with fallback
get_max_tags_limit(): Tag limit configuration helper
get_course_tags(): Tag retrieval and limiting
should_include_course(): Course inclusion logic
can_self_enrol_in_course(): Self-enrolment possibility checking
🐛 Bug Fixes
- CSS specificity issues: Fixed text-decoration conflicts with core Moodle styles
- Parameter validation: Improved handling of invalid configuration values
📚 Documentation
- Enhanced code documentation: All new methods have comprehensive PHPDoc blocks
- Template documentation: Mustache template includes usage examples and context description
Installation/Upgrade Notes
- Clear caches after installation/upgrade
- Review new settings in Site Administration ' Plugins ' Blocks ' Top Active Courses
- Check custom CSS if you have theme customizations targeting course tiles
- Test enrolment filtering with your specific enrolment methods
Author
- Sadik Mert
E-Mail: sadikmert@hotmail.de
License
This plugin is licensed under the GNU General Public License v3.0. See the LICENSE file for details.