- 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, 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 <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. ="
|