summaryrefslogtreecommitdiff
path: root/includes/pages/admin_user.php
blob: b64c967834769578c11fd72c2724dd4f4d23e30f (plain)
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
<?php
function admin_user() {
	include ("includes/funktion_db_list.php");

	$html = "";
	// Userliste, keine UID uebergeben...

	$html .= "<a href=\"" . page_link_to("register") . "\">Neuen Engel eintragen &raquo;</a><br /><br />\n";

	if (!isset ($_GET["OrderBy"]))
		$_GET["OrderBy"] = "Nick";
	$SQL = "SELECT * FROM `User` ORDER BY `" . $_GET["OrderBy"] . "` ASC";
	$Erg = sql_query($SQL);

	// anzahl zeilen
	$Zeilen = mysql_num_rows($Erg);

	$html .= "Anzahl Engel: $Zeilen<br /><br />\n";
	$html .= '
	<table width="100%" class="border" cellpadding="2" cellspacing="1"> <thead>
	  <tr class="contenttopic">
	    <th>
	      <a href="' . page_link_to("admin_user") . '&OrderBy=Nick">Nick</a>
	    </th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Vorname">Vorname</a> <a href="' . page_link_to("admin_user") . '&OrderBy=Name">Name</a></th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Alter">Alter</a></th>
	    <th>
	      <a href="' . page_link_to("admin_user") . '&OrderBy=email">E-Mail</a>
	    </th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Size">Gr&ouml;&szlig;e</a></th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Gekommen">Gekommen</a></th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Aktiv">Aktiv</a></th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=Tshirt">T-Shirt</a></th>
	    <th><a href="' . page_link_to("admin_user") . '&OrderBy=CreateDate">Registrier</a></th>
	    <th>&Auml;nd.</th>
	  </tr></thead>';
	$Gekommen = 0;
	$Active = 0;
	$Tshirt = 0;

	for ($n = 0; $n < $Zeilen; $n++) {
		$title = "";
		$user_groups = sql_select("SELECT * FROM `UserGroups` JOIN `Groups` ON (`Groups`.`UID` = `UserGroups`.`group_id`) WHERE `UserGroups`.`uid`=" . sql_escape(mysql_result($Erg, $n, "UID")) . " ORDER BY `Groups`.`Name`");
		$groups = array ();
		foreach ($user_groups as $user_group) {
			$groups[] = $user_group['Name'];
		}
		$title .= 'Groups: ' . join(", ", $groups) . "<br />";
		if (strlen(mysql_result($Erg, $n, "Telefon")) > 0)
			$title .= "Tel: " . mysql_result($Erg, $n, "Telefon") . "<br />";
		if (strlen(mysql_result($Erg, $n, "Handy")) > 0)
			$title .= "Handy: " . mysql_result($Erg, $n, "Handy") . "<br />";
		if (strlen(mysql_result($Erg, $n, "DECT")) > 0)
			$title .= "DECT: <a href=\"./dect.php?custum=" . mysql_result($Erg, $n, "DECT") . "\">" .
			mysql_result($Erg, $n, "DECT") . "</a><br />";
		if (strlen(mysql_result($Erg, $n, "Hometown")) > 0)
			$title .= "Hometown: " . mysql_result($Erg, $n, "Hometown") . "<br />";
		if (strlen(mysql_result($Erg, $n, "lastLogIn")) > 0)
			$title .= "Last login: " . date("Y-m-d H:i", mysql_result($Erg, $n, "lastLogIn")) . "<br />";
		if (strlen(mysql_result($Erg, $n, "Art")) > 0)
			$title .= "Type: " . mysql_result($Erg, $n, "Art") . "<br />";
		if (strlen(mysql_result($Erg, $n, "ICQ")) > 0)
			$title .= "ICQ: " . mysql_result($Erg, $n, "ICQ") . "<br />";
		if (strlen(mysql_result($Erg, $n, "jabber")) > 0)
			$title .= "jabber: " . mysql_result($Erg, $n, "jabber") . "<br />";

		$html .= "<tr class=\"content\">\n";
		$html .= "\t<td>" . mysql_result($Erg, $n, "Nick") . "</td>\n";
		$html .= "\t<td>" . mysql_result($Erg, $n, "Vorname") . " " . mysql_result($Erg, $n, "Name") . "</td>\n";
		$html .= "\t<td>" . mysql_result($Erg, $n, "Alter") . "</td>\n";
		$html .= "\t<td>";
		if (strlen(mysql_result($Erg, $n, "email")) > 0)
			$html .= "<a href=\"mailto:" . mysql_result($Erg, $n, "email") . "\">" .
			mysql_result($Erg, $n, "email") . "</a>";
		$html .= '<div class="hidden">' . $title . '</div>';
		$html .= "</td>\n";
		$html .= "\t<td>" . mysql_result($Erg, $n, "Size") . "</td>\n";
		$Gekommen += mysql_result($Erg, $n, "Gekommen");
		$html .= "\t<td>" . mysql_result($Erg, $n, "Gekommen") . "</td>\n";
		$Active += mysql_result($Erg, $n, "Aktiv");
		$html .= "\t<td>" . mysql_result($Erg, $n, "Aktiv") . "</td>\n";
		$Tshirt += mysql_result($Erg, $n, "Tshirt");
		$html .= "\t<td>" . mysql_result($Erg, $n, "Tshirt") . "</td>\n";
		$html .= "<td>" . mysql_result($Erg, $n, "CreateDate") . "</td>";
		$html .= "\t<td>" . '<a href="">Edit</a>' .
		"</td>\n";
		$html .= "</tr>\n";
	}
	$html .= "<tr>" .
	"<td></td><td></td><td></td><td></td><td></td>" .
	"<td>$Gekommen</td><td>$Active</td><td>$Tshirt</td><td></td><td></td></tr>\n";
	$html .= "\t</table>\n";
	// Ende Userliste

	$html .= "<hr /><h2>Statistics</h2>";
	$html .= funktion_db_element_list_2row("Hometown", "SELECT COUNT(`Hometown`), `Hometown` FROM `User` GROUP BY `Hometown`");

	$html .= "<br />\n";

	$html .= funktion_db_element_list_2row("Engeltypen", "SELECT COUNT(`Art`), `Art` FROM `User` GROUP BY `Art`");

	$html .= "<br />\n";

	$html .= funktion_db_element_list_2row("Used Groups", "SELECT Groups.Name AS 'GroupName', COUNT(Groups.Name) AS Count FROM `UserGroups` " .
	"LEFT JOIN `Groups` ON Groups.UID = UserGroups.group_id " .
	"WHERE (UserGroups.group_id!='NULL') " .
	"GROUP BY `GroupName` " .
	"");
	return $html;
}
?>