itemsperPage

This commit is contained in:
Fred Tempez 2021-03-31 16:42:32 +02:00
parent ffe91f99d8
commit 861d08768a
2 changed files with 6 additions and 6 deletions

View File

@ -115,7 +115,7 @@ class blog extends common {
$this->setData(['module', $this->getUrl(0), 'config', 'version','4.5']); $this->setData(['module', $this->getUrl(0), 'config', 'version','4.5']);
} }
// Version 5.0 // Version 5.0
if (version_compare($this->getData(['module', $this->getUrl(0), 'versionData']), '5.0', '<') ) { if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'version']), '5.0', '<') ) {
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]); $this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
$this->setData(['module', $this->getUrl(0), 'config', 'version','5.0']); $this->setData(['module', $this->getUrl(0), 'config', 'version','5.0']);
} }
@ -263,7 +263,7 @@ class blog extends common {
// Ids des commentaires par ordre de création // Ids des commentaires par ordre de création
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC')); $commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage'])); $pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Commentaires en fonction de la pagination // Commentaires en fonction de la pagination
@ -712,7 +712,7 @@ class blog extends common {
} }
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC')); $commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment'); $pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Signature de l'article // Signature de l'article

View File

@ -71,7 +71,7 @@ class news extends common {
$this->setData(['module', $this->getUrl(0), 'config', 'version','0.0']); $this->setData(['module', $this->getUrl(0), 'config', 'version','0.0']);
} }
// Version 3.0 // Version 3.0
if (version_compare($this->getData(['module', $this->getUrl(0), 'versionData']), self::VERSION, '<') ) { if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'version']), self::VERSION, '<') ) {
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]); $this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]);
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]); $this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]);
$this->setData(['module', $this->getUrl(0), 'config', 'version','3.0']); $this->setData(['module', $this->getUrl(0), 'config', 'version','3.0']);
@ -103,7 +103,7 @@ class news extends common {
// Corps des articles // Corps des articles
$newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'); $newsIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
// Articles de la première page uniquement // Articles de la première page uniquement
$newsIdsPublishedOns = array_slice($newsIdsPublishedOns, 0, $this->getData(['config', 'itemsperPage']) ); $newsIdsPublishedOns = array_slice($newsIdsPublishedOns, 0, $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
$newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); $newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) { foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) {
if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) { if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) {
@ -193,7 +193,7 @@ class news extends common {
// Ids des news par ordre de publication // Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC')); $newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination // Pagination
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage'])); $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// News en fonction de la pagination // News en fonction de la pagination