function make_calendar_html($calendar = array(), $options = array()) { $start_day = !empty($options['start_day']) ? $options['start_day'] : 1; if (empty($calendar)) { $calendar = make_calendar($options); } foreach ($calendar as $week) { $row = '<tr>'; foreach ($week as $date => $day) { if (!empty($day['diff'])) { $day['class'] .= ' month'; } if (!empty($day['today'])) { $day['class'] .= ' today'; } $row .= '<td' . (!empty($day['class']) ? ' class="' . $day['class'] . '"' : '') . ' data-date="' . $date . '"' . html_data($day['data']) . '>' . $day['content'] . '</td>'; } $row .= '</tr>'; $tbody .= $row; } $tbody = '<tbody>' . $tbody . '</tbody>'; $days = arr_day(); for ($n = $start_day; $i < 7; $i++) { $thead .= '<th>' . $days[$n] . '</th>'; $n = $n == 7 ? 1 : $n + 1; } $thead = '<thead><tr class="head">' . $thead . '</tr></thead>'; // we use the class `head` here for legacy compatability $html = '<table class="calendar">' . $thead . $tbody . '</table>'; return $html; }
function int_day($int) { $arr = arr_day(); return $arr[$int]; }