Reminder

Summary: Birthday, anniversary and other task reminders
Version: 20231109
Prerequisites: PmWiki 2.3.1 or more recent.
Status: Stable
Maintainer: Petko
Categories: Calendar, PIM, GTD, PHP55, PHP72, PHP74, PHP82
Discussion: Reminder-Talk
License: GPL2+

Real life example

Description

Use PmWiki to display yearly, monthly and weekly reminders.

I use PmWiki to store all sorts of information: notes, code snippets, links, project outlines, document drafts, news (RSS, weather) etc. I need it to also display a list of reminders/birthdays/tasks (weekly, monthly and yearly) on my browser homepage.

Installation

 include_once("$FarmD/cookbook/reminder.php");
  • Add this CSS code to your /pub/css/local.css file:
/* reminder */
ul.reminder {padding: 0px;}
ul.reminder li.date {list-style-type:none; font-weight: bold;
	border-top: 1px solid #c00; background-color: #f8f8ff;
	margin: 1px; padding: 0px; text-align:right;}

ul.reminder li.date ul {background-color: #fff;
	text-align:left;font-weight: normal;
	padding: 1px 1px 1px 1em; margin:0;}
ul.reminder li.date ul li {list-style-type:square;}
ul.reminder li.today {border: 2px solid #c00;
	border-bottom-width: 1px; background-color: white;
	font-size: 1.2em; color:black;}

