232 lines
6.2 KiB
PHP
232 lines
6.2 KiB
PHP
<?php
|
|
ob_Start();
|
|
|
|
use Glpi\Event;
|
|
|
|
include ('../inc/includes.php');
|
|
|
|
Session::checkLoginUser();
|
|
|
|
|
|
|
|
|
|
if (Session::getCurrentInterface() == "helpdesk") {
|
|
Html::helpHeader("Decharge", '', $_SESSION["glpiname"]);
|
|
} else {
|
|
Html::header("Decharge", '', "", "");
|
|
}
|
|
|
|
function get_Users(){
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT id,concat(`realname`,' ',`firstname`) AS fullname
|
|
FROM `glpi_users`
|
|
WHERE is_deleted = 0 AND realname is not null AND firstname is not null";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
$res[] = $row;
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function get_list(){
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT en.id_entete,en.fonction ,en.num,en.date,en.type ,
|
|
concat(glpi_users.realname,' ',glpi_users.firstname) as fullname
|
|
FROM decharge_entete as en
|
|
LEFT JOIN glpi_users on en.id_user = glpi_users.id
|
|
ORDER BY `en`.`id_entete` DESC";
|
|
$result = $DB->query($query);
|
|
|
|
if ($result->num_rows > 0) {
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
$res[] = $row;
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
$res =get_list() ;
|
|
|
|
|
|
echo '
|
|
<div class="center">
|
|
<form method="get" action="..\Charte Informatique.pdf">
|
|
<button type="submit" class="button2">CHARTE INFORMATIQUE</button>
|
|
</form>
|
|
</div>
|
|
<div class="center">
|
|
<table border="0" class="tab_cadrehov">
|
|
<thead>
|
|
<tr class="tab_bg_2">
|
|
<th class=""></th>
|
|
<th>Utilisateur</th>
|
|
<th>N°</th>
|
|
<th>Type</th>
|
|
<th>date</th>
|
|
</tr>
|
|
<tr class="tab_bg_2">
|
|
<th class=""></th>
|
|
<th>
|
|
<select class="js-example-basic-single" name="id_user" id="id_user" onchange ="filtre();">
|
|
<option value="0">ALL</option>';
|
|
$Users = get_Users();
|
|
foreach ($Users as $user) {
|
|
echo '<option value="'.$user['id'].'">'.$user['fullname'].'</option>';
|
|
}
|
|
echo'</select>
|
|
</th>
|
|
<th><input type="text" id="num" name="num" onchange ="filtre();"></th>
|
|
<th>
|
|
<select class="js-example-basic-single" name="type" id="type" onchange ="filtre();">
|
|
<option value="all">ALL</option>
|
|
<option value="decharge">Decharge </option>
|
|
<option value="contre decharge">Contre decharge</option>
|
|
</select>
|
|
</th>
|
|
<th><input type="date" id="date" name="date" onchange ="filtre();"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="data">
|
|
</tbody>
|
|
<footer>
|
|
<tr class="tab_bg_2">
|
|
<th class=""></th>
|
|
<th>Utilisateur</th>
|
|
<th>N°</th>
|
|
<th>Type</th>
|
|
<th>date</th>
|
|
</tr>
|
|
</footer>
|
|
</table>
|
|
|
|
|
|
</div>';
|
|
|
|
if (Session::getCurrentInterface() == "helpdesk") {
|
|
Html::helpFooter();
|
|
} else {
|
|
Html::footer();
|
|
}
|
|
|
|
|
|
|
|
|
|
$link=$CFG_GLPI["root_doc"]."/front/ticket.php";
|
|
$root = $CFG_GLPI["root_doc"];
|
|
$user = Session::getCurrentInterface();
|
|
?>
|
|
<style>
|
|
.button2{
|
|
background-color: #4CAF50;
|
|
border: none;
|
|
color: #FFFFFF;
|
|
text-align: center;
|
|
-webkit-transition-duration: 0.4s;
|
|
transition-duration: 0.4s;
|
|
margin: 16px 0 !important;
|
|
text-decoration: none;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
padding: 20px;
|
|
}
|
|
.button2:hover {
|
|
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
var root = <?php echo json_encode($root); ?>;
|
|
var res = <?php echo json_encode($res); ?>;
|
|
var user = <?php echo json_encode($user); ?>;
|
|
var userlink;
|
|
if(user == "helpdesk"){
|
|
userlink ='<li class="breadcrumb_item"><a href="'+root+'/front/helpdesk.public.php" title="Accueil">Accueil</a></li>';
|
|
}else{
|
|
userlink = '<li class="breadcrumb_item"><a href="'+root+'/front/central.php" title="Accueil">Accueil</a></li>';
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
|
|
$("#c_ssmenu2").html('<ul>'+
|
|
userlink+
|
|
'<li class="breadcrumb_item"><a href="" title="">Administration</a></li>'+
|
|
'<li class="breadcrumb_item"><a href="'+root+'/front/decharge.list.php" class="here" title="Décharge"><i class="far fa-sticky-note"></i> Décharge</a></li>'+
|
|
'<li class="icons_block"><span><a href="'+root+'/front/decharge.add.php" class="pointer" title="Ajouter"><i class="fa fa-plus"></i>'+
|
|
'<span class="sr-only">Ajouter</span></a>'+
|
|
'</li>'+
|
|
'</ul>');
|
|
|
|
});
|
|
|
|
function message() {
|
|
var r = confirm("Etes-vous sûr de vouloir supprimer ?");
|
|
if (r == false) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function loadTable(data)
|
|
{
|
|
//'<a onclick="return message()" href='+root+'/ajax/decharge.php?action=delete&id_entete='+row['id_entete']+'><i class="fa fa-trash deleteRow cursorPointer"></i></a>'+
|
|
|
|
if(data.length > 0 && data != null) {
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
var row = data[i];
|
|
$('#data').append(
|
|
'<tr class="tab_bg_2">'+
|
|
'<td width="10" valign="top">'+
|
|
'<a style="padding: 10px;" href='+root+'/front/decharge.pdf.php?id='+row['id_entete']+'><i class="far fa-save"></i></a></td>'+
|
|
'<td valign="top"><a id="Ticket1869" href='+root+'/front/decharge.update.php?id='+row['id_entete']+'>'+row['fullname']+'</a></td>'+
|
|
'<td valign="top">'+row['num']+'</td>'+
|
|
'<td valign="top">'+row['type']+'</td>'+
|
|
'<td valign="top">'+row['date']+'</td>'+
|
|
'</tr>');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
function filtre() {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: root+"/ajax/decharge.php?action=filtre&iduser="+$( "#id_user" ).val()+"&num="+$( "#num" ).val()+"&type="+$( "#type" ).val()+"&date="+$( "#date" ).val() ,
|
|
dataType: "json"
|
|
})
|
|
.done(function( msg ) {
|
|
//var data = JSON.parse(msg);
|
|
var data = msg;
|
|
$( "#data" ).empty();
|
|
if(data !== null) loadTable(data);
|
|
})
|
|
.fail(function(msg) {
|
|
console.log(msg);
|
|
});
|
|
}
|
|
|
|
loadTable(res);
|
|
|
|
|
|
|
|
</script>
|
|
<!-- script pour liste déroulante -->
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('.js-example-basic-single').select2();
|
|
});
|
|
</script>
|