20 $this->parent_gui = $a_parent_gui;
21 $this->
object = $this->parent_gui->object;
22 $this->ref_id = $this->
object->getRefId();
33 $cmd = $ilCtrl->getCmd(
"maintenance");
34 $next_class = $this->ctrl->getNextClass($this);
38 case 'ilrepositorysearchgui':
39 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
44 $ilTabs->clearTargets();
45 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
46 $this->ctrl->getLinkTarget($this,
"invite"));
48 $rep_search->setCallback($this,
49 'inviteUserGroupObject',
55 $this->ctrl->setReturn($this,
'invite');
56 $this->ctrl->forwardCommand($rep_search);
57 $ilTabs->setTabActive(
'invitation');
61 $ilTabs->clearTargets();
62 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
63 $this->ctrl->getLinkTarget($this,
"listAppraisees"));
65 $this->ctrl->setParameter($this,
"rate360", 1);
66 $this->ctrl->saveParameter($this,
"appr_id");
68 $rep_search->setCallback($this,
75 $this->ctrl->setReturn($this,
'editRaters');
76 $this->ctrl->forwardCommand($rep_search);
80 $ilTabs->activateTab(
"survey_360_appraisees");
81 $this->ctrl->setParameter($this,
"appr360", 1);
83 $rep_search->setCallback($this,
90 $this->ctrl->setReturn($this,
'listAppraisees');
91 $this->ctrl->forwardCommand($rep_search);
107 if($this->object->get360Mode())
112 $this->parent_gui->handleWriteAccess();
115 if (DEVMODE &&
$_GET[
"fill"] > 0)
117 for ($i = 0; $i <
$_GET[
"fill"]; $i++) $this->object->fillSurveyForUser();
119 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
121 $total =& $this->
object->getSurveyParticipants();
123 foreach (
$total as $user_data)
125 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
126 array_push($data, array(
127 'id' => $user_data[
"active_id"],
128 'name' => $user_data[
"sortname"],
129 'login' => $user_data[
"login"],
130 'last_access' => $last_access
133 $table_gui->setData($data);
134 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
147 $ilTabs->addSubTabTarget(
"results",
148 $this->ctrl->getLinkTarget($this,
'maintenance'),
149 array(
"maintenance",
"deleteAllUserData"),
153 if($this->object->get360Mode())
155 $ilTabs->addSubTabTarget(
"survey_360_appraisees",
156 $this->ctrl->getLinkTarget($this,
'listAppraisees'),
157 array(
"listAppraisees",
"editRaters"),
161 $ilTabs->addSubTabTarget(
"codes",
162 $this->ctrl->getLinkTarget($this,
'codes'),
163 array(
"codes",
"editCodes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes",
164 "importExternalMailRecipientsFromFileForm",
"importExternalMailRecipientsFromTextForm"),
168 if(!$this->object->get360Mode())
171 $ilTabs->addSubTabTarget(
"invitation",
172 $this->ctrl->getLinkTarget($this,
'invite'),
173 array(
"invite",
"saveInvitationStatus",
174 "inviteUserGroup",
"disinviteUserGroup"),
190 $data = $this->
object->getExternalCodeRecipients();
193 $ilTabs->addSubTabTarget
196 $this->ctrl->getLinkTarget($this,
"mailCodes"),
197 array(
"mailCodes",
"sendCodesMail",
"insertSavedMessage",
"deleteSavedMessage"),
209 if (is_array(
$_POST[
"user_select"]))
211 foreach (
$_POST[
"user_select"] as $user_id)
213 $this->
object->disinviteUser($user_id);
217 $this->ctrl->redirect($this,
"invite");
227 if (is_array($a_user_ids))
229 foreach ($a_user_ids as $user_id)
231 $this->
object->inviteUser($user_id);
245 $this->ctrl->redirect($this,
"invite");
253 $mode =
$_POST[
'invitation'];
257 $this->
object->setInvitation(0);
260 $this->
object->setInvitation(1);
261 $this->
object->setInvitationMode(0);
264 $this->
object->setInvitation(1);
265 $this->
object->setInvitationMode(1);
268 $this->
object->saveToDb();
270 $this->ctrl->redirect($this,
"invite");
283 $this->parent_gui->handleWriteAccess();
286 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
288 $form->setFormAction($this->ctrl->getFormAction($this));
289 $form->setTableWidth(
"500");
290 $form->setId(
"invite");
294 $header->setTitle($this->lng->txt(
"invitation"));
295 $form->addItem($header);
299 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
300 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0,
''));
301 $surveySetting =
new ilSetting(
"survey");
302 if ($surveySetting->get(
"unlimited_invitation"))
304 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1,
''));
306 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2,
''));
308 if ($this->object->getInvitation())
310 $inv = $this->
object->getInvitationMode() + 1;
312 $invitation->setValue($inv);
313 $form->addItem($invitation);
315 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
317 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
318 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
320 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
323 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
328 'auto_complete_name' => $lng->txt(
'user'),
329 'submit_name' => $lng->txt(
'svy_invite_action')
333 $ilToolbar->addSpacer();
335 $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
336 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
338 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
340 $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
341 include_once
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
343 $table_gui->setData($invited_users);
344 $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());
353 include_once
"Services/Utilities/classes/class.ilConfirmationGUI.php";
355 $cgui->setHeaderText($this->lng->txt(
"confirm_delete_all_user_data"));
356 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAllUserData"));
357 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteAllUserData");
358 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteAllUserData");
359 $this->tpl->setContent($cgui->getHTML());
367 $this->
object->deleteAllUserData();
370 if($this->object->get360Mode())
372 $this->
object->openAllAppraisees();
376 $this->ctrl->redirect($this,
"maintenance");
384 $this->ctrl->redirect($this,
"maintenance");
392 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
394 $this->ctrl->redirect($this,
"maintenance");
403 $this->ctrl->redirect($this,
"maintenance");
411 $this->parent_gui->handleWriteAccess();
413 if (count(
$_POST[
"chbUser"]) == 0)
416 $this->ctrl->redirect($this,
"maintenance");
420 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
422 $total =& $this->
object->getSurveyParticipants();
424 foreach (
$total as $user_data)
426 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser']))
428 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
429 array_push($data, array(
430 'id' => $user_data[
"active_id"],
431 'name' => $user_data[
"sortname"],
432 'login' => $user_data[
"login"],
433 'last_access' => $last_access
437 $table_gui->setData($data);
438 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
446 if (strcmp(
$_POST[
"lang"],
"-1") != 0)
449 $ilUser->writePref(
"survey_code_language",
$_POST[
"lang"]);
452 $this->ctrl->redirect($this,
'codes');
462 $this->parent_gui->handleWriteAccess();
465 if ($this->object->getAnonymize() != 1 && !$this->
object->isAccessibleWithCodeForAll())
470 $default_lang = $ilUser->getPref(
"survey_code_language");
473 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
475 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
479 $ilToolbar->addInputItem(
$si,
true);
480 $ilToolbar->addFormButton($this->lng->txt(
"create"),
"createSurveyCodes");
482 $ilToolbar->addSeparator();
484 $ilToolbar->addFormButton($this->lng->txt(
"import_from_file"),
"importExternalMailRecipientsFromFileForm");
485 $ilToolbar->addFormButton($this->lng->txt(
"import_from_text"),
"importExternalMailRecipientsFromTextForm");
487 $ilToolbar->addSeparator();
489 $languages = $this->lng->getInstalledLanguages();
491 $this->lng->loadLanguageModule(
"meta");
492 foreach ($languages as
$lang)
496 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
499 $si->setValue($default_lang);
500 $ilToolbar->addInputItem(
$si,
true);
501 $ilToolbar->addFormButton($this->lng->txt(
"set"),
"setCodeLanguage");
504 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
506 $survey_codes = $this->
object->getSurveyCodesTableData(null, $default_lang);
507 $table_gui->setData($survey_codes);
508 $this->tpl->setContent($table_gui->getHTML());
513 if(isset(
$_GET[
"new_ids"]))
515 $ids = explode(
";",
$_GET[
"new_ids"]);
519 $ids = (array)
$_POST[
"chb_code"];
524 $this->ctrl->redirect($this,
'codes');
527 $this->parent_gui->handleWriteAccess();
530 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesEditTableGUI.php";
532 $table_gui->setData($this->object->getSurveyCodesTableData($ids));
533 $this->tpl->setContent($table_gui->getHTML());
538 if(!is_array(
$_POST[
"chb_code"]))
540 $this->ctrl->redirect($this,
'codes');
543 foreach(
$_POST[
"chb_code"] as $id)
545 $this->
object->updateCode($id,
554 $this->ctrl->redirect($this,
'codes');
559 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
561 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
563 $cgui->setHeaderText($this->lng->txt(
"survey_code_delete_sure"));
565 $cgui->setFormAction($this->ctrl->getFormAction($this));
566 $cgui->setCancel($this->lng->txt(
"cancel"),
"codes");
567 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
569 $data = $this->
object->getSurveyCodesTableData(
$_POST[
"chb_code"]);
571 foreach ($data as $item)
578 $title = array($item[
"code"]);
579 $item[
"email"] ? $title[] = $item[
"email"] : null;
580 $item[
"last_name"] ? $title[] = $item[
"last_name"] : null;
581 $item[
"first_name"] ? $title[] = $item[
"first_name"] : null;
582 $title = implode(
", ", $title);
584 $cgui->addItem(
"chb_code[]", $item[
"code"], $title);
587 $this->tpl->setContent($cgui->getHTML());
592 $this->ctrl->redirect($this,
'codes');
601 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
603 foreach (
$_POST[
"chb_code"] as $survey_code)
605 $this->
object->deleteSurveyCode($survey_code);
613 $this->ctrl->redirect($this,
'codes');
621 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
623 $export = $this->
object->getSurveyCodesForExport(null,
$_POST[
"chb_code"]);
629 $this->ctrl->redirect($this,
'codes');
638 $export = $this->
object->getSurveyCodesForExport();
647 if (is_numeric(
$_POST[
"nrOfCodes"]))
649 $ids = $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
651 $this->ctrl->setParameter($this,
"new_ids", implode(
";", $ids));
652 $this->ctrl->redirect($this,
'editCodes');
657 $this->ctrl->redirect($this,
'codes');
663 $this->parent_gui->handleWriteAccess();
666 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
668 $form_gui->setValuesByPost();
671 if ($form_gui->getSavedMessages()->getValue() > 0)
674 $settings = $this->
object->getUserSettings($ilUser->getId(),
'savemessage');
675 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
686 $ilLog->write(
'Error: ' + $e->getMessage());
688 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
693 $this->parent_gui->handleWriteAccess();
696 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
698 $form_gui->setValuesByPost();
701 if ($form_gui->getSavedMessages()->getValue() > 0)
703 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
705 $form_gui->setValuesByPost();
716 $ilLog->write(
'Error: ' + $e->getMessage());
718 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
723 $this->parent_gui->handleWriteAccess();
726 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
727 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
728 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
730 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
732 $form_gui->setValuesByArray($mailData);
733 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
740 $this->parent_gui->handleWriteAccess();
743 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
745 if ($form_gui->checkInput())
747 $code_exists = strpos(
$_POST[
'm_message'],
'[code]') !== FALSE;
751 $form_gui->setValuesByPost();
755 if (
$_POST[
'savemessage'] == 1)
758 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
759 $this->
object->saveUserSettings($ilUser->getId(),
'savemessage', $title,
$_POST[
'm_message']);
762 $lang = $ilUser->getPref(
"survey_code_language");
765 $lang = $this->lng->getDefaultLanguage();
769 $this->ctrl->redirect($this,
'mailCodes');
774 $form_gui->setValuesByPost();
776 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
781 $this->ctrl->redirect($this,
'codesMail');
786 if (!is_array(
$_POST[
'chb_ext']) || count(is_array(
$_POST[
'chb_ext'])) == 0)
789 $this->ctrl->redirect($this,
'codesMail');
791 foreach (
$_POST[
'chb_ext'] as $code)
793 $this->
object->deleteSurveyCode($code);
796 $this->ctrl->redirect($this,
'codesMail');
801 if (trim(
$_POST[
'externaltext']))
803 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
804 $fields = preg_split(
"/;/", array_shift($data));
805 if (!in_array(
'email', $fields))
809 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
811 $existingdata = $this->
object->getExternalCodeRecipients();
812 $existingcolumns = array();
813 if (count($existingdata))
815 $first = array_shift($existingdata);
816 foreach ($first as $key => $value)
818 array_push($existingcolumns, $key);
821 $founddata = array();
822 foreach ($data as $datarow)
824 $row = preg_split(
"/;/", $datarow);
825 if (count(
$row) == count($fields))
828 foreach ($fields as $idx => $fieldname)
830 if (count($existingcolumns))
832 if (array_key_exists($idx, $existingcolumns))
834 $dataset[$fieldname] =
$row[$idx];
839 $dataset[$fieldname] =
$row[$idx];
842 if (strlen($dataset[
'email']))
844 array_push($founddata, $dataset);
848 $this->
object->createSurveyCodesForExternalData($founddata);
850 $this->ctrl->redirect($this,
'codes');
853 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
858 if (trim($_FILES[
'externalmails'][
'tmp_name']))
860 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
862 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
863 $data =
$reader->getDataArrayFromCSVFile();
864 $fields = array_shift($data);
865 if (!in_array(
'email', $fields))
869 $this->ctrl->redirect($this,
'codes');
871 $existingdata = $this->
object->getExternalCodeRecipients();
872 $existingcolumns = array();
873 if (count($existingdata))
875 $first = array_shift($existingdata);
876 foreach ($first as $key => $value)
878 array_push($existingcolumns, $key);
881 $founddata = array();
882 foreach ($data as
$row)
884 if (count($row) == count($fields))
887 foreach ($fields as $idx => $fieldname)
889 if (count($existingcolumns))
891 if (array_key_exists($idx, $existingcolumns))
893 $dataset[$fieldname] = $row[$idx];
898 $dataset[$fieldname] = $row[$idx];
901 if (strlen($dataset[
'email']))
903 array_push($founddata, $dataset);
908 $this->
object->createSurveyCodesForExternalData($founddata);
910 $this->ctrl->redirect($this,
'codes');
913 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
920 $this->parent_gui->handleWriteAccess();
923 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
925 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
926 $form_import_file->setTableWidth(
"100%");
927 $form_import_file->setId(
"codes_import_file");
930 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
931 $form_import_file->addItem($headerfile);
933 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
934 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
935 $externalmails->setRequired(
true);
936 $form_import_file->addItem($externalmails);
937 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
938 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
940 $this->tpl->setContent($form_import_file->getHTML());
947 $this->parent_gui->handleWriteAccess();
950 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
952 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
953 $form_import_text->setTableWidth(
"100%");
954 $form_import_text->setId(
"codes_import_text");
957 $headertext->setTitle($this->lng->txt(
"import_from_text"));
958 $form_import_text->addItem($headertext);
967 $inp->setValue($this->lng->txt(
'mail_import_example1') .
"\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
969 $inp->setRequired(
true);
972 $inp->setInfo($this->lng->txt(
'externaltext_info'));
973 $form_import_text->addItem($inp);
976 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
977 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
979 $this->tpl->setContent($form_import_text->getHTML());
1002 $this->parent_gui->handleWriteAccess();
1005 $this->ctrl->setParameter($this,
"appr360", 1);
1007 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1012 'auto_complete_name' => $this->lng->txt(
'user'),
1013 'submit_name' => $this->lng->txt(
'add'),
1014 'add_search' =>
true,
1020 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
1022 if ($this->object->get360SkillService() && $skmg_set->isActivated())
1024 $ilToolbar->addSeparator();
1025 $ilToolbar->addButton($lng->txt(
"survey_calc_skills"),
1026 $ilCtrl->getLinkTargetByClass(
"ilsurveyskilldeterminationgui"),
"");
1030 $this->ctrl->setParameter($this,
"appr360",
"");
1032 include_once
"Modules/Survey/classes/tables/class.ilSurveyAppraiseesTableGUI.php";
1034 $tbl->setData($this->object->getAppraiseesData());
1035 $this->tpl->setContent($tbl->getHTML());
1040 if(
sizeof($a_user_ids))
1043 foreach(array_unique($a_user_ids) as $user_id)
1045 $this->
object->addAppraisee($user_id);
1050 $this->ctrl->redirect($this,
"listAppraisees");
1057 if(!
sizeof(
$_POST[
"appr_id"]))
1060 $this->ctrl->redirect($this,
"listAppraisees");
1063 $ilTabs->clearTargets();
1064 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1065 $this->ctrl->getLinkTarget($this,
"listAppraisees"));
1067 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1069 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_delete_appraises"));
1071 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAppraisees"));
1072 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1073 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteAppraisees");
1075 $data = $this->
object->getAppraiseesData();
1078 include_once
"Services/User/classes/class.ilUserUtil.php";
1079 foreach (
$_POST[
"appr_id"] as $id)
1081 if(isset($data[$id]) && !$data[$id][
"closed"])
1091 $this->ctrl->redirect($this,
"listAppraisees");
1094 $this->tpl->setContent($cgui->getHTML());
1099 if(
sizeof(
$_POST[
"appr_id"]))
1101 $data = $this->
object->getAppraiseesData();
1103 foreach (
$_POST[
"appr_id"] as $id)
1106 if(isset($data[$id]) && !$data[$id][
"closed"])
1108 $this->
object->deleteAppraisee($id);
1115 $this->ctrl->redirect($this,
"listAppraisees");
1122 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
1127 $this->ctrl->redirect($this,
"listAppraisees");
1131 else if($this->object->get360Mode() &&
1132 $this->
object->get360SelfRaters() &&
1133 $this->
object->isAppraisee($ilUser->getId()) &&
1134 !$this->object->isAppraiseeClosed($ilUser->getId()))
1136 return $ilUser->getId();
1138 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1143 global $ilTabs, $ilToolbar, $ilAccess;
1147 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1150 $ilTabs->clearTargets();
1151 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1152 $this->ctrl->getLinkTarget($this,
"listAppraisees"));
1155 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1156 $this->ctrl->setParameter($this,
"rate360", 1);
1158 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1163 'auto_complete_name' => $this->lng->txt(
'user'),
1164 'submit_name' => $this->lng->txt(
'add'),
1165 'add_search' =>
true,
1170 $this->ctrl->setParameter($this,
"rate360",
"");
1172 $ilToolbar->addSeparator();
1174 $ilToolbar->addButton($this->lng->txt(
"survey_360_add_external_rater"),
1175 $this->ctrl->getLinkTarget($this,
"addExternalRaterForm"));
1177 include_once
"Modules/Survey/classes/tables/class.ilSurveyAppraiseesTableGUI.php";
1179 $tbl->
setData($this->object->getRatersData($appr_id));
1180 $this->tpl->setContent($tbl->getHTML());
1185 global $ilTabs, $ilAccess;
1188 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1190 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1193 $ilTabs->clearTargets();
1194 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1195 $this->ctrl->getLinkTarget($this,
"editRaters"));
1203 $this->tpl->setContent($a_form->getHTML());
1208 include_once
"Services/User/classes/class.ilUserUtil.php";
1209 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1211 $form->setFormAction($this->ctrl->getFormAction($this,
"addExternalRater"));
1212 $form->setTitle($this->lng->txt(
"survey_360_add_external_rater").
1213 ": ".ilUserUtil::getNamePresentation($appr_id));
1215 $email =
new ilEmailInputGUI($this->lng->txt(
"email"),
"email");
1216 $email->setRequired(
true);
1217 $form->addItem($email);
1219 $lname =
new ilTextInputGUI($this->lng->txt(
"lastname"),
"lname");
1221 $form->addItem($lname);
1223 $fname =
new ilTextInputGUI($this->lng->txt(
"firstname"),
"fname");
1225 $form->addItem($fname);
1227 $form->addCommandButton(
"addExternalRater", $this->lng->txt(
"save"));
1228 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1238 $this->ctrl->redirect($this,
"listAppraisees");
1241 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1244 if($form->checkInput())
1247 "email" => $form->getInput(
"email"),
1248 "lastname" => $form->getInput(
"lname"),
1249 "firstname" => $form->getInput(
"fname")
1251 $anonymous_id = $this->
object->createSurveyCodesForExternalData(array($data));
1252 $anonymous_id = array_pop($anonymous_id);
1254 $this->
object->addRater($appr_id, 0, $anonymous_id);
1257 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1258 $this->ctrl->redirect($this,
"editRaters");
1261 $form->setValuesByPost();
1271 if(
sizeof($a_user_ids))
1274 foreach(array_unique($a_user_ids) as $user_id)
1276 if($ilAccess->checkAccess(
"write",
"", $this->ref_id) ||
1277 $this->
object->get360SelfEvaluation() ||
1278 $user_id != $ilUser->getId())
1280 $this->
object->addRater($appr_id, $user_id);
1287 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1288 $this->ctrl->redirect($this,
"editRaters");
1296 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1297 if(!
sizeof(
$_POST[
"rtr_id"]))
1300 $this->ctrl->redirect($this,
"editRaters");
1303 $ilTabs->clearTargets();
1304 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1305 $this->ctrl->getLinkTarget($this,
"editRaters"));
1307 include_once
"Services/User/classes/class.ilUserUtil.php";
1308 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1310 $cgui->setHeaderText(sprintf($this->lng->txt(
"survey_360_sure_delete_raters"),
1313 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteRaters"));
1314 $cgui->setCancel($this->lng->txt(
"cancel"),
"editRaters");
1315 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteRaters");
1317 $data = $this->
object->getRatersData($appr_id);
1319 foreach (
$_POST[
"rtr_id"] as $id)
1321 if(isset($data[$id]))
1323 $cgui->addItem(
"rtr_id[]", $id, $data[$id][
"lastname"].
", ".
1324 $data[$id][
"firstname"].
" (".$data[$id][
"email"].
")");
1328 $this->tpl->setContent($cgui->getHTML());
1334 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1336 if(
sizeof(
$_POST[
"rtr_id"]))
1338 $data = $this->
object->getRatersData($appr_id);
1340 foreach (
$_POST[
"rtr_id"] as $id)
1342 if(isset($data[$id]))
1344 if(substr($id, 0, 1) ==
"u")
1346 $this->
object->deleteRater($appr_id, substr($id, 1));
1350 $this->
object->deleteRater($appr_id, 0, substr($id, 1));
1358 $this->ctrl->redirect($this,
"editRaters");
1365 if($this->object->get360SelfAppraisee() &&
1366 !$this->
object->isAppraisee($ilUser->getId()))
1368 $this->
object->addAppraisee($ilUser->getId());
1371 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1376 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1378 $form->setFormAction($this->ctrl->getFormAction($this,
"mailRatersAction"));
1379 $form->setTitle($this->lng->txt(
'compose'));
1381 $all_data = $this->
object->getRatersData($appr_id);
1382 $rec_data = array();
1383 foreach($rec_ids as $rec_id)
1385 if(isset($all_data[$rec_id]))
1387 $rec_data[] = $all_data[$rec_id][
"lastname"].
", ".
1388 $all_data[$rec_id][
"firstname"].
1389 " (".$all_data[$rec_id][
"email"].
")";
1394 $rec->setHTML(implode(
"<br />", $rec_data));
1395 $form->addItem($rec);
1397 $subject =
new ilTextInputGUI($this->lng->txt(
'subject'),
'subject');
1399 $subject->setRequired(
true);
1400 $form->addItem($subject);
1402 $existingdata = $this->
object->getExternalCodeRecipients();
1403 $existingcolumns = array();
1404 if (count($existingdata))
1406 $first = array_shift($existingdata);
1407 foreach ($first as $key => $value)
1409 if (strcmp($key,
'code') != 0 && strcmp($key,
'email') != 0 && strcmp($key,
'sent') != 0) array_push($existingcolumns,
'[' . $key .
']');
1413 $mailmessage_u =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_registered'),
'message_u');
1415 $mailmessage_u->setCols(80);
1416 $mailmessage_u->setRows(10);
1417 $form->addItem($mailmessage_u);
1419 $mailmessage_a =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_anonymous'),
'message_a');
1421 $mailmessage_a->setCols(80);
1422 $mailmessage_a->setRows(10);
1423 $mailmessage_a->setInfo(sprintf($this->lng->txt(
'message_content_info'), join($existingcolumns,
', ')));
1424 $form->addItem($mailmessage_a);
1427 $recf->setValue(implode(
";", $rec_ids));
1428 $form->addItem($recf);
1430 $form->addCommandButton(
"mailRatersAction", $this->lng->txt(
"send"));
1431 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1433 $subject->setValue(sprintf($this->lng->txt(
'survey_360_rater_subject_default'), $this->
object->getTitle()));
1434 $mailmessage_u->setValue($this->lng->txt(
'survey_360_rater_message_content_registered_default'));
1435 $mailmessage_a->setValue($this->lng->txt(
'survey_360_rater_message_content_anonymous_default'));
1447 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1449 if(!
sizeof(
$_POST[
"rtr_id"]))
1452 $this->ctrl->redirect($this,
"editRaters");
1458 $ilTabs->clearTargets();
1459 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1460 $this->ctrl->getLinkTarget($this,
"editRaters"));
1462 $this->tpl->setContent($a_form->getHTML());
1470 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1472 $rec_ids = explode(
";",
$_POST[
"rtr_id"]);
1473 if(!
sizeof($rec_ids))
1475 $this->ctrl->redirect($this,
"editRaters");
1479 if($form->checkInput())
1481 $txt_u = $form->getInput(
"message_u");
1482 $txt_a = $form->getInput(
"message_a");
1483 $subj = $form->getInput(
"subject");
1486 $sender_id = (trim($ilUser->getEmail()))
1488 : ANONYMOUS_USER_ID;
1490 include_once
"./Services/Mail/classes/class.ilMail.php";
1492 $all_data = $this->
object->getRatersData($appr_id);
1493 foreach($rec_ids as $rec_id)
1495 if(isset($all_data[$rec_id]))
1498 $user = $all_data[$rec_id];
1501 if(substr($rec_id, 0, 1) ==
"a")
1504 $url = $user[
"href"];
1505 $rcp = $user[
"email"];
1511 $user[
"code"] = $this->lng->txt(
"survey_code_mail_on_demand");
1513 $rcp = $user[
"login"];
1516 $mytxt = str_replace(
"[lastname]", $user[
"lastname"], $mytxt);
1517 $mytxt = str_replace(
"[firstname]", $user[
"firstname"], $mytxt);
1518 $mytxt = str_replace(
"[url]", $url, $mytxt);
1519 $mytxt = str_replace(
"[code]", $user[
"code"], $mytxt);
1521 $mail =
new ilMail($sender_id);
1532 $this->
object->set360RaterSent($appr_id,
1533 (substr($rec_id, 0, 1) ==
"a") ? 0 : (
int)substr($rec_id, 1),
1534 (substr($rec_id, 0, 1) ==
"u") ? 0 : (
int)substr($rec_id, 1));
1539 $this->ctrl->redirect($this,
"editRaters");
1542 $form->setValuesByPost();
1550 $ilTabs->clearTargets();
1551 $ilTabs->setBackTarget($this->lng->txt(
"menuback"),
1552 $this->ctrl->getLinkTarget($this->parent_gui,
"infoScreen"));
1554 if(!$this->object->isAppraisee($ilUser->getId()))
1556 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1559 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1561 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close"));
1563 $cgui->setFormAction($this->ctrl->getFormAction($this,
"appraiseeClose"));
1564 $cgui->setCancel($this->lng->txt(
"cancel"),
"confirmAppraiseeCloseCancel");
1565 $cgui->setConfirm($this->lng->txt(
"confirm"),
"appraiseeClose");
1567 $tpl->setContent($cgui->getHTML());
1572 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1579 if(!$this->object->isAppraisee($ilUser->getId()))
1581 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1584 $this->
object->closeAppraisee($ilUser->getId());
1586 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1593 $this->parent_gui->handleWriteAccess();
1595 $appr_ids =
$_POST[
"appr_id"];
1597 if(!
sizeof($appr_ids))
1600 $this->ctrl->redirect($this,
"listAppraisees");
1603 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1605 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close_admin"));
1607 $cgui->setFormAction($this->ctrl->getFormAction($this,
"adminAppraiseesClose"));
1608 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1609 $cgui->setConfirm($this->lng->txt(
"confirm"),
"adminAppraiseesClose");
1611 include_once
"Services/User/classes/class.ilUserUtil.php";
1612 foreach($appr_ids as $appr_id)
1617 $tpl->setContent($cgui->getHTML());
1622 $this->parent_gui->handleWriteAccess();
1624 $appr_ids =
$_POST[
"appr_id"];
1626 if(!
sizeof($appr_ids))
1629 $this->ctrl->redirect($this,
"listAppraisees");
1632 $appr_data = $this->
object->getAppraiseesData();
1633 foreach($appr_ids as $appr_id)
1635 if(isset($appr_data[$appr_id]) && !$appr_data[$appr_id][
"closed"])
1637 $this->
object->closeAppraisee($appr_id);
1641 ilUtil::sendSuccess($this->lng->txt(
"survey_360_appraisee_close_action_success_admin"),
true);
1642 $this->ctrl->redirect($this,
"listAppraisees");