72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
function userWidget($userPPURL, $userDisplayName, $userName, $userCertification, $badges, $rootPageURL) {
|
|
|
|
echo ('<a href="' . $rootPageURL . 'users?u=' . $userName . '" class="user-widget-link">');
|
|
echo ('<div class="user-widget">');
|
|
|
|
echo ('<div class="user-pp">');
|
|
echo ('<img src="' . $userPPURL . '">');
|
|
echo ('</div>');
|
|
|
|
echo ('<div class="user-info">');
|
|
|
|
echo ('<div class="user-display-name">');
|
|
echo ($userDisplayName);
|
|
if ($userCertification > 0) {
|
|
echo ('<svg class="certification" viewBox="0 0 22 22" aria-label="Compte certifié" role="img">');
|
|
echo ('<g>' . $badges[$userCertification] . '</g>');
|
|
echo ('</svg>');
|
|
}
|
|
echo ('</div>');
|
|
|
|
echo ('<div class="user-name">@' . $userName . '</div>');
|
|
|
|
echo ('</div>');
|
|
|
|
echo ('</div>');
|
|
echo ('</a>');
|
|
}
|
|
|
|
|
|
function listArticles($result, $rootPageURL) {
|
|
|
|
foreach($result as $article) {
|
|
|
|
$pubDateTime = strtotime($article['date']);
|
|
$pubDate = date('d/m/Y', $pubDateTime);
|
|
$articleID = $article['ID'];
|
|
$articleTitle = $article['title'];
|
|
$articleResume = $article['resume'];
|
|
$miniatureURL = empty($article['miniature']) ? $rootPageURL . "src/img/empty.jpg" : $article['miniature'];
|
|
if(isset($article['username']) && isset($article['display_name'])) {
|
|
$authorLink = ' | <a href="user.php?user=' . $article['username'] . '">' . $article['display_name'] . '</a>';
|
|
} else {
|
|
$authorLink = '';
|
|
}
|
|
|
|
echo('<div class="article-preview">');
|
|
|
|
echo('<a href="'. $rootPageURL .'news?article=' . $articleID . '" class="article-link">');
|
|
echo('<div class="article-illustration">');
|
|
|
|
echo('<img src="' . $miniatureURL . '" class="article-miniature">');
|
|
|
|
echo('</div>');
|
|
echo('</a>');
|
|
|
|
echo('<div class="article-info">');
|
|
echo('<div class="article-data">n° ' . $articleID . ' | ' . $pubDate . '</div>');
|
|
|
|
echo('<a href="'. $rootPageURL .'news?article=' . $articleID . '" class="article-link">');
|
|
echo('<div class="article-title">' . $articleTitle . '</div>');
|
|
echo('</a>');
|
|
|
|
echo('<div class="article-resume">' . $articleResume . '</div>');
|
|
|
|
echo('</div>');
|
|
echo('</div> ');
|
|
}
|
|
}
|
|
|
|
?>
|