-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclub_scorings.php
109 lines (92 loc) · 3.85 KB
/
club_scorings.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
require_once 'include/club.php';
define('VIEW_SCORINGS', 0);
define('VIEW_NORMALIZERS', 1);
define('VIEW_COUNT', 2);
class Page extends ClubPageBase
{
protected function show_body()
{
global $_page;
check_permissions(PERMISSION_CLUB_MANAGER, $this->id);
$this->view = VIEW_SCORINGS;
if (isset($_REQUEST['view']))
{
$this->view = (int)$_REQUEST['view'];
}
if ($this->view < VIEW_SCORINGS || $this->view >= VIEW_COUNT)
{
$this->view = VIEW_SCORINGS;
}
echo '<div class="tab">';
echo '<button ' . ($this->view == VIEW_SCORINGS ? 'class="active" ' : '') . 'onclick="goTo({view:' . VIEW_SCORINGS . '})">' . get_label('Tournament scoring systems') . '</button>';
echo '<button ' . ($this->view == VIEW_NORMALIZERS ? 'class="active" ' : '') . 'onclick="goTo({view:' . VIEW_NORMALIZERS . '})">' . get_label('Tournament scoring normalizers') . '</button>';
echo '</div>';
switch ($this->view)
{
case VIEW_SCORINGS:
echo '<div class="tabcontent">';
echo '<table class="bordered light" width="100%">';
echo '<tr class="darker"><td width="48"><a href="#" onclick="mr.createScoringSystem(' . $this->id . ')" title="'.get_label('New scoring system').'">';
echo '<img src="images/create.png" border="0"></a></td>';
echo '<td>' . get_label('Scoring system name') . '</td></tr>';
$query = new DbQuery('SELECT id, name, version FROM scorings WHERE club_id = ? ORDER BY name', $this->id);
while ($row = $query->next())
{
list ($id, $name, $version) = $row;
echo '<tr><td class="dark" align="center">';
echo '<a onclick="mr.deleteScoringSystem(' . $id . ', \'' . get_label('Are you sure you want to delete [0]?', $name) . '\')" title="' . get_label('Delete [0]', $name) . '"><img src="images/delete.png" border="0"></a>';
echo '<a onclick="mr.editScoringSystem(' . $id . ')" title="' . get_label('Edit [0]', $name) . '"><img src="images/edit.png" border="0"></a>';
echo '</td><td><a href="javascript:showScoring(' . $id . ', ' . $version . ')">' . $name . '</a></td></tr>';
}
echo '</table>';
echo '</div>';
break;
case VIEW_NORMALIZERS:
echo '<div class="tabcontent">';
echo '<table class="bordered light" width="100%">';
echo '<tr class="darker"><td width="48"><a href="#" onclick="mr.createNormalizer(' . $this->id . ')" title="'.get_label('New scoring normalizer').'">';
echo '<img src="images/create.png" border="0"></a></td>';
echo '<td>' . get_label('Scoring normalizer name') . '</td></tr>';
$query = new DbQuery('SELECT id, name, version FROM normalizers WHERE club_id = ? ORDER BY name', $this->id);
while ($row = $query->next())
{
list ($id, $name, $version) = $row;
echo '<tr><td class="dark" align="center">';
echo '<a onclick="mr.deleteNormalizer(' . $id . ', \'' . get_label('Are you sure you want to delete [0]?', $name) . '\')" title="' . get_label('Delete [0]', $name) . '"><img src="images/delete.png" border="0"></a>';
echo '<a onclick="mr.editNormalizer(' . $id . ')" title="' . get_label('Edit [0]', $name) . '"><img src="images/edit.png" border="0"></a>';
// todo: implement form/normalizer_show.php
// echo '</td><td><a href="javascript:showNormalizer(' . $id . ', ' . $version . ')">' . $name . '</a></td></tr>';
echo '</td><td>' . $name . '</td></tr>';
}
echo '</table>';
echo '</div>';
break;
}
}
protected function js()
{
switch ($this->view)
{
case VIEW_SCORINGS:
?>
function showScoring(id, version)
{
dlg.infoForm("form/scoring_show.php?id=" + id + "&version=" + version);
}
<?php
break;
case VIEW_NORMALIZERS:
?>
function showNormalizer(id, version)
{
dlg.infoForm("form/normalizer_show.php?id=" + id + "&version=" + version);
}
<?php
break;
}
}
}
$page = new Page();
$page->run(get_label('Scoring Systems'));
?>