ul.reminder li.past {color: #777;}
ul.reminder li.future {color: black;}

ul.reminder li.overdue, ul.reminder li.unknown {background-color: #ffa;}
ul.reminder li.w0, ul.reminder li.w6 {background-color: #dfd;}
ul.reminder li.date ul li.multiple {background-color: #f8f8ff;
	list-style-type:none; text-align:center;}

Usage

In a wiki page, use the markup: (:reminder Group.Page#start#end:) or:

(:rem pastdays=3 futuredays=11:)
Weekly reminders:
* w2 A Tuesday reminder
* w35 Soccer: Wednesday and Friday

Monthly reminders:
* 27 %red% '''Pay rent''' %%
* 5 Pay cable

Yearly reminders:
* 19/4/2008 Birthday of the Cookbook.Reminder recipe
* 14/7 National holiday in France

Multiple days:
* 29/4..6/5/2009 Trip to Vienna %item bgcolor=#fee%
(:remend:)

Note: default is the European way to write dates, "day/month", but you can change this with the variable $ReminderDayMonth, see below.

Every day, this wiki page will display all reminders for the past 3 days and for 11 next days, like a tickler file. It can also display a full month with tasks/reminders.

Markup parameters

  • Group.Page#start#end : define an external page or section containing the list of reminders. This should be the first parameter, and the syntax is identical to that of the (:include:) directive.
  • pastdays=3 futuredays=11 : how many days back and forward to display; default is 3..7
  • emptydays=0 : do not display dates with no reminders; default is 1 : display all dates.
  • onemonth=4 : "monthly" mode: display the full month of April (4), May (5) etc.; this parameter overrides "pastdays=" and "futuredays=". You can also call your wiki page with this parameter like [[{*$Name}?onemonth=10]] to display directly the full month of October.

You can change the default values by adding some Admin variables to config.php, see below.

Admin variables in config.php

You can customize the default settings by adding the following lines of code to config.php before including the recipe.

  • $ReminderPastDays = 2; : see parameter pastdays=, default is 3
  • $ReminderFutureDays = 11; : see parameter futuredays=, default is 7
  • $ReminderDayMonth = "m/d"; : how do you write the day/month string. Can be either "d/m" or "m/d". Note: default is the European way to write dates, "d/m".
  • $ReminderDateFormat = "%A, %B %e, %Y"; : see the "format" for the PHP function strftime, default is "%A, %e %B %Y"
  • $EnableReminderEmptyDays = 0; : see parameter emptydays=, default is 1.
  • $ReminderWeeklyFix = 1; : for weekly reminders, change w1=Sunday w0,w7=Saturday (default is w1=Monday w0,w7=Sunday, see below)
  • $ReminderIncludeSuffix = ' [[{$Group}/{$Name}]]'; If you use the #include line, this setting will append to the reminder line a link to the included page (note the single quotes).

Reminders format

All reminders are written between (:rem:)...(:remend:) in the following format:

  • the reminder line starts with one asterisk ("*") and after it, possibly space(s)
  • then, the date, a string with no whitespace, and after it space(s)
  • then, the reminder title (it can contain links, wiki styles and formatting).

Any line that does not match the above description is considered a comment and is ignored (except for #include).

Date: the script recognizes the following date formats:

  • w2, w45 : a weekly task, displayed every Monday (w1), Tuesday (w2) etc. Sunday is w0 or w7. You can set more than one day, w45 means every Thursday and every Friday. See also $ReminderWeeklyFix.
  • 12 : a monthly task, displayed April 12, May 12, June 12, etc. This is just one number<=31.
    • 0 : last day of the month; -1, -2 : the day before the last one
  • 19/4/1977 : (the year part, "/1977" is not required) : an yearly task, to be displayed every April 19. This is meant to display birthdays; if the year is written, the line will also display the difference between now and the date, as in 2008-1977: 31 (see the attached screenshot).
  • 24/12..4/1/2010 : something to be displayed every day from December 24, 2009, to January 4, 2010. Useful to mark holidays or trips. The year part is not required (and if missing, the event will be repeated every year). Note that only the end-date can contain a year part.
  • =w1, =22, =22/4, =1/5/2008 : set a one-time, "sticky" reminder. When the date of the reminder passes, the other types of reminders are reset for the next year (or month, or week); this reminder here will stick to the top of the display, before the currently active reminders, until you delete it or reset it manually to a later date. This means you *will* see that you missed it, even if you don't look at your reminders for a week or two.
    The sample dates here mean "next Monday", "next 22", "next April 22", "first of May 2008". On saving the page, this date format is automatically translated to the ISO format =YYYY-MM-DD.

Special date formats (experimental):

  • 10/10/2023r4, 11/11/2023r2w : Custom intervals, with a starting date, then repeated every N days or weeks.
  • 4w4@11, 0w7@3 : Nth Weekday of Month. This allows you to set something like
    • 4w4@11 : the fourth Thursday of November (Thanksgiving).
    • 1w1@10 : the first Monday of October (World Architects' day).
    • 0w7@3 the last Sunday of March (DST start in Europe). Note that 0=last, -1=penultimate.
  • WE+0, WE-7, WE+7w, EE+0, EE+14, EE-10w : Easter dates, something to be displayed on a date related to Easter, with "WE" meaning Western Easter (Catholic, Protestant), and "EE" meaning Eastern Easter (Orthodox), and the +/- number is the number of days (with "w" = weeks) before or after the Easter date in that year.

Time: daily reminders are sorted by the time, if a time format is found somewhere in the reminder's title. The script recognizes the following time formats:

  • #h, ##h##, ##:##, ##:## am/pm, ##h am/pm.

The time should be separated from other words by spaces.

External data pages

You can have an external page with headings and sections, containing the reminders in the specified format. Then, with the markup (:reminder Group.Page#start#end:) use this page instead of (or in addition to) the data block between (:rem:)...(:remend:).

From the same datapage, it is possible to display different categories of reminders on different pages, for example:

  • (:reminder Page:) show all reminders
  • (:reminder Page#public#publicend:) show public reminders only
  • (:reminder Page#birthdays:) show birthdays only

You can structure your data page with [[#section]] anchors, as you would do with the (:include:) directive.

From version 20080917, you can include multiple other pages or sections with this format between (:rem:)...(:remend:) tags:

 #include Page
 #include Page#from#to

The pages will be included if the visitor has read permissions, and the content will be considered a formatted list of events. Note that the maximum number of includes is fixed to 50 pages by default, and the recipe respects it. See $MaxIncludes if you wish to increase it.

AllReminders automatic data pages

Is it possible to place some tag with a date in a wiki page, and this page to appear in the Reminder list?

It is possible from version 20080917. You can place in a wiki page such a tag:

 Reminder: 19/4/1977 [whatever]

While saving the page, this line will be added to the special page Site.AllReminders, with a link to the saved page. You can have more than one such lines with different dates/titles; the format is the same as it would be between the (:rem:)...(:remend:) tags, only instead of a "*", the line starts with "Reminder:".

In your reminder display, you include Site.AllReminders by adding a line:

 #include Site.AllReminders

Then, when you add a Reminder: tag in a wiki page, it will be displayed in your reminder.

You can have more than one AllReminders log page. To have also a per-group AllReminders page, you can set in config.php the following code: $RemindersLogs = array("\$SiteGroup.AllReminders", "\$Group.AllReminders");

To disable logging, add this line after the include_once() install code: unset($RemindersLogs);

The AllReminders events are always written, but will be shown if the user has read permissions (like with RecentChanges). On a multi-user wiki, you may wish to add per-group AllReminders pages for each user and protect/lock the Site.AllReminders page.

Notes

  • The script will ignore most invalid dates, or will display a message of those that seem like reminders but cannot be parsed.
  • A reminder for February 29 will be displayed only on leap years. A monthly reminder dated "31" will appear only on months that have 31 days.
  • The "monthly mode" displays the "current or next" April: if it is April 2008, displays the current month; in May 2008 the same page will display April 2009.

Release notes / Change log

  • 20231110 : Added "Nth Weekday of Month" dates and custom intervals.
  • 20231109 : Added Easter-dependent dates.
  • 20231027 : Update for PHP8.2, requires PmWiki 2.3.1 or newer.
  • 20200216 : Add $EnableReminderDiff, requested by VKrishn.
  • 20190908 : Fix for PHP 7.4.
  • 20180731 : fix for PHP 7, requires PmWiki 2.2.58 or newer.
  • 20160211 : Add $ReminderWeeklyFix.
  • 20150405 : Fixes for PHP 5.5. The recipe now requires PmWiki 2.2.58 or more recent.
  • 20110829 : added $ReminderIncludeSuffix, nested includes
  • 20090302 : minor bugfix, the 1/2..3/4/2009 format was marked "expired" a day earlier.
  • 20090109 : added optional /year part for the long events.
  • 20081007 : Fixed flow for multiple autosave patterns.
  • 20080917 : Added AllReminders logs and multiple included pages/sections.
  • 84T, 84Ta (2008-04-29) : Added one-time, "sticky" reminders. Removed daymonth= parameter, use only the $ReminderDayMonth variable from a local/group/page config file. Small change to the suggested CSS code.
  • 84M (2008-04-22) : It is now possible to use an external page or section to store the list of reminders (suggested by Dfaure).
  • 84Kd, 84Ke (2008-04-20) : The script now tries to parse any time formats, and to order the reminders by the time.
  • 84K, 84Kc (2008-04-20) : Added zero and negative monthly dates (last day of month). Invalid/unrecognized dates are now printed at the end of the list. Added URL-request setting for the monthly mode.
  • 84J (2008-04-19) : Initial release, ready to be tested.

See Also

PmCal /
PmCal  
Test /
PmCal  

Author

  • Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

Your comments are welcome at Reminder-Talk.

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.