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)
126 if((
bool)$user_data[
"finished"])
128 $finished = $user_data[
"finished_tstamp"];
130 $wt = $this->
object->getWorkingtimeForParticipant($user_data[
"active_id"]);
131 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
132 array_push($data, array(
133 'id' => $user_data[
"active_id"],
134 'name' => $user_data[
"sortname"],
135 'login' => $user_data[
"login"],
136 'last_access' => $last_access,
137 'workingtime' => $wt,
138 'finished' => $finished
141 $table_gui->setData($data);
142 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
157 $ilTabs->addSubTabTarget(
"results",
158 $this->ctrl->getLinkTarget($this,
'maintenance'),
159 array(
"maintenance",
"deleteAllUserData"),
162 if(!$this->object->isAccessibleWithoutCode())
164 $ilTabs->addSubTabTarget(
"codes",
165 $this->ctrl->getLinkTarget($this,
'codes'),
166 array(
"codes",
"editCodes",
"createSurveyCodes",
"setCodeLanguage",
"deleteCodes",
"exportCodes",
167 "importExternalMailRecipientsFromFileForm",
"importExternalMailRecipientsFromTextForm"),
173 $ilTabs->addSubTabTarget(
"invitation",
174 $this->ctrl->getLinkTarget($this,
'invite'),
175 array(
"invite",
"saveInvitationStatus",
176 "inviteUserGroup",
"disinviteUserGroup"),
179 $data = $this->
object->getExternalCodeRecipients();
182 $ilTabs->addSubTabTarget
185 $this->ctrl->getLinkTarget($this,
"mailCodes"),
186 array(
"mailCodes",
"sendCodesMail",
"insertSavedMessage",
"deleteSavedMessage"),
198 if (is_array(
$_POST[
"user_select"]))
200 foreach (
$_POST[
"user_select"] as $user_id)
202 $this->
object->disinviteUser($user_id);
206 $this->ctrl->redirect($this,
"invite");
216 if (is_array($a_user_ids))
218 foreach ($a_user_ids as $user_id)
220 $this->
object->inviteUser($user_id);
234 $this->ctrl->redirect($this,
"invite");
242 $mode =
$_POST[
'invitation'];
255 $this->
object->saveToDb();
257 $this->ctrl->redirect($this,
"invite");
270 $this->parent_gui->handleWriteAccess();
273 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
275 $form->setFormAction($this->ctrl->getFormAction($this));
276 $form->setTableWidth(
"500");
277 $form->setId(
"invite");
281 $header->setTitle($this->lng->txt(
"invitation"));
282 $form->addItem($header);
286 $invitation->
setInfo($this->lng->txt(
'invitation_mode_desc'));
287 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"invitation_off"), 0,
''));
288 $surveySetting =
new ilSetting(
"survey");
289 if ($surveySetting->get(
"unlimited_invitation"))
291 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"unlimited_users"), 1,
''));
293 $invitation->addOption(
new ilRadioOption($this->lng->txt(
"predefined_users"), 2,
''));
295 if ($this->object->getInvitation())
297 $inv = $this->
object->getInvitationMode() + 1;
299 $invitation->setValue($inv);
300 $form->addItem($invitation);
302 $form->addCommandButton(
"saveInvitationStatus", $this->lng->txt(
"save"));
304 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.il_svy_svy_invite.html",
"Modules/Survey");
305 $this->tpl->setVariable(
"INVITATION_TABLE", $form->getHTML());
307 if ($this->object->getInvitation() && $this->
object->getInvitationMode() == 1)
310 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
315 'auto_complete_name' => $lng->txt(
'user'),
316 'submit_name' => $lng->txt(
'svy_invite_action')
320 $ilToolbar->addSpacer();
322 $ilToolbar->addButton($this->lng->txt(
"svy_search_users"),
323 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
325 $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
327 $invited_users = $this->
object->getUserData($this->object->getInvitedUsers());
328 include_once
"./Modules/Survey/classes/tables/class.ilSurveyInvitedUsersTableGUI.php";
330 $table_gui->setData($invited_users);
331 $this->tpl->setVariable(
'TBL_INVITED_USERS', $table_gui->getHTML());
340 include_once
"Services/Utilities/classes/class.ilConfirmationGUI.php";
342 $cgui->setHeaderText($this->lng->txt(
"confirm_delete_all_user_data"));
343 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAllUserData"));
344 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeleteAllUserData");
345 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmDeleteAllUserData");
346 $this->tpl->setContent($cgui->getHTML());
354 $this->
object->deleteAllUserData();
357 if($this->object->get360Mode())
359 $this->
object->openAllAppraisees();
363 $this->ctrl->redirect($this,
"maintenance");
371 $this->ctrl->redirect($this,
"maintenance");
379 $this->
object->removeSelectedSurveyResults(
$_POST[
"chbUser"]);
381 $this->ctrl->redirect($this,
"maintenance");
390 $this->ctrl->redirect($this,
"maintenance");
398 $this->parent_gui->handleWriteAccess();
400 if (count(
$_POST[
"chbUser"]) == 0)
403 $this->ctrl->redirect($this,
"maintenance");
407 include_once
"./Modules/Survey/classes/tables/class.ilSurveyMaintenanceTableGUI.php";
409 $total =& $this->
object->getSurveyParticipants();
411 foreach (
$total as $user_data)
413 if (in_array($user_data[
'active_id'],
$_POST[
'chbUser']))
415 $last_access = $this->
object->_getLastAccess($user_data[
"active_id"]);
416 array_push($data, array(
417 'id' => $user_data[
"active_id"],
418 'name' => $user_data[
"sortname"],
419 'login' => $user_data[
"login"],
420 'last_access' => $last_access
424 $table_gui->setData($data);
425 $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
433 if (strcmp(
$_POST[
"lang"],
"-1") != 0)
436 $ilUser->writePref(
"survey_code_language",
$_POST[
"lang"]);
439 $this->ctrl->redirect($this,
'codes');
449 $this->parent_gui->handleWriteAccess();
452 if ($this->object->isAccessibleWithoutCode())
457 $default_lang = $ilUser->getPref(
"survey_code_language");
460 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
462 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
466 $ilToolbar->addInputItem(
$si,
true);
468 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
471 $button->setCaption(
"create");
472 $button->setCommand(
"createSurveyCodes");
473 $ilToolbar->addButtonInstance($button);
475 $ilToolbar->addSeparator();
478 $button->setCaption(
"import_from_file");
479 $button->setCommand(
"importExternalMailRecipientsFromFileForm");
480 $ilToolbar->addButtonInstance($button);
483 $button->setCaption(
"import_from_text");
484 $button->setCommand(
"importExternalMailRecipientsFromTextForm");
485 $ilToolbar->addButtonInstance($button);
487 $ilToolbar->addSeparator();
490 $button->setCaption(
"svy_import_codes");
491 $button->setCommand(
"importAccessCodes");
492 $ilToolbar->addButtonInstance($button);
494 $ilToolbar->addSeparator();
496 $languages = $this->lng->getInstalledLanguages();
498 $this->lng->loadLanguageModule(
"meta");
499 foreach ($languages as
$lang)
503 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
506 $si->setValue($default_lang);
507 $ilToolbar->addInputItem(
$si,
true);
510 $button->setCaption(
"set");
511 $button->setCommand(
"setCodeLanguage");
512 $ilToolbar->addButtonInstance($button);
514 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesTableGUI.php";
516 $survey_codes = $this->
object->getSurveyCodesTableData(null, $default_lang);
517 $table_gui->setData($survey_codes);
518 $this->tpl->setContent($table_gui->getHTML());
523 if(isset(
$_GET[
"new_ids"]))
525 $ids = explode(
";",
$_GET[
"new_ids"]);
529 $ids = (array)
$_POST[
"chb_code"];
534 $this->ctrl->redirect($this,
'codes');
537 $this->parent_gui->handleWriteAccess();
540 include_once
"./Modules/Survey/classes/tables/class.ilSurveyCodesEditTableGUI.php";
542 $table_gui->setData($this->object->getSurveyCodesTableData($ids));
543 $this->tpl->setContent($table_gui->getHTML());
548 if(!is_array(
$_POST[
"chb_code"]))
550 $this->ctrl->redirect($this,
'codes');
553 foreach(
$_POST[
"chb_code"] as $id)
555 $this->
object->updateCode($id,
564 $this->ctrl->redirect($this,
'codes');
569 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
571 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
573 $cgui->setHeaderText($this->lng->txt(
"survey_code_delete_sure"));
575 $cgui->setFormAction($this->ctrl->getFormAction($this));
576 $cgui->setCancel($this->lng->txt(
"cancel"),
"codes");
577 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteCodes");
579 $data = $this->
object->getSurveyCodesTableData(
$_POST[
"chb_code"]);
581 foreach ($data as $item)
588 $title = array($item[
"code"]);
589 $item[
"email"] ? $title[] = $item[
"email"] : null;
590 $item[
"last_name"] ? $title[] = $item[
"last_name"] : null;
591 $item[
"first_name"] ? $title[] = $item[
"first_name"] : null;
592 $title = implode(
", ", $title);
594 $cgui->addItem(
"chb_code[]", $item[
"code"], $title);
597 $this->tpl->setContent($cgui->getHTML());
602 $this->ctrl->redirect($this,
'codes');
611 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
613 foreach (
$_POST[
"chb_code"] as $survey_code)
615 $this->
object->deleteSurveyCode($survey_code);
623 $this->ctrl->redirect($this,
'codes');
631 if (is_array(
$_POST[
"chb_code"]) && (count(
$_POST[
"chb_code"]) > 0))
633 $export = $this->
object->getSurveyCodesForExport(null,
$_POST[
"chb_code"]);
639 $this->ctrl->redirect($this,
'codes');
648 $export = $this->
object->getSurveyCodesForExport();
657 $this->parent_gui->handleWriteAccess();
660 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
662 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
663 $form_import_file->setTableWidth(
"100%");
664 $form_import_file->setId(
"codes_import_file");
667 $headerfile->setTitle($this->lng->txt(
"svy_import_codes"));
668 $form_import_file->addItem($headerfile);
670 $export_file =
new ilFileInputGUI($this->lng->txt(
"codes"),
"codes");
671 $export_file->
setInfo(sprintf($this->lng->txt(
'svy_import_codes_info'),
672 $this->lng->txt(
"export_all_survey_codes")));
673 $export_file->setSuffixes(array(
"csv"));
674 $export_file->setRequired(
true);
675 $form_import_file->addItem($export_file);
677 $form_import_file->addCommandButton(
"importAccessCodesAction", $this->lng->txt(
"import"));
678 $form_import_file->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
680 $this->tpl->setContent($form_import_file->getHTML());
688 if(trim($_FILES[
'codes'][
'tmp_name']))
691 foreach($this->object->getSurveyCodesTableData() as $item)
693 $existing[$item[
"code"]] = $item[
"id"];
696 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
698 $reader->open($_FILES[
'codes'][
'tmp_name']);
699 foreach(
$reader->getDataArrayFromCSVFile() as
$row)
701 if(
sizeof(
$row) == 8)
704 list($code, $email, $last_name, $first_name, $created, $used, $sent, $url) =
$row;
707 if(!array_key_exists($code, $existing))
710 if(strlen($created) == 10)
722 ,
"lastname" => $last_name
723 ,
"firstname" => $first_name
725 $this->
object->importSurveyCode($code, $created, $user_data);
733 $this->ctrl->redirect($this,
'codes');
741 if (is_numeric(
$_POST[
"nrOfCodes"]))
743 $ids = $this->
object->createSurveyCodes(
$_POST[
"nrOfCodes"]);
745 $this->ctrl->setParameter($this,
"new_ids", implode(
";", $ids));
746 $this->ctrl->redirect($this,
'editCodes');
751 $this->ctrl->redirect($this,
'codes');
757 $this->parent_gui->handleWriteAccess();
760 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
762 $form_gui->setValuesByPost();
765 if ($form_gui->getSavedMessages()->getValue() > 0)
768 $settings = $this->
object->getUserSettings($ilUser->getId(),
'savemessage');
769 $form_gui->getMailMessage()->setValue($settings[$form_gui->getSavedMessages()->getValue()][
'value']);
780 $ilLog->write(
'Error: ' + $e->getMessage());
782 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
787 $this->parent_gui->handleWriteAccess();
790 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
792 $form_gui->setValuesByPost();
795 if ($form_gui->getSavedMessages()->getValue() > 0)
797 $this->
object->deleteUserSettings($form_gui->getSavedMessages()->getValue());
799 $form_gui->setValuesByPost();
810 $ilLog->write(
'Error: ' + $e->getMessage());
812 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
817 $this->parent_gui->handleWriteAccess();
820 $mailData[
'm_subject'] = (array_key_exists(
'm_subject',
$_POST)) ?
$_POST[
'm_subject'] : sprintf($this->lng->txt(
'default_codes_mail_subject'), $this->
object->getTitle());
821 $mailData[
'm_message'] = (array_key_exists(
'm_message',
$_POST)) ?
$_POST[
'm_message'] : $this->lng->txt(
'default_codes_mail_message');
822 $mailData[
'm_notsent'] = (array_key_exists(
'm_notsent',
$_POST)) ?
$_POST[
'm_notsent'] :
'1';
824 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
826 $form_gui->setValuesByArray($mailData);
827 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
834 $this->parent_gui->handleWriteAccess();
837 include_once(
"./Modules/Survey/classes/forms/FormMailCodesGUI.php");
839 if ($form_gui->checkInput())
841 $code_exists = strpos(
$_POST[
'm_message'],
'[code]') !== FALSE;
845 $form_gui->setValuesByPost();
849 if (
$_POST[
'savemessage'] == 1)
852 $title = (strlen(
$_POST[
'savemessagetitle'])) ?
$_POST[
'savemessagetitle'] : ilStr::substr(
$_POST[
'm_message'], 0, 40) .
'...';
853 $this->
object->saveUserSettings($ilUser->getId(),
'savemessage', $title,
$_POST[
'm_message']);
856 $lang = $ilUser->getPref(
"survey_code_language");
859 $lang = $this->lng->getDefaultLanguage();
863 $this->ctrl->redirect($this,
'mailCodes');
868 $form_gui->setValuesByPost();
870 $this->tpl->setVariable(
"ADM_CONTENT", $form_gui->getHTML());
875 if (trim(
$_POST[
'externaltext']))
877 $data = preg_split(
"/[\n\r]/",
$_POST[
'externaltext']);
878 $fields = preg_split(
"/;/", array_shift($data));
879 if (!in_array(
'email', $fields))
883 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
885 $existingdata = $this->
object->getExternalCodeRecipients();
886 $existingcolumns = array();
887 if (count($existingdata))
889 $first = array_shift($existingdata);
890 foreach ($first as $key => $value)
892 array_push($existingcolumns, $key);
895 $founddata = array();
896 foreach ($data as $datarow)
898 $row = preg_split(
"/;/", $datarow);
899 if (count(
$row) == count($fields))
902 foreach ($fields as $idx => $fieldname)
904 if (count($existingcolumns))
906 if (array_key_exists($idx, $existingcolumns))
908 $dataset[$fieldname] =
$row[$idx];
913 $dataset[$fieldname] =
$row[$idx];
916 if (strlen($dataset[
'email']))
918 array_push($founddata, $dataset);
922 $this->
object->createSurveyCodesForExternalData($founddata);
924 $this->ctrl->redirect($this,
'codes');
927 $this->ctrl->redirect($this,
'importExternalMailRecipientsFromTextForm');
931 protected function _convertCharset($a_string, $a_from_charset=
"", $a_to_charset=
"UTF-8")
933 if(extension_loaded(
"mbstring"))
937 mb_detect_order(
"UTF-8, ISO-8859-1, Windows-1252, ASCII");
938 $a_from_charset = mb_detect_encoding($a_string);
940 if(strtoupper($a_from_charset) != $a_to_charset)
942 return @mb_convert_encoding($a_string, $a_to_charset, $a_from_charset);
950 $bom = pack(
'H*',
'EFBBBF');
951 return preg_replace(
'/^'.$bom.
'/',
'', $a_text);
956 if (trim($_FILES[
'externalmails'][
'tmp_name']))
958 include_once
"./Services/Utilities/classes/class.ilCSVReader.php";
960 $reader->open($_FILES[
'externalmails'][
'tmp_name']);
961 $data =
$reader->getDataArrayFromCSVFile();
962 $fields = array_shift($data);
963 foreach($fields as $idx => $field)
967 if (!in_array(
'email', $fields))
971 $this->ctrl->redirect($this,
'codes');
973 $existingdata = $this->
object->getExternalCodeRecipients();
974 $existingcolumns = array();
975 if (count($existingdata))
977 $first = array_shift($existingdata);
978 foreach ($first as $key => $value)
980 array_push($existingcolumns, $key);
984 include_once
"Services/Utilities/classes/class.ilStr.php";
986 $founddata = array();
987 foreach ($data as
$row)
989 if (count($row) == count($fields))
992 foreach ($fields as $idx => $fieldname)
997 if (count($existingcolumns))
999 if (array_key_exists($idx, $existingcolumns))
1001 $dataset[$fieldname] = $row[$idx];
1006 $dataset[$fieldname] = $row[$idx];
1009 if (strlen($dataset[
'email']))
1011 array_push($founddata, $dataset);
1017 if(
sizeof($founddata))
1019 $this->
object->createSurveyCodesForExternalData($founddata);
1024 $this->ctrl->redirect($this,
'codes');
1031 $this->parent_gui->handleWriteAccess();
1034 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1036 $form_import_file->setFormAction($this->ctrl->getFormAction($this));
1037 $form_import_file->setTableWidth(
"100%");
1038 $form_import_file->setId(
"codes_import_file");
1041 $headerfile->setTitle($this->lng->txt(
"import_from_file"));
1042 $form_import_file->addItem($headerfile);
1044 $externalmails =
new ilFileInputGUI($this->lng->txt(
"externalmails"),
"externalmails");
1045 $externalmails->
setInfo($this->lng->txt(
'externalmails_info'));
1046 $externalmails->setRequired(
true);
1047 $form_import_file->addItem($externalmails);
1048 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"importExternalRecipientsFromFile", $this->lng->txt(
"import"));
1049 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_file->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
1051 $this->tpl->setContent($form_import_file->getHTML());
1058 $this->parent_gui->handleWriteAccess();
1061 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1063 $form_import_text->setFormAction($this->ctrl->getFormAction($this));
1064 $form_import_text->setTableWidth(
"100%");
1065 $form_import_text->setId(
"codes_import_text");
1068 $headertext->setTitle($this->lng->txt(
"import_from_text"));
1069 $form_import_text->addItem($headertext);
1072 if (array_key_exists(
'externaltext',
$_SESSION) && strlen(
$_SESSION[
'externaltext']))
1079 $inp->setValue(
"email;firstname;lastname\n" . $this->lng->txt(
'mail_import_example2') .
"\n" . $this->lng->txt(
'mail_import_example3') .
"\n");
1081 $inp->setRequired(
true);
1084 $inp->setInfo($this->lng->txt(
'externaltext_info'));
1085 $form_import_text->addItem($inp);
1088 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"importExternalRecipientsFromText", $this->lng->txt(
"import"));
1089 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) $form_import_text->addCommandButton(
"codes", $this->lng->txt(
"cancel"));
1091 $this->tpl->setContent($form_import_text->getHTML());
1114 $this->parent_gui->handleWriteAccess();
1116 $this->ctrl->setParameter($this,
"appr360", 1);
1118 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1123 'auto_complete_name' => $this->lng->txt(
'user'),
1124 'submit_name' => $this->lng->txt(
'add'),
1125 'add_search' =>
true,
1131 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
1133 if ($this->object->get360SkillService() && $skmg_set->isActivated())
1135 $ilToolbar->addSeparator();
1136 $ilToolbar->addButton($lng->txt(
"survey_calc_skills"),
1137 $ilCtrl->getLinkTargetByClass(
"ilsurveyskilldeterminationgui"),
"");
1141 $this->ctrl->setParameter($this,
"appr360",
"");
1143 include_once
"Modules/Survey/classes/tables/class.ilSurveyAppraiseesTableGUI.php";
1145 $tbl->setData($this->object->getAppraiseesData());
1146 $this->tpl->setContent($tbl->getHTML());
1151 if(
sizeof($a_user_ids))
1154 foreach(array_unique($a_user_ids) as $user_id)
1156 $this->
object->addAppraisee($user_id);
1161 $this->ctrl->redirect($this,
"listAppraisees");
1168 if(!
sizeof(
$_POST[
"appr_id"]))
1171 $this->ctrl->redirect($this,
"listAppraisees");
1174 $ilTabs->clearTargets();
1175 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1176 $this->ctrl->getLinkTarget($this,
"listAppraisees"));
1178 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1180 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_delete_appraises"));
1182 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteAppraisees"));
1183 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1184 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteAppraisees");
1186 $data = $this->
object->getAppraiseesData();
1189 include_once
"Services/User/classes/class.ilUserUtil.php";
1190 foreach (
$_POST[
"appr_id"] as $id)
1192 if(isset($data[$id]) && !$data[$id][
"closed"])
1202 $this->ctrl->redirect($this,
"listAppraisees");
1205 $this->tpl->setContent($cgui->getHTML());
1210 if(
sizeof(
$_POST[
"appr_id"]))
1212 $data = $this->
object->getAppraiseesData();
1214 foreach (
$_POST[
"appr_id"] as $id)
1217 if(isset($data[$id]) && !$data[$id][
"closed"])
1219 $this->
object->deleteAppraisee($id);
1226 $this->ctrl->redirect($this,
"listAppraisees");
1233 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
1238 $this->ctrl->redirect($this,
"listAppraisees");
1242 else if($this->object->get360Mode() &&
1243 $this->
object->get360SelfRaters() &&
1244 $this->
object->isAppraisee($ilUser->getId()) &&
1245 !$this->object->isAppraiseeClosed($ilUser->getId()))
1247 return $ilUser->getId();
1249 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1254 global $ilTabs, $ilToolbar, $ilAccess;
1258 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1261 $ilTabs->clearTargets();
1262 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1263 $this->ctrl->getLinkTarget($this,
"listAppraisees"));
1266 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1267 $this->ctrl->setParameter($this,
"rate360", 1);
1269 include_once
'./Services/Search/classes/class.ilRepositorySearchGUI.php';
1274 'auto_complete_name' => $this->lng->txt(
'user'),
1275 'submit_name' => $this->lng->txt(
'add'),
1276 'add_search' =>
true,
1281 $this->ctrl->setParameter($this,
"rate360",
"");
1283 $ilToolbar->addSeparator();
1285 $ilToolbar->addButton($this->lng->txt(
"survey_360_add_external_rater"),
1286 $this->ctrl->getLinkTarget($this,
"addExternalRaterForm"));
1289 require_once
"Services/Link/classes/class.ilLink.php";
1292 include_once
"Modules/Survey/classes/tables/class.ilSurveyAppraiseesTableGUI.php";
1294 $tbl->
setData($this->object->getRatersData($appr_id));
1295 $this->tpl->setContent($tbl->getHTML());
1300 global $ilTabs, $ilAccess;
1303 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1305 $has_write = $ilAccess->checkAccess(
"write",
"", $this->ref_id);
1308 $ilTabs->clearTargets();
1309 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1310 $this->ctrl->getLinkTarget($this,
"editRaters"));
1318 $this->tpl->setContent($a_form->getHTML());
1323 include_once
"Services/User/classes/class.ilUserUtil.php";
1324 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1326 $form->setFormAction($this->ctrl->getFormAction($this,
"addExternalRater"));
1327 $form->setTitle($this->lng->txt(
"survey_360_add_external_rater").
1328 ": ".ilUserUtil::getNamePresentation($appr_id));
1330 $email =
new ilEmailInputGUI($this->lng->txt(
"email"),
"email");
1331 $email->setRequired(
true);
1332 $form->addItem($email);
1334 $lname =
new ilTextInputGUI($this->lng->txt(
"lastname"),
"lname");
1336 $form->addItem($lname);
1338 $fname =
new ilTextInputGUI($this->lng->txt(
"firstname"),
"fname");
1340 $form->addItem($fname);
1342 $form->addCommandButton(
"addExternalRater", $this->lng->txt(
"save"));
1343 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1353 $this->ctrl->redirect($this,
"listAppraisees");
1356 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1359 if($form->checkInput())
1362 "email" => $form->getInput(
"email"),
1363 "lastname" => $form->getInput(
"lname"),
1364 "firstname" => $form->getInput(
"fname")
1366 $anonymous_id = $this->
object->createSurveyCodesForExternalData(array($data));
1367 $anonymous_id = array_pop($anonymous_id);
1369 $this->
object->addRater($appr_id, 0, $anonymous_id);
1372 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1373 $this->ctrl->redirect($this,
"editRaters");
1376 $form->setValuesByPost();
1386 if(
sizeof($a_user_ids))
1389 foreach(array_unique($a_user_ids) as $user_id)
1391 if($ilAccess->checkAccess(
"write",
"", $this->ref_id) ||
1392 $this->
object->get360SelfEvaluation() ||
1393 $user_id != $ilUser->getId())
1395 $this->
object->addRater($appr_id, $user_id);
1402 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1403 $this->ctrl->redirect($this,
"editRaters");
1411 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1412 if(!
sizeof(
$_POST[
"rtr_id"]))
1415 $this->ctrl->redirect($this,
"editRaters");
1418 $ilTabs->clearTargets();
1419 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1420 $this->ctrl->getLinkTarget($this,
"editRaters"));
1422 include_once
"Services/User/classes/class.ilUserUtil.php";
1423 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1425 $cgui->setHeaderText(sprintf($this->lng->txt(
"survey_360_sure_delete_raters"),
1428 $cgui->setFormAction($this->ctrl->getFormAction($this,
"deleteRaters"));
1429 $cgui->setCancel($this->lng->txt(
"cancel"),
"editRaters");
1430 $cgui->setConfirm($this->lng->txt(
"confirm"),
"deleteRaters");
1432 $data = $this->
object->getRatersData($appr_id);
1434 foreach (
$_POST[
"rtr_id"] as $id)
1436 if(isset($data[$id]))
1438 $cgui->addItem(
"rtr_id[]", $id, $data[$id][
"lastname"].
", ".
1439 $data[$id][
"firstname"].
" (".$data[$id][
"email"].
")");
1443 $this->tpl->setContent($cgui->getHTML());
1449 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1451 if(
sizeof(
$_POST[
"rtr_id"]))
1453 $data = $this->
object->getRatersData($appr_id);
1455 foreach (
$_POST[
"rtr_id"] as $id)
1457 if(isset($data[$id]))
1459 if(substr($id, 0, 1) ==
"u")
1461 $this->
object->deleteRater($appr_id, substr($id, 1));
1465 $this->
object->deleteRater($appr_id, 0, substr($id, 1));
1473 $this->ctrl->redirect($this,
"editRaters");
1480 if($this->object->get360SelfAppraisee() &&
1481 !$this->
object->isAppraisee($ilUser->getId()))
1483 $this->
object->addAppraisee($ilUser->getId());
1486 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1491 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
1493 $form->setFormAction($this->ctrl->getFormAction($this,
"mailRatersAction"));
1494 $form->setTitle($this->lng->txt(
'compose'));
1496 $all_data = $this->
object->getRatersData($appr_id);
1497 $rec_data = array();
1498 foreach($rec_ids as $rec_id)
1500 if(isset($all_data[$rec_id]))
1502 $rec_data[] = $all_data[$rec_id][
"lastname"].
", ".
1503 $all_data[$rec_id][
"firstname"].
1504 " (".$all_data[$rec_id][
"email"].
")";
1509 $rec->setHTML(implode(
"<br />", $rec_data));
1510 $form->addItem($rec);
1512 $subject =
new ilTextInputGUI($this->lng->txt(
'subject'),
'subject');
1514 $subject->setRequired(
true);
1515 $form->addItem($subject);
1517 $existingdata = $this->
object->getExternalCodeRecipients();
1518 $existingcolumns = array();
1519 if (count($existingdata))
1521 $first = array_shift($existingdata);
1522 foreach ($first as $key => $value)
1524 if (strcmp($key,
'code') != 0 && strcmp($key,
'email') != 0 && strcmp($key,
'sent') != 0) array_push($existingcolumns,
'[' . $key .
']');
1528 $mailmessage_u =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_registered'),
'message_u');
1530 $mailmessage_u->setCols(80);
1531 $mailmessage_u->setRows(10);
1532 $form->addItem($mailmessage_u);
1534 $mailmessage_a =
new ilTextAreaInputGUI($this->lng->txt(
'survey_360_rater_message_content_anonymous'),
'message_a');
1536 $mailmessage_a->setCols(80);
1537 $mailmessage_a->setRows(10);
1538 $mailmessage_a->setInfo(sprintf($this->lng->txt(
'message_content_info'), join($existingcolumns,
', ')));
1539 $form->addItem($mailmessage_a);
1542 $recf->setValue(implode(
";", $rec_ids));
1543 $form->addItem($recf);
1545 $form->addCommandButton(
"mailRatersAction", $this->lng->txt(
"send"));
1546 $form->addCommandButton(
"editRaters", $this->lng->txt(
"cancel"));
1548 $subject->setValue(sprintf($this->lng->txt(
'survey_360_rater_subject_default'), $this->
object->getTitle()));
1549 $mailmessage_u->setValue($this->lng->txt(
'survey_360_rater_message_content_registered_default'));
1550 $mailmessage_a->setValue($this->lng->txt(
'survey_360_rater_message_content_anonymous_default'));
1562 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1564 if(!
sizeof(
$_POST[
"rtr_id"]))
1567 $this->ctrl->redirect($this,
"editRaters");
1573 $ilTabs->clearTargets();
1574 $ilTabs->setBackTarget($this->lng->txt(
"btn_back"),
1575 $this->ctrl->getLinkTarget($this,
"editRaters"));
1577 $this->tpl->setContent($a_form->getHTML());
1585 $this->ctrl->setParameter($this,
"appr_id", $appr_id);
1587 $rec_ids = explode(
";",
$_POST[
"rtr_id"]);
1588 if(!
sizeof($rec_ids))
1590 $this->ctrl->redirect($this,
"editRaters");
1594 if($form->checkInput())
1596 $txt_u = $form->getInput(
"message_u");
1597 $txt_a = $form->getInput(
"message_a");
1598 $subj = $form->getInput(
"subject");
1601 $sender_id = (trim($ilUser->getEmail()))
1603 : ANONYMOUS_USER_ID;
1605 include_once
"./Services/Mail/classes/class.ilMail.php";
1607 $all_data = $this->
object->getRatersData($appr_id);
1608 foreach($rec_ids as $rec_id)
1610 if(isset($all_data[$rec_id]))
1613 $user = $all_data[$rec_id];
1616 if(substr($rec_id, 0, 1) ==
"a")
1619 $url = $user[
"href"];
1620 $rcp = $user[
"email"];
1626 $user[
"code"] = $this->lng->txt(
"survey_code_mail_on_demand");
1628 $rcp = $user[
"login"];
1631 $mytxt = str_replace(
"[lastname]", $user[
"lastname"], $mytxt);
1632 $mytxt = str_replace(
"[firstname]", $user[
"firstname"], $mytxt);
1633 $mytxt = str_replace(
"[url]", $url, $mytxt);
1634 $mytxt = str_replace(
"[code]", $user[
"code"], $mytxt);
1636 $mail =
new ilMail($sender_id);
1647 $this->
object->set360RaterSent($appr_id,
1648 (substr($rec_id, 0, 1) ==
"a") ? 0 : (
int)substr($rec_id, 1),
1649 (substr($rec_id, 0, 1) ==
"u") ? 0 : (
int)substr($rec_id, 1));
1654 $this->ctrl->redirect($this,
"editRaters");
1657 $form->setValuesByPost();
1665 $ilTabs->clearTargets();
1666 $ilTabs->setBackTarget($this->lng->txt(
"menuback"),
1667 $this->ctrl->getLinkTarget($this->parent_gui,
"infoScreen"));
1669 if(!$this->object->isAppraisee($ilUser->getId()))
1671 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1674 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1676 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close"));
1678 $cgui->setFormAction($this->ctrl->getFormAction($this,
"appraiseeClose"));
1679 $cgui->setCancel($this->lng->txt(
"cancel"),
"confirmAppraiseeCloseCancel");
1680 $cgui->setConfirm($this->lng->txt(
"confirm"),
"appraiseeClose");
1682 $tpl->setContent($cgui->getHTML());
1687 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1694 if(!$this->object->isAppraisee($ilUser->getId()))
1696 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1699 $this->
object->closeAppraisee($ilUser->getId());
1701 $this->ctrl->redirect($this->parent_gui,
"infoScreen");
1708 $this->parent_gui->handleWriteAccess();
1710 $appr_ids =
$_POST[
"appr_id"];
1712 if(!
sizeof($appr_ids))
1715 $this->ctrl->redirect($this,
"listAppraisees");
1718 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1720 $cgui->setHeaderText($this->lng->txt(
"survey_360_sure_appraisee_close_admin"));
1722 $cgui->setFormAction($this->ctrl->getFormAction($this,
"adminAppraiseesClose"));
1723 $cgui->setCancel($this->lng->txt(
"cancel"),
"listAppraisees");
1724 $cgui->setConfirm($this->lng->txt(
"confirm"),
"adminAppraiseesClose");
1726 include_once
"Services/User/classes/class.ilUserUtil.php";
1727 foreach($appr_ids as $appr_id)
1732 $tpl->setContent($cgui->getHTML());
1737 $this->parent_gui->handleWriteAccess();
1739 $appr_ids =
$_POST[
"appr_id"];
1741 if(!
sizeof($appr_ids))
1744 $this->ctrl->redirect($this,
"listAppraisees");
1747 $appr_data = $this->
object->getAppraiseesData();
1748 foreach($appr_ids as $appr_id)
1750 if(isset($appr_data[$appr_id]) && !$appr_data[$appr_id][
"closed"])
1752 $this->
object->closeAppraisee($appr_id);
1756 ilUtil::sendSuccess($this->lng->txt(
"survey_360_appraisee_close_action_success_admin"),
true);
1757 $this->ctrl->redirect($this,
"listAppraisees");