mirror of
https://github.com/claradex/nativegallery.git
synced 2025-02-22 19:49:51 +03:00
update contests
This commit is contained in:
parent
04373e197c
commit
118968739c
2 changed files with 54 additions and 84 deletions
|
@ -136,7 +136,7 @@ class ExecContests
|
||||||
$votes = DB::query(
|
$votes = DB::query(
|
||||||
'SELECT user_id, photo_id, COUNT(*) AS vote_count
|
'SELECT user_id, photo_id, COUNT(*) AS vote_count
|
||||||
FROM contests_rates WHERE contest_id = :id
|
FROM contests_rates WHERE contest_id = :id
|
||||||
GROUP BY user_id ORDER BY vote_count DESC LIMIT 3',
|
GROUP BY user_id ORDER BY vote_count DESC LIMIT 10',
|
||||||
[':id' => $contest['id']]
|
[':id' => $contest['id']]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use \App\Services\{Auth, DB, Date};
|
use \App\Services\{Auth, DB, Date};
|
||||||
use \App\Models\User;
|
use \App\Models\{User, Photo};
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -18,93 +18,63 @@ use \App\Models\User;
|
||||||
<div id="backgr"></div>
|
<div id="backgr"></div>
|
||||||
<table class="tmain">
|
<table class="tmain">
|
||||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
|
<?php include($_SERVER['DOCUMENT_ROOT'] . '/views/components/Navbar.php'); ?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="main">
|
<td class="main">
|
||||||
<center>
|
<center>
|
||||||
<h1>Победители фотоконкурса</h1>
|
<h1>Победители фотоконкурса</h1>
|
||||||
<p class="narrow" style="font-size:19px"><a href="/voting">Голосование</a> · <b>Победители</b> · <a href="/voting/rating">Рейтинг</a> · <a href="/voting/waiting">Претенденты</a></p>
|
<p class="narrow" style="font-size:19px"><a href="/voting">Голосование</a> · <b>Победители</b> · <a href="/voting/rating">Рейтинг</a> · <a href="/voting/waiting">Претенденты</a></p>
|
||||||
<div style="margin:20px">Для вывода подробного отчёта о конкурсе нажмите на интересующую вас дату.</div>
|
<?php
|
||||||
<div class="pages"><span class="pg">««</span><span class="ps">1</span><a href="?show=results&st=10" class="pg">2</a><a href="?show=results&st=20" class="pg">3</a><a href="?show=results&st=30" class="pg">4</a> ··· <a href="?show=results&st=2090" class="pg">210</a><a href="?show=results&st=10" class="pg" id="NextLink">»»</a></div>
|
$photos = DB::query("SELECT * FROM contests_winners
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-02-04" title="Подробный отчёт о конкурсе">04.02.2025</a></b></span><br><span class="sm">Линии и пейзажи</span></p>
|
WHERE place BETWEEN 1 AND 3
|
||||||
<table>
|
ORDER BY contest_id, place;
|
||||||
<tr>
|
|
||||||
<a href="/photo/2066028/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/66/02/2066028_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
");
|
||||||
<a href="/photo/2065380/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/38/2065380_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2064449/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/64/44/2064449_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
$grouped = [];
|
||||||
</tr>
|
foreach ($photos as $row) {
|
||||||
</table><br>
|
$grouped[$row['contest_id']][] = $row;
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-02-03" title="Подробный отчёт о конкурсе">03.02.2025</a></b></span><br><span class="sm">Линии и пейзажи</span></p>
|
}
|
||||||
<table>
|
|
||||||
<tr>
|
// Разбиваем на блоки по 3 элемента
|
||||||
<a href="/photo/1894111/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/18/94/11/1894111_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
$final_result = [];
|
||||||
<a href="/photo/2063989/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/63/98/2063989_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
foreach ($grouped as $contest_id => $rows) {
|
||||||
<a href="/photo/2061805/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/61/80/2061805_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
$chunks = array_chunk($rows, 3);
|
||||||
</tr>
|
foreach ($chunks as $chunk) {
|
||||||
</table><br>
|
$final_result[] = $chunk;
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-02-02" title="Подробный отчёт о конкурсе">02.02.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
}
|
||||||
<table>
|
}
|
||||||
<tr>
|
|
||||||
<a href="/photo/2065272/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/27/2065272_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
foreach ($final_result as $fc) {
|
||||||
<a href="/photo/2064912/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/64/91/2064912_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
$themeid = DB::query('SELECT themeid FROM contests WHERE id=:id', array(':id'=>$fc[0]['contest_id']))[0]['themeid'];
|
||||||
<a href="/photo/2026071/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/26/07/2026071_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
$theme = DB::query('SELECT title FROM contests_themes WHERE id=:id', array(':id'=>$themeid))[0]['title'];
|
||||||
</tr>
|
echo '<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-02-04" title="Подробный отчёт о конкурсе">'.date('d.m.Y', $fc[0]['date']).'</a></b></span><br><span class="sm">'.$theme.'</span></p>
|
||||||
</table><br>
|
<table>
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-02-01" title="Подробный отчёт о конкурсе">01.02.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
<tr>';
|
||||||
<table>
|
foreach ($fc as $f) {
|
||||||
<tr>
|
$photo = new Photo($f['photo_id']);
|
||||||
<a href="/photo/2064843/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/64/84/2064843_s.jpg?1" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
if ($f['place'] === 1) {
|
||||||
<a href="/photo/2065143/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/14/2065143_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
$img = 'vs3';
|
||||||
<a href="/photo/2063982/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/63/98/2063982_s.jpg?1" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
} else if ($f['place'] === 2) {
|
||||||
</tr>
|
$img = 'vs2';
|
||||||
</table><br>
|
} else if ($f['place'] === 3) {
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-31" title="Подробный отчёт о конкурсе">31.01.2025</a></b></span><br><b class="sm">Итоговое голосование</b></p>
|
$img = 'vs1';
|
||||||
<table>
|
}
|
||||||
<tr>
|
echo '<a href="/photo/'.$f['photo_id'].'/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="'.$photo->i('photourl').'" class="f" style="margin-bottom:7px"><br><img src="/static/img/'.$img.'.png" style="position:relative; top:-2px"> </a>';
|
||||||
<a href="/photo/2042060/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/42/06/2042060_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs5.png" style="position:relative; top:-2px"> </a>
|
}
|
||||||
</tr>
|
echo '
|
||||||
</table><br>
|
</tr>
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-30" title="Подробный отчёт о конкурсе">30.01.2025</a></b></span><br><span class="sm">Линии и пейзажи</span></p>
|
</table><br>';
|
||||||
<table>
|
}
|
||||||
<tr>
|
|
||||||
<a href="/photo/2058534/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/58/53/2058534_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2057575/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/57/57/2057575_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2058630/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/58/63/2058630_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
?>
|
||||||
</tr>
|
|
||||||
</table><br>
|
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-29" title="Подробный отчёт о конкурсе">29.01.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<a href="/photo/2064029/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/64/02/2064029_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2065381/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/38/2065381_s.jpg?1" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2065050/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/05/2065050_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2065800/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/65/80/2065800_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
|
||||||
</tr>
|
|
||||||
</table><br>
|
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-28" title="Подробный отчёт о конкурсе">28.01.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<a href="/photo/2062445/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/62/44/2062445_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2048251/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/48/25/2048251_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2062446/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/62/44/2062446_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
|
||||||
</tr>
|
|
||||||
</table><br>
|
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-26" title="Подробный отчёт о конкурсе">26.01.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<a href="/photo/2061877/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/61/87/2061877_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs3.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2047310/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/47/31/2047310_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2060964/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/60/96/2060964_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
|
||||||
</tr>
|
|
||||||
</table><br>
|
|
||||||
<p><span class="narrow" style="font-size:21px"><b><a href="?show=table&date=2025-01-25" title="Подробный отчёт о конкурсе">25.01.2025</a></b></span><br><span class="sm">Фотографии транспорта</span></p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<a href="/photo/2061294/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/61/29/2061294_s.jpg?2" class="f" style="margin-bottom:7px"><br><img src="/img/vs4.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2061425/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/61/42/2061425_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs2.png" style="position:relative; top:-2px"> </a>
|
|
||||||
<a href="/photo/2048649/" class="p20" style="display:table-cell; text-align:center; vertical-align:bottom; padding:20px 20px 10px; font-size:17px"><img src="/img/prw-loader.gif" data-src="/photo/20/48/64/2048649_s.jpg" class="f" style="margin-bottom:7px"><br><img src="/img/vs1.png" style="position:relative; top:-2px"> </a>
|
|
||||||
</tr>
|
|
||||||
</table><br>
|
|
||||||
<div class="pages"><span class="pg">««</span><span class="ps">1</span><a href="?show=results&st=10" class="pg">2</a><a href="?show=results&st=20" class="pg">3</a><a href="?show=results&st=30" class="pg">4</a> ··· <a href="?show=results&st=2090" class="pg">210</a><a href="?show=results&st=10" class="pg" id="NextLink">»»</a></div>
|
|
||||||
<p class="narrow" style="font-size:19px"><a href="/voting">Голосование</a> · <b>Победители</b> · <a href="/voting/rating">Рейтинг</a> · <a href="/voting/waiting">Претенденты</a></p>
|
<p class="narrow" style="font-size:19px"><a href="/voting">Голосование</a> · <b>Победители</b> · <a href="/voting/rating">Рейтинг</a> · <a href="/voting/waiting">Претенденты</a></p>
|
||||||
</center>
|
</center>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in a new issue