diff --git a/module/news/news.php b/module/news/news.php index 0700eda7..16b31bef 100755 --- a/module/news/news.php +++ b/module/news/news.php @@ -15,7 +15,7 @@ class news extends common { - const VERSION = '3.0'; + const VERSION = '3.1'; const REALNAME = 'Actualités'; const DELETE = true; const UPDATE = '0.0'; @@ -225,15 +225,28 @@ class news extends common { // News en fonction de la pagination for($i = $pagination['first']; $i < $pagination['last']; $i++) { // Met en forme le tableau - $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + $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']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) + $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']), - $date .' à '. $heure, + $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'], @@ -316,9 +329,12 @@ class news extends common { // Supprime l'ancien news $this->deleteData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]); } + $publishedOn = $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true); + $publishedOff = $this->getInput('newsEditPublishedOff', helper::FILTER_DATETIME); $this->setData(['module', $this->getUrl(0),'posts', $newsId, [ 'content' => $this->getInput('newsEditContent', null), - 'publishedOn' => $this->getInput('newsEditPublishedOn', helper::FILTER_DATETIME, true), + 'publishedOn' => $publishedOn, + 'publishedOff' => $publishedOff < $publishedOn ? '' : $publishedOff, 'state' => $this->getInput('newsEditState', helper::FILTER_BOOLEAN), 'title' => $this->getInput('newsEditTitle', helper::FILTER_STRING_SHORT, true), 'userId' => $this->getInput('newsEditUserId', helper::FILTER_ID, true) @@ -391,7 +407,14 @@ class news extends common { $newsIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC'); $newsIds = []; foreach($newsIdsPublishedOns as $newsId => $newsPublishedOn) { - if($newsPublishedOn <= time() AND $newsIdsStates[$newsId]) { + $newsIdsPublishedOff = $this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'publishedOff']); + if( $newsPublishedOn <= time() AND + $newsIdsStates[$newsId] AND + // date de péremption tenant des champs non définis + (!is_integer($newsIdsPublishedOff) OR + $newsIdsPublishedOff > time() + ) + ) { $newsIds[] = $newsId; } } diff --git a/module/news/view/config/config.php b/module/news/view/config/config.php index a86fc1e4..8dff68ee 100755 --- a/module/news/view/config/config.php +++ b/module/news/view/config/config.php @@ -70,7 +70,7 @@ - + diff --git a/module/news/view/edit/edit.php b/module/news/view/edit/edit.php index 35671003..4a447e74 100755 --- a/module/news/view/edit/edit.php +++ b/module/news/view/edit/edit.php @@ -43,19 +43,26 @@

Options de publication

-
+
'Auteur', 'selected' => $this->getUser('id') ]); ?>
-
+
'La news est consultable à partir du moment ou la date de publication est passée.', 'label' => 'Date de publication', 'value' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'publishedOn']) ]); ?>
+
+ 'La news est consultable Jusqu\'à cette date si elle est spécifiée.', + 'label' => 'Date de dépublication', + 'value' => $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2), 'publishedOff']) + ]); ?> +
diff --git a/site/data/news/pages/telechargement/theme.css b/site/data/news/pages/telechargement/theme.css new file mode 100644 index 00000000..decc2d19 --- /dev/null +++ b/site/data/news/pages/telechargement/theme.css @@ -0,0 +1 @@ +.newsContent {height:auto;}.newsBlur {background: linear-gradient(rgba(255, 255, 255, 1) 100%,rgba(255,255,255,0) ); background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;} \ No newline at end of file