ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable Class Reference
+ Collaboration diagram for ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable:

Public Member Functions

 __construct (private readonly \ilAssQuestionList $question_list, private readonly \ilAssQuestionSkillAssignmentList $assignment_list, private readonly UIFactory $ui_factory, private readonly \ilLanguage $lng, private readonly \ilCtrl $ctrl)
 
 getComponents (URI $edit_uri, SkillAssignmentViewControlMode $skill_assignment_view_control_mode=SkillAssignmentViewControlMode::ALL)
 
 retrieveRecords (SkillAssignmentViewControlMode $skill_assignment_view_control_mode=SkillAssignmentViewControlMode::ALL)
 

Data Fields

const string VIEW_CONTROL_QUERY_PARAM = 'mode'
 

Private Member Functions

 mapRow (PresentationRow $row, SkillAssignments $record, URI $edit_uri)
 
 getViewControls (SkillAssignmentViewControlMode $skill_assignment_view_control_mode=SkillAssignmentViewControlMode::ALL)
 

Private Attributes

const string ROW_ID_PARAMETER = 'q_id'
 

Detailed Description

Definition at line 28 of file SkillsByQuestionOverviewTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::__construct ( private readonly \ilAssQuestionList  $question_list,
private readonly \ilAssQuestionSkillAssignmentList  $assignment_list,
private readonly UIFactory  $ui_factory,
private readonly \ilLanguage  $lng,
private readonly \ilCtrl  $ctrl 
)

Definition at line 34 of file SkillsByQuestionOverviewTable.php.

40 {
41 }

Member Function Documentation

◆ getComponents()

ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::getComponents ( URI  $edit_uri,
SkillAssignmentViewControlMode  $skill_assignment_view_control_mode = SkillAssignmentViewControlMode::ALL 
)

Definition at line 43 of file SkillsByQuestionOverviewTable.php.

43 : array
44 {
45 return [
46 $this->ui_factory->table()->presentation(
47 $this->lng->txt('qpl_skl_sub_tab_quest_assign'),
48 $this->getViewControls($skill_assignment_view_control_mode),
49 fn(PresentationRow $row, SkillAssignments $record): PresentationRow => $this->mapRow($row, $record, $edit_uri)
50 )
51 ->withData($this->retrieveRecords($skill_assignment_view_control_mode))
52 ];
53 }
retrieveRecords(SkillAssignmentViewControlMode $skill_assignment_view_control_mode=SkillAssignmentViewControlMode::ALL)
mapRow(PresentationRow $row, SkillAssignments $record, URI $edit_uri)
This describes a Row used in Presentation Table.

References ILIAS\Repository\lng(), ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable\mapRow(), and ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable\retrieveRecords().

+ Here is the call graph for this function:

◆ getViewControls()

ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::getViewControls ( SkillAssignmentViewControlMode  $skill_assignment_view_control_mode = SkillAssignmentViewControlMode::ALL)
private
Returns
Mode[]

Definition at line 136 of file SkillsByQuestionOverviewTable.php.

136 : array
137 {
138 $labeled_actions = [];
139 foreach (SkillAssignmentViewControlMode::cases() as $value) {
140 $this->ctrl->setParameterByClass(
141 \ilAssQuestionSkillAssignmentsGUI::class,
142 self::VIEW_CONTROL_QUERY_PARAM,
143 $value->value
144 );
145 $labeled_actions[$this->lng->txt($value->getLabel())] = $this->ctrl->getLinkTargetByClass(
146 \ilAssQuestionSkillAssignmentsGUI::class,
148 );
149 }
150
151 return [
152 $this->ui_factory->viewControl()->mode($labeled_actions, $this->lng->txt('qpl_skl_view_control_mode_aria'))
153 ->withActive($this->lng->txt($skill_assignment_view_control_mode->getLabel())),
154 ];
155 }

References ilAssQuestionSkillAssignmentsGUI\CMD_SHOW_SKILL_QUEST_ASSIGNS, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ mapRow()

ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::mapRow ( PresentationRow  $row,
SkillAssignments  $record,
URI  $edit_uri 
)
private

Definition at line 55 of file SkillsByQuestionOverviewTable.php.

