ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
6 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
7 
17 {
18 
22  function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_part_id)
23  {
24  global $ilCtrl, $lng, $ilAccess, $lng;
25 
26  $this->exc = $a_exc;
27  $this->exc_id = $this->exc->getId();
28 
29  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
30 
31  $this->part_id = $a_part_id;
32 
33  $this->setId("exc_part_".$this->exc_id."_".$this->part_id);
34 
35  include_once("./Services/User/classes/class.ilObjUser.php");
36 
37  if ($this->part_id > 0)
38  {
39  $name = ilObjUser::_lookupName($this->part_id);
40  $this->user = new ilObjUser($this->part_id);
41  }
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44 
45  //$this->setData(ilExAssignment::getMemberListData($this->exc_id, $this->ass_id));
47  $this->setData($data);
48 
49 //var_dump($data);
50 
51  if ($this->part_id > 0)
52  {
53  $this->setTitle($lng->txt("exc_participant").": ".
54  $name["lastname"].", ".$name["firstname"]." [".$name["login"]."]");
55  }
56  else
57  {
58  $this->setTitle($lng->txt("exc_participant"));
59  }
60 
61  $this->setTopCommands(true);
62  //$this->setLimit(9999);
63 
64 // $this->addColumn("", "", "1", true);
65  $this->addColumn($this->lng->txt("exc_assignment"), "order_val");
66  $this->addColumn($this->lng->txt("exc_submission"), "submission");
67  $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
68 // $this->addColumn($this->lng->txt("mail"), "feedback_time");
69  $this->addColumn($this->lng->txt("feedback"), "feedback_time");
70 
71  $this->setDefaultOrderField("order_val");
72  $this->setDefaultOrderDirection("asc");
73 
74  $this->setEnableHeader(true);
75  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
76  $this->setRowTemplate("tpl.exc_participant_row.html", "Modules/Exercise");
77  //$this->disable("footer");
78  $this->setEnableTitle(true);
79 // $this->setSelectAllCheckbox("assid");
80 
81  if ($this->part_id > 0)
82  {
83  $this->addCommandButton("saveStatusParticipant", $lng->txt("exc_save_changes"));
84  }
85  }
86 
90  function numericOrdering($a_f)
91  {
92  if (in_array($a_f, array("order_val")))
93  {
94  return true;
95  }
96  return false;
97  }
98 
99 
103  protected function fillRow($d)
104  {
105  global $lng, $ilCtrl;
106 
107  $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]);
108 
109  $has_no_team_yet = false;
110  if($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM)
111  {
112  $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id);
113 
114  // #11957
115  if(sizeof($members))
116  {
117  $this->tpl->setCurrentBlock("ass_members");
118  foreach($members as $member_id)
119  {
120  $this->tpl->setVariable("TXT_MEMBER_NAME",
121  ilObjUser::_lookupFullname($member_id));
122  $this->tpl->parseCurrentBlock();
123  }
124 
125  $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
126  $this->tpl->setVariable("HREF_LOG",
127  $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog"));
128  $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log"));
129  $ilCtrl->setParameter($this->parent_obj, "lpart", "");
130  }
131  else
132  {
133  // #11957
134  $has_no_team_yet = true;
135  $this->tpl->setCurrentBlock("team_info");
136  $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet"));
137  $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team"));
138 
139  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
140  $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id);
141  $this->tpl->setVariable("URL_CREATE_TEAM",
142  $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam"));
143  $ilCtrl->setParameter($this->parent_obj, "lpart", "");
144  $ilCtrl->setParameter($this->parent_obj, "ass_id", "");
145 
146  $cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $d["id"], $this->part_id));
147  if($cnt)
148  {
149  $this->tpl->setVariable("TEAM_FILES_INFO", "<br />".
150  $lng->txt("exc_files_returned").": ".$cnt);
151  }
152  $this->tpl->parseCurrentBlock();
153  }
154  }
155 
156  if(!$has_no_team_yet)
157  {
158  $this->tpl->setVariable("VAL_CHKBOX",
159  ilUtil::formCheckbox(0, "assid[".$d["id"]."]",1));
160  $this->tpl->setVariable("VAL_ID",
161  $d["id"]);
162 
163  // submission:
164  // see if files have been resubmmited after solved
165  $last_sub =
166  ilExAssignment::getLastSubmission($d["id"], $this->part_id);
167  if ($last_sub)
168  {
169  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub,IL_CAL_DATETIME));
170  }
171  else
172  {
173  $last_sub = "---";
174  }
175  if (ilExAssignment::lookupUpdatedSubmission($d["id"], $this->part_id) == 1)
176  {
177  $last_sub = "<b>".$last_sub."</b>";
178  }
179  $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
180  $this->tpl->setVariable("TXT_LAST_SUBMISSION",
181  $lng->txt("exc_last_submission"));
182 
183  // nr of submitted files
184  $this->tpl->setVariable("TXT_SUBMITTED_FILES",
185  $lng->txt("exc_files_returned"));
186  $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $d["id"], $this->part_id));
187  $new = ilExAssignment::lookupNewFiles($d["id"], $this->part_id);
188  if (count($new) > 0)
189  {
190  $sub_cnt.= " ".sprintf($lng->txt("cnt_new"),count($new));
191  }
192  $this->tpl->setVariable("VAL_SUBMITTED_FILES",
193  $sub_cnt);
194 
195  // download command
196  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
197  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
198  if ($sub_cnt > 0)
199  {
200  $this->tpl->setCurrentBlock("download_link");
201  $this->tpl->setVariable("LINK_DOWNLOAD",
202  $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
203  if (count($new) <= 0)
204  {
205  $this->tpl->setVariable("TXT_DOWNLOAD",
206  $lng->txt("exc_download_files"));
207  }
208  else
209  {
210  $this->tpl->setVariable("TXT_DOWNLOAD",
211  $lng->txt("exc_download_all"));
212  }
213  $this->tpl->parseCurrentBlock();
214 
215  // download new files only
216  if (count($new) > 0)
217  {
218  $this->tpl->setCurrentBlock("download_link");
219  $this->tpl->setVariable("LINK_NEW_DOWNLOAD",
220  $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
221  $this->tpl->setVariable("TXT_NEW_DOWNLOAD",
222  $lng->txt("exc_download_new"));
223  $this->tpl->parseCurrentBlock();
224  }
225  }
226 
227  // note
228  $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
229  $this->tpl->setVariable("NAME_NOTE",
230  "notice[".$d["id"]."]");
231  $this->tpl->setVariable("VAL_NOTE",
233 
234  // comment for learner
235  $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
236  $this->tpl->setVariable("NAME_LCOMMENT",
237  "lcomment[".$d["id"]."]");
238  $lpcomment = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
239  $this->tpl->setVariable("VAL_LCOMMENT",
240  ilUtil::prepareFormOutput($lpcomment));
241 
242  // solved
243  //$this->tpl->setVariable("CHKBOX_SOLVED",
244  // ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
245  $status = ilExAssignment::lookupStatusOfUser($d["id"], $this->part_id);
246  $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
247  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
248  $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
249  $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
250  if (($sd = ilExAssignment::lookupStatusTimeOfUser($d["id"], $this->part_id)) > 0)
251  {
252  $this->tpl->setCurrentBlock("status_date");
253  $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
254  $this->tpl->setVariable('VAL_STATUS_DATE',
256  $this->tpl->parseCurrentBlock();
257  }
258  switch($status)
259  {
260  case "passed": $pic = "scorm/passed.png"; break;
261  case "failed": $pic = "scorm/failed.png"; break;
262  default: $pic = "scorm/not_attempted.png"; break;
263  }
264  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
265  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
266 
267  // mark
268  $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
269  $this->tpl->setVariable("NAME_MARK",
270  "mark[".$d["id"]."]");
271  $mark = ilExAssignment::lookupMarkOfUser($d["id"], $this->part_id);
272  $this->tpl->setVariable("VAL_MARK",
274 
275  // feedback
276  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
277  if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0)
278  {
279  $this->tpl->setCurrentBlock("feedback_date");
280  $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT",
281  sprintf($lng->txt("exc_sent_at"),
283  $this->tpl->parseCurrentBlock();
284  }
285  $ilCtrl->setParameter($this, "rcp_to", $this->user->getLogin());
286  $this->tpl->setVariable("LINK_FEEDBACK",
287  $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
288  //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin());
289  $this->tpl->setVariable("TXT_FEEDBACK",
290  $lng->txt("exc_send_mail"));
291  $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
292 
293  if($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM)
294  {
295  $feedback_id = "t".ilExAssignment::getTeamIdByAssignment($d["id"], $this->part_id);
296  }
297  else
298  {
299  $feedback_id = $this->part_id;
300  }
301 
302  $storage = new ilFSStorageExercise($this->exc_id, $d["id"]);
303  $cnt_files = $storage->countFeedbackFiles($feedback_id);
304  $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedbackpart");
305  $this->tpl->setVariable("LINK_FILE_FEEDBACK",
306  $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
307  if ($cnt_files == 0)
308  {
309  $this->tpl->setVariable("TXT_FILE_FEEDBACK",
310  $lng->txt("exc_add_feedback_file"));
311  }
312  else
313  {
314  $this->tpl->setVariable("TXT_FILE_FEEDBACK",
315  $lng->txt("exc_fb_files")." (".$cnt_files.")");
316  }
317 
318 
319  $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
320  }
321  else
322  {
323  $this->tpl->touchBlock("member_has_no_team_bl");
324  }
325  }
326 
327 }
328 ?>