-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
82 lines (76 loc) · 1.48 KB
/
index.php
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
<?php
date_default_timezone_set("America/Fortaleza");
$today = date("d");
$month = intval(date("m"));
$year = date("Y");
$months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho",
"Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
$month = $months[$month-1];
$firstDay = date("w", strtotime(date("Y-m-1"))) + 1;
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Calendário</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<table>
<thead>
<tr>
<th class="month">
<?php echo $month . " de " . $year; ?>
</th>
</tr>
<tr class="daysOfWeek">
<th>Dom</th>
<th>Seg</th>
<th>Ter</th>
<th>Qua</th>
<th>Qui</th>
<th>Sex</th>
<th>Sáb</th>
</tr>
</thead>
<tbody>
<?php
$lastDay = 1;
for($week = 1; $week <= 5; $week++){
?>
<tr>
<?php
for($day = 1; $day <= 7; $day++){
if($week == 1 && $day < $firstDay){
?>
<td></td>
<?php
}elseif($lastDay > 31){
?>
<td></td>
<?php }elseif($lastDay == $today){ ?>
<td class="today">
<?php
echo $lastDay;
$lastDay++;
?>
</td>
<?php }else{ ?>
<td>
<?php
echo $lastDay;
$lastDay++;
?>
</td>
<?php
}
}
?>
</tr>
<?php } ?>
</tbody>
</table>
<script src="./script.js"></script>
</body>
</html>