5 use \ILIAS\Survey\Participants;
78 $this->tabs = $DIC->tabs();
79 $this->toolbar = $DIC->toolbar();
80 $this->access = $DIC->access();
81 $this->rbacsystem = $DIC->rbac()->system();
82 $this->
user = $DIC->user();
83 $this->log = $DIC[
"ilLog"];
84 $ilCtrl = $DIC->ctrl();
85 $lng = $DIC->language();
88 $this->parent_gui = $a_parent_gui;
89 $this->
object = $this->parent_gui->object;
90 $this->ref_id = $this->
object->getRefId();
91 $this->has_write = (bool) $a_has_write_access;
93 $this->ctrl = $ilCtrl;
96 $this->invitation_manager =
new Participants\InvitationsManager();
101 if (!$this->has_write) {
112 $cmd = $ilCtrl->getCmd(
"maintenance");
113 $next_class = $this->ctrl->getNextClass($this);
115 switch ($next_class) {
116 case 'ilrepositorysearchgui':
119 if (!$_REQUEST[
"appr360"] && !$_REQUEST[
"rate360"]) {
120 $ilTabs->clearTargets();
121 $ilTabs->setBackTarget(
122 $this->lng->txt(
"btn_back"),
123 $this->ctrl->getLinkTarget($this,
"maintenance")
126 $rep_search->setCallback(
132 $rep_search->setTitle(
$lng->txt(
"svy_invite_participants"));
134 $this->ctrl->setReturn($this,
'maintenance');
135 $this->ctrl->forwardCommand($rep_search);
136 $ilTabs->setTabActive(
'maintenance');
137 } elseif ($_REQUEST[
"rate360"]) {
138 $ilTabs->clearTargets();
139 $ilTabs->setBackTarget(
140 $this->lng->txt(
"btn_back"),
141 $this->ctrl->getLinkTarget($this,
"listAppraisees")
144 $this->ctrl->setParameter($this,
"rate360", 1);
145 $this->ctrl->saveParameter($this,
"appr_id");
147 $rep_search->setCallback(
155 $this->ctrl->setReturn($this,
'editRaters');
156 $this->ctrl->forwardCommand($rep_search);
158 $ilTabs->activateTab(
"survey_360_appraisees");
159 $this->ctrl->setParameter($this,
"appr360", 1);
161 $rep_search->setCallback(
169 $this->ctrl->setReturn($this,
'listAppraisees');
170 $this->ctrl->forwardCommand($rep_search);
183 $all_participants = $this->
object->getSurveyParticipants($a_finished_ids,
false,
true);
184 $participant_ids = [];
185 foreach ($all_participants as $participant) {
186 $participant_ids[] = $participant[
'usr_id'];
189 $filtered_participant_ids = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
192 $this->object->getRefId(),
197 foreach ($all_participants as $username => $user_data) {
198 if (!$user_data[
'usr_id']) {
199 $participants[$username] = $user_data;
201 if (in_array($user_data[
'usr_id'], $filtered_participant_ids)) {
202 $participants[$username] = $user_data;
206 return $participants;
218 if ($this->object->get360Mode()) {
225 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
226 $ilToolbar->addButton(
227 $this->lng->txt(
"survey_calc_skills"),
228 $this->ctrl->getLinkTargetByClass(
"ilsurveyskilldeterminationgui"),
237 $ilToolbar->addButton(
238 $this->lng->txt(
'svy_remove_all_participants'),
239 $this->ctrl->getLinkTarget($this,
'deleteAllUserData')
242 $ilToolbar->addSeparator();
244 if ($this->object->isAccessibleWithoutCode()) {
245 $ilToolbar->addButton(
246 $this->lng->txt(
"svy_invite_participants"),
247 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'')
255 foreach (
$total as $user_data) {
257 if ((
bool) $user_data[
"finished"]) {
258 $finished = $user_data[
"finished_tstamp"];
260 $wt = $this->
object->getWorkingtimeForParticipant($user_data[
"active_id"]);
261 $last_access = $this->
object->getLastAccess($user_data[
"active_id"]);
262 array_push(
$data, array(
263 'id' => $user_data[
"active_id"],
264 'name' => $user_data[
"sortname"],
265 'usr_id' => $user_data[
"usr_id"],
266 'login' => $user_data[
"login"],
267 'last_access' => $last_access,
268 'workingtime' => $wt,
269 'finished' => $finished,
270 'invited' => $user_data[
"invited"]
273 $table_gui->setData(
$data);
274 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
279 $surveySetting =
new ilSetting(
"survey");
281 if ($surveySetting->get(
"anonymous_participants",
false)) {
282 if ($this->object->hasAnonymizedResults() &&
283 $this->
object->hasAnonymousUserList()) {
284 $end = $this->
object->getEndDate();
285 if ($end && $end < date(
"YmdHis")) {
286 $min = $surveySetting->get(
"anonymous_participants_min", 0);
287 $total = $this->
object->getSurveyParticipants();
288 if (!$min ||
sizeof(
$total) >= $min) {
311 $this->lng->txt(
"svy_part_overview"),
312 $this->ctrl->getLinkTarget($this,
'maintenance')
318 $this->lng->txt(
"svy_anonymous_participants_svy"),
319 $this->ctrl->getLinkTarget($this,
'listParticipants')
323 if (!$this->object->isAccessibleWithoutCode()) {
326 $this->lng->txt(
"svy_codes"),
327 $this->ctrl->getLinkTarget($this,
'codes')
332 $data = $this->
object->getExternalCodeRecipients();
336 $this->lng->txt(
"mail_survey_codes"),
337 $this->ctrl->getLinkTarget($this,
"mailCodes")
341 $ilTabs->activateSubTab($active);
352 $cgui->setHeaderText($this->lng->txt(
"confirm_delete_all_user_data"));
353 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAllUserData"));
354 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteAllUserData");
355 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteAllUserData");
356 $this->tpl->setContent($cgui->getHTML());
364 if ($this->access->checkAccess(
'write',
'', $this->object->getRefId())) {
365 $this->
object->deleteAllUserData();
368 foreach ($participants as $something => $participant_data) {
369 $this->
object->removeSelectedSurveyResults([$participant_data[
'active_id']]);
376 if ($this->object->get360Mode()) {
377 $this->
object->openAllAppraisees();
380 ilUtil::sendSuccess($this->lng->txt(
"svy_all_user_data_deleted"),
true);
381 $this->ctrl->redirect($this,
"maintenance");
389 $this->ctrl->redirect($this,
"maintenance");
397 if (is_array(
$_POST[
"chbUser"])) {
398 $this->
object->removeSelectedSurveyResults(array_filter(
$_POST[
"chbUser"],
function (
$i) {
399 return is_numeric(
$i);
402 $invitations = array_filter(
$_POST[
"chbUser"],
function (
$i) {
403 return (substr(
$i, 0, 3) ==
"inv");
405 foreach ($invitations as
$i) {
406 $this->invitation_manager->remove($this->object->getSurveyId(), (int) substr($i, 3));
409 ilUtil::sendSuccess($this->lng->txt(
"svy_selected_user_data_deleted"),
true);
411 $this->ctrl->redirect($this,
"maintenance");
420 $this->ctrl->redirect($this,
"maintenance");
430 if (!is_array(
$_POST[
"chbUser"]) || count(
$_POST[
"chbUser"]) == 0) {
432 $this->ctrl->redirect($this,
"maintenance");
437 $total = $this->
object->getSurveyParticipants(null,
false,
true);
439 foreach (
$total as $user_data) {
440 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser'])
441 || ($user_data[
'invited'] && in_array(
"inv" . $user_data[
'usr_id'],
$_POST[
'chbUser']))) {
442 $last_access = $this->
object->getLastAccess($user_data[
"active_id"]);
443 array_push(
$data, array(
444 'id' => $user_data[
"active_id"],
445 'name' => $user_data[
"sortname"],
446 'login' => $user_data[
"login"],
447 'last_access' => $last_access,
448 'usr_id' => $user_data[
"usr_id"],
449 'invited' => $user_data[
"invited"]
453 $table_gui->setData(
$data);
454 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
462 if (strcmp(
$_POST[
"lang"],
"-1") != 0) {
466 ilUtil::sendSuccess($this->lng->txt(
'language_changed'),
true);
467 $this->ctrl->redirect($this,
'codes');
481 if ($this->object->isAccessibleWithoutCode()) {
485 $default_lang =
$ilUser->getPref(
"survey_code_language");
488 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
493 $ilToolbar->addInputItem(
$si,
true);
496 $button->setCaption(
"create");
497 $button->setCommand(
"createSurveyCodes");
498 $ilToolbar->addButtonInstance($button);
500 $ilToolbar->addSeparator();
503 $button->setCaption(
"import_from_file");
504 $button->setCommand(
"importExternalMailRecipientsFromFileForm");
505 $ilToolbar->addButtonInstance($button);
508 $button->setCaption(
"import_from_text");
509 $button->setCommand(
"importExternalMailRecipientsFromTextForm");
510 $ilToolbar->addButtonInstance($button);
512 $ilToolbar->addSeparator();
515 $button->setCaption(
"svy_import_codes");
516 $button->setCommand(
"importAccessCodes");
517 $ilToolbar->addButtonInstance($button);
519 $ilToolbar->addSeparator();
521 $languages = $this->lng->getInstalledLanguages();
523 $this->lng->loadLanguageModule(
"meta");
524 foreach ($languages as
$lang) {
525 $options[
$lang] = $this->lng->txt(
"meta_l_" . $lang);
528 $si->setOptions($options);
529 $si->setValue($default_lang);
530 $ilToolbar->addInputItem(
$si,
true);
533 $button->setCaption(
"set");
534 $button->setCommand(
"setCodeLanguage");
535 $ilToolbar->addButtonInstance($button);
538 $survey_codes = $this->
object->getSurveyCodesTableData(null, $default_lang);
539 $table_gui->setData($survey_codes);
540 $this->tpl->setContent($table_gui->getHTML());
545 if (isset(
$_GET[
"new_ids"])) {
546 $ids = explode(
";",
$_GET[
"new_ids"]);
548 $ids = (array)
$_POST[
"chb_code"];
552 $this->ctrl->redirect($this,
'codes');
559 $table_gui->setData($this->object->getSurveyCodesTableData($ids));
560 $this->tpl->setContent($table_gui->getHTML());
565 if (!is_array(
$_POST[
"chb_code"])) {
566 $this->ctrl->redirect($this,
'codes');
571 foreach (
$_POST[
"chb_code"] as $id) {
572 if (!$this->object->updateCode(
583 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
586 $error_message .= sprintf($this->lng->txt(
"error_save_code"), $error[0], $error[1], $error[2]);
591 $this->ctrl->redirect($this,
'codes');
596 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0)) {
598 $cgui->setHeaderText($this->lng->txt(
"survey_code_delete_sure"));
600 $cgui->setFormAction($this->ctrl->getFormAction($this));
601 $cgui->setCancel($this->lng->txt(
"cancel"),
"codes");
602 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
604 $data = $this->
object->getSurveyCodesTableData(
$_POST[
"chb_code"]);
606 foreach (
$data as $item) {
611 $title = array($item[
"code"]);
612 $item[
"email"] ? $title[] = $item[
"email"] : null;
613 $item[
"last_name"] ? $title[] = $item[
"last_name"] : null;
614 $item[
"first_name"] ? $title[] = $item[
"first_name"] : null;
615 $title = implode(
", ", $title);
617 $cgui->addItem(
"chb_code[]", $item[
"code"], $title);
620 $this->tpl->setContent($cgui->getHTML());
623 $this->ctrl->redirect($this,
'codes');
632 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0)) {
633 foreach (
$_POST[
"chb_code"] as $survey_code) {
634 $this->
object->deleteSurveyCode($survey_code);
636 ilUtil::sendSuccess($this->lng->txt(
'codes_deleted'),
true);
640 $this->ctrl->redirect($this,
'codes');
648 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0)) {
649 $export = $this->
object->getSurveyCodesForExport(null,
$_POST[
"chb_code"]);
653 $this->ctrl->redirect($this,
'codes');
662 $export = $this->
object->getSurveyCodesForExport();
675 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
676 $form_import_file->setTableWidth(
"100%");
677 $form_import_file->setId(
"codes_import_file");
680 $headerfile->setTitle($this->lng->txt(
"svy_import_codes"));
681 $form_import_file->addItem($headerfile);
683 $export_file =
new ilFileInputGUI($this->lng->txt(
"codes"),
"codes");
685 $this->lng->txt(
'svy_import_codes_info'),
686 $this->lng->txt(
"export_all_survey_codes")
688 $export_file->setSuffixes(array(
"csv"));
689 $export_file->setRequired(
true);
690 $form_import_file->addItem($export_file);
692 $form_import_file->addCommandButton(
"importAccessCodesAction", $this->lng->txt(
"import"));
693 $form_import_file->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
695 $this->tpl->setContent($form_import_file->getHTML());
703 if (trim($_FILES[
'codes'][
'tmp_name'])) {
705 foreach ($this->object->getSurveyCodesTableData() as $item) {
706 $existing[$item[
"code"]] = $item[
"id"];
710 $reader->open($_FILES[
'codes'][
'tmp_name']);
711 foreach ($reader->getDataArrayFromCSVFile() as $row) {
713 if (
sizeof($row) == 8 && is_numeric($row[5])) {
715 list($code,
$email, $last_name, $first_name, $created, $used, $sent,
$url) = $row;
718 if (!array_key_exists($code, $existing)) {
721 if (strlen($created) == 10) {
729 $this->ctrl->redirect($this,
'codes');
734 ,
"lastname" => $last_name
735 ,
"firstname" => $first_name
737 $this->
object->importSurveyCode($code, $created, $user_data);
742 ilUtil::sendSuccess($this->lng->txt(
'codes_created'),
true);
745 $this->ctrl->redirect($this,
'codes');
753 if (is_numeric(
$_POST[
"nrOfCodes"])) {
754 $ids = $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
755 ilUtil::sendSuccess($this->lng->txt(
'codes_created'),
true);
756 $this->ctrl->setParameter($this,
"new_ids", implode(
";", $ids));
757 $this->ctrl->redirect($this,
'editCodes');
760 $this->ctrl->redirect($this,
'codes');
770 $form_gui->setValuesByPost();
772 if ($form_gui->getSavedMessages()->getValue() > 0) {
774 $settings = $this->
object->getUserSettings(
$ilUser->getId(),
'savemessage');
775 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
776 ilUtil::sendSuccess($this->lng->txt(
'msg_message_inserted'));
782 $ilLog->write(
'Error: ' + $e->getMessage());
784 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
793 $form_gui->setValuesByPost();
795 if ($form_gui->getSavedMessages()->getValue() > 0) {
796 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
798 $form_gui->setValuesByPost();
799 ilUtil::sendSuccess($this->lng->txt(
'msg_message_deleted'));
805 $ilLog->write(
'Error: ' + $e->getMessage());
807 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
815 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
816 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
817 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
820 $form_gui->setValuesByArray($mailData);
821 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
832 if ($form_gui->checkInput()) {
833 $url_exists = strpos(
$_POST[
'm_message'],
'[url]') !==
false;
836 $form_gui->setValuesByPost();
838 if (
$_POST[
'savemessage'] == 1) {
840 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
841 $this->
object->saveUserSettings(
$ilUser->getId(),
'savemessage', $title,
$_POST[
'm_message']);
846 $lang = $this->lng->getDefaultLanguage();
849 ilUtil::sendSuccess($this->lng->txt(
'mail_sent'),
true);
850 $this->ctrl->redirect($this,
'mailCodes');
853 $form_gui->setValuesByPost();
855 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
860 if (trim(
$_POST[
'externaltext'])) {
861 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
862 $fields = preg_split(
"/;/", array_shift(
$data));
863 if (!in_array(
'email', $fields)) {
866 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
868 $existingdata = $this->
object->getExternalCodeRecipients();
869 $existingcolumns = array();
870 if (count($existingdata)) {
871 $first = array_shift($existingdata);
872 foreach ($first as $key => $value) {
873 array_push($existingcolumns, $key);
876 $founddata = array();
877 foreach (
$data as $datarow) {
878 $row = preg_split(
"/;/", $datarow);
879 if (count($row) == count($fields)) {
881 foreach ($fields as $idx => $fieldname) {
882 if (count($existingcolumns)) {
883 if (array_key_exists($idx, $existingcolumns)) {
884 $dataset[$fieldname] = $row[$idx];
887 $dataset[$fieldname] = $row[$idx];
890 if (strlen($dataset[
'email'])) {
891 array_push($founddata, $dataset);
895 $this->
object->createSurveyCodesForExternalData($founddata);
896 ilUtil::sendSuccess($this->lng->txt(
'external_recipients_imported'),
true);
897 $this->ctrl->redirect($this,
'codes');
900 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
904 protected function _convertCharset($a_string, $a_from_charset =
"", $a_to_charset =
"UTF-8")
906 if (extension_loaded(
"mbstring")) {
907 if (!$a_from_charset) {
908 mb_detect_order(
"UTF-8, ISO-8859-1, Windows-1252, ASCII");
909 $a_from_charset = mb_detect_encoding($a_string);
911 if (strtoupper($a_from_charset) != $a_to_charset) {
912 return @mb_convert_encoding($a_string, $a_to_charset, $a_from_charset);
920 $bom = pack(
'H*',
'EFBBBF');
921 return preg_replace(
'/^' . $bom .
'/',
'', $a_text);
926 if (trim($_FILES[
'externalmails'][
'tmp_name'])) {
928 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
929 $data = $reader->getDataArrayFromCSVFile();
930 $fields = array_shift(
$data);
931 foreach ($fields as $idx => $field) {
934 if (!in_array(
'email', $fields)) {
937 $this->ctrl->redirect($this,
'codes');
939 $existingdata = $this->
object->getExternalCodeRecipients();
940 $existingcolumns = array();
941 if (count($existingdata)) {
942 $first = array_shift($existingdata);
943 foreach ($first as $key => $value) {
944 array_push($existingcolumns, $key);
948 $founddata = array();
949 foreach (
$data as $row) {
950 if (count($row) == count($fields)) {
952 foreach ($fields as $idx => $fieldname) {
956 if (count($existingcolumns)) {
957 if (array_key_exists($idx, $existingcolumns)) {
958 $dataset[$fieldname] = $row[$idx];
961 $dataset[$fieldname] = $row[$idx];
964 if (strlen($dataset[
'email'])) {
965 array_push($founddata, $dataset);
971 if (
sizeof($founddata)) {
972 $this->
object->createSurveyCodesForExternalData($founddata);
973 ilUtil::sendSuccess($this->lng->txt(
'external_recipients_imported'),
true);
977 $this->ctrl->redirect($this,
'codes');
988 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
989 $form_import_file->setTableWidth(
"100%");
990 $form_import_file->setId(
"codes_import_file");
993 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
994 $form_import_file->addItem($headerfile);
996 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
997 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
998 $externalmails->setRequired(
true);
999 $form_import_file->addItem($externalmails);
1000 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
1001 $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
1003 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
1004 $form_import_file->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
1007 $this->tpl->setContent($form_import_file->getHTML());
1018 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
1019 $form_import_text->setTableWidth(
"100%");
1020 $form_import_text->setId(
"codes_import_text");
1023 $headertext->setTitle($this->lng->txt(
"import_from_text"));
1024 $form_import_text->addItem($headertext);
1027 if (array_key_exists(
'externaltext',
$_SESSION) && strlen(
$_SESSION[
'externaltext'])) {
1031 $inp->setValue(
"email;firstname;lastname\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
1033 $inp->setRequired(
true);
1036 $inp->setInfo($this->lng->txt(
'externaltext_info'));
1037 $form_import_text->addItem($inp);
1040 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
1041 $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
1043 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
1044 $form_import_text->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
1047 $this->tpl->setContent($form_import_text->getHTML());
1074 $this->ctrl->setParameter($this,
"appr360", 1);
1080 'auto_complete_name' => $this->lng->txt(
'user'),
1081 'submit_name' => $this->lng->txt(
'add'),
1082 'add_search' =>
true,
1089 if ($this->object->getSkillService() && $skmg_set->isActivated()) {
1090 $ilToolbar->addSeparator();
1091 $ilToolbar->addButton(
1092 $lng->txt(
"survey_calc_skills"),
1093 $ilCtrl->getLinkTargetByClass(
"ilsurveyskilldeterminationgui"),
1098 $ilToolbar->addSeparator();
1099 $ilToolbar->addButton(
1100 $this->lng->txt(
'svy_delete_all_user_data'),
1101 $this->ctrl->getLinkTarget($this,
'deleteAllUserData')
1104 $this->ctrl->setParameter($this,
"appr360",
"");
1107 $tbl->setData($this->object->getAppraiseesData());
1108 $this->tpl->setContent($tbl->getHTML());
1113 if (
sizeof($a_user_ids)) {
1115 foreach (array_unique($a_user_ids) as $user_id) {
1116 $this->
object->addAppraisee($user_id);
1119 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
1121 $this->ctrl->redirect($this,
"listAppraisees");
1128 if (!is_array(
$_POST[
"appr_id"])) {
1130 $this->ctrl->redirect($this,
"listAppraisees");
1133 $ilTabs->clearTargets();
1134 $ilTabs->setBackTarget(
1135 $this->lng->txt(
"btn_back"),
1136 $this->ctrl->getLinkTarget($this,
"listAppraisees")
1140 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_delete_appraises"));
1142 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAppraisees"));
1143 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1144 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteAppraisees");
1146 $data = $this->
object->getAppraiseesData();
1149 foreach (
$_POST[
"appr_id"] as $id) {
1150 if (isset(
$data[$id]) && !
$data[$id][
"closed"]) {
1158 $this->ctrl->redirect($this,
"listAppraisees");
1161 $this->tpl->setContent($cgui->getHTML());
1166 if (
sizeof(
$_POST[
"appr_id"])) {
1167 $data = $this->
object->getAppraiseesData();
1169 foreach (
$_POST[
"appr_id"] as $id) {
1171 if (isset(
$data[$id]) && !
$data[$id][
"closed"]) {
1172 $this->
object->deleteAppraisee($id);
1176 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
1179 $this->ctrl->redirect($this,
"listAppraisees");
1187 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id)) {
1188 $appr_id = $_REQUEST[
"appr_id"];
1190 $this->ctrl->redirect($this,
"listAppraisees");
1193 } elseif ($this->object->get360Mode() &&
1194 $this->
object->get360SelfRaters() &&
1195 $this->
object->isAppraisee(
$ilUser->getId()) &&
1196 !$this->object->isAppraiseeClosed(
$ilUser->getId())) {
1199 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1210 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1212 $ilTabs->clearTargets();
1213 $ilTabs->setBackTarget(
1214 $this->lng->txt(
"btn_back"),
1215 $this->ctrl->getLinkTarget($this,
"listAppraisees")
1219 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1220 $this->ctrl->setParameter($this,
"rate360", 1);
1226 'auto_complete_name' => $this->lng->txt(
'user'),
1227 'submit_name' => $this->lng->txt(
'add'),
1228 'add_search' =>
true,
1233 $this->ctrl->setParameter($this,
"rate360",
"");
1235 $ilToolbar->addSeparator();
1237 $ilToolbar->addButton(
1238 $this->lng->txt(
"survey_360_add_external_rater"),
1239 $this->ctrl->getLinkTarget($this,
"addExternalRaterForm")
1243 require_once
"Services/Link/classes/class.ilLink.php";
1247 $tbl->
setData($this->object->getRatersData($appr_id));
1248 $this->tpl->setContent($tbl->getHTML());
1257 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1259 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1261 $ilTabs->clearTargets();
1262 $ilTabs->setBackTarget(
1263 $this->lng->txt(
"btn_back"),
1264 $this->ctrl->getLinkTarget($this,
"editRaters")
1272 $this->tpl->setContent($a_form->getHTML());
1278 $form->setFormAction($this->ctrl->getFormAction($this,
"addExternalRater"));
1279 $form->setTitle($this->lng->txt(
"survey_360_add_external_rater") .
1282 $email =
new ilEmailInputGUI($this->lng->txt(
"email"),
"email");
1283 $email->setRequired(
true);
1286 $lname =
new ilTextInputGUI($this->lng->txt(
"lastname"),
"lname");
1287 $lname->setSize(30);
1288 $form->addItem($lname);
1290 $fname =
new ilTextInputGUI($this->lng->txt(
"firstname"),
"fname");
1291 $fname->setSize(30);
1292 $form->addItem($fname);
1294 $form->addCommandButton(
"addExternalRater", $this->lng->txt(
"save"));
1295 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1302 $appr_id = $_REQUEST[
"appr_id"];
1304 $this->ctrl->redirect($this,
"listAppraisees");
1307 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1310 if ($form->checkInput()) {
1312 "email" => $form->getInput(
"email"),
1313 "lastname" => $form->getInput(
"lname"),
1314 "firstname" => $form->getInput(
"fname")
1316 $anonymous_id = $this->
object->createSurveyCodesForExternalData(array(
$data));
1317 $anonymous_id = array_pop($anonymous_id);
1319 $this->
object->addRater($appr_id, 0, $anonymous_id);
1321 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
1322 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1323 $this->ctrl->redirect($this,
"editRaters");
1326 $form->setValuesByPost();
1337 if (
sizeof($a_user_ids)) {
1339 foreach (array_unique($a_user_ids) as $user_id) {
1340 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id) ||
1341 $this->
object->get360SelfEvaluation() ||
1342 $user_id !=
$ilUser->getId()) {
1343 if ($appr_id != $user_id) {
1344 $this->
object->addRater($appr_id, $user_id);
1345 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
1353 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1354 $this->ctrl->redirect($this,
"editRaters");
1362 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1363 if (!
sizeof(
$_POST[
"rtr_id"])) {
1365 $this->ctrl->redirect($this,
"editRaters");
1368 $ilTabs->clearTargets();
1369 $ilTabs->setBackTarget(
1370 $this->lng->txt(
"btn_back"),
1371 $this->ctrl->getLinkTarget($this,
"editRaters")
1375 $cgui->setHeaderText(sprintf(
1376 $this->lng->txt(
"survey_360_sure_delete_raters"),
1380 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteRaters"));
1381 $cgui->setCancel($this->lng->txt(
"cancel"),
"editRaters");
1382 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteRaters");
1384 $data = $this->
object->getRatersData($appr_id);
1386 foreach (
$_POST[
"rtr_id"] as $id) {
1387 if (isset(
$data[$id])) {
1388 $cgui->addItem(
"rtr_id[]", $id,
$data[$id][
"lastname"] .
", " .
1389 $data[$id][
"firstname"] .
" (" .
$data[$id][
"email"] .
")");
1393 $this->tpl->setContent($cgui->getHTML());
1399 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1401 if (
sizeof(
$_POST[
"rtr_id"])) {
1402 $data = $this->
object->getRatersData($appr_id);
1404 foreach (
$_POST[
"rtr_id"] as $id) {
1405 if (isset(
$data[$id])) {
1406 if (substr($id, 0, 1) ==
"u") {
1407 $this->
object->deleteRater($appr_id, substr($id, 1));
1409 $this->
object->deleteRater($appr_id, 0, substr($id, 1));
1414 ilUtil::sendSuccess($this->lng->txt(
"settings_saved"),
true);
1417 $this->ctrl->redirect($this,
"editRaters");
1424 if ($this->object->get360SelfAppraisee() &&
1425 !$this->
object->isAppraisee(
$ilUser->getId())) {
1426 $this->
object->addAppraisee(
$ilUser->getId());
1429 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1435 $form->setFormAction($this->ctrl->getFormAction($this,
"mailRatersAction"));
1436 $form->setTitle($this->lng->txt(
'compose'));
1438 $all_data = $this->
object->getRatersData($appr_id);
1439 $rec_data = array();
1440 foreach ($rec_ids as $rec_id) {
1441 if (isset($all_data[$rec_id])) {
1442 $rec_data[] = $all_data[$rec_id][
"lastname"] .
", " .
1443 $all_data[$rec_id][
"firstname"] .
1444 " (" . $all_data[$rec_id][
"email"] .
")";
1449 $rec->setHTML(implode(
"<br />", $rec_data));
1450 $form->addItem($rec);
1452 $subject =
new ilTextInputGUI($this->lng->txt(
'subject'),
'subject');
1453 $subject->setSize(50);
1454 $subject->setRequired(
true);
1455 $form->addItem($subject);
1457 $existingdata = $this->
object->getExternalCodeRecipients();
1458 $existingcolumns = array();
1459 if (count($existingdata)) {
1460 $first = array_shift($existingdata);
1461 foreach ($first as $key => $value) {
1462 if (strcmp($key,
'code') != 0 && strcmp($key,
'email') != 0 && strcmp($key,
'sent') != 0) {
1463 array_push($existingcolumns,
'[' . $key .
']');
1468 $mailmessage_u =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_registered'),
'message_u');
1470 $mailmessage_u->setCols(80);
1471 $mailmessage_u->setRows(10);
1472 $form->addItem($mailmessage_u);
1474 $mailmessage_a =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_anonymous'),
'message_a');
1476 $mailmessage_a->setCols(80);
1477 $mailmessage_a->setRows(10);
1478 $mailmessage_a->setInfo(sprintf($this->lng->txt(
'message_content_info'), join(
', ', $existingcolumns)));
1479 $form->addItem($mailmessage_a);
1482 $recf->setValue(implode(
";", $rec_ids));
1483 $form->addItem($recf);
1485 $form->addCommandButton(
"mailRatersAction", $this->lng->txt(
"send"));
1486 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1488 $subject->setValue(sprintf($this->lng->txt(
'survey_360_rater_subject_default'), $this->
object->getTitle()));
1489 $mailmessage_u->setValue($this->lng->txt(
'survey_360_rater_message_content_registered_default'));
1490 $mailmessage_a->setValue($this->lng->txt(
'survey_360_rater_message_content_anonymous_default'));
1501 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1503 if (!
sizeof(
$_POST[
"rtr_id"])) {
1505 $this->ctrl->redirect($this,
"editRaters");
1511 $ilTabs->clearTargets();
1512 $ilTabs->setBackTarget(
1513 $this->lng->txt(
"btn_back"),
1514 $this->ctrl->getLinkTarget($this,
"editRaters")
1517 $this->tpl->setContent($a_form->getHTML());
1525 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1527 $rec_ids = explode(
";",
$_POST[
"rtr_id"]);
1528 if (!
sizeof($rec_ids)) {
1529 $this->ctrl->redirect($this,
"editRaters");
1533 if ($form->checkInput()) {
1534 $txt_u = $form->getInput(
"message_u");
1535 $txt_a = $form->getInput(
"message_a");
1536 $subj = $form->getInput(
"subject");
1539 $sender_id = (trim(
$ilUser->getEmail()))
1543 $all_data = $this->
object->getRatersData($appr_id);
1544 foreach ($rec_ids as $rec_id) {
1545 if (isset($all_data[$rec_id])) {
1546 $user = $all_data[$rec_id];
1549 if (substr($rec_id, 0, 1) ==
"a") {
1552 $rcp =
$user[
"email"];
1557 $user[
"code"] = $this->lng->txt(
"survey_code_mail_on_demand");
1559 $rcp =
$user[
"login"];
1562 $mytxt = str_replace(
"[lastname]",
$user[
"lastname"], $mytxt);
1563 $mytxt = str_replace(
"[firstname]",
$user[
"firstname"], $mytxt);
1564 $mytxt = str_replace(
"[url]",
$url, $mytxt);
1565 $mytxt = str_replace(
"[code]",
$user[
"code"], $mytxt);
1567 $mail =
new ilMail($sender_id);
1577 $this->
object->set360RaterSent(
1579 (substr($rec_id, 0, 1) ==
"a") ? 0 : (
int) substr($rec_id, 1),
1580 (substr($rec_id, 0, 1) ==
"u") ? 0 : (
int) substr($rec_id, 1)
1585 ilUtil::sendSuccess($this->lng->txt(
"mail_sent"),
true);
1586 $this->ctrl->redirect($this,
"editRaters");
1589 $form->setValuesByPost();
1599 $ilTabs->clearTargets();
1600 $ilTabs->setBackTarget(
1601 $this->lng->txt(
"menuback"),
1602 $this->ctrl->getLinkTarget($this->parent_gui,
"infoScreen")
1605 if (!$this->object->isAppraisee(
$ilUser->getId())) {
1606 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1610 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close"));
1612 $cgui->setFormAction($this->ctrl->getFormAction($this,
"appraiseeClose"));
1613 $cgui->setCancel($this->lng->txt(
"cancel"),
"confirmAppraiseeCloseCancel");
1614 $cgui->setConfirm($this->lng->txt(
"confirm"),
"appraiseeClose");
1616 $tpl->setContent($cgui->getHTML());
1621 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1628 if (!$this->object->isAppraisee(
$ilUser->getId())) {
1629 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1632 $this->
object->closeAppraisee(
$ilUser->getId());
1633 ilUtil::sendSuccess($this->lng->txt(
"survey_360_appraisee_close_action_success"),
true);
1634 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1643 $appr_ids =
$_POST[
"appr_id"];
1645 if (!
sizeof($appr_ids)) {
1647 $this->ctrl->redirect($this,
"listAppraisees");
1651 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close_admin"));
1653 $cgui->setFormAction($this->ctrl->getFormAction($this,
"adminAppraiseesClose"));
1654 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1655 $cgui->setConfirm($this->lng->txt(
"confirm"),
"adminAppraiseesClose");
1657 foreach ($appr_ids as $appr_id) {
1661 $tpl->setContent($cgui->getHTML());
1668 $appr_ids =
$_POST[
"appr_id"];
1670 if (!
sizeof($appr_ids)) {
1672 $this->ctrl->redirect($this,
"listAppraisees");
1675 $appr_data = $this->
object->getAppraiseesData();
1676 foreach ($appr_ids as $appr_id) {
1677 if (isset($appr_data[$appr_id]) && !$appr_data[$appr_id][
"closed"]) {
1678 $this->
object->closeAppraisee($appr_id);
1682 ilUtil::sendSuccess($this->lng->txt(
"survey_360_appraisee_close_action_success_admin"),
true);
1683 $this->ctrl->redirect($this,
"listAppraisees");
1691 $this->ctrl->redirect($this,
"maintenance");
1698 $button->setCaption(
"print");
1699 $button->setOnClick(
"window.print(); return false;");
1700 $button->setOmitPreventDoubleSubmission(
true);
1701 $ilToolbar->addButtonInstance($button);
1704 $this->tpl->setContent($tbl->getHTML());
1722 if (is_array($user_ids)) {
1723 foreach ($user_ids as $user_id) {
1724 $this->invitation_manager->add($this->object->getSurveyId(), (int) $user_id);
1727 ilUtil::sendSuccess(
$lng->txt(
"svy_users_invited"),
true);
1728 $ctrl->redirect($this,
"maintenance");
importAccessCodesObject()
Import codes from export codes file (upload form)
Class ilSurveyParticipantsGUI.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
codesObject()
Display the survey access codes tab.
addAppraisee($a_user_ids)
exportAllCodesObject()
Exports all survey codes.
addExternalRaterFormObject(ilPropertyFormGUI $a_form=null)
Skill management settings.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
_convertCharset($a_string, $a_from_charset="", $a_to_charset="UTF-8")
setValue($a_value)
Set Value.
maintenanceObject()
Participants maintenance.
setCodeLanguageObject()
Change survey language for direct access URL's.
insertSavedMessageObject()
confirmAppraiseeCloseObject()
inviteUsers($user_ids)
Invite users.
cancelDeleteSelectedUserDataObject()
Cancels the deletion of all user data for the test object.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
confirmDeleteAppraiseesObject()
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
confirmDeleteRatersObject()
initMailRatersForm($appr_id, array $rec_ids)
cancelDeleteAllUserDataObject()
Cancels delete of all user data in maintenance.
deleteCodesConfirmObject()
importExternalRecipientsFromFileObject()
deleteCodesObject()
Delete a list of survey codes.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
filterSurveyParticipantsByAccess($a_finished_ids=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
createSurveyCodesObject()
Create access codes for the survey.
__construct(ilObjSurveyGUI $a_parent_gui, $a_has_write_access)
confirmDeleteSelectedUserDataObject()
Deletes all user data for the test object.
deleteSavedMessageObject()
confirmAdminAppraiseesCloseObject()
importExternalMailRecipientsFromFileFormObject()
importAccessCodesActionObject()
Import codes from export codes file.
This class represents a text area property in a property form.
importExternalRecipientsFromTextObject()
initExternalRaterForm($appr_id)
adminAppraiseesCloseObject()
confirmDeleteAllUserDataObject()
Deletes all user data of the survey after confirmation.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
mailRatersObject(ilPropertyFormGUI $a_form=null)
exportCodesObject()
Exports a list of survey codes.
deleteSingleUserResultsObject()
Asks for a confirmation to delete selected user data of the test object.
deleteAllUserDataObject()
Creates a confirmation form for delete all user data.
importExternalMailRecipientsFromTextFormObject()
Confirmation screen class.
setParticipantSubTabs(string $active)
Set the tabs for the access codes section.
confirmAppraiseeCloseCancelObject()