ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilExParticipantTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 protected $user; // [ilObjUser]
14
15 protected function initMode($a_item_id)
16 {
18
19 $this->mode = self::MODE_BY_USER;
20
21 // global id for all exercises
22 $this->setId("exc_part");
23
24 if ($a_item_id > 0) {
25 $name = ilObjUser::_lookupName($a_item_id);
26 if (trim($name["login"])) {
27 $this->user = new ilObjUser($a_item_id);
28
29 $this->setTitle($lng->txt("exc_participant") . ": " .
30 $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]");
31 }
32 }
33
34 $this->setSelectAllCheckbox("ass");
35 }
36
37 protected function parseData()
38 {
39 $ilAccess = $this->access;
40 $ilCtrl = $this->ctrl;
41
42 $this->addCommandButton("saveStatusParticipant", $this->lng->txt("save"));
43
44 // #14650 - invalid user
45 if (!$this->user) {
46 $ilCtrl->setParameter($this->getParentObject(), "member_id", "");
47 $ilCtrl->setParameter($this->getParentObject(), "part_id", ""); // #20073
48 $ilCtrl->redirect($this->getParentObject(), $this->getParentCmd());
49 }
50
51 // #18327
52 if (!$ilAccess->checkAccessOfUser($this->user->getId(), "read", "", $this->exc->getRefId()) &&
53 is_array($info = $ilAccess->getInfo())) {
54 $this->setDescription('<span class="warning">' . $info[0]['text'] . '</span>');
55 }
56
57 $data = array();
59 foreach (ilExAssignment::getInstancesByExercise($this->exc->getId()) as $ass) {
60 // ilExAssignment::getMemberListData()
61 $member_status = $ass->getMemberStatus($this->user->getId());
62
63 // filter
64 if ($this->filter["status"] &&
65 $member_status->getStatus() != $this->filter["status"]) {
66 continue;
67 }
68
69 $submission = new ilExSubmission($ass, $this->user->getId());
70 $idl = $ass->getIndividualDeadlines();
71
72 if ($this->filter["subm"]) {
73 if ($this->filter["subm"] == "y" &&
74 !$submission->getLastSubmission()) {
75 continue;
76 } elseif ($this->filter["subm"] == "n" &&
77 $submission->getLastSubmission()) {
78 continue;
79 }
80 }
81
82 $row = array(
83 "ass" => $ass,
84 "submission_obj" => $submission,
85 "name" => $ass->getTitle(),
86 "status" => $member_status->getStatus(),
87 "mark" => $member_status->getMark(),
88 "sent_time" => $member_status->getSentTime(),
89 "status_time" => $member_status->getStatusTime(),
90 "feedback_time" => $member_status->getFeedbackTime(),
91 "submission" => $submission->getLastSubmission(),
92 "notice" => $member_status->getNotice(),
93 "comment" => $member_status->getComment(),
94 "order_nr" => $ass->getOrderNr()
95 );
96
97 if ($ass->hasTeam()) {
98 $team_map = ilExAssignmentTeam::getAssignmentTeamMap($ass->getId());
99
100 $row["team"] = array();
101 foreach ($submission->getTeam()->getMembers() as $user_id) {
102 $row["team"][$user_id] = ilObjUser::_lookupFullname($user_id);
103 }
104 asort($row["team"]);
105
106 $team_id = $team_map[$this->user->getId()];
107 if (is_numeric($team_id)) {
108 $idl_team_id = "t" . $team_id;
109 if (array_key_exists($idl_team_id, $idl)) {
110 $row["idl"] = $idl[$idl_team_id];
111 }
112 }
113 } else {
114 if (array_key_exists($this->user->getId(), $idl)) {
115 $row["idl"] = $idl[$this->user->getId()];
116 }
117 }
118
119 $data[] = $row;
120 }
121
122 return $data;
123 }
124
125 protected function parseModeColumns()
126 {
127 $cols = array();
128
129 $cols["name"] = array($this->lng->txt("exc_assignment"), "order_nr");
130 $cols["team_members"] = array($this->lng->txt("exc_tbl_team"));
131 $cols["idl"] = array($this->lng->txt("exc_tbl_individual_deadline"), "idl");
132
133 return $cols;
134 }
135
136 protected function fillRow($a_item)
137 {
138 $ilCtrl = $this->ctrl;
139 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
140 $ilCtrl->setParameter($this->parent_obj, "ass_id", $a_item["ass"]->getId());
141
142 // multi-select id
143 $this->tpl->setVariable("NAME_ID", "ass");
144 $this->tpl->setVariable("VAL_ID", $a_item["ass"]->getId());
145
146 $this->parseRow($this->user->getId(), $a_item["ass"], $a_item);
147
148 $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
149 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
150 }
151
155 public function numericOrdering($a_field)
156 {
157 if (in_array($a_field, ["order_nr"])) {
158 return true;
159 }
160 return false;
161 }
162}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
static getInstancesByExercise($a_exc_id)
fillRow($a_item)
Standard Version of Fill Row.
numericOrdering($a_field)
Should this field be sorted numeric?boolean numeric ordering; default is false
Exercise submission //TODO: This class has to much static methods related to delivered "files".
parseRow($a_user_id, ilExAssignment $a_ass, array $a_row)
static _lookupName($a_user_id)
lookup user name
static _lookupFullname($a_user_id)
Lookup Full Name.
getParentCmd()
Get parent command.
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
getId()
Get element id.
setId($a_val)
Set id.
setDescription($a_val)
Set description.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
filter()
Definition: filter.php:2
if($format !==null) $name
Definition: metadata.php:230
$cols
Definition: xhr_table.php:11