-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathteams.php
141 lines (125 loc) · 5.23 KB
/
teams.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
if (isset($_SESSION['logget_ind'])) {
include ("teamdoaction.php");
?>
<div class="teams_page">
<div class="sub_menu">
<div onclick="Teams()" id="Teams_menu">Teams</div>
<div onclick="Personer()" id="Personer_menu">Personer</div>
<div onclick="Evner()" id="Evner_menu">Evner / Instrumenter</div>
</div>
<div id="team_menu">
<div id="Teams">
<div id="edit_team">
<form id="teamform" name="teamform" method="post" action="main.php?page=teams&subpage=teams&action=save">
<input type="hidden" name="teamID" id="teamID" value="-1">
<table id="musiker_table" cellspacing="0" cellpadding="3" width="780">
<tr><td height="15" background="img/tabletop_bg.gif" colspan="2"><div align="left"><strong>Ret team:</strong></div></td></tr>
<tr>
<td colspan="2">
Team navn: <input type="text" id="teamnavn" name="teamnavn" size="20">
Team Beskrivelse: <input type="text" id="teamdescr" name="teamdescr" size="50">
<td>
</tr>
<tr><td align="left" bgcolor="#f2f2f2" colspan="2"><strong>Medlemmer:</strong> (dem med kryds i)</td></tr>
<?php
$tmquery = "SELECT Bruger.BrugerID,Bruger.Fornavn,Bruger.Efternavn, Bruger.Email FROM Bruger order by fornavn, email;";
$tmresult = doSQLQuery($tmquery);
$colour = "";
while ($tmline = db_fetch_array($tmresult)) {
$brugerid = $tmline["BrugerID"];
$firstName = $tmline["Fornavn"];
$lastName = $tmline["Efternavn"];
$displayName = $firstName." ".$lastName;
if($displayName == ' '){
$displayName = $tmline['Email'];
}
echo "<tr><td".$colour." align=\"left\" colspan=\"2\">";
echo "<input class=\"checkbox\" type=\"checkbox\" id=\"member".$brugerid."\" name=\"member".$brugerid."\">";
echo $displayName." (";
// Find and list abilities
$abilityQuery = "SELECT Rolle.Navn FROM Rolle INNER JOIN BrugerRolle ON Rolle.RolleID=BrugerRolle.RolleID WHERE BrugerRolle.BrugerID=".$brugerid.";";
$abilityResult = doSQLQuery($abilityQuery);
$abilities = "";
while ($abilityLine = db_fetch_array($abilityResult)) {
if ($abilities != "") $abilities = $abilities . ", ";
$abilities = $abilities . $abilityLine["Navn"];
}
echo $abilities.")"; // Abilities
echo "</td></tr>\n";
if ($colour == "") {
$colour = " bgcolor=\"#f2f2f2\"";
} else {
$colour = "";
}
}
?>
</div></td>
</tr>
<tr>
<td<?php echo $colour; ?> align="center" colspan="2">
<input class="submit_btn" type="submit" name="Submit" value="Gem teamdata" />
<button name="send" value="Slet team" class="submit_btn_2" onClick="javascript:return deleteTeam();"> Slet team </button>
<button name="send" value="Annuller" class="submit_btn_2" onClick="javascript:document.getElementById('edit_team').style.display='none';return false;"> Annuller </button>
</td>
</tr>
</table>
</form>
<p> </p>
</div> <!-- edit_person -->
<p> </p>
<strong>Eksisterende teams:</strong>
<?php
$query = "SELECT TeamID,Navn,Beskrivelse FROM Team ORDER BY TeamID";
$result = doSQLQuery($query);
while ($line = db_fetch_array($result)) {
$colour = " bgcolor=\"#f2f2f2\"";
$teamID = $line["TeamID"];
$teamName = $line["Navn"];
$teamDesr = $line["Beskrivelse"];
echo " <table id=\"musiker_table\" cellspacing=\"0\" cellpadding=\"3\" width=\"780\">\n";
echo " <tr><td bgcolor=\"#f2f2f2\"><strong>Team: </strong>".$teamName . "</td></tr>\n";
echo " <tr><td ><strong>Beskrivelse: </strong>". $teamDesr . "</td></tr>\n";
$tmquery = "SELECT Bruger.BrugerID,Bruger.Fornavn,Bruger.Efternavn, Bruger.Email FROM Bruger INNER JOIN TeamBruger ON TeamBruger.BrugerID=Bruger.BrugerID WHERE TeamBruger.TeamID=".$teamID.";";
$tmresult = doSQLQuery($tmquery);
while ($tmline = db_fetch_array($tmresult)) {
$brugerid = $tmline["BrugerID"];
$firstName = $tmline["Fornavn"];
$lastName = $tmline["Efternavn"];
$displayName = $firstName." ".$lastName;
if(trim($displayName) == ""){
$displayName= $tmline['Email'];
}
echo "<tr><td".$colour.">".$displayName."</td></tr>\n";
if ($colour == "") {
$colour = " bgcolor=\"#f2f2f2\"";
} else {
$colour = "";
}
}
echo "<tr><td".$colour."><button name=\"send\" value=\"Ret team\" class=\"submit_btn_2\" onClick=\"javascript:editTeam(".$teamID.");return false;\"> Ret team </button></td></tr>";
echo "</table><br />\n";
}
?>
<button name="send" value="Opret nyt team" class="submit_btn_2" onClick="javascript:newTeam();return false;"> Opret nyt team </button>
<p> </p>
</div> <!--Tteams -->
<?php
include("persons.php");
include("abilities.php");
?>
</div> <!-- team_menu -->
</div> <!-- teams_page -->
<script type="text/javascript">
document.getElementById("edit_person").style.display="none";
document.getElementById("edit_team").style.display="none";
<?php
echo " ".$jsArrStr;
if (isset($_GET['subpage']) && $_GET['subpage'] == "persons") echo " Personer();\n";
else if (isset($_GET['subpage']) && $_GET['subpage'] == "abilities") echo " Evner();\n";
else echo " Teams();\n";
?>
</script>
<?php
} // session
?>