ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Logging\TestError Class Reference
+ Inheritance diagram for ILIAS\Test\Logging\TestError:
+ Collaboration diagram for ILIAS\Test\Logging\TestError:

Public Member Functions

 __construct (private readonly int $test_ref_id, private readonly ?int $question_id, private readonly ?int $admin_id, private readonly ?int $pax_id, private readonly TestErrorTypes $interaction_type, private readonly int $modification_timestamp, private readonly string $error_message)
 
 getUniqueIdentifier ()
 
 withId (int $id)
 
 getLogEntryAsDataTableRow (\ilLanguage $lng, TitleColumnsBuilder $title_builder, DataRowBuilder $row_builder, array $environment)
 
 getLogEntryAsExportRow (\ilLanguage $lng, TitleColumnsBuilder $title_builder, AdditionalInformationGenerator $additional_info, array $environment)
 
 getParsedAdditionalInformation (AdditionalInformationGenerator $additional_info, UIFactory $ui_factory, array $environment)
 
 toStorage ()
 
 getUniqueIdentifier ()
 
 withId (int $id)
 
 getLogEntryAsDataTableRow (\ilLanguage $lng, TitleColumnsBuilder $title_builder, DataRowBuilder $row_builder, array $environment)
 
 getLogEntryAsExportRow (\ilLanguage $lng, TitleColumnsBuilder $title_builder, AdditionalInformationGenerator $additional_info, array $environment)
 
 getParsedAdditionalInformation (AdditionalInformationGenerator $additional_info, UIFactory $ui_factory, array $environment)
 
 toStorage ()
 

Data Fields

const IDENTIFIER = 'te'
 
- Data Fields inherited from ILIAS\Test\Logging\TestUserInteraction
const LANG_VAR_PREFIX = 'logs_'
 

Private Member Functions

 getUserForPresentation (?int $user_id)
 

Private Attributes

int $id
 

Detailed Description

Definition at line 29 of file TestError.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Logging\TestError::__construct ( private readonly int  $test_ref_id,
private readonly ?int  $question_id,
private readonly ?int  $admin_id,
private readonly ?int  $pax_id,
private readonly TestErrorTypes  $interaction_type,
private readonly int  $modification_timestamp,
private readonly string  $error_message 
)

Definition at line 35 of file TestError.php.

43 {
44
45 }

Member Function Documentation

◆ getLogEntryAsDataTableRow()

ILIAS\Test\Logging\TestError::getLogEntryAsDataTableRow ( \ilLanguage  $lng,
TitleColumnsBuilder  $title_builder,
DataRowBuilder  $row_builder,
array  $environment 
)

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 59 of file TestError.php.

64 : DataRow {
65 $admin = $this->getUserForPresentation($this->admin_id);
66 $pax = $this->getUserForPresentation($this->pax_id);
67
68 $values = [
69 'date_and_time' => \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
70 ->setTimezone($environment['timezone']),
71 'corresponding_test' => $title_builder->buildTestTitleAsLink(
72 $this->test_ref_id
73 ),
74 'admin' => $admin,
75 'participant' => $pax,
76 'log_entry_type' => $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
77 'interaction_type' => $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value)
78 ];
79
80 if ($this->question_id !== null) {
81 $values['question'] = $title_builder->buildQuestionTitleAsLink(
82 $this->question_id,
83 $this->test_ref_id
84 );
85 }
86
87 return $row_builder->buildDataRow(
88 $this->getUniqueIdentifier(),
89 $values
90 );
91 }
getUserForPresentation(?int $user_id)
Definition: TestError.php:138
global $lng
Definition: privfeed.php:31

◆ getLogEntryAsExportRow()

ILIAS\Test\Logging\TestError::getLogEntryAsExportRow ( \ilLanguage  $lng,
TitleColumnsBuilder  $title_builder,
AdditionalInformationGenerator  $additional_info,
array  $environment 
)

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 93 of file TestError.php.

98 : array {
99 $admin = $this->getUserForPresentation($this->admin_id);
100 $pax = $this->getUserForPresentation($this->pax_id);
101
102 return [
103 \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
104 ->setTimezone($environment['timezone'])
105 ->format($environment['date_format']),
106 $title_builder->buildTestTitleAsText($this->test_ref_id),
107 $admin,
108 $pax,
109 '',
110 $title_builder->buildQuestionTitleAsText($this->question_id),
111 $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
112 $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value),
113 $this->error_message
114 ];
115 }

◆ getParsedAdditionalInformation()

ILIAS\Test\Logging\TestError::getParsedAdditionalInformation ( AdditionalInformationGenerator  $additional_info,
UIFactory  $ui_factory,
array  $environment 
)

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 117 of file TestError.php.

121 : Content {
122 return $ui_factory->legacy()->content($this->error_message);
123 }

◆ getUniqueIdentifier()

ILIAS\Test\Logging\TestError::getUniqueIdentifier ( )

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 47 of file TestError.php.

47 : ?string
48 {
49 return self::IDENTIFIER . '_' . $this->id;
50 }

References ILIAS\Test\Logging\TestError\$id.

◆ getUserForPresentation()

ILIAS\Test\Logging\TestError::getUserForPresentation ( ?int  $user_id)
private

Definition at line 138 of file TestError.php.

138 : string
139 {
140 if ($user_id === null) {
141 return '';
142 }
143 return \ilUserUtil::getNamePresentation(
144 $user_id,
145 false,
146 false,
147 '',
148 true
149 );
150 }

References $user_id.

◆ toStorage()

ILIAS\Test\Logging\TestError::toStorage ( )

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 125 of file TestError.php.

125 : array
126 {
127 return [
128 'ref_id' => [\ilDBConstants::T_INTEGER , $this->test_ref_id],
129 'qst_id' => [\ilDBConstants::T_INTEGER , $this->question_id],
130 'admin_id' => [\ilDBConstants::T_INTEGER , $this->admin_id],
131 'pax_id' => [\ilDBConstants::T_INTEGER , $this->pax_id],
132 'interaction_type' => [\ilDBConstants::T_TEXT , $this->interaction_type->value],
133 'modification_ts' => [\ilDBConstants::T_INTEGER , $this->modification_timestamp],
134 'error_message' => [\ilDBConstants::T_TEXT , $this->error_message]
135 ];
136 }

References ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\Test\Logging\TestLoggingDatabaseRepository\storeError().

+ Here is the caller graph for this function:

◆ withId()

ILIAS\Test\Logging\TestError::withId ( int  $id)

Implements ILIAS\Test\Logging\TestUserInteraction.

Definition at line 52 of file TestError.php.

52 : self
53 {
54 $clone = clone $this;
55 $clone->id = $id;
56 return $clone;
57 }

References ILIAS\Test\Logging\TestError\$id.

Field Documentation

◆ $id

int ILIAS\Test\Logging\TestError::$id
private

◆ IDENTIFIER

const ILIAS\Test\Logging\TestError::IDENTIFIER = 'te'

Definition at line 31 of file TestError.php.


The documentation for this class was generated from the following file: