summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-08-23 01:55:18 +0200
committerPhilip Häusler <msquare@notrademark.de>2014-08-23 01:55:18 +0200
commitf5a094fd8b32d44767f7fc30a65f407f4e1d9945 (patch)
treeeac9a223e103c3066ef6e0b57e0bf215eaa89a72 /includes/controller
parent74647e16d37fac9425a4561b49618b52cdc3e75c (diff)
add user view, better bootstrap
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/user_angeltypes_controller.php2
-rw-r--r--includes/controller/users_controller.php15
2 files changed, 15 insertions, 2 deletions
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
index cb8c72ae..deb9b7f3 100644
--- a/includes/controller/user_angeltypes_controller.php
+++ b/includes/controller/user_angeltypes_controller.php
@@ -12,7 +12,7 @@ function user_angeltypes_unconfirmed_hint() {
return '';
if ($_REQUEST['p'] == 'angeltypes' && $_REQUEST['action'] == 'view' && $_REQUEST['angeltype_id'] == $unconfirmed_user_angeltypes[0]['angeltype_id'])
return '';
- return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . sprintf(_("The first wants to join %s."), '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $unconfirmed_user_angeltypes[0]['angeltype_id'] . '">' . $unconfirmed_user_angeltypes[0]['name'] . '</a>'), true);
+ return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . sprintf(_("The first wants to join %s."), '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $unconfirmed_user_angeltypes[0]['angeltype_id'] . '">' . $unconfirmed_user_angeltypes[0]['name'] . '</a>'));
}
/**
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index f65f54e3..77997278 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -35,9 +35,22 @@ function user_controller() {
$admin_user_privilege = in_array('admin_user', $privileges);
+ $shifts = Shifts_by_user($user_source);
+ foreach ($shifts as &$shift) {
+ $shift['needed_angeltypes'] = sql_select("SELECT DISTINCT `AngelTypes`.* FROM `ShiftEntry` JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id` WHERE `ShiftEntry`.`SID`=" . sql_escape($shift['SID']) . " ORDER BY `AngelTypes`.`name`");
+ foreach ($shift['needed_angeltypes'] as &$needed_angeltype) {
+ $needed_angeltype['users'] = sql_select("
+ SELECT `ShiftEntry`.`freeloaded`, `User`.*
+ FROM `ShiftEntry`
+ JOIN `User` ON `ShiftEntry`.`UID`=`User`.`UID`
+ WHERE `ShiftEntry`.`SID`=" . sql_escape($shift['SID']) . "
+ AND `ShiftEntry`.`TID`=" . sql_escape($needed_angeltype['id']));
+ }
+ }
+
return array(
$user_source['Nick'],
- User_view($user_source)
+ User_view($user_source, $admin_user_privilege, User_is_freeloader($user_source), User_shift_state($user_source), User_angeltypes($user_source), User_groups($user_source), $shifts, $user['UID'] == $user_source['UID'])
);
}