-
class CalendarForm {
-
-
class CalendarForm {
-
- 受保護$year;
- 受保護$month;
- 受保護$day;
- 受保護$month;
- 受保護$day;
-
- 受保護 $週末;
- 受保護的$currentdate;
- 受保護的$dayofmonth;
- 受保護的$day_count;
- 受保護的$num;
- 受保護的$week = array();
- 受保護的$retunrhtml = " " ;
-
- function __construct($year, $month) {
- $this->makeWeeks($year, $month);
- }
-
- public function setYearMonth($年,$年, $月) {
- $this->year = $year;
- $this->month = $month;
- }
-
- 私有函數resetDayCount() {
- $this- >day_count = 1;
- }
-
- 創函數setFirstWeek() {
- $this->num = 00 ;
- }
-
- 公用函數getDayOfMonth($year, $月) {
- $this->resetDayCount();
- 回傳日期('t', mktime(0, 0, 0 , $month, $this->day_count, $年));
- }
-
- 陰道函數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, $今年->年) 432000);
- }
-
- public function getNextYear() {
- return date('Y', mktime(0, 0, 0, $this- >月, 28, $this->year) 432000);
- }
-
- public function getPrevMonth() {
- return date('m', mktime(0, 0, 0, $this -> ;月, 1, $今年->年) - 432000);
- }
-
- public function getPrevYear() {
- return date('Y', mktime(0, 0, 0 , $this->month, 1, $this->year) - 432000);
- }
-
- 私有函數makeWeeks($year, $month) {
-
- $this-> setYearMonth($year, $month);
- $this->setDayOfMonth($今年->年,$這個->月);
- $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) {
- 中斷;
- }
- }
- if ($this->day_count > $this->dayofmonth) {
- ;
- }
- }
-
- }
-
- public function getCalendarHeader() {
- $this->retunrhtml =
- "
" .- “” .
- "
"。$這個->月。“/”。$今年->今年。“ ”。
- “
”。- “
星期一 | " .
- "
星期二 | " .
- "
";
- }
-
- public function getCalendarFooter() {
- $this-> retunrhtml .= "
";
- }
-
- public function getBeginTR() {
- $this->retunrhtml .= "
";- }
-
- public function getEndTR( ) {
- $this->retunrhtml .= "
";
- }
-
- protected function getDay() {
- return $ 🎜> ->day;
- }
-
- protected function getMonth() { return $this->month; } protected function getYear() { protected function getYear() { $this->month; } protected function getYear() { return $this->month;年; }
-
- 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 = '今天';
- }
- $this-> ;retunrhtml .= "" 。 🎜> $class = '';
- $td = "td";
- if ($ this->isCurrent()) {
- $class = '今天';
- }
- $ this->retunrhtml .= "" 。 ($year, $month) {
- $this->makeWeeks($year, $month);
- $this->getCalendarHeader();
- for ($i = 0; $i week); $i ) {
- $this->getBeginTR();
- for ($j = 0; $j
- if (!空($this->週[$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->目前日期= 1;
- }
- if ($j == 5 || $j == 6) {
- $this->週末= 1;
- $ this ->getTDWeekend();
- }
- else {
- $this->weekend = 0;
- $this->getTD();
- }
-
- }
- else {
- $this-> ;retunrhtml .= "
| ";
- }
-
- }
- $this->getEndTR();
- }
- $this-> ;getCalendarFooter();
- }
-
- public function getCodeMonth() {
- $this->makeCodeMonth($this->年, $this->月) ;
- return $this->retunrhtml;
- }
-
- public function showCodeMonth() {
- echo $this->getCodeMonth();
- }
- echo $this->getCodeMonth();
- }
-
- }
-
- class TechCalendarForm extends CalendarForm {
- public function getTDHref() {
- if ($this->isWeekend()) {
- $font = "";
- }
- else {
- $font = "";
- }
- return "」。 $字體。父級::getDay() 。 "
";
- }
- }
-
-
- 複製程式碼
-
-
php
|