function wfCalendarSkinTemplateOutputPageBeforeExec(&$skin, &$tpl) { global $wgCalendarSidebarRef; $html = displayCalendar('', array('simplemonth' => true, 'fullsubscribe' => $wgCalendarSidebarRef)); $html .= displayCalendar('', array('date' => 'today', 'fullsubscribe' => $wgCalendarSidebarRef)); $html .= displayCalendar('', array('date' => 'tomorrow', 'fullsubscribe' => $wgCalendarSidebarRef)); if ($html) { $tpl->data['sidebar']['calendar'] = $html; } return true; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <?php include_once 'monket-cal-config.php'; include_once MONKET_SOURCE . 'monket-cal-init.php'; echo getCalInitHTML(); ?> </head> <body> <h1><?php echo $MC['title']; ?> </h1> <?php include_once MONKET_SOURCE . 'monket-cal-parse.php'; displayCalendar(); ?> </body> </html>
$numdays = cal_days_in_month(CAL_GREGORIAN, $month, $year); for ($day = 1; $day <= $numdays; $day++) { $date = mktime(0, 0, 0, $month, $day, $year); echo "<td>" . $day . "</td>"; if (dow($date) == 6) { // Sun echo "</tr>"; // close row if ($day < $numdays) { // more days to come echo "<tr>"; } } } // remaining empty days // Mind that $date holds the last day of the month $left = 6 - dow($date); if ($left > 0) { for ($i = 0; $i < $left; $i++) { echo "<td> </td>"; } echo "</tr>"; } echo "</tbody></table>"; } displayCalendar(2016, 4); ?> </body> </html>
* { font-family: Verdana, Arial, sans-serif; } th, td { border: 1px solid grey; width: 3em; } </style> </head> <body> <?php require "calendar.inc.php"; if (isset($_GET['year'])) { $year = $_GET['year']; if (isset($_GET['month'])) { $month = $_GET['month']; displayCalendar($year, $month); // add a back link echo "<br><a href='exercise10.php?year=" . $year . "'>back to month selection</a>"; } else { displayMonths($year); } } else { displayYears(); } ?> </body> </html>
$db_username = "******"; $db_password = "******"; $db_database = "dat310_booking"; require "exercise4.inc.php"; // get input values if (isset($_GET['checkin']) && isset($_GET['days']) && isset($_GET['property_id'])) { $checkin_str = $_GET['checkin']; // check-in date as string $checkin = strtotime($checkin_str); // check-in date as Unix timestamp $days = $_GET['days']; $checkout = strtotime("+" . $days . " days", $checkin); // check-out date as Unix timestamp $checkout_str = date("Y-m-d", $checkout); // check-out date as string $property_id = $_GET['property_id']; // load the availability for the check-in month from the bookings table $booked = loadBookings($property_id, $checkin_str, $checkout_str); // generate HTML table(s) with the cells colored according to availability displayCalendar(date("Y", $checkin), date("m", $checkin), $checkin, $checkout, $booked); // calendar for check-in month if (date("m", $checkin) != date("m", $checkout)) { // if check-out is in a different month displayCalendar(date("Y", $checkout), date("m", $checkout), $checkin, $checkout, $booked); // calendar for check-out month } } else { echo "Invalid request"; } // add 1s delay before returning the response sleep(1);