Skip to content
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

499 Add expiry dates to recipient list, verify #633

Closed

Conversation

leonstr
Copy link
Contributor

@leonstr leonstr commented Jul 23, 2024

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.

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.
@leonstr
Copy link
Contributor Author

leonstr commented Jul 23, 2024

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:

  1. 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.
  2. 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.
  3. It's not possible to use activity completion as the start-from date, this could be added later.
  4. 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.
  5. Bumped versions because date elements that show an expiry date are migrated in db/upgrade.php.
  6. 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).

@leonstr leonstr mentioned this pull request Jul 23, 2024
@mdjnelson
Copy link
Owner

mdjnelson commented Aug 18, 2024

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.

@mdjnelson
Copy link
Owner

Actually, don't worry about it ill resolve them myself. Ill look at putting this in 4.4 first then backporting from there, thanks.

@mdjnelson
Copy link
Owner

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.

@mdjnelson mdjnelson closed this Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants