+
'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-
diff --git a/module/news/changes.md b/module/news/changes.md
new file mode 100644
index 00000000..ea0c25f1
--- /dev/null
+++ b/module/news/changes.md
@@ -0,0 +1,6 @@
+# Version 4
+ - Config : le nombre d'objet est fixe, constante dans news.php
+ - Ecran layout réservé à la configuration et au thème
+ - Bug avec l'initialisation, fichier css déclaré mais absent
+
+ A faire partie CSS à amléiorer au niveau des options
\ No newline at end of file
diff --git a/module/news/news.php b/module/news/news.php
index c2dbdabd..0f7a2aac 100644
--- a/module/news/news.php
+++ b/module/news/news.php
@@ -15,7 +15,7 @@
class news extends common {
- const VERSION = '3.7';
+ const VERSION = '4.0';
const REALNAME = 'News';
const DELETE = true;
const UPDATE = '0.0';
@@ -23,7 +23,8 @@ class news extends common {
public static $actions = [
'add' => self::GROUP_MODERATOR,
- 'config' => self::GROUP_MODERATOR,
+ 'config' => self::GROUP_MODERATOR, // Edition des news
+ 'option' => self::GROUP_MODERATOR, // paramétrage des news
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR,
@@ -88,7 +89,8 @@ class news extends common {
// Signature de l'article
public static $articleSignature = '';
-
+ // Nombre d'articles dans la page de config:
+ public static $itemsperPage = 8;
/**
* Flux RSS
@@ -189,10 +191,65 @@ class news extends common {
// Mise à jour des données de module
$this->update();
+ // Ids des news par ordre de publication
+ $newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
+ // Pagination fixe
+ $pagination = helper::pagination($newsIds, $this->getUrl(),self::$itemsperPage );
+ // Liste des pages
+ self::$pages = $pagination['pages'];
+ // News en fonction de la pagination
+ for($i = $pagination['first']; $i < $pagination['last']; $i++) {
+ // Met en forme le tableau
+ $dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
+ ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
+ : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
+ $dateOn .= ' à ';
+ $dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
+ ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
+ : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
+ if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
+ $dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
+ ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
+ : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
+ $dateOff .= ' à ';
+ $dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
+ ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
+ : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
+ } else {
+ $dateOff = 'Permanent';
+ }
+ self::$news[] = [
+ $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
+ $dateOn,
+ $dateOff,
+ self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
+ template::button('newsConfigEdit' . $newsIds[$i], [
+ 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
+ 'value' => template::ico('pencil'),
+ 'help' => 'Editer cette nouvelle'
+ ]),
+ template::button('newsConfigDelete' . $newsIds[$i], [
+ 'class' => 'newsConfigDelete buttonRed',
+ 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
+ 'value' => template::ico('cancel'),
+ 'help' => 'Effacer cette nouvelle'
+ ])
+ ];
+ }
+ // Valeurs en sortie
+ $this->addOutput([
+ 'title' => 'Configuration du module',
+ 'view' => 'config',
+ 'vendor' => [
+ 'tinycolorpicker'
+ ]
+ ]);
+ }
+
+ public function option() {
// Soumission du formulaire
if($this->isPost()) {
-
// Générer la feuille de CSS
$style = '.newsFrame {';
$style .= 'border:' . $this->getInput('newsThemeBorderStyle',helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth',helper::FILTER_STRING_SHORT) . ';';
@@ -217,69 +274,26 @@ class news extends common {
]]);
$this->setData(['module', $this->getUrl(0), 'config',[
- 'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
- 'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
- 'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
- 'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
- 'height' => $this->getInput('newsConfigHeight', helper::FILTER_INT,true),
+ 'feeds' => $this->getInput('newsOptionShowFeeds',helper::FILTER_BOOLEAN),
+ 'feedsLabel' => $this->getInput('newsOptionFeedslabel',helper::FILTER_STRING_SHORT),
+ 'itemsperPage' => $this->getInput('newsOptionItemsperPage', helper::FILTER_INT,true),
+ 'itemsperCol' => $this->getInput('newsOptionItemsperCol', helper::FILTER_INT,true),
+ 'height' => $this->getInput('newsOptionHeight', 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',
+ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
'notification' => 'Modifications enregistrées',
'state' => true
]);
} else {
- // Ids des news par ordre de publication
- $newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
- // Pagination
- $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
- // Liste des pages
- self::$pages = $pagination['pages'];
- // News en fonction de la pagination
- for($i = $pagination['first']; $i < $pagination['last']; $i++) {
- // Met en forme le tableau
- $dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
- : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
- $dateOn .= ' à ';
- $dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
- : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
- if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
- $dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
- ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
- : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
- $dateOff .= ' à ';
- $dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
- ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
- : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
- } else {
- $dateOff = 'Permanent';
- }
- self::$news[] = [
- $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
- $dateOn,
- $dateOff,
- self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
- template::button('newsConfigEdit' . $newsIds[$i], [
- 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
- 'value' => template::ico('pencil')
- ]),
- template::button('newsConfigDelete' . $newsIds[$i], [
- 'class' => 'newsConfigDelete buttonRed',
- 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
- 'value' => template::ico('cancel')
- ])
- ];
- }
// Valeurs en sortie
$this->addOutput([
- 'title' => 'Configuration du module',
- 'view' => 'config',
+ 'title' => 'Options de configuration',
+ 'view' => 'option',
'vendor' => [
'tinycolorpicker'
]
@@ -435,8 +449,7 @@ class news extends common {
$newsIds[] = $newsId;
}
}
- // Pagination
- //$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
+ // Pagination selon le layout
$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', 'itemsperCol']);
diff --git a/module/news/view/add/add.php b/module/news/view/add/add.php
index b4427b96..59e3b9da 100644
--- a/module/news/view/add/add.php
+++ b/module/news/view/add/add.php
@@ -1,17 +1,16 @@
-
+
'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-
+
true,
- 'value' => 'Enregistrer en brouillon'
+ 'value' => 'Brouillon'
]); ?>
true
diff --git a/module/news/view/config/config.php b/module/news/view/config/config.php
index 873c9a66..5527854a 100644
--- a/module/news/view/config/config.php
+++ b/module/news/view/config/config.php
@@ -1,102 +1,28 @@
-
+
'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts',
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-
+
+ helper::baseUrl() . $this->getUrl(0) . '/option',
+ 'value' => template::ico('sliders'),
+ 'help' => 'Options de configuration'
+ ]); ?>
+
+
helper::baseUrl() . $this->getUrl(0) . '/add',
- 'ico' => 'plus',
- 'value' => 'News'
+ 'value' => template::ico('plus'),
+ 'help' => 'Rédiger une news'
]); ?>
-
-
-
-
-
-
-
-
Paramètres du module
-
-
- $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
- 'help' => 'Flux limité aux articles de la première page.'
- ]); ?>
-
-
- 'Etiquette RSS',
- 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
- ]); ?>
-
-
-
-
- 'Nombre de colonnes',
- 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
- ]); ?>
-
-
- 'Articles par page',
- 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
- ]); ?>
-
-
- 'Abrégé de l\'article',
- 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
- ]); ?>
-
-
-
-
-
-
-
-
-
Thème du module
-
-
- 'Bordure',
- 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
- ]); ?>
-
-
- 'Epaisseur',
- 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
- ]); ?>
-
-
- 'colorPicker',
- 'help' => 'Couleur visible en l\'absence d\'une image.
Le curseur horizontal règle le niveau de transparence.',
- 'label' => 'Couleur de la bordure',
- 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
- ]); ?>
-
-
- 'colorPicker',
- 'help' => 'Couleur visible en l\'absence d\'une image.
Le curseur horizontal règle le niveau de transparence.',
- 'label' => 'Couleur du fond',
- 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
- ]); ?>
-
-
-
-
+
diff --git a/module/news/view/edit/edit.php b/module/news/view/edit/edit.php
index 927be92d..2cc71bc0 100644
--- a/module/news/view/edit/edit.php
+++ b/module/news/view/edit/edit.php
@@ -4,14 +4,13 @@
'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-
+
true,
- 'value' => 'Enregistrer en brouillon'
+ 'value' => 'Brouillon'
]); ?>
true
diff --git a/module/news/view/option/option.css b/module/news/view/option/option.css
new file mode 100644
index 00000000..52709ea6
--- /dev/null
+++ b/module/news/view/option/option.css
@@ -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
+ * @copyright Copyright (C) 2008-2018, Rémi Jean
+ * @author Frédéric Tempez
+ * @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
+*/
\ No newline at end of file
diff --git a/module/news/view/option/option.php b/module/news/view/option/option.php
new file mode 100644
index 00000000..463439ec
--- /dev/null
+++ b/module/news/view/option/option.php
@@ -0,0 +1,95 @@
+
+
+
+ 'buttonGrey',
+ 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
+ 'value' => template::ico('left')
+ ]); ?>
+
+
+
+
+
+
+
+
+
Paramètres du module
+
+
+ $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
+ 'help' => 'Flux limité aux articles de la première page.'
+ ]); ?>
+
+
+ 'Etiquette RSS',
+ 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
+ ]); ?>
+
+
+
+
+ 'Nombre de colonnes',
+ 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
+ ]); ?>
+
+
+ 'Articles par page',
+ 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
+ ]); ?>
+
+
+ 'Abrégé de l\'article',
+ 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
+ ]); ?>
+
+
+
+
+
+
+
+
+
Thème du module
+
+
+ 'Bordure',
+ 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
+ ]); ?>
+
+
+ 'Epaisseur',
+ 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
+ ]); ?>
+
+
+ 'colorPicker',
+ 'help' => 'Couleur visible en l\'absence d\'une image.
Le curseur horizontal règle le niveau de transparence.',
+ 'label' => 'Couleur de la bordure',
+ 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
+ ]); ?>
+
+
+ 'colorPicker',
+ 'help' => 'Couleur visible en l\'absence d\'une image.
Le curseur horizontal règle le niveau de transparence.',
+ 'label' => 'Couleur du fond',
+ 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
+ ]); ?>
+
+
+
+
+
+
+Version n°
+
+
\ No newline at end of file
diff --git a/module/redirection/view/config/config.php b/module/redirection/view/config/config.php
index ff421b39..b786dbf1 100644
--- a/module/redirection/view/config/config.php
+++ b/module/redirection/view/config/config.php
@@ -1,14 +1,13 @@
-
+
'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-
diff --git a/module/search/view/config/config.php b/module/search/view/config/config.php
index 68b6ab8f..ac8bcfc5 100644
--- a/module/search/view/config/config.php
+++ b/module/search/view/config/config.php
@@ -1,14 +1,13 @@
-
+
'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
- 'ico' => 'left',
- 'value' => 'Retour'
+ 'value' => template::ico('left')
]); ?>
-