WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes Update Picture
Seamus Venasse
Date : Jan 05th 2000
Grade : 3 of 5 (graded 9 times)
Viewed : 11337
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Seamus Venasse
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/*
pcCalendar - display calendar for a given month & year
Copyright (c) 2000, Polaris Computing
http://www.polaris.ca/
*/

class pcCalendar
{

var $gaWeekTitles;

function pcCalendar()
{
/* initialise the global variables */
$this->gaWeekTitles[] = "Sunday";
$this->gaWeekTitles[] = "Monday";
$this->gaWeekTitles[] = "Tuesday";
$this->gaWeekTitles[] = "Wednesday";
$this->gaWeekTitles[] = "Thursday";
$this->gaWeekTitles[] = "Friday";
$this->gaWeekTitles[] = "Saturday";
}

function intShowCalendar( $intYear = 0, $intMonth = 0 )
{
/* if month and/or year not set, change to current month and year */
$intMonth = ( $intMonth == 0 ) ? strftime( "%m" ) : $intMonth;
$intYear = ( $intYear == 0 ) ? strftime( "%Y" ) : $intYear;

/* determine total days in month */
$lintTotalDays = 0;
while ( checkdate( $intMonth, $lintTotalDays + 1, $intYear ) )
$lintTotalDays++;

/* build table */
$this->intStartTable();
$this->intStartRow();

for ( $i = 0; $i < 7; $i++ )
$this->intDisplayWeekTitle( $i );

$this->intFinishRow();
$this->intStartRow();

/* ensure that enough blanks are put in so that the first day of the month
lines up with the proper day of the week */
$lintOffset = date( "w", mktime( 0, 0, 0, $intMonth, 1, $intYear ) );
for ( $i = 0; $i < $lintOffset; $i++ )
$this->intDisplayDay( "" );

/* start filling in the days of the month */
for ( $lintDay = 1; $lintDay <= $lintTotalDays; $lintDay++ )
{
$this->intDisplayDay( $lintDay );

/* terminate row if we're at on the last day of the week */
$lintOffset++;
if ( $lintOffset > 6 )
{
$lintOffset = 0;
$this->intFinishRow;
if ( $lintDay < $lintTotalDays )
$this->intStartRow();
}
}

/* fill in the remainder of the row with spaces */
if ( $lintOffset > 0 )
$lintOffset = 7 - $lintOffset;

for ( $i = 0; $i < $lintOffset; $i++ )
$this->intDisplayDay( "" );

$this->intFinishRow();
$this->intFinishTable();
}


function intStartTable()
{
/* this function should be overridden with your own routines */

echo '<table border="1" cellpadding="5" cellspacing="5" width="100%">';
}

function intFinishTable()
{
/* this function should be overridden with your own routines */

echo '</table>';
}

function intStartRow()
{
/* this function should be overridden with your own routines */

echo '<tr>';
}

function intFinishRow()
{
/* this function should be overridden with your own routines */

echo '</tr>';
}

function intDisplayWeekTitle( $intWeekDay )
{
/* this function should be overridden with your own routines */

echo '<th><b><font face="Arial">', $this->gaWeekTitles[
$intWeekDay ], '</font></b></th>';
}

function intDisplayDay( $intDay )
{
/* this function should be overridden with your own routines */

echo '<td>', $intDay, '</td>';
}
}
?>



Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Categories : PHP, PHP Classes, Calendar, Date Time
This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time.
Categories : PHP, Calendar, Date Time, HTML and PHP
table calendar pretty much does what cal(1) does - prints out a calendar.
Categories : Date Time, PHP, Calendar
Calendar, Kalender, date, time, day, month, year
Categories : PHP, Date Time, Calendar
Calendars to choose a range of dates , reservation events ...
Categories : PHP, Calendar, Java Script, Date Time
Calendar using Date function
Categories : HTML and PHP, PHP, Date Time, Calendar
a class that uses microtime() to provide easy calculation of elapsed times
Categories : Date Time, PHP, PHP Classes
A Timing Class
Categories : PHP, PHP Classes, Date Time
PHP Calendar Web App
Categories : PHP, Databases, MySQL, Date Time, Calendar
Calendar class on the same page , suitable for reservation
Categories : PHP, Calendar, Date Time
CALENDAR - easy calendar-navigation with PHP
Categories : PHP, Date Time, HTML and PHP, Calendar
Count how many weeks in the month have a specified day, such as Mon, Tue, etc. Var avail - number of days - first day name of the month, occurrences of Sun, occurrences of Mon, etc. Allows you to calculate number of working hours exclude Holidays.
Categories : Calendar, Date Time, PHP, Databases, MySQL
Monthly and Daily Upcoming Events calendar.
Categories : Date Time, PostgreSQL, PHP, Calendar, Databases