ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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  {
30  $lng = $this->lng;
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());
86  $idl = $ass->getIndividualDeadlines();
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  $row = array(
99  "ass" => $ass,
100  "submission_obj" => $submission,
101  "name" => $ass->getTitle(),
102  "status" => $member_status->getStatus(),
103  "mark" => $member_status->getMark(),
104  "sent_time" => $member_status->getSentTime(),
105  "status_time" => $member_status->getStatusTime(),
106  "feedback_time" => $member_status->getFeedbackTime(),
107  "submission" => $submission->getLastSubmission(),
108  "notice" => $member_status->getNotice(),
109  "comment" => $member_status->getComment(),
110  "order_nr" => $ass->getOrderNr()
111  );
112 
113  if ($ass->hasTeam()) {
114  $team_map = ilExAssignmentTeam::getAssignmentTeamMap($ass->getId());
115 
116  $row["team"] = array();
117  foreach ($submission->getTeam()->getMembers() as $user_id) {
118  $row["team"][$user_id] = ilObjUser::_lookupFullname($user_id);
119  }
120  asort($row["team"]);
121 
122  $team_id = $team_map[$this->user->getId()] ?? null;
123  if (is_numeric($team_id)) {
124  $idl_team_id = "t" . $team_id;
125  if (array_key_exists($idl_team_id, $idl)) {
126  $row["idl"] = $idl[$idl_team_id];
127  }
128  }
129  } else {
130  if (array_key_exists($this->user->getId(), $idl)) {
131  $row["idl"] = $idl[$this->user->getId()];
132  }
133  }
134 
135  $data[] = $row;
136  }
137 
138  return $data;
139  }
140 
141  protected function parseModeColumns(): array
142  {
143  $cols = array();
144 
145  $cols["name"] = array($this->lng->txt("exc_assignment"), "order_nr");
146  $cols["team_members"] = array($this->lng->txt("exc_tbl_team"));
147  $cols["idl"] = array($this->lng->txt("exc_tbl_individual_deadline"), "idl");
148 
149  return $cols;
150  }
151 
157  protected function fillRow(array $a_set): void
158  {
159  $ilCtrl = $this->ctrl;
160  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
161  $ilCtrl->setParameter($this->parent_obj, "ass_id", $a_set["ass"]->getId());
162 
163  // multi-select id
164  $this->tpl->setVariable("NAME_ID", "sel_ass_ids");
165  $this->tpl->setVariable("LISTED_NAME_ID", "listed_ass_ids");
166  $this->tpl->setVariable("VAL_ID", $a_set["ass"]->getId());
167 
168  $this->parseRow($this->user->getId(), $a_set["ass"], $a_set);
169 
170  $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
171  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
172  }
173 
174  public function numericOrdering(string $a_field): bool
175  {
176  return $a_field === "order_nr";
177  }
178 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
static _lookupFullname(int $a_user_id)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setDescription(string $a_val)
static _lookupName(int $a_user_id)
lookup user name
ilLanguage $lng
setId(string $a_val)
if($format !==null) $name
Definition: metadata.php:247
static getAssignmentTeamMap(int $a_ass_id)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static getInstancesByExercise(int $a_exc_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
$cols
Definition: xhr_table.php:11