-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvanoce.php
128 lines (115 loc) · 5.13 KB
/
vanoce.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
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
121
122
123
124
125
126
127
128
<?php
$darky = [
[
"jmeno" => "Martin",
"popis" => "Lezecké boty",
"cena" => 333,
"koupeno" => true,
],
[
"jmeno" => "Petr",
"popis" => "Knížka o programování",
"cena" => 129,
"koupeno" => false,
],
[
"jmeno" => "Markéta",
"popis" => "Zimní bunda",
"cena" => 950,
"koupeno" => true,
],
[
"jmeno" => "Petr",
"popis" => "Sluchátka",
"cena" => 1500,
"koupeno" => false,
],
[
"jmeno" => "Jirka",
"popis" => "Svetr se soby",
"cena" => 500,
"koupeno" => false,
],
];
?>
<!DOCTYPE html>
<html lang ="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Vánoční dárky</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAP//AAD8PwAA8A8AAMADAACAAQAAgAEAAIABAACAAQAAgAEAAIABAADAAwAA4AcAAPw/AAD//wAA//8AAA==" rel="icon" type="image/x-icon" />
<style>
.display-5 { font-size: 2.5rem; font-weight: 300; line-height: 1.2;}
</style>
</head>
<body>
<div class="container">
<!-- hlavička -->
<div class="header navbar navbar-light bg-success text-white rounded mt-2 mb-4">
<h1>Vánoční dárky</h1>
</div>
<!-- Zde uděláme výpis dárků -->
<h2>Seznam dárků</h2>
<ul class="list-group my-3">
<?php foreach ($darky as $darek) { ?>
<li class="list-group-item">
<!-- Zobrazení fajfky u již zakoupených dárků a křížku u nezakoupených (úkol 1.) -->
<?php if ($darek["koupeno"]) { echo "✅";} else {echo "❌";}?>
<!-- Popis dárku -->
<?php echo $darek["popis"];?>
<!-- Štítek s cenou -->
<?php
if ($darek["cena"] < 200) {
$barva = "badge-success";
} elseif ($darek["cena"] > 1000) {
$barva = "badge-warning";
} else {
$barva = "badge-secondary";
}
?>
<span class="badge <?php echo $barva; ?>"><?php echo $darek["cena"]; ?> Kč</span>
</li>
<?php } ?>
</ul>
<p>
<strong>Celkem dárků: <?php echo count($darky);?></strong>
</p>
<!-- úkol 2. -->
<h2>Příliš drahé dárky</h2>
<ul class="list-group my-3">
<?php foreach ($darky as $darek) {
if ($darek["cena"] > 1000) { ?>
<li class="list-group-item"><?php echo $darek["popis"]; ?></li>
<?php }
} ?>
</ul>
<!-- úkol 3. -->
<h2 class="mt-2">Etikety</h2>
<?php foreach ($darky as $darek) { ?>
<div class="card mt-1 w-25">
<div class="card-body display-3">
<?php echo $darek["jmeno"]; ?>
</div>
</div>
<?php } ?>
<!-- úkol 4. -->
<h2 class="mt-2">Etikety (s přizpůsobením velikosti písma)</h2>
<?php foreach ($darky as $darek) {
$velikostPisma = "display-3";
if (strlen($darek["jmeno"]) > 7) {
$velikostPisma = "display-4";
}
?>
<div class="card mt-1 w-25">
<div class="card-body <?php echo $velikostPisma; ?>">
<?php echo $darek["jmeno"]; ?>
<!-- délka: <?php echo strlen($darek["jmeno"]); ?> -->
</div>
</div>
<?php } ?>
</div>
</body>
</html>