ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_once("./Modules/Exercise/classes/class.ilExerciseSubmissionTableGUI.php");
5
15{
16 protected $user; // [ilObjUser]
17
18 protected function initMode($a_item_id)
19 {
21
22 $this->mode = self::MODE_BY_USER;
23
24 // global id for all exercises
25 $this->setId("exc_part");
26
27 if ($a_item_id > 0) {
28 $name = ilObjUser::_lookupName($a_item_id);
29 if (trim($name["login"])) {
30 $this->user = new ilObjUser($a_item_id);
31
32 $this->setTitle($lng->txt("exc_participant") . ": " .
33 $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]");
34 }
35 }
36
37 $this->setSelectAllCheckbox("ass");
38 }
39
40 protected function parseData()
41 {
42 $ilAccess = $this->access;
44
45 $this->addCommandButton("saveStatusParticipant", $this->lng->txt("save"));
46
47 // #14650 - invalid user
48 if (!$this->user) {
49 $ilCtrl->setParameter($this->getParentObject(), "member_id", "");
50 $ilCtrl->setParameter($this->getParentObject(), "part_id", ""); // #20073
51 $ilCtrl->redirect($this->getParentObject(), $this->getParentCmd());
52 }
53
54 // #18327
55 if (!$ilAccess->checkAccessOfUser($this->user->getId(), "read", "", $this->exc->getRefId()) &&
56 is_array($info = $ilAccess->getInfo())) {
57 $this->setDescription('<span class="warning">' . $info[0]['text'] . '</span>');
58 }
59
60 $data = array();
62 foreach (ilExAssignment::getInstancesByExercise($this->exc->getId()) as $ass) {
63 // ilExAssignment::getMemberListData()
64 $member_status = $ass->getMemberStatus($this->user->getId());
65
66 // filter
67 if ($this->filter["status"] &&
68 $member_status->getStatus() != $this->filter["status"]) {
69 continue;
70 }
71
72 $submission = new ilExSubmission($ass, $this->user->getId());
73 $idl = $ass->getIndividualDeadlines();
74
75 if ($this->filter["subm"]) {
76 if ($this->filter["subm"] == "y" &&
77 !$submission->getLastSubmission()) {
78 continue;
79 } elseif ($this->filter["subm"] == "n" &&
80 $submission->getLastSubmission()) {
81 continue;
82 }
83 }
84
85 $row = array(
86 "ass" => $ass,
87 "submission_obj" => $submission,
88 "name" => $ass->getTitle(),
89 "status" => $member_status->getStatus(),
90 "mark" => $member_status->getMark(),
91 "sent_time" => $member_status->getSentTime(),
92 "status_time" => $member_status->getStatusTime(),
93 "feedback_time" => $member_status->getFeedbackTime(),
94 "submission" => $submission->getLastSubmission(),
95 "notice" => $member_status->getNotice(),
96 "comment" => $member_status->getComment(),
97 "order_nr" => $ass->getOrderNr()
98 );
99
100 if ($ass->hasTeam()) {
101 $team_map = ilExAssignmentTeam::getAssignmentTeamMap($ass->getId());
102
103 $row["team"] = array();
104 foreach ($submission->getTeam()->getMembers() as $user_id) {
105 $row["team"][$user_id] = ilObjUser::_lookupFullname($user_id);
106 }
107 asort($row["team"]);
108
109 $team_id = $team_map[$this->user->getId()];
110 if (is_numeric($team_id)) {
111 $idl_team_id = "t" . $team_id;
112 if (array_key_exists($idl_team_id, $idl)) {
113 $row["idl"] = $idl[$idl_team_id];
114 }
115 }
116 } else {
117 if (array_key_exists($this->user->getId(), $idl)) {
118 $row["idl"] = $idl[$this->user->getId()];
119 }
120 }
121
122 $data[] = $row;
123 }
124
125 return $data;
126 }
127
128 protected function parseModeColumns()
129 {
130 $cols = array();
131
132 $cols["name"] = array($this->lng->txt("exc_assignment"), "order_nr");
133 $cols["team_members"] = array($this->lng->txt("exc_tbl_team"));
134 $cols["idl"] = array($this->lng->txt("exc_tbl_individual_deadline"), "idl");
135
136 return $cols;
137 }
138
139 protected function fillRow($a_item)
140 {
142 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
143 $ilCtrl->setParameter($this->parent_obj, "ass_id", $a_item["ass"]->getId());
144
145 // multi-select id
146 $this->tpl->setVariable("NAME_ID", "ass");
147 $this->tpl->setVariable("VAL_ID", $a_item["ass"]->getId());
148
149 $this->parseRow($this->user->getId(), $a_item["ass"], $a_item);
150
151 $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
152 $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
153 }
154
158 public function numericOrdering($a_field)
159 {
160 if (in_array($a_field, ["order_nr"])) {
161 return true;
162 }
163 return false;
164 }
165}
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.
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.
getId()
Get element id.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:146
$info
Definition: index.php:5
$cols
Definition: xhr_table.php:11