ILIAS  release_8 Revision v8.24
class.ilLTIConsumerGradeSynchronizationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
30{
31 public const TABLE_ID = 'lti_grade_table';
32
33 protected bool $isMultiActorReport;
34 protected array $filter = [];
35 private \ILIAS\DI\Container $dic;
37
41 public function __construct(?object $a_parent_obj, string $a_parent_cmd, bool $isMultiActorReport)
42 {
43 global $DIC; /* @var \ILIAS\DI\Container $DIC */
44 $this->dic = $DIC;
45 $this->language = $DIC->language();
46
47 $this->isMultiActorReport = $isMultiActorReport;
48
49 $this->setId(self::TABLE_ID);
50 parent::__construct($a_parent_obj, $a_parent_cmd);
51
52 $DIC->language()->loadLanguageModule('form');
53
54 $this->setFormAction($DIC->ctrl()->getFormAction($a_parent_obj, $a_parent_cmd));
55 $this->setRowTemplate('tpl.lti_grade_synchronization_table_row.html', 'Modules/LTIConsumer');
56
57 $this->initColumns();
58 $this->initFilter();
59
60 $this->setExternalSegmentation(false);
61 $this->setExternalSorting(true);
62
63 $this->setDefaultOrderField('lti_timestamp');
64 $this->setDefaultOrderDirection('desc');
65 }
66
67 protected function initColumns(): void
68 {
69 $this->addColumn($this->language->txt('tbl_grade_date'), 'lti_timestamp');
70
71 if ($this->isMultiActorReport) {
72 $this->addColumn($this->language->txt('tbl_grade_actor'), 'actor');
73 }
74 $this->addColumn($this->language->txt('tbl_grade_score'), 'score_given');
75 $this->addColumn($this->language->txt('tbl_grade_activity_progress'), '');
76 $this->addColumn($this->language->txt('tbl_grade_grading_progress'), '');
77 $this->addColumn($this->language->txt('tbl_grade_stored'), '');
78 }
79
80 public function initFilter(): void
81 {
82 if ($this->isMultiActorReport) {
83 $ti = new ilTextInputGUI($this->language->txt('tbl_grade_actor'), "actor");
84 $ti->setDataSource($this->dic->ctrl()->getLinkTarget($this->parent_obj, 'asyncUserAutocomplete', '', true));
85 $ti->setMaxLength(64);
86 $ti->setSize(20);
87 $this->addFilterItem($ti);
88 $ti->readFromSession();
89 $this->filter["actor"] = $ti->getValue();
90 }
91
92 $options = array(
93 '' => $this->language->txt('grade_activity_progress_all'),
94 'Initialized' => $this->language->txt('grade_activity_progress_initialized'),
95 'Started' => $this->language->txt('grade_activity_progress_started'),
96 'InProgress' => $this->language->txt('grade_activity_progress_inprogress'),
97 'Submitted' => $this->language->txt('grade_activity_progress_submitted'),
98 'Completed' => $this->language->txt('grade_activity_progress_completed')
99 );
100
101 $si = new ilSelectInputGUI($this->language->txt('tbl_grade_activity_progress'), "activity_progress");
102 $si->setOptions($options);
103 $this->addFilterItem($si);
104 $si->readFromSession();
105 $this->filter["activity_progress"] = $si->getValue();
106
107 $options = array(
108 '' => $this->language->txt('grade_grading_progress_all'),
109 'NotReady' => $this->language->txt('grade_grading_progress_notready'),
110 'Failed' => $this->language->txt('grade_grading_progress_failed'),
111 'Pending' => $this->language->txt('grade_grading_progress_pending'),
112 'PendingManual' => $this->language->txt('grade_grading_progress_pendingmanual'),
113 'FullyGraded' => $this->language->txt('grade_grading_progress_fullygraded')
114 );
115
116 $si = new ilSelectInputGUI($this->language->txt('tbl_grade_grading_progress'), "grading_progress");
117 $si->setOptions($options);
118 $this->addFilterItem($si);
119 $si->readFromSession();
120 $this->filter["grading_progress"] = $si->getValue();
121
122 $dp = new ilDateDurationInputGUI($this->language->txt('tbl_grade_period'), 'period');
123 $dp->setShowTime(true);
124 $this->addFilterItem($dp);
125 $dp->readFromSession();
126 $this->filter["period"] = $dp->getValue();
127 }
128
129 protected function fillRow(array $a_set): void
130 {
131 $this->tpl->setVariable('STMT_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['lti_timestamp'], IL_CAL_DATETIME)));
132 if ($this->isMultiActorReport) {
133 $this->tpl->setVariable('STMT_ACTOR', $a_set['actor']);
134 }
135 $this->tpl->setVariable('STMT_SCORE', $a_set['score_given'] . ' / ' . $a_set['score_maximum']);
136 $this->tpl->setVariable('STMT_ACTIVITY_PROGRESS', $this->language->txt('grade_activity_progress_' . strtolower($a_set['activity_progress'])));
137 $this->tpl->setVariable('STMT_GRADING_PROGRESS', $this->language->txt('grade_grading_progress_' . strtolower($a_set['grading_progress'])));
138 $this->tpl->setVariable('STMT_STORED', ilDatePresentation::formatDate(new ilDateTime($a_set['stored'], IL_CAL_DATETIME)));
139 }
140
141}
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
__construct(?object $a_parent_obj, string $a_parent_cmd, bool $isMultiActorReport)
language handling
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setExternalSegmentation(bool $a_val)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
This class represents a text property in a property form.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc