ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSurveyCodesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
23 {
24  public function __construct(
25  object $a_parent_obj,
26  string $a_parent_cmd
27  ) {
28  global $DIC;
29 
30  parent::__construct($a_parent_obj, $a_parent_cmd);
31 
32  $lng = $DIC->language();
33  $ilCtrl = $DIC->ctrl();
34 
35  $this->lng = $lng;
36  $this->ctrl = $ilCtrl;
37 
38  $this->setFormName('codesform');
39 
40  $this->addColumn('', '', '1%');
41  $this->addColumn($this->lng->txt("survey_code"), 'code', '');
42  $this->addColumn($this->lng->txt("email"), 'email', '');
43  $this->addColumn($this->lng->txt("lastname"), 'last_name', '');
44  $this->addColumn($this->lng->txt("firstname"), 'first_name', '');
45  $this->addColumn($this->lng->txt("create_date"), 'date', '');
46  $this->addColumn($this->lng->txt("survey_code_used"), 'used', '');
47  $this->addColumn($this->lng->txt("mail_sent_short"), 'sent', '');
48  $this->addColumn($this->lng->txt("survey_code_url"));
49 
50  $this->setRowTemplate("tpl.il_svy_svy_codes_row.html", "Modules/Survey");
51 
52  $this->addMultiCommand('editCodes', $this->lng->txt('edit'));
53  $this->addMultiCommand('exportCodes', $this->lng->txt('export'));
54  $this->addMultiCommand('deleteCodesConfirm', $this->lng->txt('delete'));
55 
56  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
57 
58  $button = ilSubmitButton::getInstance();
59  $button->setCaption("export_all_survey_codes");
60  $button->setCommand("exportAllCodes");
61  $button->setOmitPreventDoubleSubmission(true);
62  $this->addCommandButtonInstance($button);
63 
64  $this->setDefaultOrderField("code");
65  $this->setDefaultOrderDirection("asc");
66 
67  $this->setPrefix('chb_code');
68  $this->setSelectAllCheckbox('chb_code');
69  }
70 
71  protected function fillRow(array $a_set): void
72  {
73  $lng = $this->lng;
74 
75  $this->tpl->setVariable('CB_CODE', $a_set['id']);
76 
77  // :TODO: see permalink gui
78  if (($a_set['href'] ?? '') !== '') {
79  $this->tpl->setCurrentBlock('url');
80  $this->tpl->setVariable("URL", $lng->txt("survey_code_url_name"));
81  $this->tpl->setVariable("HREF", $a_set['href']);
82  $this->tpl->parseCurrentBlock();
83  }
84 
85  $this->tpl->setVariable("USED", ($a_set['used']) ? $lng->txt("used") : $lng->txt("not_used"));
86  $this->tpl->setVariable("SENT", ($a_set['sent']) ? '&#10003;' : '');
87  $this->tpl->setVariable("USED_CLASS", ($a_set['used']) ? ' smallgreen' : ' smallred');
88  $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set['date'], IL_CAL_UNIX)));
89  $this->tpl->setVariable("CODE", $a_set['code']);
90  $this->tpl->setVariable("EMAIL", $a_set['email']);
91  $this->tpl->setVariable("LAST_NAME", $a_set['last_name']);
92  $this->tpl->setVariable("FIRST_NAME", $a_set['first_name']);
93  }
94 }
addCommandButtonInstance(ilButtonBase $a_button)
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)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
__construct(object $a_parent_obj, string $a_parent_cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
setFormName(string $a_name="")
ilLanguage $lng
global $DIC
Definition: feed.php:28
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
__construct(Container $dic, ilPlugin $plugin)
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)
addMultiCommand(string $a_cmd, string $a_text)
setPrefix(string $a_prefix)