mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-17 20:10:50 +01:00
feat: gestione pulsanti precedente e successivo
This commit is contained in:
parent
ab6cedcd13
commit
709652eecd
@ -29,6 +29,7 @@ $draw_numer = intval(filter('draw'));
|
|||||||
if (!empty(filter('order'))) {
|
if (!empty(filter('order'))) {
|
||||||
$order['column'] = $order['column'] - 1;
|
$order['column'] = $order['column'] - 1;
|
||||||
}
|
}
|
||||||
|
$_SESSION['module_'.$id_module]['order'] = $order;
|
||||||
array_shift($columns);
|
array_shift($columns);
|
||||||
|
|
||||||
$total = Query::readQuery($structure);
|
$total = Query::readQuery($structure);
|
||||||
|
35
editor.php
35
editor.php
@ -172,6 +172,41 @@ if (empty($record) || !$has_access) {
|
|||||||
<i class="fa fa-chevron-left"></i> '.tr("Torna all'elenco").'
|
<i class="fa fa-chevron-left"></i> '.tr("Torna all'elenco").'
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
|
// Pulsante Precedente e Successivo
|
||||||
|
// Aggiungo eventuali filtri applicati alla vista
|
||||||
|
if (count(getSearchValues($id_module)) > 0) {
|
||||||
|
foreach (getSearchValues($id_module) as $key => $value) {
|
||||||
|
$where[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ricavo la posizione per questo id_record
|
||||||
|
$order = $_SESSION['module_'.$id_module]['order'] ?: [];
|
||||||
|
$module_query = Util\Query::getQuery($structure, $where, $order);
|
||||||
|
$posizioni = $dbo->fetchArray($module_query);
|
||||||
|
$key = array_search($id_record, array_column($posizioni, 'id'));
|
||||||
|
|
||||||
|
// Precedente
|
||||||
|
$prev = $posizioni[$key-1]['id'];
|
||||||
|
|
||||||
|
// Successivo
|
||||||
|
$next = $posizioni[$key+1]['id'];
|
||||||
|
|
||||||
|
if (isMobile()) {
|
||||||
|
echo '<div>';
|
||||||
|
} else {
|
||||||
|
echo '<div class="col-md-2 d-none d-sm-inline">';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<a class="btn btn-default'.($prev ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$prev.'">
|
||||||
|
<i class="fa fa-arrow-circle-left"></i>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-default'.($next ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$next.'">
|
||||||
|
<i class="fa fa-arrow-circle-right"></i>
|
||||||
|
</a>
|
||||||
|
</div>';
|
||||||
|
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
echo '<div>';
|
echo '<div>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,17 +39,8 @@ echo '
|
|||||||
|
|
||||||
<button type="button" class="btn btn-primary '.(!empty($info_firma) ? 'tip' : '').'" title="'.$info_firma.'" onclick="anteprimaFirma()" '.($record['flag_completato'] ? 'disabled' : '').'>
|
<button type="button" class="btn btn-primary '.(!empty($info_firma) ? 'tip' : '').'" title="'.$info_firma.'" onclick="anteprimaFirma()" '.($record['flag_completato'] ? 'disabled' : '').'>
|
||||||
<i class="fa fa-'.(!empty($info_firma) ? 'refresh' : 'desktop').'"></i> '.$frase.'...
|
<i class="fa fa-'.(!empty($info_firma) ? 'refresh' : 'desktop').'"></i> '.$frase.'...
|
||||||
</button>';
|
</button>
|
||||||
|
|
||||||
// TODO: da standardizzare in struttura per tutti i moduli di tipo table
|
|
||||||
/*<a class="btn btn-info'.($prev ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module=3&id_record='.$prev.'">
|
|
||||||
<i class="fa fa-arrow-circle-left"></i> '.tr('Precedente').'
|
|
||||||
</a>
|
|
||||||
<a class="btn btn-info'.($next ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module=3&id_record='.$next.'">
|
|
||||||
'.tr('Successivo').' <i class="fa fa-arrow-circle-right"></i>
|
|
||||||
</a>*/
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<script>
|
<script>
|
||||||
function duplicaIntervento() {
|
function duplicaIntervento() {
|
||||||
openModal("'.tr('Duplica attività').'", "'.$module->fileurl('modals/duplicazione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");
|
openModal("'.tr('Duplica attività').'", "'.$module->fileurl('modals/duplicazione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");
|
||||||
|
@ -478,7 +478,7 @@ class Query
|
|||||||
|
|
||||||
$select = empty($select) ? '*' : implode(', ', $select);
|
$select = empty($select) ? '*' : implode(', ', $select);
|
||||||
|
|
||||||
$query = str_replace('|select|', $select.', @posizione := @posizione + 1 AS `posizione`', $query);
|
$query = str_replace('|select|', $select, $query);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'query' => self::replacePlaceholder($query),
|
'query' => self::replacePlaceholder($query),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user