2020-01-24 22:57:04 +01:00
|
|
|
<?php
|
2020-02-22 18:14:36 +01:00
|
|
|
/**
|
|
|
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
|
|
|
*
|
2022-11-29 22:28:53 +01:00
|
|
|
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics)
|
2020-02-22 18:14:36 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-02-01 16:17:20 +01:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-01-24 22:57:04 +01:00
|
|
|
namespace App\DataTables\Column;
|
|
|
|
|
2020-03-28 18:46:15 +01:00
|
|
|
use App\Entity\Attachments\Attachment;
|
2020-02-01 19:48:07 +01:00
|
|
|
use App\Entity\Base\AbstractDBElement;
|
2020-03-28 18:55:02 +01:00
|
|
|
use App\Entity\Contracts\NamedElementInterface;
|
2020-01-24 22:57:04 +01:00
|
|
|
use App\Entity\LogSystem\AbstractLogEntry;
|
2020-04-10 12:28:15 +02:00
|
|
|
use App\Entity\LogSystem\UserNotAllowedLogEntry;
|
2020-03-28 18:46:15 +01:00
|
|
|
use App\Entity\Parameters\AbstractParameter;
|
2020-03-28 18:50:16 +01:00
|
|
|
use App\Entity\Parts\PartLot;
|
2020-03-28 18:46:15 +01:00
|
|
|
use App\Entity\PriceInformations\Orderdetail;
|
|
|
|
use App\Entity\PriceInformations\Pricedetail;
|
2023-01-08 19:14:24 +01:00
|
|
|
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
2020-02-13 23:06:39 +01:00
|
|
|
use App\Exceptions\EntityNotSupportedException;
|
2022-09-18 22:59:31 +02:00
|
|
|
use App\Repository\LogEntryRepository;
|
2020-01-24 22:57:04 +01:00
|
|
|
use App\Services\ElementTypeNameGenerator;
|
|
|
|
use App\Services\EntityURLGenerator;
|
2023-04-10 00:30:23 +02:00
|
|
|
use App\Services\LogSystem\LogTargetHelper;
|
2020-01-24 22:57:04 +01:00
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
|
use Omines\DataTablesBundle\Column\AbstractColumn;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
|
|
|
|
|
|
class LogEntryTargetColumn extends AbstractColumn
|
|
|
|
{
|
2023-06-11 14:15:46 +02:00
|
|
|
public function __construct(private readonly LogTargetHelper $logTargetHelper)
|
2020-01-24 22:57:04 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-14 19:09:07 +02:00
|
|
|
/**
|
|
|
|
* @param $value
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2020-01-24 22:57:04 +01:00
|
|
|
public function normalize($value)
|
|
|
|
{
|
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
|
2022-08-14 19:09:07 +02:00
|
|
|
public function configureOptions(OptionsResolver $resolver): self
|
2020-01-24 22:57:04 +01:00
|
|
|
{
|
|
|
|
parent::configureOptions($resolver);
|
2020-03-28 18:46:15 +01:00
|
|
|
$resolver->setDefault('show_associated', true);
|
2020-04-10 12:28:15 +02:00
|
|
|
$resolver->setDefault('showAccessDeniedPath', true);
|
2020-03-15 13:56:31 +01:00
|
|
|
|
2020-02-01 19:42:28 +01:00
|
|
|
return $this;
|
2020-01-24 22:57:04 +01:00
|
|
|
}
|
|
|
|
|
2022-08-14 19:09:07 +02:00
|
|
|
public function render($value, $context): string
|
2020-01-24 22:57:04 +01:00
|
|
|
{
|
2023-04-10 00:30:23 +02:00
|
|
|
return $this->logTargetHelper->formatTarget($context, [
|
|
|
|
'showAccessDeniedPath' => $this->options['showAccessDeniedPath'],
|
|
|
|
'show_associated' => $this->options['show_associated'],
|
|
|
|
]);
|
2020-01-24 22:57:04 +01:00
|
|
|
}
|
2020-02-01 16:17:20 +01:00
|
|
|
}
|