This commit is contained in:
Fred Tempez 2021-03-30 17:39:15 +02:00
parent 88b716a448
commit 08127b1fd5
4 changed files with 96 additions and 35 deletions

View File

@ -15,7 +15,7 @@
class news extends common {
const VERSION = '2.3';
const VERSION = '2.4';
const REALNAME = 'Actualités';
const DELETE = true;
const UPDATE = '0.0';
@ -43,6 +43,23 @@ class news extends common {
public static $users = [];
// Nombre d'objets par page
public static $ItemsList = [
4 => '4 articles',
8 => '8 articles',
12 => '12 articles',
16 => '16 articles',
22 => '22 articles'
];
// Nombre de colone par page
public static $ListeCol = [
12 => '1 Colonne',
6 => '2 Colonnes',
4 => '3 Colonnes',
2 => '4 Colonnes'
];
public static $nbrCol = 1;
/**
* Flux RSS
*/
@ -142,7 +159,9 @@ class news extends common {
if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT)
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'listeCol' => $this->getInput('newsConfigListeCol', helper::FILTER_INT,true)
]]);
// Valeurs en sortie
$this->addOutput([
@ -298,7 +317,10 @@ class news extends common {
}
}
// Pagination
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
//$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
// Nombre de colonnes
self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'listeCol']);
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination

View File

@ -40,6 +40,26 @@
</div>
</div>
</div>
<!-- Block ajouté pour le sélecteur -->
<div class="block">
<h4>Nombre de news par page</h4>
<div class="row">
<div class="col4">
<?php echo template::select('newsConfigItemsperPage', $module::$ItemsList, [
'label' => 'News par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),
'help' => 'Nombre de news par page'
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsConfigListeCol', $module::$ListeCol, [
'label' => 'Nombre de colonne',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'listeCol']),
'help' => 'Nombre de colonnes par page'
]); ?>
</div>
</div>
</div>
<?php if($module::$news): ?>
<?php echo template::table([4, 4, 2, 1, 1], $module::$news, ['Titre', 'Date de publication', 'État', '', '']); ?>
<?php echo $module::$pages; ?>

View File

@ -12,7 +12,7 @@
* @link http://zwiicms.fr/
*/
/*
/*
* Module news
*/
@ -45,3 +45,24 @@
display: inline;
vertical-align: top;
}
@media (min-width: 769px)
{
.col2 {width: 20%;}
.col3 {width: 24%;}
.col4 {width: 32%;}
.col6 {width: 49%;}
.col12 {width: 100%;}
}
@media (max-width: 768px)
{
.col2 {width: 49%;}
.col3 {width: 49%;}
.col4 {width: 49%;}
}
@media (max-width: 480px)
{
.col2 {width: 100%;}
.col3 {width: 100%;}
.col4 {width: 100%;}
}

View File

@ -2,8 +2,7 @@
<div class="row">
<div class="col12">
<?php foreach($module::$news as $newsId => $news): ?>
<div class="row ">
<div class="col12">
<div class="col<?php echo $module::$nbrCol ;?>" >
<h1 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo $news['title']; ?>
</h1>
@ -31,7 +30,6 @@
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>