-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathlisting.php
73 lines (61 loc) · 2.02 KB
/
listing.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
<?php $this->view('partials/head'); ?>
<?php //Initialize models needed for the table
new Machine_model;
new Reportdata_model;
new MODULE_model;
?>
<div class="container">
<div class="row">
<div class="col-lg-12">
<h3><span data-i18n="MODULE.listing.title"></span> <span id="total-count" class='label label-primary'>…</span></h3>
<table class="table table-striped table-condensed table-bordered">
<thead>
<tr>
<th data-i18n="listing.computername" data-colname='machine.computer_name'></th>
<th data-i18n="serial" data-colname='reportdata.serial_number'></th>
<th data-i18n="listing.username" data-colname='reportdata.long_username'></th>
</tr>
</thead>
<tbody>
<tr>
<td data-i18n="listing.loading" colspan="3" class="dataTables_empty"></td>
</tr>
</tbody>
</table>
</div> <!-- /span 12 -->
</div> <!-- /row -->
</div> <!-- /container -->
<script type="text/javascript">
$(document).on('appUpdate', function(e){
var oTable = $('.table').DataTable();
oTable.ajax.reload();
return;
});
$(document).on('appReady', function(e, lang) {
// Get column names from data attribute
var columnDefs = [],
col = 0; // Column counter
$('.table th').map(function(){
columnDefs.push({name: $(this).data('colname'), targets: col});
col++;
});
oTable = $('.table').dataTable( {
columnDefs: columnDefs,
ajax: {
url: appUrl + '/datatables/data',
type: "POST"
},
dom: mr.dt.buttonDom,
buttons: mr.dt.buttons,
createdRow: function( nRow, aData, iDataIndex ) {
// Update name in first column to link
var name=$('td:eq(0)', nRow).html();
if(name == ''){name = "No Name"};
var sn=$('td:eq(1)', nRow).html();
var link = mr.getClientDetailLink(name, sn);
$('td:eq(0)', nRow).html(link);
}
});
});
</script>
<?php $this->view('partials/foot'); ?>