ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSurveyRaterGUI Class Reference
+ 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

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: shib_login.php:26

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 108 of file class.ilSurveyRaterGUI.php.

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

◆ addExternalRater()

ilSurveyRaterGUI::addExternalRater ( ilPropertyFormGUI  $form)

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

407 : void
408 {
409 $appr_id = $this->edit_request->getAppraiseeId();
410
411 if (!$appr_id) {
412 $this->ctrl->redirect($this, "listAppraisees");
413 }
414
415 $this->ctrl->setParameter($this, "appr_id", $appr_id);
416
417 $code_id = $this->parent->addCodeForExternal(
418 $form->getInput("email"),
419 $form->getInput("lname"),
420 $form->getInput("fname")
421 );
422
423 $this->survey->addRater($appr_id, 0, $code_id);
424
425 $this->ctrl->setParameter($this->parent, "appr_id", $appr_id);
426 if ($code_id > 0) {
427 $this->ctrl->setParameter($this, "rater_id", "a" . $code_id);
428 $this->ctrl->redirect($this, "mailRaters");
429 }
430 $this->ctrl->redirect($this->parent, "editRaters");
431 }
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 433 of file class.ilSurveyRaterGUI.php.

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

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

+ Here is the call graph for this function:

◆ addRater()

ilSurveyRaterGUI::addRater ( ilPropertyFormGUI  $form)

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

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

References $user_id, 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 103 of file class.ilSurveyRaterGUI.php.

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

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ continue()

ilSurveyRaterGUI::continue ( )
protected

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

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

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 178 of file class.ilSurveyRaterGUI.php.

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

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 case 'ilrepositorysearchgui':
73 $rep_search = new ilRepositorySearchGUI();
74
75 $this->ctrl->setParameter($this, "rate360", 1);
76 $this->ctrl->saveParameter($this, "appr_id");
77
78 $rep_search->setCallback(
79 $this,
80 'addFromSearch',
81 array()
82 );
83
84 // Set tabs
85 $this->ctrl->setReturn($this, 'add');
86 $this->ctrl->forwardCommand($rep_search);
87 break;
88
89 default:
90 if (in_array($cmd, ["add",
91 "doAutoComplete",
92 "continue",
93 "mailRaters",
94 "mailRatersAction",
95 "cancel"
96 ])) {
97 $this->$cmd();
98 }
99 break;
100 }
101 }
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 266 of file class.ilSurveyRaterGUI.php.

270 $form = new ilPropertyFormGUI();
271 $form->setFormAction($this->ctrl->getFormAction($this, "mailRatersAction"));
272 $form->setTitle($this->lng->txt('compose'));
273
274 $all_data = $this->survey->getRatersData($appr_id);
275
276 $rec_data = array();
277 foreach ($rec_ids as $rec_id) {
278 if (isset($all_data[$rec_id])) {
279 $rec_data[] = $all_data[$rec_id]["lastname"] . ", " .
280 $all_data[$rec_id]["firstname"] .
281 " (" . $all_data[$rec_id]["email"] . ")";
282 }
283 }
284 sort($rec_data);
285 $rec = new ilCustomInputGUI($this->lng->txt('recipients'));
286 $rec->setHtml(implode("<br />", $rec_data));
287 $form->addItem($rec);
288
289 $subject = new ilTextInputGUI($this->lng->txt('subject'), 'subject');
290 $subject->setSize(50);
291 $subject->setRequired(true);
292 $form->addItem($subject);
293
294 $existingdata = $this->survey->getExternalCodeRecipients();
295 $existingcolumns = array();
296 if (count($existingdata)) {
297 $first = array_shift($existingdata);
298 foreach ($first as $key => $value) {
299 if (strcmp($key, 'code') !== 0 && strcmp($key, 'email') !== 0 && strcmp($key, 'sent') !== 0) {
300 $existingcolumns[] = '[' . $key . ']';
301 }
302 }
303 }
304
305 $mailmessage_u = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_registered'), 'message_u');
306 $mailmessage_u->setRequired(true);
307 $mailmessage_u->setCols(80);
308 $mailmessage_u->setRows(10);
309 $form->addItem($mailmessage_u);
310
311 $mailmessage_a = new ilTextAreaInputGUI($this->lng->txt('survey_360_rater_message_content_anonymous'), 'message_a');
312 $mailmessage_a->setRequired(true);
313 $mailmessage_a->setCols(80);
314 $mailmessage_a->setRows(10);
315 $mailmessage_a->setInfo(sprintf($this->lng->txt('message_content_info'), implode(', ', $existingcolumns)));
316 $form->addItem($mailmessage_a);
317
318 $recf = new ilHiddenInputGUI("rtr_id");
319 $recf->setValue(implode(";", $rec_ids));
320 $form->addItem($recf);
321
322 $form->addCommandButton("mailRatersAction", $this->lng->txt("send"));
323 $form->addCommandButton("cancel", $this->lng->txt("svy_dont_send"));
324
325 $subject->setValue(sprintf($this->lng->txt('survey_360_rater_subject_default'), $this->survey->getTitle()));
326 $mailmessage_u->setValue($this->lng->txt('survey_360_rater_message_content_registered_default'));
327 $mailmessage_a->setValue($this->lng->txt('survey_360_rater_message_content_anonymous_default'));
328
329 return $form;
330 }
This class represents a custom property in a property form.
This class represents a hidden form property in a property form.
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.

