mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-01 16:36:45 +01:00
Miglioramenti ultimi commit
@lucasalva87
This commit is contained in:
parent
699bf029d9
commit
fdcc16cf14
34
editor.php
34
editor.php
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
include_once __DIR__.'/core.php';
|
include_once __DIR__.'/core.php';
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
if (empty($id_record) && !empty($id_module)) {
|
if (empty($id_record) && !empty($id_module)) {
|
||||||
redirect(ROOTDIR.'/controller.php?id_module='.$id_module);
|
redirect(ROOTDIR.'/controller.php?id_module='.$id_module);
|
||||||
} elseif (empty($id_record) && empty($id_module)) {
|
} elseif (empty($id_record) && empty($id_module)) {
|
||||||
@ -201,20 +203,20 @@ if (empty($record)) {
|
|||||||
|
|
||||||
// Informazioni sulle operazioni
|
// Informazioni sulle operazioni
|
||||||
if (Auth::admin()) {
|
if (Auth::admin()) {
|
||||||
|
echo '
|
||||||
echo ' <div id="tab_info" class="tab-pane">';
|
<div id="tab_info" class="tab-pane">';
|
||||||
|
|
||||||
$operations = $dbo->fetchArray('SELECT `zz_operations`.*, `zz_users`.`username` FROM `zz_operations` JOIN `zz_users` ON `zz_operations`.`id_utente` = `zz_users`.`id` WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record).' ORDER BY `created_at` ASC LIMIT 200');
|
$operations = $dbo->fetchArray('SELECT `zz_operations`.*, `zz_users`.`username` FROM `zz_operations` JOIN `zz_users` ON `zz_operations`.`id_utente` = `zz_users`.`id` WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record).' ORDER BY `created_at` ASC LIMIT 200');
|
||||||
|
|
||||||
if (count($operations)>0){
|
|
||||||
|
|
||||||
echo ' <ul class="timeline">';
|
if (!empty($operations)) {
|
||||||
|
echo '
|
||||||
|
<ul class="timeline">';
|
||||||
|
|
||||||
foreach ($operations as $operation) {
|
foreach ($operations as $operation) {
|
||||||
$description = $operation['op'];
|
$description = $operation['op'];
|
||||||
$icon = 'pencil-square-o';
|
$icon = 'pencil-square-o';
|
||||||
$color = null;
|
$color = null;
|
||||||
$timeline = null;
|
$timeline_class = null;
|
||||||
|
|
||||||
switch ($operation['op']) {
|
switch ($operation['op']) {
|
||||||
case 'add':
|
case 'add':
|
||||||
@ -236,12 +238,12 @@ if (empty($record)) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$timeline = ' class="timeline-inverted"';
|
$timeline_class = ' class="timeline-inverted"';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<li'.$timeline.'>
|
<li '.$timeline_class.'>
|
||||||
<div class="timeline-badge '.$color.'"><i class="fa fa-'.$icon.'"></i></div>
|
<div class="timeline-badge '.$color.'"><i class="fa fa-'.$icon.'"></i></div>
|
||||||
<div class="timeline-panel">
|
<div class="timeline-panel">
|
||||||
<div class="timeline-heading">
|
<div class="timeline-heading">
|
||||||
@ -250,7 +252,7 @@ if (empty($record)) {
|
|||||||
<h4 class="timeline-title">'.$description.'</h4>
|
<h4 class="timeline-title">'.$description.'</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-right">
|
<div class="col-md-4 text-right">
|
||||||
<p><small class="label label-default tip" title="'.Translator::timestampToLocale($operation['created_at']).'"><i class="fa fa-clock-o"></i> '.time_elapsed_string($operation['created_at']).'</small></p>
|
<p><small class="label label-default tip" title="'.Translator::timestampToLocale($operation['created_at']).'"><i class="fa fa-clock-o"></i> '.Carbon::parse($operation['created_at'])->diffForHumans().'</small></p>
|
||||||
<p><small class="label label-default"><i class="fa fa-user"></i> '.tr('_USER_', [
|
<p><small class="label label-default"><i class="fa fa-user"></i> '.tr('_USER_', [
|
||||||
'_USER_' => $operation['username'],
|
'_USER_' => $operation['username'],
|
||||||
]).
|
]).
|
||||||
@ -259,25 +261,25 @@ if (empty($record)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="timeline-body">
|
<div class="timeline-body">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="timeline-footer">
|
<div class="timeline-footer">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>';
|
</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ' </ul>';
|
echo ' </ul>';
|
||||||
|
} else {
|
||||||
}else{
|
echo '
|
||||||
echo '
|
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<i class="fa fa-info-circle"></i>
|
<i class="fa fa-info-circle"></i>
|
||||||
<b>'.tr('Informazione:').'</b> '.tr('Nessun log disponibile per questa scheda').'.
|
<b>'.tr('Informazione:').'</b> '.tr('Nessun log disponibile per questa scheda').'.
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
echo ' </div>';
|
echo '
|
||||||
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin
|
// Plugin
|
||||||
|
@ -368,45 +368,3 @@ function searchFieldName($field)
|
|||||||
{
|
{
|
||||||
return str_replace([' ', '.'], ['-', ''], $field);
|
return str_replace([' ', '.'], ['-', ''], $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Restituisce il tempo trascorso tra un timestamp e questo momento.
|
|
||||||
*
|
|
||||||
* @param string $datetime
|
|
||||||
* @param bool $full
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function time_elapsed_string($datetime, $full = false) {
|
|
||||||
$now = new DateTime;
|
|
||||||
$ago = new DateTime($datetime);
|
|
||||||
$diff = $now->diff($ago);
|
|
||||||
|
|
||||||
$diff->w = floor($diff->d / 7);
|
|
||||||
$diff->d -= $diff->w * 7;
|
|
||||||
|
|
||||||
$string = array(
|
|
||||||
'y' => 'ann',
|
|
||||||
'm' => 'mes',
|
|
||||||
'w' => 'settiman',
|
|
||||||
'd' => 'giorn',
|
|
||||||
'h' => 'or',
|
|
||||||
'i' => 'minut',
|
|
||||||
's' => 'second',
|
|
||||||
);
|
|
||||||
foreach ($string as $k => &$v) {
|
|
||||||
if ($diff->$k) {
|
|
||||||
if ($v == 'settiman' or $v == 'or')
|
|
||||||
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 'e' : 'a');
|
|
||||||
else if ($v == 'mes')
|
|
||||||
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 'i' : 'e');
|
|
||||||
else
|
|
||||||
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 'i' : 'o');
|
|
||||||
} else {
|
|
||||||
unset($string[$k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$full) $string = array_slice($string, 0, 1);
|
|
||||||
return $string ? implode(', ', $string) . ' fa' : 'adesso';
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
switch ($resource) {
|
switch ($resource) {
|
||||||
case 'sync':
|
case 'sync':
|
||||||
// Normalizzazione degli interventi a database
|
// Normalizzazione degli interventi a database
|
||||||
@ -64,7 +66,7 @@ switch ($resource) {
|
|||||||
$dbo->insert('in_interventi', [
|
$dbo->insert('in_interventi', [
|
||||||
'idintervento' => $idintervento,
|
'idintervento' => $idintervento,
|
||||||
'idanagrafica' => setting('Azienda predefinita'),
|
'idanagrafica' => setting('Azienda predefinita'),
|
||||||
'data_richiesta' => \Carbon::now(),
|
'data_richiesta' => Carbon::now(),
|
||||||
'richiesta' => $richiesta,
|
'richiesta' => $richiesta,
|
||||||
'idtipointervento' => 0,
|
'idtipointervento' => 0,
|
||||||
'idstatointervento' => 'CALL',
|
'idstatointervento' => 'CALL',
|
||||||
|
@ -188,29 +188,8 @@ class FileManager implements ManagerInterface
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#'.$attachment_id.' #categoria").autocomplete({';
|
$("#'.$attachment_id.' #categoria").autocomplete({
|
||||||
$n_categorie = 0;
|
source: '.json_encode(array_column($categories, 'category')).',
|
||||||
foreach ($categories as $category) {
|
|
||||||
if (!empty($category['category'])){
|
|
||||||
if ($n_categorie==0){
|
|
||||||
$result .= '
|
|
||||||
source: [';
|
|
||||||
}
|
|
||||||
|
|
||||||
$result .= '
|
|
||||||
"'.$category['category'].'",';
|
|
||||||
|
|
||||||
$n_categorie++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($n_categorie>0){
|
|
||||||
$result .= '
|
|
||||||
],';
|
|
||||||
}else{
|
|
||||||
$result .= '
|
|
||||||
source:"[]",';
|
|
||||||
}
|
|
||||||
$result .= '
|
|
||||||
minLength: 0
|
minLength: 0
|
||||||
}).focus(function() {
|
}).focus(function() {
|
||||||
$(this).autocomplete("search", $(this).val())
|
$(this).autocomplete("search", $(this).val())
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe per gestire le traduzioni del progetto.
|
* Classe per gestire le traduzioni del progetto.
|
||||||
*
|
*
|
||||||
@ -116,6 +118,9 @@ class Translator extends Util\Singleton
|
|||||||
$this->translator->setLocale($locale);
|
$this->translator->setLocale($locale);
|
||||||
$this->locale = $locale;
|
$this->locale = $locale;
|
||||||
|
|
||||||
|
setlocale(LC_TIME, $locale);
|
||||||
|
Carbon::setLocale($locale);
|
||||||
|
|
||||||
self::$formatter = new Intl\Formatter(
|
self::$formatter = new Intl\Formatter(
|
||||||
$this->locale,
|
$this->locale,
|
||||||
empty($formatter['timestamp']) ? 'd/m/Y H:i' : $formatter['timestamp'],
|
empty($formatter['timestamp']) ? 'd/m/Y H:i' : $formatter['timestamp'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user