2011-12-17 15:18:13 +01:00
|
|
|
<?php
|
2015-08-13 20:28:48 +02:00
|
|
|
|
2023-01-03 22:19:03 +01:00
|
|
|
use Engelsystem\Helpers\Carbon;
|
2018-10-11 01:26:34 +02:00
|
|
|
use Engelsystem\Models\User\State;
|
2018-10-09 21:47:31 +02:00
|
|
|
use Engelsystem\Models\User\User;
|
2018-10-17 01:30:10 +02:00
|
|
|
use Illuminate\Database\Query\Builder;
|
|
|
|
use Illuminate\Database\Query\JoinClause;
|
2023-03-05 03:00:38 +01:00
|
|
|
use Engelsystem\Config\GoodieType;
|
2017-01-21 13:58:53 +01:00
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function admin_active_title()
|
|
|
|
{
|
2018-08-29 21:55:32 +02:00
|
|
|
return __('Active angels');
|
2013-11-25 21:04:58 +01:00
|
|
|
}
|
|
|
|
|
2017-01-03 03:22:48 +01:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function admin_active()
|
|
|
|
{
|
2017-01-21 23:07:20 +01:00
|
|
|
$tshirt_sizes = config('tshirt_sizes');
|
2018-09-17 12:33:15 +02:00
|
|
|
$shift_sum_formula = User_get_shifts_sum_query();
|
2017-07-18 21:38:53 +02:00
|
|
|
$request = request();
|
2023-03-05 03:00:38 +01:00
|
|
|
$goodie = GoodieType::from(config('goodie_type'));
|
|
|
|
$goodie_enabled = $goodie !== GoodieType::None;
|
|
|
|
$goodie_tshirt = $goodie === GoodieType::Tshirt;
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-03 14:12:17 +01:00
|
|
|
$msg = '';
|
|
|
|
$search = '';
|
2018-10-11 01:26:34 +02:00
|
|
|
$forced_count = State::whereForceActive(true)->count();
|
2018-10-17 01:30:10 +02:00
|
|
|
$count = null;
|
2017-01-03 14:12:17 +01:00
|
|
|
$set_active = '';
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-07-18 21:38:53 +02:00
|
|
|
if ($request->has('search')) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$search = strip_request_item('search');
|
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-07-18 21:38:53 +02:00
|
|
|
$show_all_shifts = $request->has('show_all_shifts');
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-07-18 21:38:53 +02:00
|
|
|
if ($request->has('set_active')) {
|
|
|
|
if ($request->has('count') && preg_match('/^\d+$/', $request->input('count'))) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$count = strip_request_item('count');
|
|
|
|
if ($count < $forced_count) {
|
2017-01-02 15:43:36 +01:00
|
|
|
error(sprintf(
|
2018-08-29 21:55:32 +02:00
|
|
|
__('At least %s angels are forced to be active. The number has to be greater.'),
|
2017-01-02 15:43:36 +01:00
|
|
|
$forced_count
|
|
|
|
));
|
2023-11-13 16:56:52 +01:00
|
|
|
throw_redirect(url('/admin-active'));
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
|
|
|
} else {
|
2018-10-17 01:30:10 +02:00
|
|
|
$msg .= error(__('Please enter a number of angels to be marked as active.'));
|
2023-11-13 16:56:52 +01:00
|
|
|
throw_redirect(url('/admin-active'));
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-11-20 16:02:03 +01:00
|
|
|
if ($request->hasPostData('ack')) {
|
2018-10-11 01:26:34 +02:00
|
|
|
State::query()
|
|
|
|
->where('got_shirt', '=', false)
|
|
|
|
->update(['active' => false]);
|
|
|
|
|
2018-10-17 01:30:10 +02:00
|
|
|
$query = User::query()
|
|
|
|
->selectRaw(
|
|
|
|
sprintf(
|
|
|
|
'
|
|
|
|
users.*,
|
2023-01-18 13:02:11 +01:00
|
|
|
COUNT(shift_entries.id) AS shift_count,
|
2018-10-17 01:30:10 +02:00
|
|
|
(%s + (
|
2020-09-12 19:45:25 +02:00
|
|
|
SELECT COALESCE(SUM(`hours`) * 3600, 0)
|
|
|
|
FROM `worklogs` WHERE `user_id`=`users`.`id`
|
|
|
|
AND `worked_at` <= NOW()
|
2018-10-17 01:30:10 +02:00
|
|
|
)) AS `shift_length`
|
|
|
|
',
|
|
|
|
$shift_sum_formula
|
2020-09-12 19:45:25 +02:00
|
|
|
)
|
2018-10-17 01:30:10 +02:00
|
|
|
)
|
2023-01-18 13:02:11 +01:00
|
|
|
->leftJoin('shift_entries', 'users.id', '=', 'shift_entries.user_id')
|
|
|
|
->leftJoin('shifts', 'shift_entries.shift_id', '=', 'shifts.id')
|
2018-10-17 01:30:10 +02:00
|
|
|
->leftJoin('users_state', 'users.id', '=', 'users_state.user_id')
|
|
|
|
->where('users_state.arrived', '=', true)
|
|
|
|
->groupBy('users.id')
|
|
|
|
->orderByDesc('force_active')
|
|
|
|
->orderByDesc('shift_length')
|
|
|
|
->orderByDesc('name')
|
|
|
|
->limit($count);
|
|
|
|
|
|
|
|
$users = $query->get();
|
2017-01-02 03:57:23 +01:00
|
|
|
$user_nicks = [];
|
|
|
|
foreach ($users as $usr) {
|
2018-10-11 01:26:34 +02:00
|
|
|
$usr->state->active = true;
|
|
|
|
$usr->state->save();
|
2019-05-31 04:03:19 +02:00
|
|
|
$user_nicks[] = User_Nick_render($usr, true);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
|
2017-01-03 14:12:17 +01:00
|
|
|
engelsystem_log('These angels are active now: ' . join(', ', $user_nicks));
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-08-29 21:55:32 +02:00
|
|
|
$msg = success(__('Marked angels.'), true);
|
2017-01-02 03:57:23 +01:00
|
|
|
} else {
|
2018-11-20 16:02:03 +01:00
|
|
|
$set_active = form([
|
2023-12-21 13:08:29 +01:00
|
|
|
button(url('/admin-active', ['search' => $search]), '« ' . __('general.back')),
|
|
|
|
form_submit('ack', '» ' . __('Apply')),
|
2023-11-13 16:56:52 +01:00
|
|
|
], url('/admin-active', ['search' => $search, 'count' => $count, 'set_active' => 1]));
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2012-12-26 14:02:27 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-11-20 16:02:03 +01:00
|
|
|
if ($request->hasPostData('submit')) {
|
|
|
|
if ($request->has('active') && preg_match('/^\d+$/', $request->input('active'))) {
|
|
|
|
$user_id = $request->input('active');
|
|
|
|
$user_source = User::find($user_id);
|
|
|
|
if ($user_source) {
|
|
|
|
$user_source->state->active = true;
|
|
|
|
$user_source->state->save();
|
2019-05-31 04:03:19 +02:00
|
|
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' is active now.');
|
2018-11-20 16:02:03 +01:00
|
|
|
$msg = success(__('Angel has been marked as active.'), true);
|
|
|
|
} else {
|
|
|
|
$msg = error(__('Angel not found.'), true);
|
|
|
|
}
|
|
|
|
} elseif ($request->has('not_active') && preg_match('/^\d+$/', $request->input('not_active'))) {
|
|
|
|
$user_id = $request->input('not_active');
|
|
|
|
$user_source = User::find($user_id);
|
|
|
|
if ($user_source) {
|
|
|
|
$user_source->state->active = false;
|
|
|
|
$user_source->state->save();
|
2019-05-31 04:03:19 +02:00
|
|
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' is NOT active now.');
|
2018-11-20 16:02:03 +01:00
|
|
|
$msg = success(__('Angel has been marked as not active.'), true);
|
|
|
|
} else {
|
|
|
|
$msg = error(__('Angel not found.'), true);
|
|
|
|
}
|
|
|
|
} elseif ($request->has('tshirt') && preg_match('/^\d+$/', $request->input('tshirt'))) {
|
|
|
|
$user_id = $request->input('tshirt');
|
|
|
|
$user_source = User::find($user_id);
|
|
|
|
if ($user_source) {
|
|
|
|
$user_source->state->got_shirt = true;
|
|
|
|
$user_source->state->save();
|
2019-05-31 04:03:19 +02:00
|
|
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has tshirt now.');
|
2023-11-16 16:11:45 +01:00
|
|
|
$msg = success(($goodie_tshirt ? __('Angel has got a T-shirt.') : __('Angel has got a goodie.')), true);
|
2018-11-20 16:02:03 +01:00
|
|
|
} else {
|
|
|
|
$msg = error('Angel not found.', true);
|
|
|
|
}
|
|
|
|
} elseif ($request->has('not_tshirt') && preg_match('/^\d+$/', $request->input('not_tshirt'))) {
|
|
|
|
$user_id = $request->input('not_tshirt');
|
|
|
|
$user_source = User::find($user_id);
|
|
|
|
if ($user_source) {
|
|
|
|
$user_source->state->got_shirt = false;
|
|
|
|
$user_source->state->save();
|
2019-05-31 04:03:19 +02:00
|
|
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has NO tshirt.');
|
2023-11-16 16:11:45 +01:00
|
|
|
$msg = success(($goodie_tshirt ? __('Angel has got no T-shirt.') : __('Angel has got no goodie.')), true);
|
2018-11-20 16:02:03 +01:00
|
|
|
} else {
|
|
|
|
$msg = error(__('Angel not found.'), true);
|
|
|
|
}
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2016-09-29 10:53:17 +02:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2019-12-26 19:07:51 +01:00
|
|
|
$query = User::with('personalData')
|
2018-10-17 01:30:10 +02:00
|
|
|
->selectRaw(
|
|
|
|
sprintf(
|
|
|
|
'
|
|
|
|
users.*,
|
2023-01-18 13:02:11 +01:00
|
|
|
COUNT(shift_entries.id) AS shift_count,
|
2018-10-17 01:30:10 +02:00
|
|
|
(%s + (
|
2020-09-12 19:45:25 +02:00
|
|
|
SELECT COALESCE(SUM(`hours`) * 3600, 0)
|
|
|
|
FROM `worklogs` WHERE `user_id`=`users`.`id`
|
|
|
|
AND `worked_at` <= NOW()
|
2018-10-17 01:30:10 +02:00
|
|
|
)) AS `shift_length`
|
|
|
|
',
|
|
|
|
$shift_sum_formula
|
2020-09-12 19:45:25 +02:00
|
|
|
)
|
2018-10-17 01:30:10 +02:00
|
|
|
)
|
2023-01-18 13:02:11 +01:00
|
|
|
->leftJoin('shift_entries', 'users.id', '=', 'shift_entries.user_id')
|
2023-01-03 22:19:03 +01:00
|
|
|
->leftJoin('shifts', function ($join) use ($show_all_shifts) {
|
2018-10-17 01:30:10 +02:00
|
|
|
/** @var JoinClause $join */
|
2023-01-18 13:02:11 +01:00
|
|
|
$join->on('shift_entries.shift_id', '=', 'shifts.id');
|
2018-12-28 21:39:23 +01:00
|
|
|
if (!$show_all_shifts) {
|
2018-10-17 01:30:10 +02:00
|
|
|
$join->where(function ($query) {
|
|
|
|
/** @var Builder $query */
|
2023-01-03 22:19:03 +01:00
|
|
|
$query->where('shifts.end', '<', Carbon::now())
|
|
|
|
->orWhereNull('shifts.end');
|
2018-10-17 01:30:10 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
->leftJoin('users_state', 'users.id', '=', 'users_state.user_id')
|
|
|
|
->where('users_state.arrived', '=', true)
|
|
|
|
->groupBy('users.id')
|
|
|
|
->orderByDesc('force_active')
|
|
|
|
->orderByDesc('shift_length')
|
|
|
|
->orderByDesc('name');
|
|
|
|
|
|
|
|
if (!is_null($count)) {
|
|
|
|
$query->limit($count);
|
|
|
|
}
|
|
|
|
|
2018-12-28 21:39:23 +01:00
|
|
|
/** @var User[] $users */
|
2018-10-17 01:30:10 +02:00
|
|
|
$users = $query->get();
|
2017-01-02 03:57:23 +01:00
|
|
|
$matched_users = [];
|
2017-01-03 14:12:17 +01:00
|
|
|
if ($search == '') {
|
2017-01-02 03:57:23 +01:00
|
|
|
$tokens = [];
|
|
|
|
} else {
|
2017-01-03 14:12:17 +01:00
|
|
|
$tokens = explode(' ', $search);
|
2012-12-26 14:02:27 +01:00
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
foreach ($users as $usr) {
|
2017-01-02 03:57:23 +01:00
|
|
|
if (count($tokens) > 0) {
|
|
|
|
$match = false;
|
|
|
|
foreach ($tokens as $t) {
|
2018-12-28 21:39:23 +01:00
|
|
|
$t = trim($t);
|
|
|
|
if (!empty($t) && stristr($usr->name, $t)) {
|
2017-01-02 03:57:23 +01:00
|
|
|
$match = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
if (!$match) {
|
2017-01-02 03:57:23 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
|
2018-10-31 13:18:43 +01:00
|
|
|
$shirtSize = $usr->personalData->shirt_size;
|
2018-10-11 01:26:34 +02:00
|
|
|
$userData = [];
|
2022-03-20 18:43:08 +01:00
|
|
|
$userData['no'] = count($matched_users) + 1;
|
2019-12-26 19:07:51 +01:00
|
|
|
$userData['nick'] = User_Nick_render($usr) . User_Pronoun_render($usr);
|
2023-03-05 03:00:38 +01:00
|
|
|
if ($goodie_tshirt) {
|
2023-01-27 21:01:23 +01:00
|
|
|
$userData['shirt_size'] = (isset($tshirt_sizes[$shirtSize]) ? $tshirt_sizes[$shirtSize] : '');
|
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
$userData['work_time'] = round($usr['shift_length'] / 60)
|
2017-12-30 12:07:10 +01:00
|
|
|
. ' min (' . sprintf('%.2f', $usr['shift_length'] / 3600) . ' h)';
|
2021-07-22 21:22:21 +02:00
|
|
|
$userData['active'] = icon_bool($usr->state->active == 1);
|
|
|
|
$userData['force_active'] = icon_bool($usr->state->force_active == 1);
|
|
|
|
$userData['tshirt'] = icon_bool($usr->state->got_shirt == 1);
|
2018-10-17 01:30:10 +02:00
|
|
|
$userData['shift_count'] = $usr['shift_count'];
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-02 03:57:23 +01:00
|
|
|
$actions = [];
|
2018-10-11 01:26:34 +02:00
|
|
|
if (!$usr->state->active) {
|
2017-08-28 16:21:10 +02:00
|
|
|
$parameters = [
|
2018-10-11 01:26:34 +02:00
|
|
|
'active' => $usr->id,
|
2017-08-28 16:21:10 +02:00
|
|
|
'search' => $search,
|
|
|
|
];
|
|
|
|
if ($show_all_shifts) {
|
|
|
|
$parameters['show_all_shifts'] = 1;
|
|
|
|
}
|
2018-11-20 16:02:03 +01:00
|
|
|
$actions[] = form(
|
2023-12-21 13:08:29 +01:00
|
|
|
[form_submit('submit', icon('plus-lg') . __('set active'), 'btn-sm', false, 'secondary')],
|
2023-11-13 16:56:52 +01:00
|
|
|
url('/admin-active', $parameters),
|
2022-10-18 19:15:22 +02:00
|
|
|
false,
|
|
|
|
true
|
2018-11-20 16:02:03 +01:00
|
|
|
);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
if ($usr->state->active) {
|
2017-08-28 16:21:10 +02:00
|
|
|
$parametersRemove = [
|
2018-10-11 01:26:34 +02:00
|
|
|
'not_active' => $usr->id,
|
2017-08-28 16:21:10 +02:00
|
|
|
'search' => $search,
|
|
|
|
];
|
2017-12-30 13:37:26 +01:00
|
|
|
if ($show_all_shifts) {
|
|
|
|
$parametersRemove['show_all_shifts'] = 1;
|
|
|
|
}
|
2018-11-20 16:02:03 +01:00
|
|
|
$actions[] = form(
|
2023-12-21 13:08:29 +01:00
|
|
|
[form_submit('submit', icon('dash-lg') . __('Remove active'), 'btn-sm', false, 'secondary')],
|
2023-11-13 16:56:52 +01:00
|
|
|
url('/admin-active', $parametersRemove),
|
2022-10-18 19:15:22 +02:00
|
|
|
false,
|
|
|
|
true
|
2018-11-20 16:02:03 +01:00
|
|
|
);
|
2017-12-30 13:37:26 +01:00
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
if (!$usr->state->got_shirt) {
|
2017-08-28 16:21:10 +02:00
|
|
|
$parametersShirt = [
|
2018-10-11 01:26:34 +02:00
|
|
|
'tshirt' => $usr->id,
|
2017-08-28 16:21:10 +02:00
|
|
|
'search' => $search,
|
|
|
|
];
|
|
|
|
if ($show_all_shifts) {
|
|
|
|
$parametersShirt['show_all_shifts'] = 1;
|
|
|
|
}
|
2023-03-05 03:00:38 +01:00
|
|
|
|
|
|
|
if ($goodie_enabled) {
|
|
|
|
$actions[] = form(
|
2023-12-21 13:08:29 +01:00
|
|
|
[form_submit('submit', icon('person') . ($goodie_tshirt ? __('Got T-shirt') : __('Got goodie')), 'btn-sm', false, 'secondary')],
|
2023-11-13 16:56:52 +01:00
|
|
|
url('/admin-active', $parametersShirt),
|
2023-03-05 03:00:38 +01:00
|
|
|
false,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2018-10-11 01:26:34 +02:00
|
|
|
if ($usr->state->got_shirt) {
|
2017-08-28 16:21:10 +02:00
|
|
|
$parameters = [
|
2018-10-11 01:26:34 +02:00
|
|
|
'not_tshirt' => $usr->id,
|
2017-08-28 16:21:10 +02:00
|
|
|
'search' => $search,
|
|
|
|
];
|
|
|
|
if ($show_all_shifts) {
|
|
|
|
$parameters['show_all_shifts'] = 1;
|
|
|
|
}
|
2023-03-05 03:00:38 +01:00
|
|
|
|
|
|
|
if ($goodie_enabled) {
|
|
|
|
$actions[] = form(
|
2023-12-21 13:08:29 +01:00
|
|
|
[form_submit('submit', icon('person') . ($goodie_tshirt ? __('Remove T-shirt') : __('Remove goodie')), 'btn-sm', false, 'secondary')],
|
2023-11-13 16:56:52 +01:00
|
|
|
url('/admin-active', $parameters),
|
2023-03-05 03:00:38 +01:00
|
|
|
false,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2023-03-05 03:00:38 +01:00
|
|
|
if ($goodie_tshirt) {
|
2023-12-21 13:08:29 +01:00
|
|
|
$actions[] = button(url('/admin/user/' . $usr->id . '/goodie'), icon('pencil') . __('form.edit'), 'btn-secondary btn-sm');
|
2023-01-27 21:01:23 +01:00
|
|
|
}
|
2021-09-24 20:28:51 +02:00
|
|
|
|
2018-11-20 16:02:03 +01:00
|
|
|
$userData['actions'] = buttons($actions);
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2018-10-11 01:26:34 +02:00
|
|
|
$matched_users[] = $userData;
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2023-03-05 03:00:38 +01:00
|
|
|
$goodie_statistics = [];
|
|
|
|
if ($goodie_tshirt) {
|
2023-01-27 21:01:23 +01:00
|
|
|
foreach (array_keys($tshirt_sizes) as $size) {
|
|
|
|
$gc = State::query()
|
|
|
|
->leftJoin('users_settings', 'users_state.user_id', '=', 'users_settings.user_id')
|
|
|
|
->leftJoin('users_personal_data', 'users_state.user_id', '=', 'users_personal_data.user_id')
|
|
|
|
->where('users_state.got_shirt', '=', true)
|
|
|
|
->where('users_personal_data.shirt_size', '=', $size)
|
|
|
|
->count();
|
2023-03-05 03:00:38 +01:00
|
|
|
$goodie_statistics[] = [
|
2023-01-27 21:01:23 +01:00
|
|
|
'size' => $size,
|
2023-02-05 18:03:00 +01:00
|
|
|
'given' => $gc,
|
2023-01-27 21:01:23 +01:00
|
|
|
];
|
|
|
|
}
|
2015-08-14 14:16:09 +02:00
|
|
|
}
|
2017-01-21 13:58:53 +01:00
|
|
|
|
2023-03-05 03:00:38 +01:00
|
|
|
$goodie_statistics[] = array_merge(
|
|
|
|
($goodie_tshirt ? ['size' => '<b>' . __('Sum') . '</b>'] : []),
|
2023-01-27 21:01:23 +01:00
|
|
|
['given' => '<b>' . State::whereGotShirt(true)->count() . '</b>']
|
|
|
|
);
|
2017-01-02 15:43:36 +01:00
|
|
|
|
2017-01-02 03:57:23 +01:00
|
|
|
return page_with_title(admin_active_title(), [
|
2017-01-02 15:43:36 +01:00
|
|
|
form([
|
2018-08-29 21:55:32 +02:00
|
|
|
form_text('search', __('Search angel:'), $search),
|
|
|
|
form_checkbox('show_all_shifts', __('Show all shifts'), $show_all_shifts),
|
2023-12-21 13:08:29 +01:00
|
|
|
form_submit('submit', icon('search') . __('form.search')),
|
2023-11-13 16:56:52 +01:00
|
|
|
], url('/admin-active')),
|
2017-01-03 14:12:17 +01:00
|
|
|
$set_active == '' ? form([
|
2022-06-16 23:00:56 +02:00
|
|
|
form_text('count', __('How much angels should be active?'), $count ?: $forced_count),
|
2023-12-21 13:08:29 +01:00
|
|
|
form_submit('set_active', icon('eye') . __('form.preview'), 'btn-info'),
|
2017-01-02 15:43:36 +01:00
|
|
|
]) : $set_active,
|
2017-01-03 03:22:48 +01:00
|
|
|
$msg . msg(),
|
2023-01-27 21:01:23 +01:00
|
|
|
table(
|
|
|
|
array_merge(
|
|
|
|
[
|
|
|
|
'no' => __('No.'),
|
2023-10-02 16:15:25 +02:00
|
|
|
'nick' => __('general.name'),
|
2023-01-27 21:01:23 +01:00
|
|
|
],
|
2023-03-05 03:00:38 +01:00
|
|
|
($goodie_tshirt ? ['shirt_size' => __('Size')] : []),
|
2023-01-27 21:01:23 +01:00
|
|
|
[
|
|
|
|
'shift_count' => __('Shifts'),
|
|
|
|
'work_time' => __('Length'),
|
|
|
|
'active' => __('Active?'),
|
|
|
|
'force_active' => __('Forced'),
|
2023-03-05 03:00:38 +01:00
|
|
|
],
|
|
|
|
($goodie_enabled ? ['tshirt' => ($goodie_tshirt ? __('T-shirt?') : __('Goodie?'))] : []),
|
|
|
|
[
|
2023-12-21 13:08:29 +01:00
|
|
|
'actions' => __('general.actions'),
|
2023-01-27 21:01:23 +01:00
|
|
|
]
|
|
|
|
),
|
|
|
|
$matched_users
|
|
|
|
),
|
2023-11-16 16:11:45 +01:00
|
|
|
$goodie_enabled ? '<h2>' . ($goodie_tshirt ? __('T-shirt statistic') : __('Goodie statistic')) . '</h2>' : '',
|
2023-03-05 03:00:38 +01:00
|
|
|
$goodie_enabled ? table(array_merge(
|
|
|
|
($goodie_tshirt ? ['size' => __('Size')] : []),
|
2023-11-16 16:11:45 +01:00
|
|
|
['given' => $goodie_tshirt ? __('Given T-shirts') : __('Given goodies') ]
|
2023-03-05 03:00:38 +01:00
|
|
|
), $goodie_statistics) : '',
|
2017-01-02 15:43:36 +01:00
|
|
|
]);
|
2011-12-17 15:18:13 +01:00
|
|
|
}
|