Let's start with the easy pieces.
We need to add a new setting that defines whether the assignment will send entry notifications and how it will send them. We will use the var2
field of the assignment table to store this setting (recall fromChapter 7, Developing Pluggable Core Modules that var2
is a field set aside, along with var1
and var3
to var5
, for custom types). As var2
is an integer type, we will use numeric code to represent the various methods: 0
for no notification, 1
for e-mail, 2
for messaging, and 3
for RSS.
Let's open up our assignment.class.php
file.
First, let's use good coding practices and set up some constants for the settings. Near the top of the file, enter:
/* * Define some constants for entry notification settings. */ define ('ASSIGNMENT_JOURNAL_EN_NONE', 0); define ('ASSIGNMENT_JOURNAL_EN_EMAIL', 1); define ('ASSIGNMENT_JOURNAL_EN_MESSAGING', 2); define ('ASSIGNMENT_JOURNAL_EN_RSS', 3);
This will allow us to use the named constants in place of the numeric values...