|
20 | 20 | use App\Services\PdfExportService;
|
21 | 21 | use App\Services\ProgramService;
|
22 | 22 | use App\Services\UserService;
|
| 23 | +use App\Utils\Helpers; |
23 | 24 | use Doctrine\ORM\QueryBuilder;
|
24 | 25 | use Kdyby\Translation\Translator;
|
25 | 26 | use Nette\Application\UI\Control;
|
@@ -276,7 +277,7 @@ public function createComponentUsersGrid($name)
|
276 | 277 | $grid->addColumnDateTime('lastPaymentDate', 'admin.users.users_last_payment_date');
|
277 | 278 |
|
278 | 279 | $grid->addColumnDateTime('rolesApplicationDate', 'admin.users.users_roles_application_date')
|
279 |
| - ->setFormat('j. n. Y H:i'); |
| 280 | + ->setFormat(Helpers::DATETIME_FORMAT); |
280 | 281 |
|
281 | 282 | $columnAttended = $grid->addColumnStatus('attended', 'admin.users.users_attended');
|
282 | 283 | $columnAttended
|
@@ -309,13 +310,13 @@ public function createComponentUsersGrid($name)
|
309 | 310 | });
|
310 | 311 |
|
311 | 312 | foreach ($this->customInputRepository->findAllOrderedByPosition() as $customInput) {
|
312 |
| - $grid->addColumnText('customInput' . $customInput->getId(), $this->truncate($customInput->getName(), 20)) |
| 313 | + $grid->addColumnText('customInput' . $customInput->getId(), Helpers::truncate($customInput->getName(), 20)) |
313 | 314 | ->setRenderer(function (User $row) use ($customInput) {
|
314 | 315 | $customInputValue = $row->getCustomInputValue($customInput);
|
315 | 316 | if ($customInputValue) {
|
316 | 317 | switch ($customInputValue->getInput()->getType()) {
|
317 | 318 | case CustomInput::TEXT:
|
318 |
| - return $this->truncate($customInputValue->getValue(), 20); |
| 319 | + return Helpers::truncate($customInputValue->getValue(), 20); |
319 | 320 |
|
320 | 321 | case CustomInput::CHECKBOX:
|
321 | 322 | return $customInputValue->getValue()
|
@@ -703,21 +704,4 @@ private function preparePaymentMethodOptionsWithoutEmpty()
|
703 | 704 | $options[$type] = 'common.payment.' . $type;
|
704 | 705 | return $options;
|
705 | 706 | }
|
706 |
| - |
707 |
| - /** |
708 |
| - * Zkrátí $text na $length znaků a doplní '...'. |
709 |
| - * @param $text |
710 |
| - * @param $length |
711 |
| - * @return bool|string |
712 |
| - */ |
713 |
| - private function truncate($text, $length) |
714 |
| - { |
715 |
| - if (strlen($text) > $length) { |
716 |
| - $text = $text . " "; |
717 |
| - $text = mb_substr($text, 0, $length, 'UTF-8'); |
718 |
| - $text = mb_substr($text, 0, strrpos($text, ' '), 'UTF-8'); |
719 |
| - $text = $text . "..."; |
720 |
| - } |
721 |
| - return $text; |
722 |
| - } |
723 | 707 | }
|
0 commit comments