搜索热词
下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
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,$month,$this->day_count,$year));
}
private function setDayOfMonth($year,$month) {
$this->dayofmonth = $this->getDayOfMonth($year,$month);
}
private function getDayOfWeek() {
return date('w',$this->month,$this->year));
}
public function getNextMonth() {
return date('m',28,$this->year) + 432000);
}
public function getNextYear() {
return date('Y',$this->year) + 432000);
}
public function getPrevMonth() {
return date('m',1,$this->year) - 432000);
}
public function getPrevYear() {
return date('Y',$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 =
"
"
" ."
" . $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->getCalendarHeader();
for ($i = 0; $i < count($this->week); $i++) {
$this->getBeginTR();
for ($j = 0; $j < 7; $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() . "";
}
}
以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
总结
以上是编程之家为你收集整理的php 日历类 日历控件全部内容,希望文章能够帮你解决php 日历类 日历控件所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。