This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseasons.php
64 lines (61 loc) · 2.03 KB
/
seasons.php
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
62
63
64
<? if(!defined("CONFIG")) exit(); ?>
<? if(!isset($login)) { show_error("You do not have administrator rights\n"); return; } ?>
<?
if(isset($_GET['filter'])) {
$filter = $_GET['filter'];
$query_where = "WHERE s.name LIKE '%$filter%' OR d.name LIKE '%$filter%' OR rs.name LIKE '%$filter%'";
}
require_once("functions.php"); // import mysql function
$link = mysqlconnect(); // call mysql function to get the link to the database
$query = "SELECT s.*, d.name dname, rs.name rsname, qrs.name qrsname, COUNT(st.team) teamcount FROM season s JOIN division d ON (s.division = d.id) JOIN point_ruleset rs ON (rs.id = s.ruleset) LEFT JOIN point_ruleset qrs ON (qrs.id = s.ruleset_qualifying) LEFT JOIN season_team st ON (st.season = s.id) $query_where GROUP BY s.id ORDER BY s.name ASC, d.name ASC";
$result = mysqli_query($link,$query);
if(!$result) {
show_error("MySQL error: " . mysqli_error($link));
return;
}
?>
<h1>Seasons</h1>
<div align="right">
<form action="." method="GET">
<input type="hidden" name="page" value="seasons">
<input type="text" class="search" name="filter" value="<?=$_GET['filter']?>">
</form>
</div>
<a href=".?page=season_add">Add season</a>
<?
if(mysqli_num_rows($result) == 0) {
show_msg("No seasons found\n");
return;
}
?>
<div class="w3-container">
<table class="w3-table-all">
<tr class="w3-dark-grey">
<td> </td>
<td>Season</td>
<td>Division</td>
<td>Ruleset</td>
<td>Ruleset Qual</td>
<td align="center">Teams</td>
</tr>
<?
#$style = "odd";
while($item = mysqli_fetch_array($result)) {
?>
<!--<tr class="<?=$style?>">-->
<tr class="w3-hover-green">
<td>
<a href=".?page=season_chg&id=<?=$item['id']?>"><img src="images/edit16.png" alt="chg"></a>
<a href=".?page=season_rem&id=<?=$item['id']?>"><img src="images/delete16.png" alt="rem"></a>
</td>
<td><?=$item['name']?></td>
<td><?=$item['dname']?></td>
<td><?=$item['rsname']?></td>
<td><?=$item['qrsname']?></td>
<td width="65" align="center"><?=$item['teamcount']?> / <?=$item['maxteams']?></td>
</tr>
<?
#$style = $style == "odd" ? "even" : "odd";
}
?>
</table>