Fix winners page

This commit is contained in:
arman 2025-02-05 04:34:46 +00:00
parent b6494034ad
commit c020136f10

@ -50,6 +50,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
echo '<h2>' . i18n('%1 ' . $type . ' Award Winners', array($_GET['year'])) . '</h2>'; echo '<h2>' . i18n('%1 ' . $type . ' Award Winners', array($_GET['year'])) . '</h2>';
$ok = true; $ok = true;
// first, lets make sure someone isnt tryint to see something that they arent allowed to! // first, lets make sure someone isnt tryint to see something that they arent allowed to!
// but only if the year they want is the FAIRYEAR. If they want a past year, thats cool // but only if the year they want is the FAIRYEAR. If they want a past year, thats cool
if ($_GET['year'] >= $config['FAIRYEAR']) { if ($_GET['year'] >= $config['FAIRYEAR']) {
@ -73,9 +74,9 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
award_types award_types
WHERE WHERE
award_awards.year='$year' award_awards.year='$year'
AND\taward_awards.award_types_id=award_types.id AND award_awards.award_types_id=award_types.id
AND\taward_types.type='$type' AND award_types.type='$type'
AND\taward_types.year='$year' AND award_types.year='$year'
ORDER BY ORDER BY
awards_order"); awards_order");
@ -85,6 +86,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
if ($q->rowCount()) { if ($q->rowCount()) {
echo '<a href="winners.php">' . i18n('Back to Winners main page') . '</a>'; echo '<a href="winners.php">' . i18n('Back to Winners main page') . '</a>';
echo '<br />'; echo '<br />';
while ($r = $q->fetch(PDO::FETCH_OBJ)) { while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$pq = $pdo->prepare("SELECT $pq = $pdo->prepare("SELECT
award_prizes.prize, award_prizes.prize,
@ -105,6 +107,7 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
AND award_prizes.year='$year' AND award_prizes.year='$year'
ORDER BY ORDER BY
`order`"); `order`");
$pq->execute(); $pq->execute();
show_pdo_errors_if_any($pdo); show_pdo_errors_if_any($pdo);
$awarded_count = 0; $awarded_count = 0;
@ -115,8 +118,30 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
} }
} }
$pq->fetch(PDO::FETCH_ORI_ABS, 0); // $pq->fetch(PDO::FETCH_ORI_ABS, 0);
} }
$pq = $pdo->prepare("SELECT
award_prizes.prize,
award_prizes.number,
award_prizes.id,
award_prizes.cash,
award_prizes.scholarship,
winners.projects_id,
projects.projectnumber,
projects.title,
projects.registrations_id AS reg_id
FROM
award_prizes
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
LEFT JOIN projects ON projects.id=winners.projects_id
WHERE
award_awards_id='$r->id'
AND award_prizes.year='$year'
ORDER BY
`order`");
$pq->execute();
if ($show_unawarded_awards == 'yes' || $awarded_count > 0) { if ($show_unawarded_awards == 'yes' || $awarded_count > 0) {
echo '<h3>' . i18n($r->name) . "</h3> \n"; echo '<h3>' . i18n($r->name) . "</h3> \n";
} }