ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilPublicSubmissionsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected \ILIAS\Exercise\InternalGUIService $gui;
27  protected ilExAssignment $ass;
28 
29  public function __construct(
30  object $a_parent_obj,
31  string $a_parent_cmd,
32  ilExAssignment $a_ass
33  ) {
34  global $DIC;
35 
36  $this->ctrl = $DIC->ctrl();
37  $this->lng = $DIC->language();
38  $ilCtrl = $DIC->ctrl();
39  $lng = $DIC->language();
40 
41  $this->ass = $a_ass;
42 
43  parent::__construct($a_parent_obj, $a_parent_cmd);
44  $this->setData($this->ass->getMemberListData());
45  $this->setTitle($lng->txt("exc_assignment") . ": " . $this->ass->getTitle());
46  $this->setTopCommands(true);
47  //$this->setLimit(9999);
48 
49  $this->addColumn($this->lng->txt("name"), "name");
50  $this->addColumn($this->lng->txt("exc_submission"), "");
51 
52  $this->setDefaultOrderField("name");
53  $this->setDefaultOrderDirection("asc");
54 
55  $this->setEnableHeader(true);
56  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
57  $this->setRowTemplate("tpl.exc_public_submissions_row.html", "Modules/Exercise");
58  //$this->disable("footer");
59  $this->setEnableTitle(true);
60  $this->gui = $DIC->exercise()->internal()->gui();
61  }
62 
67  protected function fillRow(array $a_set): void
68  {
69  $lng = $this->lng;
70  $ilCtrl = $this->ctrl;
71 
72  $member_id = $a_set["usr_id"];
73  if (($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false)) === null) {
74  return;
75  }
76 
77  // name and login
78  $this->tpl->setVariable(
79  "TXT_NAME",
80  $a_set["name"]
81  );
82  $this->tpl->setVariable(
83  "TXT_LOGIN",
84  "[" . $a_set["login"] . "]"
85  );
86 
87  // image
88  $this->tpl->setVariable(
89  "USR_IMAGE",
90  $mem_obj->getPersonalPicturePath("xxsmall")
91  );
92  $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
93 
94  $sub = new ilExSubmission($this->ass, $member_id);
95 
96  // submission:
97 
98  // nr of submitted files
99  $sub_cnt = count($sub->getFiles());
100 
101  $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned"));
102  $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
103 
104  // download command
105  if ($sub_cnt > 0) {
106  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", $member_id);
107  $url = $ilCtrl->getLinkTargetByClass("ilExSubmissionFileGUI", "downloadReturned");
108  $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "member_id", "");
109 
110  // #15126
111  $button = $this->gui->button(
112  $lng->txt("exc_download_files"),
113  $url
114  );
115  $this->tpl->setVariable("BTN_DOWNLOAD", $button->render());
116  }
117 
118  $this->tpl->parseCurrentBlock();
119  }
120 }
setData(array $a_data)
setTopCommands(bool $a_val)
Exercise assignment.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
__construct(object $a_parent_obj, string $a_parent_cmd, ilExAssignment $a_ass)
ilLanguage $lng
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
$url
Definition: ltiregstart.php:35
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Exercise InternalGUIService $gui
setEnableHeader(bool $a_enableheader)