Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Email reminders for calendar events

From MoodleDocs

Introduction

Reminders are very useful for both students as well as teachers to recall their scheduled event before the actual moment. This project is about creating a set of reminders for Moodle calendar events and sending them automatically to relevant users on timely manner via Moodle message interface. It will be implemented as a local plugin to the Moodle.

Requirements

Moodle 2.2 required

Community Bonding Period

Milestones

  1. DONE - Refine the project proposal with Michael, Rossiani and the community
  2. DONE - Feature discussion
  3. DONE - Create mockups

Features

Following features are expecting to package with the reminders plugin.

1. Reminders can be sent by customizing according to each event type.
  • Separate message providers for each event type.
  • Ability to customize message content according to event type.
2. Administrator configurations
  • Administrator can enable/disable the process of sending reminders without uninstalling the plugin.
  • Ability to choose how many days ahead should the reminders be created for each event type.
    • Reminders can be created only by days.
    • Supported only fixed amount of days ahead such as 7 days, 3 days and 1 day.
  • Ability to keep/remove history of reminder events.
2. User configurations
  • User can select desired method of receiving reminder notifications on each message provider.

Coding Period

Milestones

1. DONE - Finalize the abstract architecture.
2. DONE - Implementing the basic structure of the plugin. (CONTRIB-3648)
  • DONE - Creating a suitable version file.
  • DONE - Creating a language file.
  • DONE - Creating a message provider file.
  • DONE - Creating a lib file for the cron function.
3. DONE - Implementing message providers for each event type. (CONTRIB-3659)
4. DONE - Providing a administrator settings page. (CONTRIB-3660)
5. DONE - Implementing necessary reminder classes. (CONTRIB-3669)
  • DONE - Creating abstract reminder class.
  • DONE - Creating concrete reminder classes for each event type.
6. DONE - Building functionality.
  • DONE - Generation of message content for reminders. (CONTRIB-3671)
  • DONE - Implementation of Cron function. (CONTRIB-3670)
  • DONE - Extending to support plugin for repeated events. (CONTRIB-3672)
7. IN PROGRESS - Testing
8. IN PROGRESS - Bug fixing

File Structure

Following shows expected file structure of the plugin. Plugin name would be "reminders".

  • contents/course_reminder.class.php
  • contents/site_reminder.class.php
  • contents/group_reminder.class.php
  • contents/user_reminder.class.php
  • contents/due_reminder.class.php
  • db/access.php
  • db/message.php
  • db/upgrade.php
  • lang/en/local_reminders.php
  • reminder.class.php
  • version.php
  • lib.php
  • settings.php
  • README

Explanation

Picking up relevant events to send reminders in advance is very important and critical. Reminders must be sent only once for a event on predefined ahead of days. Identifying such events has to be done efficiently and carefully. It shows below how it can be achieved.

Events are checked against a fixed amount of time period in each and every cron cycle.

If any of event is falling exactly 1, 3 or 7 days ahead for that checking time period, that event will be marked as a ready event to send reminders. In mathematically, if any event should satisfy to send reminders

       (t(Ei) - X > T1) AND (t(Ei) - X <= T2) AND (t(Ei) > T2)

Where t(Ei) is the start time of the event and X is a set of constants indicates 1,3 or 7 days in seconds.

That fixed amount of time period is decided as the timestamp different between last cron cycle (this timestamp is not the timestamp corresponding to the start of that cron cycle, but the time it began to check for its previous timeslot. This can be extracted from info field in log record) and current time.

1. If the running cron cycle is the first ever cron cycle (i.e. no log record could find for a previous cron cycle), then the time will be cutoff by X amount of days before as configured.

first cron.jpg

  • (t1,t2) is the time period the time period that cron is running.
  • (T1,T2) is the time period which will be checked against events. (T1-T2) will be a constant and will be used at most once.
2. Otherwise,

nth cron.jpg

  • (t1,t2) is the interval between two cron cycles as defined in plugin.
  • (T1,T2) is the time inspecting region. (T1 will be decided by log record for the last cron cycle)

High Level Architecture Diagram

overall architecture.jpg

Reminders Class Diagram

reminder class diagram 1.jpg

Mockups

Administrator Setting Page

reminders admin config page.jpg

Message Format (HTML)

  • Message Title : Reminder: ${event_detail} @ ${event_date_time}

message format HTML.jpg

Message Format (Plain-text)

  • Message Title : Reminder: ${event_detail} @ ${event_date_time}
  • Message Content:
${message_title}
Reminder - #n days remaining
When -> ${event_time}
What -> ${event_course} or ${event_type}
Description -> ${event_description}

Screenshots

Admin Settings Page

settings page 1.jpg

Sample e-mail reminder for course event

sample email reminder course.jpg

Sample e-mail reminder for due event

sample email reminder due.jpg

Credits

Tracker

See also