ILIAS  release_8 Revision v8.24
ilSurveyRaterGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilSurveyRaterGUI:

Public Member Functions

 __construct (ilSurveyParticipantsGUI $parent, ilObjSurvey $survey)
 
 executeCommand ()
 
 initOptionSelectForm ()
 
 doAutoComplete ()
 
 addRater (ilPropertyFormGUI $form)
 
 mailRaters (ilPropertyFormGUI $a_form=null)
 
 initMailRatersForm (int $appr_id, array $rec_ids)
 
 mailRatersAction ()
 
 addExternalRater (ilPropertyFormGUI $form)
 
 addFromSearch (array $user_ids)
 

Protected Member Functions

 cancel ()
 
 add (ilPropertyFormGUI $form=null)
 
 continue ()
 

Protected Attributes

ILIAS Survey Editing EditingGUIRequest $edit_request
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ILIAS DI UIServices $ui
 
ILIAS Refinery Factory $refinery
 
ilGlobalTemplateInterface $main_tpl
 
ilSurveyParticipantsGUI $parent
 
ilObjSurvey $survey
 
ilObjUser $user
 
ilAccessHandler $access
 
ilTabsGUI $tabs
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_Calls ilSurveyRaterGUI: ilRepositorySearchGUI

Definition at line 25 of file class.ilSurveyRaterGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyRaterGUI::__construct ( ilSurveyParticipantsGUI  $parent,
ilObjSurvey  $survey 
)

Definition at line 39 of file class.ilSurveyRaterGUI.php.

42 {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->ui = $DIC->ui();
48 $this->refinery = $DIC->refinery();
49 $this->main_tpl = $DIC->ui()->mainTemplate();
50 $this->parent = $parent;
51 $this->survey = $survey;
52 $this->user = $DIC->user();
53 $this->access = $DIC->access();
54 $this->tabs = $DIC->tabs();
55
56 $this->ctrl->saveParameter($this, "appr_id");
57 $this->edit_request = $DIC->survey()
58 ->internal()
59 ->gui()
60 ->editing()
61 ->request();
62 }
ilSurveyParticipantsGUI $parent
global $DIC
Definition: feed.php:28

References $DIC, $parent, $survey, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilSurveyRaterGUI::add ( ilPropertyFormGUI  $form = null)
protected

Definition at line 109 of file class.ilSurveyRaterGUI.php.

111 : void {
112 $form_html = (!is_null($form))
113 ? $form->getHTML()
114 : $this->initOptionSelectForm()->getHTML();
116 $main_tpl->setContent($form_html);
117 }
ilGlobalTemplateInterface $main_tpl
setContent(string $a_html)
Sets content for standard template.

◆ addExternalRater()

ilSurveyRaterGUI::addExternalRater ( ilPropertyFormGUI  $form)

Definition at line 410 of file class.ilSurveyRaterGUI.php.

410 : void
411 {
412 $appr_id = $this->edit_request->getAppraiseeId();
413
414 if (!$appr_id) {
415 $this->ctrl->redirect($this, "listAppraisees");
416 }
417
418 $this->ctrl->setParameter($this, "appr_id", $appr_id);
419
420 $code_id = $this->parent->addCodeForExternal(
421 $form->getInput("email"),
422 $form->getInput("lname"),
423 $form->getInput("fname")
424 );
425
426 $this->survey->addRater($appr_id, 0, $code_id);
427
428 $this->ctrl->setParameter($this->parent, "appr_id", $appr_id);
429 if ($code_id > 0) {
430 $this->ctrl->setParameter($this, "rater_id", "a" . $code_id);
431 $this->ctrl->redirect($this, "mailRaters");
432 }
433 $this->ctrl->redirect($this->parent, "editRaters");
434 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ILIAS\Repository\ctrl(), and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ addFromSearch()

ilSurveyRaterGUI::addFromSearch ( array  $user_ids)

Definition at line 436 of file class.ilSurveyRaterGUI.php.

438 : void {
439 // check access
440 $ilAccess = $this->access;
442
443 $user_id = 0;
444
445 $appr_id = $this->parent->handleRatersAccess();
446
447 foreach ($user_ids as $user_id) {
448 if ($user_id > 0) {
449 if ($ilAccess->checkAccess("write", "", $this->survey->getRefId()) ||
450 $this->survey->get360SelfEvaluation() ||
451 $user_id != $ilUser->getId()) {
452 if ($appr_id != $user_id) {
453 $this->survey->addRater($appr_id, $user_id);
454 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
455 } else {
456 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("svy_appraisses_cannot_be_raters"), true);
457 $user_id = 0;
458 }
459 }
460 }
461 }
462
463 $user_str = implode(";", array_map(static function ($u): string {
464 return "u" . $u;
465 }, $user_ids));
466
467 $this->ctrl->setParameter($this->parent, "appr_id", $appr_id);
468 if ($user_id > 0) {
469 $this->ctrl->setParameter($this, "rater_id", $user_str);
470 $this->ctrl->redirect($this, "mailRaters");
471 }
472 $this->ctrl->redirect($this->parent, "editRaters");
473 }
$ilUser
Definition: imgupload.php:34

