3 declare(strict_types=1);
29 protected \ilLanguage
$lng;
30 protected \ILIAS\DI\UIServices
$ui;
45 $this->
ctrl = $DIC->ctrl();
46 $this->
lng = $DIC->language();
47 $this->
ui = $DIC->ui();
49 $this->main_tpl = $DIC->ui()->mainTemplate();
52 $this->
user = $DIC->user();
53 $this->
access = $DIC->access();
54 $this->
tabs = $DIC->tabs();
56 $this->
ctrl->saveParameter($this,
"appr_id");
57 $this->edit_request = $DIC->survey()
69 $cmd = $ctrl->getCmd(
"add");
71 switch ($next_class) {
72 case 'ilrepositorysearchgui':
75 $this->
ctrl->setParameter($this,
"rate360", 1);
76 $this->
ctrl->saveParameter($this,
"appr_id");
78 $rep_search->setCallback(
85 $this->
ctrl->setReturn($this,
'add');
86 $this->
ctrl->forwardCommand($rep_search);
90 if (in_array($cmd, [
"add",
105 $this->
ctrl->redirect($this->parent,
"editRaters");
111 $form_html = (!is_null($form))
123 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
130 $op1 =
new ilRadioOption($lng->txt(
"svy_add_internal_user"),
"direct", $lng->txt(
"svy_add_internal_user_info"));
131 $radg->addOption($op1);
134 $user = new \ilTextInputGUI($lng->txt(
"obj_user"),
"user");
135 $user->setDataSource(
136 $ctrl->getLinkTargetByClass(
143 $user->setRequired(
true);
144 $user->setMulti(
false);
148 $op2 =
new ilRadioOption($lng->txt(
"svy_search_user"),
"search", $lng->txt(
"svy_search_user_info"));
149 $radg->addOption($op2);
151 $op3 =
new ilRadioOption($lng->txt(
"svy_external_rater"),
"external", $lng->txt(
"svy_external_rater_info"));
152 $radg->addOption($op3);
156 $op3->addSubItem($email);
160 $op3->addSubItem($lname);
164 $op3->addSubItem($fname);
167 $form->addItem($radg);
170 $form->addCommandButton(
"continue", $lng->txt(
"svy_save_and_continue"));
171 $form->addCommandButton(
"cancel", $lng->txt(
"cancel"));
173 $form->setTitle($lng->txt(
"svy_add_rater"));
174 $form->setFormAction($ctrl->getFormAction($this));
181 $fields = array(
'login',
'firstname',
'lastname',
'email');
184 $auto->setSearchFields($fields);
185 $auto->setResultField(
'login');
186 $auto->enableFieldSearchableCheck(
true);
187 $auto->setMoreLinkAvailable(
true);
190 if ($this->edit_request->getFetchAll()) {
194 echo $auto->getList($this->edit_request->getTerm());
198 protected function continue():
void 201 if ($form->checkInput()) {
202 switch ($form->getInput(
"type")) {
212 $this->
ctrl->redirectByClass(
"ilrepositorysearchgui",
"");
216 $form->setValuesByPost();
227 $appr_id = $this->parent->handleRatersAccess();
231 if ($ilAccess->checkAccess(
"write",
"", $this->survey->getRefId()) ||
232 $this->survey->get360SelfEvaluation() ||
233 $user_id !== $ilUser->getId()) {
234 if ($appr_id !== $user_id) {
235 $this->survey->addRater($appr_id, $user_id);
236 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
238 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_appraisses_cannot_be_raters"),
true);
243 $this->main_tpl->setOnScreenMessage(
245 $this->
lng->txt(
"svy_user_not_found") .
" (" . $user .
")",
250 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
252 $this->
ctrl->setParameter($this,
"rater_id",
"u" . $user_id);
253 $this->
ctrl->redirect($this,
"mailRaters");
255 $this->
ctrl->redirect($this->parent,
"editRaters");
261 $appr_id = $this->parent->handleRatersAccess();
262 $this->
ctrl->setParameterByClass(
"ilSurveyParticipantsGUI",
"appr_id", $appr_id);
263 $this->
ctrl->setParameterByClass(
"ilSurveyParticipantsGUI",
"rater_id", $this->edit_request->getRaterId());
264 $this->
ctrl->redirectByClass(
"ilSurveyParticipantsGUI",
"mailRaters");
272 $form->setFormAction($this->
ctrl->getFormAction($this,
"mailRatersAction"));
273 $form->setTitle($this->
lng->txt(
'compose'));
275 $all_data = $this->survey->getRatersData($appr_id);
278 foreach ($rec_ids as $rec_id) {
279 if (isset($all_data[$rec_id])) {
280 $rec_data[] = $all_data[$rec_id][
"lastname"] .
", " .
281 $all_data[$rec_id][
"firstname"] .
282 " (" . $all_data[$rec_id][
"email"] .
")";
287 $rec->setHtml(implode(
"<br />", $rec_data));
288 $form->addItem($rec);
291 $subject->setSize(50);
292 $subject->setRequired(
true);
293 $form->addItem($subject);
295 $existingdata = $this->survey->getExternalCodeRecipients();
296 $existingcolumns = array();
297 if (count($existingdata)) {
298 $first = array_shift($existingdata);
299 foreach ($first as
$key => $value) {
300 if (strcmp(
$key,
'code') !== 0 && strcmp(
$key,
'email') !== 0 && strcmp(
$key,
'sent') !== 0) {
301 $existingcolumns[] =
'[' .
$key .
']';
306 $mailmessage_u =
new ilTextAreaInputGUI($this->
lng->txt(
'survey_360_rater_message_content_registered'),
'message_u');
308 $mailmessage_u->setCols(80);
309 $mailmessage_u->setRows(10);
310 $form->addItem($mailmessage_u);
312 $mailmessage_a =
new ilTextAreaInputGUI($this->
lng->txt(
'survey_360_rater_message_content_anonymous'),
'message_a');
314 $mailmessage_a->setCols(80);
315 $mailmessage_a->setRows(10);
316 $mailmessage_a->setInfo(sprintf($this->
lng->txt(
'message_content_info'), implode(
', ', $existingcolumns)));
317 $form->addItem($mailmessage_a);
320 $recf->setValue(implode(
";", $rec_ids));
321 $form->addItem($recf);
323 $form->addCommandButton(
"mailRatersAction", $this->
lng->txt(
"send"));
324 $form->addCommandButton(
"cancel", $this->
lng->txt(
"svy_dont_send"));
326 $subject->setValue(sprintf($this->
lng->txt(
'survey_360_rater_subject_default'), $this->survey->getTitle()));
327 $mailmessage_u->setValue($this->
lng->txt(
'survey_360_rater_message_content_registered_default'));
328 $mailmessage_a->setValue($this->
lng->txt(
'survey_360_rater_message_content_anonymous_default'));
338 $appr_id = $this->parent->handleRatersAccess();
339 $this->
ctrl->setParameter($this,
"appr_id", $appr_id);
341 $rec_ids = $this->edit_request->getRaterIds();
342 if (count($rec_ids) === 0) {
343 $this->
ctrl->redirect($this,
"editRaters");
347 if ($form->checkInput()) {
348 $txt_u = $form->getInput(
"message_u");
349 $txt_a = $form->getInput(
"message_a");
350 $subj = $form->getInput(
"subject");
353 $sender_id = (trim($ilUser->getEmail()))
357 $all_data = $this->survey->getRatersData($appr_id);
358 foreach ($rec_ids as $rec_id) {
359 if (isset($all_data[$rec_id])) {
360 $user = $all_data[$rec_id];
363 if (strpos($rec_id,
"a") === 0) {
365 $url = $user[
"href"];
366 $rcp = $user[
"email"];
371 $user[
"code"] = $this->
lng->txt(
"survey_code_mail_on_demand");
373 $rcp = $user[
"login"];
376 $mytxt = str_replace(
377 [
"[lastname]",
"[firstname]",
"[url]",
"[code]"],
378 [$user[
"lastname"], $user[
"firstname"],
$url, $user[
"code"]],
382 $mail =
new ilMail($sender_id);
392 $this->survey->set360RaterSent(
394 (strpos($rec_id,
"a") === 0) ? 0 : (
int) substr($rec_id, 1),
395 (strpos($rec_id,
"u") === 0) ? 0 : (
int) substr($rec_id, 1)
400 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"mail_sent"),
true);
401 $this->
ctrl->redirect($this->parent,
"editRaters");
404 $form->setValuesByPost();
410 $appr_id = $this->edit_request->getAppraiseeId();
413 $this->
ctrl->redirect($this,
"listAppraisees");
416 $this->
ctrl->setParameter($this,
"appr_id", $appr_id);
418 $code_id = $this->parent->addCodeForExternal(
424 $this->survey->addRater($appr_id, 0, $code_id);
426 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
428 $this->
ctrl->setParameter($this,
"rater_id",
"a" . $code_id);
429 $this->
ctrl->redirect($this,
"mailRaters");
431 $this->
ctrl->redirect($this->parent,
"editRaters");
443 $appr_id = $this->parent->handleRatersAccess();
445 foreach ($user_ids as $user_id) {
447 if ($ilAccess->checkAccess(
"write",
"", $this->survey->getRefId()) ||
448 $this->survey->get360SelfEvaluation() ||
449 $user_id != $ilUser->getId()) {
450 if ($appr_id != $user_id) {
451 $this->survey->addRater($appr_id, $user_id);
452 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
454 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_appraisses_cannot_be_raters"),
true);
461 $user_str = implode(
";", array_map(
static function ($u):
string {
465 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
467 $this->
ctrl->setParameter($this,
"rater_id", $user_str);
468 $this->
ctrl->redirect($this,
"mailRaters");
470 $this->
ctrl->redirect($this->parent,
"editRaters");
Class ilSurveyParticipantsGUI.
ILIAS Survey Editing EditingGUIRequest $edit_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addExternalRater(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Refinery Factory $refinery
const PRIVACY_MODE_RESPECT_USER_SETTING
static _lookupId($a_user_str)
addFromSearch(array $user_ids)
__construct(ilSurveyParticipantsGUI $parent, ilObjSurvey $survey)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
mailRaters(ilPropertyFormGUI $a_form=null)
getNextClass($a_gui_class=null)
initMailRatersForm(int $appr_id, array $rec_ids)
setContent(string $a_html)
Sets content for standard template.
setValue(string $a_value)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
addRater(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilSurveyParticipantsGUI $parent
ilGlobalTemplateInterface $main_tpl
This class represents a text area property in a property form.
add(ilPropertyFormGUI $form=null)