19declare(strict_types=1);
29trait QuestionPoolLinkedTitleBuilder
31 public function buildPossiblyLinkedTestTitle(
35 UIFactory $ui_factory,
36 UIRenderer $ui_renderer,
40 return $this->buildPossiblyLinkedTitle(
52 public function buildPossiblyLinkedQuestonPoolTitle(
56 UIFactory $ui_factory,
57 UIRenderer $ui_renderer,
60 bool $reference =
false
62 if ($qpl_id === null) {
67 return $lng->txt(
'tst_question_not_from_pool_info');
70 return $this->buildPossiblyLinkedTitle(
78 \ilObjQuestionPoolGUI::class,
83 private function buildPossiblyLinkedTitle(
87 UIFactory $ui_factory,
88 UIRenderer $ui_renderer,
91 string $target_class_type,
92 bool $reference =
false
94 $qpl_obj_id = $qpl_id;
98 $ref_id = $this->getFirstReferenceWithCurrentUserAccess(
105 if ($ref_id ===
null) {
106 return $title .
' (' .
$lng->txt(
'status_no_permission') .
')';
109 return $ui_renderer->render(
110 $this->getLinkedTitle($ctrl, $ui_factory, $ref_id, $title, $target_class_type)
114 private function getLinkedTitle(
116 UIFactory $ui_factory,
119 string $target_class_type
121 $linked_title = $ui_factory->link()->
standard(
123 \
ilLink::_getStaticLink($ref_id)
125 return $linked_title;
128 private function getFirstReferenceWithCurrentUserAccess(
134 if ($reference && $access->checkAccess(
'read',
'', $qpl_id)) {
138 $references_with_access = array_filter(
139 array_values($all_ref_ids),
140 function ($ref_id) use ($access) {
144 if ($references_with_access !== []) {
145 return (
int) array_shift($references_with_access);
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
Class for creating internal links on e.g repostory items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
This is how the factory for UI elements looks.
An entity that renders components to a string output.
Interface ilAccessHandler.
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id=null, $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.