From 3af1d09d61820a77dcd3d245d714d271f9442111 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 27 Dec 2012 17:32:14 +0100 Subject: [PATCH] reworked admin_user again --- includes/pages/admin_user.php | 136 ++++++++++++++-------------------- includes/sys_mysql.php | 5 +- includes/sys_template.php | 2 +- public/css/base.css | 16 +--- public/pic/icons/cross.png | Bin 0 -> 655 bytes public/pic/icons/pencil.png | Bin 0 -> 450 bytes public/pic/icons/tick.png | Bin 0 -> 537 bytes 7 files changed, 61 insertions(+), 98 deletions(-) create mode 100644 public/pic/icons/cross.png create mode 100644 public/pic/icons/pencil.png create mode 100644 public/pic/icons/tick.png diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 9c13cbd7..5f2bdbe6 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -281,93 +281,65 @@ function admin_user() { if (!isset ($_GET["OrderBy"])) $_GET["OrderBy"] = "Nick"; $SQL = "SELECT * FROM `User` ORDER BY `" . sql_escape($_GET["OrderBy"]) . "` ASC"; - $Erg = sql_query($SQL); + $angels = sql_select($SQL); // anzahl zeilen - $Zeilen = mysql_num_rows($Erg); + $Zeilen = count($angels); $html .= "Anzahl Engel: $Zeilen

\n"; - $html .= ' - - - - - - - - - - - - - '; - $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) . "
"; - if (strlen(mysql_result($Erg, $n, "Telefon")) > 0) - $title .= "Tel: " . mysql_result($Erg, $n, "Telefon") . "
"; - if (strlen(mysql_result($Erg, $n, "Handy")) > 0) - $title .= "Handy: " . mysql_result($Erg, $n, "Handy") . "
"; - if (strlen(mysql_result($Erg, $n, "DECT")) > 0) - $title .= "DECT: " . - mysql_result($Erg, $n, "DECT") . "
"; - if (strlen(mysql_result($Erg, $n, "Hometown")) > 0) - $title .= "Hometown: " . mysql_result($Erg, $n, "Hometown") . "
"; - if (strlen(mysql_result($Erg, $n, "CreateDate")) > 0) - $title .= "Registered: " . mysql_result($Erg, $n, "CreateDate") . "
"; - if (strlen(mysql_result($Erg, $n, "Art")) > 0) - $title .= "Type: " . mysql_result($Erg, $n, "Art") . "
"; - if (strlen(mysql_result($Erg, $n, "ICQ")) > 0) - $title .= "ICQ: " . mysql_result($Erg, $n, "ICQ") . "
"; - if (strlen(mysql_result($Erg, $n, "jabber")) > 0) - $title .= "jabber: " . mysql_result($Erg, $n, "jabber") . "
"; - - $html .= "\n"; - if (in_array("user_shifts_admin", $privileges)) - $html .= "\t\n"; - else - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $Gekommen += mysql_result($Erg, $n, "Gekommen"); - $html .= "\t\n"; - $Active += mysql_result($Erg, $n, "Aktiv"); - $html .= "\t\n"; - $Tshirt += mysql_result($Erg, $n, "Tshirt"); - $html .= "\t\n"; - $html .= "\t\n"; - $last_login = mysql_result($Erg, $n, "lastLogIn"); - if($last_login == 0) - $html .= ""; - else - $html .= ""; - $html .= "\t\n"; - $html .= "\n"; + + function prepare_angel_table($angel) { + global $privileges; + $groups = sql_select_single_col("SELECT `Name` FROM `UserGroups` JOIN `Groups` ON (`Groups`.`UID` = `UserGroups`.`group_id`) WHERE `UserGroups`.`uid`=" . sql_escape($angel["UID"]) . " ORDER BY `Groups`.`Name`"); + $popup = '" . - "" . - "\n"; - $html .= "\t
- Nick - Vorname NameDECTAlterE-MailLast loginEdit
" . mysql_result($Erg, $n, "Nick") . "" . mysql_result($Erg, $n, "Nick") . "" . mysql_result($Erg, $n, "Vorname") . " " . mysql_result($Erg, $n, "Name") . "" . mysql_result($Erg, $n, "DECT") . "" . mysql_result($Erg, $n, "Alter") . ""; - if (strlen(mysql_result($Erg, $n, "email")) > 0) - $html .= "" . - mysql_result($Erg, $n, "email") . ""; - $html .= ''; - $html .= "" . mysql_result($Erg, $n, "Gekommen") . "" . mysql_result($Erg, $n, "Aktiv") . "" . mysql_result($Erg, $n, "Tshirt") . "" . mysql_result($Erg, $n, "Size") . "never" . date('d.m.&\n\b\s\p;H:i', $last_login) . "" . 'Edit' . - "
Summe$Gekommen$Active$Tshirt
\n"; - // Ende Userliste + $angels = array_map('prepare_angel_table', $angels); + $Gekommen = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1"); + $Active = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1"); + $Tshirt = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1"); + $angels[] = array('Nick' => 'Summe', 'Gekommen' => $Gekommen, 'Aktiv' => $Active, 'Tshirt' => $Tshirt); + $html .= table(array( + 'Nick' => 'Nick', + 'Name' => 'Vorname Name', + 'DECT' => 'DECT', + 'Alter' => 'Alter', + 'email' => 'E-Mail', + 'Gekommen' => '
Gekommen
', + 'Aktiv' => '
Aktiv
', + 'Tshirt' => '
T-Shirt
', + 'Size' => '
Größe
', + 'lastLogIn' => 'Last login', + 'edit' => ''), + $angels); } return $html; } diff --git a/includes/sys_mysql.php b/includes/sys_mysql.php index 81747ec2..1315a4f6 100644 --- a/includes/sys_mysql.php +++ b/includes/sys_mysql.php @@ -33,8 +33,11 @@ function sql_select($query) { function sql_select_single_col($query) { $result = sql_select($query); - return array_map('array_pop', $result); + return array_map('array_shift', $result); +} +function sql_select_single_cell($query) { + return array_shift(array_shift(sql_select($query))); } // Execute a query diff --git a/includes/sys_template.php b/includes/sys_template.php index a988ff23..0f030e86 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -147,7 +147,7 @@ function table($columns, $rows, $data = true) { $html .= ''; $html .= ''; foreach ($columns as $key => $column) - $html .= '' . $column . ''; + $html .= '' . $column . ''; $html .= ''; $html .= ''; foreach ($rows as $row) { diff --git a/public/css/base.css b/public/css/base.css index 759e9157..6c5ecc57 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -152,24 +152,12 @@ td, th { border: 1px solid #888; } -td.true, td.false { - color: transparent; -} - -td.true { - background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLvZPZLkNhFIV75zjvYm7VGFNCqoZUJ+roKUUpjRuqp61Wq0NKDMelGGqOxBSUIBKXWtWGZxAvobr8lWjChRgSF//dv9be+9trCwAI/vIE/26gXmviW5bqnb8yUK028qZjPfoPWEj4Ku5HBspgAz941IXZeze8N1bottSo8BTZviVWrEh546EO03EXpuJOdG63otJbjBKHkEp/Ml6yNYYzpuezWL4s5VMtT8acCMQcb5XL3eJE8VgBlR7BeMGW9Z4yT9y1CeyucuhdTGDxfftaBO7G4L+zg91UocxVmCiy51NpiP3n2treUPujL8xhOjYOzZYsQWANyRYlU4Y9Br6oHd5bDh0bCpSOixJiWx71YY09J5pM/WEbzFcDmHvwwBu2wnikg+lEj4mwBe5bC5h1OUqcwpdC60dxegRmR06TyjCF9G9z+qM2uCJmuMJmaNZaUrCSIi6X+jJIBBYtW5Cge7cd7sgoHDfDaAvKQGAlRZYc6ltJlMxX03UzlaRlBdQrzSCwksLRbOpHUSb7pcsnxCCwngvM2Rm/ugUCi84fycr4l2t8Bb6iqTxSCgNIAAAAAElFTkSuQmCC') no-repeat center center; -} - -td.false { - background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIhSURBVDjLlZPrThNRFIWJicmJz6BWiYbIkYDEG0JbBiitDQgm0PuFXqSAtKXtpE2hNuoPTXwSnwtExd6w0pl2OtPlrphKLSXhx07OZM769qy19wwAGLhM1ddC184+d18QMzoq3lfsD3LZ7Y3XbE5DL6Atzuyilc5Ciyd7IHVfgNcDYTQ2tvDr5crn6uLSvX+Av2Lk36FFpSVENDe3OxDZu8apO5rROJDLo30+Nlvj5RnTlVNAKs1aCVFr7b4BPn6Cls21AWgEQlz2+Dl1h7IdA+i97A/geP65WhbmrnZZ0GIJpr6OqZqYAd5/gJpKox4Mg7pD2YoC2b0/54rJQuJZdm6Izcgma4TW1WZ0h+y8BfbyJMwBmSxkjw+VObNanp5h/adwGhaTXF4NWbLj9gEONyCmUZmd10pGgf1/vwcgOT3tUQE0DdicwIod2EmSbwsKE1P8QoDkcHPJ5YESjgBJkYQpIEZ2KEB51Y6y3ojvY+P8XEDN7uKS0w0ltA7QGCWHCxSWWpwyaCeLy0BkA7UXyyg8fIzDoWHeBaDN4tQdSvAVdU1Aok+nsNTipIEVnkywo/FHatVkBoIhnFisOBoZxcGtQd4B0GYJNZsDSiAEadUBCkstPtN3Avs2Msa+Dt9XfxoFSNYF/Bh9gP0bOqHLAm2WUF1YQskwrVFYPWkf3h1iXwbvqGfFPSGW9Eah8HSS9fuZDnS32f71m8KFY7xs/QZyu6TH2+2+FAAAAABJRU5ErkJggg==') no-repeat center center; -} - -.rotate { +th.Gekommen { /* this is a hack because the height of the row isn't adjusted automatically */ height: 6em; } -.rotate div { +div.rotate { transform: rotate(270deg); width: 1ex; margin: 0 auto -2px; diff --git a/public/pic/icons/cross.png b/public/pic/icons/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..1514d51a3cf1b67e1c5b9ada36f1fd474e2d214a GIT binary patch literal 655 zcmV;A0&x9_P)uEoyT++I zn$b9r%cFfhHe2K68PkBu*@^<$y+7xQ$wJ~;c5aBx$R=xq*41Wo zhwQus_VOgm0hughj}MhOvs#{>Vg09Y8WxjWUJY5YW zJ?&8eG!59Cz=|E%Ns@013KLWOLV)CObIIj_5{>{#k%TEAMs_GbdDV`x-iYsGH z#=Z{USAQA>NY(}X7=3{K8#Rq1}l<=psl5*5Xz9i;M}s*NP=ugs7Q#8Z;Dyx|}!`#}xw_C3!B-yaPC&0j)XcpuX@rNfq|q}N(wJOjA& z>u+z?dfJEuLePrqzy!)73pvLjxk4d6XNZt?hm_iYES{i}J5y3l?}PPNYDBR7oPc~6 zL^d)Bi4Q2L3pnp!nFxN9c2E+=@XAl&+;2m6a~kZj1r3Mz3C=hmUG<{+vWR@t4q?fJ zhFc(ozZD#Mx`^Q~g1v=K6!QnfuqyD4>U4EjF0eamL}Jx| z%&`kR-H+3GBYr*Qx}frLU4`%n9(`uSomzw)t%%NagXkA*R5Mbv9VLDp1wMo$cOMa~ s3Wm%r7^bwK$2$}-<~D8p`#1iScU4^XCLAA~0ssI207*qoM6N<$g3sK(Qvd(} literal 0 HcmV?d00001 diff --git a/public/pic/icons/tick.png b/public/pic/icons/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..a9925a06ab02db30c1e7ead9c701c15bc63145cb GIT binary patch literal 537 zcmV+!0_OdRP)Hs{AQG2a)rMyf zFQK~pm1x3+7!nu%-M`k}``c>^00{o_1pjWJUTfl8mg=3qGEl8H@}^@w`VUx0_$uy4 z2FhRqKX}xI*?Tv1DJd8z#F#0c%*~rM30HE1@2o5m~}ZyoWhqv>ql{V z1ZGE0lgcoK^lx+eqc*rAX1Ky;Xx3U%u#zG!m-;eD1Qsn@kf3|F9qz~|95=&g3(7!X zB}JAT>RU;a%vaNOGnJ%e1=K6eAh43c(QN8RQ6~GP%O}Jju$~Ld*%`mO1p