Nieuw lid |
|
Hallo allemaal. Ik heb een probleem met mn kalender script. Mijn opdrachtgever verzocht mij of ik de kalender misschien met zondag kan laten beginnen. Dus, in plaats van hoe het nu is: "M" "D" "W" "D" "V" "Z" "Z" moet het zo worden: "Z" "M" "D" "W" "D" "V" "Z".
Hier is de kalender in werking:
http://www.curs...lender.php
Zoals je ziet lukt het me wel om de dag aanduidingen om te zetten. Maar niet om de data 1 plek op te schuiven. Kan iemand mij vertellen hoe ik dit voor elkaar krijg?
Hieronder zal ik de functie toevoegen.
Alvast bedankt iedereen!
M.v.g.
Arjan Démoed
<?
function ShowKalender() {
$i=0;
$month=$_GET['month'];
$year=$_GET['year'];
if ((!$year) || ($year < 1970) || ($year > 2036) || (!is_numeric($year))) {
$year = date("Y");
}
if ((!$month) || ($month < 1) || ($month > 12) || (!is_numeric($month))) {
$month = date("m");
}
$this_day = mktime(0,0,0,date("m"),date("d"),date("Y"));
$month_end = date("t",mktime(0,0,0,$month+1,0,$year));
$month_start_day = date("w",mktime(0,0,0,$month,1,$year));
if ($month_start_day == 0) {
$month_start_day = 7;
}
$tedoen =0;
$news_query = "SELECT * FROM kalender WHERE categorie='Publiek' ORDER BY datum";
$result = mysql_query($news_query);
while ($ddoen = mysql_fetch_array($result)) {
$dagtedoen[$i]=$ddoen[1];
$i++;
}
$months = Array("Januari","Februari","Maart","April","Mei","Juni","Juli", "Augustus","September","Oktober","November","December");
$days = Array("Z","M","D","W","D","V","Z");
$dagte = explode('-', $dagtedoen[$tedoen]);
echo "<table width=200 height=1 class=\"adminmenu\" style=\"border-style: solid; border-width: 1px; border-color: red; font-size: 12px; margin-bottom: 10px; margin-top: 10px;\" border=0 cellspacing=1 cellpadding=0>";
echo "<tr><td colspan=7 align=center>".$months[$month-1]." ".$year."</td></tr>";
echo "<tr>";
for ($i=0;$i<7;$i++) {
echo "<td bgcolor=#eeeeee align=center width=20 height=20>".$days[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
$days_open=0;
for ($i=1;$i<$month_start_day;$i++) {
echo "<td height=20 width=20> </td>";
$days_open++;
}
$row = 1;
for ($i=1;$i<=$month_end;$i++) {
$day = date("w",mktime(0,0,0,$month,$i,$year));
$datenow = mktime(0,0,0,$month,$i,$year);
$mond = date("m",mktime(0,0,0,$month,1,$year));
if ($dagte[1]==$mond) {
$dagt = mktime(0,0,0,$dagte[1],$dagte[2],$dagte[0]);
} else {
$tedoen++;
$dagte = explode('-', $dagtedoen[$tedoen]);
}
if ($datenow == $dagt) {
$sql = "SELECT * FROM kalender WHERE datum='".$dagtedoen[$tedoen]."'";
$resultaat = mysql_query($sql);
while ($rij = mysql_fetch_array($resultaat)) {
if ($rij['checked'] == 0) {
echo "<td bgcolor='".$rij['kleur1']."' style=\"cursor:hand\" onclick=\"gotourl('kalender.php?actie=kalender&datumkijk=".$dagtedoen[$tedoen]."&month=".$month."&year=".$year."')\"
onmouseout=\"style.background='".$rij['kleur1']."'\" onmouseover=\"style.background='".$rij['kleur2']."'\" height=\"20\" width=\"20\" align=\"center\"
>".$i."</td>";
}
$tedoen++;
}
$dagte = explode('-', $dagtedoen[$tedoen]);
} else {
if ($datenow == $this_day) {
echo "<td bgcolor=#9999bb style=\"cursor: default\"
onmouseover=\"movein1(this)\"
onmouseout=\"moveout1(this)\" height=\"20\" width=\"20\" align=\"center\"
>".$i."</td>";
} else {
if ($day == 1 || $day == 0) {
echo "<td bgcolor=#ddcccc style=\"cursor: default;\"
onmouseover=\"movein3(this)\"
onmouseout=\"moveout3(this)\" height=\"20\" width=\"20\" align=\"center\"
>".$i."</td>";
} else {
echo "<td bgcolor=white style=\"cursor: default;\"
onmouseover=\"movein2(this)\"
onmouseout=\"moveout2(this)\" height=\"20\" width=\"20\" align=\"center\"
>".$i."</td>";
}
}
}
if (($day == 0) && ($i != $month_end)) {
echo "</tr><tr>"; $row++;
}
}
$days_over= (($row*7)-$month_end)-$days_open;
for ($i=1;$i<=$days_over;$i++) {
echo "<td height=20 width=20> </td>";
}
echo "</tr>";
if ($month==1) {
$prev_month = 12;
$prev_year = $year-1;
} else {
$prev_month = $month-1;
$prev_year = $year;
}
if ($month==12) {
$next_month=1;
$next_year=$year+1;
} else {
$next_month=$month+1;
$next_year=$year;
}
echo "<tr><td colspan=7 align=center>
<a href=\"". $_SERVER['PHP_SELF'] ."?actie=kalender&pagina=$pagina&month=".$prev_month."&year=".$prev_year."\">Vorige</a> <a href=\"". $_SERVER['PHP_SELF'] ."?actie=kalender&pagina=$pagina&month=".$next_month."&year=".$next_year."\">
Volgende</a></td></tr>";
echo "<tr class=\"algemeen\"><td> </td><td colspan=6 valign=\"top\"><img src=\"images/lgn_publiek.jpg\" style=\"border-style: solid; border-width: 1px; border-color: black;\" alt=\"Algemene agendapunten\" height=15 width=15> = Algemeen</td></tr>";
echo "<tr class=\"algemeen\"><td> </td><td colspan=6 valign=\"top\"><img src=\"images/lgn_vakantie.jpg\" style=\"border-style: solid; border-width: 1px; border-color: black;\" alt=\"Vakantiedagen\" height=15 width=15> = Vakantie</td></tr></table>";
}
?>
<? function ShowKalender() { $i=0; $month=$_GET['month']; $year=$_GET['year']; if ((!$year) || ($year < 1970) || ($year > 2036) || (!is_numeric($year))) { } if ((!$month) || ($month < 1) || ($month > 12) || (!is_numeric($month))) { } $month_end = date("t",mktime(0,0,0,$month+1,0,$year)); $month_start_day = date("w",mktime(0,0,0,$month,1,$year)); if ($month_start_day == 0) { $month_start_day = 7; } $tedoen =0; $news_query = "SELECT * FROM kalender WHERE categorie='Publiek' ORDER BY datum"; $dagtedoen[$i]=$ddoen[1]; $i++; } $months = Array("Januari","Februari","Maart","April","Mei","Juni","Juli", "Augustus","September","Oktober","November","December"); $days = Array("Z","M","D","W","D","V","Z"); $dagte = explode('-', $dagtedoen[$tedoen]); echo "<table width=200 height=1 class=\"adminmenu\" style=\"border-style: solid; border-width: 1px; border-color: red; font-size: 12px; margin-bottom: 10px; margin-top: 10px;\" border=0 cellspacing=1 cellpadding=0>"; echo "<tr><td colspan=7 align=center>".$months[$month-1]." ".$year."</td></tr>"; for ($i=0;$i<7;$i++) { echo "<td bgcolor=#eeeeee align=center width=20 height=20>".$days[$i]."</td>"; } $days_open=0; for ($i=1;$i<$month_start_day;$i++) { echo "<td height=20 width=20> </td>"; $days_open++; } $row = 1; for ($i=1;$i<=$month_end;$i++) { $datenow = mktime(0,0,0,$month,$i,$year); if ($dagte[1]==$mond) { $dagt = mktime(0,0,0,$dagte[1],$dagte[2],$dagte[0]); } else { $tedoen++; $dagte = explode('-', $dagtedoen[$tedoen]); } if ($datenow == $dagt) { $sql = "SELECT * FROM kalender WHERE datum='".$dagtedoen[$tedoen]."'"; if ($rij['checked'] == 0) { echo "<td bgcolor='".$rij['kleur1']."' style=\"cursor:hand\" onclick=\"gotourl('kalender.php?actie=kalender&datumkijk=".$dagtedoen[$tedoen]."&month=".$month."&year=".$year."')\" onmouseout=\"style.background='".$rij['kleur1']."'\" onmouseover=\"style.background='".$rij['kleur2']."'\" height=\"20\" width=\"20\" align=\"center\" >".$i."</td>"; } $tedoen++; } $dagte = explode('-', $dagtedoen[$tedoen]); } else { if ($datenow == $this_day) { echo "<td bgcolor=#9999bb style=\"cursor: default\" onmouseover=\"movein1(this)\" onmouseout=\"moveout1(this)\" height=\"20\" width=\"20\" align=\"center\" >".$i."</td>"; } else { if ($day == 1 || $day == 0) { echo "<td bgcolor=#ddcccc style=\"cursor: default;\" onmouseover=\"movein3(this)\" onmouseout=\"moveout3(this)\" height=\"20\" width=\"20\" align=\"center\" >".$i."</td>"; } else { echo "<td bgcolor=white style=\"cursor: default;\" onmouseover=\"movein2(this)\" onmouseout=\"moveout2(this)\" height=\"20\" width=\"20\" align=\"center\" >".$i."</td>"; } } } if (($day == 0) && ($i != $month_end)) { echo "</tr><tr>"; $row++; } } $days_over= (($row*7)-$month_end)-$days_open; for ($i=1;$i<=$days_over;$i++) { echo "<td height=20 width=20> </td>"; } if ($month==1) { $prev_month = 12; $prev_year = $year-1; } else { $prev_month = $month-1; $prev_year = $year; } if ($month==12) { $next_month=1; $next_year=$year+1; } else { $next_month=$month+1; $next_year=$year; } echo "<tr><td colspan=7 align=center> <a href=\"". $_SERVER['PHP_SELF'] ."?actie=kalender&pagina=$pagina&month=".$prev_month."&year=".$prev_year."\">Vorige</a> <a href=\"". $_SERVER['PHP_SELF'] ."?actie=kalender&pagina=$pagina&month=".$next_month."&year=".$next_year."\"> Volgende</a></td></tr>"; echo "<tr class=\"algemeen\"><td> </td><td colspan=6 valign=\"top\"><img src=\"images/lgn_publiek.jpg\" style=\"border-style: solid; border-width: 1px; border-color: black;\" alt=\"Algemene agendapunten\" height=15 width=15> = Algemeen</td></tr>"; echo "<tr class=\"algemeen\"><td> </td><td colspan=6 valign=\"top\"><img src=\"images/lgn_vakantie.jpg\" style=\"border-style: solid; border-width: 1px; border-color: black;\" alt=\"Vakantiedagen\" height=15 width=15> = Vakantie</td></tr></table>"; } ?>
|