array( 'text' => $row["catid"] ))); if($row["start_date"]!="") { $fecha = $row["start_date"];} if($row["start_ts"]!="") { $fecha = substr($row["start_ts"],0,10);} $events += array($fecha => $row["catid"]); } //print_r($events); /** * Returns the calendar's html for the given year and month. * * @param $year (Integer) The year, e.g. 2015. * @param $month (Integer) The month, e.g. 7. * @param $events (Array) An array of events where the key is the day's date * in the format "Y-m-d", the value is an array with 'text' and 'link'. * @return (String) The calendar's html. */ function build_html_calendar($year, $month, $events = null) { // CSS classes $css_cal = 'calendar'; $css_cal_row = 'calendar-row'; $css_cal_day_head = 'calendar-day-head'; $css_cal_day = 'calendar-day'; $css_cal_day_number = 'day-number'; $css_cal_day_blank = 'calendar-day-np'; $css_cal_day_event = 'calendar-day-event'; $css_cal_event = 'calendar-event'; // Table headings $headings = array('L', 'M', 'X', 'J', 'V', 'S', 'D'); // Start: draw table $calendar = "" . "" . "" . ""; // Days and weeks $running_day = date('N', mktime(0, 0, 0, $month, 1, $year)); $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year)); // Row for week one $calendar .= ""; // Print "blank" days until the first of the current week for ($x = 1; $x < $running_day; $x++) { $calendar .= ""; } // Keep going with days... for ($day = 1; $day <= $days_in_month; $day++) { // Check if there is an event today $cur_date = date('Y-m-d', mktime(0, 0, 0, $month, $day, $year)); $draw_event = false; if (isset($events) && isset($events[$cur_date])) { $draw_event = true; } // Day cell $calendar .= $draw_event ? ""; // New row if ($running_day == 7) { $calendar .= ""; if (($day + 1) <= $days_in_month) { $calendar .= ""; } $running_day = 1; } // Increment the running day else { $running_day++; } } // for $day // Finish the rest of the days in the week if ($running_day != 1) { for ($x = $running_day; $x <= 7; $x++) { $calendar .= ""; } } // Final row $calendar .= ""; // End the table $calendar .= '
" . implode("", $headings) . "
" : ""; // Add the day number $calendar .= "
" . $day . "
"; // Insert an event for this day if ($draw_event) { /*$calendar .= "";*/ if($events[$cur_date]['text']=="2"){ $calendar .="
O
" ; } if($events[$cur_date]['text']=="3"){ $calendar .="
R
" ; } } // Close day cell $calendar .= "
'; // All done, return result return $calendar; } ?> Quinta Zertuche
Calendario
 

< April 2055 >

     
    Ocupado
    Reservado sin anticipo