newPage(); $rep->setFontSize(11); } else if ($type == 'csv') { $rep = new lcsv(i18n('Program Awards')); } $q = $pdo->prepare("SELECT award_awards.id, award_awards.name, award_awards.criteria, award_awards.presenter, award_awards.order AS awards_order, award_types.type FROM award_awards, award_types WHERE award_awards.year=? AND\taward_types.year=? AND\taward_awards.award_types_id=award_types.id AND\taward_awards.excludefromac='0' AND\t(award_types.type='special' OR award_types.type='grand') ORDER BY awards_order"); $q->execute([$config['FAIRYEAR'],$config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); if ($q->rowCount()) { while ($r = $q->fetch(PDO::FETCH_OBJ)) { $rep->heading(i18n($r->name)); // get teh age categories $acq = $pdo->prepare("SELECT projectcategories.category FROM projectcategories, award_awards_projectcategories WHERE projectcategories.year=? AND award_awards_projectcategories.year=? AND award_awards_projectcategories.award_awards_id=? AND award_awards_projectcategories.projectcategories_id=projectcategories.id ORDER BY projectcategories.id"); $acq->execute([$config['FAIRYEAR'],$config['FAIRYEAR'],$r->id]); show_pdo_errors_if_any($pdo); $cats = ''; while ($acr = $acq->fetch(PDO::FETCH_OBJ)) { $cats .= i18n($acr->category) . ', '; } $cats = substr($cats, 0, -2); $rep->addText("$cats: " . i18n($r->criteria)); $pq = $pdo->prepare("SELECT award_prizes.prize, award_prizes.number, award_prizes.id, award_prizes.cash, award_prizes.scholarship FROM award_prizes WHERE award_awards_id=? AND award_prizes.year=? AND award_prizes.excludefromac='0' ORDER BY `order`"); $pq->execute([$r->id,$config['FAIRYEAR']]); show_pdo_errors_if_any($pdo); $prevprizeid = -1; while ($pr = $pq->fetch(PDO::FETCH_OBJ)) { if ($prevprizeid != $pr->id) { $prizetext = ''; if ($pr->number > 1) $prizetext .= i18n('%1 prizes of', array($pr->number)) . ' '; if ($pr->prize) $prizetext .= i18n($pr->prize); if ($pr->cash || $pr->scholarship) { if ($pr->prize) $prizetext .= ' ('; if ($pr->cash && $pr->scholarship) $prizetext .= "\$$pr->cash / \$$pr->scholarship " . i18n('scholarship'); else if ($pr->cash) $prizetext .= "\$$pr->cash"; else if ($pr->scholarship) $prizetext .= "\$$pr->scholarship " . i18n('scholarship'); if ($pr->prize) $prizetext .= ')'; } $rep->addText($prizetext); $prevprizeid = $pr->id; } } $rep->nextLine(); } } $rep->output(); ?>