@@ -120,50 +120,56 @@ public function createComponentProgramBlocksGrid(string $name): void
120
120
$ grid ->setColumnsHideable ();
121
121
$ grid ->setStrictSessionFilterValues (false );
122
122
123
- $ grid ->addGroupAction ('admin.program.blocks_group_action_export_blocks_attendees ' )
124
- ->onSelect [] = [$ this , 'groupExportBlocksAttendees ' ];
125
-
126
- $ grid ->addColumnText ('name ' , 'admin.program.blocks_name ' )
123
+ $ grid ->addColumnText ('name ' , 'admin.program.blocks.common.name ' )
127
124
->setSortable ()
128
125
->setFilterText ();
129
126
130
- $ grid ->addColumnText ('subevent ' , 'admin.program.blocks_subevent ' , 'subevent.name ' )
127
+ $ grid ->addColumnText ('subevent ' , 'admin.program.blocks.common.subevent ' , 'subevent.name ' )
131
128
->setSortable ('s.name ' )
132
129
->setFilterMultiSelect ($ this ->subeventService ->getSubeventsOptions (), 's.id ' );
133
130
134
- $ grid ->addColumnText ('category ' , 'admin.program.blocks_category ' , 'category.name ' )
131
+ $ grid ->addColumnText ('category ' , 'admin.program.blocks.common.category ' , 'category.name ' )
135
132
->setSortable ('c.name ' )
136
133
->setFilterMultiSelect ($ this ->categoryRepository ->getCategoriesOptions (), 'c.id ' );
137
134
138
- $ grid ->addColumnText ('lectors ' , 'admin.program.blocks_lectors ' , 'lectorsText ' )
135
+ $ grid ->addColumnText ('lectors ' , 'admin.program.blocks.common.lectors ' , 'lectorsText ' )
139
136
->setFilterMultiSelect ($ this ->userRepository ->getLectorsOptions ())
140
137
->setCondition (static function (QueryBuilder $ qb , ArrayHash $ values ): void {
141
138
$ qb ->join ('b.lectors ' , 'l ' )
142
139
->andWhere ('l.id IN (:lids) ' )
143
140
->setParameter ('lids ' , (array ) $ values );
144
141
});
145
142
146
- $ grid ->addColumnNumber ('duration ' , 'admin.program.blocks_duration ' )
143
+ $ grid ->addColumnNumber ('duration ' , 'admin.program.blocks.common.duration ' )
147
144
->setSortable ()
148
145
->setFilterText ();
149
146
150
- $ grid ->addColumnText ('capacity ' , 'admin.program.blocks_capacity ' )
147
+ $ grid ->addColumnText ('capacity ' , 'admin.program.blocks.common.capacity ' )
151
148
->setRendererOnCondition (function ($ row ) {
152
- return $ this ->translator ->translate ('admin.program.blocks_capacity_unlimited ' );
149
+ return $ this ->translator ->translate ('admin.program.blocks.common.capacity_unlimited ' );
153
150
}, static function (Block $ row ) {
154
151
return $ row ->getCapacity () === null ;
155
152
})
156
153
->setSortable ();
157
154
158
- $ columnMandatory = $ grid ->addColumnStatus ('mandatory ' , 'admin.program.blocks_mandatory ' );
155
+ $ grid ->addColumnText ('alternatesAllowed ' , 'admin.program.blocks.column.alternates_allowed ' )
156
+ ->setReplacement ([
157
+ '0 ' => $ this ->translator ->translate ('admin.common.no ' ),
158
+ '1 ' => $ this ->translator ->translate ('admin.common.yes ' ),
159
+ ])
160
+ ->setSortable ()
161
+ ->setFilterSelect ([null => 'admin.common.all ' , 1 => 'admin.common.yes ' , 0 => 'admin.common.no ' ])
162
+ ->setTranslateOptions ();
163
+
164
+ $ columnMandatory = $ grid ->addColumnStatus ('mandatory ' , 'admin.program.blocks.common.mandatory ' );
159
165
$ columnMandatory
160
- ->addOption (ProgramMandatoryType::VOLUNTARY , 'admin.program.blocks_mandatory_voluntary ' )
166
+ ->addOption (ProgramMandatoryType::VOLUNTARY , 'common.program_mandatory_type.voluntary ' )
161
167
->setClass ('btn-primary ' )
162
168
->endOption ()
163
- ->addOption (ProgramMandatoryType::MANDATORY , 'admin.program.blocks_mandatory_mandatory ' )
169
+ ->addOption (ProgramMandatoryType::MANDATORY , 'common.program_mandatory_type.mandatory ' )
164
170
->setClass ('btn-danger ' )
165
171
->endOption ()
166
- ->addOption (ProgramMandatoryType::AUTO_REGISTERED , 'admin.program.blocks_mandatory_auto_registered ' )
172
+ ->addOption (ProgramMandatoryType::AUTO_REGISTERED , 'common.program_mandatory_type.auto_registered ' )
167
173
->setClass ('btn-warning ' )
168
174
->endOption ()
169
175
->onChange [] = [$ this , 'changeMandatory ' ];
@@ -172,13 +178,13 @@ public function createComponentProgramBlocksGrid(string $name): void
172
178
->setSortable ()
173
179
->setFilterSelect ([
174
180
'' => 'admin.common.all ' ,
175
- ProgramMandatoryType::VOLUNTARY => 'admin.program.blocks_mandatory_voluntary ' ,
176
- ProgramMandatoryType::MANDATORY => 'admin.program.blocks_mandatory_mandatory ' ,
177
- ProgramMandatoryType::AUTO_REGISTERED => 'admin.program.blocks_mandatory_auto_registered ' ,
181
+ ProgramMandatoryType::VOLUNTARY => 'common.program_mandatory_type.voluntary ' ,
182
+ ProgramMandatoryType::MANDATORY => 'common.program_mandatory_type.mandatory ' ,
183
+ ProgramMandatoryType::AUTO_REGISTERED => 'common.program_mandatory_type.auto_registered ' ,
178
184
])
179
185
->setTranslateOptions ();
180
186
181
- $ grid ->addColumnNumber ('programsCount ' , 'admin.program.blocks_programs_count ' )
187
+ $ grid ->addColumnNumber ('programsCount ' , 'admin.program.blocks.column.programs_count ' )
182
188
->setRenderer (static function (Block $ row ) {
183
189
return $ row ->getProgramsCount ();
184
190
});
@@ -205,9 +211,12 @@ public function createComponentProgramBlocksGrid(string $name): void
205
211
->setClass ('btn btn-xs btn-danger ' )
206
212
->addAttributes ([
207
213
'data-toggle ' => 'confirmation ' ,
208
- 'data-content ' => $ this ->translator ->translate ('admin.program.blocks_delete_confirm ' ),
214
+ 'data-content ' => $ this ->translator ->translate ('admin.program.blocks.action.delete_confirm ' ),
209
215
]);
210
216
$ grid ->allowRowsAction ('delete ' , [$ this , 'isAllowedModifyBlock ' ]);
217
+
218
+ $ grid ->addGroupAction ('admin.program.blocks.action.export_blocks_attendees ' )
219
+ ->onSelect [] = [$ this , 'groupExportBlocksAttendees ' ];
211
220
}
212
221
213
222
/**
@@ -221,13 +230,13 @@ public function handleDelete(int $id): void
221
230
$ block = $ this ->blockRepository ->findById ($ id );
222
231
223
232
if (! $ this ->userRepository ->findById ($ this ->getPresenter ()->getUser ()->getId ())->isAllowedModifyBlock ($ block )) {
224
- $ this ->getPresenter ()->flashMessage ('admin.program.blocks_delete_not_allowed ' , 'danger ' );
233
+ $ this ->getPresenter ()->flashMessage ('admin.program.blocks.message.delete_not_allowed ' , 'danger ' );
225
234
$ this ->redirect ('this ' );
226
235
}
227
236
228
237
$ this ->commandBus ->handle (new RemoveBlock ($ block ));
229
238
230
- $ this ->getPresenter ()->flashMessage ('admin.program.blocks_deleted ' , 'success ' );
239
+ $ this ->getPresenter ()->flashMessage ('admin.program.blocks.message.delete_success ' , 'success ' );
231
240
232
241
$ this ->redirect ('this ' );
233
242
}
@@ -244,18 +253,18 @@ public function changeMandatory(string $id, string $mandatory): void
244
253
$ p = $ this ->getPresenter ();
245
254
246
255
if (! $ this ->isAllowedModifyBlock ($ block )) {
247
- $ p ->flashMessage ('admin.program.blocks_change_mandatory_denied ' , 'danger ' );
256
+ $ p ->flashMessage ('admin.program.blocks.message.mandatory_change_denied ' , 'danger ' );
248
257
} elseif ($ mandatory === ProgramMandatoryType::AUTO_REGISTERED && ! $ this ->validators ->validateBlockAutoRegistered ($ block , $ block ->getCapacity ())) {
249
- $ p ->flashMessage ('admin.program.blocks_change_mandatory_auto_registered_not_allowed ' , 'danger ' );
258
+ $ p ->flashMessage ('admin.program.blocks.message.mandatory_change_auto_registered_not_allowed ' , 'danger ' );
250
259
} else {
251
260
try {
252
261
$ blockOld = clone $ block ;
253
262
$ block ->setMandatory ($ mandatory );
254
263
$ this ->commandBus ->handle (new SaveBlock ($ block , $ blockOld ));
255
- $ p ->flashMessage ('admin.program.blocks_changed_mandatory ' , 'success ' );
264
+ $ p ->flashMessage ('admin.program.blocks.message.mandatory_change_success ' , 'success ' );
256
265
} catch (Throwable $ ex ) {
257
266
Debugger::log ($ ex , ILogger::WARNING );
258
- $ p ->flashMessage ('admin.program.blocks_change_mandatory_error ' , 'danger ' );
267
+ $ p ->flashMessage ('admin.program.blocks.message.mandatory_change_failed ' , 'danger ' );
259
268
}
260
269
}
261
270
0 commit comments