Login   Register  
PHP Classes
elePHPant
Icontem

File: phpCal_documentation.xml

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rick Hopkins  >  phpCal  >  phpCal_documentation.xml  >  Download  
File: phpCal_documentation.xml
Role: Documentation
Content type: text/plain
Description: XML Documentation
Class: phpCal
Generate customizable calendars in HTML
Author: By
Last change:
Date: 11 years ago
Size: 8,188 bytes
 

Contents

Class file image Download
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="phpCal_docStyle.xsl"?>
<phpCal>
	<classinfo>
		<classname>phpCal</classname>
		<version>1.0.0 stable</version>
		<author>Rick Hopkins</author>
		<date>11.07.2003</date>
		<description>
			PHP based calendar program which will create a calendar. It will display months, days, current day, navigation arrows to move from month to month, and year to year, and will also have the ability to color in days which contain events. The calendar will also be scalable in size, and have style editability. More features will be forth coming.</description>
	</classinfo>
	<summary>
		<description>
			PHPCAL is a very easy to understand class. In the class opening there are a number of variables that are declared for use in the class later on. The constructor function (phpCal) sets a few of those variables when a new instance is created. The constructor function takes two values: month, and year. These two values should be passed in a numeric state.<br />An example would be this:if (isset($_GET)){<br />$cal = new phpCal($_GET["month"], $_GET["year"]);} else {$cal = new phpCal(date("m"), date("Y"));}<br />One variable in particular to note would be the day variable. The day variable is set to 1 - the day number of the first day of the month. This is worth checking out because it is used later in a public function called setStartDay() for all you who live in an area where your week starts on a Monday. After setting some intial values for calendar creation later, it moves on to the functions setStyleVars() and setStyles(). First setStyleVars() will set default values for the style variables contained in phpCal which affect the look of the resultant calendar. It affects such things at table width, table color, table spacing, border size, border color, font name, font size, font color, number colors (if different from title), and the normal and rollover colors for normal days, current day, and event days. It also sets the daysOfWeek variable which is an array holding the names of the week, the monthTitles variable which is an array holding the names of the months, the dayLink variable which is used when a particular day is clicked on, and finally the calendarLink variable which is used when calendar navigation links are clicked. The setStyles() function creates actual css style tags to go in the html for the table and table cells, as well as font tags. The setStyles() function also sets a variable called curMonthTitle which holds the current months name. After this if you are content with the default style values you can go ahead and create the calendar using the createCal() function which simply loops through the number of days necessary to set up the calendar for given month. It also uses a function called setUpDay() to determine what type of day it is: normal, current, or event day, which will be discussed when we get to the public methods. Function setUpDays() colors the days appropriately and sets up rollover colors as well as borders and all styling necessary. Now on to the fun part of phpCal. The public methods. Any changes made to phpCal through the following public functions should be made BEFORE calling createCal().
		</description>
		<publicmethods>
			<method>
				<methodname>setEventDays</methodname>
				<parameters>
					<param>$events (array of dates) - required</param>
				</parameters>
				<purpose>Sets up an array of event dates for showing which days have scheduled events. Currently the date format is mm/dd/YYYY.</purpose>
				<example>$events = array("11/12/2003", "09/05/2003"); - $cal->setEventDays($events);</example>
			</method>
			<method>
				<methodname>setFontVars</methodname>
				<parameters>
					<param>$name (string font name) - required</param>
					<param>$size (string font size in pixels) - required</param>
					<param>$fColor (string color of font) - required</param>
					<param>$nColor (string color of numbers) - only needed if different from titles</param>
				</parameters>
				<purpose>Sets all adjustable font properties to desired values.</purpose>
				<example>$cal->setFontVars("Verdana", "10", "#333333");</example>
			</method>
			<method>
				<methodname>setTableVars</methodname>
				<parameters>
					<param>$size (integer table width) - required</param>
					<param>$color (string table background color) - required</param>
					<param>$spacing (integer table spacing) - required</param>
				</parameters>
				<purpose>Sets all adjustable calendar html table properties except borders.</purpose>
				<example>$cal->setTableVars(200, "#FFFFFF", 1);</example>
			</method>
			<method>
				<methodname>setTableBorders</methodname>
				<parameters>
					<param>$thickness (integer border thickness) - required</param>
					<param>$color (string border color) - required</param>
				</parameters>
				<purpose>Sets the calendar html table and cell border thickness and color.</purpose>
				<example>$cal->setTableBorders(2, "#333333");</example>
			</method>
			<method>
				<methodname>setLinks</methodname>
				<parameters>
					<param>$dayLink (string calendar day link) - required</param>
					<param>$calLink (string calendar navigation link) - required</param>
				</parameters>
				<purpose>Sets up the page links within the calendar for days and navigation.</purpose>
				<example>$cal->setLinks("calendarDay.html", "calendar.html");</example>
			</method>
			<method>
				<methodname>setDaysOfWeek</methodname>
				<parameters>
					<param>$dayTitles (array of day names) - required : requires all 7 days</param>
				</parameters>
				<purpose>Sets the titles of the days of the week.</purpose>
				<example>$days = array("Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"); - $cal->setDaysOfWeek($days);</example>
			</method>
			<method>
				<methodname>setMonthTitles</methodname>
				<parameters>
					<param>$monthTitles (array of month names) - required : requires all 12 month titles</param>
				</parameters>
				<purpose>Sets the titles of the months of the year.</purpose>
				<example>$months = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); - $cal->setMonthTitles($months);</example>
			</method>
			<method>
				<methodname>setNormalDayColors</methodname>
				<parameters>
					<param>$reg (string day background color) - required</param>
					<param>$roll (string day background color on rollover) - required</param>
				</parameters>
				<purpose>Sets the background color of a normal day when neutral and rolled over.</purpose>
				<example>$cal->setNormalDayColors("#EEEEEE", "#AB3932");</example>
			</method>
			<method>
				<methodname>setCurrentDayColors</methodname>
				<parameters>
					<param>$reg (string day background color) - required</param>
					<param>$roll (string day background color on rollover) - required</param>
				</parameters>
				<purpose>Sets the background color of the current day when neutral and rolled over.</purpose>
				<example>$cal->setCurrentDayColors("#EEEEEE", "#AB3932");</example>
			</method>
			<method>
				<methodname>setEventDayColors</methodname>
				<parameters>
					<param>$reg (string day background color) - required</param>
					<param>$roll (string day background color on rollover) - required</param>
				</parameters>
				<purpose>Sets the background color of an event day when neutral and rolled over.</purpose>
				<example>$cal->setEventDayColors("#EEEEEE", "#AB3932");</example>
			</method>
			<method>
				<methodname>setStartDay</methodname>
				<parameters>
					<param>$day (integer : 1 = week starts on Sunday, greater than 1 = week starts on a Monday) - required</param>
				</parameters>
				<purpose>Adjusts the calendar for those areas of the world where the calendar week starts on a Monday.</purpose>
				<example>$cal->setStartDay(2);</example>
			</method>
		</publicmethods>
	</summary>
	<changelog>
		<lastchange>11.27.2003</lastchange>
		<entry>Added XML Documentation File, as well as XSL stylesheet for documentation.</entry>
	</changelog>
</phpCal>