ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Test\Utilities\TitleColumnsBuilder Class Reference
+ Collaboration diagram for ILIAS\Test\Utilities\TitleColumnsBuilder:

Public Member Functions

 __construct (private readonly GeneralQuestionPropertiesRepository $properties_repository, private readonly \ilCtrl $ctrl, private readonly \ilAccessHandler $access, private readonly \ilLanguage $lng, private readonly StaticURLServices $static_url, private readonly UIFactory $ui_factory, private readonly Refinery $refinery)
 
 buildQuestionTitleAsLink (int $question_id, int $test_ref_id)
 
 buildQuestionTitleAsText (?int $question_id)
 
 buildTestTitleAsLink (int $test_ref_id)
 
 buildTestTitleAsText (int $test_ref_id)
 
 buildAccessCheckedTestTitleAsLinkForObjId (int $test_obj_id, string $title)
 
 buildAccessCheckedQuestionpoolTitleAsLink (?int $qpl_id, ?string $title=null, bool $reference=false)
 

Private Member Functions

 buildPossiblyLinkedTitle (int $obj_id, string $title, string $target_class_type, bool $reference=false)
 
 getLinkedTitle (int $ref_id, string $title, string $target_class_type)
 
 getFirstReferenceWithCurrentUserAccess (bool $reference, int $obj_id, array $all_ref_ids)
 

Detailed Description

Definition at line 30 of file TitleColumnsBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Utilities\TitleColumnsBuilder::__construct ( private readonly GeneralQuestionPropertiesRepository  $properties_repository,
private readonly \ilCtrl  $ctrl,
private readonly \ilAccessHandler  $access,
private readonly \ilLanguage  $lng,
private readonly StaticURLServices  $static_url,
private readonly UIFactory  $ui_factory,
private readonly Refinery  $refinery 
)

Definition at line 32 of file TitleColumnsBuilder.php.

40  {
41  }

Member Function Documentation

◆ buildAccessCheckedQuestionpoolTitleAsLink()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildAccessCheckedQuestionpoolTitleAsLink ( ?int  $qpl_id,
?string  $title = null,
bool  $reference = false 
)

Definition at line 130 of file TitleColumnsBuilder.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Test\Utilities\TitleColumnsBuilder\buildPossiblyLinkedTitle(), ILIAS\Repository\lng(), and null.

Referenced by ILIAS\Test\Questions\Properties\Properties\getAsQuestionsTableRow().

134  : StandardLink {
135  if ($qpl_id === null) {
136  return $this->ui_factory->link()->standard(
137  $title ?? $this->lng->txt('tst_question_not_from_pool_info'),
138  ''
139  )->withDisabled();
140  }
141 
142  if (\ilObject::_lookupType($qpl_id, $reference) !== 'qpl') {
143  return $this->ui_factory->link()->standard(
144  $this->lng->txt('tst_question_not_from_pool_info'),
145  ''
146  )->withDisabled();
147  }
148 
149  $qpl_obj_id = $qpl_id;
150  if ($reference) {
151  $qpl_obj_id = \ilObject::_lookupObjId($qpl_id);
152  }
153 
154  return $this->buildPossiblyLinkedTitle(
155  $qpl_obj_id,
156  $title ?? \ilObject::_lookupTitle($qpl_obj_id),
157  \ilObjQuestionPoolGUI::class,
158  $reference
159  );
160  }
buildPossiblyLinkedTitle(int $obj_id, string $title, string $target_class_type, bool $reference=false)
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildAccessCheckedTestTitleAsLinkForObjId()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildAccessCheckedTestTitleAsLinkForObjId ( int  $test_obj_id,
string  $title 
)

Definition at line 119 of file TitleColumnsBuilder.php.

References ILIAS\Test\Utilities\TitleColumnsBuilder\buildPossiblyLinkedTitle().

122  : StandardLink {
123  return $this->buildPossiblyLinkedTitle(
124  $test_obj_id,
125  $title,
126  \ilObjTestGUI::class
127  );
128  }
buildPossiblyLinkedTitle(int $obj_id, string $title, string $target_class_type, bool $reference=false)
+ Here is the call graph for this function:

◆ buildPossiblyLinkedTitle()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildPossiblyLinkedTitle ( int  $obj_id,
string  $title,
string  $target_class_type,
bool  $reference = false 
)
private

Definition at line 162 of file TitleColumnsBuilder.php.

References $ref_id, ilObject\_getAllReferences(), ILIAS\Test\Utilities\TitleColumnsBuilder\getFirstReferenceWithCurrentUserAccess(), ILIAS\Test\Utilities\TitleColumnsBuilder\getLinkedTitle(), and null.

Referenced by ILIAS\Test\Utilities\TitleColumnsBuilder\buildAccessCheckedQuestionpoolTitleAsLink(), and ILIAS\Test\Utilities\TitleColumnsBuilder\buildAccessCheckedTestTitleAsLinkForObjId().

167  : StandardLink {
169  $reference,
170  $obj_id,
172  );
173 
174  if ($ref_id === null) {
175  return $this->ui_factory->link()->standard(
176  "{$title} ({$this->lng->txt('status_no_permission')})",
177  ''
178  )->withDisabled();
179  }
180 
181  return $this->getLinkedTitle($ref_id, $title, $target_class_type);
182  }
static _getAllReferences(int $id)
get all reference ids for object ID
getLinkedTitle(int $ref_id, string $title, string $target_class_type)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
getFirstReferenceWithCurrentUserAccess(bool $reference, int $obj_id, array $all_ref_ids)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionTitleAsLink()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildQuestionTitleAsLink ( int  $question_id,
int  $test_ref_id 
)

