initialize($current_month_new,$current_day_new,$current_year_new); // $testcal->add_event(1); when set, there is an event for that specific day // $testcal->add_event(2); use // $testcal->display(); // ////////////////////////////////////////////////////////////////////////////////// class dtCalendar { //////////////// General setting (user modify) ///////////////////////////////// var $col_today_bg = \\\"#EFF333\\\"; var $col_title_bg = \\\"#30267B\\\"; var $col_title_txt = \\\"#FFFFFF\\\"; var $col_cell_bg = \\\"#E6E6E6\\\"; var $col_nav_bg = \\\"#CCCCCC\\\"; var $col_nav_txt = \\\"#000000\\\"; // set to true/false to enable/disable top navigation bar (default=on) var $show_nav = \\\"true\\\"; // set href page and it\\\'s target var $href_page = \\\"viewselecteddate.php\\\"; var $target = \\\"_self\\\"; ///////////////////////////////////////////////////////////////////////////////// // valid months starting with jan <=> 1 var $valid_months = array(1=>\\\"Jan\\\", \\\"Feb\\\", \\\"Mar\\\", \\\"Apr\\\", \\\"May\\\", \\\"Jun\\\", \\\"Jul\\\", \\\"Aug\\\", \\\"Sep\\\", \\\"Oct\\\", \\\"Nov\\\", \\\"Dec\\\"); // valid days starting with Sat <=> 1 for table location var $valid_days = array(\\\"Sat\\\"=>1, \\\"Sun\\\"=>2, \\\"Mon\\\"=>3, \\\"Tue\\\"=>4, \\\"Wed\\\"=>5, \\\"Thu\\\"=>6, \\\"Fri\\\"=>7); var $months_events = array(); var $current_day; var $current_month; var $current_year; var $current_date; var $abbreviated_wkday; var $current_month_str; function dtCalendar() { $this->current_month = intval(date(\\\"m\\\")); $this->current_day = intval(date(\\\"d\\\")); $this->current_year = intval(date(\\\"Y\\\")); // Find the first day of any given month (displaying table usage) $this->abbreviated_wkday = strftime(\\\"%a\\\", mktime(0,0,0,$this->current_month,1,$this->current_year)); //$this->current_month_str = $this->valid_months[$this->current_month]; } function initialize($current_month_new, $current_day_new, $current_year_new) { $this->current_month = $current_month_new; $this->current_day = $current_day_new; $this->current_year = $current_year_new; // Find the first day of any given month (displaying table usage) $this->abbreviated_wkday = strftime(\\\"%a\\\", mktime(0,0,0,$current_month_new,1,$current_year_new)); } // Add an event to the calendar function add_event($event_day) { $event_day++; $this->months_events[$event_day] = 1; } function display() { ?> show_nav == \\\"true\\\") { ?>
col_nav_bg?>\\\">
col_nav_txt?>\\\">Year: col_nav_txt?>\\\">Month:
col_title_bg?>\\\"> \\\"; for ($tbl_col=1; $tbl_col<8; $tbl_col++) { if (checkdate($this->current_month, $x_day, $this->current_year)) { if (($tbl_col < intval($this->valid_days[$this->abbreviated_wkday])) && ($tbl_row==1)) { print \\\"\\\"; } else { ($x_day < 10) ? $x_day_submit = \\\"0\\\".\\\"$x_day\\\" : $x_day_submit = $x_day; ($this->current_month < 10) ? $current_month_submit = \\\"0\\\".$this->current_month : $current_month_submit = $this->current_month; if ($this->current_day == $x_day) { print \\\"\\\"; } } else { print \\\"\\\"; } } // for print \\\"\\\"; }?>
col_title_txt?>\\\">Sat col_title_txt?>\\\">Sun col_title_txt?>\\\">Mon col_title_txt?>\\\">Tue col_title_txt?>\\\">Wed col_title_txt?>\\\">Thu col_title_txt?>\\\">Fri
col_cell_bg.\\\"> col_today_bg.\\\">\\\"; print \\\"href_page.\\\"?selecteddate=\\\".$this->current_year.\\\"-\\\".$current_month_submit.\\\"-\\\".$x_day_submit.\\\"\\\' target=\\\'\\\".$this->target.\\\"\\\'>\\\".$x_day++.\\\"\\\"; } else { print \\\"col_cell_bg.\\\">\\\"; print \\\"href_page.\\\"?selecteddate=\\\".$this->current_year.\\\"-\\\".$current_month_submit.\\\"-\\\".$x_day_submit.\\\"\\\' target=\\\'\\\".$this->target.\\\"\\\'>\\\".$x_day++.\\\"\\\"; } if (isset($this->months_events[$x_day])) print \\\"*\\\"; print \\\"col_cell_bg.\\\">