-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (34 loc) · 1.75 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
<?php include_once 'views/header.php'; ?>
<?php
require_once 'controllers/ParkingSpotController.php';
require_once 'models/ParkingSpotService.php';
$parking_spots = ParkingSpotController::getAllParkingSpots();
$free_spots = ParkingSpotController::countFreeParkingSpots($parking_spots);
?>
<div class="container">
<?php if (is_logged_in()) { ?>
<h1>Статус на паркинга</h1>
<div class="card-deck">
<?php foreach ($parking_spots as $spot) : ?>
<div class="card text-white <?php echo $spot->isFree() ? 'bg-success' : 'bg-danger' ?>">
<div class="card-header">Място номер <?php echo $spot->getNumber() ?></div>
<div class="card-body">
<p class="card-text">
<?php if ($spot->isFree()) { ?>
Мястото е свободно
<?php } else { ?>
<p>Заето от <?php echo $spot->getOwner() ?>.</p>
<p>Oт <?php echo $spot->getTimeIn() ?> <?php echo ($spot->getTimeOut() ? "до ".$spot->getTimeOut() : "") ?>.</p>
<?php } ?>
</p>
</div>
</div>
<?php endforeach; ?>
</div>
<?php } else { ?>
<h1>Добре дошли!</h1>
<h3>В момента има <?php echo $free_spots ?> свободни места.</h3>
<h3>За да видите повече детайли или да вдигнете бариерата, моля влезте в профила си.</h3>
<?php } ?>
</div>
<?php include_once 'views/footer.php'; ?>