Détail article
This commit is contained in:
parent
1ca00c11e5
commit
9d97c0a75f
|
@ -66,6 +66,9 @@ class news extends common {
|
||||||
'400px' => 'Grand'
|
'400px' => 'Grand'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Signature de l'article
|
||||||
|
public static $articleSignature = '';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mise à jour du module
|
* Mise à jour du module
|
||||||
|
@ -331,8 +334,34 @@ class news extends common {
|
||||||
* Accueil
|
* Accueil
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index() {
|
||||||
// Mise à jour
|
// Mise à jour des données de module
|
||||||
$this->update();
|
$this->update();
|
||||||
|
// Affichage d'un article
|
||||||
|
if(
|
||||||
|
$this->getUrl(1)
|
||||||
|
// Protection pour la pagination, un ID ne peut pas être un entier, une page oui
|
||||||
|
AND intval($this->getUrl(1)) === 0
|
||||||
|
) {
|
||||||
|
// L'article n'existe pas
|
||||||
|
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'access' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// L'article existe
|
||||||
|
else {
|
||||||
|
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'showBarEditButton' => true,
|
||||||
|
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
||||||
|
'view' => 'article'
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Affichage index
|
||||||
// Ids des news par ordre de publication
|
// Ids des news par ordre de publication
|
||||||
$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');
|
||||||
$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');
|
||||||
|
@ -360,6 +389,8 @@ class news extends common {
|
||||||
'showPageContent' => true,
|
'showPageContent' => true,
|
||||||
'view' => 'index'
|
'view' => 'index'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
|
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||||
|
* @license GNU General Public License, version 3
|
||||||
|
* @link http://zwiicms.fr/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Module news
|
||||||
|
*/
|
||||||
|
|
||||||
|
#rssFeed {
|
||||||
|
text-align: right;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#rssFeed p {
|
||||||
|
display: inline;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row verticalAlignMiddle">
|
||||||
|
<div class="col12 newsDate">
|
||||||
|
<!-- bloc signature et date -->
|
||||||
|
<?php echo $module::$articleSignature . ' - ';?>
|
||||||
|
<i class="far fa-calendar-alt"></i>
|
||||||
|
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
|
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
|
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
|
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||||
|
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||||
|
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||||
|
echo $date . ' à ' . $heure;
|
||||||
|
?>
|
||||||
|
<!-- Bloc edition -->
|
||||||
|
<?php if (
|
||||||
|
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||||
|
AND
|
||||||
|
( // Propriétaire
|
||||||
|
( $this->getUser('group') === self::GROUP_ADMIN )
|
||||||
|
)
|
||||||
|
): ?>
|
||||||
|
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
|
||||||
|
<?php echo template::ico('pencil');?> Editer
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<!-- Bloc RSS-->
|
||||||
|
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||||
|
<div id="rssFeed">
|
||||||
|
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||||
|
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||||
|
<?php
|
||||||
|
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||||
|
?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -31,13 +31,8 @@
|
||||||
margin: -10px;
|
margin: -10px;
|
||||||
height: 20%;
|
height: 20%;
|
||||||
width: 110%;
|
width: 110%;
|
||||||
-webkit-filter: blur(5px);
|
backdrop-filter: blur(1px);
|
||||||
-moz-filter: blur(5px);
|
-webkit-backdrop-filter: blur(1px);
|
||||||
-o-filter: blur(5px);
|
|
||||||
-ms-filter: blur(5px);
|
|
||||||
filter: blur(5px);
|
|
||||||
|
|
||||||
background-color: rgba(253, 254, 255, 0.90);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<?php foreach($module::$news as $newsId => $news): ?>
|
<?php foreach($module::$news as $newsId => $news): ?>
|
||||||
<div class="col<?php echo $module::$nbrCol ;?>" >
|
<div class="col<?php echo $module::$nbrCol ;?>" >
|
||||||
<h1 class="newsTitle" id="<?php echo $newsId;?>">
|
<h1 class="newsTitle" id="<?php echo $newsId;?>">
|
||||||
<?php echo $news['title']; ?>
|
<?php echo '<a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="newsContent" style="height:<?php echo $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight']); ?>;">
|
<div class="newsContent" style="height:<?php echo $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight']); ?>;">
|
||||||
<?php echo $news['content']; ?>
|
<?php echo $news['content']; ?>
|
||||||
|
|
Loading…
Reference in New Issue