-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadmin.groepen.php
140 lines (127 loc) · 6.57 KB
/
admin.groepen.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
<?php
include "inc.default.php"; // should be included in EVERY file
$oSecurity = security(TRUE);
if (!$oSecurity->admin()) stop("admin");
$oPage->addJS("script/admin.js");
$oPage->addCSS("style/admin.css");
if (isset($_POST["addgroup"])) {
$oGroep = new group();
$oGroep->naam($_POST["naam"]);
$oGroep->info($_POST["info"]);
$oGroep->admin($_POST["admin"]);
$oGroep->update();
if ($_FILES["img"]["error"] == 0){
$strTmp = "upload/tmp/" . $_FILES["img"]["name"];
move_uploaded_file($_FILES["img"]["tmp_name"], $strTmp);
createGroupPicture($strTmp, $oGroep->id());
}
$oGroep->update();
$oGroep->addUser(intval($_POST["admin"]));
}
if (isset($_POST["delgroup"])) {
$oGroep = group(intval($_POST["delgroup"]));
$oGroep->delete(TRUE);
$oGroep->update();
}
$oExperience = new experience(me());
$oExperience->detail("reason", "admin-groepen");
$oExperience->add(2);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
echo $oPage->getHeader();
?>
</head>
<body id="index">
<?php echo $oPage->startTabs(); ?>
<div class="body">
<div class="container">
<div class="row">
<?php
echo $oSecurity->me()->html("user.html");
?>
</div>
<div class="main market admin-groepen">
<?php include "admin.menu.xml"; ?>
<h1>Groepsbeheer </h1>
<form method="post" class="groepToevoegenForm form-horizontal" enctype="multipart/form-data">
<fieldset>
<legend>Groepen</legend>
<div class="form-group">
<table>
<tr>
<th class="order asc">naam</th>
<th class="order">info</th>
<th class="order">beheerder</th>
<th class="order">OWA</th>
<th>...</th>
</tr>
<?php
$oGroepen = new grouplist();
foreach ($oGroepen->getList() as $oGroep) {
echo "<tr>";
echo "<td>" . $oGroep->naam() . "</td>";
echo "<td>" . shorten($oGroep->info()) . "</td>";
echo "<td>" . $oGroep->admin()->getName() . "</td>";
echo "<td>" . $oGroep->credits() . "/" . $oGroep->availableCredits() . "</td>";
echo "<td>
<a href=\"admin.groepusers.php?group=" . $oGroep->id() . "\">aanpassen</a>
<button class=\"actiondelete\" value=\"" . $oGroep->id() . "\" onclick=\"return confirm('Weet je zeker?');\" name=\"delgroup\" />
</td>";
echo "</tr>";
}
?>
</table>
</div>
</fieldset>
<fieldset>
<legend>Nieuwe groep toevoegen</legend>
<div class="form-group">
<label for="username" class="control-label col-lg-2">Groepsnaam:</label>
<div class="col-lg-10">
<input type="text" name="naam" class="naam form-control" id="naam" placeholder="Groepsnaam" value="" />
</div>
</div>
<div class="form-group">
<label for="username" class="control-label col-lg-2">Beheerder:</label>
<div class="col-lg-10">
<select name="admin" class="form-control" id="admin">
<option value="0">- selecteer een beheerder -</option>
<?php
$oUserList = new userlist();
foreach ($oUserList->getList() as $oUser) {
echo "<option value=\"" . $oUser->id() . "\">" . $oUser->getName() . "</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="description" class="control-label col-lg-2">Omschrijving:</label>
<div class="col-lg-10">
<textarea name="info" id="info" class="form-control" placeholder="Vertel ons iets over deze groep..."></textarea>
</div>
</div>
<div class="form-group">
<label for="img" class="control-label col-lg-2">Foto:</label>
<div class="col-lg-10">
<input type="file" name="img" class="img image form-control" id="img" placeholder="" value="" />
</div>
</div>
<div class="form-group">
<div class="col-lg-12">
<input type="submit" value="Gegevens opslaan" id="profile" class="btn btn-default pull-right" name="addgroup" />
</div>
</div>
</fieldset>
</form>
</div>
</div>
<?php echo $oPage->endTabs(); ?>
</div>
<div class="footer">
<?php echo $oPage->footer(); ?>
</div>
</body>
</html>