Part-DB.Part-DB-server/src/DataTables/Column/LogEntryTargetColumn.php

77 lines
2.5 KiB
PHP
Raw Normal View History

<?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);
namespace App\DataTables\Column;
use App\Entity\Attachments\Attachment;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\LogSystem\AbstractLogEntry;
use App\Entity\LogSystem\UserNotAllowedLogEntry;
use App\Entity\Parameters\AbstractParameter;
use App\Entity\Parts\PartLot;
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;
use App\Services\ElementTypeNameGenerator;
use App\Services\EntityURLGenerator;
2023-04-10 00:30:23 +02:00
use App\Services\LogSystem\LogTargetHelper;
use Doctrine\ORM\EntityManagerInterface;
use Omines\DataTablesBundle\Column\AbstractColumn;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
class LogEntryTargetColumn extends AbstractColumn
{
public function __construct(private readonly LogTargetHelper $logTargetHelper)
{
}
2022-08-14 19:09:07 +02:00
/**
* @param $value
* @return mixed
*/
public function normalize($value)
{
return $value;
}
2022-08-14 19:09:07 +02:00
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);
$resolver->setDefault('show_associated', true);
$resolver->setDefault('showAccessDeniedPath', true);
2020-03-15 13:56:31 +01:00
2020-02-01 19:42:28 +01:00
return $this;
}
2022-08-14 19:09:07 +02:00
public function render($value, $context): string
{
2023-04-10 00:30:23 +02:00
return $this->logTargetHelper->formatTarget($context, [
'showAccessDeniedPath' => $this->options['showAccessDeniedPath'],
'show_associated' => $this->options['show_associated'],
]);
}
2020-02-01 16:17:20 +01:00
}