◆ initOptionSelectForm()

ilSurveyRaterGUI::initOptionSelectForm ( )

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

119 {
122
123 $form = new ilPropertyFormGUI();
124
125 //
126 $radg = new ilRadioGroupInputGUI($lng->txt("svy_type_of_rater"), "type");
127 //$radg->setInfo($lng->txt(""));
128 //$radg->setValue();
129 $op1 = new ilRadioOption($lng->txt("svy_add_internal_user"), "direct", $lng->txt("svy_add_internal_user_info"));
130 $radg->addOption($op1);
131 $radg->setValue("direct");
132
133 $user = new \ilTextInputGUI($lng->txt("obj_user"), "user");
134 $user->setDataSource(
136 "ilsurveyratergui",
137 "doAutoComplete",
138 "",
139 true
140 )
141 );
142 $user->setRequired(true);
143 $user->setMulti(false);
144 $op1->addSubItem($user);
145
146
147 $op2 = new ilRadioOption($lng->txt("svy_search_user"), "search", $lng->txt("svy_search_user_info"));
148 $radg->addOption($op2);
149
150 $op3 = new ilRadioOption($lng->txt("svy_external_rater"), "external", $lng->txt("svy_external_rater_info"));
151 $radg->addOption($op3);
152
153 $email = new ilEMailInputGUI($this->lng->txt("email"), "email");
154 $email->setRequired(true);
155 $op3->addSubItem($email);
156
157 $lname = new ilTextInputGUI($this->lng->txt("lastname"), "lname");
158 $lname->setSize(30);
159 $op3->addSubItem($lname);
160
161 $fname = new ilTextInputGUI($this->lng->txt("firstname"), "fname");
162 $fname->setSize(30);
163 $op3->addSubItem($fname);
164
165
166 $form->addItem($radg);
167
168 // save and cancel commands
169 $form->addCommandButton("continue", $lng->txt("svy_save_and_continue"));
170 $form->addCommandButton("cancel", $lng->txt("cancel"));
171
172 $form->setTitle($lng->txt("svy_add_rater"));
173 $form->setFormAction($ctrl->getFormAction($this));
174
175 return $form;
176 }
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
This class represents a email property in a property form.
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 class represents an option in a radio group.

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

+ Here is the call graph for this function:

◆ mailRaters()

ilSurveyRaterGUI::mailRaters ( ?ilPropertyFormGUI  $a_form = null)

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

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

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ mailRatersAction()

ilSurveyRaterGUI::mailRatersAction ( )

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

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

References $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: