Nom de variables et alignements

This commit is contained in:
Fred Tempez 2021-03-30 17:52:16 +02:00
parent 08127b1fd5
commit 92bbafdafd
3 changed files with 33 additions and 35 deletions

View File

@ -52,7 +52,7 @@ class news extends common {
22 => '22 articles' 22 => '22 articles'
]; ];
// Nombre de colone par page // Nombre de colone par page
public static $ListeCol = [ public static $Columns = [
12 => '1 Colonne', 12 => '1 Colonne',
6 => '2 Colonnes', 6 => '2 Colonnes',
4 => '3 Colonnes', 4 => '3 Colonnes',
@ -161,7 +161,7 @@ class news extends common {
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true), 'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'listeCol' => $this->getInput('newsConfigListeCol', helper::FILTER_INT,true) 'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true)
]]); ]]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -320,7 +320,7 @@ class news extends common {
//$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage'])); //$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])); $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
// Nombre de colonnes // Nombre de colonnes
self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'listeCol']); self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']);
// 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

View File

@ -52,9 +52,9 @@
]); ?> ]); ?>
</div> </div>
<div class="col4"> <div class="col4">
<?php echo template::select('newsConfigListeCol', $module::$ListeCol, [ <?php echo template::select('newsConfigItemsperCol', $module::$Columns, [
'label' => 'Nombre de colonne', 'label' => 'Nombre de colonne',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'listeCol']), 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']),
'help' => 'Nombre de colonnes par page' 'help' => 'Nombre de colonnes par page'
]); ?> ]); ?>
</div> </div>

View File

@ -1,37 +1,35 @@
<?php if($module::$news): ?> <?php if($module::$news): ?>
<div class="row"> <div class="row">
<div class="col12"> <?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 $news['title']; ?> </h1>
</h1> <div class="newsContent">
<div class="newsContent"> <?php echo $news['content']; ?>
<?php echo $news['content']; ?> </div>
</div> <div class="newsSignature">
<div class="newsSignature"> <i class="far fa-calendar-alt"></i>
<i class="far fa-calendar-alt"></i> <?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
<?php echo mb_detect_encoding(strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true) ? strftime('%d %B %Y', $news['publishedOn'])
? strftime('%d %B %Y', $news['publishedOn']) : utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?>
: utf8_encode(strftime('%d %B %Y', $news['publishedOn'])); ?> - <?php echo $news['userId']; ?>
- <?php echo $news['userId']; ?> <!-- Bloc edition -->
<!-- Bloc edition --> <?php if (
<?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND AND
( // Propriétaire ( // Propriétaire
( $this->getUser('group') === self::GROUP_ADMIN ) ( $this->getUser('group') === self::GROUP_ADMIN )
) )
): ?> ): ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId . '/' . $_SESSION['csrf'];?>"> <a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId . '/' . $_SESSION['csrf'];?>">
<?php echo template::ico('pencil');?> Editer <?php echo template::ico('pencil');?> Editer
</a> </a>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div>
<?php endforeach; ?>
</div> </div>
<?php endforeach; ?>
</div> </div>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> <?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>