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: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 8: Line 8:


=== Milestones ===
=== Milestones ===
# Refine the project proposal with Michael and the community
# DONE - Refine the project proposal with Michael, Rossiani and the community
# Feature discussion
# DONE - Feature discussion
# Create mockups
# DONE - Create mockups


=== Features ===
=== Features ===
Following features are expecting to package with the reminders plugin.
Following features are expecting to package with the reminders plugin.


:1. Administrator configurations
: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.
::* 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 every due event in Moodle calendar.
::* Ability to choose how many days ahead should the reminders be created ''for each event type''.
::** Reminders can be created only by days.
::** Reminders can be created only by days.
::** Supported only fixed amount of days ahead such as 7 days, 5 days, 3 days and 1 day.
::** 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
:2. User configurations
::* User can select desired method of receiving reminder notifications on corresponding message provider.
::* User can select desired method of receiving reminder notifications on each message provider.


== Coding Period ==
== Coding Period ==
Line 27: Line 31:
=== Milestones ===
=== Milestones ===


:1. Finalize the overall architecture.
:1. DONE - Finalize the abstract architecture.
:2. Finalize file structure and database table schema.
:2. DONE - Implementing the basic structure of the plugin. (CONTRIB-3648)
:3. Building the basic structure of the plugin - Implementation Phase 1
::* DONE - Creating a suitable version file.
::* Creating a suitable version file.
::* DONE - Creating a language file.
::* Define the database structure in XMLDB file.
::* DONE - Creating a message provider file.
::* Define capabilities.
::* DONE - Creating a lib file for the cron function.
::* Define the message provider.
:3. DONE - Implementing message providers for each event type. (CONTRIB-3659)
::* Define a set of administrator page settings
:4. DONE - Providing a administrator settings page. (CONTRIB-3660)
::** Implement an option for enabling/disabling reminder.
:5. DONE - Implementing necessary reminder classes. (CONTRIB-3669)
::** Implement a set of options to configure per-defined number of days ahead which reminders should be invoked.
::* DONE - Creating abstract reminder class.
::* Implement the initial script to be run.
::* DONE - Creating concrete reminder classes for each event type.
::* Creating a language file.
:6. DONE - Building functionality.
:4. Building functions - Implementation Phase 2
::* DONE - Generation of message content for reminders. (CONTRIB-3671)
::* Creating a suitable version file.
::* 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 ===
=== 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/access.php
* db/message.php
* db/message.php
* db/install.php
* db/install.xml
* db/upgrade.php
* db/upgrade.php
* db/events.php
* lang/en/local_reminders.php
* lang/en/local_reminders.php
* reminder.class.php
* version.php
* version.php
* lib.php
* lib.php
Line 57: Line 67:
* README
* README


=== Database Structure ===
=== Explanation ===
A single database will be used to store these reminders. Following shows its structure. (Subject to change)
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)


{| class="nicetable"
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.
|-
! Field
! Type
! width="500" | Description
|-
| id
| bigint(10)
| Primary key for reminder records.
|-
| eventid
| bigint(10)
| Foreign key for corresponding event.
|-
| daysahead
| bigint(10)
| Number of days ahead such that reminder should be invoked.
|-
| enabled
| smallint(4)
| Indicates whether this single reminder is enabled or not. Disabled reminder will not be invoked only for that time. If it has been found enabled later, then it would be invoked.
|-
| mailed
| smallint(4)
| Indicates whether this reminder has been already mailed. Mailed reminders will be deleted after sometime.
|}


=== Architecture Diagram ===
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.
[[File: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,
[[File: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 ===
 
[[File:overall_architecture.jpg]]
 
=== Reminders Class Diagram ===
[[File:reminder_class_diagram_1.jpg]]
 
== Mockups ==
=== Administrator Setting Page ===
[[File:reminders_admin_config_page.jpg]]
 
=== Message Format (HTML) ===
* Message Title : Reminder: ${event_detail} @ ${event_date_time}
 
[[File: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 ==
== Screenshots ==
=== Admin Settings Page ===
[[File:settings_page_1.jpg]]
=== Sample e-mail reminder for course event ===
[[File:sample_email_reminder_course.jpg]]
=== Sample e-mail reminder for due event ===
[[File:sample_email_reminder_due.jpg]]
== Credits ==
* Mentors: [http://moodle.org/user/view.php?id=381842&course=5 Michael de Raadt] and [http://moodle.org/user/view.php?id=955449&course=5 Rossiani Wijaya]
* Special thanks goes to [http://moodle.org/user/profile.php?id=1297063 Luiggi Sansonetti] who translated the plugin into French language.
* Another thank goes to Guido Roessling for providing a German translation for this plugin
== Tracker ==
* CONTRIB-3647 Automating Email reminders for calendar events
== See also ==
* Plugin development [https://github.com/isuru89/moodle-reminders-for-calendar-events Repository]
* [https://docs.moodle.org/dev/Projects_for_new_developers Moodle - Google Summer of Code 2012 Idea List]
* [http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/isuru89/1 Original Proposal - GSoC 2012]
* RSS Feed from Personal Blog, [http://uisurumadushanka89.blogspot.com/feeds/posts/default/-/gsoc RSS Feed].

Latest revision as of 11:54, 6 September 2012

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