Fix winners page

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

View File

@ -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>';
$ok = true;
// 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
if ($_GET['year'] >= $config['FAIRYEAR']) {
@ -73,9 +74,9 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
award_types
WHERE
award_awards.year='$year'
AND\taward_awards.award_types_id=award_types.id
AND\taward_types.type='$type'
AND\taward_types.year='$year'
AND award_awards.award_types_id=award_types.id
AND award_types.type='$type'
AND award_types.year='$year'
ORDER BY
awards_order");
@ -85,7 +86,40 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
if ($q->rowCount()) {
echo '<a href="winners.php">' . i18n('Back to Winners main page') . '</a>';
echo '<br />';
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$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();
show_pdo_errors_if_any($pdo);
$awarded_count = 0;
if ($show_unawarded_awards == 'no') {
while ($pr = $pq->fetch(PDO::FETCH_OBJ)) {
if ($pr->projectnumber) {
$awarded_count++;
}
}
// $pq->fetch(PDO::FETCH_ORI_ABS, 0);
}
$pq = $pdo->prepare("SELECT
award_prizes.prize,
award_prizes.number,
@ -105,18 +139,9 @@ if (get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type'))
AND award_prizes.year='$year'
ORDER BY
`order`");
$pq->execute();
show_pdo_errors_if_any($pdo);
$awarded_count = 0;
if ($show_unawarded_awards == 'no') {
while ($pr = $pq->fetch(PDO::FETCH_OBJ)) {
if ($pr->projectnumber) {
$awarded_count++;
}
}
$pq->fetch(PDO::FETCH_ORI_ABS, 0);
}
if ($show_unawarded_awards == 'yes' || $awarded_count > 0) {
echo '<h3>' . i18n($r->name) . "</h3> \n";
}