ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPublicSubmissionsTableGUI.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 
16 {
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_ass_id)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  $this->exc = $a_exc;
26  $this->exc_id = $this->exc->getId();
27 
28  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
29 
30  $this->ass_id = $a_ass_id;
31 
32  parent::__construct($a_parent_obj, $a_parent_cmd);
33  $this->setData(ilExAssignment::getMemberListData($this->exc_id, $this->ass_id));
34  $this->setTitle($lng->txt("exc_assignment").": ".
35  ilExAssignment::lookupTitle($a_ass_id));
36  $this->setTopCommands(true);
37  //$this->setLimit(9999);
38 
39  $this->addColumn($this->lng->txt("name"), "name");
40  $this->addColumn($this->lng->txt("exc_submission"), "");
41 
42  $this->setDefaultOrderField("name");
43  $this->setDefaultOrderDirection("asc");
44 
45  $this->setEnableHeader(true);
46  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
47  $this->setRowTemplate("tpl.exc_public_submissions_row.html", "Modules/Exercise");
48  //$this->disable("footer");
49  $this->setEnableTitle(true);
50  }
51 
55  protected function fillRow($member)
56  {
57  global $lng, $ilCtrl;
58 
59  include_once "./classes/class.ilObjectFactory.php";
60  $member_id = $member["usr_id"];
61  if(!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id,false)))
62  {
63  continue;
64  }
65 
66  // name and login
67  $this->tpl->setVariable("TXT_NAME",
68  $member["name"]);
69  $this->tpl->setVariable("TXT_LOGIN",
70  "[".$member["login"]."]");
71 
72  // image
73  $this->tpl->setVariable("USR_IMAGE",
74  $mem_obj->getPersonalPicturePath("xxsmall"));
75  $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
76 
77  // submission:
78  // see if files have been resubmmited after solved
79  $last_sub =
80  ilExAssignment::getLastSubmission($this->ass_id, $member_id);
81  if ($last_sub)
82  {
83  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub,IL_CAL_DATETIME));
84  }
85  else
86  {
87  $last_sub = "---";
88  }
89 
90  // nr of submitted files
91  $this->tpl->setVariable("TXT_SUBMITTED_FILES",
92  $lng->txt("exc_files_returned"));
93  $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id));
94  $this->tpl->setVariable("VAL_SUBMITTED_FILES",
95  $sub_cnt);
96 
97  // download command
98  $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
99  if ($sub_cnt > 0)
100  {
101  $this->tpl->setCurrentBlock("download_link");
102  $this->tpl->setVariable("LINK_DOWNLOAD",
103  $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
104  $this->tpl->setVariable("TXT_DOWNLOAD",
105  $lng->txt("exc_download_files"));
106  $this->tpl->parseCurrentBlock();
107 
108  }
109 
110  $this->tpl->parseCurrentBlock();
111  }
112 
113 }
114 ?>