-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroups.php
164 lines (134 loc) · 4.65 KB
/
groups.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?
require_once "php/connect_db.php";
session_start();
if (!isset($_SESSION['logged'])) header("Location: login.php");
else{
$data = $_GET;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Информационная система Детсада</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="" name="keywords">
<meta content="" name="description">
<!-- Favicons -->
<link href="img/favicon.png" rel="icon">
<link href="img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Roboto:100,300,400,500,700|Philosopher:400,400i,700,700i" rel="stylesheet">
<!-- Bootstrap css -->
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Libraries CSS Files -->
<link href="lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- Main Stylesheet File -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<header id="header" class="header header-hide">
<div class="container">
<div id="logo" class="pull-left">
<h1><a href="#body" class="scrollto"><span>Лю</span>бимый садик</a></h1>
</div>
<nav id="nav-menu-container">
<ul class="nav-menu">
<li class="menu-active"><a href="index.php">Домой</a></li>
<li><a href="educators.php">Воспитатели</a></li>
<li><a href="groups.php">Список Групп</a></li>
<li><a href="regtodetsad.php">Регистрация в детский сад</a></li>
<li><a href="lessons.php">Наши Кружки</a></li>
<li><a href="php/logout.php">Выйти</a></li>
<?
if ($_SESSION['logged']->admin == 1) {
echo '<li><a href="apanel.php">Админ-панель</a></li>';
}?>
</ul>
</nav><!-- #nav-menu-container -->
</div>
</header><!-- #header -->
<!--==========================
Hero Section
============================-->
<section id="hero" class="wow fadeIn">
<div class="hero-container">
<h1>Добро пожаловать в любимый садик</h1>
<h2>Приведите детей утром, получите гениев вечером</h2>
<img src="img/sadik-global.jpg" style="width: 100%;height: auto;" alt="global-sad">
<a href="educators.php" class="btn-get-started scrollto">Воспитатели</a>
</div>
</section><!-- #hero -->
<div class="container">
<div class="row">
<div class="col-md-10">
<div class="groups">
<form action="groups.php" class="groups" method="GET">
<select name="groups_id" class="form-control">
<?php
$groups = R::findAll('groups');
foreach ($groups as $key => $value) {
if ($data['groups_id'] == $value->id) {
echo '<option value="' . $value->id . '" selected>' . $value->name . '</option>';
}else{
echo '<option value="' . $value->id . '">' . $value->name . '</option>';
}
}?>
</select>
</div>
</div>
<div class="col-md-2">
<input type="submit" name="submit" class="btn btn-success">
</div>
</form>
</div>
</div>
<div class="container">
<div class="row">
<table border="1" class="table">
<tr>
<td>Имя</td>
<td>Фамилия</td>
<td>День рождения</td>
<td>Группа</td>
</tr>
<?php
if (isset($data['groups_id'])) {
$childs = R::findAll('childs', 'id_group = ? and active = ?', array($data['groups_id'], 1));
foreach ($childs as $key => $value) {
$group_id = R::findOne('groups', 'id = ?', array($value->id_group));
echo "<tr>
<td>" . $value->fname . "</td>" .
"<td>" . $value->sname . "</td>" .
"<td>" . $value->birthdate . "</td>" .
"<td>" . $group_id->name . "</td>
</tr>";
}
# code...
}else{
$childs = R::findAll('childs', 'active = ?', [1]);
foreach ($childs as $key => $value) {
$group_id = R::findOne('groups', 'id = ?', array($value->id_group));
echo "<tr>
<td>" . $value->fname . "</td>" .
"<td>" . $value->sname . "</td>" .
"<td>" . $value->birthdate . "</td>" .
"<td>" . $group_id->name . "</td>
</tr>";
}
}
?>
</table>
</div>
</div>
<a href="#" class="back-to-top"><i class="fa fa-chevron-up"></i></a>
<!-- JavaScript Libraries -->
<script src="lib/jquery/jquery.min.js"></script>
<script src="lib/jquery/jquery-migrate.min.js"></script>
<script src="lib/superfish/superfish.min.js"></script>
<script src="lib/wow/wow.min.js"></script>
<!-- Template Main Javascript File -->
<script src="js/main.js"></script>
</body>
</html>
<? }
?>