-
Notifications
You must be signed in to change notification settings - Fork 3
/
mn_groups.inc.php
104 lines (91 loc) · 3.43 KB
/
mn_groups.inc.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
<?php /* trenerova stranka - prirazeni clenu trenerum */
if (!defined("__HIDE_TEST__")) exit; /* zamezeni samostatneho vykonani */ ?>
<?
DrawPageTitle('Přiřazení členů malým trenérům');
?>
<CENTER>
<script language="javascript">
<!--
/* "status=yes,width=600,height=460" */
javascript:set_default_size(600,520);
function confirm_add() {
return confirm('Opravdu chcete povolit platícího trenéra?');
}
function confirm_reset() {
return confirm('Opravdu chcete resetovat trenéra?');
}
//-->
</script>
<?
require_once "./common_user.inc.php";
$data_tbl = new html_table_mc();
$col = 0;
$data_tbl->set_header_col($col++,'Poř.č.',ALIGN_CENTER);
$data_tbl->set_header_col($col++,'Příjmení',ALIGN_LEFT);
$data_tbl->set_header_col($col++,'Jméno',ALIGN_LEFT);
$data_tbl->set_header_col_with_help($col++,'Reg.č.',ALIGN_CENTER,"Registrační číslo");
$data_tbl->set_header_col($col++,'Trenér',ALIGN_CENTER);
if (IsLoggedSmallAdmin())
$data_tbl->set_header_col($col++,'Platící trenér',ALIGN_CENTER);
echo $data_tbl->get_css()."\n";
echo $data_tbl->get_header()."\n";
echo $data_tbl->get_header_row()."\n";
// u.id, u.prijmeni, u.jmeno, u.reg, u.hidden, u.lic, u2.jmeno as ch_jmeno, u2.prijmeni as ch_prijmeni
// u.*
$query='SELECT u.*, u2.jmeno as ch_jmeno, u2.prijmeni as ch_prijmeni, u2.hidden as ch_hidden FROM '.TBL_USER.' as u LEFT JOIN '.TBL_USER.' as u2 ON u.chief_id = u2.id ORDER BY sort_name ASC';
@$vysledek=query_db($query);
$i=1;
while ($zaznam=mysqli_fetch_array($vysledek))
{
if (!$zaznam['hidden'])
{
$row = array();
$row[] = $i++;
$row[] = $zaznam['prijmeni'];
$row[] = $zaznam['jmeno'];
$row[] = RegNumToStr($zaznam['reg']);
if ($zaznam['ch_jmeno'] == NULL || $zaznam['ch_prijmeni'] == NULL)
$row[] = "<A HREF=\"javascript:open_win('./mng_edit.php?id=".$zaznam['id']."','')\">Edit</A>";
else
{
if ($zaznam['ch_hidden'])
$row[] = '<span class="TextAlert2">'.$zaznam['ch_jmeno'].' '.$zaznam['ch_prijmeni'].'</span> / <a HREF="./mn_groups_exc.php?type=1&id='.$zaznam["id"].'" onclick="return confirm_reset()" class="Erase">Reset</A>';
else
$row[] = $zaznam['ch_jmeno'].' '.$zaznam['ch_prijmeni'].' / '. "<A HREF=\"javascript:open_win('./mng_edit.php?id=".$zaznam['id']."','')\">Edit</A>";
}
if (IsLoggedSmallAdmin())
{
$val = '';
if ($zaznam['chief_id'] != null && $zaznam['chief_id'] != 0)
{
if ($zaznam['chief_pay'] != null)
{
$query2='SELECT * FROM '.TBL_USER.' WHERE id = '.$zaznam['chief_pay'].' LIMIT 1';
@$vysledek2=query_db($query2);
if ($zaznam2=mysqli_fetch_array($vysledek2))
{
if ($zaznam['chief_pay'] != $zaznam['chief_id'] || $zaznam2['hidden'])
$val.='<span class="TextAlert2">';
$val.=$zaznam2['jmeno'].' '.$zaznam2['prijmeni'];
if ($zaznam['chief_pay'] != $zaznam['chief_id'] || $zaznam2['hidden'])
$val.='</span>';
$val.=' / ';
$val.= '<a HREF="./mn_groups_exc.php?type=2&id='.$zaznam["id"].'" onclick="return confirm_reset()" class="Erase">Reset</A>';
}
else
$val.=$zaznam['chief_pay'];
}
else
$val.= '<a HREF="./mn_groups_exc.php?type=3&id='.$zaznam["id"].'" onclick="return confirm_add()">Povol</A>';
}
else
$val.='-';
$row[] = $val;
}
echo $data_tbl->get_new_row_arr($row)."\n";
}
}
echo $data_tbl->get_footer()."\n";
?>
<BR>
</CENTER>