69 lines
2.1 KiB
PHP
Executable File
69 lines
2.1 KiB
PHP
Executable File
<?php
|
|
|
|
function userWidget($userPPURL, $userDisplayName, $userName, $userBadgeSVG, $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);
|
|
echo ($userBadgeSVG);
|
|
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['creation_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'])) {
|
|
$authorLink = ' | <a href="/users?u=' . $article['username'] . '">' . $article['display_name'] . $article['badge_svg'] . '</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 . $authorLink . '</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> ');
|
|
}
|
|
}
|
|
|
|
?>
|