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 : Calendar class on the same page , suitable for reservation
Categories : PHP, Calendar, Date Time Update Picture
Patrice Benedetto
Date : Dec 20th 2000
Grade : 2 of 5 (graded 10 times)
Viewed : 14454
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Patrice Benedetto
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?PHP
class BZ_calendar {
var $me , $beg , $end ;
function BZ_calendar ( $num , $beg , $end )
{
$this->me = $num ;
$this->beg = $beg ;
$this->end = $end ;
}
function jj ( $goto , $c1 , $c2 )
{
global $beg , $end ;
$lastday = array(0,31,28,31,30,31,30,31,31,30,31,30,31);
if ( $this->me == 1 ) { $t = $c1 ; }
else { $t = $c2 ; }
$today = getdate( $t );
$tbuff = mktime(0,0,0,$today['mon'],1,$today["year"] ) ;
$tDate = getdate( $tbuff );
$firstwday= $tDate["wday"];
$ld = $lastday[$tDate['mon']];
$td = $today["mday"];
if ( ( $tDate["year"] % 4 ) == 0 ) $ld++ ;
        $nn=0;
        $n=1;
        $aujourduis = date("Y-m-d", time() );
        echo "<tr>";
        while ( $n < $ld )
                {        
        if ( ( ++$nn >= $firstwday ) )
                {
                $value = date("Y-m-d", $tbuff);
                if ( ( $value> $beg && $value< $end ) ||
                (($this->me ==1 ) && ( $value== $end ) ) ||
                (($this->me ==2 ) && ( $value== $beg ) ))
                {
                echo "<td bgcolor=#cc6600 > " ;
                }
                elseif ( ( ($value == $beg) && ($this->me ==1 ) )
                || (( $value == $end) && ( $this->me ==2 ) ) )
                {
                echo "<td bgcolor=#000000 > " ;
                }
                else { echo "<td bgcolor=#337878 > " ; }

        $d = beg ;
        $f = $end ;
        if ($this->me == 1 ) { $d = $value ;
                        if ( $d > $end ) { $f = $d ; }
                        else { $f = $end ; } }
                        else
                                { $f = $value ;
                                if ( $f < $beg ) { $d = $f ; }
                                else { $d = $beg ; } }
        if($value >= $aujourduis )
         echo " <a href='$goto?beg=$d&end=$f&cal=$this->me&c2=$c2&c1=$c1 ' > ".$n."</a></td>" ;
                 else echo $n. "</td>" ;
                
                ++$n;
                $tbuff +=86400 ;
                }
        else
                {
                echo "<td > </td>" ;
                }
        if ( $nn % 7 ==0 ) echo "</tr> <tr>";
        }
echo "</tr>";
}


function draw ( $goto , $c1 , $c2 )
{
global $time , $beg , $end , $cal ;
setlocale ("LC_ALL", "fr_CA");

echo "<table bgcolor=#6699CC CELLSPACING ='0' BORDER='0' > \n<tr VALIGN=CENTER ALIGN=CENTER > \n
<td> " ;
if ( $this->me ==1 )
{
echo " <a href='$goto?cal=".$this->me."&c1=".($c1 - 86400*30) ."&c2=".$c2."&beg=$beg&end=$end'>
<< </a> </td> \n <th bgcolor=#336699 > ".strftime(" %B %Y" ,$c1 ) ." </th> \n <td>
<a href='$goto?cal=".$this->me."&c1=".($c1 + 86400*30 )."&c2=$c2&beg=$beg&end=$end'> >> </a> </td>
\n" ;
}
else
{
echo " <a href='$goto?cal=".$this->me."&c2=".($c2 - 86400*30 )."&c1=".$c1."&beg=$beg&end=$end'>
<< </a> </td> \n <th bgcolor=#336699 > ". strftime(" %B %Y" ,$c2 ) ." </th> \n <td>
<a href='$goto?cal=".$this->me."&c2=".($c2 + 86400*30 )."&c1=$c1&beg=$beg&end=$end'> >> </a>
</td> \n " ;
}

echo " </tr> <tr>
<td COLSPAN=3 >
<table BORDER=0 CELLSPACING=1 ALIGN='CENTER' WIDTH ='180' >
<TR bgcolor=#336699 ><TH>L</TH><TH>M</TH><TH>M</TH><TH>J</TH><TH>V</TH><TH>S</TH><TH>D</TH></TH>
";                                                                                
$this->jj( $goto , $c1 , $c2 ) ;
echo "</table> </td> </tr></table> ";
}
}
// USAGE ( CODE fragment )
// if( ! defined ("BZ_calendar") ) include "lib/BZ_calendar.inc";
// if ( $time=='' ) $time = time();
// if ( !isset ($c1 )) $c1 = $time ;
// if ( !isset ($c2 )) $c2 = $time ;
// if (!isset ( $beg ) ) $beg = date("Y-m-d", $time);
// if (!isset ( $end ) ) $end = date("Y-m-d", $time);
// if ( $cal == 1 && $c2 < $c1 ) $c2 = $c1 ;
// if ( $cal == 2 && $c2 < $c1 ) $c1 = $c2 ;
// $cal1= new BZ_calendar         ( 1 , $beg , $end ) ;
// $cal2 = new BZ_calendar         ( 2 , $beg , $end ) ;
//
// $cal1->draw("test.php3" , $c1 ,$c2 );
//
// $cal2->draw("test.php3" , $c1 ,$c2 );
/// TEST PAGE http://onlypub.com/hotel/test.php3
/// the first calendar select the start date , the second the end date )
// The query the database whith $beg and $end
// enjoy ( but you have to change it a little to use the US date format )



function to generate calendars on the fly.
Categories : Calendar, PHP, Date Time
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
table calendar pretty much does what cal(1) does - prints out a calendar.
Categories : Date Time, PHP, Calendar
PHP Calendar Web App
Categories : PHP, Databases, MySQL, Date Time, Calendar
PHP Calendar
Categories : PHP, Calendar, Date Time, Java Script, CSS
Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June).
Categories : Calendar, Date Time, PHP
Calendar, Kalender, date, time, day, month, year
Categories : PHP, Date Time, Calendar
Calendar using Date function
Categories : HTML and PHP, PHP, Date Time, Calendar
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
Monthly and Daily Upcoming Events calendar.
Categories : Date Time, PostgreSQL, PHP, Calendar, Databases
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
Simple PHP control CSS Calendar
Categories : PHP, HTML and PHP, Calendar, Date Time, CSS
A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed.
Categories : Date Time, PHP, Complete Programs, Calendar
CALENDAR - easy calendar-navigation with PHP
Categories : PHP, Date Time, HTML and PHP, Calendar
Calendar for any month any year
Categories : PHP, Calendar, Date Time
 benedetto patrice wrote :876
test page has moved 
http://www.labynet.org/hotel/test.php3?beg=2002-11-07&end=2002-11-28&cal=2&c2=1036674213&c1=1036674213