Hallo,
Ik weet het, de zoveelste vraag over datums, maar ik kom er echt niet uit.
Ik heb van hotscripts een prachtige kalender gedownload, alleen hij geeft de
maanden en de door php-gegenereerde dagen in het Engels en ik vind dat geen
gezicht.
Ik heb vele nieuwsgroepen doorgezocht, ben op de php site geweest, lees iets
over de functie localtime etc, maar heb geen idee hoe en waar ik dat nu moet
inpassen. Kan iemand me helpen, en het eventueel in het nederlands
uitleggen?
Gr. Anja O.
<?php
/************************************************** *
JCal - Version 1.1 Beta (Nov. 27, 2002)
Author Jay Hargis - Prescient Software
This software is provided under the GNU GENERAL
PUBLIC LICENSE. Please see 'COPYING' for details.
This license information must APPEAR and REMAIN
INTACT in all JCal scripts.
http://www.prescientsoftware.com/jcal
************************************************** */
require ("jcal_config/config_inc.php");
// connect to the database
$conn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not
connect to database!");
mysql_select_db($db, $conn);
?>
<!-- REPLACE WITH YOUR OWN HEADER IF YOU LIKE -->
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Calendar Admin</title>
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#ffffcc">
<!-- REPLACE WITH YOUR OWN HEADER IF YOU LIKE -->
<?
//clean input
if (isset($_GET['month'])) { $month = $_GET['month']; $month = ereg_replace
("[[:space:]]", "", $month); $month = ereg_replace ("[[unct:]]", "",
$month); $month = ereg_replace ("[[:alpha:]]", "", $month); }
if (isset($_GET['year'])) { $year = $_GET['year']; $year = ereg_replace
("[[:space:]]", "", $year); $year = ereg_replace ("[[unct:]]", "", $year);
$year = ereg_replace ("[[:alpha:]]", "", $year); if ($year < 1990) { $year =
1990; } if ($year > 2035) { $year = 2035; } }
if (isset($_GET['today'])) { $today = $_GET['today']; $today = ereg_replace
("[[:space:]]", "", $today); $today = ereg_replace ("[[unct:]]", "",
$today); $today = ereg_replace ("[[:alpha:]]", "", $today); }
$month = (isset($month)) ? $month : date("n",time());
$year = (isset($year)) ? $year : date("Y",time());
$today = (isset($today))? $today : date("j", time());
$daylong = date("l",mktime(1,1,1,$month,$today,$year));
$monthlong = date("F",mktime(1,1,1,$month,$today,$year));
$dayone = date("w",mktime(1,1,1,$month,1,$year));
$numdays = date("t",mktime(1,1,1,$month,1,$year));
$alldays = array('Zo','Ma','Di','Wo','Do','Vr','Za');
$next_year = $year + 1;
$last_year = $year - 1;
if ($today > $numdays) { $today--; }
//begin outer table structure
echo "<table border=\"0\" cellpadding=\"4\" cellspacing=\"4\" width=\"528\">
<tr>
<td>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\"
width=\"311\" bgcolor=\"black\">
<tr>
<td bgcolor=\"white\" valign=\"middle\"
align=\"center\"><b>$daylong, $monthlong $today, $year</b></td>
</tr>
</table>
</td>
<td valign=\"middle\" align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"middle\" align=\"center\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$last_year&today=$today&month=$month\"
onmouseover=\"document.calb2.src='jcal_img/ltab2over.gif'\"
onmouseout=\"document.calb2.src='jcal_img/ltab2.gif'\"><img
src=\"jcal_img/ltab2.gif\" border=\"0\"
name=\"calb2\"></a></td><td> </td>
<td valign=\"middle\" align=\"center\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\"
width=\"180\" bgcolor=\"black\">
<tr>
<td bgcolor=\"white\" valign=\"middle\"
align=\"center\"><b>$year</b></td>
</tr>
</table>
</td>
<td> </td><td valign=\"middle\" align=\"center\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$next_year&today=$today&month=$month\"
onmouseover=\"document.calb1.src='jcal_img/rtab2over.gif'\"
onmouseout=\"document.calb1.src='jcal_img/rtab2.gif'\"><img
src=\"jcal_img/rtab2.gif\" border=\"0\" name=\"calb1\"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign=\"top\">
<table border=\"0\" cellpadding=\"4\" cellspacing=\"1\"
bgcolor=\"black\" width=\"100%\" height=\"445\">
<tr>
<td class=\"cellbg\" valign=\"top\">";
//load and display day title and content in fields
$sql_date = "$year-$month-$today";
$eventQuery = "SELECT title, event, html FROM cal WHERE eventdate =
'$sql_date';";
$eventExec = mysql_query($eventQuery);
while($row = mysql_fetch_array($eventExec)) {
$html_setting = $row["html"];
$event_title = stripslashes($row["title"]);
$event_title = htmlspecialchars($event_title);
$event_event = stripslashes($row["event"]);
if ($html_setting != 1) {
$event_event = htmlspecialchars($event_event);
$event_event = ereg_replace ("\n", "<br>\n", $event_event);
}
}
echo "<font class=\"eventheading\">$event_title</font><br><br>\n";
echo $event_event;
echo "</td>
</tr>
</table>
<br><center><a href=\"http://www.prescientsoftware.com/jcal\"><font
size=-2>Powered by JCal</font></a></center>
<td valign=\"top\">
<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" bgcolor=\"black\"
width=\"250\">
<tr>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=1';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=1\"
class=\"normal\">Jan</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=2';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=2\"
class=\"normal\">Febr</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=3';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=3\"
class=\"normal\">Maart</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=4';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=4\"
class=\"normal\">April</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=5';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=5\"
class=\"normal\">Mei</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=6';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=6\"
class=\"normal\">Juni</a> </td>
</tr>
<tr>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=7';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=7\"
class=\"normal\">Juli</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=8';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=8\"
class=\"normal\">Aug</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=9';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=9\"
class=\"normal\">Sept</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=10';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=10\"
class=\"normal\">Okt</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=11';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=11\"
class=\"normal\">Nov</a> </td>
<td valign=\"middle\" align=\"center\" onClick=\"window.location='"
..$_SERVER['PHP_SELF']. "?year=$year&today=1&month=12';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"> <a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=1&month=12\"
class=\"normal\">Dec</a> </td>
</tr>
</table><br>\n";
//display name of month
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\"
bgcolor=\"black\" width=\"250\">\n<tr>\n";
echo "<td class=\"cellbg\" colspan=\"7\" valign=\"middle\"
align=\"center\"><font class=\"regheading\"><b>" .
date("F",mktime(1,1,1,$month,1,$year)) . "</b></font>\n</td>\n";
echo "</tr>\n<tr>\n";
//display day names
foreach($alldays as $value) {
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\"
width=\"10%\"><font class=\"$normaltext\"
size=\"1\"><b>$value</b></font></td>\n";
}
echo "</tr>\n<tr>\n";
//display blank days as nbsp's
for ($i = 0; $i < $dayone; $i++) {
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\"><font
class=\"$normaltext\" size=\"1\"> </font></td>\n";
}
//display days
for ($zz = 1; $zz <= $numdays; $zz++) {
if ($i >= 7) { print("</tr>\n<tr>\n"); $i=0; }
//check current day for an event
$result_found = 0;
if ($zz == $today) { //mark todays cell regardless
echo "<td valign=\"middle\" align=\"center\"
onClick=\"window.location='" .$_SERVER['PHP_SELF'].
"?year=$year&today=$zz&month=$month';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='celltoday'\" class=\"celltoday\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\"
class=\"today\">$zz</a></font></td>\n";
$result_found = 1;
}
if ($result_found != 1) {//search for event on this day and mark cell if
title not empty
$sql_currentday = "$year-$month-$zz";
$eventQuery = "SELECT title FROM cal WHERE eventdate =
'$sql_currentday';";
$eventExec = mysql_query($eventQuery);
while($row = mysql_fetch_array($eventExec)) {
if (strlen($row["title"]) > 0) {
echo "<td valign=\"middle\" align=\"center\"
onClick=\"window.location='" .$_SERVER['PHP_SELF'].
"?year=$year&today=$zz&month=$month';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellevent'\" class=\"cellevent\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\"
class=\"normal\">$zz</a></td>\n";
$result_found = 1;
}
}
}
if ($result_found != 1) {//show default cell style for day
echo "<td valign=\"middle\" align=\"center\"
onClick=\"window.location='" .$_SERVER['PHP_SELF'].
"?year=$year&today=$zz&month=$month';\"
onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$year&today=$zz&month=$month\"
class=\"normal\">$zz</a></td>\n";
}
$i++; $result_found = 0;
}
$create_emptys = 7 - (($dayone + $numdays) % 7);
if ($create_emptys == 7) { $create_emptys = 0; }
//display blank remaining cells
if ($create_emptys != 0) {
echo "<td class=\"cellbg\" valign=\"middle\" align=\"center\"
colspan=\"$create_emptys\"><font class=\"$normaltext\"> </font></td>\n";
}
echo "</tr>\n";
echo "</table><br>\n";
//weekly display
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\"
bgcolor=\"black\" width=\"250\">\n<tr>\n";
echo "<td valign=\"middle\" align=\"center\" class=\"cellbg\"><font
class=\"regheading\"><b>Deze week</b></font></td></tr>\n";
for ($i = $today; $i <= ($today + 6); $i++) {
//determine if days rollover into next month
$current_day = $i;
$current_year = $year;
$current_month = $month;
if ($i > $numdays) {
$current_day = ($i - $numdays);
$current_month = $month + 1;
if ($current_month > 12) {
$current_month = 1; $current_year = $year + 1;
}
}
$dayname =
date("l",mktime(1,1,1,$current_month,$current_day, $current_year));
$sql_currentday = "$current_year-$current_month-$current_day";
$eventQuery = "SELECT title FROM cal WHERE eventdate =
'$sql_currentday';";
$eventExec = mysql_query($eventQuery);
while($row = mysql_fetch_array($eventExec)) {
if (strlen($row["title"]) > 0) {
$this_days_title = stripslashes($row["title"]);
$this_days_title = htmlspecialchars($this_days_title);
}
}
echo "<tr onMouseOver=\"this.className='cellover'\";
onMouseOut=\"this.className='cellbg'\" class=\"cellbg\" height=\"30\">
<td valign=\"top\" onClick=\"window.location='" .$_SERVER['PHP_SELF'].
"?year=$current_year&today=$current_day&month=$cur rent_month';\"><a
href=\"".$_SERVER['PHP_SELF']."?year=$current_year&today=$current_day&month=
$current_month\" class=\"normal\">$dayname - $current_day</a><br>\n";
//display day title if exists
if (strlen($this_days_title) > 0) {
echo "<font class=\"eventtitle\">$this_days_title</font>";
}
echo "</td></tr>\n";
$this_days_title = "";
}
echo "</table>\n";
echo "<center><a href=\"".$_SERVER['PHP_SELF']."\" class=\"normal\">Ga naar
vandaag</a></center>";
//end outer table
echo "</td>
</tr>
</table>\n";
?>
</body>
</html>

Likes:

unct:]]", "",
Quote