forked from che0/greybox
-
Notifications
You must be signed in to change notification settings - Fork 3
/
turnaj.kidy.inc
61 lines (56 loc) · 1.59 KB
/
turnaj.kidy.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/*
* greybox
* $Id: turnaj.kidy.inc,v 1.5 2005/03/23 20:05:48 che0 Exp $
*/
$turnaj_id = $_REQUEST["turnaj_id"];
$GLOBALS["page"]->title = htmlspecialchars(cpdb_fetch_one_value("select nazev from turnaj where turnaj_ID = :turnaj_id", array(":turnaj_id"=>$turnaj_id))) . " / " . $lang["kidy"];
pg_head();
cpdb_fetch_all(sprintf("
select
clovek.clovek_ID,
clovek.jmeno,
clovek.nick,
clovek.prijmeni,
clovek.clen,
klub.kratky_nazev as klub,
klub.klub_ID,
avg(kidy) as avg,
count(kidy) as samples
from
clovek
left join klub on clovek.klub_ID = klub.klub_ID
left join clovek_debata on clovek.clovek_ID = clovek_debata.clovek_ID
and find_in_set(clovek_debata.role,'a1,a2,a3,n1,n2,n3')
left join debata on clovek_debata.debata_ID = debata.debata_ID
where
clovek.debater = 1
and debata.turnaj_ID = :turnaj_id
group by
clovek_ID, jmeno, nick, prijmeni, klub, klub_ID
having
samples > 0
order by
avg desc
", $ukaz), array(":turnaj_id"=>$turnaj_id), $r_kidy);
de_html($r_kidy);
cph_table_head(array($lang["rank"], $lang["debater"], $lang["club"], $lang["average"], $lang["samples"]));
$count = 0; $rank = 1; $pts = -1;
foreach ($r_kidy as $kidy) {
$count++;
if ($pts != $kidy["avg"]) {
$pts = $kidy["avg"];
$rank = $count;
}
cph_table_row(array(
$rank,
cphs_link("./?page=clovek&clovek_id=" . $kidy["clovek_ID"], join_name($kidy["jmeno"],$kidy["nick"],$kidy["prijmeni"])),
cphs_link("./?page=klub&klub_id=" . $kidy["klub_ID"], $kidy["klub"]),
$kidy["avg"],
$kidy["samples"]
),
$kidy["clen"] ? array() : array("class"=>"inactive")
);
}
cph_table_end();
?>