References $ilUser, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addRater()

ilSurveyRaterGUI::addRater ( ilPropertyFormGUI  $form)

Definition at line 223 of file class.ilSurveyRaterGUI.php.

223 : void
224 {
225 // check access
226 $ilAccess = $this->access;
228
229 $appr_id = $this->parent->handleRatersAccess();
230 $user = $form->getInput("user");
231 $user_id = ilObjUser::_lookupId($user);
232 if ($user_id > 0) {
233 if ($ilAccess->checkAccess("write", "", $this->survey->getRefId()) ||
234 $this->survey->get360SelfEvaluation() ||
235 $user_id !== $ilUser->getId()) {
236 if ($appr_id !== $user_id) {
237 $this->survey->addRater($appr_id, $user_id);
238 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
239 } else {
240 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt("svy_appraisses_cannot_be_raters"), true);
241 $user_id = 0;
242 }
243 }
244 } else {
245 $this->main_tpl->setOnScreenMessage(
246 'failure',
247 $this->lng->txt("svy_user_not_found") . " (" . $user . ")",
248 true
249 );
250 }
251
252 $this->ctrl->setParameter($this->parent, "appr_id", $appr_id);
253 if ($user_id > 0) {
254 $this->ctrl->setParameter($this, "rater_id", "u" . $user_id);
255 $this->ctrl->redirect($this, "mailRaters");
256 }
257 $this->ctrl->redirect($this->parent, "editRaters");
258 }
static _lookupId($a_user_str)

