- Class Calendarform {
- protected $year;
- protected $month;
- protected $day;
- protected $weekend;
- protected $currentdate;
- protected $dayofmonth;
- protected $day _count;
- protected $num;
- Protected $week = Array ();
- protected $retunrhtml = "";
- function __construct ($year, $month) {
- $this->makeweeks ($year, $month);
- }
- Public Function Setyearmonth ($year, $month) {
- $this->year = $year;
- $this->month = $month;
- }
- Private Function Resetdaycount () {
- $this->day_count = 1;
- }
- Private Function Setfirstweek () {
- $this->num = 0;
- }
- Public Function GetDayOfMonth ($year, $month) {
- $this->resetdaycount ();
- Return date (' t ', mktime (0, 0, 0, $month, $this->day_count, $year));
- }
- Private Function Setdayofmonth ($year, $month) {
- $this->dayofmonth = $this->getdayofmonth ($year, $month);
- }
- Private Function GetDayOfWeek () {
- Return date (' W ', mktime (0, 0, 0, $this->month, $this->day_count, $this->year));
- }
- Public Function Getnextmonth () {
- Return date (' m ', mktime (0, 0, 0, $this->month, $this->year) + 432000);
- }
- Public Function Getnextyear () {
- Return date (' Y ', mktime (0, 0, 0, $this->month, $this->year) + 432000);
- }
- Public Function Getprevmonth () {
- Return date (' m ', mktime (0, 0, 0, $this->month, 1, $this->year)-432000);
- }
- Public Function Getprevyear () {
- Return date (' Y ', mktime (0, 0, 0, $this->month, 1, $this->year)-432000);
- }
- Private Function Makeweeks ($year, $month) {
- $this->setyearmonth ($year, $month);
- $this->setdayofmonth ($this->year, $this->month);
- $this->setfirstweek ();
- $this->num = 0;
- for ($i = 0; $i < 7; $i + +) {
- $dayofweek = $this->getdayofweek ();
- $dayofweek = $dayofweek-1;
- if ($dayofweek = =-1) {
- $dayofweek = 6;
- }
- if ($dayofweek = = $i) {
- $this->week[$this->num][$i] = $this->day_count;
- $this->day_count++;
- }
- else {
- $this->week[$this->num][$i] = "";
- }
- }
- while (TRUE) {
- $this->num++;
- for ($i = 0; $i < 7; $i + +) {
- $this->week[$this->num][$i] = $this->day_count;
- $this->day_count++;
- if ($this->day_count > $this->dayofmonth) {
- Break
- }
- }
- if ($this->day_count > $this->dayofmonth) {
- Break
- }
- }
- }
- Public Function Getcalendarheader () {
- $this->retunrhtml =
- "
- "
- "
- "
- "
- "
- "
- "
- "
- "
- "
- "
- }
- Public Function Getcalendarfooter () {
- $this->retunrhtml. = "
" .
" .
" . $this->month. "/" . $this->year. " |
" .
" .
Monday | ".
Tuesday | ".
Wednesday | ".
Thursday | ".
Friday | ".
Saturday | ".
Sunday | ".
";
";
- }
- Public Function getbegintr () {
- $this->retunrhtml. = "
|