ILIAS  eassessment Revision 61809
 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  $this->tpl->setVariable("VAL_CHKBOX",
110  ilUtil::formCheckbox(0, "assid[".$d["id"]."]",1));
111  $this->tpl->setVariable("VAL_ID",
112  $d["id"]);
113 
114  // submission:
115  // see if files have been resubmmited after solved
116  $last_sub =
117  ilExAssignment::getLastSubmission($d["id"], $this->part_id);
118  if ($last_sub)
119  {
120  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub,IL_CAL_DATETIME));
121  }
122  else
123  {
124  $last_sub = "---";
125  }
126  if (ilExAssignment::lookupUpdatedSubmission($d["id"], $this->part_id) == 1)
127  {
128  $last_sub = "<b>".$last_sub."</b>";
129  }
130  $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
131  $this->tpl->setVariable("TXT_LAST_SUBMISSION",
132  $lng->txt("exc_last_submission"));
133 
134  // nr of submitted files
135  $this->tpl->setVariable("TXT_SUBMITTED_FILES",
136  $lng->txt("exc_files_returned"));
137  $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $d["id"], $this->part_id));
138  $new = ilExAssignment::lookupNewFiles($d["id"], $this->part_id);
139  if (count($new) > 0)
140  {
141  $sub_cnt.= " ".sprintf($lng->txt("cnt_new"),count($new));
142  }
143  $this->tpl->setVariable("VAL_SUBMITTED_FILES",
144  $sub_cnt);
145 
146  // download command
147  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
148  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
149  if ($sub_cnt > 0)
150  {
151  $this->tpl->setCurrentBlock("download_link");
152  $this->tpl->setVariable("LINK_DOWNLOAD",
153  $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
154  if (count($new) <= 0)
155  {
156  $this->tpl->setVariable("TXT_DOWNLOAD",
157  $lng->txt("exc_download_files"));
158  }
159  else
160  {
161  $this->tpl->setVariable("TXT_DOWNLOAD",
162  $lng->txt("exc_download_all"));
163  }
164  $this->tpl->parseCurrentBlock();
165 
166  // download new files only
167  if (count($new) > 0)
168  {
169  $this->tpl->setCurrentBlock("download_link");
170  $this->tpl->setVariable("LINK_NEW_DOWNLOAD",
171  $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
172  $this->tpl->setVariable("TXT_NEW_DOWNLOAD",
173  $lng->txt("exc_download_new"));
174  $this->tpl->parseCurrentBlock();
175  }
176  }
177 
178  // note
179  $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
180  $this->tpl->setVariable("NAME_NOTE",
181  "notice[".$d["id"]."]");
182  $this->tpl->setVariable("VAL_NOTE",
184 
185  // comment for learner
186  $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
187  $this->tpl->setVariable("NAME_LCOMMENT",
188  "lcomment[".$d["id"]."]");
189  $lpcomment = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id);
190  $this->tpl->setVariable("VAL_LCOMMENT",
191  ilUtil::prepareFormOutput($lpcomment));
192 
193  // solved
194  //$this->tpl->setVariable("CHKBOX_SOLVED",
195  // ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
196  $status = ilExAssignment::lookupStatusOfUser($d["id"], $this->part_id);
197  $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
198  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
199  $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
200  $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
201  if (($sd = ilExAssignment::lookupStatusTimeOfUser($d["id"], $this->part_id)) > 0)
202  {
203  $this->tpl->setCurrentBlock("status_date");
204  $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
205  $this->tpl->setVariable('VAL_STATUS_DATE',
207  $this->tpl->parseCurrentBlock();
208  }
209  switch($status)
210  {
211  case "passed": $pic = "scorm/passed.gif"; break;
212  case "failed": $pic = "scorm/failed.gif"; break;
213  default: $pic = "scorm/not_attempted.gif"; break;
214  }
215  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
216  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
217 
218  // mark
219  $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
220  $this->tpl->setVariable("NAME_MARK",
221  "mark[".$d["id"]."]");
222  $mark = ilExAssignment::lookupMarkOfUser($d["id"], $this->part_id);
223  $this->tpl->setVariable("VAL_MARK",
225 
226  // feedback
227  $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
228  if (($ft = ilExAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0)
229  {
230  $this->tpl->setCurrentBlock("feedback_date");
231  $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT",
232  sprintf($lng->txt("exc_sent_at"),
234  $this->tpl->parseCurrentBlock();
235  }
236  $ilCtrl->setParameter($this, "rcp_to", $this->user->getLogin());
237  $this->tpl->setVariable("LINK_FEEDBACK",
238  $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
239  //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin());
240  $this->tpl->setVariable("TXT_FEEDBACK",
241  $lng->txt("exc_send_mail"));
242  $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
243 
244  $storage = new ilFSStorageExercise($this->exc_id, $d["id"]);
245  $cnt_files = $storage->countFeedbackFiles($this->part_id);
246  $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedbackpart");
247  $this->tpl->setVariable("LINK_FILE_FEEDBACK",
248  $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
249  if ($cnt_files == 0)
250  {
251  $this->tpl->setVariable("TXT_FILE_FEEDBACK",
252  $lng->txt("exc_add_feedback_file"));
253  }
254  else
255  {
256  $this->tpl->setVariable("TXT_FILE_FEEDBACK",
257  $lng->txt("exc_fb_files")." (".$cnt_files.")");
258  }
259 
260 
261  $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
262  }
263 
264 }
265 ?>