Summary: Birthday, anniversary and other task reminders
Version: 20080917
Status:

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;}
In addition to the GNU GPL v.3, this recipe is Postcardware. If you like it or use it, please send me a postcard (info).
Usage
In a wiki page, use the markup:
(:reminder Group.Page#start#end:)
or:
(:rem pastdays=3 futuredays=11 locale=fr_FR.utf8 daymonth="m/d":)
Weekly reminders:
* w2 A Tuesday reminder
* w35 Soccer: Wednesday and Friday
Monthly reminders:
* 27 %red% '''Pay rent''' %%
* 5 Pay cable
Yearly reminders:
* 4/19/2008 Birthday of the Cookbook.Reminder recipe
* 7/14 National holiday in France
Multiple days:
* 4/29..5/6 Trip to Vienna %item bgcolor=#fee%
(:remend:)
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
locale=fr_FR.utf8 : change the default locale, to display the date in French
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
$ReminderLocale = "fr_FR.utf8"; : see parameter locale=, default is not set
$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", while in this page the examples are in the British/American way.
$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.
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 each Monday (w1), Tuesday (w2) etc. Sunday is w0 or w7. You can set more than one day, w45 means Thursday and Friday.
- 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
- 4/19/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).
- 12/24..1/4 : something to be displayed every day from December 24 to January 4, usefull to mark holidays or trips. Currently this format does not accept years (and if not deleted, will be repeated every year).
- =w1, =22, =4/22, =5/1/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", "5/1/2008". On saving the page, this date format is automatically translated to the ISO format =YYYY-MM-DD.
Time: from version 84Kd, 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.
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: 4/19/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 silently ignore most invalid dates, such as 2/30 or 4/31.
- 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
Current (recommended) version is 20080917Δ.
- 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
Author
Comments
Your comments are welcome at Reminder-Talk.