mississa Posted December 4, 2006 Share Posted December 4, 2006 Hi!Would really appreciate some help. I have helped out a community business with an opensource modification - online booking calendar http://www.queenstreetstudio.com/bookcal/calendar.phpCertainly one or two things are a bit out of my depth and calendars are a bit hard.... The calendar selector tool doesn't know that your after January 2007 - it goes to January 2006. that piece of code is:<select name="monthselect" onchange="document.forms[0].month.value=document.forms[0].monthselect.options[monthselect.selectedIndex].value; document.forms[0].submit();" class="selectBoxStyle"> <?php for ($m = 1; $m < 13; $m++) { echo '<option value="' . $m . '"'; if ($m == $this->month) echo ' selected="selected"'; echo '>' . $months_full[date('n',mktime(0,0,0,$m,1))-1] . "</option>\n"; } ?> </select>The full calendar.class.php file is:class Calendar { var $isPopup = true; var $day; var $month; var $year; var $monthName; var $daysInMonth; var $weekstart; var $scheduleid = ''; var $isFrame = false; var $javascript = "changeScheduler(%d,%d,%d,%d,%d,'%s');"; /** * Create a new Calendar object with default values * * This will create a new Calendar using default * colors, font sizes, and other attributes * @param none */ function Calendar($isPopup = true, $month = null, $year = null, $weekstart = null, $isFrame = false) { //$this->setupStyleRules(); global $months_full; global $conf; $this->isPopup = $isPopup; $this->isFrame = $isFrame; $this->weekstart = (!is_null($weekstart)) ? $weekstart : $conf['app']['calFirstDay']; $this->day = 1; if ($this->isPopup || $this->isFrame) { if (isset($_POST['month']) && isset($_POST['year'])) { $month = $_POST['month']; $year = $_POST['year']; $this->scheduleid = $_POST['scheduleid']; } else { $month = date('m'); } } // Go forward or back a year if needed if ($month !== null && $year !== null) { if ($month < 1) { $month = 12; $year = $year - 1; } if ($month > 12) { $month = 1; $year = $year + 1; } } else { $month = date('m'); $year = date('Y'); } $dateTS = mktime(0,0,0,$month,1,$year); $this->month = $month; $this->year = $year; // Number value of the first day of the week of the month $this->firstWeekDay = (7 + (date('w', $dateTS) - $this->weekstart)) % 7; // Number of days in this month $this->daysInMonth = date('t', $dateTS); // String name of this month $this->monthName = $months_full[date('n', $dateTS)-1]; } function setupStyleRules() { } /** * Print the actual calendar and jump functions * * This function prints out the calendar and calls all * the associated functions to print the calendar, * links and forms used to jump to a new month * * (This is the only function that needs to be called * after a Calendar has been created) * @param none */ function printCalendar() { $today = getdate(); $this->printCalendarBody($today); if ($this->isPopup || $this->isFrame) { $this->printJumpForm(); } } /** * Prints the calendar body * @param int $today timestamp for todays date */ function printCalendarBody($today) { global $days_letter; $days = $days_letter;//array ('S', 'M', 'T', 'W', 'T', 'F', 'S'); ?> <table border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td colspan="7" class="calpicktitle" align="center"><?php echo $this->monthName . ' ' . $this->year ?></td> </tr> <tr class="dayNamesStyle"> <?phpfor ($i = $this->weekstart; $i < $this->weekstart + 7; $i++) { echo '<td>' . $days[$i%7] . '</td>'; } ?> </tr> <?php// Move to first day of the month echo "<tr>"; for ($day = 0; $day < $this->firstWeekDay; $day++) echo "<td class=\"emptyDayStyle\"> </td>"; // Initialize day //$day = $this->firstWeekDay + $this->weekstart; $day += $this->weekstart; // Initialize printRow $printRow = false; // Print out days for all weeks for ($currentDay = 0; $currentDay < $this->daysInMonth; /* No change needed */ ) { // See if we should start a new row // (will be for each time except first) if ($printRow) { echo "<tr>"; } $printRow = true; // Print out each day of this week for ( /* Day already set */ ; $day < $this->weekstart + 7; $day++) { // If there are still more days to print, do it if (++$currentDay <= $this->daysInMonth) { if ($currentDay == $today['mday'] && $this->month == $today['mon'] && $this->year == $today['year']) $class = 'currentDayBoxStyle'; else $class = 'dayBoxStyle'; echo "<td class=\"$class\"><a href=\"javascript: " . sprintf($this->javascript, $this->month, $currentDay, $this->year, intval($this->isPopup), $this->scheduleid, $this->isFrame) . "\">" . ($currentDay) . "</a></td>"; } else { // Else print out empty cells for ( /* Day already set */ ; $day < $this->weekstart + 7; $day++) echo "<td class=\"emptyDayStyle\"> </td>"; } } // Reset day counter $day = $this->weekstart; echo "</tr>\n"; } ?> </table> <?php } /** * Prints out the form to jump to the next day * @param none */ function printJumpForm() { global $months_full; ?><form id="changeMonth" name="changeMonth" action="<?php echo $_SERVER['PHP_SELF'] . '?' . $this->scheduleid ?>" method="post" style="margin-bottom: 0px;" align="center"><br><table width="180px" border="0" align="center" cellpadding="3" cellspacing="0" > <tr align="center"> <?php // Set values for prev/next month/year variables $nextMonth = $this->month+1; $nextYear = $prevYear = $this->year; $prevMonth = $this->month-1; ?> <td style="width: 33%;" class="navMonthStyle"><a href="javascript: changeDate(<?php echo $prevMonth . ',' . $prevYear?>);"><?php echo "< " . strftime("%b",mktime(0,0,0,$prevMonth,1,$prevYear)) ?></a></td> <td style="width: 33%"> <select name="monthselect" onchange="document.forms[0].month.value=document.forms[0].monthselect.options[monthselect.selectedIndex].value; document.forms[0].submit();" class="selectBoxStyle"> <?php for ($m = 1; $m < 13; $m++) { echo '<option value="' . $m . '"'; if ($m == $this->month) echo ' selected="selected"'; echo '>' . $months_full[date('n',mktime(0,0,0,$m,1))-1] . "</option>\n"; } ?> </select> <input type="hidden" name="year" value="<?php echo $this->year ?>" /> <input type="hidden" name="month" value="<?php echo $this->month ?>" /> <input type="hidden" name="scheduleid" value="<?php echo $this->scheduleid?>" /> </td> <td style="width: 33%;" class="navMonthStyle"><a href="javascript: changeDate(<?php echo $nextMonth . ',' . $nextYear?>);"><?php echo strftime("%b",mktime(0,0,0,$nextMonth,1,$nextYear)) . " >" ?></a></td> </tr> </table></form> <?php } /** * Sets the border color of the Calendar * * @param string $color HTML color */ function setBorderColor($color) { $this->borderColor = $color; } /** * Sets the background color of the empty day cell of the Calendar * * @param string $color HTML color */ function setEmptyDayBGColor($color) { $this->ed_bgcolor = $color; } /** * Sets the background color of the full day cell of the Calendar * * @param string $color HTML color */ function setFullDayBGColor($color) { $this->fd_bgcolor = $color; } /** * Sets the cell box size of the Calendar * Min size = 20 * Max size = 80 * * @param int $size box size (in pixels) */ function setBoxSize($size) { $size = intval($size); if ($size < 20) $size = 20; if ($size > 80) $size = 80; $this->boxSize = $size . 'px'; } /** * Sets the color of the day links of the Calendar * * @param string $color HTML color */ function setLinkColor($color) { $this->linkColor = $color; } /** * Sets the hover color of day links of the Calendar * * @param string $color HTML color */ function setLinkHover($color) { $this->linkHover = $color; } /** * Sets the color month links of the Calendar * * @param string $color HTML color */ function setMonthColor($color) { $this->monthColor = $color; } /** * Sets the hover color month links of the Calendar * * @param string $color HTML color */ function setMonthHover($color) { $this->monthHover = $color; } /** * Sets the background color the month select of the Calendar * * @param string $color HTML color */ function setSelectBGColor($color) { $this->select_bgcolor = $color; } /** * Sets the background color the month select of the Calendar * * @param int $size font size (in pixels) */ function setSelectSize($size) { $this->selectSize = $size . 'px'; } /** * Sets the text color the month select of the Calendar * * @param string $color HTML color */ function setSelectTextColor($color) { $this->select_textcolor = $color; } /** * Sets the common font size of the Calendar * * @param int $size font size (in pixels) */ function setTextSize($size) { $this->textSize = intval($size) . 'px'; }}?>Your help would be greatly appreciated - as people are currently selecting Jan 2006 and thinking it is full so QSS are loosing bookings. Thanks, Missc Link to comment https://forums.phpfreaks.com/topic/29449-jump-calendar-doesnt-know-jan-on-pull-menu-is-next-year/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.