itemsperPages blog + download
This commit is contained in:
parent
861d08768a
commit
1dab50c5ff
@ -21,7 +21,6 @@ class init extends common {
|
||||
'githubId' => ''
|
||||
],
|
||||
'timezone' => 'Europe/Paris',
|
||||
'itemsperPage' => 10,
|
||||
'proxyUrl' => '',
|
||||
'proxyPort' => '',
|
||||
'proxyType' => 'tcp://',
|
||||
|
@ -407,7 +407,7 @@ class blog extends common {
|
||||
$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),
|
||||
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true)
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -759,7 +759,7 @@ class blog extends common {
|
||||
}
|
||||
}
|
||||
// Pagination
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
class download extends common {
|
||||
|
||||
const VERSION = '1.1';
|
||||
const VERSION = '1.2';
|
||||
const REALNAME = 'Téléchargement';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -91,6 +91,15 @@ class download extends common {
|
||||
'10000' => '10000'
|
||||
];
|
||||
|
||||
// Nombre d'objets par page
|
||||
public static $ItemsList = [
|
||||
4 => '4 articles',
|
||||
8 => '8 articles',
|
||||
12 => '12 articles',
|
||||
16 => '16 articles',
|
||||
22 => '22 articles'
|
||||
];
|
||||
|
||||
// Permissions d'un item
|
||||
public static $itemConsent = [
|
||||
self::EDIT_ALL => 'Tous les groupes',
|
||||
@ -109,6 +118,22 @@ class download extends common {
|
||||
|
||||
public static $users = [];
|
||||
|
||||
/**
|
||||
* Mise à jour du module
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
// Insitialisation de la version
|
||||
if ($this->getData(['module', $this->getUrl(0), 'config', 'version']) === NULL) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'version','0.0']);
|
||||
}
|
||||
// Version 5.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'version']), '1.1', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 6]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'version','1.2']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flux RSS
|
||||
*/
|
||||
@ -252,7 +277,7 @@ class download 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(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Commentaires en fonction de la pagination
|
||||
@ -389,11 +414,14 @@ class download extends common {
|
||||
* Configuration
|
||||
*/
|
||||
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('downloadConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('downloadConfigFeedslabel',helper::FILTER_STRING_SHORT)
|
||||
'feedsLabel' => $this->getInput('downloadConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true),
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -429,7 +457,7 @@ class download extends common {
|
||||
}
|
||||
$itemIds = $filterData;
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// items en fonction de la pagination
|
||||
@ -618,6 +646,8 @@ class download extends common {
|
||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||
*/
|
||||
public function index() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Affichage d'un item
|
||||
if(
|
||||
$this->getUrl(1)
|
||||
@ -706,7 +736,7 @@ class download extends common {
|
||||
}
|
||||
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']),'#comment');
|
||||
// Nombre de téléchargements
|
||||
self::$statSum = count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items',$this->getUrl(1),'fileStats']), 'time') ) === 0
|
||||
? '0'
|
||||
@ -757,7 +787,7 @@ class download extends common {
|
||||
}
|
||||
}
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Items en fonction de la pagination
|
||||
@ -866,7 +896,7 @@ class download extends common {
|
||||
// Total des téléchargements
|
||||
self::$statSum = count ($itemIds);
|
||||
// Pagination
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($itemIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
|
@ -36,6 +36,14 @@
|
||||
]); ?>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user