19 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))
129 $op1 =
new ilRadioOption($lng->txt(
"svy_add_internal_user"),
"direct", $lng->txt(
"svy_add_internal_user_info"));
130 $radg->addOption($op1);
133 $user = new \ilTextInputGUI($lng->txt(
"obj_user"),
"user");
134 $user->setDataSource(
135 $ctrl->getLinkTargetByClass(
142 $user->setRequired(
true);
143 $user->setMulti(
false);
147 $op2 =
new ilRadioOption($lng->txt(
"svy_search_user"),
"search", $lng->txt(
"svy_search_user_info"));
148 $radg->addOption($op2);
150 $op3 =
new ilRadioOption($lng->txt(
"svy_external_rater"),
"external", $lng->txt(
"svy_external_rater_info"));
151 $radg->addOption($op3);
155 $op3->addSubItem($email);
159 $op3->addSubItem($lname);
163 $op3->addSubItem($fname);
166 $form->addItem($radg);
169 $form->addCommandButton(
"continue", $lng->txt(
"svy_save_and_continue"));
170 $form->addCommandButton(
"cancel", $lng->txt(
"cancel"));
172 $form->setTitle($lng->txt(
"svy_add_rater"));
173 $form->setFormAction($ctrl->getFormAction($this));
180 $fields = array(
'login',
'firstname',
'lastname',
'email');
183 $auto->setSearchFields($fields);
184 $auto->setResultField(
'login');
185 $auto->enableFieldSearchableCheck(
true);
186 $auto->setMoreLinkAvailable(
true);
189 if ($this->edit_request->getFetchAll()) {
193 echo $auto->getList($this->edit_request->getTerm());
197 protected function continue():
void 200 if ($form->checkInput()) {
201 switch ($form->getInput(
"type")) {
211 $this->
ctrl->redirectByClass(
"ilrepositorysearchgui",
"");
215 $form->setValuesByPost();
226 $appr_id = $this->parent->handleRatersAccess();
230 if ($ilAccess->checkAccess(
"write",
"", $this->survey->getRefId()) ||
231 $this->survey->get360SelfEvaluation() ||
234 $this->survey->addRater($appr_id,
$user_id);
235 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
237 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_appraisses_cannot_be_raters"),
true);
242 $this->main_tpl->setOnScreenMessage(
244 $this->
lng->txt(
"svy_user_not_found") .
" (" . $user .
")",
249 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
251 $this->
ctrl->setParameter($this,
"rater_id",
"u" .
$user_id);
252 $this->
ctrl->redirect($this,
"mailRaters");
254 $this->
ctrl->redirect($this->parent,
"editRaters");
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");
271 $form->setFormAction($this->
ctrl->getFormAction($this,
"mailRatersAction"));
272 $form->setTitle($this->
lng->txt(
'compose'));
274 $all_data = $this->survey->getRatersData($appr_id);
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"] .
")";
286 $rec->setHtml(implode(
"<br />", $rec_data));
287 $form->addItem($rec);
290 $subject->setSize(50);
291 $subject->setRequired(
true);
292 $form->addItem($subject);
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 .
']';
305 $mailmessage_u =
new ilTextAreaInputGUI($this->
lng->txt(
'survey_360_rater_message_content_registered'),
'message_u');
307 $mailmessage_u->setCols(80);
308 $mailmessage_u->setRows(10);
309 $form->addItem($mailmessage_u);
311 $mailmessage_a =
new ilTextAreaInputGUI($this->
lng->txt(
'survey_360_rater_message_content_anonymous'),
'message_a');
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);
319 $recf->setValue(implode(
";", $rec_ids));
320 $form->addItem($recf);
322 $form->addCommandButton(
"mailRatersAction", $this->
lng->txt(
"send"));
323 $form->addCommandButton(
"cancel", $this->
lng->txt(
"svy_dont_send"));
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'));
337 $appr_id = $this->parent->handleRatersAccess();
338 $this->
ctrl->setParameter($this,
"appr_id", $appr_id);
340 $rec_ids = $this->edit_request->getRaterIds();
341 if (count($rec_ids) === 0) {
342 $this->
ctrl->redirect($this,
"editRaters");
346 if ($form->checkInput()) {
347 $txt_u = $form->getInput(
"message_u");
348 $txt_a = $form->getInput(
"message_a");
349 $subj = $form->getInput(
"subject");
352 $sender_id = (trim($ilUser->getEmail()))
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];
362 if (strpos($rec_id,
"a") === 0) {
364 $url = $user[
"href"];
365 $rcp = $user[
"email"];
370 $user[
"code"] = $this->
lng->txt(
"survey_code_mail_on_demand");
372 $rcp = $user[
"login"];
375 $mytxt = str_replace(
376 [
"[lastname]",
"[firstname]",
"[url]",
"[code]"],
377 [$user[
"lastname"], $user[
"firstname"],
$url, $user[
"code"]],
381 $mail =
new ilMail($sender_id);
391 $this->survey->set360RaterSent(
393 (strpos($rec_id,
"a") === 0) ? 0 : (
int) substr($rec_id, 1),
394 (strpos($rec_id,
"u") === 0) ? 0 : (
int) substr($rec_id, 1)
399 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"mail_sent"),
true);
400 $this->
ctrl->redirect($this->parent,
"editRaters");
403 $form->setValuesByPost();
409 $appr_id = $this->edit_request->getAppraiseeId();
412 $this->
ctrl->redirect($this,
"listAppraisees");
415 $this->
ctrl->setParameter($this,
"appr_id", $appr_id);
417 $code_id = $this->parent->addCodeForExternal(
423 $this->survey->addRater($appr_id, 0, $code_id);
425 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
427 $this->
ctrl->setParameter($this,
"rater_id",
"a" . $code_id);
428 $this->
ctrl->redirect($this,
"mailRaters");
430 $this->
ctrl->redirect($this->parent,
"editRaters");
442 $appr_id = $this->parent->handleRatersAccess();
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);
453 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"svy_appraisses_cannot_be_raters"),
true);
460 $user_str = implode(
";",
array_map(
static function ($u):
string {
464 $this->
ctrl->setParameter($this->parent,
"appr_id", $appr_id);
466 $this->
ctrl->setParameter($this,
"rater_id", $user_str);
467 $this->
ctrl->redirect($this,
"mailRaters");
469 $this->
ctrl->redirect($this->parent,
"editRaters");
Class ilSurveyParticipantsGUI.
ILIAS Survey Editing EditingGUIRequest $edit_request
This class represents an option in a radio group.
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)
setContent(string $a_html)
Sets content for standard template.
addFromSearch(array $user_ids)
__construct(ilSurveyParticipantsGUI $parent, ilObjSurvey $survey)
add(?ilPropertyFormGUI $form=null)
sort()
description: > Example for rendering a Sort Glyph.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getNextClass($a_gui_class=null)
initMailRatersForm(int $appr_id, array $rec_ids)
setValue(string $a_value)
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
addRater(ilPropertyFormGUI $form)
ilSurveyParticipantsGUI $parent
ilGlobalTemplateInterface $main_tpl
This class represents a text area property in a property form.
mailRaters(?ilPropertyFormGUI $a_form=null)
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...