-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
428 lines (411 loc) · 14.3 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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<?php
// Funciones de conexión con la base de dato
require 'funciones.php';
//error_reporting(E_ALL);
$link = conectar();
session_start();
seguridad();
/*
echo "<pre>";
echo var_dump($_SESSION);
echo "</pre>";
/*
echo "<pre>";
echo var_dump($_POST);
echo "</pre>";
*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chamilo - Members Management</title>
<meta content="Chamilo - Members Management" name="description">
<!-- We need to emulate IE7 only when we are to use excanvas -->
<!--[if IE]> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <![endif]-->
<!-- Favicons -->
<link href="http://chamilo.nosolored.me/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<!-- Main Stylesheet -->
<link type="text/css" href="css/style4.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/custom.css" media="screen">
<!-- <link type="text/css" href="css/green.css" rel="stylesheet">-->
<!-- Your Custom Stylesheet -->
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.17.custom.css" media="screen">
<!--swfobject - needed only if you require <video> tag support for older browsers -->
<script src="js/swfobject.js" type="text/javascript"></script>
<!-- jQuery with plugins -->
<script src="js/jquery-1.8.2.js" type="text/javascript"></script>
<!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
<script src="js/jquery.ui.core.min.js" type="text/javascript"></script>
<script src="js/jquery.ui.widget.min.js" type="text/javascript"></script>
<script src="js/jquery.ui.tabs.min.js" type="text/javascript"></script>
<!-- jQuery tooltips -->
<script src="js/jquery.tipTip.min.js" type="text/javascript"></script>
<!-- Superfish navigation -->
<script src="js/jquery.superfish.min.js" type="text/javascript"></script>
<script src="js/jquery.supersubs.min.js" type="text/javascript"></script>
<!-- jQuery form validation -->
<script src="js/jquery.validate_pack.js" type="text/javascript"></script>
<!-- jQuery popup box -->
<script src="js/jquery.nyroModal.pack.js" type="text/javascript"></script>
<!-- jQuery graph plugins -->
<!--[if IE]><script type="text/javascript" src="js/flot/excanvas.min.js"></script><![endif]-->
<script src="js/flot/jquery.flot.min.js" type="text/javascript"></script>
<!-- Internet Explorer Fixes -->
<!--[if IE]> <link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/> <script src="js/html5.js"></script> <![endif]-->
<!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
<!--[if lt IE 8]> <script src="js/IE8.js"></script> <![endif]-->
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
/* setup navigation, content boxes, etc... */
Administry.setup();
$(".edit-member").click(function(e) {
e.preventDefault();
e.stopPropagation();
var vcod = $(this).parent().attr("id");
$("#result_edit").html('<div class="center"><br /><img src="images/nyro/ajaxLoader.gif" alt="cargando" /></div>');
$.post("funciones/configuracion_searcher.php",{tab:"edit_member",cod:vcod},
function(data){
if(data.status == "false"){
alert("Problem for edit");
$("#result_edit").html('');
}else{
$("#result_edit").html(data.contenido);
$("#save_edit").click(function(e) {
e.preventDefault();
e.stopPropagation();
var vcod = $("#member_edit #cod").attr("value");
var nombre = $("#member_edit #name").attr("value");
var apellidos = $("#member_edit #surname").attr("value");
var vemail = $("#member_edit #email").attr("value");
var pais = $("#member_edit #country").attr("value");
var telefono = $("#member_edit #phone").attr("value");
var vquota = $("#member_edit #quota").attr("value");
var tipo = $("#member_edit #type").attr("value");
var institucion = $("#member_edit #institution").attr("value");
var direccion = $("#member_edit #address").attr("value");
var cpostal = $("#member_edit #postal_code").attr("value");
var nvat = $("#member_edit #vat").attr("value");
var estado = $("#member_edit #status").attr("value");
var lenguaje = $("#member_edit #language").attr("value");
var renovacion = $("#member_edit #renewal").attr("value").replace(/\//g, '-');
var comentarios = $("#member_edit #comment").attr("value");
$.post("funciones/configuracion_searcher.php",{tab:"editar",cod:vcod,name:nombre,surname:apellidos,email:vemail,country:pais,phone:telefono,quota:vquota,type:tipo,institution:institucion,address:direccion,postal_code:cpostal,vat:nvat,status:estado,language:lenguaje,renewal:renovacion,comment:comentarios},
function(data){
if(data.status == "false"){
alert("Error while editing");
}else{
$("#result_edit").html('');
//Actualizar los 3 campos de la tabla que se ha editado
alert("updated correctly");
$("#"+data.cod).prev().prev().prev().prev().prev().html(data.name);
$("#"+data.cod).prev().prev().prev().prev().html(data.surname);
$("#"+data.cod).prev().prev().prev().html(data.email);
$("#"+data.cod).prev().prev().html(data.renewal);
if(data.notice_email == "YES"){
$("#"+data.cod).prev().css("background","#A5DF00");
$("#"+data.cod).prev().html('<strong>'+data.notice_email+'</strong>');
}else{
$("#"+data.cod).prev().css("background","#F5D0A9");
$("#"+data.cod).prev().html('<strong>'+data.notice_email+'</strong>');
}
}
}, "json");
return false;
});
$("#member_edit #type").change(function(){
var tipo = $(this).attr("value");
if(tipo=='2' || tipo=='5'){
$("#company").show();
$("#institution").removeAttr('disabled');
}else{
$("#company").hide();
$("#institution").attr("disabled","disabled");
}
});
$("#renewal").datepicker({
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true
});
}
},"json");
});
$(".renovar").click(function(e) {
e.preventDefault();
e.stopPropagation();
var vcod = $(this).parent().attr("id");
if(confirm("Update member?")){
$.post("funciones/configuracion_searcher.php",{tab:"renovar_miembro",cod:vcod},
function(data){
if(data.status=="false"){
alert("Error update");
}else{
window.location.href="index.php";
}
}, "json");
}
return false;
});
$(".eliminar-usuario").click(function(e) {
e.preventDefault();
e.stopPropagation();
var vcod = $(this).parent().attr("id");
if(confirm("Erase member?")){
$.post("funciones/configuracion_searcher.php",{tab:"eliminar_usuario",cod:vcod},
function(data){
if(data.status=="false"){
alert("Error erase");
}else{
$("#"+data.cod).parent().remove();
}
}, "json");
}
return false;
});
});
</script>
</head>
<body>
<!-- Header -->
<header id="top">
<div class="wrapper">
<!-- Title/Logo - can use text instead of image -->
<div id="title">
<img alt="Members Management" src="images/logo.png">
<!--<span>Administry</span> demo-->
</div>
<!-- Top navigation -->
<div id="topnav">
Logged in as
<b><?php echo htmlspecialchars($_SESSION['usuario']); ?></b>
<span>|</span>
<a href="setting.php">Settings</a>
<span>|</span>
<a href="logout.php">Logout</a>
<br>
</div>
<!-- End of Top navigation -->
<!-- Main navigation -->
<?php include_once 'menu/top-menu.php'; ?>
<!-- End of Main navigation -->
<!-- Future Proyect -- Aside links
<aside>
<b>English</b>
·
<a href="#">Spanish</a>
·
<a href="#">German</a>
</aside>
-->
<!-- End of Aside links -->
</div>
</header>
<!-- End of Header -->
<!-- Page title -->
<div id="pagetitle">
<div class="wrapper">
<h1>Dashboard</h1>
<!-- Quick search box -->
<form method="get" action="">
<input id="q" class="" type="text" name="q">
</form>
</div>
</div>
<!-- End of Page title -->
<!-- Page content -->
<div id="page">
<!-- Wrapper -->
<div class="wrapper">
<!-- Left column/section -->
<section class="column width6 first">
<div class="colgroup leading">
<div class="column width3 first">
<h3>
Welcome back,
<a href="profile.php"><?php echo htmlspecialchars($_SESSION['name']); ?></a>
</h3>
<p>You are in the management platform Chamilo members</p>
</div>
<div class="column width3">
<h4>Last login</h4>
<p>
<?php echo date("l F d\\t\h, Y \\a\\t h:ia",$_SESSION['last_login']).' from '. $_SESSION['last_ip']; ?>
</p>
</div>
</div>
<div class="colgroup leading">
<div class="column width3 first">
<h4>Members Status</h4>
<hr>
<table class="no-style full">
<tbody>
<?php
$link = conectar();
$result_num = $link->query("SELECT count('cod') AS num FROM members");
$tmp = $result_num->fetch_assoc();
$num_members = $tmp['num'];
$estilo = array("progress-green","progress-blue","progress-red");
$sql = "SELECT * FROM status";
$result = $link->query($sql);
$i = 0;
while ($tmp_status = $result->fetch_assoc()){
$result_num = $link->query("SELECT count('cod') AS num FROM members WHERE status='".$tmp_status['cod']."'");
$tmp = $result_num->fetch_assoc();
$num_status = $tmp['num'];
echo '<tr>';
echo '<td>'.$tmp_status['status'].'</td>';
echo '<td class="ta-right">'. $num_status .'/'.$num_members.'</td>';
echo '<td>';
echo '<div id="progress1" class="progress full '.$estilo[($i%3)].'" value="'.$num_status.'">';
if($num_members > 0 ){
echo '<span style="width: '.round((($num_status/$num_members)*100)).'%; display: block;">';
echo '<b style="display: inline;">'.round((($num_status/$num_members)*100)).'%</b>';
}else{
echo '<span style="width:0%; display: block;">';
echo '<b style="display: inline;">0%</b>';
}
echo '</span>';
echo '</div>';
echo '</td>';
echo '</tr>';
$i++;
}
?>
</tbody>
</table>
</div>
<div class="column width3">
<h4>
Statistics:
</h4>
<hr>
<table class="no-style full">
<tbody>
<?php
$sql = "SELECT COUNT(*) AS cuenta, SUM(quota) AS suma FROM members WHERE date_arrival > '".date("Y-m")."-01'";
$result = $link->query($sql);
$aux = $result->fetch_assoc();
?>
<tr>
<td>New inscriptions this month</td>
<td class="ta-right">
<a href="#"><?php echo $aux['cuenta']; ?></a>
</td>
<td class="ta-right"><?php echo number_format($aux['suma'],2,'.',' '); ?> €</td>
</tr>
<?php
$sql = "SELECT COUNT(*) AS cuenta, SUM(quota) AS suma FROM members WHERE date_arrival > '".date("Y")."-01-01'";
$result = $link->query($sql);
$aux = $result->fetch_assoc();
?>
<tr>
<td>New inscriptions this year</td>
<td class="ta-right">
<a href="#"><?php echo $aux['cuenta']; ?></a>
</td>
<td class="ta-right"><?php echo number_format($aux['suma'],2,'.',' '); ?> €</td>
</tr>
<?php
$sql = "SELECT COUNT(*) AS cuenta, SUM(quota) AS suma FROM members WHERE mark_renewal > '".date("Y-m")."-01'";
$result = $link->query($sql);
$aux = $result->fetch_assoc();
?>
<tr>
<td>Renovations this month</td>
<td class="ta-right">
<a href="#"><?php echo $aux['cuenta']; ?></a>
</td>
<td class="ta-right"><?php echo number_format($aux['suma'],2,'.',' '); ?> €</td>
</tr>
<?php
$sql = "SELECT COUNT(*) AS cuenta, SUM(quota) AS suma FROM members WHERE mark_renewal > '".date("Y")."-01-01'";
$result = $link->query($sql);
$aux = $result->fetch_assoc();
?>
<tr>
<td>Renovations this year</td>
<td class="ta-right">
<a href="#"><?php echo $aux['cuenta']; ?></a>
</td>
<td class="ta-right"><?php echo number_format($aux['suma'],2,'.',' '); ?> €</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
$sql = "SELECT * FROM members WHERE renewal > DATE_SUB(NOW(), INTERVAL 1 WEEK) AND renewal < DATE_SUB(NOW(),INTERVAL -3 WEEK) ORDER BY renewal ASC";
$result = $link->query($sql);
?>
<div class="colgroup leading">
<div class="width6">
<h4 style="display:inline-block; margin-bottom:0;">
Members with next expiration date:
<a href="#"><?php echo $result->num_rows; ?></a>
</h4>
<a style="float:right" href="cron.php" title="Execute cron"><img src="images/cron.png" style="margin-top:10px" alt="cron"></a>
<hr>
<?php
if($result->num_rows>0){
echo '<div id="result_searcher" align="center">';
echo '<table class="stylized" width="100%">';
echo '<tr><th>N</th><th class="name">Name</th><th class="surname">Surname</th><th class="email">E-mail</th><th class="renewal">Renewal</th><th class=ta-center">Renewal notice</th><th class="option">Options</th></tr>';
$i = 0;
while($row = $result->fetch_assoc()){
$i += 1;
if($i%2==0){
echo '<tr class="campo2">';
}else{
echo '<tr>';
}
echo '<td>'.$i.'</td>';
echo '<td>'.htmlspecialchars($row['name']).'</td>';
echo '<td>'.htmlspecialchars($row['surname']).'</td>';
echo '<td>'.htmlspecialchars($row['email']).'</td>';
echo '<td class="ta-center">'.date("d/m/Y",strtotime($row['renewal'])).'</td>';
if($row['email_renewal'] == '1'){
echo '<td class="ta-center" style="background:#A5DF00;"><strong>Yes</strong></td>';
}else{
echo '<td class="ta-center" style="background:#F5D0A9;"><strong>No</strong></td>';
}
echo '<td id="member'.$row['cod'].'" class="options-width">';
echo '<a href="renovar-user.php?cod='.$row['cod'].'" title="Renewal" class="renovar"><img src="images/update.png" /></a> ';
echo '<a href="edit-user.php?cod='.$row['cod'].'" title="Edit '.$row['usuario'].'" class="edit-member info-tooltip"><img src="images/note_edit.png" /></a> ';
echo '<a href="delete-user.php?cod='.$row['cod'].'" title="Delete" '.$row['usuario'].'" class="eliminar-usuario"><img src="images/delete.png" /></a>';
echo '</td>';
echo '</tr>';
}
echo '</table></div>';
$result->free_result();
}
?>
</div>
<div id="result_edit"></div>
</div>
<div class="clear"> </div>
</section>
<!-- End of Left column/section -->
<!-- Right column/section -->
<?php include_once 'menu/right-menu.php'; ?>
<!-- End of Right column/section -->
</div>
<!-- End of Wrapper -->
</div>
<!-- End of Page content -->
<!-- Page footer -->
<?php include_once 'menu/footer-menu.php'; ?>
<!-- End of Animated footer -->
<!-- Scroll to top link -->
<a id="totop" style="display: block;">^ scroll to top</a>
<!-- Admin template javascript load -->
<script src="js/administry.js" type="text/javascript"></script>
<div id="tiptip_holder" style="max-width:200px;">
<div id="tiptip_arrow">
<div id="tiptip_arrow_inner"></div>
</div>
<div id="tiptip_content"></div>
</div>
</body>
</html>