Formatting & Docstrings
This commit is contained in:
parent
879918864a
commit
952c7892f3
|
@ -42,7 +42,7 @@ before_script:
|
||||||
.test_template: &test_definition
|
.test_template: &test_definition
|
||||||
stage: test
|
stage: test
|
||||||
artifacts:
|
artifacts:
|
||||||
name: "${CI_JOB_NAME}_${CI_PROJECT_ID}_${PHP_VERSION}"
|
name: "${CI_JOB_NAME}_${CI_PROJECT_ID}"
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- ./coverage/
|
- ./coverage/
|
||||||
|
|
|
@ -41,7 +41,7 @@ ALTER TABLE `Room` DROP `Number`;
|
||||||
ALTER TABLE `Room` DROP `show`;
|
ALTER TABLE `Room` DROP `show`;
|
||||||
ALTER TABLE `Room` DROP `Man`;
|
ALTER TABLE `Room` DROP `Man`;
|
||||||
ALTER TABLE `Room` ADD `from_frab` BOOLEAN NOT NULL AFTER `FromPentabarf`;
|
ALTER TABLE `Room` ADD `from_frab` BOOLEAN NOT NULL AFTER `FromPentabarf`;
|
||||||
update Room set `from_frab`=(`FromPentabarf`='Y');
|
UPDATE Room SET `from_frab` = (`FromPentabarf` = 'Y');
|
||||||
ALTER TABLE `Room` DROP `FromPentabarf`;
|
ALTER TABLE `Room` DROP `FromPentabarf`;
|
||||||
ALTER TABLE `Room` ADD `map_url` VARCHAR(300) NULL AFTER `from_frab`;
|
ALTER TABLE `Room` ADD `map_url` VARCHAR(300) NULL AFTER `from_frab`;
|
||||||
ALTER TABLE `Room` ADD `description` TEXT NULL AFTER `map_url`;
|
ALTER TABLE `Room` ADD `description` TEXT NULL AFTER `map_url`;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Engelsystem\ShiftsFilter;
|
use Engelsystem\ShiftsFilter;
|
||||||
use Engelsystem\ShiftsFilterRenderer;
|
use Engelsystem\ShiftsFilterRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text for Angeltype related links.
|
* Text for Angeltype related links.
|
||||||
*
|
*
|
||||||
|
@ -197,6 +198,7 @@ function angeltype_controller()
|
||||||
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
|
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
|
||||||
$request = request();
|
$request = request();
|
||||||
$tab = 0;
|
$tab = 0;
|
||||||
|
|
||||||
if ($request->has('shifts_filter_day')) {
|
if ($request->has('shifts_filter_day')) {
|
||||||
$tab = 1;
|
$tab = 1;
|
||||||
}
|
}
|
||||||
|
@ -222,10 +224,11 @@ function angeltype_controller()
|
||||||
/**
|
/**
|
||||||
* On which days do shifts for this angeltype occur? Needed for shiftCalendar.
|
* On which days do shifts for this angeltype occur? Needed for shiftCalendar.
|
||||||
*
|
*
|
||||||
* @param Angeltype $angeltype
|
* @param array $angeltype
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function angeltype_controller_shiftsFilterDays($angeltype) {
|
function angeltype_controller_shiftsFilterDays($angeltype)
|
||||||
|
{
|
||||||
$all_shifts = Shifts_by_angeltype($angeltype);
|
$all_shifts = Shifts_by_angeltype($angeltype);
|
||||||
$days = [];
|
$days = [];
|
||||||
foreach ($all_shifts as $shift) {
|
foreach ($all_shifts as $shift) {
|
||||||
|
@ -240,11 +243,12 @@ function angeltype_controller_shiftsFilterDays($angeltype) {
|
||||||
/**
|
/**
|
||||||
* Sets up the shift filter for the angeltype.
|
* Sets up the shift filter for the angeltype.
|
||||||
*
|
*
|
||||||
* @param Angeltype $angeltype
|
* @param array $angeltype
|
||||||
* @param array $days
|
* @param array $days
|
||||||
* @return ShiftsFilter
|
* @return ShiftsFilter
|
||||||
*/
|
*/
|
||||||
function angeltype_controller_shiftsFilter($angeltype, $days) {
|
function angeltype_controller_shiftsFilter($angeltype, $days)
|
||||||
|
{
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
$request = request();
|
$request = request();
|
||||||
|
|
|
@ -101,7 +101,8 @@ function event_config_edit_controller()
|
||||||
);
|
);
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
sprintf('Changed event config: %s, %s, %s, %s, %s, %s',
|
sprintf(
|
||||||
|
'Changed event config: %s, %s, %s, %s, %s, %s',
|
||||||
$event_name,
|
$event_name,
|
||||||
$event_welcome_msg,
|
$event_welcome_msg,
|
||||||
date('Y-m-d', $buildup_start_date),
|
date('Y-m-d', $buildup_start_date),
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all data for the public dashboard
|
* Loads all data for the public dashboard
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function public_dashboard_controller()
|
function public_dashboard_controller()
|
||||||
{
|
{
|
||||||
|
@ -31,6 +33,7 @@ function public_dashboard_controller()
|
||||||
* Gathers information for free shifts to display.
|
* Gathers information for free shifts to display.
|
||||||
*
|
*
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function public_dashboard_controller_free_shift($shift)
|
function public_dashboard_controller_free_shift($shift)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +68,7 @@ function public_dashboard_controller_free_shift($shift)
|
||||||
* Gathers information for needed angels on dashboard
|
* Gathers information for needed angels on dashboard
|
||||||
*
|
*
|
||||||
* @param array $needed_angels
|
* @param array $needed_angels
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function public_dashboard_needed_angels($needed_angels)
|
function public_dashboard_needed_angels($needed_angels)
|
||||||
{
|
{
|
||||||
|
@ -86,9 +90,10 @@ function public_dashboard_needed_angels($needed_angels)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns url to public dashboard
|
* Returns url to public dashboard
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function public_dashboard_link()
|
function public_dashboard_link()
|
||||||
{
|
{
|
||||||
return page_link_to('public-dashboard');
|
return page_link_to('public-dashboard');
|
||||||
}
|
}
|
||||||
?>
|
|
|
@ -1,8 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Engelsystem\ShiftSignupState;
|
use Engelsystem\ShiftSignupState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route shift entry actions.
|
* Route shift entry actions.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entries_controller()
|
function shift_entries_controller()
|
||||||
{
|
{
|
||||||
|
@ -25,6 +28,8 @@ function shift_entries_controller()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign up for a shift.
|
* Sign up for a shift.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_controller()
|
function shift_entry_create_controller()
|
||||||
{
|
{
|
||||||
|
@ -63,6 +68,7 @@ function shift_entry_create_controller()
|
||||||
*
|
*
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_controller_admin($shift, $angeltype)
|
function shift_entry_create_controller_admin($shift, $angeltype)
|
||||||
{
|
{
|
||||||
|
@ -126,6 +132,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
|
||||||
*
|
*
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_controller_supporter($shift, $angeltype)
|
function shift_entry_create_controller_supporter($shift, $angeltype)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +150,15 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
|
||||||
|
|
||||||
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
|
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
|
||||||
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
|
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
|
||||||
$shift_signup_state = Shift_signup_allowed($signup_user, $shift, $angeltype, null, null, $needed_angeltype, $shift_entries);
|
$shift_signup_state = Shift_signup_allowed(
|
||||||
|
$signup_user,
|
||||||
|
$shift,
|
||||||
|
$angeltype,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
$needed_angeltype,
|
||||||
|
$shift_entries
|
||||||
|
);
|
||||||
if (!$shift_signup_state->isSignupAllowed()) {
|
if (!$shift_signup_state->isSignupAllowed()) {
|
||||||
if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) {
|
if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) {
|
||||||
error(_('This shift is already occupied.'));
|
error(_('This shift is already occupied.'));
|
||||||
|
@ -180,9 +195,11 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an error message for the given shift signup state.
|
* Generates an error message for the given shift signup state.
|
||||||
|
*
|
||||||
* @param ShiftSignupState $shift_signup_state
|
* @param ShiftSignupState $shift_signup_state
|
||||||
*/
|
*/
|
||||||
function shift_entry_error_message(ShiftSignupState $shift_signup_state) {
|
function shift_entry_error_message(ShiftSignupState $shift_signup_state)
|
||||||
|
{
|
||||||
if ($shift_signup_state->getState() == ShiftSignupState::ANGELTYPE) {
|
if ($shift_signup_state->getState() == ShiftSignupState::ANGELTYPE) {
|
||||||
error(_('You need be accepted member of the angeltype.'));
|
error(_('You need be accepted member of the angeltype.'));
|
||||||
} elseif ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
|
} elseif ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
|
||||||
|
@ -204,6 +221,7 @@ function shift_entry_error_message(ShiftSignupState $shift_signup_state) {
|
||||||
*
|
*
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_controller_user($shift, $angeltype)
|
function shift_entry_create_controller_user($shift, $angeltype)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +231,15 @@ function shift_entry_create_controller_user($shift, $angeltype)
|
||||||
$signup_user = $user;
|
$signup_user = $user;
|
||||||
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
|
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
|
||||||
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
|
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
|
||||||
$shift_signup_state = Shift_signup_allowed($signup_user, $shift, $angeltype, null, null, $needed_angeltype, $shift_entries);
|
$shift_signup_state = Shift_signup_allowed(
|
||||||
|
$signup_user,
|
||||||
|
$shift,
|
||||||
|
$angeltype,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
$needed_angeltype,
|
||||||
|
$shift_entries
|
||||||
|
);
|
||||||
if (!$shift_signup_state->isSignupAllowed()) {
|
if (!$shift_signup_state->isSignupAllowed()) {
|
||||||
shift_entry_error_message($shift_signup_state);
|
shift_entry_error_message($shift_signup_state);
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
|
@ -249,6 +275,9 @@ function shift_entry_create_controller_user($shift, $angeltype)
|
||||||
/**
|
/**
|
||||||
* Link to create a shift entry.
|
* Link to create a shift entry.
|
||||||
*
|
*
|
||||||
|
* @param array $shift
|
||||||
|
* @param array $angeltype
|
||||||
|
* @param array $params
|
||||||
* @return string URL
|
* @return string URL
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_link($shift, $angeltype, $params = [])
|
function shift_entry_create_link($shift, $angeltype, $params = [])
|
||||||
|
@ -264,6 +293,8 @@ function shift_entry_create_link($shift, $angeltype, $params = [])
|
||||||
/**
|
/**
|
||||||
* Link to create a shift entry as admin.
|
* Link to create a shift entry as admin.
|
||||||
*
|
*
|
||||||
|
* @param array $shift
|
||||||
|
* @param array $params
|
||||||
* @return string URL
|
* @return string URL
|
||||||
*/
|
*/
|
||||||
function shift_entry_create_link_admin($shift, $params = [])
|
function shift_entry_create_link_admin($shift, $params = [])
|
||||||
|
@ -277,6 +308,8 @@ function shift_entry_create_link_admin($shift, $params = [])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a shift entry from get parameter shift_entry_id.
|
* Load a shift entry from get parameter shift_entry_id.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_load()
|
function shift_entry_load()
|
||||||
{
|
{
|
||||||
|
@ -296,6 +329,8 @@ function shift_entry_load()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove somebody from a shift.
|
* Remove somebody from a shift.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function shift_entry_delete_controller()
|
function shift_entry_delete_controller()
|
||||||
{
|
{
|
||||||
|
@ -334,7 +369,7 @@ function shift_entry_delete_controller()
|
||||||
* Link to delete a shift entry.
|
* Link to delete a shift entry.
|
||||||
*
|
*
|
||||||
* @param array $shiftEntry
|
* @param array $shiftEntry
|
||||||
*
|
* @param array $params
|
||||||
* @return string URL
|
* @return string URL
|
||||||
*/
|
*/
|
||||||
function shift_entry_delete_link($shiftEntry, $params = [])
|
function shift_entry_delete_link($shiftEntry, $params = [])
|
||||||
|
|
|
@ -45,7 +45,6 @@ function shift_edit_controller()
|
||||||
{
|
{
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
// Schicht bearbeiten
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
$valid = true;
|
$valid = true;
|
||||||
$request = request();
|
$request = request();
|
||||||
|
@ -65,7 +64,11 @@ function shift_edit_controller()
|
||||||
$angeltypes = select_array(AngelTypes(), 'id', 'name');
|
$angeltypes = select_array(AngelTypes(), 'id', 'name');
|
||||||
$shifttypes = select_array(ShiftTypes(), 'id', 'name');
|
$shifttypes = select_array(ShiftTypes(), 'id', 'name');
|
||||||
|
|
||||||
$needed_angel_types = select_array(NeededAngelTypes_by_shift($shift_id), 'angel_type_id', 'count');
|
$needed_angel_types = select_array(
|
||||||
|
NeededAngelTypes_by_shift($shift_id),
|
||||||
|
'angel_type_id',
|
||||||
|
'count'
|
||||||
|
);
|
||||||
foreach (array_keys($angeltypes) as $angeltype_id) {
|
foreach (array_keys($angeltypes) as $angeltype_id) {
|
||||||
if (!isset($needed_angel_types[$angeltype_id])) {
|
if (!isset($needed_angel_types[$angeltype_id])) {
|
||||||
$needed_angel_types[$angeltype_id] = 0;
|
$needed_angel_types[$angeltype_id] = 0;
|
||||||
|
@ -178,7 +181,9 @@ function shift_edit_controller()
|
||||||
shifts_title(),
|
shifts_title(),
|
||||||
[
|
[
|
||||||
msg(),
|
msg(),
|
||||||
'<noscript>' . info(_('This page is much more comfortable with javascript.'), true) . '</noscript>',
|
'<noscript>'
|
||||||
|
. info(_('This page is much more comfortable with javascript.'), true)
|
||||||
|
. '</noscript>',
|
||||||
form([
|
form([
|
||||||
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
||||||
form_text('title', _('Title'), $title),
|
form_text('title', _('Title'), $title),
|
||||||
|
@ -310,8 +315,9 @@ function shifts_controller()
|
||||||
switch ($request->input('action')) {
|
switch ($request->input('action')) {
|
||||||
case 'view':
|
case 'view':
|
||||||
return shift_controller();
|
return shift_controller();
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case 'next':
|
case 'next':
|
||||||
return shift_next_controller();
|
shift_next_controller();
|
||||||
default:
|
default:
|
||||||
redirect(page_link_to('/'));
|
redirect(page_link_to('/'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,10 @@ function user_angeltype_update_controller()
|
||||||
UserAngelType_update($user_angeltype['id'], $supporter);
|
UserAngelType_update($user_angeltype['id'], $supporter);
|
||||||
|
|
||||||
$success_message = sprintf(
|
$success_message = sprintf(
|
||||||
$supporter ? _('Added supporter rights for %s to %s.') : _('Removed supporter rights for %s from %s.'),
|
$supporter
|
||||||
|
? _('Added supporter rights for %s to %s.')
|
||||||
|
: _('Removed supporter rights for %s from %s.')
|
||||||
|
,
|
||||||
AngelType_name_render($angeltype),
|
AngelType_name_render($angeltype),
|
||||||
User_Nick_render($user_source)
|
User_Nick_render($user_source)
|
||||||
);
|
);
|
||||||
|
@ -291,6 +294,8 @@ function user_angeltype_update_controller()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User joining an Angeltype (Or supporter doing this for him).
|
* User joining an Angeltype (Or supporter doing this for him).
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function user_angeltype_add_controller()
|
function user_angeltype_add_controller()
|
||||||
{
|
{
|
||||||
|
@ -364,7 +369,11 @@ function user_angeltype_join_controller($angeltype)
|
||||||
$user_angeltype_id = UserAngelType_create($user, $angeltype);
|
$user_angeltype_id = UserAngelType_create($user, $angeltype);
|
||||||
|
|
||||||
$success_message = sprintf(_('You joined %s.'), $angeltype['name']);
|
$success_message = sprintf(_('You joined %s.'), $angeltype['name']);
|
||||||
engelsystem_log(sprintf('User %s joined %s.', User_Nick_render($user), AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf(
|
||||||
|
'User %s joined %s.',
|
||||||
|
User_Nick_render($user),
|
||||||
|
AngelType_name_render($angeltype)
|
||||||
|
));
|
||||||
success($success_message);
|
success($success_message);
|
||||||
|
|
||||||
if (in_array('admin_user_angeltypes', $privileges)) {
|
if (in_array('admin_user_angeltypes', $privileges)) {
|
||||||
|
|
|
@ -271,7 +271,7 @@ function users_list_controller()
|
||||||
User_arrived_count(),
|
User_arrived_count(),
|
||||||
User_active_count(),
|
User_active_count(),
|
||||||
User_force_active_count(),
|
User_force_active_count(),
|
||||||
ShiftEntries_freeleaded_count(),
|
ShiftEntries_freeloaded_count(),
|
||||||
User_tshirts_count(),
|
User_tshirts_count(),
|
||||||
User_got_voucher_count()
|
User_got_voucher_count()
|
||||||
)
|
)
|
||||||
|
@ -464,7 +464,10 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter)
|
||||||
if (in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) && $taken < $needed_angels_count) {
|
if (in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) && $taken < $needed_angels_count) {
|
||||||
$filtered_shifts[] = $shift;
|
$filtered_shifts[] = $shift;
|
||||||
}
|
}
|
||||||
if (in_array(ShiftsFilter::FILLED_FILLED, $shiftsFilter->getFilled()) && $taken >= $needed_angels_count) {
|
if (
|
||||||
|
in_array(ShiftsFilter::FILLED_FILLED, $shiftsFilter->getFilled())
|
||||||
|
&& $taken >= $needed_angels_count
|
||||||
|
) {
|
||||||
$filtered_shifts[] = $shift;
|
$filtered_shifts[] = $shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,10 @@ function engelsystem_email($address, $title, $message)
|
||||||
$address,
|
$address,
|
||||||
$title,
|
$title,
|
||||||
$message,
|
$message,
|
||||||
sprintf("Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>", config('no_reply_email'))
|
sprintf(
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\r\nFrom: Engelsystem <%s>",
|
||||||
|
config('no_reply_email')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
|
|
|
@ -84,6 +84,7 @@ $includeFiles = [
|
||||||
__DIR__ . '/../includes/pages/user_settings.php',
|
__DIR__ . '/../includes/pages/user_settings.php',
|
||||||
__DIR__ . '/../includes/pages/user_shifts.php',
|
__DIR__ . '/../includes/pages/user_shifts.php',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($includeFiles as $file) {
|
foreach ($includeFiles as $file) {
|
||||||
require_once realpath($file);
|
require_once realpath($file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,12 @@ function mail_shift_change($old_shift, $new_shift)
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ($user['email_shiftinfo']) {
|
if ($user['email_shiftinfo']) {
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _('Your Shift has changed'), $message, true);
|
engelsystem_email_to_user(
|
||||||
|
$user,
|
||||||
|
'[engelsystem] ' . _('Your Shift has changed'),
|
||||||
|
$message,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +116,10 @@ function mail_shift_assign($user, $shift)
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _('Assigned to Shift'), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _('Assigned to Shift'), $message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $user
|
||||||
|
* @param array $shift
|
||||||
|
*/
|
||||||
function mail_shift_removed($user, $shift)
|
function mail_shift_removed($user, $shift)
|
||||||
{
|
{
|
||||||
if (!$user['email_shiftinfo']) {
|
if (!$user['email_shiftinfo']) {
|
||||||
|
|
|
@ -26,10 +26,11 @@ function AngelType_new()
|
||||||
/**
|
/**
|
||||||
* Checks if the angeltype has any contact information.
|
* Checks if the angeltype has any contact information.
|
||||||
*
|
*
|
||||||
* @param Angeltype $angeltype
|
* @param array $angeltype Angeltype
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function AngelType_has_contact_info($angeltype) {
|
function AngelType_has_contact_info($angeltype)
|
||||||
|
{
|
||||||
return !empty($angeltype['contact_name'])
|
return !empty($angeltype['contact_name'])
|
||||||
|| !empty($angeltype['contact_dect'])
|
|| !empty($angeltype['contact_dect'])
|
||||||
|| !empty($angeltype['contact_email']);
|
|| !empty($angeltype['contact_email']);
|
||||||
|
@ -139,6 +140,7 @@ function AngelType_create($angeltype)
|
||||||
. $angeltype['contact_email'] . ', '
|
. $angeltype['contact_email'] . ', '
|
||||||
. $angeltype['show_on_dashboard']
|
. $angeltype['show_on_dashboard']
|
||||||
);
|
);
|
||||||
|
|
||||||
return $angeltype;
|
return $angeltype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +174,7 @@ function AngelType_validate_name($name, $angeltype)
|
||||||
FROM `AngelTypes`
|
FROM `AngelTypes`
|
||||||
WHERE `name`=?
|
WHERE `name`=?
|
||||||
LIMIT 1', [$name])) == 0);
|
LIMIT 1', [$name])) == 0);
|
||||||
|
|
||||||
return new ValidationResult($valid, $name);
|
return new ValidationResult($valid, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ function NeededAngelTypes_delete_by_room($room_id)
|
||||||
* @param int $room_id
|
* @param int $room_id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function NeededAngelTypes_by_room($room_id) {
|
function NeededAngelTypes_by_room($room_id)
|
||||||
|
{
|
||||||
return DB::select(
|
return DB::select(
|
||||||
'SELECT `angel_type_id`, `count` FROM `NeededAngelTypes` WHERE `room_id`=?',
|
'SELECT `angel_type_id`, `count` FROM `NeededAngelTypes` WHERE `room_id`=?',
|
||||||
[$room_id]
|
[$room_id]
|
||||||
|
@ -76,7 +77,12 @@ function NeededAngelTypes_by_room($room_id) {
|
||||||
function NeededAngelTypes_by_shift($shiftId)
|
function NeededAngelTypes_by_shift($shiftId)
|
||||||
{
|
{
|
||||||
$needed_angeltypes_source = DB::select('
|
$needed_angeltypes_source = DB::select('
|
||||||
SELECT `NeededAngelTypes`.*, `AngelTypes`.`id`, `AngelTypes`.`name`, `AngelTypes`.`restricted`, `AngelTypes`.`no_self_signup`
|
SELECT
|
||||||
|
`NeededAngelTypes`.*,
|
||||||
|
`AngelTypes`.`id`,
|
||||||
|
`AngelTypes`.`name`,
|
||||||
|
`AngelTypes`.`restricted`,
|
||||||
|
`AngelTypes`.`no_self_signup`
|
||||||
FROM `NeededAngelTypes`
|
FROM `NeededAngelTypes`
|
||||||
JOIN `AngelTypes` ON `AngelTypes`.`id` = `NeededAngelTypes`.`angel_type_id`
|
JOIN `AngelTypes` ON `AngelTypes`.`id` = `NeededAngelTypes`.`angel_type_id`
|
||||||
WHERE `shift_id` = ?
|
WHERE `shift_id` = ?
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Engelsystem\Database\DB;
|
use Engelsystem\Database\DB;
|
||||||
use Engelsystem\ValidationResult;
|
use Engelsystem\ValidationResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a name for a room.
|
* Validate a name for a room.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The new name
|
||||||
* The new name
|
* @param int $room_id The room id
|
||||||
* @param int $room_id
|
|
||||||
* The room id
|
|
||||||
* @return ValidationResult
|
* @return ValidationResult
|
||||||
*/
|
*/
|
||||||
function Room_validate_name($name, $room_id)
|
function Room_validate_name($name, $room_id)
|
||||||
|
@ -17,6 +16,7 @@ function Room_validate_name($name, $room_id)
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(DB::select('SELECT RID FROM `Room` WHERE `Name`=? AND NOT `RID`=?', [
|
if (count(DB::select('SELECT RID FROM `Room` WHERE `Name`=? AND NOT `RID`=?', [
|
||||||
$name,
|
$name,
|
||||||
$room_id
|
$room_id
|
||||||
|
@ -77,14 +77,10 @@ function Room_delete_by_name($name)
|
||||||
/**
|
/**
|
||||||
* Create a new room
|
* Create a new room
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name Name of the room
|
||||||
* Name of the room
|
* @param boolean $from_frab Is this a frab imported room?
|
||||||
* @param boolean $from_frab
|
* @param string $map_url URL to a map tha can be displayed in an iframe
|
||||||
* Is this a frab imported room?
|
* @param string description Markdown description
|
||||||
* @param string $map_url
|
|
||||||
* URL to a map tha can be displayed in an iframe
|
|
||||||
* @param
|
|
||||||
* description markdown description
|
|
||||||
* @return false|int
|
* @return false|int
|
||||||
*/
|
*/
|
||||||
function Room_create($name, $from_frab, $map_url, $description)
|
function Room_create($name, $from_frab, $map_url, $description)
|
||||||
|
@ -113,14 +109,12 @@ function Room_create($name, $from_frab, $map_url, $description)
|
||||||
/**
|
/**
|
||||||
* update a room
|
* update a room
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param int $room_id The rooms id
|
||||||
* Name of the room
|
* @param string $name Name of the room
|
||||||
* @param boolean $from_frab
|
* @param boolean $from_frab Is this a frab imported room?
|
||||||
* Is this a frab imported room?
|
* @param string $map_url URL to a map tha can be displayed in an iframe
|
||||||
* @param string $map_url
|
* @param string $description Markdown description
|
||||||
* URL to a map tha can be displayed in an iframe
|
* @return int
|
||||||
* @param
|
|
||||||
* description markdown description
|
|
||||||
*/
|
*/
|
||||||
function Room_update($room_id, $name, $from_frab, $map_url, $description)
|
function Room_update($room_id, $name, $from_frab, $map_url, $description)
|
||||||
{
|
{
|
||||||
|
@ -153,9 +147,7 @@ function Room_update($room_id, $name, $from_frab, $map_url, $description)
|
||||||
/**
|
/**
|
||||||
* Returns room by id.
|
* Returns room by id.
|
||||||
*
|
*
|
||||||
* @param int $room_id
|
* @param int $room_id RID
|
||||||
* RID
|
|
||||||
* @param bool $onlyVisible
|
|
||||||
* @return array|false
|
* @return array|false
|
||||||
*/
|
*/
|
||||||
function Room($room_id)
|
function Room($room_id)
|
||||||
|
|
|
@ -26,7 +26,7 @@ function ShiftEntry_new()
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_freeleaded_count()
|
function ShiftEntries_freeloaded_count()
|
||||||
{
|
{
|
||||||
$result = DB::selectOne('SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1');
|
$result = DB::selectOne('SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1');
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function ShiftEntries_freeleaded_count()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List users subsribed to a given shift.
|
* List users subscribed to a given shift.
|
||||||
*
|
*
|
||||||
* @param int $shift_id
|
* @param int $shift_id
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -103,6 +103,7 @@ function ShiftEntry_create($shift_entry)
|
||||||
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||||
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||||
);
|
);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,7 @@ class ShiftSignupState
|
||||||
/**
|
/**
|
||||||
* Combine this state with another state from the same shift.
|
* Combine this state with another state from the same shift.
|
||||||
*
|
*
|
||||||
* @param ShiftSignupState $shiftSignupState
|
* @param ShiftSignupState $shiftSignupState The other state to combine
|
||||||
* The other state to combine
|
|
||||||
*/
|
*/
|
||||||
public function combineWith(ShiftSignupState $shiftSignupState)
|
public function combineWith(ShiftSignupState $shiftSignupState)
|
||||||
{
|
{
|
||||||
|
@ -122,6 +121,7 @@ class ShiftSignupState
|
||||||
case ShiftSignupState::ADMIN:
|
case ShiftSignupState::ADMIN:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ function ShiftType($shifttype_id)
|
||||||
/**
|
/**
|
||||||
* Get all shift types.
|
* Get all shift types.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function ShiftTypes()
|
function ShiftTypes()
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,6 @@ class ShiftsFilter
|
||||||
*/
|
*/
|
||||||
public function __construct($user_shifts_admin, $rooms, $types)
|
public function __construct($user_shifts_admin, $rooms, $types)
|
||||||
{
|
{
|
||||||
$this->user_shifts_admin = $user_shifts_admin;
|
|
||||||
$this->rooms = $rooms;
|
$this->rooms = $rooms;
|
||||||
$this->types = $types;
|
$this->types = $types;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ use Engelsystem\ShiftSignupState;
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function Shifts_by_angeltype($angeltype) {
|
function Shifts_by_angeltype($angeltype)
|
||||||
|
{
|
||||||
return DB::select('
|
return DB::select('
|
||||||
SELECT DISTINCT `Shifts`.* FROM `Shifts`
|
SELECT DISTINCT `Shifts`.* FROM `Shifts`
|
||||||
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
|
||||||
|
@ -28,6 +29,10 @@ function Shifts_by_angeltype($angeltype) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns every shift with needed angels in the given time range.
|
* Returns every shift with needed angels in the given time range.
|
||||||
|
*
|
||||||
|
* @param int $start timestamp
|
||||||
|
* @param int $end timestamp
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function Shifts_free($start, $end)
|
function Shifts_free($start, $end)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +53,7 @@ function Shifts_free($start, $end)
|
||||||
AND (SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
AND (SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
||||||
> (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
> (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
AND NOT `Shifts`.`PSID` IS NULL
|
AND NOT `Shifts`.`PSID` IS NULL
|
||||||
) as `tmp`
|
) AS `tmp`
|
||||||
ORDER BY `tmp`.`start`
|
ORDER BY `tmp`.`start`
|
||||||
", [
|
", [
|
||||||
$start,
|
$start,
|
||||||
|
@ -65,14 +70,17 @@ function Shifts_free($start, $end)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all shifts with a PSID (from frab import)
|
* Returns all shifts with a PSID (from frab import)
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function Shifts_from_frab() {
|
function Shifts_from_frab()
|
||||||
|
{
|
||||||
return DB::select('SELECT * FROM `Shifts` WHERE `PSID` IS NOT NULL ORDER BY `start`');
|
return DB::select('SELECT * FROM `Shifts` WHERE `PSID` IS NOT NULL ORDER BY `start`');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $room
|
* @param array $room
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function Shifts_by_room($room)
|
function Shifts_by_room($room)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +228,7 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ShiftsFilter $shiftsFilter
|
* @param ShiftsFilter $shiftsFilter
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
{
|
{
|
||||||
|
@ -405,13 +413,13 @@ function Shift_signup_allowed_admin($needed_angeltype, $shift_entries)
|
||||||
/**
|
/**
|
||||||
* Check if an angel can signout from a shift.
|
* Check if an angel can signout from a shift.
|
||||||
*
|
*
|
||||||
* @param $shift The shift
|
* @param array $shift The shift
|
||||||
* @param $angeltype The angeltype
|
* @param array $angeltype The angeltype
|
||||||
* @param $signout_user The user that was signed up for the shift
|
* @param array $signout_user The user that was signed up for the shift
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function Shift_signout_allowed($shift, $angeltype, $signout_user) {
|
function Shift_signout_allowed($shift, $angeltype, $signout_user)
|
||||||
|
{
|
||||||
global $user, $privileges;
|
global $user, $privileges;
|
||||||
|
|
||||||
// user shifts admin can sign out any user at any time
|
// user shifts admin can sign out any user at any time
|
||||||
|
@ -496,9 +504,8 @@ function Shift_delete_by_psid($shift_psid)
|
||||||
*/
|
*/
|
||||||
function Shift_delete($shift_id)
|
function Shift_delete($shift_id)
|
||||||
{
|
{
|
||||||
mail_shift_delete(Shift($shift_id));
|
|
||||||
|
|
||||||
DB::delete('DELETE FROM `Shifts` WHERE `SID`=?', [$shift_id]);
|
DB::delete('DELETE FROM `Shifts` WHERE `SID`=?', [$shift_id]);
|
||||||
|
mail_shift_delete(Shift($shift_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -606,15 +613,23 @@ function Shift_create($shift)
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @param bool $include_freeload_comments
|
* @param bool $include_freeload_comments
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function Shifts_by_user($user, $include_freeload_comments = false)
|
function Shifts_by_user($user, $include_freeload_comments = false)
|
||||||
{
|
{
|
||||||
return DB::select('
|
return DB::select('
|
||||||
SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`,
|
SELECT
|
||||||
`ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`,
|
`ShiftTypes`.`id` AS `shifttype_id`,
|
||||||
|
`ShiftTypes`.`name`,
|
||||||
|
`ShiftEntry`.`id`,
|
||||||
|
`ShiftEntry`.`SID`,
|
||||||
|
`ShiftEntry`.`TID`,
|
||||||
|
`ShiftEntry`.`UID`,
|
||||||
|
`ShiftEntry`.`freeloaded`,
|
||||||
|
`ShiftEntry`.`Comment`,
|
||||||
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
|
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
|
||||||
`Shifts`.*, `Room`.*
|
`Shifts`.*,
|
||||||
|
`Room`.*
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
||||||
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
||||||
|
|
|
@ -1,36 +1,43 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Engelsystem\Database\Db;
|
use Engelsystem\Database\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of angels currently working.
|
* Returns the number of angels currently working.
|
||||||
|
*
|
||||||
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
function stats_currently_working()
|
function stats_currently_working()
|
||||||
{
|
{
|
||||||
$result = Db::selectOne("
|
$result = Db::selectOne("
|
||||||
SELECT SUM(
|
SELECT SUM(
|
||||||
(SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
(SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
) as `count`
|
) AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE (`end` >= ? AND `start` <= ?)", [
|
WHERE (`end` >= ? AND `start` <= ?)", [
|
||||||
time(),
|
time(),
|
||||||
time()
|
time()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($result['count'])) {
|
if (empty($result['count'])) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result['count'];
|
return $result['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of hours still to work.
|
* Return the number of hours still to work.
|
||||||
|
*
|
||||||
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
function stats_hours_to_work()
|
function stats_hours_to_work()
|
||||||
{
|
{
|
||||||
$result = Db::selectOne("
|
$result = Db::selectOne("
|
||||||
SELECT ROUND(SUM(`count`)) as `count` FROM (
|
SELECT ROUND(SUM(`count`)) AS `count` FROM (
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
||||||
* (`Shifts`.`end` - `Shifts`.`start`)/3600 as `count`
|
* (`Shifts`.`end` - `Shifts`.`start`)/3600 AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` >= ?
|
WHERE `end` >= ?
|
||||||
AND `Shifts`.`PSID` IS NULL
|
AND `Shifts`.`PSID` IS NULL
|
||||||
|
@ -39,11 +46,11 @@ function stats_hours_to_work()
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
||||||
* (`Shifts`.`end` - `Shifts`.`start`)/3600 as `count`
|
* (`Shifts`.`end` - `Shifts`.`start`)/3600 AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` >= ?
|
WHERE `end` >= ?
|
||||||
AND NOT `Shifts`.`PSID` IS NULL
|
AND NOT `Shifts`.`PSID` IS NULL
|
||||||
) as `tmp`
|
) AS `tmp`
|
||||||
", [
|
", [
|
||||||
time(),
|
time(),
|
||||||
time()
|
time()
|
||||||
|
@ -56,17 +63,19 @@ function stats_hours_to_work()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of needed angels in the next 3 hours
|
* Returns the number of needed angels in the next 3 hours
|
||||||
|
*
|
||||||
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
function stats_angels_needed_three_hours()
|
function stats_angels_needed_three_hours()
|
||||||
{
|
{
|
||||||
$now = time();
|
$now = time();
|
||||||
$in3hours = $now + 3 * 60 * 60;
|
$in3hours = $now + 3 * 60 * 60;
|
||||||
$result = Db::selectOne("
|
$result = Db::selectOne("
|
||||||
SELECT SUM(`count`) as `count` FROM (
|
SELECT SUM(`count`) AS `count` FROM (
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
||||||
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
as `count`
|
AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` > ? AND `start` < ?
|
WHERE `end` > ? AND `start` < ?
|
||||||
AND `Shifts`.`PSID` IS NULL
|
AND `Shifts`.`PSID` IS NULL
|
||||||
|
@ -76,11 +85,11 @@ function stats_angels_needed_three_hours()
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
||||||
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
as `count`
|
AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` > ? AND `start` < ?
|
WHERE `end` > ? AND `start` < ?
|
||||||
AND NOT `Shifts`.`PSID` IS NULL
|
AND NOT `Shifts`.`PSID` IS NULL
|
||||||
) as `tmp`", [
|
) AS `tmp`", [
|
||||||
$now,
|
$now,
|
||||||
$in3hours,
|
$in3hours,
|
||||||
$now,
|
$now,
|
||||||
|
@ -94,17 +103,22 @@ function stats_angels_needed_three_hours()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of needed angels for nightshifts (between 2 and 8)
|
* Returns the number of needed angels for nightshifts (between 2 and 8)
|
||||||
|
*
|
||||||
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
function stats_angels_needed_for_nightshifts()
|
function stats_angels_needed_for_nightshifts()
|
||||||
{
|
{
|
||||||
$night_start = parse_date('Y-m-d H:i', date('Y-m-d', time() + 12 * 60 * 60) . ' 02:00');
|
$night_start = parse_date(
|
||||||
|
'Y-m-d H:i',
|
||||||
|
date('Y-m-d', time() + 12 * 60 * 60) . ' 02:00'
|
||||||
|
);
|
||||||
$night_end = $night_start + 6 * 60 * 60;
|
$night_end = $night_start + 6 * 60 * 60;
|
||||||
$result = Db::selectOne("
|
$result = Db::selectOne("
|
||||||
SELECT SUM(`count`) as `count` FROM (
|
SELECT SUM(`count`) AS `count` FROM (
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
|
||||||
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
as `count`
|
AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` > ? AND `start` < ?
|
WHERE `end` > ? AND `start` < ?
|
||||||
AND `Shifts`.`PSID` IS NULL
|
AND `Shifts`.`PSID` IS NULL
|
||||||
|
@ -114,11 +128,11 @@ function stats_angels_needed_for_nightshifts()
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
|
||||||
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
- (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
|
||||||
as `count`
|
AS `count`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
WHERE `end` > ? AND `start` < ?
|
WHERE `end` > ? AND `start` < ?
|
||||||
AND NOT `Shifts`.`PSID` IS NULL
|
AND NOT `Shifts`.`PSID` IS NULL
|
||||||
) as `tmp`", [
|
) AS `tmp`", [
|
||||||
$night_start,
|
$night_start,
|
||||||
$night_end,
|
$night_end,
|
||||||
$night_start,
|
$night_start,
|
||||||
|
@ -129,5 +143,3 @@ function stats_angels_needed_for_nightshifts()
|
||||||
}
|
}
|
||||||
return $result['count'];
|
return $result['count'];
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
|
@ -27,7 +27,7 @@ function UserAngelType_exists($user, $angeltype)
|
||||||
* List users angeltypes.
|
* List users angeltypes.
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function User_angeltypes($user)
|
function User_angeltypes($user)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ function User_angeltypes($user)
|
||||||
* Gets unconfirmed user angeltypes for angeltypes of which the given user is a supporter.
|
* Gets unconfirmed user angeltypes for angeltypes of which the given user is a supporter.
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function User_unconfirmed_AngelTypes($user)
|
function User_unconfirmed_AngelTypes($user)
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,7 @@ function User_is_AngelType_supporter(&$user, $angeltype)
|
||||||
if (!isset($user['privileges'])) {
|
if (!isset($user['privileges'])) {
|
||||||
$user['privileges'] = privileges_for_user($user['UID']);
|
$user['privileges'] = privileges_for_user($user['UID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (count(DB::select('
|
return (count(DB::select('
|
||||||
SELECT `id`
|
SELECT `id`
|
||||||
FROM `UserAngelTypes`
|
FROM `UserAngelTypes`
|
||||||
|
@ -143,7 +144,6 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user)
|
||||||
*
|
*
|
||||||
* @param int $user_angeltype_id
|
* @param int $user_angeltype_id
|
||||||
* @param array $confirm_user
|
* @param array $confirm_user
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
function UserAngelType_confirm($user_angeltype_id, $confirm_user)
|
function UserAngelType_confirm($user_angeltype_id, $confirm_user)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Engelsystem\Database\DB;
|
||||||
* Returns users groups
|
* Returns users groups
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function User_groups($user)
|
function User_groups($user)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,7 +209,7 @@ function User_is_freeloader($user)
|
||||||
* Returns all users that are not member of given angeltype.
|
* Returns all users that are not member of given angeltype.
|
||||||
*
|
*
|
||||||
* @param array $angeltype Angeltype
|
* @param array $angeltype Angeltype
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function Users_by_angeltype_inverted($angeltype)
|
function Users_by_angeltype_inverted($angeltype)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ function Users_by_angeltype_inverted($angeltype)
|
||||||
* Returns all members of given angeltype.
|
* Returns all members of given angeltype.
|
||||||
*
|
*
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function Users_by_angeltype($angeltype)
|
function Users_by_angeltype($angeltype)
|
||||||
{
|
{
|
||||||
|
@ -258,7 +258,7 @@ function Users_by_angeltype($angeltype)
|
||||||
/**
|
/**
|
||||||
* Returns User id array
|
* Returns User id array
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
function User_ids()
|
function User_ids()
|
||||||
{
|
{
|
||||||
|
@ -268,6 +268,7 @@ function User_ids()
|
||||||
/**
|
/**
|
||||||
* Strip unwanted characters from a users nick. Allowed are letters, numbers, connecting punctuation and simple space.
|
* Strip unwanted characters from a users nick. Allowed are letters, numbers, connecting punctuation and simple space.
|
||||||
* Nick is trimmed.
|
* Nick is trimmed.
|
||||||
|
*
|
||||||
* @param string $nick
|
* @param string $nick
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -279,8 +280,7 @@ function User_validate_Nick($nick)
|
||||||
/**
|
/**
|
||||||
* Validate user email address.
|
* Validate user email address.
|
||||||
*
|
*
|
||||||
* @param string $mail
|
* @param string $mail The email address to validate
|
||||||
* The email address to validate
|
|
||||||
* @return ValidationResult
|
* @return ValidationResult
|
||||||
*/
|
*/
|
||||||
function User_validate_mail($mail)
|
function User_validate_mail($mail)
|
||||||
|
@ -292,8 +292,7 @@ function User_validate_mail($mail)
|
||||||
/**
|
/**
|
||||||
* Validate user jabber address
|
* Validate user jabber address
|
||||||
*
|
*
|
||||||
* @param string $jabber
|
* @param string $jabber Jabber-ID to validate
|
||||||
* Jabber-ID to validate
|
|
||||||
* @return ValidationResult
|
* @return ValidationResult
|
||||||
*/
|
*/
|
||||||
function User_validate_jabber($jabber)
|
function User_validate_jabber($jabber)
|
||||||
|
@ -337,10 +336,8 @@ function User_validate_planned_arrival_date($planned_arrival_date)
|
||||||
/**
|
/**
|
||||||
* Validate the planned departure date
|
* Validate the planned departure date
|
||||||
*
|
*
|
||||||
* @param int $planned_arrival_date
|
* @param int $planned_arrival_date Unix timestamp
|
||||||
* Unix timestamp
|
* @param int $planned_departure_date Unix timestamp
|
||||||
* @param int $planned_departure_date
|
|
||||||
* Unix timestamp
|
|
||||||
* @return ValidationResult
|
* @return ValidationResult
|
||||||
*/
|
*/
|
||||||
function User_validate_planned_departure_date($planned_arrival_date, $planned_departure_date)
|
function User_validate_planned_departure_date($planned_arrival_date, $planned_departure_date)
|
||||||
|
@ -383,8 +380,7 @@ function User($user_id)
|
||||||
/**
|
/**
|
||||||
* Returns User by api_key.
|
* Returns User by api_key.
|
||||||
*
|
*
|
||||||
* @param string $api_key
|
* @param string $api_key User api key
|
||||||
* User api key
|
|
||||||
* @return array|null Matching user, null if not found
|
* @return array|null Matching user, null if not found
|
||||||
*/
|
*/
|
||||||
function User_by_api_key($api_key)
|
function User_by_api_key($api_key)
|
||||||
|
@ -396,7 +392,7 @@ function User_by_api_key($api_key)
|
||||||
* Returns User by email.
|
* Returns User by email.
|
||||||
*
|
*
|
||||||
* @param string $email
|
* @param string $email
|
||||||
* @return array|null Matching user, null or false on error
|
* @return array|null Matching user, null on error
|
||||||
*/
|
*/
|
||||||
function User_by_email($email)
|
function User_by_email($email)
|
||||||
{
|
{
|
||||||
|
@ -460,7 +456,9 @@ function User_generate_password_recovery_token(&$user)
|
||||||
$user['UID'],
|
$user['UID'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
engelsystem_log('Password recovery for ' . User_Nick_render($user) . ' started.');
|
engelsystem_log('Password recovery for ' . User_Nick_render($user) . ' started.');
|
||||||
|
|
||||||
return $user['password_recovery_token'];
|
return $user['password_recovery_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,10 +472,10 @@ function User_get_eligable_voucher_count(&$user)
|
||||||
$shifts_done = count(ShiftEntries_finished_by_user($user));
|
$shifts_done = count(ShiftEntries_finished_by_user($user));
|
||||||
|
|
||||||
$earned_vouchers = $user['got_voucher'] - $voucher_settings['initial_vouchers'];
|
$earned_vouchers = $user['got_voucher'] - $voucher_settings['initial_vouchers'];
|
||||||
$elegible_vouchers = $shifts_done / $voucher_settings['shifts_per_voucher'] - $earned_vouchers;
|
$eligable_vouchers = $shifts_done / $voucher_settings['shifts_per_voucher'] - $earned_vouchers;
|
||||||
if ($elegible_vouchers < 0) {
|
if ($eligable_vouchers < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $elegible_vouchers;
|
return $eligable_vouchers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,8 @@ function admin_active()
|
||||||
}
|
}
|
||||||
$usr['nick'] = User_Nick_render($usr);
|
$usr['nick'] = User_Nick_render($usr);
|
||||||
$usr['shirt_size'] = $tshirt_sizes[$usr['Size']];
|
$usr['shirt_size'] = $tshirt_sizes[$usr['Size']];
|
||||||
$usr['work_time'] = round($usr['shift_length'] / 60) . ' min (' . round($usr['shift_length'] / 3600) . ' h)';
|
$usr['work_time'] = round($usr['shift_length'] / 60)
|
||||||
|
. ' min (' . round($usr['shift_length'] / 3600) . ' h)';
|
||||||
$usr['active'] = glyph_bool($usr['Aktiv'] == 1);
|
$usr['active'] = glyph_bool($usr['Aktiv'] == 1);
|
||||||
$usr['force_active'] = glyph_bool($usr['force_active'] == 1);
|
$usr['force_active'] = glyph_bool($usr['force_active'] == 1);
|
||||||
$usr['tshirt'] = glyph_bool($usr['Tshirt'] == 1);
|
$usr['tshirt'] = glyph_bool($usr['Tshirt'] == 1);
|
||||||
|
|
|
@ -85,7 +85,11 @@ function admin_groups()
|
||||||
'privilege-' . $privilege['name']
|
'privilege-' . $privilege['name']
|
||||||
);
|
);
|
||||||
$privileges_html .= sprintf(
|
$privileges_html .= sprintf(
|
||||||
'<tr><td><input type="checkbox" name="privileges[]" value="%s" %s /></td> <td>%s</td> <td>%s</td></tr>',
|
'<tr>'
|
||||||
|
. '<td><input type="checkbox" name="privileges[]" value="%s" %s /></td>'
|
||||||
|
. '<td>%s</td>'
|
||||||
|
. '<td>%s</td>'
|
||||||
|
. '</tr>',
|
||||||
$privilege['id'],
|
$privilege['id'],
|
||||||
($privilege['group_id'] != '' ? 'checked="checked"' : ''),
|
($privilege['group_id'] != '' ? 'checked="checked"' : ''),
|
||||||
$privilege['name'],
|
$privilege['name'],
|
||||||
|
|
|
@ -63,8 +63,9 @@ function admin_import()
|
||||||
error(_('Please select a shift type.'));
|
error(_('Please select a shift type.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) {
|
$minutes_start = trim($request->input('add_minutes_start'));
|
||||||
$add_minutes_start = trim($request->input('add_minutes_start'));
|
if ($request->has('add_minutes_start') && is_numeric($minutes_start)) {
|
||||||
|
$add_minutes_start = $minutes_start;
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_('Please enter an amount of minutes to add to a talk\'s begin.'));
|
error(_('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||||
|
@ -106,7 +107,11 @@ function admin_import()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$html .= div('well well-sm text-center', [
|
$html .= div('well well-sm text-center', [
|
||||||
_('File Upload') . mute(glyph('arrow-right')) . mute(_('Validation')) . mute(glyph('arrow-right')) . mute(_('Import'))
|
_('File Upload')
|
||||||
|
. mute(glyph('arrow-right'))
|
||||||
|
. mute(_('Validation'))
|
||||||
|
. mute(glyph('arrow-right'))
|
||||||
|
. mute(_('Import'))
|
||||||
]) . div('row', [
|
]) . div('row', [
|
||||||
div('col-md-offset-3 col-md-6', [
|
div('col-md-offset-3 col-md-6', [
|
||||||
form([
|
form([
|
||||||
|
@ -164,7 +169,10 @@ function admin_import()
|
||||||
'well well-sm text-center',
|
'well well-sm text-center',
|
||||||
[
|
[
|
||||||
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>'
|
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>'
|
||||||
. mute(glyph('arrow-right')) . _('Validation') . mute(glyph('arrow-right')) . mute(_('Import'))
|
. mute(glyph('arrow-right'))
|
||||||
|
. _('Validation')
|
||||||
|
. mute(glyph('arrow-right'))
|
||||||
|
. mute(_('Import'))
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
. form(
|
. form(
|
||||||
|
|
|
@ -24,7 +24,9 @@ function admin_new_questions()
|
||||||
$new_messages = count(DB::select('SELECT `QID` FROM `Questions` WHERE `AID` IS NULL'));
|
$new_messages = count(DB::select('SELECT `QID` FROM `Questions` WHERE `AID` IS NULL'));
|
||||||
|
|
||||||
if ($new_messages > 0) {
|
if ($new_messages > 0) {
|
||||||
return '<a href="' . page_link_to('admin_questions') . '">' . _('There are unanswered questions!') . '</a>';
|
return '<a href="' . page_link_to('admin_questions') . '">'
|
||||||
|
. _('There are unanswered questions!')
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,21 @@ function admin_rooms()
|
||||||
'from_frab' => glyph_bool($room['from_frab']),
|
'from_frab' => glyph_bool($room['from_frab']),
|
||||||
'map_url' => glyph_bool(!empty($room['map_url'])),
|
'map_url' => glyph_bool(!empty($room['map_url'])),
|
||||||
'actions' => table_buttons([
|
'actions' => table_buttons([
|
||||||
button(page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]), _('edit'), 'btn-xs'),
|
button(
|
||||||
button(page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]), _('delete'), 'btn-xs')
|
page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]),
|
||||||
|
_('edit'),
|
||||||
|
'btn-xs'
|
||||||
|
),
|
||||||
|
button(
|
||||||
|
page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]),
|
||||||
|
_('delete'),
|
||||||
|
'btn-xs'
|
||||||
|
)
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$room = null;
|
|
||||||
|
|
||||||
|
$room = null;
|
||||||
if ($request->has('show')) {
|
if ($request->has('show')) {
|
||||||
$msg = '';
|
$msg = '';
|
||||||
$name = '';
|
$name = '';
|
||||||
|
@ -101,7 +109,10 @@ function admin_rooms()
|
||||||
$angeltypes_count[$angeltype_id] = $request->input($queryKey);
|
$angeltypes_count[$angeltype_id] = $request->input($queryKey);
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(_('Please enter needed angels for type %s.'), $angeltype), true);
|
$msg .= error(sprintf(
|
||||||
|
_('Please enter needed angels for type %s.'),
|
||||||
|
$angeltype
|
||||||
|
), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,10 +113,16 @@ function admin_shifts()
|
||||||
} elseif ($request->input('mode') == 'variable') {
|
} elseif ($request->input('mode') == 'variable') {
|
||||||
if (
|
if (
|
||||||
$request->has('change_hours')
|
$request->has('change_hours')
|
||||||
&& preg_match('/^(\d{2}(,|$))/', trim(str_replace(' ', '', $request->input('change_hours'))))
|
&& preg_match(
|
||||||
|
'/^(\d{2}(,|$))/',
|
||||||
|
trim(str_replace(' ', '', $request->input('change_hours')))
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$mode = 'variable';
|
$mode = 'variable';
|
||||||
$change_hours = array_map('trim', explode(',', $request->input('change_hours')));
|
$change_hours = array_map(
|
||||||
|
'trim',
|
||||||
|
explode(',', $request->input('change_hours'))
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_('Please split the shift-change hours by colons.'));
|
error(_('Please split the shift-change hours by colons.'));
|
||||||
|
@ -264,7 +270,8 @@ function admin_shifts()
|
||||||
];
|
];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
if (isset($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0) {
|
if (isset($needed_angel_types[$type['id']]) && $needed_angel_types[$type['id']] > 0) {
|
||||||
$shifts_table_entry['needed_angels'] .= '<b>' . AngelType_name_render($type) . ':</b> ' . $needed_angel_types[$type['id']] . '<br />';
|
$shifts_table_entry['needed_angels'] .= '<b>' . AngelType_name_render($type) . ':</b> '
|
||||||
|
. $needed_angel_types[$type['id']] . '<br />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$shifts_table[] = $shifts_table_entry;
|
$shifts_table[] = $shifts_table_entry;
|
||||||
|
@ -327,6 +334,7 @@ function admin_shifts()
|
||||||
FROM `AngelTypes`
|
FROM `AngelTypes`
|
||||||
WHERE `id` = ?
|
WHERE `id` = ?
|
||||||
LIMIT 1', [$type_id]);
|
LIMIT 1', [$type_id]);
|
||||||
|
|
||||||
if (!empty($angel_type_source)) {
|
if (!empty($angel_type_source)) {
|
||||||
DB::insert('
|
DB::insert('
|
||||||
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
|
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
|
||||||
|
@ -338,6 +346,7 @@ function admin_shifts()
|
||||||
$count
|
$count
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$needed_angel_types_info[] = $angel_type_source['name'] . ': ' . $count;
|
$needed_angel_types_info[] = $angel_type_source['name'] . ': ' . $count;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +389,13 @@ function admin_shifts()
|
||||||
form_info(_('Mode'), ''),
|
form_info(_('Mode'), ''),
|
||||||
form_radio('mode', _('Create one shift'), $mode == 'single', 'single'),
|
form_radio('mode', _('Create one shift'), $mode == 'single', 'single'),
|
||||||
form_radio('mode', _('Create multiple shifts'), $mode == 'multi', 'multi'),
|
form_radio('mode', _('Create multiple shifts'), $mode == 'multi', 'multi'),
|
||||||
form_text('length', _('Length'), $request->has('length') ? $request->input('length') : '120'),
|
form_text(
|
||||||
|
'length',
|
||||||
|
_('Length'),
|
||||||
|
$request->has('length')
|
||||||
|
? $request->input('length')
|
||||||
|
: '120'
|
||||||
|
),
|
||||||
form_radio(
|
form_radio(
|
||||||
'mode',
|
'mode',
|
||||||
_('Create multiple shifts with variable length'),
|
_('Create multiple shifts with variable length'),
|
||||||
|
@ -390,7 +405,9 @@ function admin_shifts()
|
||||||
form_text(
|
form_text(
|
||||||
'change_hours',
|
'change_hours',
|
||||||
_('Shift change hours'),
|
_('Shift change hours'),
|
||||||
$request->has('change_hours') ? $request->input('input') : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'
|
$request->has('change_hours')
|
||||||
|
? $request->input('input')
|
||||||
|
: '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
|
@ -401,7 +418,12 @@ function admin_shifts()
|
||||||
$angelmode == 'location',
|
$angelmode == 'location',
|
||||||
'location'
|
'location'
|
||||||
),
|
),
|
||||||
form_radio('angelmode', _('The following angels are needed'), $angelmode == 'manually', 'manually'),
|
form_radio(
|
||||||
|
'angelmode',
|
||||||
|
_('The following angels are needed'),
|
||||||
|
$angelmode == 'manually',
|
||||||
|
'manually'
|
||||||
|
),
|
||||||
div('row', [
|
div('row', [
|
||||||
$angel_types
|
$angel_types
|
||||||
])
|
])
|
||||||
|
|
|
@ -235,7 +235,8 @@ function admin_user()
|
||||||
}
|
}
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
'Set groups of ' . User_Nick_render($user_source) . ' to: ' . join(', ', $user_groups_info)
|
'Set groups of ' . User_Nick_render($user_source) . ' to: '
|
||||||
|
. join(', ', $user_groups_info)
|
||||||
);
|
);
|
||||||
$html .= success('Benutzergruppen gespeichert.', true);
|
$html .= success('Benutzergruppen gespeichert.', true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,7 +262,9 @@ function admin_user()
|
||||||
`Handy` = ?,
|
`Handy` = ?,
|
||||||
`Alter` =?,
|
`Alter` =?,
|
||||||
`DECT` = ?,
|
`DECT` = ?,
|
||||||
' . ($user_source['email_by_human_allowed'] ? '`email` = ' . DB::getPdo()->quote($request->postData('eemail')) . ',' : '') . '
|
' . ($user_source['email_by_human_allowed']
|
||||||
|
? '`email` = ' . DB::getPdo()->quote($request->postData('eemail')) . ','
|
||||||
|
: '') . '
|
||||||
`jabber` = ?,
|
`jabber` = ?,
|
||||||
`Size` = ?,
|
`Size` = ?,
|
||||||
`Gekommen`= ?,
|
`Gekommen`= ?,
|
||||||
|
@ -298,13 +301,19 @@ function admin_user()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'change_pw':
|
case 'change_pw':
|
||||||
if ($request->postData('new_pw') != '' && $request->postData('new_pw') == $request->postData('new_pw2')) {
|
if (
|
||||||
|
$request->postData('new_pw') != ''
|
||||||
|
&& $request->postData('new_pw') == $request->postData('new_pw2')
|
||||||
|
) {
|
||||||
set_password($user_id, $request->postData('new_pw'));
|
set_password($user_id, $request->postData('new_pw'));
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log('Set new password for ' . User_Nick_render($user_source));
|
engelsystem_log('Set new password for ' . User_Nick_render($user_source));
|
||||||
$html .= success('Passwort neu gesetzt.', true);
|
$html .= success('Passwort neu gesetzt.', true);
|
||||||
} else {
|
} else {
|
||||||
$html .= error('Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!', true);
|
$html .= error(
|
||||||
|
'Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,7 +392,6 @@ function guest_register()
|
||||||
form_info(entry_required() . ' = ' . _('Entry required!'))
|
form_info(entry_required() . ' = ' . _('Entry required!'))
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
// form_textarea('comment', _('Did you help at former CCC events and which tasks have you performed then?'), $comment),
|
|
||||||
form_submit('submit', _('Register'))
|
form_submit('submit', _('Register'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -14,7 +14,11 @@ function guest_stats()
|
||||||
list($user_count) = DB::select('SELECT count(*) AS `user_count` FROM `User`');
|
list($user_count) = DB::select('SELECT count(*) AS `user_count` FROM `User`');
|
||||||
$stats['user_count'] = $user_count['user_count'];
|
$stats['user_count'] = $user_count['user_count'];
|
||||||
|
|
||||||
list($arrived_user_count) = DB::select('SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1');
|
list($arrived_user_count) = DB::select('
|
||||||
|
SELECT count(*) AS `user_count`
|
||||||
|
FROM `User`
|
||||||
|
WHERE `Gekommen`=1
|
||||||
|
');
|
||||||
$stats['arrived_user_count'] = $arrived_user_count['user_count'];
|
$stats['arrived_user_count'] = $arrived_user_count['user_count'];
|
||||||
|
|
||||||
$done_shifts_seconds = DB::selectOne('
|
$done_shifts_seconds = DB::selectOne('
|
||||||
|
|
|
@ -63,13 +63,21 @@ function make_atom_entries_from_news($news_entries)
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $news_entry
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function make_atom_entry_from_news($news_entry)
|
function make_atom_entry_from_news($news_entry)
|
||||||
{
|
{
|
||||||
return '
|
return '
|
||||||
<entry>
|
<entry>
|
||||||
<title>' . htmlspecialchars($news_entry['Betreff']) . '</title>
|
<title>' . htmlspecialchars($news_entry['Betreff']) . '</title>
|
||||||
<link href="' . page_link_to('news_comments', ['nid' => $news_entry['ID']]) . '"/>
|
<link href="' . page_link_to('news_comments', ['nid' => $news_entry['ID']]) . '"/>
|
||||||
<id>' . preg_replace('#^https?://#', '', page_link_to('news_comments', ['nid' => $news_entry['ID']])) . '</id>
|
<id>' . preg_replace(
|
||||||
|
'#^https?://#',
|
||||||
|
'',
|
||||||
|
page_link_to('news_comments', ['nid' => $news_entry['ID']])
|
||||||
|
) . '</id>
|
||||||
<updated>' . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . '</updated>
|
<updated>' . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . '</updated>
|
||||||
<summary>' . htmlspecialchars($news_entry['Text']) . '</summary>
|
<summary>' . htmlspecialchars($news_entry['Text']) . '</summary>
|
||||||
</entry>' . "\n";
|
</entry>' . "\n";
|
||||||
|
|
|
@ -30,7 +30,7 @@ function user_ical()
|
||||||
/**
|
/**
|
||||||
* Renders an ical calendar from given shifts array.
|
* Renders an ical calendar from given shifts array.
|
||||||
*
|
*
|
||||||
* @param array <Shift> $shifts
|
* @param array $shifts Shift
|
||||||
*/
|
*/
|
||||||
function send_ical_from_shifts($shifts)
|
function send_ical_from_shifts($shifts)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,8 @@ function user_meetings()
|
||||||
* @param array $news
|
* @param array $news
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function news_text($news) {
|
function news_text($news)
|
||||||
|
{
|
||||||
$text = ReplaceSmilies($news['Text']);
|
$text = ReplaceSmilies($news['Text']);
|
||||||
$text = preg_replace("/\r\n\r\n/m", '<br><br>', $text);
|
$text = preg_replace("/\r\n\r\n/m", '<br><br>', $text);
|
||||||
return $text;
|
return $text;
|
||||||
|
@ -101,7 +102,11 @@ function display_news($news)
|
||||||
$html .= '<div class="panel-footer text-muted">';
|
$html .= '<div class="panel-footer text-muted">';
|
||||||
if (in_array('admin_news', $privileges)) {
|
if (in_array('admin_news', $privileges)) {
|
||||||
$html .= '<div class="pull-right">'
|
$html .= '<div class="pull-right">'
|
||||||
. button_glyph(page_link_to('admin_news', ['action' => 'edit', 'id' => $news['ID']]), 'edit', 'btn-xs')
|
. button_glyph(
|
||||||
|
page_link_to('admin_news', ['action' => 'edit', 'id' => $news['ID']]),
|
||||||
|
'edit',
|
||||||
|
'btn-xs'
|
||||||
|
)
|
||||||
. '</div>';
|
. '</div>';
|
||||||
}
|
}
|
||||||
$html .= '<span class="glyphicon glyphicon-time"></span> ' . date('Y-m-d H:i', $news['Datum']) . ' ';
|
$html .= '<span class="glyphicon glyphicon-time"></span> ' . date('Y-m-d H:i', $news['Datum']) . ' ';
|
||||||
|
@ -140,7 +145,11 @@ function user_news_comments()
|
||||||
$nid = $request->input('nid');
|
$nid = $request->input('nid');
|
||||||
$news = DB::selectOne('SELECT * FROM `News` WHERE `ID`=? LIMIT 1', [$nid]);
|
$news = DB::selectOne('SELECT * FROM `News` WHERE `ID`=? LIMIT 1', [$nid]);
|
||||||
if ($request->has('text')) {
|
if ($request->has('text')) {
|
||||||
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($request->input('text')));
|
$text = preg_replace(
|
||||||
|
"/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui",
|
||||||
|
'',
|
||||||
|
strip_tags($request->input('text'))
|
||||||
|
);
|
||||||
DB::insert('
|
DB::insert('
|
||||||
INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`)
|
INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
|
|
|
@ -126,7 +126,7 @@ function user_settings_password($user_source)
|
||||||
*
|
*
|
||||||
* @param array $user_source The user
|
* @param array $user_source The user
|
||||||
* @param array $themes List of available themes
|
* @param array $themes List of available themes
|
||||||
* @return mixed
|
* @return array
|
||||||
*/
|
*/
|
||||||
function user_settings_theme($user_source, $themes)
|
function user_settings_theme($user_source, $themes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,8 +56,18 @@ function update_ShiftsFilter_timerange(ShiftsFilter $shiftsFilter, $days)
|
||||||
$end_time = $start_time + 24 * 60 * 60;
|
$end_time = $start_time + 24 * 60 * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
$shiftsFilter->setStartTime(check_request_datetime('start_day', 'start_time', $days, $start_time));
|
$shiftsFilter->setStartTime(check_request_datetime(
|
||||||
$shiftsFilter->setEndTime(check_request_datetime('end_day', 'end_time', $days, $end_time));
|
'start_day',
|
||||||
|
'start_time',
|
||||||
|
$days,
|
||||||
|
$start_time
|
||||||
|
));
|
||||||
|
$shiftsFilter->setEndTime(check_request_datetime(
|
||||||
|
'end_day',
|
||||||
|
'end_time',
|
||||||
|
$days,
|
||||||
|
$end_time
|
||||||
|
));
|
||||||
|
|
||||||
if ($shiftsFilter->getStartTime() > $shiftsFilter->getEndTime()) {
|
if ($shiftsFilter->getStartTime() > $shiftsFilter->getEndTime()) {
|
||||||
$shiftsFilter->setEndTime($shiftsFilter->getStartTime() + 24 * 60 * 60);
|
$shiftsFilter->setEndTime($shiftsFilter->getStartTime() + 24 * 60 * 60);
|
||||||
|
@ -115,7 +125,7 @@ function load_days()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|false
|
* @return array[]|false
|
||||||
*/
|
*/
|
||||||
function load_types()
|
function load_types()
|
||||||
{
|
{
|
||||||
|
@ -210,9 +220,19 @@ function view_user_shifts()
|
||||||
view(__DIR__ . '/../../templates/user_shifts.html', [
|
view(__DIR__ . '/../../templates/user_shifts.html', [
|
||||||
'title' => shifts_title(),
|
'title' => shifts_title(),
|
||||||
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), 'rooms', _('Rooms')),
|
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), 'rooms', _('Rooms')),
|
||||||
'start_select' => html_select_key('start_day', 'start_day', array_combine($days, $days), $start_day),
|
'start_select' => html_select_key(
|
||||||
|
'start_day',
|
||||||
|
'start_day',
|
||||||
|
array_combine($days, $days),
|
||||||
|
$start_day
|
||||||
|
),
|
||||||
'start_time' => $start_time,
|
'start_time' => $start_time,
|
||||||
'end_select' => html_select_key('end_day', 'end_day', array_combine($days, $days), $end_day),
|
'end_select' => html_select_key(
|
||||||
|
'end_day',
|
||||||
|
'end_day',
|
||||||
|
array_combine($days, $days),
|
||||||
|
$end_day
|
||||||
|
),
|
||||||
'end_time' => $end_time,
|
'end_time' => $end_time,
|
||||||
'type_select' => make_select(
|
'type_select' => make_select(
|
||||||
$types,
|
$types,
|
||||||
|
@ -242,7 +262,10 @@ function view_user_shifts()
|
||||||
'set_last_4h' => _('last 4h'),
|
'set_last_4h' => _('last 4h'),
|
||||||
'set_next_4h' => _('next 4h'),
|
'set_next_4h' => _('next 4h'),
|
||||||
'set_next_8h' => _('next 8h'),
|
'set_next_8h' => _('next 8h'),
|
||||||
'buttons' => button(public_dashboard_link(), glyph('dashboard') . _('Public Dashboard'))
|
'buttons' => button(
|
||||||
|
public_dashboard_link(),
|
||||||
|
glyph('dashboard') . _('Public Dashboard')
|
||||||
|
)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -87,18 +87,22 @@ function verify_password($password, $salt, $uid = null)
|
||||||
{
|
{
|
||||||
$crypt_alg = config('crypt_alg');
|
$crypt_alg = config('crypt_alg');
|
||||||
$correct = false;
|
$correct = false;
|
||||||
if (substr($salt, 0, 1) == '$') { // new-style crypt()
|
if (substr($salt, 0, 1) == '$') {
|
||||||
|
// new-style crypt()
|
||||||
$correct = crypt($password, $salt) == $salt;
|
$correct = crypt($password, $salt) == $salt;
|
||||||
} elseif (substr($salt, 0, 7) == '{crypt}') { // old-style crypt() with DES and static salt - not used anymore
|
} elseif (substr($salt, 0, 7) == '{crypt}') {
|
||||||
|
// old-style crypt() with DES and static salt - not used anymore
|
||||||
$correct = crypt($password, '77') == $salt;
|
$correct = crypt($password, '77') == $salt;
|
||||||
} elseif (strlen($salt) == 32) { // old-style md5 without salt - not used anymore
|
} elseif (strlen($salt) == 32) {
|
||||||
|
// old-style md5 without salt - not used anymore
|
||||||
$correct = md5($password) == $salt;
|
$correct = md5($password) == $salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($correct && substr($salt, 0, strlen($crypt_alg)) != $crypt_alg && intval($uid)) {
|
if ($correct && substr($salt, 0, strlen($crypt_alg)) != $crypt_alg && intval($uid)) {
|
||||||
// this password is stored in another format than we want it to be.
|
// this password is stored in another format than we want it to be.
|
||||||
// let's update it!
|
// let's update it!
|
||||||
// we duplicate the query from the above set_password() function to have the extra safety of checking the old hash
|
// we duplicate the query from the above set_password() function to have the extra safety of checking
|
||||||
|
// the old hash
|
||||||
DB::update('
|
DB::update('
|
||||||
UPDATE `User`
|
UPDATE `User`
|
||||||
SET `Passwort` = ?
|
SET `Passwort` = ?
|
||||||
|
|
|
@ -23,9 +23,11 @@ function form_hidden($name, $value)
|
||||||
*/
|
*/
|
||||||
function form_spinner($name, $label, $value)
|
function form_spinner($name, $label, $value)
|
||||||
{
|
{
|
||||||
|
$value = htmlspecialchars($value);
|
||||||
|
|
||||||
return form_element($label, '
|
return form_element($label, '
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="spinner-' . $name . '" class="form-control" name="' . $name . '" value="' . htmlspecialchars($value) . '" />
|
<input id="spinner-' . $name . '" class="form-control" name="' . $name . '" value="' . $value . '" />
|
||||||
<div class="input-group-btn">
|
<div class="input-group-btn">
|
||||||
<button id="spinner-' . $name . '-down" class="btn btn-default" type="button">
|
<button id="spinner-' . $name . '-down" class="btn btn-default" type="button">
|
||||||
<span class="glyphicon glyphicon-minus"></span>
|
<span class="glyphicon glyphicon-minus"></span>
|
||||||
|
@ -130,7 +132,13 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []
|
||||||
$sel .= ' disabled="disabled"';
|
$sel .= ' disabled="disabled"';
|
||||||
}
|
}
|
||||||
$html .= '<td style="text-align: center;">'
|
$html .= '<td style="text-align: center;">'
|
||||||
. '<input type="checkbox" id="' . $dom_id . '" name="' . $name . '[]" value="' . $key . '" ' . $sel . ' />'
|
. sprintf(
|
||||||
|
'<input type="checkbox" id="%s" name="%s[]" value="%s" %s />',
|
||||||
|
$dom_id,
|
||||||
|
$name,
|
||||||
|
$key,
|
||||||
|
$sel
|
||||||
|
)
|
||||||
. '</td>';
|
. '</td>';
|
||||||
}
|
}
|
||||||
$html .= '<td><label for="' . $dom_id . '">' . $item . '</label></td></tr>';
|
$html .= '<td><label for="' . $dom_id . '">' . $item . '</label></td></tr>';
|
||||||
|
@ -281,7 +289,11 @@ function form_email($name, $label, $value, $disabled = false)
|
||||||
*/
|
*/
|
||||||
function form_file($name, $label)
|
function form_file($name, $label)
|
||||||
{
|
{
|
||||||
return form_element($label, '<input id="form_' . $name . '" type="file" name="' . $name . '" />', 'form_' . $name);
|
return form_element(
|
||||||
|
$label,
|
||||||
|
sprintf('<input id="form_%1$s" type="file" name="%1$s" />', $name),
|
||||||
|
'form_' . $name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,7 +309,11 @@ function form_password($name, $label, $disabled = false)
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<input class="form-control" id="form_' . $name . '" type="password" name="' . $name . '" value="" ' . $disabled . '/>',
|
sprintf(
|
||||||
|
'<input class="form-control" id="form_%1$s" type="password" name="%1$s" value=""%s/>',
|
||||||
|
$name,
|
||||||
|
$disabled
|
||||||
|
),
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,15 +60,29 @@ function header_toolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($user) && in_array('register', $privileges) && config('registration_enabled')) {
|
if (!isset($user) && in_array('register', $privileges) && config('registration_enabled')) {
|
||||||
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $page == 'register');
|
$toolbar_items[] = toolbar_item_link(
|
||||||
|
page_link_to('register'),
|
||||||
|
'plus',
|
||||||
|
register_title(),
|
||||||
|
$page == 'register'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('login', $privileges)) {
|
if (in_array('login', $privileges)) {
|
||||||
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $page == 'login');
|
$toolbar_items[] = toolbar_item_link(
|
||||||
|
page_link_to('login'),
|
||||||
|
'log-in',
|
||||||
|
login_title(),
|
||||||
|
$page == 'login'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($user) && in_array('user_messages', $privileges)) {
|
if (isset($user) && in_array('user_messages', $privileges)) {
|
||||||
$toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages());
|
$toolbar_items[] = toolbar_item_link(
|
||||||
|
page_link_to('user_messages'),
|
||||||
|
'envelope',
|
||||||
|
user_unread_messages()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$toolbar_items[] = header_render_hints();
|
$toolbar_items[] = header_render_hints();
|
||||||
|
@ -112,7 +126,12 @@ function make_user_submenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('logout', $privileges)) {
|
if (in_array('logout', $privileges)) {
|
||||||
$user_submenu[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $page == 'logout');
|
$user_submenu[] = toolbar_item_link(
|
||||||
|
page_link_to('logout'),
|
||||||
|
'log-out',
|
||||||
|
logout_title(),
|
||||||
|
$page == 'logout'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user_submenu;
|
return $user_submenu;
|
||||||
|
@ -160,7 +179,12 @@ function make_navigation()
|
||||||
|
|
||||||
foreach ($admin_pages as $menu_page => $title) {
|
foreach ($admin_pages as $menu_page => $title) {
|
||||||
if (in_array($menu_page, $privileges)) {
|
if (in_array($menu_page, $privileges)) {
|
||||||
$admin_menu[] = toolbar_item_link(page_link_to($menu_page), '', $title, $menu_page == $page);
|
$admin_menu[] = toolbar_item_link(
|
||||||
|
page_link_to($menu_page),
|
||||||
|
'',
|
||||||
|
$title,
|
||||||
|
$menu_page == $page
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
* @param string $label
|
* @param string $label
|
||||||
* @param string $number
|
* @param string $number
|
||||||
* @param string $style default, warning, danger or success. Optional.
|
* @param string $style default, warning, danger or success. Optional.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function stats($label, $number, $style = null)
|
function stats($label, $number, $style = null)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +45,9 @@ function tabs($tabs, $selected = 0)
|
||||||
$tab_header[] = '<li role="presentation" class="' . $class . '">
|
$tab_header[] = '<li role="presentation" class="' . $class . '">
|
||||||
<a href="#' . $header . '" aria-controls="' . $header . '" role="tab" data-toggle="tab">'
|
<a href="#' . $header . '" aria-controls="' . $header . '" role="tab" data-toggle="tab">'
|
||||||
. $header . '</a></li>';
|
. $header . '</a></li>';
|
||||||
$tab_content[] = '<div role="tabpanel" class="tab-pane ' . $class . '" id="' . $header . '">' . $content . '</div>';
|
$tab_content[] = '<div role="tabpanel" class="tab-pane ' . $class . '" id="' . $header . '">'
|
||||||
|
. $content
|
||||||
|
. '</div>';
|
||||||
}
|
}
|
||||||
return div('', [
|
return div('', [
|
||||||
'<ul class="nav nav-tabs" role="tablist">' . join($tab_header) . '</ul>',
|
'<ul class="nav nav-tabs" role="tablist">' . join($tab_header) . '</ul>',
|
||||||
|
@ -114,7 +117,9 @@ function glyph($glyph_name)
|
||||||
*/
|
*/
|
||||||
function glyph_bool($boolean)
|
function glyph_bool($boolean)
|
||||||
{
|
{
|
||||||
return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">' . glyph($boolean ? 'ok' : 'remove') . '</span>';
|
return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">'
|
||||||
|
. glyph($boolean ? 'ok' : 'remove')
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,9 +270,12 @@ function page_with_title($title, $elements)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a description based on the data arrays key and values as label an description.
|
* Renders a description based on the data arrays key and values as label an description.
|
||||||
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function description($data) {
|
function description($data)
|
||||||
|
{
|
||||||
$elements = [];
|
$elements = [];
|
||||||
foreach ($data as $label => $description) {
|
foreach ($data as $label => $description) {
|
||||||
if (!empty($label) && !empty($description)) {
|
if (!empty($label) && !empty($description)) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Engelsystem\ShiftsFilterRenderer;
|
|
||||||
use Engelsystem\ShiftCalendarRenderer;
|
use Engelsystem\ShiftCalendarRenderer;
|
||||||
|
use Engelsystem\ShiftsFilterRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AngelTypes
|
* AngelTypes
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +15,9 @@ use Engelsystem\ShiftCalendarRenderer;
|
||||||
*/
|
*/
|
||||||
function AngelType_name_render($angeltype)
|
function AngelType_name_render($angeltype)
|
||||||
{
|
{
|
||||||
return '<a href="' . angeltype_link($angeltype['id']) . '">' . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] . '</a>';
|
return '<a href="' . angeltype_link($angeltype['id']) . '">'
|
||||||
|
. ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name']
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +95,10 @@ function AngelType_edit_view($angeltype, $supporter_mode)
|
||||||
? form_info(_('No Self Sign Up'), $angeltype['no_self_signup'] ? _('Yes') : _('No'))
|
? form_info(_('No Self Sign Up'), $angeltype['no_self_signup'] ? _('Yes') : _('No'))
|
||||||
: form_checkbox('no_self_signup', _('No Self Sign Up'), $angeltype['no_self_signup']),
|
: form_checkbox('no_self_signup', _('No Self Sign Up'), $angeltype['no_self_signup']),
|
||||||
$supporter_mode
|
$supporter_mode
|
||||||
? form_info(_('Requires driver license'), $angeltype['requires_driver_license'] ? _('Yes') : _('No'))
|
? form_info(_('Requires driver license'),
|
||||||
|
$angeltype['requires_driver_license']
|
||||||
|
? _('Yes')
|
||||||
|
: _('No'))
|
||||||
: form_checkbox(
|
: form_checkbox(
|
||||||
'requires_driver_license',
|
'requires_driver_license',
|
||||||
_('Requires driver license'),
|
_('Requires driver license'),
|
||||||
|
@ -133,7 +139,10 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($angeltype['requires_driver_license']) {
|
if ($angeltype['requires_driver_license']) {
|
||||||
$buttons[] = button(user_driver_license_edit_link($user), glyph('road') . _('my driving license'));
|
$buttons[] = button(
|
||||||
|
user_driver_license_edit_link($user),
|
||||||
|
glyph('road') . _('my driving license')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_angeltype == null) {
|
if ($user_angeltype == null) {
|
||||||
|
@ -353,7 +362,7 @@ function AngelType_view(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Angeltype $angeltype
|
* @param array $angeltype
|
||||||
* @param ShiftsFilterRenderer $shiftsFilterRenderer
|
* @param ShiftsFilterRenderer $shiftsFilterRenderer
|
||||||
* @param ShiftCalendarRenderer $shiftCalendarRenderer
|
* @param ShiftCalendarRenderer $shiftCalendarRenderer
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
|
@ -370,7 +379,7 @@ function AngelType_view_shifts($angeltype, $shiftsFilterRenderer, $shiftCalendar
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Angeltype $angeltype
|
* @param array $angeltype
|
||||||
* @param array $members
|
* @param array $members
|
||||||
* @param bool $admin_user_angeltypes
|
* @param bool $admin_user_angeltypes
|
||||||
* @param bool $admin_angeltypes
|
* @param bool $admin_angeltypes
|
||||||
|
@ -460,7 +469,7 @@ function AngelType_view_info(
|
||||||
/**
|
/**
|
||||||
* Renders the contact info
|
* Renders the contact info
|
||||||
*
|
*
|
||||||
* @param Anteltype $angeltype
|
* @param array $angeltype
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function AngelTypes_render_contact_info($angeltype)
|
function AngelTypes_render_contact_info($angeltype)
|
||||||
|
|
|
@ -73,7 +73,11 @@ function EventConfig_info($event_config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event name, start+end date are set
|
// Event name, start+end date are set
|
||||||
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
if (
|
||||||
|
$event_config['event_name'] != null
|
||||||
|
&& $event_config['event_start_date'] != null
|
||||||
|
&& $event_config['event_end_date'] != null
|
||||||
|
) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_('%s, from %s to %s'),
|
_('%s, from %s to %s'),
|
||||||
$event_config['event_name'],
|
$event_config['event_name'],
|
||||||
|
@ -134,7 +138,10 @@ function EventConfig_edit_view(
|
||||||
form_text('event_name', _('Event Name'), $event_name),
|
form_text('event_name', _('Event Name'), $event_name),
|
||||||
form_info('', _('Event Name is shown on the start page.')),
|
form_info('', _('Event Name is shown on the start page.')),
|
||||||
form_textarea('event_welcome_msg', _('Event Welcome Message'), $event_welcome_msg),
|
form_textarea('event_welcome_msg', _('Event Welcome Message'), $event_welcome_msg),
|
||||||
form_info('', _('Welcome message is shown after successful registration. You can use markdown.'))
|
form_info(
|
||||||
|
'',
|
||||||
|
_('Welcome message is shown after successful registration. You can use markdown.')
|
||||||
|
)
|
||||||
]),
|
]),
|
||||||
div('col-md-3 col-xs-6', [
|
div('col-md-3 col-xs-6', [
|
||||||
form_date('buildup_start_date', _('Buildup date'), $buildup_start_date),
|
form_date('buildup_start_date', _('Buildup date'), $buildup_start_date),
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public dashboard (formerly known as angel news hub)
|
* Public dashboard (formerly known as angel news hub)
|
||||||
|
*
|
||||||
|
* @param array $stats
|
||||||
|
* @param array[] $free_shifts
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function public_dashboard_view($stats, $free_shifts)
|
function public_dashboard_view($stats, $free_shifts)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +13,7 @@ function public_dashboard_view($stats, $free_shifts)
|
||||||
if (count($free_shifts) > 0) {
|
if (count($free_shifts) > 0) {
|
||||||
$shift_panels = [];
|
$shift_panels = [];
|
||||||
foreach ($free_shifts as $shift) {
|
foreach ($free_shifts as $shift) {
|
||||||
$shift_panels[] = public_dashborad_shift_render($shift);
|
$shift_panels[] = public_dashboard_shift_render($shift);
|
||||||
}
|
}
|
||||||
$needed_angels = div('first', [
|
$needed_angels = div('first', [
|
||||||
div('col-md-12', [
|
div('col-md-12', [
|
||||||
|
@ -18,6 +22,7 @@ function public_dashboard_view($stats, $free_shifts)
|
||||||
join($shift_panels)
|
join($shift_panels)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return page([
|
return page([
|
||||||
div('public-dashboard', [
|
div('public-dashboard', [
|
||||||
div('first', [
|
div('first', [
|
||||||
|
@ -48,8 +53,11 @@ function public_dashboard_view($stats, $free_shifts)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a single shift panel for a dashboard shift with needed angels
|
* Renders a single shift panel for a dashboard shift with needed angels
|
||||||
|
*
|
||||||
|
* @param array $shift
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function public_dashborad_shift_render($shift)
|
function public_dashboard_shift_render($shift)
|
||||||
{
|
{
|
||||||
$panel_body = glyph('time') . $shift['start'] . ' - ' . $shift['end'];
|
$panel_body = glyph('time') . $shift['start'] . ' - ' . $shift['end'];
|
||||||
$panel_body .= ' (' . $shift['duration'] . ' h)';
|
$panel_body .= ' (' . $shift['duration'] . ' h)';
|
||||||
|
@ -62,7 +70,10 @@ function public_dashborad_shift_render($shift)
|
||||||
$panel_body .= '<br>' . glyph('map-marker') . $shift['room_name'];
|
$panel_body .= '<br>' . glyph('map-marker') . $shift['room_name'];
|
||||||
|
|
||||||
foreach ($shift['needed_angels'] as $needed_angels) {
|
foreach ($shift['needed_angels'] as $needed_angels) {
|
||||||
$panel_body .= '<br>' . glyph('user') . '<span class="text-' . $shift['style'] . '">' . $needed_angels['need'] . ' × ' . $needed_angels['angeltype_name'] . '</span>';
|
$panel_body .= '<br>' . glyph('user')
|
||||||
|
. '<span class="text-' . $shift['style'] . '">'
|
||||||
|
. $needed_angels['need'] . ' × ' . $needed_angels['angeltype_name']
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return div('col-md-3', [
|
return div('col-md-3', [
|
||||||
|
@ -74,4 +85,3 @@ function public_dashborad_shift_render($shift)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Engelsystem\ShiftCalendarRenderer;
|
use Engelsystem\ShiftCalendarRenderer;
|
||||||
use Engelsystem\ShiftsFilterRenderer;
|
use Engelsystem\ShiftsFilterRenderer;
|
||||||
|
|
||||||
|
@ -27,7 +28,12 @@ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalen
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
if (!empty($room['map_url'])) {
|
if (!empty($room['map_url'])) {
|
||||||
$tabs[_('Map')] = '<div class="map"><iframe style="width: 100%; min-height: 400px; border: 0px none;" src="' . $room['map_url'] . '"></iframe></div>';
|
$tabs[_('Map')] = sprintf(
|
||||||
|
'<div class="map">'
|
||||||
|
. '<iframe style="width: 100%; min-height: 400px; border: 0 none;" src="%s"></iframe>'
|
||||||
|
. '</div>',
|
||||||
|
$room['map_url']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabs[_('Shifts')] = div('first', [
|
$tabs[_('Shifts')] = div('first', [
|
||||||
|
@ -59,8 +65,10 @@ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalen
|
||||||
function Room_name_render($room)
|
function Room_name_render($room)
|
||||||
{
|
{
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
if (in_array('view_rooms', $privileges)) {
|
if (in_array('view_rooms', $privileges)) {
|
||||||
return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
|
return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return glyph('map-marker') . $room['Name'];
|
return glyph('map-marker') . $room['Name'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ShiftCalendarLane
|
||||||
$this->shifts[] = $shift;
|
$this->shifts[] = $shift;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Unable to add shift to shift calendar lane.');
|
throw new Exception('Unable to add shift to shift calendar lane.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ class ShiftCalendarLane
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,10 @@ class ShiftCalendarRenderer
|
||||||
$start_time = $shift['start'];
|
$start_time = $shift['start'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(($start_time - ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(
|
||||||
|
($start_time - ShiftCalendarRenderer::TIME_MARGIN)
|
||||||
|
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,7 +285,11 @@ class ShiftCalendarRenderer
|
||||||
$end_time = $shift['end'];
|
$end_time = $shift['end'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(($end_time + ShiftCalendarRenderer::TIME_MARGIN) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
|
||||||
|
return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(
|
||||||
|
($end_time + ShiftCalendarRenderer::TIME_MARGIN)
|
||||||
|
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,7 +297,10 @@ class ShiftCalendarRenderer
|
||||||
*/
|
*/
|
||||||
private function calcBlocksPerSlot()
|
private function calcBlocksPerSlot()
|
||||||
{
|
{
|
||||||
return ceil(($this->getLastBlockEndTime() - $this->getFirstBlockStartTime()) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
return ceil(
|
||||||
|
($this->getLastBlockEndTime() - $this->getFirstBlockStartTime())
|
||||||
|
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,10 +33,14 @@ class ShiftCalendarShiftRenderer
|
||||||
|
|
||||||
$blocks = ceil(($shift['end'] - $shift['start']) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
$blocks = ceil(($shift['end'] - $shift['start']) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
||||||
$blocks = max(1, $blocks);
|
$blocks = max(1, $blocks);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$blocks,
|
$blocks,
|
||||||
div(
|
div(
|
||||||
'shift panel panel-' . $class . '" style="height: ' . ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN) . 'px"',
|
'shift panel panel-' . $class . '" '
|
||||||
|
. 'style="height: '
|
||||||
|
. ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN)
|
||||||
|
. 'px"',
|
||||||
[
|
[
|
||||||
$this->renderShiftHead($shift),
|
$this->renderShiftHead($shift),
|
||||||
div('panel-body', [
|
div('panel-body', [
|
||||||
|
@ -138,6 +142,7 @@ class ShiftCalendarShiftRenderer
|
||||||
'<ul class="list-group">' . $html . '</ul>'
|
'<ul class="list-group">' . $html . '</ul>'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$shift_signup_state,
|
$shift_signup_state,
|
||||||
''
|
''
|
||||||
|
@ -161,7 +166,15 @@ class ShiftCalendarShiftRenderer
|
||||||
$style = $entry['freeloaded'] ? ' text-decoration: line-through;' : '';
|
$style = $entry['freeloaded'] ? ' text-decoration: line-through;' : '';
|
||||||
$entry_list[] = '<span style="' . $style . '">' . User_Nick_render($entry) . '</span>';
|
$entry_list[] = '<span style="' . $style . '">' . User_Nick_render($entry) . '</span>';
|
||||||
}
|
}
|
||||||
$shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries);
|
$shift_signup_state = Shift_signup_allowed(
|
||||||
|
$user,
|
||||||
|
$shift,
|
||||||
|
$angeltype,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
$angeltype,
|
||||||
|
$shift_entries
|
||||||
|
);
|
||||||
$inner_text = sprintf(
|
$inner_text = sprintf(
|
||||||
ngettext('%d helper needed', '%d helpers needed', $shift_signup_state->getFreeEntries()),
|
ngettext('%d helper needed', '%d helpers needed', $shift_signup_state->getFreeEntries()),
|
||||||
$shift_signup_state->getFreeEntries()
|
$shift_signup_state->getFreeEntries()
|
||||||
|
@ -200,7 +213,10 @@ class ShiftCalendarShiftRenderer
|
||||||
// Add link to join the angeltype first
|
// Add link to join the angeltype first
|
||||||
$entry_list[] = $inner_text . '<br />'
|
$entry_list[] = $inner_text . '<br />'
|
||||||
. button(
|
. button(
|
||||||
page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']]),
|
page_link_to(
|
||||||
|
'user_angeltypes',
|
||||||
|
['action' => 'add', 'angeltype_id' => $angeltype['id']]
|
||||||
|
),
|
||||||
sprintf(_('Become %s'), $angeltype['name']),
|
sprintf(_('Become %s'), $angeltype['name']),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
);
|
);
|
||||||
|
@ -241,8 +257,16 @@ class ShiftCalendarShiftRenderer
|
||||||
$header_buttons = '';
|
$header_buttons = '';
|
||||||
if (in_array('admin_shifts', $privileges)) {
|
if (in_array('admin_shifts', $privileges)) {
|
||||||
$header_buttons = '<div class="pull-right">' . table_buttons([
|
$header_buttons = '<div class="pull-right">' . table_buttons([
|
||||||
button(page_link_to('user_shifts', ['edit_shift' => $shift['SID']]), glyph('edit'), 'btn-xs'),
|
button(
|
||||||
button(page_link_to('user_shifts', ['delete_shift' => $shift['SID']]), glyph('trash'), 'btn-xs')
|
page_link_to('user_shifts', ['edit_shift' => $shift['SID']]),
|
||||||
|
glyph('edit'),
|
||||||
|
'btn-xs'
|
||||||
|
),
|
||||||
|
button(
|
||||||
|
page_link_to('user_shifts', ['delete_shift' => $shift['SID']]),
|
||||||
|
glyph('trash'),
|
||||||
|
'btn-xs'
|
||||||
|
)
|
||||||
]) . '</div>';
|
]) . '</div>';
|
||||||
}
|
}
|
||||||
$shift_heading = date('H:i', $shift['start']) . ' ‐ '
|
$shift_heading = date('H:i', $shift['start']) . ' ‐ '
|
||||||
|
|
|
@ -13,7 +13,14 @@
|
||||||
function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user)
|
function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_delete_title(), [
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
info(sprintf(_('Do you want to sign off %s from shift %s from %s to %s as %s?'), User_Nick_render($signoff_user), $shift['name'], date('Y-m-d H:i', $shift['start']), date('Y-m-d H:i', $shift['end']), $angeltype['name']), true),
|
info(sprintf(
|
||||||
|
_('Do you want to sign off %s from shift %s from %s to %s as %s?'),
|
||||||
|
User_Nick_render($signoff_user),
|
||||||
|
$shift['name'],
|
||||||
|
date('Y-m-d H:i', $shift['start']),
|
||||||
|
date('Y-m-d H:i', $shift['end']),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
||||||
button(shift_entry_delete_link($shiftEntry, [
|
button(shift_entry_delete_link($shiftEntry, [
|
||||||
|
@ -36,7 +43,13 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_
|
||||||
function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user)
|
function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_delete_title(), [
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
info(sprintf(_('Do you want to sign off from your shift %s from %s to %s as %s?'), $shift['name'], date('Y-m-d H:i', $shift['start']), date('Y-m-d H:i', $shift['end']), $angeltype['name']), true),
|
info(sprintf(
|
||||||
|
_('Do you want to sign off from your shift %s from %s to %s as %s?'),
|
||||||
|
$shift['name'],
|
||||||
|
date('Y-m-d H:i', $shift['start']),
|
||||||
|
date('Y-m-d H:i', $shift['end']),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
||||||
button(shift_entry_delete_link($shiftEntry, [
|
button(shift_entry_delete_link($shiftEntry, [
|
||||||
|
@ -63,10 +76,14 @@ function ShiftEntry_delete_title()
|
||||||
* @param array $angeltypes_select
|
* @param array $angeltypes_select
|
||||||
* @param array $signup_user
|
* @param array $signup_user
|
||||||
* @param array $users_select
|
* @param array $users_select
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_create_view_admin($shift, $room, $angeltype, $angeltypes_select, $signup_user, $users_select)
|
function ShiftEntry_create_view_admin($shift, $room, $angeltype, $angeltypes_select, $signup_user, $users_select)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
|
return page_with_title(
|
||||||
|
ShiftEntry_create_title() . ': ' . $shift['name']
|
||||||
|
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||||
|
[
|
||||||
Shift_view_header($shift, $room),
|
Shift_view_header($shift, $room),
|
||||||
info(_('Do you want to sign up the following user for this shift?'), true),
|
info(_('Do you want to sign up the following user for this shift?'), true),
|
||||||
form([
|
form([
|
||||||
|
@ -85,12 +102,16 @@ function ShiftEntry_create_view_admin($shift, $room, $angeltype, $angeltypes_sel
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @param array $signup_user
|
* @param array $signup_user
|
||||||
* @param array $users_select
|
* @param array $users_select
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_create_view_supporter($shift, $room, $angeltype, $signup_user, $users_select)
|
function ShiftEntry_create_view_supporter($shift, $room, $angeltype, $signup_user, $users_select)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
|
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name']
|
||||||
|
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||||
|
[
|
||||||
Shift_view_header($shift, $room),
|
Shift_view_header($shift, $room),
|
||||||
info(sprintf(_('Do you want to sign up the following user for this shift as %s?'), AngelType_name_render($angeltype)), true),
|
info(sprintf(_('Do you want to sign up the following user for this shift as %s?'),
|
||||||
|
AngelType_name_render($angeltype)), true),
|
||||||
form([
|
form([
|
||||||
form_select('user_id', _('User'), $users_select, $signup_user['UID']),
|
form_select('user_id', _('User'), $users_select, $signup_user['UID']),
|
||||||
form_submit('submit', glyph('ok') . _('Save'))
|
form_submit('submit', glyph('ok') . _('Save'))
|
||||||
|
@ -105,10 +126,13 @@ function ShiftEntry_create_view_supporter($shift, $room, $angeltype, $signup_use
|
||||||
* @param array $room
|
* @param array $room
|
||||||
* @param array $angeltype
|
* @param array $angeltype
|
||||||
* @param string $comment
|
* @param string $comment
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_create_view_user($shift, $room, $angeltype, $comment)
|
function ShiftEntry_create_view_user($shift, $room, $angeltype, $comment)
|
||||||
{
|
{
|
||||||
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', [
|
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name']
|
||||||
|
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||||
|
[
|
||||||
Shift_view_header($shift, $room),
|
Shift_view_header($shift, $room),
|
||||||
info(sprintf(_('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true),
|
info(sprintf(_('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true),
|
||||||
form([
|
form([
|
||||||
|
@ -140,13 +164,26 @@ function ShiftEntry_create_title()
|
||||||
* @param bool $user_admin_shifts
|
* @param bool $user_admin_shifts
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false)
|
function ShiftEntry_edit_view(
|
||||||
{
|
$angel,
|
||||||
|
$date,
|
||||||
|
$location,
|
||||||
|
$title,
|
||||||
|
$type,
|
||||||
|
$comment,
|
||||||
|
$freeloaded,
|
||||||
|
$freeload_comment,
|
||||||
|
$user_admin_shifts = false
|
||||||
|
) {
|
||||||
$freeload_form = [];
|
$freeload_form = [];
|
||||||
if ($user_admin_shifts) {
|
if ($user_admin_shifts) {
|
||||||
$freeload_form = [
|
$freeload_form = [
|
||||||
form_checkbox('freeloaded', _('Freeloaded'), $freeloaded),
|
form_checkbox('freeloaded', _('Freeloaded'), $freeloaded),
|
||||||
form_textarea('freeload_comment', _('Freeload comment (Only for shift coordination):'), $freeload_comment)
|
form_textarea(
|
||||||
|
'freeload_comment',
|
||||||
|
_('Freeload comment (Only for shift coordination):'),
|
||||||
|
$freeload_comment
|
||||||
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return page_with_title(_('Edit shift entry'), [
|
return page_with_title(_('Edit shift entry'), [
|
||||||
|
|
|
@ -7,14 +7,18 @@ use Engelsystem\ShiftSignupState;
|
||||||
*
|
*
|
||||||
* @param array $shift
|
* @param array $shift
|
||||||
* @param array $room
|
* @param array $room
|
||||||
*
|
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
function Shift_view_header($shift, $room) {
|
function Shift_view_header($shift, $room)
|
||||||
|
{
|
||||||
return div('row', [
|
return div('row', [
|
||||||
div('col-sm-3 col-xs-6', [
|
div('col-sm-3 col-xs-6', [
|
||||||
'<h4>' . _('Title') . '</h4>',
|
'<h4>' . _('Title') . '</h4>',
|
||||||
'<p class="lead">' . ($shift['URL'] != '' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' : $shift['title']) . '</p>'
|
'<p class="lead">'
|
||||||
|
. ($shift['URL'] != ''
|
||||||
|
? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>'
|
||||||
|
: $shift['title'])
|
||||||
|
. '</p>'
|
||||||
]),
|
]),
|
||||||
div('col-sm-3 col-xs-6', [
|
div('col-sm-3 col-xs-6', [
|
||||||
'<h4>' . _('Start') . '</h4>',
|
'<h4>' . _('Start') . '</h4>',
|
||||||
|
@ -237,6 +241,11 @@ function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angelty
|
||||||
function shift_length($shift)
|
function shift_length($shift)
|
||||||
{
|
{
|
||||||
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ':';
|
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ':';
|
||||||
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, '0', STR_PAD_LEFT) . 'h';
|
$length .= str_pad(
|
||||||
|
(($shift['end'] - $shift['start']) % (60 * 60)) / 60,
|
||||||
|
2,
|
||||||
|
'0',
|
||||||
|
STR_PAD_LEFT
|
||||||
|
) . 'h';
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,11 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_('Confirm angeltype for user'), [
|
return page_with_title(_('Confirm angeltype for user'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(
|
||||||
|
_('Do you really want to confirm %s for %s?'),
|
||||||
|
User_Nick_render($user),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
button(
|
button(
|
||||||
|
@ -122,7 +126,11 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_('Remove angeltype'), [
|
return page_with_title(_('Remove angeltype'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(
|
||||||
|
_('Do you really want to delete %s from %s?'),
|
||||||
|
User_Nick_render($user),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
button(
|
button(
|
||||||
|
@ -174,7 +182,11 @@ function UserAngelType_join_view($user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_('Become a %s'), $angeltype['name']), [
|
return page_with_title(sprintf(_('Become a %s'), $angeltype['name']), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(
|
||||||
|
_('Do you really want to add %s to %s?'),
|
||||||
|
User_Nick_render($user),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
button(
|
button(
|
||||||
|
|
|
@ -42,7 +42,11 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
|
||||||
_('Truck 12,5t'),
|
_('Truck 12,5t'),
|
||||||
$user_driver_license['has_license_12_5t_truck']
|
$user_driver_license['has_license_12_5t_truck']
|
||||||
),
|
),
|
||||||
form_checkbox('has_license_forklift', _('Forklift'), $user_driver_license['has_license_forklift'])
|
form_checkbox(
|
||||||
|
'has_license_forklift',
|
||||||
|
_('Forklift'),
|
||||||
|
$user_driver_license['has_license_forklift']
|
||||||
|
)
|
||||||
])
|
])
|
||||||
], 'driving_license'),
|
], 'driving_license'),
|
||||||
form_submit('submit', _('Save'))
|
form_submit('submit', _('Save'))
|
||||||
|
|
|
@ -20,7 +20,9 @@ class UserHintsRenderer
|
||||||
$hint_class = $this->important ? 'danger' : 'info';
|
$hint_class = $this->important ? 'danger' : 'info';
|
||||||
$glyphicon = $this->important ? 'warning-sign' : 'info-sign';
|
$glyphicon = $this->important ? 'warning-sign' : 'info-sign';
|
||||||
|
|
||||||
return toolbar_popover($glyphicon . ' text-' . $hint_class, '', $this->hints, 'bg-' . $hint_class);
|
return toolbar_popover(
|
||||||
|
$glyphicon . ' text-' . $hint_class, '', $this->hints, 'bg-' . $hint_class
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -105,6 +105,7 @@ function User_registration_success_view($event_welcome_message)
|
||||||
{
|
{
|
||||||
$parsedown = new Parsedown();
|
$parsedown = new Parsedown();
|
||||||
$event_welcome_message = $parsedown->text($event_welcome_message);
|
$event_welcome_message = $parsedown->text($event_welcome_message);
|
||||||
|
|
||||||
return page_with_title(_('Registration successful'), [
|
return page_with_title(_('Registration successful'), [
|
||||||
msg(),
|
msg(),
|
||||||
div('row', [
|
div('row', [
|
||||||
|
@ -171,7 +172,10 @@ function User_edit_vouchers_view($user)
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($user), glyph('chevron-left') . _('back'))
|
button(user_link($user), glyph('chevron-left') . _('back'))
|
||||||
]),
|
]),
|
||||||
info(sprintf(_('Angel should receive at least %d vouchers.'), User_get_eligable_voucher_count($user)), true),
|
info(sprintf(
|
||||||
|
_('Angel should receive at least %d vouchers.'),
|
||||||
|
User_get_eligable_voucher_count($user)
|
||||||
|
), true),
|
||||||
form(
|
form(
|
||||||
[
|
[
|
||||||
form_spinner('vouchers', _('Number of vouchers given out'), $user['got_voucher']),
|
form_spinner('vouchers', _('Number of vouchers given out'), $user['got_voucher']),
|
||||||
|
@ -283,16 +287,25 @@ function User_shift_state_render($user)
|
||||||
|
|
||||||
if ($nextShift['start'] > time()) {
|
if ($nextShift['start'] > time()) {
|
||||||
if ($nextShift['start'] - time() > 3600) {
|
if ($nextShift['start'] - time() > 3600) {
|
||||||
return '<span class="text-success moment-countdown" data-timestamp="' . $nextShift['start'] . '">' . _('Next shift %c') . '</span>';
|
return '<span class="text-success moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
|
||||||
|
. _('Next shift %c')
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
return '<span class="text-warning moment-countdown" data-timestamp="' . $nextShift['start'] . '">' . _('Next shift %c') . '</span>';
|
return '<span class="text-warning moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
|
||||||
|
. _('Next shift %c')
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
$halfway = ($nextShift['start'] + $nextShift['end']) / 2;
|
$halfway = ($nextShift['start'] + $nextShift['end']) / 2;
|
||||||
|
|
||||||
if (time() < $halfway) {
|
if (time() < $halfway) {
|
||||||
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['start'] . '">' . _('Shift starts %c') . '</span>';
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
|
||||||
|
. _('Shift starts %c')
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['end'] . '">' . _('Shift ends %c') . '</span>';
|
|
||||||
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['end'] . '">'
|
||||||
|
. _('Shift ends %c')
|
||||||
|
. '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,7 +364,8 @@ function User_view_myshift($shift, $user_source, $its_me)
|
||||||
|
|
||||||
if ($shift['freeloaded']) {
|
if ($shift['freeloaded']) {
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>';
|
$myshift['comment'] .= '<br />'
|
||||||
|
. '<p class="error">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>';
|
||||||
} else {
|
} else {
|
||||||
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . '</p>';
|
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . '</p>';
|
||||||
}
|
}
|
||||||
|
@ -432,7 +446,9 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
$myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
|
$myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
|
||||||
|
|
||||||
return page_with_title(
|
return page_with_title(
|
||||||
'<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>',
|
'<span class="icon-icon_angel"></span> '
|
||||||
|
. htmlspecialchars($user_source['Nick'])
|
||||||
|
. ' <small>' . $user_name . '</small>',
|
||||||
[
|
[
|
||||||
msg(),
|
msg(),
|
||||||
div('row space-top', [
|
div('row space-top', [
|
||||||
|
@ -451,10 +467,16 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
_('arrived')
|
_('arrived')
|
||||||
) : '',
|
) : '',
|
||||||
$admin_user_privilege ? button(
|
$admin_user_privilege ? button(
|
||||||
page_link_to('users', ['action' => 'edit_vouchers', 'user_id' => $user_source['UID']]),
|
page_link_to(
|
||||||
|
'users',
|
||||||
|
['action' => 'edit_vouchers', 'user_id' => $user_source['UID']]
|
||||||
|
),
|
||||||
glyph('cutlery') . _('Edit vouchers')
|
glyph('cutlery') . _('Edit vouchers')
|
||||||
) : '',
|
) : '',
|
||||||
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _('Settings')) : '',
|
$its_me ? button(
|
||||||
|
page_link_to('user_settings'),
|
||||||
|
glyph('list-alt') . _('Settings')
|
||||||
|
) : '',
|
||||||
$its_me ? button(
|
$its_me ? button(
|
||||||
page_link_to('ical', ['key' => $user_source['api_key']]),
|
page_link_to('ical', ['key' => $user_source['api_key']]),
|
||||||
glyph('calendar') . _('iCal Export')
|
glyph('calendar') . _('iCal Export')
|
||||||
|
@ -487,7 +509,10 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
'comment' => _('Comment'),
|
'comment' => _('Comment'),
|
||||||
'actions' => _('Action')
|
'actions' => _('Action')
|
||||||
], $myshifts_table) : '',
|
], $myshifts_table) : '',
|
||||||
$its_me ? info(glyph('info-sign') . _('Your night shifts between 2 and 8 am count twice.'), true) : '',
|
$its_me ? info(
|
||||||
|
glyph('info-sign') . _('Your night shifts between 2 and 8 am count twice.'),
|
||||||
|
true
|
||||||
|
) : '',
|
||||||
$its_me && count($shifts) == 0
|
$its_me && count($shifts) == 0
|
||||||
? error(sprintf(
|
? error(sprintf(
|
||||||
_('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
|
_('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
|
||||||
|
@ -499,9 +524,15 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the state section of user view.
|
* Render the state section of user view
|
||||||
|
*
|
||||||
|
* @param bool $admin_user_privilege
|
||||||
|
* @param bool $freeloader
|
||||||
|
* @param array $user_source
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function User_view_state($admin_user_privilege, $freeloader, $user_source) {
|
function User_view_state($admin_user_privilege, $freeloader, $user_source)
|
||||||
|
{
|
||||||
if ($admin_user_privilege) {
|
if ($admin_user_privilege) {
|
||||||
$state = User_view_state_admin($freeloader, $user_source);
|
$state = User_view_state_admin($freeloader, $user_source);
|
||||||
} else {
|
} else {
|
||||||
|
@ -516,8 +547,12 @@ function User_view_state($admin_user_privilege, $freeloader, $user_source) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the state section of user view for users.
|
* Render the state section of user view for users.
|
||||||
|
*
|
||||||
|
* @param array $user_source
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function User_view_state_user($user_source) {
|
function User_view_state_user($user_source)
|
||||||
|
{
|
||||||
$state = [
|
$state = [
|
||||||
User_shift_state_render($user_source)
|
User_shift_state_render($user_source)
|
||||||
];
|
];
|
||||||
|
@ -534,8 +569,13 @@ function User_view_state_user($user_source) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the state section of user view for admins.
|
* Render the state section of user view for admins.
|
||||||
|
*
|
||||||
|
* @param bool $freeloader
|
||||||
|
* @param array $user_source
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function User_view_state_admin($freeloader, $user_source) {
|
function User_view_state_admin($freeloader, $user_source)
|
||||||
|
{
|
||||||
$state = [];
|
$state = [];
|
||||||
|
|
||||||
if ($freeloader) {
|
if ($freeloader) {
|
||||||
|
|
|
@ -12,7 +12,9 @@ class DatabaseServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
$config = $this->app->get('config');
|
$config = $this->app->get('config');
|
||||||
Db::connect(
|
Db::connect(
|
||||||
'mysql:host=' . $config->get('database')['host'] . ';dbname=' . $config->get('database')['db'] . ';charset=utf8',
|
'mysql:host=' . $config->get('database')['host']
|
||||||
|
. ';dbname=' . $config->get('database')['db']
|
||||||
|
. ';charset=utf8',
|
||||||
$config->get('database')['user'],
|
$config->get('database')['user'],
|
||||||
$config->get('database')['pw']
|
$config->get('database')['pw']
|
||||||
) || $this->exitOnError();
|
) || $this->exitOnError();
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Db
|
||||||
*
|
*
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return array
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
public static function select($query, array $bindings = [])
|
public static function select($query, array $bindings = [])
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,6 @@ interface HandlerInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $e
|
* @param Throwable $e
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public function report(Throwable $e);
|
public function report(Throwable $e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,11 @@ class Whoops extends Legacy implements HandlerInterface
|
||||||
/** @var Application */
|
/** @var Application */
|
||||||
protected $app;
|
protected $app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whoops constructor.
|
||||||
|
*
|
||||||
|
* @param Container $app
|
||||||
|
*/
|
||||||
public function __construct(Container $app)
|
public function __construct(Container $app)
|
||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
Loading…
Reference in New Issue