display user nicks on shift json export

This commit is contained in:
Philip Häusler 2015-01-05 13:58:34 +01:00
parent 48e4787548
commit 9af229094d
1 changed files with 4 additions and 0 deletions

View File

@ -727,6 +727,7 @@ function view_user_shifts() {
foreach ($angeltypes as &$angeltype) { foreach ($angeltypes as &$angeltype) {
$entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `TID`='" . sql_escape($angeltype['id']) . "' ORDER BY `Nick`"); $entries = sql_select("SELECT * FROM `ShiftEntry` JOIN `User` ON (`ShiftEntry`.`UID` = `User`.`UID`) WHERE `SID`='" . sql_escape($shift['SID']) . "' AND `TID`='" . sql_escape($angeltype['id']) . "' ORDER BY `Nick`");
$entry_list = array(); $entry_list = array();
$entry_nicks = [];
$freeloader = 0; $freeloader = 0;
foreach ($entries as $entry) { foreach ($entries as $entry) {
if (in_array('user_shifts_admin', $privileges)) if (in_array('user_shifts_admin', $privileges))
@ -740,8 +741,11 @@ function view_user_shifts() {
$freeloader ++; $freeloader ++;
} }
$entry_list[] = $member; $entry_list[] = $member;
$entry_nicks[] = $entry['Nick'];
} }
$angeltype['taken'] = count($entries) - $freeloader; $angeltype['taken'] = count($entries) - $freeloader;
$angeltype['angels'] = $entry_nicks;
// do we need more angles of this type? // do we need more angles of this type?
if ($angeltype['count'] - count($entries) + $freeloader > 0) { if ($angeltype['count'] - count($entries) + $freeloader > 0) {
$inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries) + $freeloader), $angeltype['count'] - count($entries) + $freeloader); $inner_text = sprintf(ngettext("%d helper needed", "%d helpers needed", $angeltype['count'] - count($entries) + $freeloader), $angeltype['count'] - count($entries) + $freeloader);