-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_alters.php
139 lines (120 loc) · 5.84 KB
/
add_alters.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
<?php
session_start();
if (!isset($_SESSION['id'])) {
header("Location:index.php");
} else {
$user_id = $_SESSION['id'];
}
require_once('system/data.php');
require_once('system/security.php');
$page = 'add_alters';
if (isset($_GET['action'])) {
if ($_GET['action'] == 'edit') {
$alt = get_single_record('alters', $_GET['id']);
}
if ($_GET['action'] == 'delete') {
$alt = delete_record('alters', $_GET['id']);
header("Location:add_alters.php");
}
}
if (isset($_POST['data'])) {
if ($_POST['data']['id'] != '') {
update_record('alters', $_POST['data']['id'], $_POST['data']);
} else {
add_record('alters', $_POST['data']);
}
header("Location:add_alters.php");
}
$alters = get_records('alters');
?>
<!DOCTYPE html>
<html lang="de">
<?php include './header.php'; ?>
<body>
<div class="wrapper">
<?php include 'sidebar.php'; ?>
<!-- Page Content Holder -->
<div id="content">
<?php include './navigation.php'; ?>
<div class=container-fluid>
<div class="row">
<!-- begin col-6 -->
<div class="col-md-12">
<!-- begin panel -->
<div class="panel panel-inverse" >
<div class="panel-heading">
<div class="panel-heading-btn">
</div>
<h4 class="panel-title">Alterskategorie</h4>
</div>
<div class="panel-body col-md-12">
<div class="col-md-6">
<form method="POST" action="">
<table class="table">
<tbody>
<tr>
<td>Alter eingeben</td>
<td>
<input type="text" name="data[name]" class="form-control" value="<?php echo @$alt['name']; ?>">
<input type="hidden" name="data[id]" class="form-control" value="<?php echo @$alt['id']; ?>">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" class="form-control btn btn-primary" value="Speichern">
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="col-md-6">
<div class="table-responsive">
<table id="data-table1" class="table table-striped table-bordered">
<thead>
<tr>
<th colspan="2">Alterskategorien</th>
</tr>
<tr>
<th>Name</th>
<th>Löschen / Bearbeiten</th>
</tr>
</thead>
<tbody>
<?php
foreach ($alters as $key => $value) {
?>
<tr>
<td><?php echo $value['name']; ?></td>
<td>
<a class="btn btn-warning" href="add_alters.php?action=edit&id=<?php echo $value['id']; ?>">Bearbeiten</a>
<a class="btn btn-danger" onclick="return confirm('Sind Sie sicher?');" href="add_alters.php?action=delete&id=<?php echo $value['id']; ?>">Löschen</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!--/container-->
</div><!--/content-->
</div><!--/wrapper-->
<!-- jQuery -->
<script>
$(document).ready(function () {
$('#data-table1').DataTable( {
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
}
});
});
</script>
</body>
</html>