It works as follows: ■ First it sets the given contact ID using the setContactIDmethod.. ◆ getMails : This method returns all e-mails for the given contact num-ber.. This method takes t
Trang 1ID It works as follows:
■ First it sets the given contact ID using the setContactID()method
■ A SQL statement, $stmt, is created to select all the reminder informa-tion for the given contact ID
■ The SQL statement is executed using $this->dbi->query(), and the result is stored in $result
■ If there are more than zero rows in the $resultobject, each row is fetched in the $rowvariable
■ All reminders found in the result set are stored in an array
■ The method returns the array if the result set is not empty; otherwise, it returns null
◆ getMails() : This method returns all e-mails for the given contact
num-ber This is how it works:
■ It sets the given contact ID using the setContactID()method
■ A SQL statement, $stmt, is created to select all the e-mails sent to the given contact
■ The SQL statement is executed using $this->dbi->query(), and the result is stored in $result
■ If there are more than zero rows in the $resultobject, each row is fetched in the $rowvariable
■ All e-mails found in the result set are stored in an array
■ The method returns the array if the result set is not empty; otherwise, it returns null
Here are the other methods in this class:
addKeywords() Adds new keywords for the given contact It
explodes the $keywordstring passed as a parameter and stores the different keywords in an array; for each keyword in the array, it adds a new entry in the CONTACT_KEYWORDtable
deleteKeywords() Deletes keywords for the given contact It takes
contact ID as the parameter
Trang 2Method Description
modifyKeywords() Updates keyword information for the given
contact It uses deleteKeywords()to delete the previous keywords, and then uses
addKeywords()to add the new keywords This method takes the contact ID and the new keywords array as parameters
setContactID() Sets the contact ID If the contact ID is passed to this
method, it sets the member variable cidto the given contact ID At the end it returns the contact ID
getColumnValue() Returns the value of the given column from the
database for the current contact object It takes the column name as a parameter This method uses
loadContactInfo()with the given contact ID to set all the attributes for the contact, and then returns the formatted value of the specified column
deleteRemindersByContactID() Deletes all reminders from the reminder table for a
given contact ID It takes the contact ID as the input and returns TRUEor FALSE, depending on the deletion status
deleteKeywordsByContactID() Deletes all keywords from the keyword table for a
given contact ID So it takes contact ID as the input and returns TRUEor FALSE, depending on the deletion status
addReminder() Adds new reminders to the reminder table for the
given contact It takes the contact ID, author ID, the remind note, the publish date, and the message
ID as a parameter Then it returns TRUEor FALSE, depending on the status of the operation
storeMail() Stores new mail in the database Attributes such as
contact ID, CC To, subject, body, and send time stamp are passed as parameters to this method
replaceCategory() Replaces the old category with the given new one
It takes the old and new category IDs as parameters and returns TRUE or FALSE,
depending on the status of the operation
getMailDetails() Returns detailed information of the given mail ID
It takes the mail ID as a parameter and returns the details of it
Trang 3The Application Configuration Files
Like all other applications we’ve developed in this book, the intranet contact man-ager applications also use a standard set of configuration, message, and error files These files are discussed in the following sections
The main configuration file
The primary configuration file for the contact manager is called contact.conf Table 9-2 discusses each configuration variable
T ABLE 9-2 THE CONTACT.CONFVARIABLES
$PEAR_DIR Set to the directory containing the PEAR
package; specifically the DB module needed for
class.DBI.phpin our application framework
$PHPLIB_DIR Set to the PHPLIB directory, which contains the
PHPLIB packages; specifically the
template.incpackage needed for template manipulation
$APP_FRAMEWORK_DIR Set to our application framework directory
$PATH Set to the combined directory path consisting of
the $PEAR_DIR, the $PHPLIB_DIR, and the
$APP_FRAMEWORK_DIR This path is used with the ini_set()method to redefine the
php.inientry for include_pathto include
$PATHahead of the default path This allows PHP to find our application framework, PHPLIB, and PEAR-related files
$AUTHENTICATION_URL Set to the central login application URL
$LOGOUT_URL Set to the central logout application URL
$HOME_URL Set to the top-most URL of the site If the URL
redirection application does not find a valid URL
in the e-campaign database to redirect to for a valid request, it uses this URL as a default
$APPLICATION_NAME Internal name of the application
$DEFAULT_LANGUAGE Set to the default two-character language code
Trang 4Variable Purpose
$ROOT_PATH Set to the root path of the application
$REL_ROOT_PATH Relative path to the root directory
$REL_APP_PATH Relative application path as seen from the web
browser
$TEMPLATE_DIR The fully qualified path to the template
directory
$THEME_TEMPLATE_DIR The fully qualified path to the theme template
directory
$REL_PHOTO_DIR The Web-relative path to the photo directory
used to store user photos
$PHOTO_DIR The fully qualified path to the photo directory
$DEFAULT_PHOTO Name of the default photo file, which is used
when a user does not have a photo in the photo directory
$CLASS_DIR The fully qualified path to the class directory
$REL_TEMPLATE_DIR The Web-relative path to the template directory
used
$CATEGORY_CLASS Name of the Categoryclass file
$CONTACT_CLASS Name of the Contactclass file
$MESSAGE_CLASS Name of the Messageclass file This class was
developed for the MOTD application discussed
in Chapter 8
$CONTACT_MNGR Name of the application that shows the index
page of the application with the contact search menu
$CONTACT_CAT_MNGR Name of the application that manipulates all
functions related to contact category
$INTRANET_DB_URL The fully qualified URL for the database used to
MOTD information
$CONTACT_DB_URL The fully qualified URL for the database used to
store the contacts and categories
Continued
Trang 5T ABLE 9-2 THE CONTACT.CONFVARIABLES (Continued)
$CONTACT_CATEGORY_TBL Name of the category table in the database
$CONTACT_INFO_TBL Name of the contact info table in the database
$CONTACT_KEYWORD_TBL Name of the contact keyword table in the
database
$USER_PREFERENCE_TBL Name of the user preference table in the
intranet database
$MESSAGE_TBL Name of the MOTD message table in the
intranet database
$CONTACT_MAIL_TBL Name of the contact mail table in the database
$MSG_VIEWER_TBL Name of the message viewer list table in the
intranet database
$AUTH_DB_TBL Name of the user authentication table in the
auth database
$STATUS_TEMPLATE Name of the status template file used to display
status messages
$CONTACT_HOME_TEMPLATE Name of the contact index template file
$CONTACT_CAT_HOME_TEMPLATE Name of the contact category index template
file
$CONTACT_INFO_ADD_MOD_TEMPLATE Name of the add/modify contact entry form
template file
$CONTACT_CAT_ADD_MOD_TEMPLATE Name of the add/modify category entry form
template file
$CONTACT_DETAILS_TEMPLATE Name of the contact details template file
ODD_COLOR Color defined for odd rows when displaying
tabular data
EVEN_COLOR Color defined for even rows when displaying
tabular data
USER_DB_URL The fully qualified authentication database URL