ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  public function __construct($a_parent_obj, $a_parent_cmd, ilExAssignment $a_ass)
23  {
24  global $DIC;
25 
26  $this->ctrl = $DIC->ctrl();
27  $this->lng = $DIC->language();
28  $ilCtrl = $DIC->ctrl();
29  $lng = $DIC->language();
30 
31  $this->ass = $a_ass;
32 
33  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
34 
35  parent::__construct($a_parent_obj, $a_parent_cmd);
36  $this->setData($this->ass->getMemberListData());
37  $this->setTitle($lng->txt("exc_assignment") . ": " . $this->ass->getTitle());
38  $this->setTopCommands(true);
39  //$this->setLimit(9999);
40 
41  $this->addColumn($this->lng->txt("name"), "name");
42  $this->addColumn($this->lng->txt("exc_submission"), "");
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_public_submissions_row.html", "Modules/Exercise");
50  //$this->disable("footer");
51  $this->setEnableTitle(true);
52  }
53 
57  protected function fillRow($member)
58  {
59  $lng = $this->lng;
61 
62  include_once "./Services/Object/classes/class.ilObjectFactory.php";
63  $member_id = $member["usr_id"];
64  if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
65  return;
66  }
67 
68  // name and login
69  $this->tpl->setVariable(
70  "TXT_NAME",
71  $member["name"]
72  );
73  $this->tpl->setVariable(
74  "TXT_LOGIN",
75  "[" . $member["login"] . "]"
76  );
77 
78  // image
79  $this->tpl->setVariable(
80  "USR_IMAGE",
81  $mem_obj->getPersonalPicturePath("xxsmall")
82  );
83  $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
84 
85  $sub = new ilExSubmission($this->ass, $member_id);
86 
87  // submission:
88  // see if files have been resubmmited after solved
89  $last_sub = $sub->getLastSubmission();
90  if ($last_sub) {
91  $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
92  } else {
93  $last_sub = "---";
94  }
95 
96  // nr of submitted files
97  $sub_cnt = count($sub->getFiles());
98 
99  $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
100  $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
101 
102  // download command
103  if ($sub_cnt > 0) {
104  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", $member_id);
105  $url = $ilCtrl->getLinkTargetByClass("ilExSubmissionFileGUI", "downloadReturned");
106  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", "");
107 
108  // #15126
109  include_once("./Services/UIComponent/Button/classes/class.ilLinkButton.php");
110  $button = ilLinkButton::getInstance();
111  $button->setCaption("exc_download_files");
112  $button->setUrl($url);
113  $button->setOmitPreventDoubleSubmission(true);
114  $this->tpl->setVariable("BTN_DOWNLOAD", $button->render());
115  }
116 
117  $this->tpl->parseCurrentBlock();
118  }
119 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
Exercise assignment.
const IL_CAL_DATETIME
global $DIC
Definition: saml.php:7
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
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.
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.
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.
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
setEnableHeader($a_enableheader)
Set Enable Header.
$url
setEnableTitle($a_enabletitle)
Set Enable Title.