ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilSurveyAppraiseesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
23 {
24  protected \ILIAS\Survey\Editing\EditingGUIRequest $edit_request;
25  protected bool $raters_mode;
26  protected string $fallback_url;
27 
28  public function __construct(
29  object $a_parent_obj,
30  string $a_parent_cmd,
31  bool $a_raters_mode = false,
32  bool $a_may_delete_rater = false,
33  ?string $a_fallback_url = null
34  ) {
35  global $DIC;
36 
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38 
39  $lng = $DIC->language();
40  $ilCtrl = $DIC->ctrl();
41 
42  $this->raters_mode = $a_raters_mode;
43  $this->fallback_url = trim($a_fallback_url ?? "");
44 
45  $this->lng = $lng;
46  $this->ctrl = $ilCtrl;
47 
48  $this->setFormName('apprform');
49 
50  $this->addColumn('', '', '1%');
51  $this->addColumn($this->lng->txt("name"), 'name', '');
52  $this->addColumn($this->lng->txt("login"), 'login', '');
53  $this->addColumn($this->lng->txt("email"), 'email', '');
54 
55  $this->edit_request = $DIC->survey()
56  ->internal()
57  ->gui()
58  ->editing()
59  ->request();
60 
61  if (!$this->raters_mode) {
62  $this->addColumn($this->lng->txt("survey_360_raters_finished"), "finished");
63  $this->addColumn($this->lng->txt("survey_360_appraisee_close_table"), "closed");
64  $this->addColumn($this->lng->txt("actions"));
65 
66  $this->setTitle($this->lng->txt("survey_360_appraisees"));
67  } else {
68  $this->addColumn($this->lng->txt("survey_360_rater_finished"), "finished");
69  $this->addColumn($this->lng->txt("survey_code_url"));
70  $this->addColumn($this->lng->txt("survey_360_rater_mail_sent"), "sent");
71 
72  $this->setTitle(
73  $this->lng->txt("survey_360_edit_raters") . " : " .
74  ilUserUtil::getNamePresentation($this->edit_request->getAppraiseeId())
75  );
76  }
77 
78  $this->setRowTemplate("tpl.il_svy_svy_appraisees_row.html", "components/ILIAS/Survey");
79 
80  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
81 
82  $this->setDefaultOrderField("last_name");
83  $this->setDefaultOrderDirection("asc");
84 
85  if (!$this->raters_mode) {
86  $this->addMultiCommand('confirmAdminAppraiseesClose', $this->lng->txt('survey_360_appraisee_close_action'));
87  $this->addMultiCommand('confirmDeleteAppraisees', $this->lng->txt('survey_360_remove_appraisees'));
88  $this->setPrefix('appr_id');
89  $this->setSelectAllCheckbox('appr_id');
90  } else {
91  $this->addMultiCommand('mailRaters', $this->lng->txt('mail'));
92  if ($a_may_delete_rater) {
93  $this->addMultiCommand('confirmDeleteRaters', $this->lng->txt('remove'));
94  }
95  $this->setPrefix('rtr_id');
96  $this->setSelectAllCheckbox('rtr_id');
97  }
98  }
99 
100  protected function fillRow(array $a_set): void
101  {
102  $lng = $this->lng;
103 
104  if (!$this->raters_mode) {
105  if ($a_set['closed']) {
106  $this->tpl->setVariable("CLOSED", ilDatePresentation::formatDate(new ilDateTime($a_set['closed'], IL_CAL_UNIX)));
107  } else {
108  $this->tpl->setCurrentBlock("cb");
109  $this->tpl->setVariable('MODE', "appr");
110  $this->tpl->setVariable('ID', $a_set['user_id']);
111  $this->tpl->parseCurrentBlock();
112  $this->tpl->setVariable("CLOSED", "");
113  }
114 
115  $this->tpl->setVariable("FINISHED", $a_set['finished']);
116 
117  $this->ctrl->setParameter($this->getParentObject(), "appr_id", $a_set["user_id"]);
118  $this->tpl->setVariable("URL", $lng->txt("survey_360_edit_raters"));
119  $this->tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this->getParentObject(), "editRaters"));
120  $this->ctrl->setParameter($this->getParentObject(), "appr_id", "");
121  } else {
122  $this->tpl->setVariable('MODE', "rtr");
123  $this->tpl->setVariable('ID', $a_set['user_id']);
124  $this->tpl->setVariable("FINISHED", $a_set['finished'] ? $lng->txt("yes") : $lng->txt("no"));
125 
126  $sent = "";
127  if ($a_set["sent"]) {
128  $sent = ilDatePresentation::formatDate(new ilDateTime($a_set["sent"], IL_CAL_UNIX));
129  }
130  $this->tpl->setVariable("MAIL_SENT", $sent);
131 
132  if (($a_set["href"] ?? false) || $this->fallback_url) {
133  if ($a_set["href"] ?? false) {
134  $this->tpl->setVariable("DIRECT_HREF", $a_set["href"]);
135  } else {
136  $this->tpl->setVariable("DIRECT_HREF", $this->fallback_url);
137  }
138  } else {
139  $this->tpl->setVariable("NO_HREF", "");
140  }
141  }
142 
143  $this->tpl->setVariable("LOGIN", $a_set['login']);
144  $this->tpl->setVariable("EMAIL", $a_set['email']);
145  $this->tpl->setVariable("NAME", $a_set['name']);
146  }
147 }
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)
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $a_raters_mode=false, bool $a_may_delete_rater=false, ?string $a_fallback_url=null)
global $DIC
Definition: shib_login.php:22
setDefaultOrderDirection(string $a_defaultorderdirection)
ILIAS Survey Editing EditingGUIRequest $edit_request
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(Container $dic, ilPlugin $plugin)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
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)