ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.ilExSubmission.php";
6 
16 {
17  protected $ass; // [ilExAssignment]
18 
22  function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
23  {
24  global $ilCtrl, $lng;
25 
26  $this->ass = $a_ass;
27 
28  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
29 
30  parent::__construct($a_parent_obj, $a_parent_cmd);
31  $this->setData($this->ass->getMemberListData());
32  $this->setTitle($lng->txt("exc_assignment").": ".$this->ass->getTitle());
33  $this->setTopCommands(true);
34  //$this->setLimit(9999);
35 
36  $this->addColumn($this->lng->txt("name"), "name");
37  $this->addColumn($this->lng->txt("exc_submission"), "");
38 
39  $this->setDefaultOrderField("name");
40  $this->setDefaultOrderDirection("asc");
41 
42  $this->setEnableHeader(true);
43  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
44  $this->setRowTemplate("tpl.exc_public_submissions_row.html", "Modules/Exercise");
45  //$this->disable("footer");
46  $this->setEnableTitle(true);
47  }
48 
52  protected function fillRow($member)
53  {
54  global $lng, $ilCtrl;
55 
56  include_once "./Services/Object/classes/class.ilObjectFactory.php";
57  $member_id = $member["usr_id"];
58  if(!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id,false)))
59  {
60  return;
61  }
62 
63  // name and login
64  $this->tpl->setVariable("TXT_NAME",
65  $member["name"]);
66  $this->tpl->setVariable("TXT_LOGIN",
67  "[".$member["login"]."]");
68 
69  // image
70  $this->tpl->setVariable("USR_IMAGE",
71  $mem_obj->getPersonalPicturePath("xxsmall"));
72  $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
73 
74  $sub = new ilExSubmission($this->ass, $member_id);
75 
76  // submission:
77  // see if files have been resubmmited after solved
78  $last_sub = $sub->getLastSubmission();
79  if ($last_sub)
80  {
81  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub,IL_CAL_DATETIME));
82  }
83  else
84  {
85  $last_sub = "---";
86  }
87 
88  // nr of submitted files
89  $sub_cnt = count($sub->getFiles());
90 
91  $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
92  $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
93 
94  // download command
95  if ($sub_cnt > 0)
96  {
97  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", $member_id);
98  $url = $ilCtrl->getLinkTargetByClass("ilExSubmissionFileGUI", "downloadReturned");
99  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", "");
100 
101  // #15126
102  include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
103  $button = ilLinkButton::getInstance();
104  $button->setCaption("exc_download_files");
105  $button->setUrl($url);
106  $button->setOmitPreventDoubleSubmission(true);
107  $this->tpl->setVariable("BTN_DOWNLOAD", $button->render());
108  }
109 
110  $this->tpl->parseCurrentBlock();
111  }
112 
113 }
114 ?>
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
Exercise assignment.
const IL_CAL_DATETIME
$url
Definition: shib_logout.php:72
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
Constructor.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
Exercise submission.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.