<?php
function drawMonth($month, $year, $jelentkezettNapok, $napiJelentkezokSzama) {
// $months = Array("Január", "Február", "Március", "Április", "Május", "Június", "Július",
// "Augusztus", "Szeptember", "Október", "November", "December");
//echo "<p class='honapNeve'>".$months[$month - 1]."</p>";
// echo "<table class='naptar'>";
// echo "<tr><th>H</th><th>K</th><th>Sz</th><th>Cs</th><th>P</th><th>Sz</th><th>V</th></tr>";
$firstDayOfTheMonth = mktime(0, 0, 0, $month, 1, $year);
$d = getdate($firstDayOfTheMonth);
// Vasarnap helyett hetfo az elso nap a heten. Pl. "6" jelentese: szombaton kezdodik a honap.
$dayOfTheWeekOfFirstDayOfTheMonth = (6 + $d["wday"]) % 7 + 1;
// Hany napos a honap.
$totalDaysInCurrentMonth = date("t", $firstDayOfTheMonth);
$kellenekUresNapokAHonapVegen = true;
for ($i = 0; $i < $totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1); $i++) {
// Csak az aktuális héttől kezdve. Megjegyzés: date("W") hétfőt tekinti a hét első napjának, ami nekünk pont megfelel.
$day = $i - $dayOfTheWeekOfFirstDayOfTheMonth + 2;
$dateWeek = date("W", mktime(0, 0, 0, $month, $day, $year));
if (intval(date("W", $firstDayOfTheMonth)) > intval($dateWeek)) {
continue;
}
// A hónap végén azokat a heteket nem jelenítjük meg, amikre még nem lehetne jelentkezni.
$utolsoJelentkezhetoHet = intval(date("W", strtotime("+ 28 day")));
if ($utolsoJelentkezhetoHet < intval(date("W"))) {
// Ez decemberben fordulhat elo, amikor is 28 nap mulva mar januarra esik. Ebben az esetben
// az egesz honapot ki kell irni.
$utolsoJelentkezhetoHet += 52;
}
// date("W", mktime(0, 0, 0, 12, 31, 2012)) hibasan 1-et ad 53 helyett, ezert a december
// honapot kulon kell kezelni.
if (!($month == 12 && $day >= 3) && intval($dateWeek) > $utolsoJelentkezhetoHet) {
$kellenekUresNapokAHonapVegen = false;
continue;
}
if ($i % 7 == 0) {
echo "<tr>";
}
if ($i < $dayOfTheWeekOfFirstDayOfTheMonth - 1) {
// Ures napok a honap elejen.
echo "<td class='noborder'></td>";
} else if ($i < $totalDaysInCurrentMonth + $dayOfTheWeekOfFirstDayOfTheMonth - 1){
// Naptari napok.
$day = $i - $dayOfTheWeekOfFirstDayOfTheMonth + 2;
$date = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
$napiJelentkezok = isset($napiJelentkezokSzama[$date]) ? $napiJelentkezokSzama[$date] : 0;
/*if (isset($jelentkezettNapok[$date])) {
if (isDayInTheFuture($date)) {
echo "<td title='Klikkelj a lemondáshoz' id='nap-".$date."' class='registered' onclick='lemondasMegerositese(\"".$date."\")'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>";
} else {
if (isToday($date)) {
echo "<td id='nap-".$date."' class='todayRegistered today'><span class='today'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>";
} else {
echo "<td id='nap-".$date."' class='pastRegistered'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>";
}
}
} else {
if (isToday($date)) {
echo "<td id='nap-".$date."' class='notAvailableForRegistration today'><span class='today'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>";
} else {
echo "<td title='Klikkelj a jelentkezéshez' id='nap-".$date."' "
.(isDayAvailableForRegistration($date, $jelentkezettNapok)
? "class='availableForRegistration' onclick='jelentkezesMegerositese(\"".$date."\")'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>"
: "class='notAvailableForRegistration'><span class='notToday'>".$day."</span></td>");
}
}*/
echo $day . "nap ";
} else {
// TODO(palinko): Kell ez?
echo "<td class='noborder'></td>";
}
if ($i % 7 == 6) {
echo "</tr>";
}
}
// Üres napok a hónap végén. Csak akkor, ha nem üres hetet (7 üres napot) kellene kiírni.
// TODO(palinko): $kellenekUresNapokAHonapVegen-t helyesen számolni eredetileg is.
if ($kellenekUresNapokAHonapVegen && ($totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1)) % 7 > 0) {
for ($i = ($totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1)) % 7; $i < 7; $i++) {
echo "<td class='noborder'></td>";
}
}
// echo "</table>";
}
drawMonth(1, 2013, array(), array());
?>
- Output for git.master, git.master_jit, rfc.property-hooks
- <tr><td class='noborder'></td>1nap 2nap 3nap 4nap 5nap 6nap </tr><tr>7nap 8nap 9nap 10nap 11nap 12nap 13nap </tr><tr>14nap 15nap 16nap 17nap 18nap 19nap 20nap </tr><tr>21nap 22nap 23nap 24nap 25nap 26nap 27nap </tr><tr>28nap 29nap 30nap 31nap <td class='noborder'></td><td class='noborder'></td><td class='noborder'></td>
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:
32.01 ms | 401 KiB | 8 Q