499 Add expiry dates to recipient list, verify
Add a new element, customcertelement_expiry, which represents the certificate's expiry date, 1-5 years from either the award date or the course completion date. This date is shown in the recipients table shown to the teacher and the verify page when this element is added to a certificate.
This PR is for the MOODLE_401_BRANCH. I also have branches for other supported versions: 499-expirydate-402, 499-expirydate-403 and 499-expirydate-404.
Notes on this proposed change:
- Because I didn't want to make the core mod_customcert code dependent on the new element I call
class_exists('\customcertelement_expiry\element')before calling its methods. - I added a new element because 1) I wanted it to be possible to start the expiry from the course completion date instead of the award date (only the latter was previously supported), and 2) I wanted to be able to display "Valid for one year" on the certificate, but still have a date appear in the recipients list.
- It's not possible to use activity completion as the start-from date, this could be added later.
- The expiry date shown in the recipients list and verify page is wrapped in
<span class="ok|soon|expired">so admins can change how this is displayed with CSS. - Bumped versions because date elements that show an expiry date are migrated in
db/upgrade.php. - Multiple expiry elements are allowed because customcertelement_dates are migrated to this new element, and there may be multiple instances of the old element. (If I wasn't migrating existing elements, I'd only allow a single element per certificate).
This is on my list to look at next. The code looks good from a quick glance, sorry for the delay.
Are you able to do a rebase on the latest as there are currently conflicts? A branch for 4.4, 4.3, 4.2 and 4.1 would be much appreciated but not essential as I can cherry-pick back and fix the upgrade dates etc.
Actually, don't worry about it ill resolve them myself. Ill look at putting this in 4.4 first then backporting from there, thanks.
Pushed up the code in 4.4, will see how GHA behaves and backport. Made a few minor adjustments and did some refactoring. Thanks for your hard work, much appreciated.