', $info); } function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null) { global $user; if ($user_angeltype == null) { $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype); } if ($angeltype['shift_signup_state']->isSignupAllowed()) { return button( page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'], _('Sign up') ); } elseif ($user_angeltype == null) { return button( page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], sprintf(_('Become %s'), $angeltype['name']) ); } return ''; } function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupState $shift_signup_state) { global $privileges; $shift_admin = in_array('admin_shifts', $privileges); $user_shift_admin = in_array('user_shifts_admin', $privileges); $admin_rooms = in_array('admin_rooms', $privileges); $admin_shifttypes = in_array('shifttypes', $privileges); $parsedown = new Parsedown(); $angeltypes = []; foreach ($angeltypes_source as $angeltype) { $angeltypes[$angeltype['id']] = $angeltype; } $needed_angels = ''; foreach ($shift['NeedAngels'] as $needed_angeltype) { $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin); } return page_with_title( $shift['name'] . ' %c', [ msg(), $shift_signup_state->getState() == ShiftSignupState::COLLIDES ? info(_('This shift collides with one of your shifts.'), true) : '', $shift_signup_state->getState() == ShiftSignupState::SIGNED_UP ? info(_('You are signed up for this shift.'), true) : '', ($shift_admin || $admin_shifttypes || $admin_rooms) ? buttons([ $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '' ]) : '', div('row', [ div('col-sm-3 col-xs-6', [ '
' . ($shift['URL'] != '' ? '' . $shift['title'] . '' : $shift['title']) . '
' ]), div('col-sm-3 col-xs-6', [ '',
glyph('calendar') . date(_('Y-m-d'), $shift['start']),
'
',
glyph('time') . date('H:i', $shift['start']),
'
',
glyph('calendar') . date(_('Y-m-d'), $shift['end']),
'
',
glyph('time') . date('H:i', $shift['end']),
'
' . Room_name_render($room) . '
' ]) ]), div('row', [ div('col-sm-6', [ '