ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSurveyAppraiseesTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
10 {
11  protected $raters_mode; // [bool]
12  protected $fallback_url; // [string]
13 
21  public function __construct($a_parent_obj, $a_parent_cmd, $a_raters_mode = false, $a_may_delete_rater = false, $a_fallback_url = null)
22  {
23  global $DIC;
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26 
27  $lng = $DIC->language();
28  $ilCtrl = $DIC->ctrl();
29 
30  $this->raters_mode = (bool) $a_raters_mode;
31  $this->fallback_url = trim($a_fallback_url);
32 
33  $this->lng = $lng;
34  $this->ctrl = $ilCtrl;
35 
36  $this->setFormName('apprform');
37 
38  $this->addColumn('', '', '1%');
39  $this->addColumn($this->lng->txt("name"), 'name', '');
40  $this->addColumn($this->lng->txt("login"), 'login', '');
41  $this->addColumn($this->lng->txt("email"), 'email', '');
42 
43  if (!$this->raters_mode) {
44  $this->addColumn($this->lng->txt("survey_360_raters_finished"), "finished");
45  $this->addColumn($this->lng->txt("survey_360_appraisee_close_table"), "closed");
46  $this->addColumn($this->lng->txt("actions"));
47 
48  $this->setTitle($this->lng->txt("survey_360_appraisees"));
49  } else {
50  $this->addColumn($this->lng->txt("survey_360_rater_finished"), "finished");
51  $this->addColumn($this->lng->txt("survey_code_url"));
52  $this->addColumn($this->lng->txt("survey_360_rater_mail_sent"), "sent");
53 
54  $this->setTitle($this->lng->txt("survey_360_edit_raters") . " : " .
55  ilUserUtil::getNamePresentation($_REQUEST["appr_id"]));
56  }
57 
58  $this->setRowTemplate("tpl.il_svy_svy_appraisees_row.html", "Modules/Survey");
59 
60  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
61 
62  $this->setDefaultOrderField("last_name");
63  $this->setDefaultOrderDirection("asc");
64 
65  if (!$this->raters_mode) {
66  $this->addMultiCommand('confirmAdminAppraiseesClose', $this->lng->txt('survey_360_appraisee_close_action'));
67  $this->addMultiCommand('confirmDeleteAppraisees', $this->lng->txt('survey_360_remove_appraisees'));
68  $this->setPrefix('appr_id');
69  $this->setSelectAllCheckbox('appr_id');
70  } else {
71  $this->addMultiCommand('mailRaters', $this->lng->txt('mail'));
72  if ($a_may_delete_rater) {
73  $this->addMultiCommand('confirmDeleteRaters', $this->lng->txt('remove'));
74  }
75  $this->setPrefix('rtr_id');
76  $this->setSelectAllCheckbox('rtr_id');
77  }
78  }
79 
87  public function fillRow($data)
88  {
89  $lng = $this->lng;
90 
91  if (!$this->raters_mode) {
92  if ($data['closed']) {
93  $this->tpl->setVariable("CLOSED", ilDatePresentation::formatDate(new ilDateTime($data['closed'], IL_CAL_UNIX)));
94  } else {
95  $this->tpl->setCurrentBlock("cb");
96  $this->tpl->setVariable('MODE', $this->raters_mode ? "rtr" : "appr");
97  $this->tpl->setVariable('ID', $data['user_id']);
98  $this->tpl->parseCurrentBlock();
99  $this->tpl->setVariable("CLOSED", "");
100  }
101 
102  $this->tpl->setVariable("FINISHED", $data['finished']);
103 
104  $this->ctrl->setParameter($this->getParentObject(), "appr_id", $data["user_id"]);
105  $this->tpl->setVariable("URL", $lng->txt("survey_360_edit_raters"));
106  $this->tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this->getParentObject(), "editRaters"));
107  $this->ctrl->setParameter($this->getParentObject(), "appr_id", "");
108  } else {
109  $this->tpl->setVariable('MODE', $this->raters_mode ? "rtr" : "appr");
110  $this->tpl->setVariable('ID', $data['user_id']);
111  $this->tpl->setVariable("FINISHED", $data['finished'] ? $lng->txt("yes") : $lng->txt("no"));
112 
113  $sent = "";
114  if ($data["sent"]) {
116  }
117  $this->tpl->setVariable("MAIL_SENT", $sent);
118 
119  if ($data["href"] || $this->fallback_url) {
120  if ($data["href"]) {
121  $this->tpl->setVariable("DIRECT_HREF", $data["href"]);
122  } else {
123  $this->tpl->setVariable("DIRECT_HREF", $this->fallback_url);
124  }
125  } else {
126  $this->tpl->setVariable("NO_HREF", "");
127  }
128  }
129 
130  $this->tpl->setVariable("LOGIN", $data['login']);
131  $this->tpl->setVariable("EMAIL", $data['email']);
132  $this->tpl->setVariable("NAME", $data['name']);
133  }
134 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
global $DIC
Definition: goto.php:24
addMultiCommand($a_cmd, $a_text)
Add Command button.
setPrefix($a_prefix)
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
setRowTemplate($a_template, $a_template_dir="")
Set row template.
__construct($a_parent_obj, $a_parent_cmd, $a_raters_mode=false, $a_may_delete_rater=false, $a_fallback_url=null)
Constructor.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
__construct(Container $dic, ilPlugin $plugin)
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.