Choix de la langue à l'intallation
This commit is contained in:
parent
55b4763cff
commit
a62135c172
@ -18,6 +18,7 @@ class install extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR,
|
||||
"postinstall" => self::GROUP_VISITOR,
|
||||
'steps' => self::GROUP_ADMIN,
|
||||
'update' => self::GROUP_ADMIN
|
||||
];
|
||||
@ -75,11 +76,55 @@ class install extends common {
|
||||
// source: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Installation
|
||||
* Pré-installation - choix de la langue
|
||||
*/
|
||||
public function index() {
|
||||
// Accès refusé
|
||||
if($this->getData(['user']) !== []) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['config', 'i18n', 'interface', $this->getInput('installLanguage')]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'install/postinstall'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Liste des langues UI disponibles
|
||||
if (is_dir(self::I18N_DIR)) {
|
||||
$dir = getcwd();
|
||||
chdir(self::I18N_DIR);
|
||||
$files = glob('*.json');
|
||||
// Ajouter une clé au tableau avec le code de langue
|
||||
foreach( $files as $file) {
|
||||
// La langue est-elle référencée ?
|
||||
if (array_key_exists(basename($file, '.json'), self::$languagesUI)) {
|
||||
self::$i18nFiles[basename($file, '.json')] = self::$languagesUI[basename($file, '.json')];
|
||||
}
|
||||
}
|
||||
chdir($dir);
|
||||
}
|
||||
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Installation',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* post Installation
|
||||
*/
|
||||
public function postInstall() {
|
||||
// Accès refusé
|
||||
if($this->getData(['user']) !== []) {
|
||||
// Valeurs en sortie
|
||||
@ -204,21 +249,6 @@ class install extends common {
|
||||
$dataThemes = json_decode($dataThemes, true);
|
||||
self::$themes = helper::arrayColumn($dataThemes, 'name');
|
||||
|
||||
// Liste des langues UI disponibles
|
||||
if (is_dir(self::I18N_DIR)) {
|
||||
$dir = getcwd();
|
||||
chdir(self::I18N_DIR);
|
||||
$files = glob('*.json');
|
||||
// Ajouter une clé au tableau avec le code de langue
|
||||
foreach( $files as $file) {
|
||||
// La langue est-elle référencée ?
|
||||
if (array_key_exists(basename($file, '.json'), self::$languagesUI)) {
|
||||
self::$i18nFiles[basename($file, '.json')] = self::$languagesUI[basename($file, '.json')];
|
||||
}
|
||||
}
|
||||
chdir($dir);
|
||||
}
|
||||
|
||||
// Créer sitemap
|
||||
$this->createSitemap();
|
||||
// Mise à jour de la liste des pages pour TinyMCE
|
||||
@ -228,7 +258,7 @@ class install extends common {
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_LAYOUT_LIGHT,
|
||||
'title' => 'Installation',
|
||||
'view' => 'index'
|
||||
'view' => 'postinstall'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
/* Vide */
|
@ -1,100 +1,20 @@
|
||||
<p>
|
||||
<?php echo template::topic('Renseignez les champs ci-dessous pour finaliser l\'installation.'); ?>
|
||||
</p>
|
||||
<?php echo template::formOpen('installForm'); ?>
|
||||
<h3>
|
||||
<?php echo template::topic('Compte administrateur'); ?>
|
||||
</h3>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('installId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::password('installPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::password('installConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::mail('installMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('installFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('installLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="accordion" data-speed="150">
|
||||
<li class="accordion-item">
|
||||
<h3 class="accordion-title">
|
||||
<?php echo template::topic('▷ Options avancées'); ?>
|
||||
</h3>
|
||||
<div class="accordion-content">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('installDefaultData',true , 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
|
||||
'checked' => false
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('installProxyType', $module::$proxyType, [
|
||||
'label' => 'Type de proxy'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('installProxyUrl', [
|
||||
'label' => 'Adresse du proxy',
|
||||
'placeholder' => 'cache.proxy.fr'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('installProxyPort', [
|
||||
'label' => 'Port du proxy',
|
||||
'placeholder' => '6060'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::select('installTheme', $module::$themes, [
|
||||
'label' => 'Thème'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col3 offset9">
|
||||
<?php echo template::submit('installSubmit', [
|
||||
'value' => 'Installer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formOpen('installForm'); ?>
|
||||
<h3>
|
||||
<?php echo template::topic('Dans quelle langue utiliserez-vous Zwii ?'); ?>
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col6 offset3">
|
||||
<?php echo template::select('installLanguage', $module::$i18nFiles, [
|
||||
'label' => 'Langues installées',
|
||||
'selected' => $this->getData(['config', 'i18n', 'interface'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 offset9">
|
||||
<?php echo template::submit('installSubmit', [
|
||||
'value' => 'Suivant'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
1
core/module/install/view/postinstall/postinstall.css
Normal file
1
core/module/install/view/postinstall/postinstall.css
Normal file
@ -0,0 +1 @@
|
||||
/* Vide */
|
107
core/module/install/view/postinstall/postinstall.php
Normal file
107
core/module/install/view/postinstall/postinstall.php
Normal file
@ -0,0 +1,107 @@
|
||||
<p>
|
||||
<?php echo template::topic('Renseignez les champs ci-dessous pour finaliser l\'installation.'); ?>
|
||||
</p>
|
||||
<?php echo template::formOpen('installForm'); ?>
|
||||
<h3>
|
||||
<?php echo template::topic('Compte administrateur'); ?>
|
||||
</h3>
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('installId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::password('installPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::password('installConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::mail('installMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('installFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('installLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="accordion" data-speed="150">
|
||||
<li class="accordion-item">
|
||||
<h3 class="accordion-title">
|
||||
<?php echo template::topic('▷ Options avancées'); ?>
|
||||
</h3>
|
||||
<div class="accordion-content">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('installDefaultData',true , 'Ne pas charger l\'exemple de site (utilisateurs avancés)', [
|
||||
'checked' => false
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('installProxyType', $module::$proxyType, [
|
||||
'label' => 'Type de proxy'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('installProxyUrl', [
|
||||
'label' => 'Adresse du proxy',
|
||||
'placeholder' => 'cache.proxy.fr'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('installProxyPort', [
|
||||
'label' => 'Port du proxy',
|
||||
'placeholder' => '6060'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::select('installTheme', $module::$themes, [
|
||||
'label' => 'Thème'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('installPrevious', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(true) . '?install',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset7">
|
||||
<?php echo template::submit('installSubmit', [
|
||||
'value' => 'Installer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user