ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TestLoggingSettings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\UI\Factory as UIFactory;
24use ILIAS\Refinery\Factory as Refinery;
25
27{
28 public function __construct(
29 private bool $logging_enabled = false,
30 private bool $ip_logging_enabled = true
31 ) {
32 }
33
38 public function toForm(
39 UIFactory $ui_factory,
42 ): array {
43 $trafo = $refinery->custom()->transformation(
44 static fn($vs): self => new self($vs['activation'], $vs['ip_logging'])
45 );
46 return [
47 'logging' => $ui_factory->input()->field()->section(
48 [
49 'activation' => $ui_factory->input()->field()->checkbox(
50 $lng->txt('activate_logging')
51 )->withValue($this->isLoggingEnabled()),
52 'ip_logging' => $ui_factory->input()->field()->checkbox(
53 $lng->txt('log_ip')
54 )->withByline($lng->txt('log_ip_info'))
55 ->withValue($this->isIPLoggingEnabled())
56 ],
57 $lng->txt('logging_settings')
58 )->withAdditionalTransformation($trafo)
59 ];
60 }
61
62 public function isLoggingEnabled(): bool
63 {
64 return $this->logging_enabled;
65 }
66
67 public function withLoggingEnabled(bool $logging_enabled): self
68 {
69 $clone = clone $this;
70 $clone->logging_enabled = $logging_enabled;
71 return $clone;
72 }
73
74 public function isIPLoggingEnabled(): bool
75 {
76 return $this->ip_logging_enabled;
77 }
78
79 public function withIPLoggingEnabled(bool $ip_logging_enabled): self
80 {
81 $clone = clone $this;
82 $clone->ip_logging_enabled = $ip_logging_enabled;
83 return $clone;
84 }
85}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
toForm(UIFactory $ui_factory, Refinery $refinery, \ilLanguage $lng)
__construct(private bool $logging_enabled=false, private bool $ip_logging_enabled=true)
language handling
global $lng
Definition: privfeed.php:31