ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
TestAdministrationInteraction.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Test\Logging;
22 
24 
29 
31 {
32  public const IDENTIFIER = 'tai';
33 
34  private int $id;
35 
39  public function __construct(
40  private readonly int $test_ref_id,
41  private readonly int $admin_id,
42  private readonly TestAdministrationInteractionTypes $interaction_type,
43  private readonly int $modification_timestamp,
44  private readonly array $additional_data
45  ) {
46 
47  }
48 
49  public function getUniqueIdentifier(): ?string
50  {
51  return self::IDENTIFIER . '_' . $this->id;
52  }
53 
54  public function withId(int $id): self
55  {
56  $clone = clone $this;
57  $clone->id = $id;
58  return $clone;
59  }
60 
61  public function getLogEntryAsDataTableRow(
63  TitleColumnsBuilder $title_builder,
64  DataRowBuilder $row_builder,
65  array $environment
66  ): DataRow {
67  return $row_builder->buildDataRow(
68  $this->getUniqueIdentifier(),
69  [
70  'date_and_time' => \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
71  ->setTimezone($environment['timezone']),
72  'corresponding_test' => $title_builder->buildTestTitleAsLink(
73  $this->test_ref_id
74  ),
76  $this->admin_id,
77  false,
78  false,
79  '',
80  true
81  ),
82  'log_entry_type' => $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
83  'interaction_type' => $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value)
84  ]
85  )->withDisabledAction(
87  $this->additional_data === []
88  );
89  }
90 
91  public function getLogEntryAsExportRow(
93  TitleColumnsBuilder $title_builder,
94  AdditionalInformationGenerator $additional_info,
95  array $environment
96  ): array {
97  return [
98  \DateTimeImmutable::createFromFormat('U', (string) $this->modification_timestamp)
99  ->setTimezone($environment['timezone'])
100  ->format($environment['date_format']),
101  $title_builder->buildTestTitleAsText($this->test_ref_id),
103  $this->admin_id,
104  false,
105  false,
106  '',
107  true
108  ),
109  '',
110  '',
111  '',
112  $lng->txt(self::LANG_VAR_PREFIX . self::IDENTIFIER),
113  $lng->txt(self::LANG_VAR_PREFIX . $this->interaction_type->value),
114  $additional_info->parseForExport($this->additional_data, $environment)
115  ];
116  }
117 
119  AdditionalInformationGenerator $additional_info,
120  UIFactory $ui_factory,
121  array $environment
122  ): DescriptiveListing {
123  return $additional_info->parseForTable($this->additional_data, $environment);
124  }
125 
126  public function toStorage(): array
127  {
128  return [
129  'ref_id' => [\ilDBConstants::T_INTEGER , $this->test_ref_id],
130  'admin_id' => [\ilDBConstants::T_INTEGER , $this->admin_id],
131  'interaction_type' => [\ilDBConstants::T_TEXT , $this->interaction_type->value],
132  'modification_ts' => [\ilDBConstants::T_INTEGER , $this->modification_timestamp],
133  'additional_data' => [\ilDBConstants::T_CLOB , json_encode($this->additional_data)]
134  ];
135  }
136 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
parseForExport(array $additional_info, array $environment)
buildDataRow(string $id, array $record)
getLogEntryAsDataTableRow(\ilLanguage $lng, TitleColumnsBuilder $title_builder, DataRowBuilder $row_builder, array $environment)
__construct(private readonly int $test_ref_id, private readonly int $admin_id, private readonly TestAdministrationInteractionTypes $interaction_type, private readonly int $modification_timestamp, private readonly array $additional_data)
getLogEntryAsExportRow(\ilLanguage $lng, TitleColumnsBuilder $title_builder, AdditionalInformationGenerator $additional_info, array $environment)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
getParsedAdditionalInformation(AdditionalInformationGenerator $additional_info, UIFactory $ui_factory, array $environment)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:31
parseForTable(array $additional_info, array $environment)