Ajout : pagination des articles

This commit is contained in:
fredtempez 2018-10-06 05:46:07 +02:00
parent 1fc2a34831
commit 7919507712
15 changed files with 49 additions and 41 deletions

12
.gitignore vendored
View File

@ -1,15 +1,5 @@
# Fichiers temporaires
site/tmp/*
# Sauvegardes
site/backup/*
# Fichiers de données
site/data/*
# Fichiers uploadés
site/file/source/*
site/file/thumb/*
site/*
# Dossiers vides dans GitHub
!.gitkeep

View File

@ -1,18 +1,20 @@
# ChangeLog
# ChangeLog
## Préversion version 8.3.14
* Modifications :
- Footer dans 3 blocs contenant dans l'ordre : Texte, Réseaux sociaux, Copyright
- Balise ALT dans les images du menu
- Config RFM
- Pagination variable du nombres d'articles par page (news, blog et form)
## version 8.3.13 :
* Modifications :
- Bannière "responsive", nouvelles options de positionnement
- Bouton Edit dans Blog
- Options de position des menus selon la position de la bannière
- Mise à jour TinyMCE
- Bouton Edition dans un article du blog
- Balise ALT dans les images du menu
- Correction RFM
## version 8.3.12 :
* Modification :

View File

@ -55,7 +55,8 @@ class common {
'youtubeId' => ''
],
'timezone' => 'Europe/Paris',
'title' => 'Zwii, votre site en quelques clics !'
'title' => 'Zwii, votre site en quelques clics !',
'ItemsperPage' => '10'
],
'core' => [
'dataVersion' => 0,
@ -869,16 +870,15 @@ class common {
$this->setData(['theme','header','imageContainer','auto']);
$this->setData(['core', 'dataVersion', 8313]);
$this->SaveData();
}
// Version 8.3.14
if($this->getData(['core', 'dataVersion']) < 8314) {
$this->setData(['theme','footer','socialsPosition','1']);
$this->setData(['theme','footer','textPosition','2']);
$this->setData(['theme','footer','copyrightPosition','3']);
$this->setData(['config','ItemsperPage','10']);
$this->setData(['core', 'dataVersion', 8314]);
$this->SaveData();
}
}
@ -1619,9 +1619,10 @@ class helper {
* @param array $array Tableau de donnée à utiliser
* @param string $url URL à utiliser, la dernière partie doit correspondre au numéro de page, par défaut utiliser $this->getUrl()
* @param null|int $sufix Suffixe de l'url
* @param $item pagination nombre d'éléments par page
* @return array
*/
public static function pagination($array, $url, $sufix = null) {
public static function pagination($array, $url, $item, $sufix = null) {
// Scinde l'url
$url = explode('/', $url);
// Url de pagination
@ -1631,13 +1632,13 @@ class helper {
// Nombre d'éléments à afficher
$nbElements = count($array);
// Nombre de page
$nbPage = ceil($nbElements / 10);
$nbPage = ceil($nbElements / $item);
// Page courante
$currentPage = is_numeric($urlPagination) ? self::filter($urlPagination, self::FILTER_INT) : 1;
// Premier élément de la page
$firstElement = ($currentPage - 1) * 10;
$firstElement = ($currentPage - 1) * $item;
// Dernier élément de la page
$lastElement = $firstElement + 10;
$lastElement = $firstElement + $item;
$lastElement = ($lastElement > $nbElements) ? $nbElements : $lastElement;
// Mise en forme de la liste des pages
$pages = '';

View File

@ -134,6 +134,13 @@ class config extends common {
'Pacific/Fiji' => '(GMT+12:00) Fiji',
'Asia/Kamchatka' => '(GMT+12:00) Kamchatka'
];
// Nombre d'objets par page
public static $ItemsList = [
'5' => '5 articles',
'10' => '10 articles',
'15' => '15 articles',
'20' => '20 articles'
];
/**
* Sauvegarde des données
@ -184,7 +191,8 @@ class config extends common {
'youtubeId' => $this->getInput('configSocialYoutubeId')
],
'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true),
'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true)
'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true),
'ItemsperPage' => $this->getInput('ItemsperPage')
]
]);
if(self::$inputNotices === []) {

View File

@ -46,10 +46,22 @@
<?php echo template::checkbox('configCookieConsent', true, 'Message de consentement pour l\'utilisation des cookies', [
'checked' => $this->getData(['config', 'cookieConsent'])
]); ?>
<?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [
'checked' => helper::checkRewrite(),
'help' => 'Afin d\'éviter de bloquer votre site pensez à vérifier que le module de réécriture d\'URL est bien actif sur votre serveur avant d\'activer cette fonctionnalité.'
]); ?>
<div class="row">
<div class="col6">
<?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [
'checked' => helper::checkRewrite(),
'help' => 'Afin d\'éviter de bloquer votre site pensez à vérifier que le module de réécriture d\'URL est bien actif sur votre serveur avant d\'activer cette fonctionnalité.'
]); ?>
</div>
<div class="col6">
<?php echo template::select('ItemsperPage', $module::$ItemsList, [
'label' => 'Pagination',
'selected' => $this->getData(['config', 'ItemsperPage']),
'help' => 'Nombre d\'articles de blog ou de news par page'
]); ?>
</div>
</div>
</div>
</div>
<div class="col6">

View File

@ -98,7 +98,7 @@ class blog extends common {
// Ids des commentaires par ordre de création
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($commentIds, $this->getUrl());
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Commentaires en fonction de la pagination
@ -153,7 +153,7 @@ class blog extends common {
// Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl());
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
@ -312,7 +312,7 @@ class blog extends common {
// Ids des commentaires par ordre de publication
$commentIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']), 'createdOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(), '#comment');
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','ItemsperPage']),'#comment');
// Liste des pages
self::$pages = $pagination['pages'];
// Commentaires en fonction de la pagination
@ -340,7 +340,7 @@ class blog extends common {
}
}
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl());
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination

View File

@ -101,7 +101,7 @@ class form extends common {
$data = $this->getData(['module', $this->getUrl(0), 'data']);
if($data) {
// Pagination
$pagination = helper::pagination($data, $this->getUrl());
$pagination = helper::pagination($data, $this->getUrl(),$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pagination = $pagination['pages'];
// Inverse l'ordre du tableau

View File

@ -82,7 +82,7 @@ class news extends common {
// Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0)]), 'publishedOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($newsIds, $this->getUrl());
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination
@ -203,7 +203,7 @@ class news extends common {
}
}
// Pagination
$pagination = helper::pagination($newsIds, $this->getUrl());
$pagination = helper::pagination($newsIds, $this->getUrl()$this->getData(['config','ItemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
/*273a7de0c618d570573c7a7247077a43*/@import url("https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Oswald");body{background-color:rgba(236,239,241,1);font-family:"Open Sans",sans-serif}a{color:rgba(74,105,189,1)}a:hover{color:rgba(59,90,174,1)}body,.row > div{font-size:14px}body,.block h4,input[type='email'],input[type='text'],input[type='password'],.inputFile,select,textarea,.inputFile,.button.buttonGrey,.button.buttonGrey:hover{color:rgba(26, 19, 178, 1)}.container{max-width:1170px}#site{background-color:rgba(27, 226, 226, 1);border-radius:0;box-shadow:0 #212223}.speechBubble,.button,.button:hover,button[type='submit'],.pagination a,.pagination a:hover,input[type='checkbox']:checked + label:before,input[type='radio']:checked + label:before,.helpContent{background-color:rgba(74,105,189,1);color:white}.helpButton span{color:rgba(74,105,189,1)}input[type='text']:hover,input[type='password']:hover,.inputFile:hover,select:hover,textarea:hover{border-color:rgba(74,105,189,1)}.speechBubble:before{border-color:rgba(74,105,189,1) transparent transparent transparent}.button:hover,button[type='submit']:hover,.pagination a:hover,input[type='checkbox']:not(:active):checked:hover + label:before,input[type='checkbox']:active + label:before,input[type='radio']:checked:hover + label:before,input[type='radio']:not(:checked):active + label:before{background-color:rgba(59,90,174,1)}.helpButton span:hover{color:rgba(59,90,174,1)}.button:active,button[type='submit']:active,.pagination a:active{background-color:rgba(54,85,169,1)}h1,h2,h3,h4,h5,h6{color:rgba(74,105,189,1);font-family:"Oswald",sans-serif;font-weight:normal;text-transform:none}header{background-size:auto}header{background-color:rgba(255,255,255,1);height:150px;line-height:150px;text-align:center}@media (max-width: 767px) {header{height:75px;line-height:75px;}}header span{color:rgba(33,34,35,1);font-family:"Oswald",sans-serif;font-weight:normal;font-size:2em;text-transform:none}nav,nav a{background-color:rgba(74,105,189,1)}nav a,#toggle span,nav a:hover{color:rgba(255, 255, 255, 1)}nav a:hover{background-color:rgba(59,90,174,1)}nav a.active{background-color:rgba(54,85,169,1)}#menu{text-align:left}#toggle span,#menu a{padding:5px 10px;font-weight:normal;font-size:1.3em;text-transform:none}footer{background-color:rgba(255,255,255,1);color:rgba(33, 34, 35, 1)}footer a{color:rgba(33, 34, 35, 1)}footer .container > div{margin:5px 0}#footerSocials{text-align:left}#footerText{text-align:center}#footerCopyright{text-align:right}
/*6cf9131d4f3bbc4f9cf6527081973b5b*/@import url("https://fonts.googleapis.com/css?family=Open+Sans|Oswald|Oswald");body{background-color:rgba(236,239,241,1);font-family:"Open Sans",sans-serif}a{color:rgba(74,105,189,1)}a:hover{color:rgba(59,90,174,1)}body,.row > div{font-size:14px}body,.block h4,input[type='email'],input[type='text'],input[type='password'],.inputFile,select,textarea,.inputFile,.button.buttonGrey,.button.buttonGrey:hover{color:rgba(26, 19, 178, 1)}.container{max-width:1170px}#site{background-color:rgba(27, 226, 226, 1);border-radius:0;box-shadow:0 #212223}.speechBubble,.button,.button:hover,button[type='submit'],.pagination a,.pagination a:hover,input[type='checkbox']:checked + label:before,input[type='radio']:checked + label:before,.helpContent{background-color:rgba(74,105,189,1);color:white}.helpButton span{color:rgba(74,105,189,1)}input[type='text']:hover,input[type='password']:hover,.inputFile:hover,select:hover,textarea:hover{border-color:rgba(74,105,189,1)}.speechBubble:before{border-color:rgba(74,105,189,1) transparent transparent transparent}.button:hover,button[type='submit']:hover,.pagination a:hover,input[type='checkbox']:not(:active):checked:hover + label:before,input[type='checkbox']:active + label:before,input[type='radio']:checked:hover + label:before,input[type='radio']:not(:checked):active + label:before{background-color:rgba(59,90,174,1)}.helpButton span:hover{color:rgba(59,90,174,1)}.button:active,button[type='submit']:active,.pagination a:active{background-color:rgba(54,85,169,1)}h1,h2,h3,h4,h5,h6{color:rgba(74,105,189,1);font-family:"Oswald",sans-serif;font-weight:normal;text-transform:none}header{background-size:auto}header{background-color:rgba(255,255,255,1);height:150px;line-height:150px;text-align:center}@media (max-width: 767px) {header{height:75px;line-height:75px;}}header span{color:rgba(33,34,35,1);font-family:"Oswald",sans-serif;font-weight:normal;font-size:2em;text-transform:none}nav,nav a{background-color:rgba(74,105,189,1)}nav a,#toggle span,nav a:hover{color:rgba(255, 255, 255, 1)}nav a:hover{background-color:rgba(59,90,174,1)}nav a.active{background-color:rgba(54,85,169,1)}#menu{text-align:left}#toggle span,#menu a{padding:10px;font-weight:normal;font-size:1em;text-transform:none}footer{background-color:rgba(255,255,255,1);color:rgba(33, 34, 35, 1)}footer a{color:rgba(33, 34, 35, 1)}footer .container > div{margin:5px 0}#footerSocials{text-align:center}#footerText{text-align:center}#footerCopyright{text-align:center}