translate index WIP

This commit is contained in:
Fred Tempez 2022-09-26 16:30:40 +02:00
parent f02379453c
commit 15c69649b2
2 changed files with 33 additions and 16 deletions

View File

@ -21,7 +21,7 @@ class translate extends common {
'add' => self::GROUP_ADMIN, // Ajouter une langue de contenu
'edit' => self::GROUP_ADMIN, // Editer une langue de contenu
'delete' => self::GROUP_ADMIN, // Effacer une langue de contenu
'i18n' => self::GROUP_VISITOR,
'i18n' => self::GROUP_VISITOR,
];
// Language content
@ -121,30 +121,31 @@ class translate extends common {
// Préparation du formulaire
// -------------------------
// Onglet des langues de contenu
foreach (self::$languages as $keyi18n => $value) {
// tableau des langues installées
if (is_dir(self::DATA_DIR . $keyi18n) ) {
self::$languagesInstalled [] = [
$value . '(' . $keyi18n . ')' ,
$value . ' (' . $keyi18n . ')' ,
self::$i18nUI === $keyi18n ? '(langue de l\'interface)' : '',
'',
template::button('translateContentLanguageEdit' . $keyi18n, [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $keyi18n. '/' . $_SESSION['csrf'],
'value' => template::ico('pencil'),
'help' => 'Editer les locales'
]),
template::button('translateContentLanguageDelete' .$keyi18n, [
'class' => 'buttonRed',
'class' => 'buttonRed' . (self::$i18nUI === $keyi18n ? ' disabled' : '') ,
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $keyi18n . '/' . $_SESSION['csrf'],
'value' => template::ico('trash'),
'help' => 'Supprimer cette langue'
])
];
}
}
// Liste des langues disponibles
// Langues de l'UI disponibles
if (is_dir(self::I18N_DIR)) {
$dir = getcwd();
chdir(self::I18N_DIR);
@ -174,7 +175,7 @@ class translate extends common {
public function add() {
// Soumission du formulaire
if($this->isPost()) {
@ -347,7 +348,7 @@ class translate extends common {
}
/***
* Effacer une langue de contenu
* Effacer une langue de contenu
*/
public function delete() {
// Edition des langues

View File

@ -44,7 +44,7 @@
<div id="uiContainer" class="tabContent">
<div class="row">
<div class="col12">
<div class="block" id="flagsWrapper">
<div class="block">
<h4>
<?php echo template::topic('Langue de l\'administration'); ?>
</h4>
@ -61,11 +61,27 @@
</div>
</div>
<div id="contentContainer" class="tabContent">
<?php if($module::$languagesInstalled): ?>
<?php echo template::table([10, 1, 1], $module::$languagesInstalled, ['Langue', '', '']); ?>
<?php else: ?>
<?php echo template::speech('Aucune news.'); ?>
<?php endif; ?>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo template::topic('Ajouter une langue'); ?>
</h4>
<div class="row">
<div class="col12">
Poouet !
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<?php if($module::$languagesInstalled): ?>
<?php echo template::table([2, 2, 6, 1, 1], $module::$languagesInstalled, ['Langue', '', '', '', '']); ?>
<?php endif; ?>
</div>
</div>
</div>
<?php echo template::formClose(); ?>