Definition at line 43 of file TitleColumnsBuilder.php.

References null, and ILIAS\Repository\refinery().

Referenced by ILIAS\Test\Logging\TestError\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsDataTableRow(), and ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsDataTableRow().

46  : StandardLink {
47  $question_title = $this->properties_repository->getForQuestionId($question_id)?->getTitle();
48 
49  if ($question_title === null) {
50  return $this->ui_factory->link()->standard(
51  "{$this->lng->txt('deleted')} ({$this->lng->txt('id')}: {$question_id})",
52  ''
53  )->withDisabled();
54  }
55 
56  return $this->ui_factory->link()->standard(
57  $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform(
58  $this->properties_repository->getForQuestionId($question_id)?->getTitle()
59  ),
60  $this->static_url->builder()->build(
61  'tst',
62  new ReferenceId($test_ref_id),
63  ['qst', $question_id]
64  )->__toString()
65  );
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionTitleAsText()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildQuestionTitleAsText ( ?int  $question_id)

Definition at line 68 of file TitleColumnsBuilder.php.

References null, and ILIAS\Repository\refinery().

Referenced by ILIAS\Test\Logging\TestError\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsExportRow(), and ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsExportRow().

70  : string {
71  if ($question_id === null) {
72  return '';
73  }
74  $question_title = $this->properties_repository->getForQuestionId($question_id)?->getTitle();
75 
76  if ($question_title === null) {
77  return "{$this->lng->txt('deleted')} ({$this->lng->txt('id')}: {$question_id})";
78  }
79 
80  return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($question_title);
81  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTestTitleAsLink()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildTestTitleAsLink ( int  $test_ref_id)

Definition at line 83 of file TitleColumnsBuilder.php.

References ilObject\_isInTrash(), ilObject\_lookupObjId(), and ilObject\_lookupTitle().

Referenced by ILIAS\Test\Logging\TestError\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestAdministrationInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsDataTableRow(), and ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsDataTableRow().

83  : StandardLink
84  {
85  $test_obj_id = \ilObject::_lookupObjId($test_ref_id);
86  if ($test_obj_id === 0) {
87  return $this->ui_factory->link()->standard(
88  "{$this->lng->txt('deleted')} ({$this->lng->txt('id')}: {$test_ref_id})",
89  ''
90  )->withDisabled();
91  }
92 
93  if (\ilObject::_isInTrash($test_ref_id)) {
94  return $this->ui_factory->link()->standard(
95  "{$this->lng->txt('in_trash')} ({$this->lng->txt('title')}: "
96  . \ilObject::_lookupTitle($test_obj_id) . ", {$this->lng->txt('id')}: {$test_ref_id})",
97  ''
98  );
99  }
100 
101  return $this->ui_factory->link()->standard(
102  \ilObject::_lookupTitle($test_obj_id),
103  $this->static_url->builder()->build('tst', new ReferenceId($test_ref_id))->__toString()
104  );
105  }
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _isInTrash(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTestTitleAsText()

ILIAS\Test\Utilities\TitleColumnsBuilder::buildTestTitleAsText ( int  $test_ref_id)

Definition at line 107 of file TitleColumnsBuilder.php.

References ilObject\_lookupObjId().

Referenced by ILIAS\Test\Logging\TestAdministrationInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestError\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsExportRow(), and ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsExportRow().

107  : string
108  {
109  $test_obj_id = \ilObject::_lookupObjId($test_ref_id);
110  if ($test_obj_id === 0) {
111  return "{$this->lng->txt('deleted')} ({$this->lng->txt('id')}: {$test_ref_id})";
112  }
113 
114  return \ilObject::_lookupTitle($test_obj_id);
115  }
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstReferenceWithCurrentUserAccess()

ILIAS\Test\Utilities\TitleColumnsBuilder::getFirstReferenceWithCurrentUserAccess ( bool  $reference,
int  $obj_id,
array  $all_ref_ids 
)
private

Definition at line 200 of file TitleColumnsBuilder.php.

References $ref_id, ILIAS\Repository\access(), and null.

Referenced by ILIAS\Test\Utilities\TitleColumnsBuilder\buildPossiblyLinkedTitle().

204  : ?int {
205  if ($reference && $this->access->checkAccess('read', '', $obj_id)) {
206  return $obj_id;
207  }
208 
209  $references_with_access = array_filter(
210  array_values($all_ref_ids),
211  function (int $ref_id): bool {
212  return $this->access->checkAccess('read', '', $ref_id);
213  }
214  );
215  if ($references_with_access !== []) {
216  return array_shift($references_with_access);
217  }
218  return null;
219  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLinkedTitle()

ILIAS\Test\Utilities\TitleColumnsBuilder::getLinkedTitle ( int  $ref_id,
string  $title,
string  $target_class_type 
)
private

Definition at line 184 of file TitleColumnsBuilder.php.

References ILIAS\Repository\ctrl().

Referenced by ILIAS\Test\Utilities\TitleColumnsBuilder\buildPossiblyLinkedTitle().

188  : StandardLink {
189  $this->ctrl->setParameterByClass($target_class_type, 'ref_id', $ref_id);
190  $linked_title = $this->ui_factory->link()->standard(
191  $title,
192  $this->ctrl->getLinkTargetByClass(
193  [$target_class_type]
194  )
195  );
196  $this->ctrl->clearParametersByClass($target_class_type);
197  return $linked_title;
198  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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