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,
];
const PAGINATION = '20';
// Language contents
public static $translateOptions = [];
// Page pour la configuration dans la langue
public static $pagesList = [];
public static $orphansList = [];
public static $pages = '';
// Liste des langues installées
public static $languagesUiInstalled = [];
public static $languagesInstalled = [];
// Liste des langues cibles
public static $languagesTarget = [];
// Activation du bouton de copie
public static $siteCopy = true;
// Localisation en cours d'édition
public static $locales = [];
@ -435,7 +443,19 @@ class translate extends common
// Tableau des chaines à traduire dans la langue sélectionnée
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

View File

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