ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExerciseMemberTableGUI.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 
15 {
16 
20  function __construct($a_parent_obj, $a_parent_cmd, $a_exc)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng;
23 
24  $this->exc = $a_exc;
25 
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27  $this->setData($this->exc->getMemberListData());
28  $this->setTitle($lng->txt("members"));
29  //$this->setLimit(9999);
30 
31  $this->addColumn("", "", "1", true);
32  $this->addColumn($this->lng->txt("image"), "", "1");
33  $this->addColumn($this->lng->txt("name"), "name");
34  $this->addColumn($this->lng->txt("login"), "login");
35  $this->sent_col = $this->exc->_lookupAnyExerciseSent($this->exc->getId());
36  if ($this->sent_col)
37  {
38  $this->addColumn($this->lng->txt("exc_exercise_sent"), "sent_time");
39  }
40  $this->addColumn($this->lng->txt("exc_submission"), "submission");
41  $this->addColumn($this->lng->txt("exc_grading"), "solved_time");
42  $this->addColumn($this->lng->txt("mail"), "feedback_time");
43 
44  $this->setDefaultOrderField("name");
45  $this->setDefaultOrderDirection("asc");
46 
47  $this->setEnableHeader(true);
48  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
49  $this->setRowTemplate("tpl.exc_members_row.html", "Modules/Exercise");
50  //$this->disable("footer");
51  $this->setEnableTitle(true);
52  $this->setSelectAllCheckbox("member");
53 
54  $this->addMultiCommand("saveStatus", $lng->txt("exc_save_changes"));
55  $this->addMultiCommand("redirectFeedbackMail", $lng->txt("exc_send_mail"));
56  $this->addMultiCommand("sendMembers", $lng->txt("exc_send_exercise"));
57  $this->addMultiCommand("deassignMembers", $lng->txt("exc_deassign_members"));
58 
59  if(count($this->exc->members_obj->getAllDeliveredFiles()))
60  {
61  $this->addCommandButton("downloadAll", $lng->txt("download_all_returned_files"));
62  }
63 
64 
65 // $this->addCommandButton("", $lng->txt(""));
66  }
67 
71  protected function fillRow($member)
72  {
73  global $lng, $ilCtrl;
74 
75  include_once "./classes/class.ilObjectFactory.php";
76  $member_id = $member["usr_id"];
77  if(!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id,false)))
78  {
79  continue;
80  }
81 
82  // mail sent
83  if ($this->sent_col)
84  {
85  if ($this->exc->members_obj->getStatusSentByMember($member_id))
86  {
87  $this->tpl->setCurrentBlock("mail_sent");
88  if (($st = ilObjExercise::_lookupSentTime($this->exc->getId(),
89  $member_id)) > 0)
90  {
91  $this->tpl->setVariable("TXT_MAIL_SENT",
92  sprintf($lng->txt("exc_sent_at"),
94  }
95  else
96  {
97  $this->tpl->setVariable("TXT_MAIL_SENT",
98  $lng->txt("sent"));
99  }
100  $this->tpl->parseCurrentBlock();
101  }
102  else
103  {
104  $this->tpl->setCurrentBlock("mail_sent");
105  $this->tpl->setVariable("TXT_MAIL_SENT",
106  "&nbsp;");
107  $this->tpl->parseCurrentBlock();
108  }
109  }
110 
111  // checkbox
112  $this->tpl->setVariable("VAL_CHKBOX",
113  ilUtil::formCheckbox(0,"member[$member_id]",1));
114  $this->tpl->setVariable("VAL_ID",
115  $member_id);
116 
117  // name and login
118  $this->tpl->setVariable("TXT_NAME",
119  $member["name"]);
120  $this->tpl->setVariable("TXT_LOGIN",
121  "[".$member["login"]."]");
122 
123  // image
124  $this->tpl->setVariable("USR_IMAGE",
125  $mem_obj->getPersonalPicturePath("xxsmall"));
126  $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
127 
128  // submission:
129  // see if files have been resubmmited after solved
130  $last_sub =
131  $this->exc->getLastSubmission($member_id);
132 
133  if ($last_sub)
134  {
135  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub,IL_CAL_DATETIME));
136  }
137  else
138  {
139  $last_sub = "---";
140  }
141  if ($this->exc->_lookupUpdatedSubmission($this->exc->getId(), $member_id) == 1)
142  {
143  $last_sub = "<b>".$last_sub."</b>";
144  }
145  $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
146  $this->tpl->setVariable("TXT_LAST_SUBMISSION",
147  $lng->txt("exc_last_submission"));
148 
149  // nr of submitted files
150  $this->tpl->setVariable("TXT_SUBMITTED_FILES",
151  $lng->txt("exc_files_returned"));
152  $sub_cnt = count($this->exc->getDeliveredFiles($member_id));
153  $new = $this->exc->_lookupNewFiles($this->exc->getId(), $member_id);
154  if (count($new) > 0)
155  {
156  $sub_cnt.= " ".sprintf($lng->txt("cnt_new"),count($new));
157  }
158  $this->tpl->setVariable("VAL_SUBMITTED_FILES",
159  $sub_cnt);
160 
161  // download command
162  $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
163  if ($sub_cnt > 0)
164  {
165  $this->tpl->setCurrentBlock("download_link");
166  $this->tpl->setVariable("LINK_DOWNLOAD",
167  $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
168  if (count($new) <= 0)
169  {
170  $this->tpl->setVariable("TXT_DOWNLOAD",
171  $lng->txt("exc_download_files"));
172  }
173  else
174  {
175  $this->tpl->setVariable("TXT_DOWNLOAD",
176  $lng->txt("exc_download_all"));
177  }
178  $this->tpl->parseCurrentBlock();
179 
180  // download new files only
181  if (count($new) > 0)
182  {
183  $this->tpl->setCurrentBlock("download_link");
184  $this->tpl->setVariable("LINK_NEW_DOWNLOAD",
185  $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
186  $this->tpl->setVariable("TXT_NEW_DOWNLOAD",
187  $lng->txt("exc_download_new"));
188  $this->tpl->parseCurrentBlock();
189  }
190  }
191 
192  // note
193  $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
194  $this->tpl->setVariable("NAME_NOTE",
195  "notice[$member_id]");
196  $this->tpl->setVariable("VAL_NOTE",
197  ilUtil::prepareFormOutput($this->exc->members_obj->getNoticeByMember($member_id)));
198 
199  // comment for learner
200  $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner"));
201  $this->tpl->setVariable("NAME_LCOMMENT",
202  "lcomment[$member_id]");
203  $lpcomment = ilLPMarks::_lookupComment($member_id,$this->exc->getId());
204  $this->tpl->setVariable("VAL_LCOMMENT",
205  ilUtil::prepareFormOutput($lpcomment));
206 
207  // solved
208  //$this->tpl->setVariable("CHKBOX_SOLVED",
209  // ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
210  $status = ilExerciseMembers::_lookupStatus($this->exc->getId(), $member_id);
211  $this->tpl->setVariable("SEL_".strtoupper($status), ' selected="selected" ');
212  $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
213  $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
214  $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
215  if (($sd = ilObjExercise::_lookupStatusTime($this->exc->getId(), $member_id)) > 0)
216  {
217  $this->tpl->setCurrentBlock("status_date");
218  $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
219  $this->tpl->setVariable('VAL_STATUS_DATE',
221  $this->tpl->parseCurrentBlock();
222  }
223  switch($status)
224  {
225  case "passed": $pic = "scorm/passed.gif"; break;
226  case "failed": $pic = "scorm/failed.gif"; break;
227  default: $pic = "scorm/not_attempted.gif"; break;
228  }
229  $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
230  $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_".$status));
231 
232  // mark
233  $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
234  $this->tpl->setVariable("NAME_MARK",
235  "mark[$member_id]");
236  $mark = ilLPMarks::_lookupMark($member_id,$this->exc->getId());
237  $this->tpl->setVariable("VAL_MARK",
239 
240  // feedback
241  $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
242  $this->tpl->setVariable("CHKBOX_FEEDBACK",
243  ilUtil::formCheckbox($this->exc->members_obj->getStatusFeedbackByMember($member_id),"feedback[$member_id]",1));
244  if (($ft = ilObjExercise::_lookupFeedbackTime($this->exc->getId(), $member_id)) > 0)
245  {
246  $this->tpl->setCurrentBlock("feedback_date");
247  $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT",
248  sprintf($lng->txt("exc_sent_at"),
250  $this->tpl->parseCurrentBlock();
251  }
252  $ilCtrl->setParameter($this, "rcp_to", $mem_obj->getLogin());
253  $this->tpl->setVariable("LINK_FEEDBACK",
254  $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
255  //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin());
256  $this->tpl->setVariable("TXT_FEEDBACK",
257  $lng->txt("exc_send_mail"));
258  $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
259 
260  $this->tpl->parseCurrentBlock();
261  }
262 
263 }
264 ?>