56 {
57 $assignment_details = [];
58 foreach ($record->getSkillAssignments() as $skill_assignment) {
59 $assignment_details[$skill_assignment->getSkillTitle()] = $this->ui_factory
60 ->listing()
61 ->property()
62 ->withProperty($this->lng->txt('tree'), $skill_assignment->getSkillPath())
63 ->withProperty(
64 $this->lng->txt('tst_comp_eval_mode'),
65 $this->lng->txt(
66 $skill_assignment->hasEvalModeBySolution()
67 ? 'qpl_skill_point_eval_mode_solution_compare'
68 : 'qpl_skill_point_eval_mode_quest_result'
69 )
70 )
71 ->withProperty($this->lng->txt('tst_comp_points'), (string) $skill_assignment->getMaxSkillPoints());
72 }
73
74 $row = $row
75 ->withHeadline($record->getQuestion()['title'])
76 ->withSubheadline($record->getQuestion()['description'])
77 ->withLeadingSymbol(
78 $this->ui_factory->symbol()->icon()->standard('ques', '')
79 )
80 ->withContent(
81 $assignment_details !== []
82 ? $this->ui_factory->listing()->descriptive($assignment_details)
83 : $this->ui_factory->legacy()->content($this->lng->txt('ui_table_no_records'))
84 )
85 ->withAction(
86 $this->ui_factory->button()->standard(
87 $this->lng->txt('tst_manage_competence_assigns'),
88 (string) $edit_uri->withParameter(self::ROW_ID_PARAMETER, $record->getQuestion()['question_id'])
89 )
90 );
91
92 $assignments = $this->assignment_list->getAssignmentsByQuestionId($record->getQuestion()['question_id']);
93 if ($assignments === []) {
94 return $row;
95 }
96
97 return $row->withImportantFields([
98 $this->lng->txt('tst_competence') => implode(
99 ', ',
100 array_map(static fn(\ilAssQuestionSkillAssignment $a) => $a->getSkillTitle(), $assignments)
101 ),
102 ]);
103 }
withParameter(string $key, $value)
Get URI with modified parameters.
Definition: URI.php:387
withImportantFields(array $fields)
Get a row like this with the record-fields and labels to be shown in the collapsed row.
withHeadline(string $headline)
Get a row like this with the given headline.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, ILIAS\TestQuestionPool\Skills\SkillAssignments\getQuestion(), ILIAS\TestQuestionPool\Skills\SkillAssignments\getSkillAssignments(), ILIAS\Repository\lng(), ILIAS\UI\Component\Table\PresentationRow\withHeadline(), ILIAS\UI\Component\Table\PresentationRow\withImportantFields(), and ILIAS\Data\URI\withParameter().

Referenced by ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable\getComponents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrieveRecords()

ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::retrieveRecords ( SkillAssignmentViewControlMode  $skill_assignment_view_control_mode = SkillAssignmentViewControlMode::ALL)
Returns
array<SkillAssignments>

Definition at line 108 of file SkillsByQuestionOverviewTable.php.

108 : array
109 {
110 $records = [];
111 foreach ($this->question_list->getQuestionDataArray() as $question_id => $question_data) {
112 $assignments_by_question_id = $this->assignment_list->getAssignmentsByQuestionId($question_id);
113 if (
114 $skill_assignment_view_control_mode === SkillAssignmentViewControlMode::ASSIGNED
115 && $assignments_by_question_id === []
116 ) {
117 continue;
118 }
119
120 if (
121 $skill_assignment_view_control_mode === SkillAssignmentViewControlMode::UNASSIGNED
122 && $assignments_by_question_id !== []
123 ) {
124 continue;
125 }
126
127 $records[] = new SkillAssignments($question_data, $assignments_by_question_id);
128 }
129
130 return $records;
131 }

Referenced by ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable\getComponents().

+ Here is the caller graph for this function:

Field Documentation

◆ ROW_ID_PARAMETER

const string ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::ROW_ID_PARAMETER = 'q_id'
private

Definition at line 32 of file SkillsByQuestionOverviewTable.php.

◆ VIEW_CONTROL_QUERY_PARAM

const string ILIAS\TestQuestionPool\Skills\SkillsByQuestionOverviewTable::VIEW_CONTROL_QUERY_PARAM = 'mode'

Definition at line 30 of file SkillsByQuestionOverviewTable.php.


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