ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Modules/Exercise/classes/class.ilExerciseSubmissionTableGUI.php");
5 
15 {
16  protected $user; // [ilObjUser]
17 
18  protected function initMode($a_item_id)
19  {
20  global $lng;
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  {
29  $name = ilObjUser::_lookupName($a_item_id);
30  if(trim($name["login"]))
31  {
32  $this->user = new ilObjUser($a_item_id);
33 
34  $this->setTitle($lng->txt("exc_participant").": ".
35  $name["lastname"].", ".$name["firstname"]." [".$name["login"]."]");
36  }
37  }
38 
39  $this->setSelectAllCheckbox("ass");
40  }
41 
42  protected function parseData()
43  {
44  global $ilAccess, $ilCtrl;
45 
46  $this->addCommandButton("saveStatusParticipant", $this->lng->txt("save"));
47 
48  // #14650 - invalid user
49  if(!$this->user)
50  {
51  $ilCtrl->setParameter($this->getParentObject(), "member_id", "");
52  $ilCtrl->setParameter($this->getParentObject(), "part_id", ""); // #20073
53  $ilCtrl->redirect($this->getParentObject(), $this->getParentCmd());
54  }
55 
56  // #18327
57  if(!$ilAccess->checkAccessOfUser($this->user->getId(), "read","", $this->exc->getRefId()) &&
58  is_array($info = $ilAccess->getInfo()))
59  {
60  $this->setDescription('<span class="warning">'.$info[0]['text'].'</span>');
61  }
62 
63  $data = array();
64  foreach(ilExAssignment::getInstancesByExercise($this->exc->getId()) as $ass)
65  {
66  // ilExAssignment::getMemberListData()
67 
68  $member_status = $ass->getMemberStatus($this->user->getId());
69 
70  // filter
71  if($this->filter["status"] &&
72  $member_status->getStatus() != $this->filter["status"])
73  {
74  continue;
75  }
76 
77  $submission = new ilExSubmission($ass, $this->user->getId());
78  $idl = $ass->getIndividualDeadlines();
79 
80  if($this->filter["subm"])
81  {
82  if($this->filter["subm"] == "y" &&
83  !$submission->getLastSubmission())
84  {
85  continue;
86  }
87  else if($this->filter["subm"] == "n" &&
88  $submission->getLastSubmission())
89  {
90  continue;
91  }
92  }
93 
94  $row = array(
95  "ass" => $ass,
96  "submission_obj" => $submission,
97  "name" => $ass->getTitle(),
98  "status" => $member_status->getStatus(),
99  "mark" => $member_status->getMark(),
100  "sent_time" => $member_status->getSentTime(),
101  "status_time" => $member_status->getStatusTime(),
102  "feedback_time" => $member_status->getFeedbackTime(),
103  "submission" => $submission->getLastSubmission(),
104  "notice" => $member_status->getNotice(),
105  "comment" => $member_status->getComment()
106  );
107 
108  if($ass->hasTeam())
109  {
110  $team_map = ilExAssignmentTeam::getAssignmentTeamMap($ass->getId());
111 
112  $row["team"] = array();
113  foreach($submission->getTeam()->getMembers() as $user_id)
114  {
115  $row["team"][$user_id] = ilObjUser::_lookupFullname($user_id);
116  }
117  asort($row["team"]);
118 
119  $team_id = $team_map[$this->user->getId()];
120  if(is_numeric($team_id))
121  {
122  $idl_team_id = "t".$team_id;
123  if(array_key_exists($idl_team_id, $idl))
124  {
125  $row["idl"] = $idl[$idl_team_id];
126  }
127  }
128  }
129  else
130  {
131  if(array_key_exists($this->user->getId(), $idl))
132  {
133  $row["idl"] = $idl[$this->user->getId()];
134  }
135  }
136 
137  $data[] = $row;
138  }
139 
140  return $data;
141  }
142 
143  protected function parseModeColumns()
144  {
145  $cols = array();
146 
147  $cols["name"] = array($this->lng->txt("exc_assignment"), "name");
148  $cols["team_members"] = array($this->lng->txt("exc_tbl_team"));
149  $cols["idl"] = array($this->lng->txt("exc_tbl_individual_deadline"), "idl");
150 
151  return $cols;
152  }
153 
154  protected function fillRow($a_item)
155  {
156  global $ilCtrl;
157 
158  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
159  $ilCtrl->setParameter($this->parent_obj, "ass_id", $a_item["ass"]->getId());
160 
161  // multi-select id
162  $this->tpl->setVariable("NAME_ID", "ass");
163  $this->tpl->setVariable("VAL_ID", $a_item["ass"]->getId());
164 
165  $this->parseRow($this->user->getId(), $a_item["ass"], $a_item);
166 
167  $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
168  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->user->getId());
169  }
170 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static _lookupName($a_user_id)
lookup user name
setDescription($a_val)
Set description.
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
static _lookupFullname($a_user_id)
Lookup Full Name.
Exercise participant table.
getParentCmd()
Get parent command.
getParentObject()
Get parent object.
setId($a_val)
Set id.
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
$info
Definition: example_052.php:80
static getInstancesByExercise($a_exc_id)
parseRow($a_user_id, ilExAssignment $a_ass, array $a_row)
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
Exercise submission.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
getId()
Get element id.