References $ilUser, ilObjUser\_lookupId(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getInput(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ cancel()

ilSurveyRaterGUI::cancel ( )
protected

Definition at line 104 of file class.ilSurveyRaterGUI.php.

104 : void
105 {
106 $this->ctrl->redirect($this->parent, "editRaters");
107 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ continue()

ilSurveyRaterGUI::continue ( )
protected

Definition at line 199 of file class.ilSurveyRaterGUI.php.

199 : void
200 {
201 $form = $this->initOptionSelectForm();
202 if ($form->checkInput()) {
203 switch ($form->getInput("type")) {
204 case "direct":
205 $this->addRater($form);
206 break;
207
208 case "external":
209 $this->addExternalRater($form);
210 break;
211
212 case "search":
213 $this->ctrl->redirectByClass("ilrepositorysearchgui", "");
214 break;
215
216 }
217 } else {
218 $form->setValuesByPost();
219 $this->add($form);
220 }
221 }
addRater(ilPropertyFormGUI $form)
addExternalRater(ilPropertyFormGUI $form)
add(ilPropertyFormGUI $form=null)

References ILIAS\UI\examples\Symbol\Glyph\Add\add(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ doAutoComplete()

ilSurveyRaterGUI::doAutoComplete ( )

Definition at line 180 of file class.ilSurveyRaterGUI.php.

180 : void
181 {
182 $fields = array('login','firstname','lastname','email');
183
184 $auto = new ilUserAutoComplete();
185 $auto->setSearchFields($fields);
186 $auto->setResultField('login');
187 $auto->enableFieldSearchableCheck(true);
188 $auto->setMoreLinkAvailable(true);
190
191 if ($this->edit_request->getFetchAll()) {
192 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
193 }
194
195 echo $auto->getList($this->edit_request->getTerm());
196 exit();
197 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
Definition: login.php:28

References exit, ilUserAutoComplete\MAX_ENTRIES, and ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING.

◆ executeCommand()

ilSurveyRaterGUI::executeCommand ( )

Definition at line 64 of file class.ilSurveyRaterGUI.php.

64 : void
65 {
67
68 $next_class = $ctrl->getNextClass($this);
69 $cmd = $ctrl->getCmd("add");
70
71 switch ($next_class) {
72
73 case 'ilrepositorysearchgui':
74 $rep_search = new ilRepositorySearchGUI();
75
76 $this->ctrl->setParameter($this, "rate360", 1);
77 $this->ctrl->saveParameter($this, "appr_id");
78
79 $rep_search->setCallback(
80 $this,
81 'addFromSearch',
82 array()
83 );
84
85 // Set tabs
86 $this->ctrl->setReturn($this, 'add');
87 $this->ctrl->forwardCommand($rep_search);
88 break;
89
90 default:
91 if (in_array($cmd, ["add",
92 "doAutoComplete",
93 "continue",
94 "mailRaters",
95 "mailRatersAction",
96 "cancel"
97 ])) {
98 $this->$cmd();
99 }
100 break;
101 }
102 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc

References $ctrl, ILIAS\Repository\ctrl(), ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ initMailRatersForm()

ilSurveyRaterGUI::initMailRatersForm ( int  $appr_id,
array  $rec_ids 
)

Definition at line 269 of file class.ilSurveyRaterGUI.php.

273 $form = new ilPropertyFormGUI();
274 $form->setFormAction($this->ctrl->getFormAction($this, "mailRatersAction"));
275 $form->setTitle($this->lng->txt('compose'));
276
277 $all_data = $this->survey->getRatersData($appr_id);
278
279 $rec_data = array();
280 foreach ($rec_ids as $rec_id) {
281 if (isset($all_data[$rec_id])) {
282 $rec_data[] = $all_data[$rec_id]["lastname"] . ", " .
283 $all_data[$rec_id]["firstname"] .
284 " (" . $all_data[$rec_id]["email"] . ")";
285 }
286 }
287 sort($rec_data);
288 $rec = new ilCustomInputGUI($this->lng->txt('recipients'));
289 $rec->setHtml(implode("<br />", $rec_data));
290 $form->addItem($rec);
291
292 $subject = new ilTextInputGUI($this->lng->txt('subject'), 'subject');
293 $subject->setSize(50);
294 $subject->setRequired(true);
295 $form->addItem($subject);
296
297 $existingdata = $this->survey->getExternalCodeRecipients();
298 $existingcolumns = array();
299 if (count($existingdata)) {
300 $first = array_shift($existingdata);
301 foreach ($first as $key => $value) {
302 if (strcmp($key, 'code') !== 0 && strcmp($key, 'email') !== 0 && strcmp($key, 'sent') !== 0) {
303 $existingcolumns[] = '[' . $key . ']';
304 }
305 }
306 }
307
308 $mailmessage_u = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_registered'), 'message_u');
309 $mailmessage_u->setRequired(true);
310 $mailmessage_u->setCols(80);
311 $mailmessage_u->setRows(10);
312 $form->addItem($mailmessage_u);
313
314 $mailmessage_a = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_anonymous'), 'message_a');
315 $mailmessage_a->setRequired(true);
316 $mailmessage_a->setCols(80);
317 $mailmessage_a->setRows(10);
318 $mailmessage_a->setInfo(sprintf($this->lng->txt('message_content_info'), implode(', ', $existingcolumns)));
319 $form->addItem($mailmessage_a);
320
321 $recf = new ilHiddenInputGUI("rtr_id");
322 $recf->setValue(implode(";", $rec_ids));
323 $form->addItem($recf);
324
325 $form->addCommandButton("mailRatersAction", $this->lng->txt("send"));
326 $form->addCommandButton("cancel", $this->lng->txt("svy_dont_send"));
327
328 $subject->setValue(sprintf($this->lng->txt('survey_360_rater_subject_default'), $this->survey->getTitle()));
329 $mailmessage_u->setValue($this->lng->txt('survey_360_rater_message_content_registered_default'));
330 $mailmessage_a->setValue($this->lng->txt('survey_360_rater_message_content_anonymous_default'));
331
332 return $form;
333 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ initOptionSelectForm()

ilSurveyRaterGUI::initOptionSelectForm ( )

Definition at line 119 of file class.ilSurveyRaterGUI.php.

120 {
123
124 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
125 $form = new ilPropertyFormGUI();
126
127 //
128 $radg = new ilRadioGroupInputGUI($lng->txt("svy_type_of_rater"), "type");
129 //$radg->setInfo($lng->txt(""));
130 //$radg->setValue();
131 $op1 = new ilRadioOption($lng->txt("svy_add_internal_user"), "direct", $lng->txt("svy_add_internal_user_info"));
132 $radg->addOption($op1);
133 $radg->setValue("direct");
134
135 $user = new \ilTextInputGUI($lng->txt("obj_user"), "user");
136 $user->setDataSource(
138 "ilsurveyratergui",
139 "doAutoComplete",
140 "",
141 true
142 )
143 );
144 $user->setRequired(true);
145 $user->setMulti(false);
146 $op1->addSubItem($user);
147
148
149 $op2 = new ilRadioOption($lng->txt("svy_search_user"), "search", $lng->txt("svy_search_user_info"));
150 $radg->addOption($op2);
151
152 $op3 = new ilRadioOption($lng->txt("svy_external_rater"), "external", $lng->txt("svy_external_rater_info"));
153 $radg->addOption($op3);
154
155 $email = new ilEMailInputGUI($this->lng->txt("email"), "email");
156 $email->setRequired(true);
157 $op3->addSubItem($email);
158
159 $lname = new ilTextInputGUI($this->lng->txt("lastname"), "lname");
160 $lname->setSize(30);
161 $op3->addSubItem($lname);
162
163 $fname = new ilTextInputGUI($this->lng->txt("firstname"), "fname");
164 $fname->setSize(30);
165 $op3->addSubItem($fname);
166
167
168 $form->addItem($radg);
169
170 // save and cancel commands
171 $form->addCommandButton("continue", $lng->txt("svy_save_and_continue"));
172 $form->addCommandButton("cancel", $lng->txt("cancel"));
173
174 $form->setTitle($lng->txt("svy_add_rater"));
175 $form->setFormAction($ctrl->getFormAction($this));
176
177 return $form;
178 }
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:302

References $email, $lng, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ mailRaters()

ilSurveyRaterGUI::mailRaters ( ilPropertyFormGUI  $a_form = null)

Definition at line 261 of file class.ilSurveyRaterGUI.php.

261 : void
262 {
263 $appr_id = $this->parent->handleRatersAccess();
264 $this->ctrl->setParameterByClass("ilSurveyParticipantsGUI", "appr_id", $appr_id);
265 $this->ctrl->setParameterByClass("ilSurveyParticipantsGUI", "rater_id", $this->edit_request->getRaterId());
266 $this->ctrl->redirectByClass("ilSurveyParticipantsGUI", "mailRaters");
267 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ mailRatersAction()

ilSurveyRaterGUI::mailRatersAction ( )

Definition at line 336 of file class.ilSurveyRaterGUI.php.

336 : void
337 {
339
340 $appr_id = $this->parent->handleRatersAccess();
341 $this->ctrl->setParameter($this, "appr_id", $appr_id);
342
343 $rec_ids = $this->edit_request->getRaterIds();
344 if (count($rec_ids) === 0) {
345 $this->ctrl->redirect($this, "editRaters");
346 }
347
348 $form = $this->initMailRatersForm($appr_id, $rec_ids);
349 if ($form->checkInput()) {
350 $txt_u = $form->getInput("message_u");
351 $txt_a = $form->getInput("message_a");
352 $subj = $form->getInput("subject");
353
354 // #12743
355 $sender_id = (trim($ilUser->getEmail()))
356 ? $ilUser->getId()
358
359 $all_data = $this->survey->getRatersData($appr_id);
360 foreach ($rec_ids as $rec_id) {
361 if (isset($all_data[$rec_id])) {
362 $user = $all_data[$rec_id];
363
364 // anonymous
365 if (strpos($rec_id, "a") === 0) {
366 $mytxt = $txt_a;
367 $url = $user["href"];
368 $rcp = $user["email"];
369 }
370 // reg
371 else {
372 $mytxt = $txt_u;
373 $user["code"] = $this->lng->txt("survey_code_mail_on_demand");
374 $url = ilLink::_getStaticLink($this->survey->getRefId());
375 $rcp = $user["login"]; // #15141
376 }
377
378 $mytxt = str_replace(
379 ["[lastname]", "[firstname]", "[url]", "[code]"],
380 [$user["lastname"], $user["firstname"], $url, $user["code"]],
381 $mytxt
382 );
383
384 $mail = new ilMail($sender_id);
385 $mail->enqueue(
386 $rcp, // to
387 "", // cc
388 "", // bcc
389 $subj, // subject
390 $mytxt, // message
391 array() // attachments
392 );
393
394 $this->survey->set360RaterSent(
395 $appr_id,
396 (strpos($rec_id, "a") === 0) ? 0 : (int) substr($rec_id, 1),
397 (strpos($rec_id, "u") === 0) ? 0 : (int) substr($rec_id, 1)
398 );
399 }
400 }
401
402 $this->main_tpl->setOnScreenMessage('success', $this->lng->txt("mail_sent"), true);
403 $this->ctrl->redirect($this->parent, "editRaters");
404 }
405
406 $form->setValuesByPost();
407// $this->mailRatersObject($form);
408 }
initMailRatersForm(int $appr_id, array $rec_ids)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$url

References $ilUser, $url, ilLink\_getStaticLink(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilSurveyRaterGUI::$access
protected

Definition at line 36 of file class.ilSurveyRaterGUI.php.

◆ $ctrl

ilCtrl ilSurveyRaterGUI::$ctrl
protected

Definition at line 28 of file class.ilSurveyRaterGUI.php.

Referenced by executeCommand().

◆ $edit_request

ILIAS Survey Editing EditingGUIRequest ilSurveyRaterGUI::$edit_request
protected

Definition at line 27 of file class.ilSurveyRaterGUI.php.

◆ $lng

ilLanguage ilSurveyRaterGUI::$lng
protected

Definition at line 29 of file class.ilSurveyRaterGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilSurveyRaterGUI::$main_tpl
protected

Definition at line 32 of file class.ilSurveyRaterGUI.php.

◆ $parent

ilSurveyParticipantsGUI ilSurveyRaterGUI::$parent
protected

Definition at line 33 of file class.ilSurveyRaterGUI.php.

Referenced by __construct().

◆ $refinery

ILIAS Refinery Factory ilSurveyRaterGUI::$refinery
protected

Definition at line 31 of file class.ilSurveyRaterGUI.php.

◆ $survey

ilObjSurvey ilSurveyRaterGUI::$survey
protected

Definition at line 34 of file class.ilSurveyRaterGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilSurveyRaterGUI::$tabs
protected

Definition at line 37 of file class.ilSurveyRaterGUI.php.

◆ $ui

ILIAS DI UIServices ilSurveyRaterGUI::$ui
protected

Definition at line 30 of file class.ilSurveyRaterGUI.php.

◆ $user

ilObjUser ilSurveyRaterGUI::$user
protected

Definition at line 35 of file class.ilSurveyRaterGUI.php.


The documentation for this class was generated from the following file: