ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssignmentsPerParticipantTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ilObjUser $user;
27
28 protected function initMode(int $a_item_id): void
29 {
31
32 $this->mode = self::MODE_BY_USER;
33
34 // global id for all exercises
35 $this->setId("exc_part");
36
37 if ($a_item_id > 0) {
38 $name = ilObjUser::_lookupName($a_item_id);
39 if (trim($name["login"]) !== '' && trim($name["login"]) !== '0') {
40 $this->user = new ilObjUser($a_item_id);
41
42 $this->setTitle(
43 $lng->txt("exc_participant") . ": " .
44 $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]"
45 );
46 }
47 }
48
49 $this->setSelectAllCheckbox("ass");
50 }
51
55 protected function parseData(): array
56 {
57 $ilAccess = $this->access;
58 $ilCtrl = $this->ctrl;
59 $this->addCommandButton("saveStatusParticipant", $this->lng->txt("save"));
60
61 // #14650 - invalid user
62 if (!$this->user) {
63 $ilCtrl->setParameter($this->getParentObject(), "member_id", "");
64 $ilCtrl->setParameter($this->getParentObject(), "part_id", ""); // #20073
65 $ilCtrl->redirect($this->getParentObject(), $this->getParentCmd());
66 }
67
68 // #18327
69 if (!$ilAccess->checkAccessOfUser($this->user->getId(), "read", "", $this->exc->getRefId()) &&
70 is_array($info = $ilAccess->getInfo())) {
71 $this->setDescription('<span class="warning">' . $info[0]['text'] . '</span>');
72 }
73
74 $data = array();
75 foreach (ilExAssignment::getInstancesByExercise($this->exc->getId()) as $ass) {
76 // ilExAssignment::getMemberListData()
77 $member_status = $ass->getMemberStatus($this->user->getId());
78
79 // filter
80 if ($this->filter["status"] &&
81 $member_status->getStatus() != $this->filter["status"]) {
82 continue;
83 }
84
85 $submission = new ilExSubmission($ass, $this->user->getId());
87
88 if ($this->filter["subm"]) {
89 if ($this->filter["subm"] == "y" &&
90 !$submission->getLastSubmission()) {
91 continue;
92 } elseif ($this->filter["subm"] == "n" &&
93 $submission->getLastSubmission()) {
94 continue;
95 }
96 }
97
98 if ($this->filter["subm_after"]) {
99 if (is_null($submission->getLastSubmission())) {
100 continue;
101 } else {
102 if ($submission->getLastSubmission() <
103 $this->filter["subm_after"]->get(IL_CAL_DATETIME)) {
104 continue;
105 }
106 }
107 }
108 if ($this->filter["subm_before"]) {
109 if (is_null($submission->getLastSubmission())) {
110 continue;
111 } else {
112 if ($submission->getLastSubmission() >
113 $this->filter["subm_before"]->get(IL_CAL_DATETIME)) {
114 continue;
115 }
116 }
117 }
118
119 $row = array(
120 "ass" => $ass,
121 "submission_obj" => $submission,
122 "name" => $ass->getTitle(),
123 "status" => $member_status->getStatus(),
124 "mark" => $member_status->getMark(),
125 "sent_time" => $member_status->getSentTime(),
126 "status_time" => $member_status->getStatusTime(),
127 "feedback_time" => $member_status->getFeedbackTime(),
128 "submission" => $submission->getLastSubmission(),
129 "notice" => $member_status->getNotice(),
130 "comment" => $member_status->getComment(),
131 "order_nr" => $ass->getOrderNr()
132 );
133
134 if ($ass->hasTeam()) {
136
137 $row["team"] = array();
138 foreach ($submission->getTeam()->getMembers() as $user_id) {
140 }
141 asort($row["team"]);
142
143 $team_id = $team_map[$this->user->getId()] ?? null;
144 if (is_numeric($team_id)) {
145 $idl_team_id = "t" . $team_id;
146 if (array_key_exists($idl_team_id, $idl)) {
147 $row["idl"] = $idl[$idl_team_id];
148 }
149 }
150 } else {
151 if (array_key_exists($this->user->getId(), $idl)) {
152 $row["idl"] = $idl[$this->user->getId()];
153 }
154 }
155
156 $data[] = $row;
157 }
158
159 return $data;
160 }
161
162 protected function parseModeColumns(): array
163 {
164 $cols = array();
165
166 $cols["name"] = array($this->lng->txt("exc_assignment"), "order_nr");
167 $cols["team_members"] = array($this->lng->txt("exc_tbl_team"));
168 $cols["idl"] = array($this->lng->txt("exc_tbl_individual_deadline"), "idl");
169
170 return $cols;
171 }
172
178 protected function fillRow(array $a_set): void
179 {
180 $ilCtrl = $this->ctrl;
181 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
182 $ilCtrl->setParameter($this->parent_obj, "ass_id", $a_set["ass"]->getId());
183
184 // multi-select id
185 $this->tpl->setVariable("NAME_ID", "sel_ass_ids");
186 $this->tpl->setVariable("LISTED_NAME_ID", "listed_ass_ids");
187 $this->tpl->setVariable("VAL_ID", $a_set["ass"]->getId());
188
189 $this->parseRow($this->user->getId(), $a_set["ass"], $a_set);
190
191 $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
192 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
193 }
194
195 public function numericOrdering(string $a_field): bool
196 {
197 return $a_field === "order_nr";
198 }
199}
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
numericOrdering(string $a_field)
Should this field be sorted numeric?
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
static getAssignmentTeamMap(int $a_ass_id)
static getInstancesByExercise(int $a_exc_id)
getMemberStatus(?int $a_user_id=null)
Exercise submission //TODO: This class has many static methods related to delivered "files".
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...
User class.
static _lookupFullname(int $a_user_id)
static _lookupName(int $a_user_id)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setDescription(string $a_val)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setId(string $a_val)
ilLanguage $lng
$info
Definition: entry_point.php:21
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)