Ajouter une pagination

This commit is contained in:
Fred Tempez 2022-10-15 09:00:53 +02:00
parent a017f3a74f
commit 06c912c7a8
2 changed files with 32 additions and 10 deletions

View File

@ -26,18 +26,26 @@ class translate extends common
'content' => self::GROUP_VISITOR, 'content' => self::GROUP_VISITOR,
]; ];
const PAGINATION = '20';
// Language contents // Language contents
public static $translateOptions = []; public static $translateOptions = [];
// Page pour la configuration dans la langue // Page pour la configuration dans la langue
public static $pagesList = []; public static $pagesList = [];
public static $orphansList = []; public static $orphansList = [];
public static $pages = '';
// Liste des langues installées // Liste des langues installées
public static $languagesUiInstalled = []; public static $languagesUiInstalled = [];
public static $languagesInstalled = []; public static $languagesInstalled = [];
// Liste des langues cibles // Liste des langues cibles
public static $languagesTarget = []; public static $languagesTarget = [];
// Activation du bouton de copie // Activation du bouton de copie
public static $siteCopy = true; public static $siteCopy = true;
// Localisation en cours d'édition // Localisation en cours d'édition
public static $locales = []; public static $locales = [];
@ -435,7 +443,19 @@ class translate extends common
// Tableau des chaines à traduire dans la langue sélectionnée // Tableau des chaines à traduire dans la langue sélectionnée
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
self::$languagesUiInstalled[$key] = $value; $dialogues[] = ['source' => $key, 'target' => $value];
}
// Pagination
$pagination = helper::pagination($dialogues, $this->getUrl(), self::PAGINATION);
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for ($i = $pagination['first']; $i < $pagination['last']; $i++) {
self::$languagesUiInstalled[$i] = $dialogues[$i];
} }
// Valeurs en sortie // Valeurs en sortie

View File

@ -17,17 +17,19 @@
<div class="row"> <div class="row">
<?php foreach ($module::$languagesUiInstalled as $key => $value) : ?> <?php foreach ($module::$languagesUiInstalled as $key => $value) : ?>
<div class="col6"> <div class="col6">
<?php echo sprintf('%g -', array_search($key, array_keys($module::$languagesUiInstalled))); ?> <?php echo sprintf('%g -', $key); ?>
<?php echo $key; ?> <?php echo $value['source']; ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::text('translateString' . array_search($key ,array_keys($module::$languagesUiInstalled)), [ <?php echo template::text('translateString' . array_search($value['target'], array_keys($module::$languagesUiInstalled)), [
'label' => '', 'label' => '',
'value' => $value 'value' => $value['target']
]); ?> ]); ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php echo $module::$pages; ?>
</div>
</div> </div>
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>