/
eventiLC.php
executable file
·189 lines (159 loc) · 6.47 KB
/
eventiLC.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
<?php
include('php/session.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<meta name="theme-color" content="#0d3c55">
<title>Eventi</title>
<!-- Latest compiled and minified CSS -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="dist/css/customcss.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="dist/css/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css"/>
<script type="text/javascript" src="dist/js/datatables.min.js"></script>
<script>
$(document).ready(function() {
var table = $('#eventi').DataTable( {
responsive:true,
bLengthChange: false,
language: {
"lengthMenu": "Mostra _MENU_ elementi",
"zeroRecords": "Nessun documento trovato",
"info": "Mostra pagina _PAGE_ di _PAGES_",
"infoEmpty": "Nessun documento presente",
"infoFiltered": "(filtra al massimo _MAX_ documenti')",
"search": "Cerca:",
"paginate": {
"first": "Prima",
"last": "Ultima",
"next": "Prossima",
"previous": "Precedente"
},
},
columnDefs: [
{
"targets": [ 3 ],
"visible": false,
"searchable": false
}],
columns: [
{ data: 'Nome' },
{ data: 'Descrizione' },
{ data: 'DataInserimento' },
{ data: 'Link' }
]
} );
$.ajax({
url: "php/eventiTab.php",
data:"&branca=LC",
dataType: "json",
success: function(response){
$.each(response, function (i,o) {
table.row.add({
"Nome": o.Nome,
"Descrizione":o.Descrizione,
"DataInserimento":o.DataInserimento,
"Link":o.Link,
}).draw();
});
},
error: function(){
alert('errore carico eventi');
}
});
//Al click del documento lo apre direttamente nel browser
$("#eventi tbody").on('click','tr',function(){
var data = table.row(this).data();
var url = data['Link'];
window.location ="http://"+url;
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="navbar">
<?php include_once('navbar.php'); ?>
</div>
<div class="container">
<div style="float:left">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalNorm">
Aggiungi materiale evento
</button>
<!-- Modal -->
<div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<form action="php/uploadFileEventi.php" method="POST" enctype="multipart/form-data">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Aggiungi materiale
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="form-group">
<label for="nomeAtt">Nome</label>
<input type="text" name="nomeEvento" class="form-control"
id="nomeAtt" placeholder=""/>
</div>
<div class="form-group">
<label for="descrizione">Descrizione</label>
<textarea class="form-control" name="descrizione" rows="5" id="descrizione"></textarea>
</div>
<input type="hidden" class="form-control" id="autore" name="autore" value="<?php echo ((isset($_SESSION["user"]))?$_SESSION["user"]:"nonce"); ?>"/>
<input type="hidden" name="action" value="upload" />
<input type="hidden" name="branca" id="branca" value="LC"/>
<label>Carica il tuo file:</label>
<input type="file" name="fileToUpload" id="fileToUpload" />
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<div style="float:right">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Chiudi
</button>
<input type="submit" class="btn btn-default" value="Conferma"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<br><br><br>
<div class="table-responsive">
<table class="table table-striped table-hover table-bordered" id = "eventi" name="eventi" cellspacing="0" width="100%">
<thead>
<tr>
<th>Nome</th>
<th>Descrizione</th>
<th>Data Inserimento</th>
<th>Link</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</body>
</html>