Module téléchargement
This commit is contained in:
parent
4ba7c59d32
commit
6a7642e5a0
@ -53,6 +53,9 @@ class download extends common {
|
|||||||
|
|
||||||
public static $pages;
|
public static $pages;
|
||||||
|
|
||||||
|
// Nombre de téléchargements
|
||||||
|
public static $statSum = 0;
|
||||||
|
|
||||||
public static $states = [
|
public static $states = [
|
||||||
false => 'Brouillon',
|
false => 'Brouillon',
|
||||||
true => 'Publié'
|
true => 'Publié'
|
||||||
@ -90,7 +93,7 @@ class download extends common {
|
|||||||
|
|
||||||
public static $users = [];
|
public static $users = [];
|
||||||
|
|
||||||
const VERSION = '4.2';
|
const VERSION = '1.0';
|
||||||
const REALNAME = 'Téléchargement';
|
const REALNAME = 'Téléchargement';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -426,8 +429,6 @@ class download extends common {
|
|||||||
$toApprove = 0;
|
$toApprove = 0;
|
||||||
$approved = count($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'comment']));
|
$approved = count($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'comment']));
|
||||||
}
|
}
|
||||||
// Nombre de téléchargements
|
|
||||||
$stats = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'fileStats']), 'time');
|
|
||||||
// Met en forme le tableau
|
// Met en forme le tableau
|
||||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
||||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
||||||
@ -435,13 +436,18 @@ class download extends common {
|
|||||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])), 'UTF-8', true)
|
||||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate']))
|
||||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])));
|
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileDate'])));
|
||||||
|
$stat = count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'fileStats']), 'time') ) === 0
|
||||||
|
? '0'
|
||||||
|
: '<a href="' . helper::baseurl() . $this->getUrl(0) . '/stats/' . $itemIds[$i] . '" >' .
|
||||||
|
count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i],'fileStats']), 'time') ) .
|
||||||
|
'</a>';
|
||||||
self::$items[] = [
|
self::$items[] = [
|
||||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $itemIds[$i] . '" target="_blank" >' .
|
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $itemIds[$i] . '" target="_blank" >' .
|
||||||
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'title']) .
|
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'title']) .
|
||||||
'</a>',
|
'</a>',
|
||||||
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileVersion']),
|
$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'fileVersion']),
|
||||||
$date .' à '. $heure,
|
$date .' à '. $heure,
|
||||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/stats/' . $itemIds[$i] . '" >' . count($stats) . '</a>',
|
$stat,
|
||||||
self::$states[$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'state'])],
|
self::$states[$this->getData(['module', $this->getUrl(0), 'items', $itemIds[$i], 'state'])],
|
||||||
// Bouton pour afficher les commentaires de l'item
|
// Bouton pour afficher les commentaires de l'item
|
||||||
template::button('downloadConfigComment' . $itemIds[$i], [
|
template::button('downloadConfigComment' . $itemIds[$i], [
|
||||||
@ -684,6 +690,10 @@ class download extends common {
|
|||||||
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
|
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
|
||||||
// Pagination
|
// Pagination
|
||||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');
|
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['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'
|
||||||
|
: count(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'fileStats']), 'time') ) ;
|
||||||
// Liste des pages
|
// Liste des pages
|
||||||
self::$pages = $pagination['pages'];
|
self::$pages = $pagination['pages'];
|
||||||
// Signature de l'item
|
// Signature de l'item
|
||||||
@ -836,6 +846,8 @@ class download extends common {
|
|||||||
|
|
||||||
// Construction de la page des statistiques
|
// Construction de la page des statistiques
|
||||||
$itemIds = array_keys($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']));
|
$itemIds = array_keys($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']));
|
||||||
|
// Total des téléchargements
|
||||||
|
self::$statSum = count ($itemIds);
|
||||||
// Pagination
|
// Pagination
|
||||||
$pagination = helper::pagination($itemIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
$pagination = helper::pagination($itemIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<?php echo template::button('downloadConfigAdd', [
|
<?php echo template::button('downloadConfigAdd', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||||
'ico' => 'plus',
|
'ico' => 'plus',
|
||||||
'value' => 'Item'
|
'value' => 'Fichier'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
|
@ -26,10 +26,11 @@
|
|||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.downloadTitle {
|
h2{
|
||||||
/*background-color: #ECEFF1;*/
|
|
||||||
padding: 0px;
|
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
margin-top: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
|
||||||
}
|
}
|
||||||
.downloadContent {
|
.downloadContent {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php foreach($module::$items as $itemId => $item): ?>
|
<?php foreach($module::$items as $itemId => $item): ?>
|
||||||
<div class="row rowitem">
|
<div class="row rowitem">
|
||||||
<div class="col3">
|
<div class="col3 downloadLeft">
|
||||||
<?php
|
<?php
|
||||||
// Déterminer le nom de la miniature
|
// Déterminer le nom de la miniature
|
||||||
$parts = explode('/',$item['picture']);
|
$parts = explode('/',$item['picture']);
|
||||||
@ -20,13 +20,13 @@
|
|||||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $item['picture']; ?>">
|
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $item['picture']; ?>">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col9">
|
<div class="col9 downloadRight">
|
||||||
<article>
|
<article>
|
||||||
<h1 class="downloadTitle">
|
<h2 class="downloadTitle">
|
||||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">
|
||||||
<?php echo $item['title']; ?>
|
<?php echo $item['title']; ?>
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h2>
|
||||||
<div class="downloadComment">
|
<div class="downloadComment">
|
||||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>#comment">
|
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>#comment">
|
||||||
<?php if ($item['comment']): ?>
|
<?php if ($item['comment']): ?>
|
||||||
|
@ -77,6 +77,13 @@
|
|||||||
<?php echo ' du ' . $date; ?>
|
<?php echo ' du ' . $date; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12 textAlignCenter">
|
||||||
|
<span>Téléchargements :
|
||||||
|
<?php echo $module::$statSum; ?>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col9">
|
<div class="col9">
|
||||||
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
|
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
|
||||||
|
@ -13,11 +13,18 @@
|
|||||||
'class' => 'statsDeleteAll buttonRed',
|
'class' => 'statsDeleteAll buttonRed',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/statsDeleteAll' . '/' . $this->getUrl(2) . '/'. $_SESSION['csrf'] ,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/statsDeleteAll' . '/' . $this->getUrl(2) . '/'. $_SESSION['csrf'] ,
|
||||||
'ico' => 'cancel',
|
'ico' => 'cancel',
|
||||||
'value' => 'Tout effacer'
|
'value' => 'Purger'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<h3> Nombre de téléchargements :
|
||||||
|
<?php echo $module::$statSum; ?>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php if($module::$items): ?>
|
<?php if($module::$items): ?>
|
||||||
<?php echo template::table([6, 6], $module::$items, ['Date', 'Adresse IP']); ?>
|
<?php echo template::table([6, 6], $module::$items, ['Date', 'Adresse IP']); ?>
|
||||||
<?php echo $module::$pages; ?>
|
<?php echo $module::$pages; ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user