-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathstempelterminal.php
311 lines (303 loc) · 10.7 KB
/
stempelterminal.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<?php
/********************************************************************************
* Small Time - Beispiel für ein einfaches Touch - Screen - Stempelterminal
* bei nichtgebrauch Datei löschen
/*******************************************************************************
* Version 0.9.1
* Author: IT-Master
* www.it-master.ch / info@it-master.ch
* Copyright (c), IT-Master, All rights reserved
*******************************************************************************/
// Zeitzone setzten, damit die Stunden richtig ausgerechnet werden
date_default_timezone_set("Europe/Paris");
@setlocale(LC_TIME, 'de_DE.UTF-8', 'de_DE@euro', 'de_DE', 'de-DE', 'de', 'ge', 'de_DE.UTF-8', 'German');
//Memory - ab ca. 15 Usern auf 32 stellen, ab 30 auf 64 und ab 60 auf 128M usw.
@ini_set('memory_limit', '32M');
// Microtime für die Seitenanzeige (Geschwindigkeit des Seitenaufbaus)
$_start_time = explode(" ", microtime());
$_start_time = $_start_time[1] + $_start_time[0];
$_grpwahl = '2';
$gruppe = 2;
if (isset($_GET['gruppe'])) {
$_grpwahl = $_GET['gruppe'];
$gruppe = $_GET['gruppe'];
}
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
include_once('./include/class_absenz.php');
include_once('./include/class_user.php');
include_once('./include/class_group.php');
include_once('./include/class_login.php');
include_once('./include/class_template.php');
include_once('./include/class_time.php');
include_once('./include/class_month.php');
include_once('./include/class_jahr.php');
include_once('./include/class_feiertage.php');
include_once('./include/class_filehandle.php');
include_once('./include/class_rapport.php');
include_once('./include/class_show.php');
include_once('./include/class_settings.php');
include("./include/time_funktionen.php");
$_grpwahl = $_grpwahl - 1;
$_group = new time_group($_grpwahl);
if (isset($id))
$_grpwahl = $_group->get_usergroup($id);
$anzMA = count($_group->_array[1][$_grpwahl]);
foreach ($_group->_array[0] as $gruppen) {
//echo $gruppen[0];
}
if (isset($_GET['json'])) {
//-------------------------------------------------------------------------------------------------------------
// Anwesenheitsliste in ein JSON laden
//-------------------------------------------------------------------------------------------------------------
$tmparr = array();
for ($x = 0; $x < $anzMA; $x++) {
$tmparr[$x]['gruppe'] = trim($_group->_array[0][$_grpwahl][$x]);
$tmparr[$x]['mitarbeiterid'] = trim($_group->_array[1][$_grpwahl][$x]);
$tmparr[$x]['loginname'] = trim($_group->_array[2][$_grpwahl][$x]);
$tmparr[$x]['pfad'] = trim($_group->_array[3][$_grpwahl][$x]);
// Mitarbeiter - Name
$tmparr[$x]['username'] = trim($_group->_array[4][$_grpwahl][$x]);
//Anwesend oder nicht
$tmparr[$x]['anwesend'] = (count($_group->_array[5][$_grpwahl][$x])) % 2;
if ($tmparr[$x]['anwesend']) {
$tmparr[$x]['status'] = 'Anwesend';
} else {
$tmparr[$x]['status'] = 'Abwesend';
}
// Mitarbeiter - Bild anzeigen
if (file_exists("./Data/".$_group->_array[2][$_grpwahl][$x]."/img/bild.jpg")) {
$tmparr[$x]['bild'] = "./Data/".$_group->_array[2][$_grpwahl][$x]."/img/bild.jpg";
} else {
$tmparr[$x]['bild'] = "./images/ico/user-icon.png";
}
if (isset($_group->_array[5][$_grpwahl][$x][count($_group->_array[5][$_grpwahl][$x]) - 1])) {
$tmparr[$x]['lasttime'] = $_group->_array[5][$_grpwahl][$x][count($_group->_array[5][$_grpwahl][$x]) - 1];
$tmparr[$x]['alltime'] = implode(" - ", $_group->_array[5][$_grpwahl][$x]);
} else {
$tmparr[$x]['lasttime'] = '';
$tmparr[$x]['alltime'] = '';
}
$tmparr[$x]['passwort'] = trim($_group->_array[7][$_grpwahl][$x]);
$idtime_secret = 'CHANGEME';
// stempeln über idtime
//http://localhost:88/Kunden/time.repmo.ch/idtime.php?id=1864f9f71f65975b
$hash = sha1($tmparr[$x]['pfad'].$tmparr[$x]['passwort'].crypt($tmparr[$x]['pfad'], '$2y$04$'.substr($idtime_secret.$tmparr[$x]['passwort'], 0, 22)));
$tmparr[$x]['idtime'] = substr($hash, 0, 16);
}
echo json_encode($tmparr);
} else {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<!--<meta http-equiv="refresh" content="10">-->
<title>SmallTime - Touch - Screen - Stempelterminal</title>
<link href='https://fonts.googleapis.com/css?family=Rambla:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700italic,700' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.js"></script>
<style>
body{
background-color: #70858f;
font-size: 0.8em;
}
.alert-danger, .alert-error {
background-color: #e9c7c7;
border-color: #da9e9e;
}
.alert-success {
background-color: #d1e9c7;
border-color: #A6C48D;
}
.alert {
padding: 6px 6px 6px 6px;
margin-bottom: 20px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
/*background-color: #fcf8e3;*/
border: 1px solid #fbeed5;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
color: #000000;
}
table{
margin-top: 2em;
}
.mitarbeiter{
display: -ms-flex;
display: -webkit-flex;
display: flex;
margin: 10px;
}
.bild{
-webkit-flex: 1;
flex: 1;
-webkit-order: 1;
order: 1;
}
.bild img{
width: 100%;
}
.name{
-webkit-flex: 2;
flex: 2;
-webkit-order: 2;
order: 2;
}
.row{
}
nav ul li.active {
background-color: rgba(0, 0, 0, 0.6);
}
.container .row {
margin-left: 0;
margin-right: 0;
}
@media only screen and (min-width: 1200px){
.container{
width: 80%;
max-width: 1600px;
}
}
@media only screen and (min-width: 993px){
.container{
width: 95%;
}
}
@media only screen and (min-width: 601px){
.container{
width: 95%;
}
}
</style>
<script>
(function($)
{
$(function()
{
$(".button-collapse").sideNav();
}); // End Document Ready
})(jQuery); // End of jQuery name space
function start(){
uebersicht('?gruppe=<?php echo $gruppe; ?>&json');
//uebersicht('repmo_json.php?group=<?php echo $_grpwahl; ?>&json');
}
function mastempeln(str){
console.log(str);
idtime(str);
}
function idtime(id)
{
$.ajax(
{
url: 'idtime.php?id=' + id + '&w=no',
//url: url,
type: 'get',
dataType: 'text',
async: true,
success: function(response)
{
console.log(response);
uebersicht('?gruppe=<?php echo $gruppe; ?>&json');
}
});
}
function uebersicht(url)
{
$.ajax(
{
//url: 'idtime.php?id=' + id + '&w=no',
url: url,
type: 'get',
dataType: 'json',
async: true,
success: function(response)
{
console.log(response);
$('#maanzeige').html('');
//$('#matemplate').show();
var panel = $('#matemplate').clone();
$('#matemplate').hide();
for (i = 0; i < response.length; i++) {
var new_panel = panel.clone();
// Tabelle farblich unterscheiden
if (response[i].anwesend == 1) {
new_panel.find('.mitarbeiter').addClass('green lighten-1');
} else {
new_panel.find('.mitarbeiter').addClass('deep-orange accent-2');
}
//<img src="{{bild}}" alt="{{username}}" />
new_panel.find('#img').html('<img src="'+ response[i].bild+'" alt="'+ response[i].username+'" />');
var html_for_mustache = new_panel.html();
var html = Mustache.to_html(html_for_mustache, response[i]);
$('#maanzeige').append(html);
};
}
});
}
</script>
</head>
<body onload="start();">
<!-- NAVIGATION !-->
<nav class="navbar blue-grey darken-3" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="?" class="brand-logo"><span class="fa fa-fw fa-home fa-1x"></span>Home</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<?php
$i = 2;
foreach ($_group->_array[0] as $gruppen) {
echo '<li ';
if (intval($gruppe) == $i)
echo 'class="active" ';
echo 'id="menue'.$i.'" ><a href="?gruppe='.$i.'" id="seite'.$i.'"><i class="fa fa-users fa-2"></i> '.$gruppen[0].'</a></li>';
$i++;
}
echo '<li ><a href="index.php" target="_new"><i class="fa fa-home fa-2"></i> Index.php</a></li>';
echo '<li ><a href="admin.php" target="_new"><i class="fa fa-lock fa-2"></i> Admin.php</a></li>';
echo '</ul><ul class="side-nav" id="mobile-demo">';
$i = 2;
foreach ($_group->_array[0] as $gruppen) {
echo '<li ';
if (intval($gruppe) == $i)
echo 'class="active" ';
echo 'id="mobmenue'.$i.'"><a href="?gruppe='.$i.'" id="mobseite'.$i.'"><i class="fa fa-users fa-2"></i> '.$gruppen[0].'</a></li>';
$i++;
}
echo '<li ><a href="index.php" target="_new"><i class="fa fa-home fa-2"></i> Index.php</a></li>';
echo '<li ><a href="admin.php" target="_new"><i class="fa fa-lock fa-2"></i> Admin.php</a></li>';
?>
</ul>
</div>
</nav>
<!-- CONTENT !-->
<div class="container" id="ContentHTML">
<div class="container">
<div id="maanzeige" class="row"></div>
<div id="matemplate" style="visibility: hidden">
<div class="col s12 m6 l4">
<div class=" mitarbeiter " onclick="mastempeln('{{idtime}}')" >
<div class="bild" id="img"><img src="{{bild}}" alt="{{username}}" /></div>
<div class="name"><h5>{{username}}</h5><p>
{{alltime}}
<hr>
{{status}} seit: {{lasttime}}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}
?>