query("SET NAMES 'utf8'");
$sql = $conn->query("SELECT * FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state"); $r = mysqli_fetch_array($sql);
if($state > 1){
$n0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) <= 7")))['total'];
$n7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$n30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and status = $state and DATEDIFF(now(),date_creation) > 30")))['total'];
}else{
$n0 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 7")))['total'];
$n7 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) <= 30 and DATEDIFF(now(),date_creation) > 7")))['total'];
$n30 = (mysqli_fetch_array($conn->query("SELECT count(*) as total FROM glpi_tickets where id in (select tickets_id from glpi_groups_tickets where groups_id = 13) and id not in (select tickets_id from glpi_tickets_users where type = 2) and status < 6 and DATEDIFF(now(),date_creation) > 30")))['total'];
}
$sql = $conn->query(" SELECT count(*) as total, realname, firstname FROM glpi_tickets
left join glpi_tickets_users on glpi_tickets.id = glpi_tickets_users.tickets_id and glpi_tickets_users.type = 2
left join glpi_users on glpi_tickets_users.users_id = glpi_users.id
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status = $state
and glpi_tickets_users.users_id in (SELECT glpi_users.id FROM glpi_groups_users left join glpi_users on users_id = glpi_users.id where glpi_groups_users.groups_id = 13)
group by glpi_tickets_users.users_id, realname
order by total desc");
$repName='';$repTot='';
while($row = mysqli_fetch_array($sql)){
$repName .= $row['firstname'].' '.$row['realname'].',';
$repTot .= $row['total'].',';
}
$repName = substr($repName, 0, -1);
$repTot = substr($repTot, 0, -1);
$sql = $conn->query(" SELECT count(*) as total FROM glpi_tickets
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and status = $state");
$r = mysqli_fetch_array($sql); $ec = $r['total'];
?>
Répartition acteurs (en cours + planifié + en attente)
''){
$nb = explode(',',$repTot);$i=0;
foreach (explode(',',$repName) as $name) {
echo '
';
echo '
';
echo '';
echo '
';
echo '
'.$nb[$i].'
';
echo '';
echo '
';
echo '
';
$ec -= $nb[$i];
$i++;
}
echo '
';
echo '
';
echo '';
echo '
';
echo '
'.$ec.'
';
echo '';
echo '
';
echo '
';
}
?>
1){
$sql = $conn->query(" SELECT glpi_tickets.date_creation, glpi_tickets.id, glpi_tickets.name, glpi_tickets.date_mod, users_id_lastupdater, realname, firstname FROM glpi_tickets
left join glpi_users on glpi_users.id = glpi_tickets.users_id_lastupdater
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and glpi_tickets.status = $state
order by date_creation desc");
}else{
$sql = $conn->query(" SELECT glpi_tickets.date_creation, glpi_tickets.id, glpi_tickets.name, glpi_tickets.date_mod, users_id_lastupdater, realname, firstname FROM glpi_tickets
left join glpi_users on glpi_users.id = glpi_tickets.users_id_lastupdater
where glpi_tickets.id in (select tickets_id from glpi_groups_tickets where groups_id = 13)
and glpi_tickets.id not in (select tickets_id from glpi_tickets_users where type = 2)
and glpi_tickets.status < 6
order by date_creation desc");
}
?>
Liste des tickets
| Ticket |
Date Création |
Résumé |
Dernière modification |
";
echo "".$row['id']." | ";
echo "".explode(" ",$row['date_creation'])[0]." | ";
echo "".$row['name']." | ";
echo "".explode(" ",$row['date_mod'])[0]." par ".$row['firstname']." ".$row['realname']." | ";
echo "";
}
?>