ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  parent::__construct($a_parent_obj, $a_parent_cmd);
49 
50  global $lng, $ilCtrl;
51 
52  $this->raters_mode = (bool)$a_raters_mode;
53  $this->fallback_url = trim($a_fallback_url);
54 
55  $this->lng = $lng;
56  $this->ctrl = $ilCtrl;
57 
58  $this->setFormName('apprform');
59 
60  $this->addColumn('','','1%');
61  $this->addColumn($this->lng->txt("lastname"),'lastname', '');
62  $this->addColumn($this->lng->txt("firstname"),'firstname', '');
63  $this->addColumn($this->lng->txt("email"),'email', '');
64  $this->addColumn($this->lng->txt("login"),'login', '');
65 
66  if(!$this->raters_mode)
67  {
68  $this->addColumn($this->lng->txt("survey_360_raters_finished"), "finished");
69  $this->addColumn($this->lng->txt("survey_360_appraisee_close_table"), "closed");
70  $this->addColumn($this->lng->txt("actions"));
71 
72  $this->setTitle($this->lng->txt("survey_360_appraisees"));
73  }
74  else
75  {
76  $this->addColumn($this->lng->txt("survey_360_rater_finished"), "finished");
77  $this->addColumn($this->lng->txt("survey_code_url"));
78  $this->addColumn($this->lng->txt("survey_360_rater_mail_sent"), "sent");
79 
80  include_once "Services/User/classes/class.ilUserUtil.php";
81  $this->setTitle($this->lng->txt("survey_360_edit_raters")." : ".
83  }
84 
85  $this->setRowTemplate("tpl.il_svy_svy_appraisees_row.html", "Modules/Survey");
86 
87  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
88 
89  $this->setDefaultOrderField("last_name");
90  $this->setDefaultOrderDirection("asc");
91 
92  if(!$this->raters_mode)
93  {
94  $this->addCommandButton('deleteAllUserData', $this->lng->txt('svy_delete_all_user_data'));
95  $this->addMultiCommand('confirmAdminAppraiseesClose', $this->lng->txt('survey_360_appraisee_close_action'));
96  $this->addMultiCommand('confirmDeleteAppraisees', $this->lng->txt('survey_360_remove_appraisees'));
97  $this->setPrefix('appr_id');
98  $this->setSelectAllCheckbox('appr_id');
99  }
100  else
101  {
102  $this->addMultiCommand('mailRaters', $this->lng->txt('mail'));
103  if($a_may_delete_rater)
104  {
105  $this->addMultiCommand('confirmDeleteRaters', $this->lng->txt('remove'));
106  }
107  $this->setPrefix('rtr_id');
108  $this->setSelectAllCheckbox('rtr_id');
109  }
110  }
111 
119  public function fillRow($data)
120  {
121  global $lng;
122 
123  $this->tpl->setVariable('MODE', $this->raters_mode ? "rtr" : "appr");
124  $this->tpl->setVariable('ID', $data['user_id']);
125  $this->tpl->setVariable("LOGIN", $data['login']);
126  $this->tpl->setVariable("EMAIL", $data['email']);
127  $this->tpl->setVariable("LAST_NAME", $data['lastname']);
128  $this->tpl->setVariable("FIRST_NAME", $data['firstname']);
129 
130  if(!$this->raters_mode)
131  {
132  $this->tpl->setVariable("FINISHED", $data['finished']);
133  $this->tpl->setVariable("CLOSED", $data['closed'] ?
135  : "");
136 
137  $this->ctrl->setParameter($this->getParentObject(), "appr_id", $data["user_id"]);
138  $this->tpl->setVariable("URL", $lng->txt("survey_360_edit_raters"));
139  $this->tpl->setVariable("HREF", $this->ctrl->getLinkTarget($this->getParentObject(), "editRaters"));
140  $this->ctrl->setParameter($this->getParentObject(), "appr_id", "");
141  }
142  else
143  {
144  $this->tpl->setVariable("FINISHED", $data['finished'] ? $lng->txt("yes") : $lng->txt("no"));
145 
146  $sent = "";
147  if($data["sent"])
148  {
150  }
151  $this->tpl->setVariable("MAIL_SENT", $sent);
152 
153  if($data["href"] || $this->fallback_url)
154  {
155  if($data["href"])
156  {
157  $this->tpl->setVariable("DIRECT_HREF", $data["href"]);
158  }
159  else
160  {
161  $this->tpl->setVariable("DIRECT_HREF", $this->fallback_url);
162  }
163  }
164  else
165  {
166  $this->tpl->setVariable("NO_HREF", "");
167  }
168  }
169  }
170 }
171 ?>