<?php require_once '../../../protected/config.php'; require_once config::servroot() . "/protected/smarty/template.php"; $template = new template(); require_once config::servroot() . "/protected/db/dbview.php"; $dbh = new dbview(); // Find the tournament specified by the URL $sres = $dbh->get('select count(*) as many from tournaments where id = :id and year = :year and aka = :aka', array(':id' => $_GET['id'], ':aka' => $_GET['aka'], ':year' => $_GET['year'])); if (0 == $sres[0]['many']) { error_log("Can't find series: aka: {$_GET['aka']}, id: {$_GET['id']}, year: {$_GET['year']}"); // Find all tournaments with a given aka $akaAll = 'select tournaments.name as name, tournaments.year, tournaments.id, start, host, schools.name as sname from tournaments left join schools on host = schools.id and tournaments.year = schools.year where tournaments.aka = :aka order by start desc, tournaments.name'; // All tournaments witht eh aka given by the URL $akaGrp = $dbh->get($akaAll, array(':aka' => $_GET['aka']));
<?php require_once '../../protected/config.php'; //require_once('../../protected/error-init.php'); require_once config::servroot() . "/protected/smarty/template.php"; $template = new template(); require_once config::servroot() . "/protected/db/dbview.php"; $dbh = new dbview(); // avg simply ignored nulls $torder = $dbh->get('select aka, avg(if(datediff(start,makedate(year(start),210)) < 0, datediff(start,makedate(year(start),210)) + 365.24, datediff(start,makedate(year(start),210)))) as days from tournaments group by aka order by days'); $tyStmt = $dbh->prepare(' set @year = :year; select year, id, name from tournaments where ((datediff(start, makedate(@year - 1,210)) > 0 and datediff(start, makedate(@year - 1,210)) < 364) or (start is null and year = @year)) and aka = :aka order by name'); foreach ($torder as $key => $trn) { $list = null; $recentYear = null; $recentID = null; for ($year = config::lastyear(); $year >= config::firstyear(); --$year) {