This commit is contained in:
Fred Tempez 2022-01-17 19:32:06 +01:00 committed by fredtempez
parent 615bf640a9
commit 0e3c9e779b
5 changed files with 165 additions and 108 deletions

View File

@ -15,7 +15,7 @@
class blog extends common { class blog extends common {
const VERSION = '5.1'; const VERSION = '6.0';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -32,6 +32,7 @@ class blog extends common {
'commentDelete' => self::GROUP_MODERATOR, 'commentDelete' => self::GROUP_MODERATOR,
'commentDeleteAll' => self::GROUP_MODERATOR, 'commentDeleteAll' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR,
'layout' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
@ -100,6 +101,9 @@ class blog extends common {
self::EDIT_OWNER => 'Propriétaire' self::EDIT_OWNER => 'Propriétaire'
]; ];
// Nombre d'articles dans la page de config:
public static $itemsperPage = 8;
public static $users = []; public static $users = [];
@ -398,23 +402,7 @@ class blog extends common {
* Configuration * Configuration
*/ */
public function config() { public function config() {
// Mise à jour des données de module
$this->update();
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
]]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Modifications enregistrées',
'state' => true
]);
} else {
// Ids des articles par ordre de publication // Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès // Gestion des droits d'accès
@ -442,7 +430,7 @@ class blog extends common {
} }
$articleIds = $filterData; $articleIds = $filterData;
// Pagination // Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])); $pagination = helper::pagination($articleIds, $this->getUrl(),self::$itemsperPage);
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Articles en fonction de la pagination // Articles en fonction de la pagination
@ -493,7 +481,33 @@ class blog extends common {
'view' => 'config' 'view' => 'config'
]); ]);
} }
public function layout() {
// Mise à jour des données de module
$this->update();
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('blogLayoutShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogLayoutFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('blogLayoutItemsperPage', helper::FILTER_INT,true),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
]]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/layout',
'notification' => 'Modifications enregistrées',
'state' => true
]);
} else {
// Valeurs en sortie
$this->addOutput([
'title' => 'Mise en page',
'view' => 'layout'
]);
} }
}
/** /**
* Suppression * Suppression

2
module/blog/changes.md Normal file
View File

@ -0,0 +1,2 @@
# version 6
- mise à la norme avec le module news : le formulaire est sorti de l'écran principal

View File

@ -16,36 +16,12 @@
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">
<?php echo template::submit('blogConfigSubmit'); ?> <?php echo template::button('blogConfigLayout', [
</div> 'href' => helper::baseUrl() . $this->getUrl(0) . '/layout',
</div> 'ico' => 'brush',
<div class="row"> 'value' => 'Mise en page'
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('blogConfigShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?> ]); ?>
</div> </div>
<div class="col6">
<?php echo template::text('blogConfigFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset6">
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
</div>
</div>
</div>
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<?php if($module::$articles): ?> <?php if($module::$articles): ?>

View File

@ -0,0 +1,18 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,47 @@
<?php echo template::formOpen('blogLayout'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('blogLayoutBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('blogLayoutSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('blogLayoutShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogLayoutFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset6">
<?php echo template::select('blogLayoutItemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>
</div>