forked from ZwiiCMS-Team/ZwiiCMS
Ajouter une pagination
This commit is contained in:
parent
a017f3a74f
commit
06c912c7a8
@ -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 = [];
|
||||||
|
|
||||||
@ -145,7 +153,7 @@ class translate extends common
|
|||||||
self::$i18nUI === $key ? helper::translate('Interface') : '',
|
self::$i18nUI === $key ? helper::translate('Interface') : '',
|
||||||
'',
|
'',
|
||||||
template::button('translateContentLanguageEdit' . $key, [
|
template::button('translateContentLanguageEdit' . $key, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/locale/' . $key ,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/locale/' . $key,
|
||||||
'value' => template::ico('pencil'),
|
'value' => template::ico('pencil'),
|
||||||
'help' => 'Éditer'
|
'help' => 'Éditer'
|
||||||
]),
|
]),
|
||||||
@ -179,7 +187,7 @@ class translate extends common
|
|||||||
self::$i18nUI === $selected ? helper::translate('Interface') : '',
|
self::$i18nUI === $selected ? helper::translate('Interface') : '',
|
||||||
'',
|
'',
|
||||||
template::button('translateContentLanguageEdit' . $file, [
|
template::button('translateContentLanguageEdit' . $file, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/ui/' . $selected ,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/ui/' . $selected,
|
||||||
'value' => template::ico('pencil'),
|
'value' => template::ico('pencil'),
|
||||||
'help' => 'Éditer',
|
'help' => 'Éditer',
|
||||||
'disabled' => 'fr_FR' === $selected
|
'disabled' => 'fr_FR' === $selected
|
||||||
@ -272,7 +280,7 @@ class translate extends common
|
|||||||
{
|
{
|
||||||
// Jeton incorrect ou URl avec le code langue incorrecte
|
// Jeton incorrect ou URl avec le code langue incorrecte
|
||||||
if (
|
if (
|
||||||
!array_key_exists($this->getUrl(2), self::$languages)
|
!array_key_exists($this->getUrl(2), self::$languages)
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -390,7 +398,7 @@ class translate extends common
|
|||||||
{
|
{
|
||||||
// Jeton incorrect ou URl avec le code langue incorrecte
|
// Jeton incorrect ou URl avec le code langue incorrecte
|
||||||
if (
|
if (
|
||||||
!array_key_exists($this->getUrl(2), self::$languages)
|
!array_key_exists($this->getUrl(2), self::$languages)
|
||||||
) {
|
) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -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
|
||||||
|
@ -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>
|
||||||
<?php echo template::formClose(); ?>
|
</div>
|
||||||
|
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user