ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSurveyAppraiseesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 
35 {
36  protected $raters_mode; // [bool]
37  protected $fallback_url; // [string]
38 
46  public function __construct($a_parent_obj, $a_parent_cmd, $a_raters_mode = false, $a_may_delete_rater = false, $a_fallback_url = null)
47  {
48  global $DIC;
49 
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  $lng = $DIC->language();
53  $ilCtrl = $DIC->ctrl();
54 
55  $this->raters_mode = (bool) $a_raters_mode;
56  $this->fallback_url = trim($a_fallback_url);
57 
58  $this->lng = $lng;
59  $this->ctrl = $ilCtrl;
60 
61  $this->setFormName('apprform');
62 
63  $this->addColumn('', '', '1%');
64  $this->addColumn($this->lng->txt("name"), 'name', '');
65  $this->addColumn($this->lng->txt("login"), 'login', '');
66  $this->addColumn($this->lng->txt("email"), 'email', '');
67 
68  if (!$this->raters_mode) {
69  $this->addColumn($this->lng->txt("survey_360_raters_finished"), "finished");
70  $this->addColumn($this->lng->txt("survey_360_appraisee_close_table"), "closed");
71  $this->addColumn($this->lng->txt("actions"));
72 
73  $this->setTitle($this->lng->txt("survey_360_appraisees"));
74  } else {
75  $this->addColumn($this->lng->txt("survey_360_rater_finished"), "finished");
76  $this->addColumn($this->lng->txt("survey_code_url"));
77  $this->addColumn($this->lng->txt("survey_360_rater_mail_sent"), "sent");
78 
79  include_once "Services/User/classes/class.ilUserUtil.php";
80  $this->setTitle($this->lng->txt("survey_360_edit_raters") . " : " .
81  ilUserUtil::getNamePresentation($_REQUEST["appr_id"]));
82  }
83 
84  $this->setRowTemplate("tpl.il_svy_svy_appraisees_row.html", "Modules/Survey");
85 
86  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
87 
88  $this->setDefaultOrderField("last_name");
89  $this->setDefaultOrderDirection("asc");
90 
91  if (!$this->raters_mode) {
92  $this->addMultiCommand('confirmAdminAppraiseesClose', $this->lng->txt('survey_360_appraisee_close_action'));
93  $this->addMultiCommand('confirmDeleteAppraisees', $this->lng->txt('survey_360_remove_appraisees'));
94  $this->setPrefix('appr_id');
95  $this->setSelectAllCheckbox('appr_id');
96  } else {
97  $this->addMultiCommand('mailRaters', $this->lng->txt('mail'));
98  if ($a_may_delete_rater) {
99  $this->addMultiCommand('confirmDeleteRaters', $this->lng->txt('remove'));
100  }
101  $this->setPrefix('rtr_id');
102  $this->setSelectAllCheckbox('rtr_id');
103  }
104  }
105 
113  public function fillRow($data)
114  {
115  $lng = $this->lng;
116 
117  if (!$this->raters_mode) {
118  if ($data['closed']) {
119  $this->tpl->setVariable("CLOSED", ilDatePresentation::formatDate(new ilDateTime($data['closed'], IL_CAL_UNIX)));
120  } else {
121  $this->tpl->setCurrentBlock("cb");
122  $this->tpl->setVariable('MODE', $this->raters_mode ? "rtr" : "appr");
123  $this->tpl->setVariable('ID', $data['user_id']);
124  $this->tpl->parseCurrentBlock();
125  $this->tpl->setVariable("CLOSED", "");
126  }
127 
128  $this->tpl->setVariable("FINISHED", $data['finished']);
129 
130  $this->ctrl->setParameter($this->getParentObject(), "appr_id", $data["user_id"]);
131  $this->tpl->setVariable("URL", $lng->txt("survey_360_edit_raters"));
132  $this->tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this->getParentObject(), "editRaters"));
133  $this->ctrl->setParameter($this->getParentObject(), "appr_id", "");
134  } else {
135  $this->tpl->setVariable('MODE', $this->raters_mode ? "rtr" : "appr");
136  $this->tpl->setVariable('ID', $data['user_id']);
137  $this->tpl->setVariable("FINISHED", $data['finished'] ? $lng->txt("yes") : $lng->txt("no"));
138 
139  $sent = "";
140  if ($data["sent"]) {
142  }
143  $this->tpl->setVariable("MAIL_SENT", $sent);
144 
145  if ($data["href"] || $this->fallback_url) {
146  if ($data["href"]) {
147  $this->tpl->setVariable("DIRECT_HREF", $data["href"]);
148  } else {
149  $this->tpl->setVariable("DIRECT_HREF", $this->fallback_url);
150  }
151  } else {
152  $this->tpl->setVariable("NO_HREF", "");
153  }
154  }
155 
156  $this->tpl->setVariable("LOGIN", $data['login']);
157  $this->tpl->setVariable("EMAIL", $data['email']);
158  $this->tpl->setVariable("NAME", $data['name']);
159  }
160 }
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
getParentObject()
Get parent object.
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.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setPrefix($a_prefix)
Date and time handling
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.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.