kalender

Gesponsorde koppelingen

PHP script bestanden

  1. kalender

« Lees de omschrijving en reacties

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<!-- kop met style plaatsen: style is van phpinfo() al je het bekend voor
mocht komen ;) -->


<head>
<style type="text/css"><!--
a { text-decoration: none; }
a:hover { text-decoration: underline; }
acronym {border-bottom: 1px dotted #000; cursor:help;}
h1 { font-family: arial, helvetica, sans-serif;
font-size: 18pt; font-weight: bold;}
h2 { font-family: arial, helvetica, sans-serif;
font-size: 14pt; font-weight: bold;}
body { font-family: arial, helvetica,
sans-serif; font-size: 10pt;
scrollbar-3dlight-color:#ffffff;
scrollbar-arrow-color:#cccccc;
scrollbar-base-color: #9999cc;
scrollbar-darkshadow-color:#000000;
scrollbar-face-color:#9999cc;
scrollbar-highlight-color:#9999cc;
scrollbar-shadow-color: #ccccff;}
}
.line {border: 1px #000000 solid;}
td {background-color:#cccccc;}
th {background-color:#ccccff;
font-family: arial, helvetica, sans-serif;
font-size: 11pt; font-weight: bold; }
input{ background-color: #9999cc; border: 1px #000000 solid;}
option { background-color: #9999cc; border: 1px #000000 solid;}
textarea { background-color: #9999cc; border: 1px #000000 solid;}
select {background-color: #9999cc; border: 1px #000000 solid; }
//--></style>
<title>Calendar</title>
</head>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
function alias($monthnr){

  //-------------
    // pre: monthnr is een integer
    // post: retourneerd de naam van de maand

  switch ($monthnr){
    case
"01": return "Januari";
    case
"02": return "Februari";
    case
"03": return "Maart";
    case
"04": return "April";
        case
"05": return "Mei";
        case
"06": return "Juni";
        case
"07": return "Juli";
        case
"08": return "Augustus";
        case
"09": return "September";
        case
"10": return "Oktober";
        case
"11": return "November";
        case
"12": return "December";                
    }    
}

function
calendar($day,$month,$year){

  //-------------
    // pre: -
    // post: retourneerd een overzicht van een maand met wat knopjes

  $today=$day;
  $firstdayofthemonth= date ("w", mktime(0, 0, 0, $month, 0, $year));
  $dayforloop = 1 - $firstdayofthemonth;
  $lastdayofthemonth= date ("d", mktime(0, 0, 0, $month+1, -1, $year));
  $endweekday =    date ("w", mktime(0, 0, 0, $month+1, -1, $year));
    if (!$endweekday==0)
      $endday = $lastdayofthemonth + (7-$endweekday);
    else $endday = $lastdayofthemonth;
  
  echo "<form method=\"post\">";
    echo "<input type=\"hidden\" name=\"day\" value=\"$day\"></input>";
    echo "<input type=\"hidden\" name=\"month\" value=\"$month\"></input>";
    echo "<input type=\"hidden\" name=\"year\" value=\"$year\"></input>";
          
  echo "<table border=\"0\" cellpadding=\"03\" cellspacing=\"0\">";
    
  echo "<tr><th align=\"center\" colspan=\"6\"><input type=\"text\" align=\"center\" name=\"date\" value=\"".
             date ("d/m/y", mktime(0, 0, 0, $month, $day, $year))."\"></input></th><th>".
             "<input type=\"submit\" name=\"button\" value=\"go\"></input>".
             "</th></tr>";
    
    echo "<tr><th colspan=\"7\">".alias($month)."/$year</th></tr>";
            
  echo "<tr>
            <th align=\"center\">ma </th>
              <th align=\"center\">di </th>
              <th align=\"center\">wo </th>
              <th align=\"center\">do </th>
              <th align=\"center\">vr </th>
              <th align=\"center\">za </th>
              <th align=\"center\">zo</th>
              </tr>"
;
  echo "<tr>";

    
  while ($dayforloop<=$endday){
     // als de dag niet bij de huidige maand hoort, andere kleur geven
     if ( ($dayforloop<=0)|(($dayforloop-1)>$lastdayofthemonth) ) {echo "<td align=\"center\">";
       echo "<font color=\"#dddddd\">".date ("d", mktime(0, 0, 0, $month, $dayforloop, $year))."</font></td>";}
    
     // als het vandaag is, dan een mooi randje om de cel maken    
     elseif ($dayforloop==$today) echo "<td class=\"line\" align=\"center\">$dayforloop</td>";
    
     // zoniet, dan gewoon printen    
          else echo "<td align=\"center\">".date ("d", mktime(0, 0, 0, $month, $dayforloop, $year))."</td>";
  
     // wel of niet een nieuwe tablerow starten
     if (date ("w", mktime(0, 0, 0, $month, $dayforloop, $year))==0)
     if ( ($endday>=dayforloop)|(date("w",mktime(0,0,0,$month,$endday,$year))==0) ) echo"</tr>";
     else echo"</tr><tr>";

       $dayforloop++;
  }

    
    // nog wat knopjes voor navigatie
    echo "<tr><th><input type=\"submit\" name=\"button\" value=\"<\"></input></th>";
  echo "<th align=\"center\" colspan =\"5\"><input type=\"submit\" name=\"button\" value=\"today\"></input></th>";
  echo "<th><input type=\"submit\" name=\"button\" value=\">\"></input></th>";
  echo "</tr>";
  echo "</table>";
    echo "</form>";
}


//////////////////
// main
//////////////////

// formulier afvangen

switch ($_POST['button']){
  case
"<":
      //down
        if ($_POST['month']==1) {$month=12; $year=$_POST['year']-1; $year="0".$year;}
        else {$month = $_POST['month']-1; $year=$_POST['year'];}
        calendar($_POST['day'],$month,$year);
      break;
    case
">":
      //up
        if ($_POST['month']==12) {$month=1; $year=$_POST['year']+1;$year="0".$year;}
        else {$month = $_POST['month']+1; $year=$_POST['year'];}
        calendar($_POST['day'],$month,$year);
      break;
    case
"today":
      calendar(date("d"),date("m"),date("y"));
      break;
    case
"go":
        calendar(substr($_POST['date'],0,2),substr($_POST['date'],3,2),substr($_POST['date'],6,2));
        break;
    default:

      calendar(date("d"),date("m"),date("y"));
      break;
}


?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.