2024-02-22 15:58:03 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
|
|
* Copyright (C) DevCode s.r.l.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
if (setting('Attiva notifica di presenza utenti sul record')){
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<table class="table table-hover table-condensed">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2024-02-23 13:14:38 +01:00
|
|
|
<th>'.tr('Modulo').'</th>
|
|
|
|
<th>'.tr('Record').'</th>
|
|
|
|
<th>'.tr('Data e ora accesso').'</th>
|
|
|
|
<th>'.tr('Ultimo aggiornamento').'</th>
|
|
|
|
<!--th>'.tr('Permanenza').'</th-->
|
2024-02-22 15:58:03 +01:00
|
|
|
</tr>
|
|
|
|
</thead>';
|
|
|
|
|
2024-02-23 13:14:38 +01:00
|
|
|
$sessioni = $dbo->fetchArray('SELECT zz_semaphores.*, SUBSTRING_INDEX(posizione, ",", -1) AS id_record, zz_modules.name AS modulo, TIMESTAMPDIFF(SECOND, zz_semaphores.created_at, zz_semaphores.updated) AS permanenza, zz_users.username AS utente
|
2024-02-22 15:58:03 +01:00
|
|
|
FROM zz_semaphores
|
|
|
|
INNER JOIN zz_modules ON SUBSTRING_INDEX(posizione, ",", 1) = zz_modules.id
|
|
|
|
INNER JOIN zz_users ON zz_semaphores.id_utente = zz_users.id
|
2024-02-23 13:14:38 +01:00
|
|
|
ORDER BY `utente` ASC, SUBSTRING_INDEX(posizione, ",", -1) ASC');
|
|
|
|
|
|
|
|
$gruppi = collect($sessioni)->groupBy('utente');
|
|
|
|
$i = 0;
|
|
|
|
foreach ($gruppi as $utente => $sessioni) {
|
|
|
|
|
|
|
|
$utente = Models\User::find($sessioni[$i]['id_utente']);
|
|
|
|
$i++;
|
2024-02-22 15:58:03 +01:00
|
|
|
|
|
|
|
echo '
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2024-02-23 13:14:38 +01:00
|
|
|
<th colspan="5" class="text-center text-muted" >'.(($utente->photo) ? "<img class='attachment-img tip' title=".$utente->username." src=".$utente->photo.">" : "<i class='fa fa-user-circle-o attachment-img tip' title=".$utente->username."></i>").'<span class="direct-chat-name"> '.$utente->anagrafica->ragione_sociale.' ['.$utente->gruppo.']</span></th>
|
2024-02-22 15:58:03 +01:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
foreach ($sessioni as $sessione) {
|
|
|
|
$class ='info';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<tr class="'.$class.'" data-id="'.$sessione['id'].'" data-nome='.json_encode($sessione['name']).'>
|
|
|
|
<td>
|
2024-02-23 13:14:38 +01:00
|
|
|
'.$sessione['modulo'].'
|
2024-02-22 15:58:03 +01:00
|
|
|
</td>
|
|
|
|
|
2024-02-23 13:14:38 +01:00
|
|
|
<td>
|
2024-02-22 15:58:03 +01:00
|
|
|
'.$sessione['id_record'].'
|
|
|
|
</td>
|
|
|
|
|
2024-02-23 13:14:38 +01:00
|
|
|
<td>
|
2024-02-22 15:58:03 +01:00
|
|
|
'.Translator::timestampToLocale($sessione['created_at']).'
|
|
|
|
</td>
|
|
|
|
|
2024-02-23 13:14:38 +01:00
|
|
|
<td>
|
|
|
|
<span class="tip" title="'.Translator::timestampToLocale($sessione['updated']).'" >'.Carbon\Carbon::parse($sessione['updated'])->diffForHumans().'</span>
|
2024-02-22 15:58:03 +01:00
|
|
|
</td>
|
|
|
|
|
2024-02-23 13:14:38 +01:00
|
|
|
<!--td>
|
|
|
|
<span class="tip" title="'.Translator::timestampToLocale($sessione['updated']).'" >'.gmdate('H:i:s', $sessione['permanenza']).'</span>
|
|
|
|
</td-->
|
2024-02-22 15:58:03 +01:00
|
|
|
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
|
|
|
|
}else{
|
|
|
|
echo '<span>Non è possibile monitorare la presenta degli utenti.</span>';
|
|
|
|
}
|
|
|
|
|