您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 日历类 日历控件

2024/3/14 22:10:38发布21次查看
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, 28, $this->year) + 432000); } public function getnextyear() { return date('y', mktime(0, 0, 0, $this->month, 28, $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 $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 $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 = . . . $this->month . / . $this->year .
. . monday . tuesday . wednesday . thursday . friday . saturday . sunday .
; } public function getcalendarfooter() { $this->retunrhtml .=
; } public function getbegintr() { $this->retunrhtml .= ; } public function getendtr() { $this->retunrhtml .=
; } protected function getday() { return $this->day; } protected function getmonth() { return $this->month; } protected function getyear() { return $this->year; } protected function isweekend() { return $this->weekend; } protected function iscurrent() { return $this->currentdate; } public function gettdhref() { return $this->getday(); } public function gettd() { $class = ''; $td = td; if ($this->iscurrent()) { $class = 'today'; } $this->retunrhtml .= . $this->gettdhref() . $td>; } public function gettdweekend() { $class = ''; $td = td; if ($this->iscurrent()) { $class = 'today'; } $this->retunrhtml .= . $this->gettdhref() . $td>; } protected function makecodemonth($year, $month) { $this->makeweeks($year, $month); $this->getcalendarheader(); for ($i = 0; $i week); $i++) { $this->getbegintr(); for ($j = 0; $j if (!empty($this->week[$i][$j])) { $this->day = $this->week[$i][$j]; $this->currentdate = 0; if ($this->year == date('y') && $this->month == date('m') && $this->day == date('j')) { $this->currentdate = 1; } if ($j == 5 || $j == 6) { $this->weekend = 1; $this->gettdweekend(); } else { $this->weekend = 0; $this->gettd(); } } else { $this->retunrhtml .= ; } } $this->getendtr(); } $this->getcalendarfooter(); } public function getcodemonth() { $this->makecodemonth($this->year, $this->month); return $this->retunrhtml; } public function showcodemonth() { echo $this->getcodemonth(); } } class techcalendarform extends calendarform { public function gettdhref() { if ($this->isweekend()) { $font = ; } else { $font = ; } return . $font . parent::getday() . ; }}
复制代码
php
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product