-
Notifications
You must be signed in to change notification settings - Fork 0
/
paginaMostraAttivita.php
executable file
·212 lines (181 loc) · 7.62 KB
/
paginaMostraAttivita.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
<?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>Attivita'</title>
<!-- Latest compiled and minified CSS -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="dist/css/customcss.css" rel="stylesheet">
<link href="dist/css/carousel.css" rel="stylesheet">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</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 type="text/javascript" src="dist/js/moment-with-locales.js"></script>
<script>
$(document).ready(function($) {
var table = $('#attivita').DataTable( {
responsive:true,
pageLength: 15,
bLengthChange: false,
language: {
"lengthMenu": "Mostra _MENU_ elementi",
"zeroRecords": "Nessun attivita' trovata",
"info": "Mostra pagina _PAGE_ di _PAGES_",
"infoEmpty": "Nessun attivita' presente",
"infoFiltered": "(filtra al massimo _MAX_ attivita')",
"search": "Cerca:",
"paginate": {
"first": "Prima",
"last": "Ultima",
"next": "Prossima",
"previous": "Precedente"
},
},
ajax: {
url: "php/getUltimeAttivita.php",
dataSrc:""
},
columnDefs: [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
}],
columns: [
{data: 'id'},
{ data: 'Nome' },
{ data: 'Descrizione' },
{ data: 'Branca' },
{ data: 'Autore' },
{ data: 'DataInserimento' ,
'render': function (data) {
return (moment(data).format("DD/MM/YYYY"));
}},
{ data: 'url',"render": function ( data, type, row, meta ) {
return "<a href='mostraAttivita.php?id=" + row['id']+ "'>" + "Apri" + '</a>';}}
]
} );
$("#form").submit(function(e){
alert($("#form").serialize());
$.ajax({
type: "POST",
url: "php/ricercaAttivita.php",
data: $("#form").serialize(),
dataType: "json",
success: function(response){
var trHTML = '';
$("#attivita tr").html("");
},
error: function(){
alert('errore carico attivita');
}
});
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="navbar">
<?php include_once('navbar.php'); ?>
</div>
<div class="container">
<div align="center"><h2 class="sub-header">Attivita' </h2></div>
<div style="float:left">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalNorm">
Inserisci
</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/insertAttivitaFile.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 attivita'
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="form-group">
<label for="nomeAtt">Nome</label>
<input type="text" name="nomeAtt" 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"); ?>"/>
<div class="form-group">
<label for="descrizione">Branca</label>
<select class="form-control" id="branca" name="branca">
<option>L/C</option>
<option>E/G</option>
<option>R/S</option>
<option>Co.Ca.</option>
</select>
</div>
<input type="hidden" name="action" value="upload" />
<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 id="attivita" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>id</th>
<th>Nome</th>
<th>Descrizione</th>
<th>Branca</th>
<th>Autore</th>
<th>Data Inserimento</th>
<th>URL</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div id="footer">
<?php include_once('footer.php'); ?>
</div>
</body>
</html>