1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
<?php
use Engelsystem\Models\User\User;
/**
* @param array $user_angeltype
* @param User $user
* @param array $angeltype
* @param bool $supporter
* @return string
*/
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
{
return page_with_title($supporter ? __('Add supporter rights') : __('Remove supporter rights'), [
msg(),
info(sprintf(
$supporter
? __('Do you really want to add supporter rights for %s to %s?')
: __('Do you really want to remove supporter rights for %s from %s?'),
$angeltype['name'],
User_Nick_render($user)
), true),
form([
buttons([
button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
glyph('remove') . __('cancel')
),
form_submit('submit', glyph('ok') . __('yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', [
'action' => 'update',
'user_angeltype_id' => $user_angeltype['id'],
'supporter' => ($supporter ? '1' : '0'),
])),
]);
}
/**
* @param array $angeltype
* @return string
*/
function UserAngelTypes_delete_all_view($angeltype)
{
return page_with_title(__('Deny all users'), [
msg(),
info(sprintf(__('Do you really want to deny all users for %s?'), $angeltype['name']), true),
form([
buttons([
button(
page_link_to(
'angeltypes',
['action' => 'view', 'angeltype_id' => $angeltype['id']]
),
glyph('remove') . __('cancel')
),
form_submit('deny_all', glyph('ok') . __('yes'), 'btn-primary', false)
]),
], page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']])),
]);
}
/**
* @param array $angeltype
* @return string
*/
function UserAngelTypes_confirm_all_view($angeltype)
{
return page_with_title(__('Confirm all users'), [
msg(),
info(sprintf(__('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
form([
buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
form_submit('confirm_all', glyph('ok') . __('yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']])),
]);
}
/**
* @param array $user_angeltype
* @param User $user
* @param array $angeltype
* @return string
*/
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
{
return page_with_title(__('Confirm angeltype for user'), [
msg(),
info(sprintf(
__('Do you really want to confirm %s for %s?'),
User_Nick_render($user),
$angeltype['name']
), true),
form([
buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
form_submit('confirm_user', glyph('ok') . __('yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id']])),
]);
}
/**
* @param array $user_angeltype
* @param User $user
* @param array $angeltype
* @return string
*/
function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
{
return page_with_title(__('Remove angeltype'), [
msg(),
info(sprintf(
__('Do you really want to delete %s from %s?'),
User_Nick_render($user),
$angeltype['name']
), true),
form([
buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
form_submit('delete', glyph('ok') . __('yes'), 'btn-primary', false),
]),
], page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']])),
], true);
}
/**
* @param array $angeltype
* @param User[] $users_source
* @param int $user_id
* @return string
*/
function UserAngelType_add_view($angeltype, $users_source, $user_id)
{
$users = [];
foreach ($users_source as $user_source) {
$users[$user_source->id] = User_Nick_render($user_source);
}
return page_with_title(__('Add user to angeltype'), [
msg(),
buttons([
button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
__('back'),
'back'
)
]),
form([
form_info(__('Angeltype'), $angeltype['name']),
form_select('user_id', __('User'), $users, $user_id),
form_submit('submit', __('Add'))
])
]);
}
/**
* @param User $user
* @param array $angeltype
* @return string
*/
function UserAngelType_join_view($user, $angeltype)
{
return page_with_title(sprintf(__('Become a %s'), $angeltype['name']), [
msg(),
info(sprintf(
__('Do you really want to add %s to %s?'),
User_Nick_render($user),
$angeltype['name']
), true),
form([
buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
form_submit('submit', glyph('ok') . __('save'), 'btn-primary', false)
]),
], page_link_to(
'user_angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user->id]
)),
]);
}
|