Example #1
0
 function get_mini_month($month, $year, $extra, $itemid)
 {
     global $DaysShort;
     $month = intval($month);
     if ($month < 10) {
         $month = '0' . $month;
     }
     $stamp = Rsys::mysql_datetime_to_timestamp($year . '-' . $month . '-01 00:00:00');
     $daysinmonth = date('t', $stamp);
     $dayofweek = date('w', $stamp);
     // 0-6
     if ($dayofweek == 0) {
         $dayofweek = 7;
     }
     // 1-7...
     echo '<table style="padding:0.2em;border:1px solid #000" cellspacing="1"><tr><th><a style="font-size: 11px;font-family: Verdana,sans-serif;" href="reservation.php?item=' . $itemid . '&amp;viewday&amp;changemonth=yes&amp;date=' . ($month == 1 ? $year - 1 : $year) . '-' . ($month == 1 ? 12 : $month - 1) . '-1' . $extra . '">&laquo;</a></th><th colspan="5" style="font-family: Verdana,sans-serif;border:2px inset #000;background-color:#FF0;font-size:11px">' . $this->get_long_month($month - 1) . ' ' . $year . '</th><th><a href="reservation.php?item=' . $itemid . '&amp;viewday&amp;changemonth=yes&amp;date=' . ($month == 12 ? $year + 1 : $year) . '-' . ($month == 12 ? 1 : $month + 1) . '-1' . $extra . '" style="font-size: 11px;font-family: Verdana,sans-serif;">&raquo;</a></th></tr><tr>';
     for ($i = 1; $i <= 7; $i++) {
         echo '<th style="color:#036;font-size: 10px;font-family: Verdana,sans-serif; padding: 3px 0.2em 3px 0.2em">' . $this->get_short_day($i == 7 ? 0 : $i) . '</th>';
     }
     echo '</tr><tr>';
     for ($i = 1; $i <= 42; $i++) {
         if ($i - $dayofweek < $daysinmonth && $i >= $dayofweek) {
             echo '<td style="border-bottom:1px solid #CCE;cursor: pointer;border-right:1px solid #CCE;text-align: center;font-size: 11px;font-family: Verdana,sans-serif;" onmouseout="this.style.background=\'#FFF\'" onmouseover="this.style.background=\'#FF0\'" onclick="document.location.href=\'?viewday&amp;date=' . $year . '-' . $month . '-' . ($i - $dayofweek + 1) . $extra . '\'"><a href="?viewday&amp;date=' . $year . '-' . $month . '-' . ($i - $dayofweek + 1) . $extra . '" style="color:' . (Rsys::check_date_month_calendar($year . '-' . $month . '-' . ($i - $dayofweek + 1), $itemid) ? "#0C0" : "#666") . '">' . ($i - $dayofweek + 1) . '</a></td>';
         } elseif ($i < $dayofweek) {
             echo '<td>&nbsp;</td>';
         } else {
             break;
         }
         if ($i + 1 - $dayofweek < $daysinmonth && $i + 1 > $dayofweek && $i % 7 == 0) {
             echo '</tr><tr>';
         }
     }
     echo '</tr></table>';
 }