diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index fe8607d7..3d61c7fc 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -272,6 +272,7 @@ function angeltype_controller_shiftsFilter(AngelType $angeltype, $days)
function angeltypes_list_controller()
{
$user = auth()->user();
+ $admin_angeltypes = auth()->can('admin_angel_types');
if (!auth()->can('angeltypes')) {
throw_redirect(url('/'));
@@ -282,21 +283,27 @@ function angeltypes_list_controller()
$actions = [
button(
url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]),
- icon('eye') . __('view'),
- 'btn-sm'
+ icon('eye') . ($admin_angeltypes ? '' : __('View')),
+ 'btn-sm btn-info',
+ '',
+ ($admin_angeltypes ? __('View') : '')
),
];
- if (auth()->can('admin_angel_types')) {
+ if ($admin_angeltypes) {
$actions[] = button(
url('/angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype->id]),
- icon('pencil') . __('edit'),
- 'btn-sm'
+ icon('pencil'),
+ 'btn-sm',
+ '',
+ __('form.edit')
);
$actions[] = button(
url('/angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype->id]),
- icon('trash') . __('delete'),
- 'btn-sm'
+ icon('trash'),
+ 'btn-sm btn-danger',
+ '',
+ __('form.delete')
);
}
@@ -307,14 +314,18 @@ function angeltypes_list_controller()
'/user-angeltypes',
['action' => 'delete', 'user_angeltype_id' => $angeltype->user_angel_type_id]
),
- icon('box-arrow-right') . __('leave'),
- 'btn-sm'
+ icon('box-arrow-right') . ($admin_angeltypes ? '' : __('Leave')),
+ 'btn-sm',
+ '',
+ ($admin_angeltypes ? __('Leave') : '')
);
} else {
$actions[] = button(
url('/user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype->id]),
- icon('box-arrow-in-right') . __('join'),
- 'btn-sm'
+ icon('box-arrow-in-right') . ($admin_angeltypes ? '' : __('Join')),
+ 'btn-sm',
+ '',
+ ($admin_angeltypes ? __('Join') : '')
);
}
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 462f1c1a..5ec5eb5c 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -201,7 +201,7 @@ function shift_edit_controller()
);
}
- $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm');
+ $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm', '', __('general.back'));
return page_with_title(
$link . ' ' . shifts_title(),
[
@@ -222,7 +222,7 @@ function shift_edit_controller()
),
'
' . __('Needed angels') . '
',
$angel_types_spinner,
- form_submit('submit', __('form.save')),
+ form_submit('submit', icon('save') . __('form.save')),
]),
]
);
@@ -276,7 +276,7 @@ function shift_delete_controller()
throw_redirect(url('/user-shifts'));
}
- $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm');
+ $link = button(url('/shifts', ['action' => 'view', 'shift_id' => $shift_id]), icon('chevron-left'), 'btn-sm', '', __('general.back'));
return page_with_title(
$link . ' ' . shifts_title(),
[
@@ -288,7 +288,7 @@ function shift_delete_controller()
), true),
form([
form_hidden('delete_shift', $shift->id),
- form_submit('delete', __('delete')),
+ form_submit('delete', icon('trash') . __('form.delete'), '', true, 'danger'),
]),
]
);
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 48bd5338..6e036c4d 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -97,8 +97,8 @@ function admin_active()
$msg = success(__('Marked angels.'), true);
} else {
$set_active = form([
- button(url('/admin-active', ['search' => $search]), '« ' . __('back')),
- form_submit('ack', '» ' . __('apply')),
+ button(url('/admin-active', ['search' => $search]), '« ' . __('general.back')),
+ form_submit('ack', '» ' . __('Apply')),
], url('/admin-active', ['search' => $search, 'count' => $count, 'set_active' => 1]));
}
}
@@ -236,7 +236,7 @@ function admin_active()
$parameters['show_all_shifts'] = 1;
}
$actions[] = form(
- [form_submit('submit', __('set active'), 'btn-sm', false, 'secondary')],
+ [form_submit('submit', icon('plus-lg') . __('set active'), 'btn-sm', false, 'secondary')],
url('/admin-active', $parameters),
false,
true
@@ -251,7 +251,7 @@ function admin_active()
$parametersRemove['show_all_shifts'] = 1;
}
$actions[] = form(
- [form_submit('submit', __('remove active'), 'btn-sm', false, 'secondary')],
+ [form_submit('submit', icon('dash-lg') . __('Remove active'), 'btn-sm', false, 'secondary')],
url('/admin-active', $parametersRemove),
false,
true
@@ -268,7 +268,7 @@ function admin_active()
if ($goodie_enabled) {
$actions[] = form(
- [form_submit('submit', ($goodie_tshirt ? __('got T-shirt') : __('got goodie')), 'btn-sm', false, 'secondary')],
+ [form_submit('submit', icon('person') . ($goodie_tshirt ? __('Got T-shirt') : __('Got goodie')), 'btn-sm', false, 'secondary')],
url('/admin-active', $parametersShirt),
false,
true
@@ -286,7 +286,7 @@ function admin_active()
if ($goodie_enabled) {
$actions[] = form(
- [form_submit('submit', ($goodie_tshirt ? __('remove T-shirt') : __('remove goodie')), 'btn-sm', false, 'secondary')],
+ [form_submit('submit', icon('person') . ($goodie_tshirt ? __('Remove T-shirt') : __('Remove goodie')), 'btn-sm', false, 'secondary')],
url('/admin-active', $parameters),
false,
true
@@ -295,7 +295,7 @@ function admin_active()
}
if ($goodie_tshirt) {
- $actions[] = button(url('/admin/user/' . $usr->id . '/goodie'), __('form.edit'), 'btn-secondary btn-sm');
+ $actions[] = button(url('/admin/user/' . $usr->id . '/goodie'), icon('pencil') . __('form.edit'), 'btn-secondary btn-sm');
}
$userData['actions'] = buttons($actions);
@@ -328,11 +328,11 @@ function admin_active()
form([
form_text('search', __('Search angel:'), $search),
form_checkbox('show_all_shifts', __('Show all shifts'), $show_all_shifts),
- form_submit('submit', __('form.search')),
+ form_submit('submit', icon('search') . __('form.search')),
], url('/admin-active')),
$set_active == '' ? form([
form_text('count', __('How much angels should be active?'), $count ?: $forced_count),
- form_submit('set_active', __('form.preview')),
+ form_submit('set_active', icon('eye') . __('form.preview'), 'btn-info'),
]) : $set_active,
$msg . msg(),
table(
@@ -350,7 +350,7 @@ function admin_active()
],
($goodie_enabled ? ['tshirt' => ($goodie_tshirt ? __('T-shirt?') : __('Goodie?'))] : []),
[
- 'actions' => '',
+ 'actions' => __('general.actions'),
]
),
$matched_users
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index 2e4bce1a..fa3c877e 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -117,10 +117,15 @@ function admin_arrive()
form_hidden('user', $usr->id),
form_submit(
'submit',
- $usr->state->arrived ? __('reset') : __('user.arrived'),
+ $usr->state->arrived
+ ? icon('arrow-counterclockwise')
+ : icon('house'),
'btn-sm',
true,
- $usr->state->arrived ? 'secondary' : 'primary'
+ $usr->state->arrived ? 'secondary' : 'primary',
+ $usr->state->arrived
+ ? __('Reset')
+ : __('user.arrive')
),
]);
@@ -201,7 +206,7 @@ function admin_arrive()
$msg . msg(),
form([
form_text('search', __('form.search'), $search),
- form_submit('submit', __('form.search')),
+ form_submit('submit', icon('search') . __('form.search')),
], url('/admin-arrive')),
table([
'name' => __('general.name'),
@@ -209,7 +214,7 @@ function admin_arrive()
'arrived' => __('Arrived?'),
'rendered_arrival_date' => __('Arrival date'),
'rendered_planned_departure_date' => __('Planned departure'),
- 'actions' => '',
+ 'actions' => __('general.actions'),
], $users_matched),
div('row', [
div('col-md-4', [
diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php
index 19f13133..505d6974 100644
--- a/includes/pages/admin_free.php
+++ b/includes/pages/admin_free.php
@@ -110,7 +110,7 @@ function admin_free()
: icon('eye-slash'),
'actions' =>
auth()->can('admin_user')
- ? button(url('/admin-user', ['id' => $usr->id]), icon('pencil') . __('edit'), 'btn-sm')
+ ? button(url('/admin-user', ['id' => $usr->id]), icon('pencil'), 'btn-sm', '', __('form.edit'))
: '',
];
}
@@ -121,7 +121,7 @@ function admin_free()
div('row', [
form_text('search', __('form.search'), $search, null, null, null, 'col'),
form_select('angeltype', __('Angeltype'), $angel_types, $angelType, '', 'col'),
- form_submit('submit', __('form.search')),
+ form_submit('submit', icon('search') . __('form.search')),
]),
]),
]),
diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php
index 7086ebf2..c8539274 100644
--- a/includes/pages/admin_groups.php
+++ b/includes/pages/admin_groups.php
@@ -42,7 +42,10 @@ function admin_groups()
'/admin-groups',
['action' => 'edit', 'id' => $group->id]
),
- icon('pencil') . __('edit'),
+ icon('pencil'),
+ '',
+ '',
+ __('form.edit'),
'btn-sm'
),
];
@@ -79,7 +82,7 @@ function admin_groups()
);
}
- $privileges_form[] = form_submit('submit', __('form.save'));
+ $privileges_form[] = form_submit('submit', icon('save') . __('form.save'));
$html .= page_with_title(__('Edit group') . ' ' . htmlspecialchars($group->name), [
form(
$privileges_form,
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php
index 1b0e402e..96d073ea 100644
--- a/includes/pages/admin_shifts.php
+++ b/includes/pages/admin_shifts.php
@@ -371,7 +371,7 @@ function admin_shifts()
form_hidden('change_hours', implode(', ', $change_hours)),
form_hidden('angelmode', $angelmode),
form_hidden('shift_over_midnight', $shift_over_midnight ? 'true' : 'false'),
- form_submit('back', icon('chevron-left') . __('back')),
+ form_submit('back', icon('chevron-left') . __('general.back')),
$shiftsCreationHint,
table([
'timeslot' => __('Time and location'),
@@ -449,7 +449,7 @@ function admin_shifts()
. '';
}
- $link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm');
+ $link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm', '', __('general.back'));
return page_with_title(
$link . ' ' . admin_shifts_title() . ' ' . sprintf(
'%s',
@@ -556,7 +556,7 @@ function admin_shifts()
]),
]),
]),
- form_submit('preview', icon('search') . __('form.preview')),
+ form_submit('preview', icon('eye') . __('form.preview'), 'btn-info'),
]),
]
);
diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php
index 4f304479..0444457e 100644
--- a/includes/pages/admin_user.php
+++ b/includes/pages/admin_user.php
@@ -151,7 +151,8 @@ function admin_user()
$html .= '' . "\n";
$html .= '' . "\n" . '
' . "\n";
- $html .= '' . "\n";
+ $html .= '' . "\n";
$html .= '';
$html .= '
';
@@ -174,7 +175,8 @@ function admin_user()
. '' . "\n";
$html .= '' . "\n" . '
' . "\n";
- $html .= '' . "\n";
+ $html .= '' . "\n";
$html .= '';
$html .= '
';
@@ -212,14 +214,15 @@ function admin_user()
$html .= '
';
- $html .= '' . "\n";
+ $html .= '' . "\n";
$html .= '';
$html .= '
';
}
$html .= buttons([
- button(user_delete_link($user_source->id), icon('trash') . __('delete'), 'btn-danger'),
+ button(user_delete_link($user_source->id), icon('trash') . __('form.delete'), 'btn-danger'),
]);
$html .= '
';
@@ -350,7 +353,7 @@ function admin_user()
}
}
- $link = button(url('/users', ['action' => 'view', 'user_id' => $user_id]), icon('chevron-left'), 'btn-sm');
+ $link = button(url('/users', ['action' => 'view', 'user_id' => $user_id]), icon('chevron-left'), 'btn-sm', '', __('general.back'));
return page_with_title(
$link . ' ' . __('Edit user'),
[
diff --git a/includes/sys_form.php b/includes/sys_form.php
index 9970fc9c..676a4986 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -143,9 +143,9 @@ function form_info($label, $text = '')
* @param string $buttonType
* @return string
*/
-function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType = 'primary')
+function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType = 'primary', $title = '')
{
- $button = '