145 bool $a_call_by_reference =
true
149 $this->survey_service =
$DIC->survey()->internal();
151 $this->
user = $DIC->user();
152 $this->
lng = $DIC->language();
153 $this->db =
$DIC->database();
154 $this->
access = $DIC->access();
155 $this->plugin_admin =
$DIC[
"ilPluginAdmin"];
156 $this->tree =
$DIC->repositoryTree();
161 $this->survey_id = -1;
162 $this->introduction =
"";
163 $this->outro =
$lng->
txt(
"survey_finished");
164 $this->author =
$ilUser->getFullname();
166 $this->questions = array();
169 $this->surveyCodeSecurity =
true;
170 $this->pool_usage =
true;
174 $this->invitation_manager = $this
180 $this->import_manager =
$DIC->surveyQuestionPool()
193 $this->code_manager = $this
196 ->code($this, $this->
user->getId());
198 $this->feature_config = $this
201 ->modeFeatureConfig($this->
getMode());
203 $this->data_manager = $this
210 $id = parent::create();
224 public function update($a_upload =
false): bool
230 if (!parent::update()) {
241 $result = parent::createReference();
258 $this->questions[] = $question_id;
261 public function delete():
bool
263 $this->svy_log->debug(
"Deleting Survey, ref id: " . $this->
getRefId() .
", obj id: " .
270 foreach ($this->questions as $question_id) {
271 $this->svy_log->debug(
"Remove question " . $question_id);
279 $this->svy_log->debug(
"Call parent delete.");
280 $remove = parent::delete();
298 "DELETE FROM svy_svy WHERE survey_id = %s",
303 $result =
$ilDB->queryF(
304 "SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
308 $questionblocks = array();
309 while ($row =
$ilDB->fetchAssoc($result)) {
310 $questionblocks[] = $row[
"questionblock_fi"];
312 if (count($questionblocks)) {
313 $affectedRows =
$ilDB->manipulate(
"DELETE FROM svy_qblk WHERE " .
$ilDB->in(
'questionblock_id', $questionblocks,
false,
'integer'));
316 "DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
322 $this->code_manager->deleteAll(
true);
326 $directory = $svy_data_dir .
"/svy_" . $this->
getId();
327 if (is_dir($directory)) {
336 foreach (
$mobs as $mob) {
349 bool $reset_LP =
true
353 $result =
$ilDB->queryF(
354 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
358 $active_array = array();
359 while ($row =
$ilDB->fetchAssoc($result)) {
360 $active_array[] = $row[
"finished_id"];
363 $affectedRows =
$ilDB->manipulateF(
364 "DELETE FROM svy_finished WHERE survey_fi = %s",
369 foreach ($active_array as $active_fi) {
370 $affectedRows =
$ilDB->manipulateF(
371 "DELETE FROM svy_answer WHERE active_fi = %s",
375 $affectedRows =
$ilDB->manipulateF(
376 "DELETE FROM svy_times WHERE finished_fi = %s",
384 $lp_obj->resetLPDataForCompleteObject();
387 $this->invitation_manager->removeAll($this->
getSurveyId());
401 foreach ($finished_ids as $finished_id) {
402 $result =
$ilDB->queryF(
403 "SELECT finished_id, user_fi FROM svy_finished WHERE finished_id = %s",
407 $row =
$ilDB->fetchAssoc($result);
408 if ($row[
"user_fi"]) {
409 $user_ids[] = (
int) $row[
"user_fi"];
412 $affectedRows =
$ilDB->manipulateF(
413 "DELETE FROM svy_answer WHERE active_fi = %s",
415 array($row[
"finished_id"])
418 $affectedRows =
$ilDB->manipulateF(
419 "DELETE FROM svy_finished WHERE finished_id = %s",
424 $affectedRows =
$ilDB->manipulateF(
425 "DELETE FROM svy_times WHERE finished_fi = %s",
427 array($row[
"finished_id"])
431 if (count($user_ids)) {
433 $lp_obj->resetLPDataForUserIds($user_ids);
436 foreach ($user_ids as $user_id) {
437 $this->invitation_manager->remove($this->getSurveyId(), $user_id);
446 ?array $finished_ids =
null,
447 bool $force_non_anonymous =
false,
448 bool $include_invites =
false
451 $sql =
"SELECT * FROM svy_finished" .
452 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer");
454 $sql .=
" AND " .
$ilDB->in(
"finished_id", $finished_ids,
"",
"integer");
457 $result =
$ilDB->query($sql);
458 $participants = array();
459 if ($result->numRows() > 0) {
460 while ($row =
$ilDB->fetchAssoc($result)) {
461 $userdata = $this->getUserDataFromActiveId($row[
"finished_id"], $force_non_anonymous);
462 $userdata[
"finished"] = (bool) $row[
"state"];
463 $userdata[
"finished_tstamp"] = $row[
"tstamp"];
464 $participants[$userdata[
"sortname"] . $userdata[
"active_id"]] = $userdata;
467 $participant_ids = array_column($participants,
"usr_id");
468 if ($include_invites) {
469 foreach ($this->invitation_manager->getAllForSurvey($this->getSurveyId()) as $usr_id) {
470 if (!in_array($usr_id, $participant_ids)) {
472 $participants[
$name[
"lastname"] .
"," .
$name[
"firstname"] . $usr_id] = [
474 "sortname" =>
$name[
"lastname"] .
"," .
$name[
"firstname"],
475 "fistname" =>
$name[
"firstname"],
476 "lastname" =>
$name[
"lastname"],
477 "login" =>
$name[
"login"],
481 "finished_tstamp" => 0,
487 return $participants;
496 return ($this->getTitle() && count($this->questions));
506 if ($this->getSurveyId() > 0) {
508 "UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
509 array(
'text',
'integer',
'integer'),
510 array($this->isComplete(), time(), $this->getSurveyId())
521 bool $a_force =
false
523 $questiontype = $this->getQuestionType($question_id);
524 $question_gui = $this->getQuestionGUI($questiontype, $question_id);
527 if ($this->
getId() === $question_gui->object->getObjId() && !$a_force) {
531 $duplicate_id = $question_gui->object->duplicate(
true,
"",
"", 0, $this->
getId());
532 return $duplicate_id;
544 $this->svy_log->debug(
"insert question, id:" . $question_id);
547 $this->svy_log->debug(
"question is not complete");
551 $result =
$ilDB->queryF(
552 "SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
554 array($this->getSurveyId())
556 $sequence = $result->numRows();
557 $duplicate_id = $this->duplicateQuestionForSurvey($question_id);
558 $this->svy_log->debug(
"duplicate, id: " . $question_id .
", duplicate id: " . $duplicate_id);
561 if ($this->isQuestionInSurvey($duplicate_id)) {
565 $next_id =
$ilDB->nextId(
'svy_svy_qst');
566 $affectedRows =
$ilDB->manipulateF(
567 "INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
568 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
569 array($next_id, $this->getSurveyId(), $duplicate_id, $sequence, time())
572 $this->svy_log->debug(
"added entry to svy_svy_qst, id: " . $next_id .
", question id: " . $duplicate_id .
", sequence: " . $sequence);
574 $this->loadQuestionsFromDb();
575 $this->saveCompletionStatus();
588 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst " .
589 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
590 " AND question_fi = " .
$ilDB->quote($a_question_fi,
"integer"));
591 if ($rec =
$ilDB->fetchAssoc($set)) {
599 int $questionblock_id
602 $sequence_manager = $this->survey_service->domain()->sequence(
603 $this->getSurveyId(),
609 $result =
$ilDB->queryF(
610 "SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle," .
611 " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst" .
612 " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi" .
613 " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi" .
614 " AND svy_qblk.questionblock_id = %s" .
615 " ORDER BY svy_svy_qst.sequence",
617 array($questionblock_id)
619 $questions = array();
620 $show_questiontext =
false;
621 $show_blocktitle =
false;
623 $this->svy_log->debug(
"insert block, original id: " . $questionblock_id);
624 while ($row =
$ilDB->fetchAssoc($result)) {
625 $this->svy_log->debug(
"question: " . $row[
"question_fi"]);
626 $duplicate_id = $sequence_manager->appendQuestion($row[
"question_fi"],
true);
628 $this->svy_log->debug(
"question copy: " . $duplicate_id);
629 $questions[] = $duplicate_id;
630 $title = (string) $row[
"title"];
631 $this->svy_log->debug(
"title: " . $title);
632 $show_questiontext = (bool) $row[
"show_questiontext"];
633 $show_blocktitle = (bool) $row[
"show_blocktitle"];
635 $this->createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions);
647 $next_id =
$ilDB->nextId(
'svy_settings');
648 $affectedRows =
$ilDB->insert(
"svy_settings", array(
649 "settings_id" => array(
"integer", $next_id),
650 "usr_id" => array(
"integer", $usr_id),
651 "keyword" => array(
"text",
$key),
652 "title" => array(
"text", $title),
653 "value" => array(
"clob", $value)
663 "DELETE FROM svy_settings WHERE settings_id = %s",
675 $result =
$ilDB->queryF(
676 "SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
677 array(
'integer',
'text'),
681 if ($result->numRows()) {
682 while ($row =
$ilDB->fetchAssoc($result)) {
683 $found[$row[
'settings_id']] = $row;
695 $rmd_start = $this->getReminderStart();
696 if (is_object($rmd_start)) {
699 $rmd_end = $this->getReminderEnd();
700 if (is_object($rmd_end)) {
703 if ($this->getSurveyId() < 1) {
704 $next_id =
$ilDB->nextId(
'svy_svy');
705 $affectedRows =
$ilDB->insert(
"svy_svy", array(
706 "survey_id" => array(
"integer", $next_id),
707 "obj_fi" => array(
"integer", $this->
getId()),
708 "author" => array(
"text", $this->getAuthor()),
711 "startdate" => array(
"text", $this->getStartDate()),
712 "enddate" => array(
"text", $this->getEndDate()),
713 "evaluation_access" => array(
"text", $this->getEvaluationAccess()),
714 "complete" => array(
"text", $this->isComplete()),
715 "created" => array(
"integer", time()),
716 "anonymize" => array(
"text", $this->getAnonymize()),
717 "show_question_titles" => array(
"text", $this->getShowQuestionTitles()),
718 "mailnotification" => array(
'integer', ($this->getMailNotification()) ? 1 : 0),
719 "mailaddresses" => array(
'text', $this->getMailAddresses()),
720 "mailparticipantdata" => array(
'text', $this->getMailParticipantData()),
721 "tstamp" => array(
"integer", time()),
722 "pool_usage" => array(
"integer", $this->getPoolUsage()),
724 "mode" => array(
"integer", $this->getMode()),
726 "mode_360_self_eval" => array(
"integer", $this->get360SelfEvaluation()),
727 "mode_360_self_rate" => array(
"integer", $this->get360SelfRaters()),
728 "mode_360_self_appr" => array(
"integer", $this->get360SelfAppraisee()),
729 "mode_360_results" => array(
"integer", $this->get360Results()),
731 "mode_skill_service" => array(
"integer", (
int) $this->getSkillService()),
733 "mode_self_eval_results" => array(
"integer", self::RESULTS_SELF_EVAL_OWN),
735 "reminder_status" => array(
"integer", (
int) $this->getReminderStatus()),
736 "reminder_start" => array(
"datetime", $rmd_start),
737 "reminder_end" => array(
"datetime", $rmd_end),
738 "reminder_frequency" => array(
"integer", $this->getReminderFrequency()),
739 "reminder_target" => array(
"integer", $this->getReminderTarget()),
740 "reminder_last_sent" => array(
"datetime", $this->getReminderLastSent()),
741 "reminder_tmpl" => array(
"text", $this->getReminderTemplate(
true)),
742 "tutor_ntf_status" => array(
"integer", (
int) $this->getTutorNotificationStatus()),
743 "tutor_ntf_reci" => array(
"text", implode(
";", $this->getTutorNotificationRecipients())),
744 "tutor_ntf_target" => array(
"integer", $this->getTutorNotificationTarget()),
745 "own_results_view" => array(
"integer", $this->hasViewOwnResults()),
746 "own_results_mail" => array(
"integer", $this->hasMailOwnResults()),
747 "tutor_res_status" => array(
"integer", (
int) $this->getTutorResultsStatus()),
748 "tutor_res_reci" => array(
"text", implode(
";", $this->getTutorResultsRecipients())),
749 "confirmation_mail" => array(
"integer", $this->hasMailConfirmation()),
750 "anon_user_list" => array(
"integer", $this->hasAnonymousUserList()),
751 "calculate_sum_score" => array(
"integer", $this->getCalculateSumScore())
753 $this->setSurveyId($next_id);
755 $affectedRows =
$ilDB->update(
"svy_svy", array(
756 "author" => array(
"text", $this->getAuthor()),
759 "startdate" => array(
"text", $this->getStartDate()),
760 "enddate" => array(
"text", $this->getEndDate()),
761 "evaluation_access" => array(
"text", $this->getEvaluationAccess()),
762 "complete" => array(
"text", $this->isComplete()),
763 "anonymize" => array(
"text", $this->getAnonymize()),
764 "show_question_titles" => array(
"text", $this->getShowQuestionTitles()),
765 "mailnotification" => array(
'integer', ($this->getMailNotification()) ? 1 : 0),
766 "mailaddresses" => array(
'text', $this->getMailAddresses()),
767 "mailparticipantdata" => array(
'text', $this->getMailParticipantData()),
768 "tstamp" => array(
"integer", time()),
769 "pool_usage" => array(
"integer", $this->getPoolUsage()),
771 "mode" => array(
"integer", $this->getMode()),
773 "mode_360_self_eval" => array(
"integer", $this->get360SelfEvaluation()),
774 "mode_360_self_rate" => array(
"integer", $this->get360SelfRaters()),
775 "mode_360_self_appr" => array(
"integer", $this->get360SelfAppraisee()),
776 "mode_360_results" => array(
"integer", $this->get360Results()),
778 "mode_skill_service" => array(
"integer", (
int) $this->getSkillService()),
780 "mode_self_eval_results" => array(
"integer", $this->getSelfEvaluationResults()),
782 "reminder_status" => array(
"integer", $this->getReminderStatus()),
783 "reminder_start" => array(
"datetime", $rmd_start),
784 "reminder_end" => array(
"datetime", $rmd_end),
785 "reminder_frequency" => array(
"integer", $this->getReminderFrequency()),
786 "reminder_target" => array(
"integer", $this->getReminderTarget()),
787 "reminder_last_sent" => array(
"datetime", $this->getReminderLastSent()),
788 "reminder_tmpl" => array(
"text", $this->getReminderTemplate()),
789 "tutor_ntf_status" => array(
"integer", $this->getTutorNotificationStatus()),
790 "tutor_ntf_reci" => array(
"text", implode(
";", $this->getTutorNotificationRecipients())),
791 "tutor_ntf_target" => array(
"integer", $this->getTutorNotificationTarget()),
792 "own_results_view" => array(
"integer", $this->hasViewOwnResults()),
793 "own_results_mail" => array(
"integer", $this->hasMailOwnResults()),
794 "tutor_res_status" => array(
"integer", (
int) $this->getTutorResultsStatus()),
795 "tutor_res_reci" => array(
"text", implode(
";", $this->getTutorResultsRecipients())),
796 "confirmation_mail" => array(
"integer", $this->hasMailConfirmation()),
797 "anon_user_list" => array(
"integer", $this->hasAnonymousUserList()),
798 "calculate_sum_score" => array(
"integer", $this->getCalculateSumScore())
800 "survey_id" => array(
"integer", $this->getSurveyId())
805 $this->saveQuestionsToDb();
813 if (!$this->isActivationLimited()) {
817 $item->setTimingStart($this->getActivationStartDate());
818 $item->setTimingEnd($this->getActivationEndDate());
819 $item->toggleVisible($this->getActivationVisibility());
822 $item->update($this->ref_id);
831 $this->svy_log->debug(
"save questions");
834 $old_questions = array();
835 $result =
$ilDB->queryF(
836 "SELECT survey_question_id,question_fi,sequence" .
837 " FROM svy_svy_qst WHERE survey_fi = %s",
839 array($this->getSurveyId())
841 while ($row =
$ilDB->fetchAssoc($result)) {
842 $old_questions[$row[
"question_fi"]] = $row;
846 $insert =
$update = $delete = array();
847 foreach ($this->questions as $seq => $fi) {
848 if (!array_key_exists($fi, $old_questions)) {
850 } elseif ($old_questions[$fi][
"sequence"] != $seq) {
851 $update[$fi] = $old_questions[$fi][
"survey_question_id"];
854 unset($old_questions[$fi]);
858 if (count($old_questions)) {
860 foreach ($old_questions as $fi => $old) {
861 $del_ids[] = $old[
"survey_question_id"];
863 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst" .
864 " WHERE " .
$ilDB->in(
"survey_question_id", $del_ids,
"",
"integer"));
865 $this->svy_log->debug(
"delete: " . $q);
867 unset($old_questions);
870 foreach ($this->questions as $seq => $fi) {
871 if (in_array($fi, $insert)) {
873 if (!$this->isQuestionInSurvey($fi)) {
874 $next_id =
$ilDB->nextId(
'svy_svy_qst');
876 "INSERT INTO svy_svy_qst" .
877 " (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp)" .
878 " VALUES (%s, %s, %s, %s, %s, %s)",
879 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer'),
880 array($next_id, $this->getSurveyId(), $fi,
null, $seq, time())
882 $this->svy_log->debug(
"insert svy_svy_qst, id:" . $next_id .
", fi: " . $fi .
", seq:" . $seq);
884 } elseif (array_key_exists($fi,
$update)) {
885 $ilDB->manipulate(
"UPDATE svy_svy_qst" .
886 " SET sequence = " .
$ilDB->quote($seq,
"integer") .
887 ", tstamp = " .
$ilDB->quote(time(),
"integer") .
888 " WHERE survey_question_id = " .
$ilDB->quote(
$update[$fi],
"integer"));
889 $this->svy_log->debug(
"update svy_svy_qst, id:" .
$update[$fi] .
", fi: " . $fi .
", seq:" . $seq);
896 string $questiontype,
907 if ($question_id < 1) {
910 $result =
$ilDB->queryF(
911 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
912 "svy_question.questiontype_fi = svy_qtype.questiontype_id",
916 if ($result->numRows() === 1) {
918 return $data[
"type_tag"];
926 return $this->survey_id;
934 switch ($a_anonymize) {
935 case self::ANONYMIZE_OFF:
936 case self::ANONYMIZE_ON:
937 case self::ANONYMIZE_FREEACCESS:
938 case self::ANONYMIZE_CODE_ALL:
939 $this->anonymize = $a_anonymize;
942 $this->anonymize = self::ANONYMIZE_OFF;
949 return $this->anonymize;
955 $this->calculate_sum_score = $a_val;
960 return $this->calculate_sum_score;
966 return ($this->getAnonymize() === self::ANONYMIZE_OFF ||
967 $this->getAnonymize() === self::ANONYMIZE_FREEACCESS);
973 return ($this->getAnonymize() === self::ANONYMIZE_ON ||
974 $this->getAnonymize() === self::ANONYMIZE_FREEACCESS);
980 $result =
$ilDB->queryF(
981 "SELECT * FROM svy_svy WHERE obj_fi = %s",
983 array($this->
getId())
985 if ($result->numRows() === 1) {
987 $this->setSurveyId(
$data[
"survey_id"]);
988 $this->setAuthor(
$data[
"author"] ??
"");
990 if (strcmp(
$data[
"outro"],
"survey_finished") === 0) {
991 $this->setOutro($this->
lng->txt(
"survey_finished"));
995 $this->setShowQuestionTitles((
bool)
$data[
"show_question_titles"]);
996 $this->setStartDate((
string) (
$data[
"startdate"] ??
""));
997 $this->setEndDate((
string) (
$data[
"enddate"] ??
""));
998 $this->setAnonymize((
int)
$data[
"anonymize"]);
999 $this->setEvaluationAccess(
$data[
"evaluation_access"] ??
"");
1000 $this->loadQuestionsFromDb();
1001 $this->setMailNotification((
bool)
$data[
'mailnotification']);
1002 $this->setMailAddresses((
string)
$data[
'mailaddresses']);
1003 $this->setMailParticipantData((
string)
$data[
'mailparticipantdata']);
1004 $this->setPoolUsage((
bool)
$data[
'pool_usage']);
1006 $this->setMode(
$data[
'mode']);
1008 $this->set360SelfEvaluation((
bool)
$data[
'mode_360_self_eval']);
1009 $this->set360SelfRaters((
bool)
$data[
'mode_360_self_rate']);
1010 $this->set360SelfAppraisee((
bool)
$data[
'mode_360_self_appr']);
1011 $this->set360Results((
int)
$data[
'mode_360_results']);
1013 $this->setSelfEvaluationResults((
int)
$data[
'mode_self_eval_results']);
1015 $this->setSkillService((
bool)
$data[
'mode_skill_service']);
1017 $this->setReminderStatus((
bool)
$data[
"reminder_status"]);
1020 $this->setReminderFrequency((
int)
$data[
"reminder_frequency"]);
1021 $this->setReminderTarget((
int)
$data[
"reminder_target"]);
1022 $this->setReminderLastSent((
string)
$data[
"reminder_last_sent"]);
1023 $this->setReminderTemplate((
int)
$data[
"reminder_tmpl"]);
1024 $this->setTutorNotificationStatus(
$data[
"tutor_ntf_status"]);
1025 $this->setTutorNotificationRecipients(explode(
";",
$data[
"tutor_ntf_reci"]));
1026 $this->setTutorNotificationTarget(
$data[
"tutor_ntf_target"]);
1027 $this->setTutorResultsStatus((
bool)
$data[
"tutor_res_status"]);
1028 $this->setTutorResultsRecipients(explode(
";",
$data[
"tutor_res_reci"]));
1030 $this->setViewOwnResults((
bool)
$data[
"own_results_view"]);
1031 $this->setMailOwnResults((
bool)
$data[
"own_results_mail"]);
1032 $this->setMailConfirmation((
bool)
$data[
"confirmation_mail"]);
1033 $this->setCalculateSumScore((
bool)
$data[
"calculate_sum_score"]);
1035 $this->setAnonymousUserList((
bool)
$data[
"anon_user_list"]);
1039 if (isset($this->ref_id) && $this->ref_id !== 0) {
1041 switch ($activation[
"timing_type"]) {
1043 $this->setActivationLimited(
true);
1044 $this->setActivationStartDate($activation[
"timing_start"]);
1045 $this->setActivationEndDate($activation[
"timing_end"]);
1046 $this->setActivationVisibility($activation[
"visible"]);
1050 $this->setActivationLimited(
false);
1059 $this->questions = array();
1060 $result =
$ilDB->queryF(
1061 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1063 array($this->getSurveyId())
1066 $this->questions[
$data[
"sequence"]] =
$data[
"question_fi"];
1078 $result =
$ilDB->queryF(
1079 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1081 array($this->getSurveyId())
1086 $to_delete_ids = array();
1088 if (in_array(
$data[
"question_fi"], $fis)) {
1089 $to_delete_ids[] =
$data[
"survey_question_id"];
1091 $fis[] =
$data[
"question_fi"];
1096 if (count($to_delete_ids) > 0) {
1097 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst" .
1098 " WHERE " .
$ilDB->in(
"survey_question_id", $to_delete_ids,
false,
"integer") .
1099 " AND survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
1100 $this->svy_log->debug(
"delete: " . $q);
1102 $ilDB->manipulate($q =
"DELETE FROM svy_qblk_qst " .
1103 " WHERE " .
$ilDB->in(
"question_fi", $fis,
true,
"integer") .
1104 " AND survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
1105 $this->svy_log->debug(
"delete: " . $q);
1109 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst " .
1110 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
" ORDER BY sequence");
1112 while ($rec =
$ilDB->fetchAssoc($set)) {
1114 $q =
"UPDATE svy_svy_qst SET " .
1115 " sequence = " .
$ilDB->quote($seq++,
"integer") .
1116 " WHERE survey_question_id = " .
$ilDB->quote($rec[
"survey_question_id"],
"integer")
1118 $this->svy_log->debug(
"update: " . $q);
1125 $this->author = $author;
1134 string $a_author =
""
1136 $md = new
ilMD($this->
getId(), 0, $this->getType());
1139 if ($a_author ===
'') {
1141 $a_author =
$ilUser->getFullname();
1144 $md_life = $md->addLifecycle();
1146 $con = $md_life->addContribute();
1147 $con->setRole(
"Author");
1149 $ent = $con->addEntity();
1150 $ent->setEntity($a_author);
1159 $md =
new ilMD($this->
getId(), 0, $this->getType());
1160 $md_life = $md->getLifecycle();
1162 $ids = $md_life->getContributeIds();
1163 foreach ($ids as
$id) {
1164 $md_cont = $md_life->getContribute(
$id);
1165 if (strcmp($md_cont->getRole(),
"Author") === 0) {
1166 $entids = $md_cont->getEntityIds();
1167 foreach ($entids as $entid) {
1168 $md_ent = $md_cont->getEntity($entid);
1169 $author[] = $md_ent->getEntity();
1174 return implode(
",", $author);
1179 return (
bool) $this->display_question_titles;
1184 $this->display_question_titles = $a_show;
1188 string $introduction =
""
1190 $this->introduction = $introduction;
1196 $this->outro = $outro;
1201 return $this->start_date;
1208 string $start_date =
""
1210 $this->start_date = $start_date;
1227 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches)) {
1232 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches)) {
1237 $this->start_date = sprintf(
'%04d%02d%02d%02d%02d%02d', $y, $m,
$d, $h,
$i, $s);
1242 return $this->end_date;
1249 string $end_date =
""
1251 $this->end_date = $end_date;
1256 $start = $this->getStartDate();
1266 $end = $this->getEndDate();
1288 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches)) {
1293 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches)) {
1298 $this->end_date = sprintf(
'%04d%02d%02d%02d%02d%02d', $y, $m,
$d, $h,
$i, $s);
1304 return $this->evaluation_access;
1308 string $evaluation_access = self::EVALUATION_ACCESS_OFF
1310 $this->evaluation_access = $evaluation_access;
1316 $this->activation_visibility = $a_value;
1321 return $this->activation_visibility;
1326 return $this->activation_limited;
1331 $this->activation_limited = $a_value;
1336 return $this->introduction;
1341 return $this->outro;
1351 $existing_questions = array();
1352 $result =
$ilDB->queryF(
1353 "SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1354 "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1356 array($this->getSurveyId())
1359 if (
$data[
"original_id"]) {
1360 $existing_questions[] = (
int)
$data[
"original_id"];
1363 return $existing_questions;
1371 bool $could_be_offline =
false,
1372 bool $showPath =
false
1385 array $move_questions,
1389 $array_pos = array_search($target_index, $this->questions);
1390 $part1 = $part2 = [];
1391 if ($insert_mode === 0) {
1392 $part1 = array_slice($this->questions, 0, $array_pos);
1393 $part2 = array_slice($this->questions, $array_pos);
1394 } elseif ($insert_mode === 1) {
1395 $part1 = array_slice($this->questions, 0, $array_pos + 1);
1396 $part2 = array_slice($this->questions, $array_pos + 1);
1399 foreach ($move_questions as $question_id) {
1400 if (!(!in_array($question_id, $part1))) {
1401 unset($part1[array_search($question_id, $part1)]);
1404 if (!(!in_array($question_id, $part2))) {
1405 unset($part2[array_search($question_id, $part2)]);
1410 if ($found !== count($move_questions)) {
1413 $part1 = array_values($part1);
1414 $part2 = array_values($part2);
1415 $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1416 foreach ($move_questions as $question_id) {
1417 $constraints = $this->getConstraints($question_id);
1418 foreach ($constraints as $idx => $constraint) {
1419 foreach ($part2 as $next_question_id) {
1420 if ($constraint[
"question"] == $next_question_id) {
1422 $this->deleteConstraint($constraint[
"id"]);
1427 $this->saveQuestionsToDb();
1436 $question = self::_instanciateQuestion($question_id);
1437 #20610 if no question found, do nothing.
1439 $question->delete($question_id);
1440 $this->removeConstraintsConcerningQuestion($question_id);
1452 $result =
$ilDB->queryF(
1453 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1454 array(
'integer',
'integer'),
1455 array($question_id, $this->getSurveyId())
1457 if ($result->numRows() > 0) {
1458 $remove_constraints = array();
1459 while ($row =
$ilDB->fetchAssoc($result)) {
1460 $remove_constraints[] = $row[
"constraint_fi"];
1462 $affectedRows =
$ilDB->manipulateF(
1463 "DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1464 array(
'integer',
'integer'),
1465 array($question_id, $this->getSurveyId())
1467 foreach ($remove_constraints as
$key => $constraint_id) {
1468 $affectedRows =
$ilDB->manipulateF(
1469 "DELETE FROM svy_constraint WHERE constraint_id = %s",
1471 array($constraint_id)
1483 array $remove_questions,
1484 array $remove_questionblocks
1488 $block_sizes = array();
1489 foreach ($this->getSurveyQuestions() as $question_id =>
$data) {
1490 if (in_array($question_id, $remove_questions) or in_array(
$data[
"questionblock_id"], $remove_questionblocks)) {
1491 unset($this->questions[array_search($question_id, $this->questions)]);
1492 $this->removeQuestion($question_id);
1493 } elseif (
$data[
"questionblock_id"]) {
1494 $block_sizes[
$data[
"questionblock_id"]] = ($block_sizes[
$data[
"questionblock_id"]] ?? 0) + 1;
1499 foreach ($block_sizes as $block_id => $size) {
1501 $remove_questionblocks[] = $block_id;
1505 foreach (array_unique($remove_questionblocks) as $questionblock_id) {
1506 $affectedRows =
$ilDB->manipulateF(
1507 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1509 array($questionblock_id)
1511 $affectedRows =
$ilDB->manipulateF(
1512 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1513 array(
'integer',
'integer'),
1514 array($questionblock_id, $this->getSurveyId())
1518 $this->questions = array_values($this->questions);
1519 $this->saveQuestionsToDb();
1527 array $questionblocks
1530 foreach ($questionblocks as
$index) {
1531 $affectedRows =
$ilDB->manipulateF(
1532 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1536 $affectedRows =
$ilDB->manipulateF(
1537 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1538 array(
'integer',
'integer'),
1539 array(
$index, $this->getSurveyId())
1549 int $questionblock_id
1554 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
1555 array(
'integer',
'integer',
'integer'),
1556 array($questionblock_id, $this->getSurveyId(), $question_id)
1565 int $questionblock_id
1570 if (!$this->isQuestionInAnyBlock($question_id)) {
1571 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
1572 $affectedRows =
$ilDB->manipulateF(
1573 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1574 "question_fi) VALUES (%s, %s, %s, %s)",
1575 array(
'integer',
'integer',
'integer',
'integer'),
1576 array($next_id, $this->getSurveyId(), $questionblock_id, $question_id)
1579 $this->deleteConstraints($question_id);
1593 $set =
$ilDB->query(
"SELECT * FROM svy_qblk_qst " .
1594 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
1595 " AND question_fi = " .
$ilDB->quote($a_question_fi,
"integer"));
1596 if ($rec =
$ilDB->fetchAssoc($set)) {
1609 int $questionblock_id
1613 $result =
$ilDB->queryF(
1614 "SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM " .
1615 "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
1616 "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
1618 array($questionblock_id)
1621 while ($row =
$ilDB->fetchAssoc($result)) {
1622 $titles[$row[
"question_fi"]] = $row[
"title"];
1623 $survey_id = $row[
"survey_fi"];
1625 $result =
$ilDB->queryF(
1626 "SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1630 $resultarray = array();
1632 while ($row =
$ilDB->fetchAssoc($result)) {
1633 if (array_key_exists($row[
"question_fi"], $titles)) {
1634 $resultarray[$counter++] = $titles[$row[
"question_fi"]];
1637 return $resultarray;
1646 int $questionblock_id
1651 $result =
$ilDB->queryF(
1652 "SELECT a.question_fi FROM svy_qblk_qst a JOIN svy_svy_qst b ON (a.question_fi = b.question_fi) " .
1653 " WHERE a.questionblock_fi = %s ORDER BY b.sequence",
1655 array($questionblock_id)
1658 if ($result->numRows()) {
1660 if (!in_array(
$data[
'question_fi'], $ids)) {
1661 $ids[] = (
int)
$data[
'question_fi'];
1673 int $questionblock_id
1678 $result =
$ilDB->queryF(
1679 "SELECT * FROM svy_qblk WHERE questionblock_id = %s",
1681 array($questionblock_id)
1683 $row =
$ilDB->fetchAssoc($result);
1693 bool $show_questiontext =
true,
1694 bool $show_blocktitle =
false,
1695 bool $compress_view =
false
1700 $next_id =
$ilDB->nextId(
'svy_qblk');
1702 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
1703 " show_blocktitle, owner_fi, tstamp, compress_view) " .
1704 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
1705 array(
'integer',
'text',
'integer',
'integer',
'integer',
'integer',
'integer'),
1706 array($next_id, $title, $show_questiontext, $show_blocktitle, $owner, time(),$compress_view)
1716 bool $show_questiontext,
1717 bool $show_blocktitle,
1719 bool $compress_view =
false
1725 $this->moveQuestions($questions, $questions[0], 0);
1729 $next_id =
$ilDB->nextId(
'svy_qblk');
1730 $affectedRows =
$ilDB->manipulateF(
1731 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
1732 " show_blocktitle, owner_fi, tstamp, compress_view) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1733 array(
'integer',
'text',
'text',
'text',
'integer',
'integer',
'integer'),
1734 array($next_id, $title, $show_questiontext, $show_blocktitle,
$ilUser->getId(), time(), $compress_view)
1736 if ($affectedRows) {
1737 $questionblock_id = $next_id;
1738 foreach ($questions as
$index) {
1739 if (!$this->isQuestionInAnyBlock(
$index)) {
1740 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
1741 $affectedRows =
$ilDB->manipulateF(
1742 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1743 "question_fi) VALUES (%s, %s, %s, %s)",
1744 array(
'integer',
'integer',
'integer',
'integer'),
1745 array($next_id, $this->getSurveyId(), $questionblock_id,
$index)
1747 $this->deleteConstraints(
$index);
1757 int $questionblock_id,
1759 bool $show_questiontext,
1760 bool $show_blocktitle,
1761 bool $compress_view =
false
1765 "UPDATE svy_qblk SET title = %s, show_questiontext = %s," .
1766 " show_blocktitle = %s, compress_view = %s WHERE questionblock_id = %s",
1767 array(
'text',
'text',
'text',
'integer',
'integer'),
1768 array($title, $show_questiontext, $show_blocktitle, $compress_view, $questionblock_id)
1780 $result =
$ilDB->queryF(
1781 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1782 array(
'integer',
'integer'),
1783 array($question_id, $this->getSurveyId())
1785 $constraints = array();
1786 while ($row =
$ilDB->fetchAssoc($result)) {
1787 $constraints[] = $row[
"constraint_fi"];
1789 foreach ($constraints as $constraint_id) {
1790 $this->deleteConstraint($constraint_id);
1802 $affectedRows =
$ilDB->manipulateF(
1803 "DELETE FROM svy_constraint WHERE constraint_id = %s",
1805 array($constraint_id)
1807 $affectedRows =
$ilDB->manipulateF(
1808 "DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
1810 array($constraint_id)
1819 bool $with_answers =
false
1823 $all_questions = array();
1824 $result =
$ilDB->queryF(
1825 "SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, " .
1826 "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
1827 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
1828 "ORDER BY svy_svy_qst.sequence",
1830 array($this->getSurveyId())
1832 while ($row =
$ilDB->fetchAssoc($result)) {
1834 if ($row[
"plugin"]) {
1835 if (!$this->isPluginActive($row[
"type_tag"])) {
1840 $question = self::_instanciateQuestion($row[
"question_id"]);
1841 $questionrow = $question->getQuestionDataArray($row[
"question_id"]);
1842 foreach ($row as
$key => $value) {
1843 $questionrow[
$key] = $value;
1845 $all_questions[$row[
"question_id"]] = $questionrow;
1846 $all_questions[$row[
"question_id"]][
"usableForPrecondition"] = $question->usableForPrecondition();
1847 $all_questions[$row[
"question_id"]][
"availableRelations"] = $question->getAvailableRelations();
1851 $questionblocks = array();
1852 if (count($all_questions)) {
1853 $result =
$ilDB->queryF(
1854 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
1855 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
1856 "AND " .
$ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
1858 array($this->getSurveyId())
1860 while ($row =
$ilDB->fetchAssoc($result)) {
1861 $questionblocks[$row[
'question_fi']] = $row;
1865 foreach ($all_questions as $question_id => $row) {
1866 $constraints = $this->getConstraints($question_id);
1867 if (isset($questionblocks[$question_id])) {
1868 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
1869 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
1871 $all_questions[$question_id][
"questionblock_title"] =
"";
1872 $all_questions[$question_id][
"questionblock_id"] =
"";
1874 $all_questions[$question_id][
"constraints"] = $constraints;
1875 if ($with_answers) {
1877 $result =
$ilDB->queryF(
1878 "SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
1879 "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id " .
1880 "ORDER BY sequence ASC",
1884 if ($result->numRows() > 0) {
1886 $answers[] =
$data[
"title"];
1889 $all_questions[$question_id][
"answers"] = $answers;
1892 return $all_questions;
1901 array $obligatory_questions
1904 $result =
$ilDB->queryF(
1905 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
1907 array($this->getSurveyId())
1909 if ($result->numRows()) {
1910 while ($row =
$ilDB->fetchAssoc($result)) {
1911 if (!array_key_exists($row[
"question_fi"], $obligatory_questions)) {
1912 $obligatory_questions[$row[
"question_fi"]] = 0;
1917 foreach ($obligatory_questions as $question_fi => $obligatory) {
1919 $ilDB->manipulate(
"UPDATE svy_question" .
1920 " SET obligatory = " .
$ilDB->quote($obligatory,
"integer") .
1921 " WHERE question_id = " .
$ilDB->quote($question_fi,
"integer"));
1933 $all_questions = array();
1934 $result =
$ilDB->queryF(
1935 "SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
1936 "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
1937 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
1938 "ORDER BY svy_svy_qst.sequence",
1940 array($this->getSurveyId())
1942 while ($row =
$ilDB->fetchAssoc($result)) {
1943 $all_questions[$row[
"question_id"]] = $row;
1946 $questionblocks = array();
1947 if (count($all_questions)) {
1948 $result =
$ilDB->queryF(
1949 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst " .
1950 "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
1951 "AND " .
$ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
1953 array($this->getSurveyId())
1955 while ($row =
$ilDB->fetchAssoc($result)) {
1956 $questionblocks[$row[
'question_fi']] = $row;
1960 $all_pages = array();
1963 foreach ($all_questions as $question_id => $row) {
1964 $constraints = array();
1965 if (isset($questionblocks[$question_id])) {
1966 if (!$currentblock or ($currentblock != $questionblocks[$question_id][
'questionblock_id'])) {
1969 $all_questions[$question_id][
'page'] = $pageindex;
1970 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
1971 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
1972 $all_questions[$question_id][
"questionblock_show_questiontext"] = $questionblocks[$question_id][
'show_questiontext'];
1973 $all_questions[$question_id][
"questionblock_show_blocktitle"] = $questionblocks[$question_id][
'show_blocktitle'];
1974 $all_questions[$question_id][
"questionblock_compress_view"] = $questionblocks[$question_id][
'compress_view'];
1975 $currentblock = $questionblocks[$question_id][
'questionblock_id'];
1978 $all_questions[$question_id][
'page'] = $pageindex;
1979 $all_questions[$question_id][
"questionblock_title"] =
"";
1980 $all_questions[$question_id][
"questionblock_id"] =
"";
1981 $all_questions[$question_id][
"questionblock_show_questiontext"] = 1;
1982 $all_questions[$question_id][
"questionblock_show_blocktitle"] = 1;
1983 $all_questions[$question_id][
"questionblock_compress_view"] =
false;
1986 $constraints = $this->getConstraints($question_id);
1987 $all_questions[$question_id][
"constraints"] = $constraints;
1988 if (!isset($all_pages[$pageindex])) {
1989 $all_pages[$pageindex] = array();
1991 $all_pages[$pageindex][] = $all_questions[$question_id];
1994 $max = count($all_pages);
1996 foreach ($all_pages as
$index => $block) {
1997 foreach ($block as $blockindex => $question) {
1998 $all_pages[
$index][$blockindex][
"position"] = $counter / $max;
2015 int $active_page_question_id,
2019 $pages = $this->getSurveyPages();
2020 if ($active_page_question_id === 0) {
2023 foreach ($pages as
$key => $question_array) {
2024 foreach ($question_array as $question) {
2025 if ($active_page_question_id == $question[
"question_id"]) {
2030 if ($foundpage === -1) {
2033 $foundpage += $direction;
2034 if ($foundpage < 0) {
2037 if ($foundpage >= count($pages)) {
2040 return $pages[$foundpage];
2048 bool $use_obj_id =
false,
2049 bool $could_be_offline =
false,
2050 bool $showPath =
false,
2051 string $permission =
"read"
2065 $result =
$ilDB->queryF(
2066 "SELECT svy_constraint.*, svy_relation.*, svy_qst_constraint.question_fi ref_question_fi FROM svy_qst_constraint, svy_constraint, " .
2067 "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2068 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2070 array($constraint_id)
2073 if ($result->numRows()) {
2074 $pc =
$ilDB->fetchAssoc($result);
2088 $result_array = array();
2089 $result =
$ilDB->queryF(
2090 "SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation " .
2091 "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2092 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s " .
2093 "AND svy_qst_constraint.survey_fi = %s",
2094 array(
'integer',
'integer'),
2095 array($question_id, $this->getSurveyId())
2097 while ($row =
$ilDB->fetchAssoc($result)) {
2100 $question =
new $question_type();
2101 $question->loadFromDb($row[
"question_fi"]);
2102 $valueoutput = $question->getPreconditionValueOutput($row[
"value"]);
2103 $result_array[] = array(
"id" => $row[
"constraint_id"],
2104 "question" => $row[
"question_fi"],
2105 "short" => $row[
"shortname"],
2106 "long" => $row[
"longname"],
2107 "value" => $row[
"value"],
2108 "conjunction" => $row[
"conjunction"],
2109 "valueoutput" => $valueoutput
2112 return $result_array;
2124 $result_array = array();
2125 $result =
$ilDB->queryF(
2126 "SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* " .
2127 "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id " .
2128 "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2132 while ($row =
$ilDB->fetchAssoc($result)) {
2133 $result_array[] = array(
"id" => $row[
"constraint_id"],
2134 "for_question" => $row[
"for_question"],
2135 "question" => $row[
"question_fi"],
2136 "short" => $row[
"shortname"],
2137 "long" => $row[
"longname"],
2138 "relation_id" => $row[
"relation_id"],
2139 "value" => $row[
"value"],
2140 'conjunction' => $row[
'conjunction']
2143 return $result_array;
2156 $result_array = array();
2157 $result =
$ilDB->queryF(
2158 "SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN " .
2159 "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s " .
2160 "ORDER BY svy_variable.sequence",
2164 while ($row =
$ilDB->fetchObject($result)) {
2165 $result_array[$row->sequence] = $row;
2167 return $result_array;
2180 int $if_question_id,
2187 $next_id =
$ilDB->nextId(
'svy_constraint');
2188 $affectedRows =
$ilDB->manipulateF(
2189 "INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES " .
2190 "(%s, %s, %s, %s, %s)",
2191 array(
'integer',
'integer',
'integer',
'float',
'integer'),
2192 array($next_id, $if_question_id, $relation, $value, $conjunction)
2194 if ($affectedRows) {
2206 int $to_question_id,
2211 $next_id =
$ilDB->nextId(
'svy_qst_constraint');
2213 "INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, " .
2214 "constraint_fi) VALUES (%s, %s, %s, %s)",
2215 array(
'integer',
'integer',
'integer',
'integer'),
2216 array($next_id, $this->getSurveyId(), $to_question_id, $constraint_id)
2224 int $precondition_id,
2225 int $if_question_id,
2232 "UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s " .
2233 "WHERE constraint_id = %s",
2234 array(
'integer',
'integer',
'float',
'integer',
'integer'),
2235 array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2247 foreach ($questions as $question_id) {
2249 "UPDATE svy_constraint SET conjunction = %s " .
2250 "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2251 array(
'integer',
'integer'),
2252 array($conjunction, $question_id)
2261 bool $short_as_key =
false
2266 $custom_order = array(
"equal",
"not_equal",
"less",
"less_or_equal",
"more",
"more_or_equal");
2267 $custom_order = array_flip($custom_order);
2269 $result_array = array();
2270 $result =
$ilDB->query(
"SELECT * FROM svy_relation");
2271 while ($row =
$ilDB->fetchAssoc($result)) {
2272 if ($short_as_key) {
2273 $result_array[$row[
"shortname"]] = array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"id" => $row[
"relation_id"],
"order" => $custom_order[$row[
"longname"]]);
2275 $result_array[$row[
"relation_id"]] = array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"order" => $custom_order[$row[
"longname"]]);
2280 foreach ($result_array as $idx => $item) {
2281 unset($result_array[$idx][
"order"]);
2284 return $result_array;
2300 $affectedRows =
$ilDB->manipulateF(
2301 "DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2302 array(
'integer',
'integer'),
2303 array($question_id, $active_id)
2316 $result_array = array();
2317 $result =
$ilDB->queryF(
2318 "SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2319 array(
'integer',
'integer'),
2320 array($question_id, $active_id)
2322 if ($result->numRows() >= 1) {
2323 while ($row =
$ilDB->fetchAssoc($result)) {
2324 $result_array[] = $row;
2327 return $result_array;
2341 "UPDATE svy_finished SET state = %s, tstamp = %s" .
2342 " WHERE survey_fi = %s AND finished_id = %s",
2343 array(
'text',
'integer',
'integer',
'integer'),
2344 array(1, time(), $this->getSurveyId(), $finished_id)
2348 if ($this->getMode() === self::MODE_SELF_EVAL) {
2349 $user = $this->getUserDataFromActiveId($finished_id);
2351 $sskill->writeAndAddSelfEvalSkills($user[
'usr_id']);
2355 if ($this->getMode() === self::MODE_IND_FEEDB) {
2360 $raters = $this->getRatersData($appr_id);
2361 $run_manager = $this->survey_service
2364 ->run($this, $this->
user->getId(), $appr_id);
2365 $run = $run_manager->getById($finished_id);
2368 $rater_id = $run->getUserId();
2370 foreach ($raters as
$id => $rater) {
2371 if (($rater[
"code"] ??
"") === $run->getCode()) {
2378 $sskill->writeAndAddIndFeedbackSkills($finished_id, $appr_id, $rater_id);
2381 $this->checkTutorNotification();
2397 "UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
2398 array(
'integer',
'integer'),
2399 array(($page_id) ?: 0, $finished_id)
2411 string $a_anonymize_id,
2415 $placeholders = array(
2416 "FIRST_NAME" =>
"firstname",
2417 "LAST_NAME" =>
"lastname",
2420 "firstname" =>
"firstname"
2425 $recipients = explode(
",", $this->mailaddresses);
2426 foreach ($recipients as $recipient) {
2429 $ntf->setLangModules(array(
"survey"));
2430 $ntf->setRefId($this->getRefId());
2431 $ntf->setSubjectLangId(
'finished_mail_subject');
2433 $messagetext = $this->mailparticipantdata;
2435 if (trim($messagetext)) {
2436 if (!$this->hasAnonymizedResults()) {
2440 foreach ($placeholders as
$key => $mapping) {
2441 if ($this->hasAnonymizedResults()) {
2442 $messagetext = str_replace(
'[' .
$key .
']',
'', $messagetext);
2444 $messagetext = str_replace(
'[' .
$key .
']', trim(
$data[$mapping]), $messagetext);
2447 $ntf->setIntroductionDirect($messagetext);
2449 $ntf->setIntroductionLangId(
'survey_notification_finished_introduction');
2454 $ntf->addAdditionalInfo(
2455 'survey_360_appraisee',
2460 $active_id = $this->getActiveID($a_user_id, $a_anonymize_id, $a_appr_id);
2461 $ntf->addAdditionalInfo(
2463 $this->getParticipantTextResults($active_id),
2467 $ntf->setGotoLangId(
'survey_notification_tutor_link');
2468 $ntf->setReasonLangId(
'survey_notification_finished_reason');
2470 $recipient = trim($recipient);
2473 $ntf->sendMailAndReturnRecipients([$user_id]);
2476 if (count($user_ids) > 0) {
2477 $ntf->sendMailAndReturnRecipients([current($user_ids)]);
2506 $userResults = $this->getUserSpecificResults(array($active_id));
2507 $questions = $this->getSurveyQuestions(
true);
2508 $questioncounter = 1;
2509 foreach ($questions as $question_id => $question_data) {
2510 $textresult .= $questioncounter++ .
". " . $question_data[
"title"] .
"\n";
2511 $found = $userResults[$question_id][$active_id];
2513 if (is_array($found)) {
2514 $text = implode(
"\n", $found);
2519 $text = self::getSurveySkippedValue();
2521 $text = str_replace(
"<br />",
"\n", $text);
2522 $textresult .= $text .
"\n\n";
2533 string $anonymize_id,
2539 if ($anonymize_id) {
2540 $result =
$ilDB->queryF(
2541 "SELECT finished_id FROM svy_finished" .
2542 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2543 array(
'integer',
'text',
'integer'),
2544 array($this->getSurveyId(), $anonymize_id, $appr_id)
2547 $result =
$ilDB->queryF(
2548 "SELECT finished_id FROM svy_finished" .
2549 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
2550 array(
'integer',
'integer',
'integer'),
2551 array($this->getSurveyId(), $user_id, $appr_id)
2554 if ($result->numRows() === 0) {
2557 $row =
$ilDB->fetchAssoc($result);
2558 return (
int) $row[
"finished_id"];
2570 $result =
$ilDB->queryF(
2571 "SELECT lastpage FROM svy_finished WHERE finished_id = %s",
2575 if ($row =
$ilDB->fetchAssoc($result)) {
2576 return (
int) $row[
"lastpage"];
2590 array $constraint_data,
2591 ?array $working_data
2593 if (!is_array($working_data) || count($working_data) === 0) {
2597 if ((count($working_data) === 1) and (strcmp($working_data[0][
"value"],
"") === 0)) {
2602 foreach ($working_data as
$data) {
2603 switch ($constraint_data[
"short"]) {
2605 if (
$data[
"value"] < $constraint_data[
"value"]) {
2611 if (
$data[
"value"] <= $constraint_data[
"value"]) {
2617 if (
$data[
"value"] == $constraint_data[
"value"]) {
2623 if (
$data[
"value"] <> $constraint_data[
"value"]) {
2629 if (
$data[
"value"] >= $constraint_data[
"value"]) {
2635 if (
$data[
"value"] > $constraint_data[
"value"]) {
2645 return (
int) $found;
2658 $result =
$ilDB->queryF(
2659 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
2663 return (
bool) $result->numRows();
2676 $result =
$ilDB->queryF(
2677 "SELECT * FROM svy_finished WHERE survey_fi = %s",
2679 array($this->getSurveyId())
2681 if ($result->numRows()) {
2682 while ($row =
$ilDB->fetchAssoc($result)) {
2683 $users[] = (
int) $row[
"finished_id"];
2697 $evaluation = array();
2699 foreach (array_keys($this->getSurveyQuestions()) as $question_id) {
2703 $question =
new $question_type();
2704 $question->loadFromDb($question_id);
2707 $q_res = $q_eval->getResults();
2710 foreach ($finished_ids as $user_id) {
2711 $data[$user_id] = $q_eval->parseUserSpecificResults($q_res, $user_id);
2714 $evaluation[$question_id] =
$data;
2726 bool $force_non_anonymous =
false
2730 $surveySetting =
new ilSetting(
"survey");
2731 $use_anonymous_id = $surveySetting->get(
"use_anonymous_id");
2732 $result =
$ilDB->queryF(
2733 "SELECT * FROM svy_finished WHERE finished_id = %s",
2738 $foundrows = $result->numRows();
2740 $row =
$ilDB->fetchAssoc($result);
2742 $name = ($use_anonymous_id) ? $row[
"anonymous_id"] : $this->
lng->txt(
"anonymous");
2744 "fullname" =>
$name,
2745 "sortname" =>
$name,
2750 "active_id" => (
string) $active_id
2753 if (($row[
"user_fi"] > 0) &&
2755 !$this->hasAnonymizedResults() &&
2756 !$this->get360Mode()) ||
2757 $force_non_anonymous)) {
2759 $userdata[
"fullname"] = $userdata[
"sortname"] = $this->
lng->txt(
"deleted_user");
2762 $userdata[
'usr_id'] = $row[
'user_fi'];
2765 if (strlen($gender) === 1) {
2766 $gender = $this->
lng->txt(
"gender_$gender");
2768 $userdata[
"gender"] = $gender;
2772 $userdata[
"login"] = $user->
getLogin();
2776 $code = $this->code_manager->getByUserKey((
string) $row[
"anonymous_id"]);
2777 if (!is_null($code) && $this->feature_config->usesAppraisees()) {
2778 $userdata[
"firstname"] = $code->getFirstName();
2779 $userdata[
"lastname"] = $code->getLastName();
2780 $userdata[
"sortname"] = $code->getLastName() .
", " . $code->getFirstName();
2799 $result =
$ilDB->queryF(
2800 "SELECT * FROM svy_answer WHERE active_fi = %s",
2804 while ($row =
$ilDB->fetchAssoc($result)) {
2805 if (!is_array($answers[$row[
"question_fi"]])) {
2806 $answers[$row[
"question_fi"]] = array();
2808 $answers[$row[
"question_fi"]][] = $row;
2810 $userdata = $this->getUserDataFromActiveId($active_id);
2812 "name" => $userdata[
"fullname"],
2813 "firstname" => $userdata[
"firstname"],
2814 "lastname" => $userdata[
"lastname"],
2815 "login" => $userdata[
"login"],
2816 "gender" => $userdata[
"gender"],
2817 "answers" => array()
2819 foreach ($questions as
$key => $question) {
2820 if (array_key_exists(
$key, $answers)) {
2821 $resultset[
"answers"][
$key] = $answers[
$key];
2823 $resultset[
"answers"][
$key] = array();
2825 sort($resultset[
"answers"][
$key]);
2839 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
2840 $where .=
" AND " .
$ilDB->like(
'svy_question.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
2842 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
2843 $where .=
" AND " .
$ilDB->like(
'svy_question.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
2845 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
2846 $where .=
" AND " .
$ilDB->like(
'svy_question.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
2848 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
2849 $where .=
" AND svy_qtype.type_tag = " .
$ilDB->quote($arrFilter[
'type'],
'text');
2851 if (array_key_exists(
'spl', $arrFilter) && strlen($arrFilter[
'spl'])) {
2852 $where .=
" AND svy_question.obj_fi = " .
$ilDB->quote($arrFilter[
'spl'],
'integer');
2855 $spls = $this->getAvailableQuestionpools(
true,
false,
false);
2856 $forbidden =
" AND " .
$ilDB->in(
'svy_question.obj_fi', array_keys($spls),
false,
'integer');
2857 $forbidden .=
" AND svy_question.complete = " .
$ilDB->quote(
"1",
'text');
2859 $existing_questions = $this->getExistingQuestions();
2860 if (count($existing_questions)) {
2861 $existing =
" AND " .
$ilDB->in(
'svy_question.question_id', $existing_questions,
true,
'integer');
2866 $query_result =
$ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id" .
2867 " FROM svy_question, svy_qtype, object_reference" .
2868 " WHERE svy_question.original_id IS NULL" . $forbidden . $existing .
2869 " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0" .
2870 " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
2873 if ($query_result->numRows()) {
2874 while ($row =
$ilDB->fetchAssoc($query_result)) {
2875 if (array_key_exists(
'spl_txt', $arrFilter) && strlen($arrFilter[
'spl_txt'])) {
2876 if (stripos($spls[$row[
"obj_fi"]], $arrFilter[
'spl_txt']) ===
false) {
2881 $row[
'ttype'] = $trans[$row[
'type_tag']];
2882 if ($row[
"plugin"]) {
2883 if ($this->isPluginActive($row[
"type_tag"])) {
2904 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
2905 $where .=
" AND " .
$ilDB->like(
'svy_qblk.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
2908 $query_result =
$ilDB->query(
"SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE " .
2909 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi " .
2910 "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, " .
2911 "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
2913 if ($query_result->numRows()) {
2915 $surveytitles = array();
2916 foreach ($survey_ref_ids as $survey_ref_id) {
2920 while ($row =
$ilDB->fetchAssoc($query_result)) {
2921 $questions_array = $this->getQuestionblockQuestions($row[
"questionblock_id"]);
2923 foreach ($questions_array as
$key => $value) {
2924 $questions_array[
$key] =
"$counter. $value";
2927 if (strlen($surveytitles[$row[
"obj_fi"]] ??
"")) {
2928 $rows[$row[
"questionblock_id"]] = array(
2929 "questionblock_id" => $row[
"questionblock_id"],
2930 "title" => $row[
"title"],
2931 "svy" => $surveytitles[$row[
"obj_fi"]],
2932 "contains" => implode(
", ", $questions_array),
2933 "owner" => $row[
"owner_fi"]
2949 $a_xml_writer->xmlHeader();
2951 "xmlns:xsi" =>
"http://www.w3.org/2001/XMLSchema-instance",
2952 "xsi:noNamespaceSchemaLocation" =>
"https://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
2954 $a_xml_writer->xmlStartTag(
"surveyobject", $attrs);
2956 "id" => $this->getSurveyId(),
2957 "title" => $this->getTitle()
2959 $a_xml_writer->xmlStartTag(
"survey", $attrs);
2961 $a_xml_writer->xmlElement(
"description",
null, $this->getDescription());
2962 $a_xml_writer->xmlElement(
"author",
null, $this->getAuthor());
2963 $a_xml_writer->xmlStartTag(
"objectives");
2965 "label" =>
"introduction"
2967 $this->addMaterialTag($a_xml_writer, $this->getIntroduction(),
true,
true, $attrs);
2971 $this->addMaterialTag($a_xml_writer, $this->getOutro(),
true,
true, $attrs);
2972 $a_xml_writer->xmlEndTag(
"objectives");
2974 if ($this->getAnonymize()) {
2975 $attribs = array(
"enabled" =>
"1");
2977 $attribs = array(
"enabled" =>
"0");
2979 $a_xml_writer->xmlElement(
"anonymisation", $attribs);
2980 $a_xml_writer->xmlStartTag(
"restrictions");
2981 if ($this->getAnonymize() === 2) {
2982 $attribs = array(
"type" =>
"free");
2984 $attribs = array(
"type" =>
"restricted");
2986 $a_xml_writer->xmlElement(
"access", $attribs);
2987 if ($this->getStartDate()) {
2988 $attrs = array(
"type" =>
"date");
2989 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getStartDate(), $matches);
2990 $a_xml_writer->xmlElement(
"startingtime", $attrs, sprintf(
"%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5]));
2992 if ($this->getEndDate()) {
2993 $attrs = array(
"type" =>
"date");
2994 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->getEndDate(), $matches);
2995 $a_xml_writer->xmlElement(
"endingtime", $attrs, sprintf(
"%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5]));
2997 $a_xml_writer->xmlEndTag(
"restrictions");
3000 $pages = $this->getSurveyPages();
3001 $hasconstraints =
false;
3002 foreach ($pages as $question_array) {
3003 foreach ($question_array as $question) {
3004 if (count($question[
"constraints"])) {
3005 $hasconstraints =
true;
3010 if ($hasconstraints) {
3011 $a_xml_writer->xmlStartTag(
"constraints");
3012 foreach ($pages as $question_array) {
3013 foreach ($question_array as $question) {
3014 if (count($question[
"constraints"])) {
3016 foreach ($question[
"constraints"] as $constraint) {
3018 "sourceref" => $question[
"question_id"],
3019 "destref" => $constraint[
"question"],
3020 "relation" => $constraint[
"short"],
3021 "value" => $constraint[
"value"],
3022 "conjunction" => $constraint[
"conjunction"]
3024 $a_xml_writer->xmlElement(
"constraint", $attribs);
3029 $a_xml_writer->xmlEndTag(
"constraints");
3033 $a_xml_writer->xmlStartTag(
"metadata");
3035 $custom_properties = array();
3036 $custom_properties[
"evaluation_access"] = $this->getEvaluationAccess();
3037 $custom_properties[
"status"] = !$this->getOfflineStatus();
3038 $custom_properties[
"display_question_titles"] = $this->getShowQuestionTitles();
3039 $custom_properties[
"pool_usage"] = (
int) $this->getPoolUsage();
3041 $custom_properties[
"own_results_view"] = (
int) $this->hasViewOwnResults();
3042 $custom_properties[
"own_results_mail"] = (
int) $this->hasMailOwnResults();
3043 $custom_properties[
"confirmation_mail"] = (
int) $this->hasMailConfirmation();
3045 $custom_properties[
"anon_user_list"] = (
int) $this->hasAnonymousUserList();
3046 $custom_properties[
"mode"] = $this->getMode();
3047 $custom_properties[
"mode_360_self_eval"] = (
int) $this->get360SelfEvaluation();
3048 $custom_properties[
"mode_360_self_rate"] = (
int) $this->get360SelfRaters();
3049 $custom_properties[
"mode_360_self_appr"] = (
int) $this->get360SelfAppraisee();
3050 $custom_properties[
"mode_360_results"] = $this->get360Results();
3051 $custom_properties[
"mode_skill_service"] = (
int) $this->getSkillService();
3052 $custom_properties[
"mode_self_eval_results"] = $this->getSelfEvaluationResults();
3059 foreach ($custom_properties as $label => $value) {
3060 $a_xml_writer->xmlStartTag(
"metadatafield");
3061 $a_xml_writer->xmlElement(
"fieldlabel",
null, $label);
3062 $a_xml_writer->xmlElement(
"fieldentry",
null, $value);
3063 $a_xml_writer->xmlEndTag(
"metadatafield");
3066 $a_xml_writer->xmlStartTag(
"metadatafield");
3067 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"SCORM");
3068 $md =
new ilMD($this->
getId(), 0, $this->getType());
3070 $md->toXML($writer);
3071 $metadata = $writer->xmlDumpMem();
3072 $a_xml_writer->xmlElement(
"fieldentry",
null, $metadata);
3073 $a_xml_writer->xmlEndTag(
"metadatafield");
3075 $a_xml_writer->xmlEndTag(
"metadata");
3076 $a_xml_writer->xmlEndTag(
"survey");
3078 $attribs = array(
"id" => $this->
getId());
3079 $a_xml_writer->xmlStartTag(
"surveyquestions", $attribs);
3081 foreach ($pages as $question_array) {
3082 if (count($question_array) > 1) {
3083 $attribs = array(
"id" => $question_array[0][
"question_id"]);
3085 "showQuestiontext" => $question_array[0][
"questionblock_show_questiontext"],
3086 "showBlocktitle" => $question_array[0][
"questionblock_show_blocktitle"],
3087 "compressView" => $question_array[0][
"questionblock_compress_view"]
3089 $a_xml_writer->xmlStartTag(
"questionblock", $attribs);
3090 if (strlen($question_array[0][
"questionblock_title"])) {
3091 $a_xml_writer->xmlElement(
"questionblocktitle",
null, $question_array[0][
"questionblock_title"]);
3094 foreach ($question_array as $question) {
3095 if (strlen($question[
"heading"])) {
3096 $a_xml_writer->xmlElement(
"textblock",
null, $question[
"heading"]);
3098 $questionObject = self::_instanciateQuestion($question[
"question_id"]);
3102 if ($questionObject !==
false) {
3103 $questionObject->insertXML($a_xml_writer,
false);
3106 if (count($question_array) > 1) {
3107 $a_xml_writer->xmlEndTag(
"questionblock");
3111 $a_xml_writer->xmlEndTag(
"surveyquestions");
3112 $a_xml_writer->xmlEndTag(
"surveyobject");
3113 $xml = $a_xml_writer->xmlDumpMem(
false);
3124 if ($question_id < 1) {
3128 if ($question_type ===
'') {
3132 $question =
new $question_type();
3133 $question->loadFromDb($question_id);
3145 if (!is_dir($a_dir) || is_int(strpos($a_dir,
".."))) {
3148 $importDirectory =
"";
3151 $current_dir = opendir($a_dir);
3153 while ($entryname = readdir($current_dir)) {
3154 $files[] = $entryname;
3157 foreach ($files as $file) {
3158 if (is_dir($a_dir .
"/" . $file) and ($file !==
"." and $file !==
"..")) {
3160 $importDirectory = $a_dir .
"/" . $file;
3163 closedir($current_dir);
3164 if ($importDirectory !==
'') {
3166 $current_dir = opendir($importDirectory);
3168 while ($entryname = readdir($current_dir)) {
3169 $files[] = $entryname;
3171 foreach ($files as $file) {
3172 if (is_file($importDirectory .
"/" . $file) &&
3173 ($file !==
"." && $file !==
"..") &&
3174 (preg_match(
"/^[0-9]{10}__[0-9]+__(svy_)*[0-9]+\.[A-Za-z]{1,3}$/", $file) ||
3175 preg_match(
"/^[0-9]{10}__[0-9]+__(survey__)*[0-9]+\.[A-Za-z]{1,3}$/", $file))) {
3177 $xmlFile = $importDirectory .
"/" . $file;
3181 return array(
"dir" => $importDirectory,
"xml" => $xmlFile);
3195 if ($svy_qpl_id < 1) {
3199 $source = $file_info[
"tmp_name"];
3201 if ((
$source ===
'none') || (!
$source) || $file_info[
"error"] > UPLOAD_ERR_OK) {
3202 $error = $this->
lng->txt(
"import_no_file_selected");
3207 if ((strcmp($file_info[
"type"],
"text/xml") === 0) || (strcmp($file_info[
"type"],
"application/xml") === 0)) {
3208 $this->svy_log->debug(
"isXML");
3212 $suffix = pathinfo($file_info[
"name"]);
3213 if (strcmp(strtolower($suffix[
"extension"]),
"zip") === 0) {
3214 $this->svy_log->debug(
"isZip");
3217 if (!$isXml && !$isZip) {
3218 $error = $this->
lng->txt(
"import_wrong_file_type");
3219 $this->svy_log->debug(
"Survey: Import error. Filetype was \"" . $file_info[
"type"] .
"\"");
3221 if ($error ===
'') {
3223 $import_dir = $this->getImportDirectory();
3224 $import_subdir =
"";
3227 $importfile = $import_dir .
"/" . $file_info[
"name"];
3230 $found = $this->locateImportFiles($import_dir);
3231 if (!((strlen($found[
"dir"]) > 0) && (strlen($found[
"xml"]) > 0))) {
3232 $error = $this->
lng->txt(
"wrong_import_file_structure");
3235 $importfile = $found[
"xml"];
3236 $import_subdir = $found[
"dir"];
3238 $importfile = tempnam($import_dir,
"survey_import");
3242 $this->svy_log->debug(
"Import file = $importfile");
3243 $this->svy_log->debug(
"Import subdir = $import_subdir");
3245 $fh = fopen($importfile,
'rb');
3247 $error = $this->
lng->txt(
"import_error_opening_file");
3250 $xml = fread($fh, filesize($importfile));
3251 $result = fclose($fh);
3253 $error = $this->
lng->txt(
"import_error_closing_file");
3257 $this->import_manager->clearMobs();
3258 if (strpos(
$xml,
"questestinterop")) {
3261 $this->svy_log->debug(
"survey id = " . $this->
getId());
3262 $this->svy_log->debug(
"question pool id = " . $svy_qpl_id);
3265 $config = $imp->getConfig(
"Modules/Survey");
3266 $config->setQuestionPoolID($svy_qpl_id);
3267 $imp->getMapping()->addMapping(
"Modules/Survey",
"svy", 0, $this->
getId());
3268 $imp->importFromDirectory($import_subdir,
"svy",
"Modules/Survey");
3269 $this->svy_log->debug(
"config(Modules/survey)->getQuestionPoolId =" .
$config->getQuestionPoolID());
3275 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject
3279 $this->loadFromDb();
3282 $svy_type = $this->getMode();
3285 $newObj = parent::cloneObject(
$target_id, $copy_id, $omit_tree);
3286 $this->cloneMetaData($newObj);
3287 $newObj->updateMetaData();
3289 $newObj->setAuthor($this->getAuthor());
3290 $newObj->setIntroduction($this->getIntroduction());
3291 $newObj->setOutro($this->getOutro());
3292 $newObj->setEvaluationAccess($this->getEvaluationAccess());
3293 $newObj->setStartDate($this->getStartDate());
3294 $newObj->setEndDate($this->getEndDate());
3295 $newObj->setAnonymize($this->getAnonymize());
3296 $newObj->setShowQuestionTitles($this->getShowQuestionTitles());
3297 $newObj->setPoolUsage($this->getPoolUsage());
3298 $newObj->setViewOwnResults($this->hasViewOwnResults());
3299 $newObj->setMailOwnResults($this->hasMailOwnResults());
3300 $newObj->setMailConfirmation($this->hasMailConfirmation());
3301 $newObj->setAnonymousUserList($this->hasAnonymousUserList());
3303 $newObj->setMode($this->getMode());
3304 $newObj->set360SelfEvaluation($this->get360SelfEvaluation());
3305 $newObj->set360SelfAppraisee($this->get360SelfAppraisee());
3306 $newObj->set360SelfRaters($this->get360SelfRaters());
3307 $newObj->set360Results($this->get360Results());
3308 $newObj->setSkillService($this->getSkillService());
3311 $newObj->setReminderStatus($this->getReminderStatus());
3312 $newObj->setReminderStart($this->getReminderStart());
3313 $newObj->setReminderEnd($this->getReminderEnd());
3314 $newObj->setReminderFrequency($this->getReminderFrequency());
3315 $newObj->setReminderTarget($this->getReminderTarget());
3316 $newObj->setReminderTemplate($this->getReminderTemplate());
3318 $newObj->setTutorNotificationStatus($this->getTutorNotificationStatus());
3319 $newObj->setTutorNotificationRecipients($this->getTutorNotificationRecipients());
3320 $newObj->setTutorNotificationTarget($this->getTutorNotificationTarget());
3321 $newObj->setTutorResultsStatus($this->getTutorResultsStatus());
3322 $newObj->setTutorResultsRecipients($this->getTutorResultsRecipients());
3324 $newObj->setMailNotification($this->getMailNotification());
3325 $newObj->setMailAddresses($this->getMailAddresses());
3326 $newObj->setMailParticipantData($this->getMailParticipantData());
3328 $question_pointer = array();
3332 foreach ($this->questions as
$key => $question_id) {
3334 $question = self::_instanciateQuestion($question_id);
3338 $question->setObjId($newObj->getId());
3339 $question->saveToDb($original_id);
3340 $newObj->questions[
$key] = $question->getId();
3341 $question_pointer[$question_id] = $question->getId();
3342 $mapping[$question_id] = $question->getId();
3349 if (!$cp_options->isRootNode($this->getRefId())) {
3350 $newObj->setOfflineStatus($this->getOfflineStatus());
3353 $newObj->saveToDb();
3354 $newObj->cloneTextblocks($mapping);
3357 if (($svy_type === self::MODE_360 || $svy_type === self::MODE_SELF_EVAL) &&
3358 $this->getSkillService()) {
3362 foreach ($mapping as $src_qst_id => $tgt_qst_id) {
3363 $qst_skill = $src_skills->getSkillForQuestion($src_qst_id);
3365 $tgt_skills->addQuestionSkillAssignment($tgt_qst_id, $qst_skill[
"base_skill_id"], $qst_skill[
"tref_id"]);
3370 $thresholds->cloneTo($newObj, $mapping);
3374 $questionblocks = array();
3375 $questionblock_questions = array();
3376 $result =
$ilDB->queryF(
3377 "SELECT * FROM svy_qblk_qst WHERE survey_fi = %s",
3379 array($this->getSurveyId())
3381 if ($result->numRows() > 0) {
3382 while ($row =
$ilDB->fetchAssoc($result)) {
3383 $questionblock_questions[] = $row;
3384 $questionblocks[$row[
"questionblock_fi"]] = $row[
"questionblock_fi"];
3388 foreach ($questionblocks as
$key => $value) {
3389 $questionblock = self::_getQuestionblock(
$key);
3390 $questionblock_id = self::_addQuestionblock(
3391 (
string) $questionblock[
"title"],
3392 (
int) $questionblock[
"owner_fi"],
3393 (
bool) $questionblock[
"show_questiontext"],
3394 (
bool) $questionblock[
"show_blocktitle"],
3395 (
bool) $questionblock[
"compress_view"]
3397 $questionblocks[
$key] = $questionblock_id;
3400 foreach ($questionblock_questions as
$key => $value) {
3401 if ($questionblocks[$value[
"questionblock_fi"]] &&
3402 $question_pointer[$value[
"question_fi"]]) {
3403 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
3404 $affectedRows =
$ilDB->manipulateF(
3405 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) " .
3406 "VALUES (%s, %s, %s, %s)",
3407 array(
'integer',
'integer',
'integer',
'integer'),
3408 array($next_id, $newObj->getSurveyId(), $questionblocks[$value[
"questionblock_fi"]], $question_pointer[$value[
"question_fi"]])
3414 $constraints = self::_getConstraints($this->getSurveyId());
3415 $newConstraints = array();
3416 foreach ($constraints as
$key => $constraint) {
3417 if ($question_pointer[$constraint[
"for_question"]] &&
3418 $question_pointer[$constraint[
"question"]]) {
3419 if (!array_key_exists($constraint[
'id'], $newConstraints)) {
3420 $constraint_id = $newObj->addConstraint($question_pointer[$constraint[
"question"]], $constraint[
"relation_id"], $constraint[
"value"], $constraint[
'conjunction']);
3421 $newConstraints[$constraint[
'id']] = $constraint_id;
3423 $newObj->addConstraintToQuestion($question_pointer[$constraint[
"for_question"]], $newConstraints[$constraint[
'id']]);
3429 $obj_settings->cloneSettings($newObj->getId());
3430 unset($obj_settings);
3442 $result =
$ilDB->queryF(
3443 "SELECT * FROM svy_svy_qst WHERE question_fi = %s",
3447 if ($row =
$ilDB->fetchAssoc($result)) {
3448 return $row[
"heading"] ??
"";
3462 foreach ($mapping as $original_id => $new_id) {
3463 $textblock = $this->getTextblock($original_id);
3478 if (!is_writable($svy_data_dir)) {
3479 throw new ilSurveyException(
"Survey Data Directory (" . $svy_data_dir .
") not writeable.");
3483 $svy_dir = $svy_data_dir .
"/svy_" . $this->
getId();
3485 if (!is_dir($svy_dir)) {
3489 $export_dir = $svy_dir .
"/export";
3491 if (!is_dir($export_dir)) {
3517 if (!is_writable($svy_data_dir)) {
3518 throw new ilSurveyException(
"Survey Data Directory (" . $svy_data_dir .
") not writeable.");
3522 $svy_dir = $svy_data_dir .
"/svy_" . $this->
getId();
3524 if (!is_dir($svy_dir)) {
3529 $import_dir = $svy_dir .
"/import";
3531 if (!is_dir($import_dir)) {
3543 "/svy_" . $this->
getId() .
"/import";
3544 if (!is_dir($import_dir)) {
3547 if (is_dir($import_dir)) {
3566 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3567 array(
'text',
'integer',
'integer'),
3568 array($heading, $this->getSurveyId(), $insertbefore)
3572 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
3573 array(
'text',
'integer',
'integer'),
3574 array(
null, $this->getSurveyId(), $insertbefore)
3587 $result =
$ilDB->queryF(
3588 "SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
3589 array(
'text',
'integer'),
3590 array(
$key, $this->getSurveyId())
3592 return $result->numRows() === 1;
3605 array $a_codes =
null,
3612 $sql =
"SELECT svy_anonymous.*, svy_finished.state" .
3613 " FROM svy_anonymous" .
3614 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
3615 " WHERE svy_anonymous.survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
3616 " AND svy_anonymous.user_key IS NULL";
3619 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.survey_key", $a_codes,
"",
"text");
3621 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.anonymous_id", $a_ids,
"",
"text");
3628 $titles[] =
'"' .
$lng->txt(
"survey_code") .
'"';
3629 $titles[] =
'"' .
$lng->txt(
"email") .
'"';
3630 $titles[] =
'"' .
$lng->txt(
"lastname") .
'"';
3631 $titles[] =
'"' .
$lng->txt(
"firstname") .
'"';
3632 $titles[] =
'"' .
$lng->txt(
"create_date") .
'"';
3633 $titles[] =
'"' .
$lng->txt(
"used") .
'"';
3634 $titles[] =
'"' .
$lng->txt(
"mail_sent_short") .
'"';
3635 $titles[] =
'"' .
$lng->txt(
"survey_code_url") .
'"';
3636 $export[] = implode(
";", $titles);
3638 $result =
$ilDB->query($sql);
3639 $default_lang =
$ilUser->getPref(
"survey_code_language");
3640 while ($row =
$ilDB->fetchAssoc($result)) {
3642 $item[] = $row[
"survey_key"];
3644 if ($row[
"externaldata"]) {
3645 $ext = unserialize($row[
"externaldata"], [
'allowed_classes' =>
false]);
3646 $item[] = $ext[
"email"];
3647 $item[] = $ext[
"lastname"];
3648 $item[] = $ext[
"firstname"];
3659 $item[] = ($this->isSurveyCodeUsed($row[
"survey_key"])) ? 1 : 0;
3660 $item[] = ($row[
"sent"]) ? 1 : 0;
3662 $params = array(
"accesscode" => $row[
"survey_key"]);
3663 if ($default_lang) {
3664 $params[
"lang"] = $default_lang;
3668 $export[] =
'"' . implode(
'";"', $item) .
'"';
3670 return implode(
"\n", $export);
3686 $sql =
"SELECT svy_anonymous.*, svy_finished.state" .
3687 " FROM svy_anonymous" .
3688 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
3689 " WHERE svy_anonymous.survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer")
3693 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.anonymous_id", $ids,
"",
"integer");
3696 $sql .=
" ORDER BY tstamp, survey_key ASC";
3697 $result =
$ilDB->query($sql);
3698 if ($result->numRows() > 0) {
3699 while ($row =
$ilDB->fetchAssoc($result)) {
3702 if ($this->isSurveyCodeUsed($row[
"survey_key"])) {
3705 $params = array(
"accesscode" => $row[
"survey_key"]);
3714 'id' => $row[
"anonymous_id"],
3715 'code' => $row[
"survey_key"],
3716 'date' => $row[
"tstamp"],
3718 'sent' => $row[
'sent'],
3725 if ($row[
"externaldata"]) {
3726 $ext = unserialize($row[
"externaldata"], [
'allowed_classes' =>
false]);
3727 $item[
'email'] = $ext[
'email'] ??
"";
3728 $item[
'last_name'] = $ext[
'lastname'] ??
"";
3729 $item[
'first_name'] = $ext[
'firstname'] ??
"";
3745 $result =
$ilDB->queryF(
3746 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
3747 array(
'integer',
'text'),
3748 array($this->getSurveyId(), $code)
3750 return $result->numRows() > 0;
3760 $result =
$ilDB->queryF(
3761 "SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
3762 array(
'integer',
'text'),
3763 array($this->getSurveyId(), $code)
3765 return !(($result->numRows() > 0));
3772 string $a_anonymize_key,
3778 $next_id =
$ilDB->nextId(
'svy_anonymous');
3780 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
3781 "VALUES (%s, %s, %s, %s, %s)",
3782 array(
'integer',
'text',
'integer',
'text',
'integer'),
3783 array($next_id, $a_anonymize_key, $this->getSurveyId(), serialize($a_data), $a_created)
3802 $check_finished = ($not_sent > 1);
3806 $recipients = $this->getExternalCodeRecipients($check_finished);
3807 foreach ($recipients as
$data) {
3810 switch ($not_sent) {
3812 $do_send = !(bool)
$data[
'sent'];
3816 $do_send =
$data[
'finished'];
3820 $do_send = !
$data[
'finished'];
3834 "accesscode" =>
$data[
"code"],
3838 $messagetext = str_replace(
'[url]',
$url, $messagetext);
3840 $messagetext = str_replace(
'[' .
$key .
']', $value, $messagetext);
3858 "UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
3859 array(
'integer',
'integer'),
3860 array(1, $this->getSurveyId())
3868 bool $a_check_finished =
false
3871 $result =
$ilDB->queryF(
3872 "SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
3874 array($this->getSurveyId())
3877 while ($row =
$ilDB->fetchAssoc($result)) {
3878 if (!$row[
'externaldata']) {
3882 $externaldata = unserialize($row[
'externaldata'], [
'allowed_classes' =>
false]);
3883 if (!$externaldata[
'email']) {
3887 $externaldata[
'code'] = $row[
'code'];
3888 $externaldata[
'sent'] = $row[
'sent'];
3890 if ($a_check_finished) {
3893 $externaldata[
'finished'] = $this->isSurveyFinishedByCode($row[
'code']);
3896 $res[] = $externaldata;
3909 $result = $this->db->queryF(
3910 "SELECT state FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
3911 array(
'integer',
'text'),
3912 array($this->getSurveyId(), $a_code)
3915 $row = $this->db->fetchAssoc($result);
3917 return $row[
'state'] ??
false;
3928 if ($survey_code !==
'') {
3929 $affectedRows =
$ilDB->manipulateF(
3930 "DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
3931 array(
'integer',
'text'),
3932 array($this->getSurveyId(), $survey_code)
3947 $result =
$ilDB->queryF(
3948 "SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
3949 array(
'integer',
'text'),
3950 array($this->getSurveyId(), md5($user_id))
3952 if ($result->numRows()) {
3953 $row =
$ilDB->fetchAssoc($result);
3954 $access_code = $row[
"survey_key"];
3956 return $access_code;
3973 $next_id =
$ilDB->nextId(
'svy_anonymous');
3974 $affectedRows =
$ilDB->manipulateF(
3975 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) " .
3976 "VALUES (%s, %s, %s, %s, %s)",
3977 array(
'integer',
'text',
'integer',
'text',
'integer'),
3978 array($next_id, $access_code, $this->getSurveyId(), md5($user_id), time())
3991 $result =
$ilDB->queryF(
3992 "SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
3996 if ($result->numRows()) {
3997 $row =
$ilDB->fetchAssoc($result);
3998 return (
int) $row[
"tstamp"];
4000 $result =
$ilDB->queryF(
4001 "SELECT tstamp FROM svy_finished WHERE finished_id = %s",
4005 if ($result->numRows()) {
4006 $row =
$ilDB->fetchAssoc($result);
4007 return (
int) $row[
"tstamp"];
4029 if (preg_match(
"/<[^>]*?>/", $a_text)) {
4043 bool $close_material_tag =
true,
4044 bool $add_mobs =
true,
4045 array $attribs =
null
4047 $a_xml_writer->xmlStartTag(
"material", $attribs);
4049 "type" =>
"text/plain"
4051 if ($this->isHTML($a_material)) {
4052 $attrs[
"type"] =
"text/xhtml";
4055 $a_xml_writer->
xmlElement(
"mattext", $attrs, $mattext);
4059 foreach (
$mobs as $mob) {
4060 $mob_id =
"il_" .
IL_INST_ID .
"_mob_" . $mob;
4061 if (strpos($mattext, $mob_id) !==
false) {
4065 "uri" =>
"objects/" .
"il_" .
IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
4066 "type" =>
"svy:html",
4067 "id" => $this->getId()
4069 $a_xml_writer->
xmlElement(
"matimage", $imgattrs,
null);
4073 if ($close_material_tag) {
4087 if ($this->getAnonymize() !== self::ANONYMIZE_OFF) {
4088 if ($this->surveyCodeSecurity ===
false) {
4110 $this->survey_id = $survey_id;
4125 if (count($ids) === 0) {
4129 $result =
$ilDB->query(
"SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " .
$ilDB->in(
'usr_id', $ids,
false,
'integer') .
" ORDER BY login");
4130 $result_array = array();
4131 while ($row =
$ilDB->fetchAssoc($result)) {
4132 $result_array[$row[
"usr_id"]] = $row;
4134 return $result_array;
4142 return $this->mailnotification;
4150 $this->mailnotification = $a_notification;
4158 return $this->mailaddresses;
4166 $this->mailaddresses = $a_addresses;
4174 return $this->mailparticipantdata;
4182 $this->mailparticipantdata = $a_data;
4193 $result =
$ilDB->queryF(
4194 "SELECT * FROM svy_times WHERE finished_fi = %s",
4199 while ($row =
$ilDB->fetchAssoc($result)) {
4200 if ($row[
'left_page'] > 0 && $row[
'entered_page'] > 0) {
4201 $total += $row[
'left_page'] - $row[
'entered_page'];
4210 if (count($this->questions) === count($a_order)) {
4211 $this->questions = array_flip($a_order);
4212 $this->saveQuestionsToDb();
4218 return $this->pool_usage;
4223 $this->pool_usage = $a_value;
4232 string $a_last_name,
4233 string $a_first_name,
4238 $a_email = trim($a_email);
4245 $data = array(
"email" => $a_email,
4246 "lastname" => trim($a_last_name),
4247 "firstname" => trim($a_first_name));
4250 "externaldata" => array(
"text", serialize(
$data)),
4251 "sent" => array(
"integer", $a_sent)
4257 array(
"anonymous_id" => array(
"integer", $a_id))
4270 if ($this->getMode() === self::MODE_360) {
4278 $this->mode_360_self_eval = $a_value;
4283 return $this->mode_360_self_eval;
4288 $this->mode_360_self_appr = $a_value;
4293 return $this->mode_360_self_appr;
4298 $this->mode_360_self_rate = $a_value;
4303 return $this->mode_360_self_rate;
4308 $this->mode_360_results = $a_value;
4313 return $this->mode_360_results;
4325 $access =
$DIC->access();
4327 if (!$this->isAppraisee($a_user_id) &&
4330 "obj_id" => array(
"integer", $this->getSurveyId()),
4331 "user_id" => array(
"integer", $a_user_id)
4333 $ilDB->insert(
"svy_360_appr", $fields);
4337 $this->sendAppraiseeNotification($a_user_id);
4350 $ntf->setRefId($this->getRefId());
4351 $ntf->setGotoLangId(
'url');
4354 $lng = $ntf->getUserLanguage($a_user_id);
4356 $ntf->setIntroductionLangId(
"svy_user_added_appraisee_mail");
4357 $subject = str_replace(
"%1", $this->getTitle(),
$lng->txt(
"svy_user_added_appraisee"));
4366 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
4379 $ntf->setRefId($this->getRefId());
4380 $ntf->setGotoLangId(
'url');
4383 $lng = $ntf->getUserLanguage($a_user_id);
4385 $ntf->setIntroductionLangId(
"svy_user_added_appraisee_close_mail");
4386 $subject = str_replace(
"%1", $this->getTitle(),
$lng->txt(
"svy_user_added_appraisee"));
4395 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
4409 $ntf->setRefId($this->getRefId());
4410 $ntf->setGotoLangId(
'url');
4413 $lng = $ntf->getUserLanguage($a_user_id);
4415 $ntf->setIntroductionLangId(
"svy_user_added_rater_mail");
4416 $subject = str_replace(
"%1", $this->getTitle(),
$lng->txt(
"svy_user_added_rater"));
4426 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
4438 $set =
$ilDB->query(
"SELECT user_id" .
4439 " FROM svy_360_appr" .
4440 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4441 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
4442 return (
bool)
$ilDB->numRows($set);
4453 $set =
$ilDB->query(
"SELECT has_closed" .
4454 " FROM svy_360_appr" .
4455 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4456 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
4457 $row =
$ilDB->fetchAssoc($set);
4458 return (
bool) ($row[
"has_closed"] ??
false);
4469 $ilDB->manipulate(
"DELETE FROM svy_360_appr" .
4470 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4471 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
4473 $set =
$ilDB->query(
"SELECT user_id" .
4474 " FROM svy_360_rater" .
4475 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4476 " AND appr_id = " .
$ilDB->quote($a_user_id,
"integer"));
4477 while ($row =
$ilDB->fetchAssoc($set)) {
4478 $this->deleteRater($a_user_id, $row[
"user_id"]);
4481 if ($this->get360SelfEvaluation()) {
4482 $this->deleteRater($a_user_id, $a_user_id);
4495 $set =
$ilDB->query(
"SELECT * FROM svy_360_appr" .
4496 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
4497 while ($row =
$ilDB->fetchAssoc($set)) {
4504 $raters = $this->getRatersData($row[
"user_id"]);
4505 foreach ($raters as $rater) {
4506 if ($rater[
"finished"]) {
4510 $res[$row[
"user_id"]][
"finished"] = $finished .
"/" . count($raters);
4511 $res[$row[
"user_id"]][
"closed"] = $row[
"has_closed"];
4521 int $a_appraisee_id,
4523 int $a_anonymous_id = 0
4528 $access =
$DIC->access();
4530 if ($this->isAppraisee($a_appraisee_id) &&
4531 !$this->isRater($a_appraisee_id, $a_user_id, $a_anonymous_id)) {
4533 "obj_id" => array(
"integer", $this->getSurveyId()),
4534 "appr_id" => array(
"integer", $a_appraisee_id),
4535 "user_id" => array(
"integer", $a_user_id),
4536 "anonymous_id" => array(
"integer", $a_anonymous_id)
4538 $ilDB->insert(
"svy_360_rater", $fields);
4542 $this->sendRaterNotification($a_user_id, $a_appraisee_id);
4551 int $a_appraisee_id,
4553 int $a_anonymous_id = 0
4558 if ($this->isAppraisee($a_user_id) &&
4559 $this->get360SelfEvaluation() &&
4560 (!$a_appraisee_id || $a_appraisee_id === $a_user_id)) {
4566 $sql =
"SELECT user_id" .
4567 " FROM svy_360_rater" .
4568 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4569 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
4570 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer");
4571 if ($a_appraisee_id) {
4572 $sql .=
" AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer");
4574 $set =
$ilDB->query($sql);
4575 return (
bool)
$ilDB->numRows($set);
4582 int $a_appraisee_id,
4584 int $a_anonymous_id = 0
4588 $finished_id = $this->getFinishedIdForAppraiseeIdAndRaterId($a_appraisee_id, $a_user_id);
4590 $this->removeSelectedSurveyResults(array($finished_id));
4593 $ilDB->manipulate(
"DELETE FROM svy_360_rater" .
4594 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4595 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer") .
4596 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
4597 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer"));
4608 $res = $anonymous_ids = array();
4610 $set =
$ilDB->query(
"SELECT * FROM svy_360_rater" .
4611 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4612 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer"));
4613 while ($row =
$ilDB->fetchAssoc($set)) {
4614 if ($row[
"anonymous_id"]) {
4615 $res[
"a" . $row[
"anonymous_id"]] = array(
4616 "lastname" =>
"unknown code " . $row[
"anonymous_id"],
4617 "sent" => $row[
"mail_sent"],
4620 $anonymous_ids[] = $row[
"anonymous_id"];
4626 $name[
"sent"] = $row[
"mail_sent"];
4627 $name[
"finished"] = (bool) $this->is360SurveyStarted($a_appraisee_id, (
int) $row[
"user_id"]);
4632 if (count($anonymous_ids)) {
4633 $data = $this->getSurveyCodesTableData($anonymous_ids);
4634 foreach (
$data as $item) {
4635 if (isset(
$res[
"a" . $item[
"id"]])) {
4636 $res[
"a" . $item[
"id"]] = array(
4637 "user_id" =>
"a" . $item[
"id"],
4638 "lastname" => $item[
"last_name"],
4639 "firstname" => $item[
"first_name"],
4640 "name" => $item[
"last_name"] .
", " . $item[
"first_name"],
4642 "email" => $item[
"email"],
4643 "code" => $item[
"code"],
4644 "href" => $item[
"href"],
4645 "sent" =>
$res[
"a" . $item[
"id"]][
"sent"],
4646 "finished" => (
bool) $this->is360SurveyStarted($a_appraisee_id, 0, $item[
"code"])
4661 int $a_anonymous_id =
null
4667 $sql =
"SELECT appr_id FROM svy_360_rater" .
4668 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer");
4671 $sql .=
" AND user_id = " .
$ilDB->quote($a_user_id,
"integer");
4673 $sql .=
" AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer");
4676 $set =
$ilDB->query($sql);
4677 while ($row =
$ilDB->fetchAssoc($set)) {
4678 $res[] = (
int) $row[
"appr_id"];
4682 if ($this->get360SelfEvaluation() &&
4683 $this->isAppraisee((
int) $a_user_id) &&
4684 !in_array($a_user_id,
$res)) {
4685 $res[] = $a_user_id;
4698 $set =
$ilDB->query(
"SELECT anonymous_id FROM svy_anonymous" .
4699 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4700 " AND survey_key = " .
$ilDB->quote($a_code,
"text"));
4702 return $res[
"anonymous_id"] ??
null;
4711 string $anonymous_code =
null
4715 $sql =
"SELECT * FROM svy_finished" .
4716 " WHERE survey_fi =" .
$ilDB->quote($this->getSurveyId(),
"integer") .
4717 " AND appr_id = " .
$ilDB->quote($appr_id,
"integer");
4719 $sql .=
" AND user_fi = " .
$ilDB->quote($user_id,
"integer");
4721 $sql .=
" AND anonymous_id = " .
$ilDB->quote($anonymous_code,
"text");
4723 $result =
$ilDB->query($sql);
4724 if ($result->numRows() === 0) {
4727 $row =
$ilDB->fetchAssoc($result);
4728 return (
int) $row[
"state"];
4741 string $a_code =
null
4747 if (!$this->isAccessibleWithoutCode()) {
4750 if ($this->feature_config->usesAppraisees() &&
4752 $this->isRater(0, $user_id)) {
4754 $code = $this->data_manager->code(
"")
4755 ->withUserId($user_id);
4756 $this->code_manager->add($code);
4757 $a_code = $this->code_manager->getByUserId($user_id);
4763 $this->getAnonymize() === self::ANONYMIZE_FREEACCESS) {
4768 $code = $this->data_manager->code(
"")
4769 ->withUserId($user_id);
4770 $code_id = $this->code_manager->add($code);
4771 $a_code = $this->code_manager->getByCodeId($code_id);
4780 $sql =
"SELECT * FROM svy_finished" .
4781 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer");
4784 $sql .=
" AND (user_fi = " .
$ilDB->quote($user_id,
"integer") .
4785 " OR anonymous_id = " .
$ilDB->quote($a_code,
"text") .
")";
4789 $sql .=
" AND anonymous_id = " .
$ilDB->quote($a_code,
"text");
4791 $set =
$ilDB->query($sql);
4792 while ($row =
$ilDB->fetchAssoc($set)) {
4793 $res[$row[
"finished_id"]] = array(
"appr_id" => $row[
"appr_id"],
4794 "user_id" => $row[
"user_fi"],
4795 "code" => $row[
"anonymous_id"],
4796 "finished" => (
bool) $row[
"state"]);
4798 return array(
"code" => $a_code,
"runs" =>
$res);
4810 $set =
$ilDB->query(
"SELECT sf.anonymous_id FROM svy_finished sf" .
4811 " WHERE sf.survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4812 " AND sf.user_fi = " .
$ilDB->quote($a_user_id,
"integer"));
4813 $a_code =
$ilDB->fetchAssoc($set);
4814 return (
string) ($a_code[
"anonymous_id"] ??
"");
4828 $set =
$ilDB->query(
"SELECT user_fi FROM svy_finished" .
4829 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4830 " AND anonymous_id = " .
$ilDB->quote($a_code,
"text"));
4831 $user_id =
$ilDB->fetchAssoc($set);
4832 $user_id = (
int) $user_id[
"user_fi"];
4846 bool $a_exclude_appraisee =
false
4852 $set =
$ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished" .
4853 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4854 " AND appr_id = " .
$ilDB->quote($a_appr_id,
"integer"));
4855 while ($row =
$ilDB->fetchAssoc($set)) {
4856 if ($a_exclude_appraisee && $row[
"user_fi"] == $a_appr_id) {
4859 $res[] = (
int) $row[
"finished_id"];
4875 $set =
$ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished" .
4876 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4877 " AND appr_id = " .
$ilDB->quote($a_appr_id,
"integer") .
4878 " AND user_fi = " .
$ilDB->quote($a_rat_id,
"integer"));
4879 if ($row =
$ilDB->fetchAssoc($set)) {
4880 return (
int) $row[
"finished_id"];
4890 $this->mode_skill_service = $a_val;
4895 return $this->mode_skill_service;
4902 int $a_appraisee_id,
4904 int $a_anonymous_id,
4905 int $a_tstamp =
null
4913 $ilDB->manipulate(
"UPDATE svy_360_rater" .
4914 " SET mail_sent = " .
$ilDB->quote($a_tstamp,
"integer") .
4915 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4916 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer") .
4917 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
4918 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer"));
4930 $user =
$DIC->user();
4933 $ilDB->manipulate(
"UPDATE svy_360_appr" .
4934 " SET has_closed = " .
$ilDB->quote(time(),
"integer") .
4935 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
4936 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
4940 if ($this->getSkillService() && $skmg_set->isActivated()) {
4942 $sskill->writeAndAddAppraiseeSkills($a_user_id);
4946 if ($user->
getId() !== $a_user_id) {
4947 $this->sendAppraiseeCloseNotification($a_user_id);
4958 $ilDB->manipulate(
"UPDATE svy_360_appr" .
4959 " SET has_closed = " .
$ilDB->quote(
null,
"integer") .
4960 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
4966 public static function validateExternalRaterCode(
4973 $anonym_repo =
$DIC->survey()
4979 if (!$anonym_repo->isExternalRaterValidated($a_ref_id)) {
4980 $svy =
new self($a_ref_id);
4983 $domain_service =
$DIC->survey()->internal()->domain();
4984 $code_manager = $domain_service->code($svy, 0);
4985 $feature_config = $domain_service->modeFeatureConfig($svy->getMode());
4986 $access_manager = $domain_service->access($a_ref_id, 0);
4988 if ($access_manager->canStartSurvey() &&
4990 $code_manager->exists($a_code)) {
4991 $anonymous_id = $svy->getAnonymousIdByCode($a_code);
4992 if ($anonymous_id) {
4993 if (count($svy->getAppraiseesToRate(
null, $anonymous_id))) {
4994 $anonym_repo->setExternalRaterValidation($a_ref_id,
true);
4999 $anonym_repo->setExternalRaterValidation($a_ref_id,
false);
5003 return $anonym_repo->isExternalRaterValidated($a_ref_id);
5013 return $this->reminder_status;
5018 $this->reminder_status = $a_value;
5023 return $this->reminder_start;
5028 $this->reminder_start = $a_value;
5033 return $this->reminder_end;
5038 $this->reminder_end = $a_value;
5043 return $this->reminder_frequency;
5048 $this->reminder_frequency = $a_value;
5053 return $this->reminder_target;
5058 $this->reminder_target = $a_value;
5063 return $this->reminder_last_sent;
5068 if ($a_value ==
"") {
5071 $this->reminder_last_sent = $a_value;
5075 bool $selectDefault =
false
5077 if ($selectDefault) {
5078 $defaultTemplateId = 0;
5079 $this->getReminderMailTemplates($defaultTemplateId);
5081 if ($defaultTemplateId > 0) {
5082 return $defaultTemplateId;
5086 return $this->reminder_tmpl;
5091 $this->reminder_tmpl = $a_value;
5096 return $this->tutor_ntf_status;
5104 $this->tutor_ntf_status = $a_value;
5112 return $this->tutor_ntf_recipients;
5120 $this->tutor_ntf_recipients = $a_value;
5131 return $this->tutor_ntf_target;
5136 $this->tutor_ntf_target = $a_value;
5141 return $this->tutor_res_status;
5146 $this->tutor_res_status = $a_value;
5151 return $this->tutor_res_recipients;
5156 $this->tutor_res_recipients = $a_value;
5167 if ($this->getTutorNotificationStatus()) {
5171 $user_ids = $this->getNotificationTargetUserIds(($this->getTutorNotificationTarget() === self::NOTIFICATION_INVITED_USERS));
5173 $set =
$ilDB->query(
"SELECT COUNT(*) numall FROM svy_finished" .
5174 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5175 " AND state = " .
$ilDB->quote(1,
"integer") .
5176 " AND " .
$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
5177 $row =
$ilDB->fetchAssoc($set);
5180 if ((
int) $row[
"numall"] === count($user_ids)) {
5181 $this->sendTutorNotification();
5194 $access =
$DIC->access();
5196 $rater_ids = array();
5197 foreach ($this->getAppraiseesData() as
$app) {
5198 $this->svy_log->debug(
"Handle appraisee " .
$app[
'user_id']);
5200 if (!$this->isAppraiseeClosed(
$app[
'user_id'])) {
5201 $this->svy_log->debug(
"Check self evaluation, self: " . $this->get360SelfAppraisee() .
", target: " . $this->getReminderTarget());
5204 if ($this->get360SelfEvaluation() &&
5205 in_array($this->getReminderTarget(), array(self::NOTIFICATION_APPRAISEES, self::NOTIFICATION_APPRAISEES_AND_RATERS))) {
5206 $this->svy_log->debug(
"...1");
5208 if (!$this->is360SurveyStarted((
int)
$app[
'user_id'], (
int)
$app[
'user_id'])) {
5209 $this->svy_log->debug(
"...2");
5210 if (!isset($rater_ids[
$app[
'user_id']])) {
5211 $rater_ids[
$app[
'user_id']] = array();
5213 if (!isset(
$app[
"user_id"], $rater_ids[
$app[
'user_id']])) {
5214 $rater_ids[
$app[
'user_id']][] =
$app[
"user_id"];
5219 $this->svy_log->debug(
"Check raters.");
5224 $this->getReminderTarget(),
5225 array(self::NOTIFICATION_RATERS, self::NOTIFICATION_APPRAISEES_AND_RATERS),
5229 foreach ($this->getRatersData(
$app[
'user_id']) as $rater) {
5231 if ($rater[
"login"] !==
"") {
5234 if ($rater_id > 0) {
5236 if (!($rater[
"anonymous_id"] ??
false) && !($rater[
"finished"] ??
false)) {
5237 if (!isset($rater_ids[$rater_id])) {
5238 $rater_ids[$rater_id] = array();
5240 if (!in_array(
$app[
"user_id"], $rater_ids[$rater_id])) {
5241 $rater_ids[$rater_id][] =
$app[
"user_id"];
5250 $this->svy_log->debug(
"Found raters:" . count($rater_ids));
5252 foreach ($rater_ids as
$id =>
$app) {
5254 $this->send360ReminderToUser((
int)
$id,
$app);
5261 array $a_appraisee_ids
5263 $this->svy_log->debug(
"Send mail to:" . $a_user_id);
5266 $ntf->setLangModules(array(
"svy",
"survey"));
5267 $ntf->setRefId($this->getRefId());
5268 $ntf->setGotoLangId(
'url');
5271 $lng = $ntf->getUserLanguage($a_user_id);
5273 $ntf->setIntroductionLangId(
"svy_user_added_rater_reminder_mail");
5274 $subject = str_replace(
"%1", $this->getTitle(),
$lng->txt(
"svy_user_added_rater"));
5276 foreach ($a_appraisee_ids as $appraisee_id) {
5287 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
5302 $tree = $this->tree;
5305 if ($a_use_invited) {
5306 $user_ids = $this->invitation_manager->getAllForSurvey($this->getSurveyId());
5308 $parent_grp_ref_id = $tree->checkForParentType($this->getRefId(),
"grp");
5309 if ($parent_grp_ref_id) {
5311 $user_ids = $part->getMembers();
5313 $parent_crs_ref_id = $tree->checkForParentType($this->getRefId(),
"crs");
5314 if ($parent_crs_ref_id) {
5316 $user_ids = $part->getMembers();
5331 foreach ($this->getTutorNotificationRecipients() as $user_id) {
5334 $ulng->loadLanguageModule(
'survey');
5336 $subject = sprintf($ulng->txt(
'survey_notification_tutor_subject'), $this->getTitle());
5339 $message .= $ulng->txt(
'survey_notification_tutor_body') .
":\n\n";
5340 $message .= $ulng->txt(
'obj_svy') .
": " . $this->getTitle() .
"\n";
5341 $message .=
"\n" . $ulng->txt(
'survey_notification_tutor_link') .
": " . $link;
5344 $mail_obj->appendInstallationSignature(
true);
5359 $ilAccess = $this->access;
5362 $now_with_format = date(
"YmdHis", $now);
5363 $today = date(
"Y-m-d");
5365 $this->svy_log->debug(
"Check status and dates.");
5369 $this->getOfflineStatus() ||
5370 !$this->getReminderStatus() ||
5371 ($this->getStartDate() && $now_with_format < $this->getStartDate()) ||
5372 ($this->getEndDate() && $now_with_format > $this->getEndDate())) {
5377 $start = $this->getReminderStart();
5381 $end = $this->getReminderEnd();
5385 if ($today < $start ||
5386 ($end && $today > $end)) {
5390 $this->svy_log->debug(
"Check access period.");
5395 ($now < $item_data[
"timing_start"] ||
5396 $now > $item_data[
"timing_end"])) {
5400 $this->svy_log->debug(
"Check frequency.");
5404 $cut->increment(
IL_CAL_DAY, $this->getReminderFrequency() * -1);
5405 if (!$this->getReminderLastSent() ||
5406 $cut->get(
IL_CAL_DATE) >= substr($this->getReminderLastSent(), 0, 10)) {
5407 $missing_ids = array();
5408 if (!$this->feature_config->usesAppraisees()) {
5409 $this->svy_log->debug(
"Entering survey mode.");
5412 $user_ids = $this->getNotificationTargetUserIds(($this->getReminderTarget() === self::NOTIFICATION_INVITED_USERS));
5415 $finished_ids = array();
5416 $set =
$ilDB->query(
"SELECT user_fi FROM svy_finished" .
5417 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5418 " AND state = " .
$ilDB->quote(1,
"text") .
5419 " AND " .
$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
5420 while ($row =
$ilDB->fetchAssoc($set)) {
5421 $finished_ids[] = $row[
"user_fi"];
5425 $missing_ids = array_diff($user_ids, $finished_ids);
5427 foreach ($missing_ids as $idx => $user_id) {
5429 if (!$ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->getId())) {
5430 unset($missing_ids[$idx]);
5435 $this->sentReminder($missing_ids);
5439 $this->svy_log->debug(
"Entering 360 mode.");
5441 $this->sent360Reminders();
5445 $this->setReminderLastSent($today);
5448 return count($missing_ids);
5454 protected function sentReminder(
5455 array $a_recipient_ids
5462 if ($this->getReminderTemplate() &&
5463 array_key_exists($this->getReminderTemplate(), $this->getReminderMailTemplates())) {
5465 $templateService =
$DIC[
'mail.texttemplates.service'];
5466 $tmpl = $templateService->loadTemplateForId($this->getReminderTemplate());
5468 $tmpl_params = array(
5469 "ref_id" => $this->getRefId(),
5474 $tmpl_params =
null;
5478 foreach ($a_recipient_ids as $user_id) {
5480 $subject = $tmpl->getSubject();
5481 $message = $this->sentReminderPlaceholders($tmpl->getMessage(), $user_id, $tmpl_params);
5487 $ulng->loadLanguageModule(
'survey');
5489 $subject = sprintf($ulng->txt(
'survey_reminder_subject'), $this->getTitle());
5492 $message .= $ulng->txt(
'survey_reminder_body') .
":\n\n";
5493 $message .= $ulng->txt(
'obj_svy') .
": " . $this->getTitle() .
"\n";
5494 $message .=
"\n" . $ulng->txt(
'survey_reminder_link') .
": " . $link;
5498 $mail_obj->appendInstallationSignature(
true);
5511 int $starting_time =
null
5513 $this->activation_starting_time = $starting_time;
5517 int $ending_time =
null
5519 $this->activation_ending_time = $ending_time;
5524 return $this->activation_starting_time;
5529 return $this->activation_ending_time;
5534 $this->view_own_results = $a_value;
5539 return $this->view_own_results;
5544 $this->mail_own_results = $a_value;
5549 return $this->mail_own_results;
5554 $this->mail_confirmation = $a_value;
5559 return $this->mail_confirmation;
5564 $this->anon_user_list = $a_value;
5569 return $this->anon_user_list;
5580 $surveySetting =
new ilSetting(
"survey");
5581 if (!$surveySetting->get(
"skipped_is_custom",
false)) {
5582 return $lng->txt(
"skipped");
5584 return $surveySetting->get(
"skipped_custom_value",
"");
5588 public function getReminderMailTemplates(
5589 int &$defaultTemplateId =
null
5596 $templateService =
$DIC[
'mail.texttemplates.service'];
5598 $res[$tmpl->getTplId()] = $tmpl->getTitle();
5599 if (
null !== $defaultTemplateId && $tmpl->isDefault()) {
5600 $defaultTemplateId = $tmpl->getTplId();
5610 array $a_context_params
5616 $user = new \ilObjUser($a_user_id);
5618 $processor = new \ilMailTemplatePlaceholderResolver(
$context, $a_message);
5619 $a_message = $processor->resolve($user, $a_context_params);
5620 }
catch (\Exception
$e) {
5629 $this->mode = $a_value;
5639 $this->mode_self_eval_results = $a_value;
5644 return $this->mode_self_eval_results;
5659 $q =
"SELECT obj_fi FROM svy_svy" .
5660 " WHERE tutor_res_cron IS NULL" .
5661 " AND tutor_res_status = " .
$ilDB->quote(1,
"integer") .
5662 " AND enddate < " .
$ilDB->quote(date(
"Ymd000000"),
"text");
5665 $q =
"SELECT obj_fi FROM svy_svy" .
5666 " WHERE tutor_res_status = " .
$ilDB->quote(1,
"integer") .
5667 " AND enddate < " .
$ilDB->quote(date(
"Ymd000000"),
"text");
5670 $set =
$ilDB->query($q);
5674 while ($row =
$ilDB->fetchAssoc($set)) {
5675 $res[] = (
int) $row[
"obj_fi"];
5685 $sum_score += call_user_func([
$c,
"getMaxSumScore"], $this->getSurveyId());
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getOriginalId(int $question_id, bool $a_return_question_id_if_no_original=true)
Returns the original id of a question.
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
static _isComplete(int $question_id)
Checks whether the question is complete or not.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getInstance(int $a_copy_id)
@classDescription Date and time handling
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDataDir()
get data directory (outside webspace)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
setLangModules(array $a_modules)
Class ilMailTemplateContextService.
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionClasses()
static _getQuestionTypeTranslations()
set360SelfAppraisee(bool $a_value)
sendRaterNotification(int $a_user_id, int $a_appraisee_id)
string $author
A text representation of the authors name.
isAccessibleWithoutCode()
isUnusedCode(string $a_code, int $a_user_id)
Participants InvitationsManager $invitation_manager
getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)
isPluginActive(string $a_pname)
getNextPage(int $active_page_question_id, int $direction)
Get current, previous or next page.
getAppraiseesToRate(?int $a_user_id, int $a_anonymous_id=null)
removeQuestionFromBlock(int $question_id, int $questionblock_id)
addRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
isSurveyCodeUsed(string $code)
setEndDateAndTime(string $end_date, string $end_time)
importSurveyCode(string $a_anonymize_key, int $a_created, array $a_data)
const EVALUATION_ACCESS_PARTICIPANTS
isSurveyFinishedByCode(string $a_code)
Get if survey is finished for a specific anonymous user code.
const RESULTS_SELF_EVAL_NONE
setStartDateAndTime(string $start_date, string $start_time)
getExternalCodeRecipients(bool $a_check_finished=false)
Mode FeatureConfig $feature_config
removeQuestion(int $question_id)
setAnonymousUserList(bool $a_value)
closeAppraisee(int $a_user_id)
bool $calculate_sum_score
moveQuestions(array $move_questions, int $target_index, int $insert_mode)
Move questions and/or questionblocks to another position.
getFinishedIdForAppraiseeIdAndRaterId(int $a_appr_id, int $a_rat_id)
Get finished id for an appraisee and a rater.
addAppraisee(int $a_user_id)
getUserSpecificResults(array $finished_ids)
Calculates the evaluation data for the user specific results.
getQuestionblockQuestions(int $questionblock_id)
getSurveyFinishedIds()
Get run ids.
setReminderStatus(bool $a_value)
sendNotificationMail(int $a_user_id, string $a_anonymize_id, int $a_appr_id=0)
These mails are sent to tutors for each single participant that finishes a survey.
string $mailparticipantdata
getActivationVisibility()
getTextblock(int $question_id)
int $activation_ending_time
setSelfEvaluationResults(int $a_value)
setTutorNotificationStatus(bool $a_value)
Activates mail being sent to tutors after all participants have finished the survey.
prepareTextareaOutput(string $txt_output)
Prepares a string for a text area output in surveys.
createImportDirectory()
creates data directory for import files (data_dir/svy_data/svy_<id>/import)
static _addQuestionblock(string $title="", int $owner=0, bool $show_questiontext=true, bool $show_blocktitle=false, bool $compress_view=false)
getAvailableQuestionpools(bool $use_obj_id=false, bool $could_be_offline=false, bool $showPath=false, string $permission="read")
Returns the available question pools for the active user.
__construct(int $a_id=0, bool $a_call_by_reference=true)
getUserSettings(int $usr_id, string $key)
setReminderLastSent(?string $a_value)
array $tutor_res_recipients
isQuestionInSurvey(int $a_question_fi)
set360Results(int $a_value)
getEvaluationByUser(array $questions, int $active_id)
Calculates the evaluation data for a given run.
setSurveyId(int $survey_id)
isQuestionInAnyBlock(int $a_question_fi)
sendAppraiseeNotification(int $a_user_id)
static _getQuestionblock(int $questionblock_id)
get question block properties
locateImportFiles(string $a_dir)
Locates the import directory and the xml file in a directory with an unzipped import file.
getTutorNotificationRecipients()
Mail being sent to tutors after all participants have finished the survey?
getSurveyQuestions(bool $with_answers=false)
Returns the survey questions and questionblocks in an array.
setOutro(string $outro="")
getSelfEvaluationResults()
int $activation_starting_time
addMaterialTag(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true, array $attribs=null)
Creates an XML material tag from a plain text or xhtml text.
addQuestion(int $question_id)
Adds a question to the survey (used in importer!)
setTutorResultsRecipients(array $a_value)
const NOTIFICATION_INVITED_USERS
const RESULTS_SELF_EVAL_ALL
updateConstraint(int $precondition_id, int $if_question_id, int $relation, float $value, int $conjunction)
getExistingQuestions()
Gets the question id's of the questions which are already in the survey.
deleteConstraint(int $constraint_id)
Deletes a single constraint.
setReminderTemplate(?int $a_value)
setSkillService(bool $a_val)
removeSelectedSurveyResults(array $finished_ids)
Deletes the user data of a given array of survey participants.
saveUserAccessCode(int $user_id, string $access_code)
Saves a survey access code for a registered user to the database.
setObligatoryStates(array $obligatory_questions)
Sets the obligatory states for questions in a survey from the questions form.
setIntroduction(string $introduction="")
setEndDate(string $end_date="")
ilPluginAdmin $plugin_admin
sendCodes(int $not_sent, string $subject, string $message, string $lang)
setStartDate(string $start_date="")
getQuestionblocksTable(array $arrFilter)
Retrieve data for question block browser.
getUserAccessCode(int $user_id)
Returns a survey access code that was saved for a registered user.
const NOTIFICATION_PARENT_COURSE
const EVALUATION_ACCESS_ALL
isRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
bool $activation_visibility
deleteWorkingData(int $question_id, int $active_id)
Deletes the working data of a question in the database.
int $mode_self_eval_results
getQuestionsTable(array $arrFilter)
Retrieve data for question browser.
setActivationEndDate(int $ending_time=null)
insertQuestionblock(int $questionblock_id)
getUserDataFromActiveId(int $active_id, bool $force_non_anonymous=false)
Returns run information.
getUserData(array $ids)
Returns a data of all users specified by id list.
getTutorNotificationTarget()
Group that is checked for the "all participants have finished" mail Either a) all members of a parent...
getNotificationTargetUserIds(bool $a_use_invited)
These users must finish the survey to trigger the tutor notification "all users finished the survey" ...
ILIAS SurveyQuestionPool Export ImportManager $import_manager
getFinishedIdsForAppraiseeId(int $a_appr_id, bool $a_exclude_appraisee=false)
const QUESTIONTITLES_VISIBLE
getLastActivePage(int $active_id)
Returns the question id of the last active page a user visited in a survey.
deleteSurveyCode(string $survey_code)
setReminderFrequency(int $a_value)
setShowQuestionTitles(bool $a_show)
toXML()
Returns a QTI xml representation of the survey.
getAnonymousIdByCode(string $a_code)
getLastAccess(int $finished_id)
sendTutorNotification()
Send mail to tutors after all participants have finished the survey.
getReminderTemplate(bool $selectDefault=false)
loadWorkingData(int $question_id, int $active_id)
Gets the given answer data of a question in a run.
deleteConstraints(int $question_id)
Deletes the constraints for a question.
getQuestionpoolTitles(bool $could_be_offline=false, bool $showPath=false)
Returns the available question pools for the active user.
const NOTIFICATION_APPRAISEES_AND_RATERS
setPage(int $finished_id, int $page_id)
Sets the number of the active survey page.
static getSurveysWithTutorResults()
static _getConstraints(int $survey_id)
saveUserSettings(int $usr_id, string $key, string $title, string $value)
const ANONYMIZE_FREEACCESS
int $survey_id
A unique positive numerical ID which identifies the survey.
saveHeading(string $heading, int $insertbefore)
updateOrder(array $a_order)
getQuestionType(int $question_id)
deleteUserSettings(int $id)
addConstraintToQuestion(int $to_question_id, int $constraint_id)
setTutorResultsStatus(bool $a_value)
getTutorResultsRecipients()
updateConjunctionForQuestions(array $questions, int $conjunction)
setActivationVisibility(bool $a_value)
static _hasDatasets(int $survey_id)
deleteAllUserData(bool $reset_LP=true)
Deletes all user data of a survey.
getMailParticipantData()
Preceding text (incl.
setMailNotification(bool $a_notification)
Activate mail to tutors each time a participant finishes the survey.
getAllRelations(bool $short_as_key=false)
is360SurveyStarted(int $appr_id, int $user_id, string $anonymous_code=null)
sendAppraiseeCloseNotification(int $a_user_id)
int $display_question_titles
deleteAppraisee(int $a_user_id)
getMailAddresses()
(Tutor) Recipients of "single participant has finished" mails
setTutorNotificationRecipients(array $a_value)
Set tutor recipients for "all participants have finished" mail.
isComplete()
Check if survey is complete for use.
getSurveyParticipants(?array $finished_ids=null, bool $force_non_anonymous=false, bool $include_invites=false)
setReminderTarget(int $a_value)
getQuestionblockQuestionIds(int $questionblock_id)
addConstraint(int $if_question_id, int $relation, float $value, int $conjunction)
Adds a constraint.
getQuestionGUI(string $questiontype, int $question_id)
getSurveyCodesForExport(array $a_codes=null, array $a_ids=null)
Return a list of survey codes for file export, note: user_key needs to be null to export a record.
getActiveID(int $user_id, string $anonymize_id, int $appr_id)
Get run id.
getConstraints(int $question_id)
Returns the constraints to a given question or questionblock.
saveAuthorToMetadata(string $a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
checkTutorNotification()
Check, if mail to tutors after all participants have finished the survey should be sent.
getWorkingtimeForParticipant(int $finished_id)
findCodeForUser(int $a_user_id)
deleteRater(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id=0)
saveCompletionStatus()
Saves the completion status of the survey.
static getSurveySkippedValue()
const EVALUATION_ACCESS_OFF
static _instanciateQuestion(int $question_id)
Creates an instance of a question with a given question id.
createReference()
creates reference for object
updateCode(int $a_id, string $a_email, string $a_last_name, string $a_first_name, int $a_sent)
setMailParticipantData(string $a_data)
Set preceding text (incl.
duplicateQuestionForSurvey(int $question_id, bool $a_force=false)
Takes a question and creates a copy of the question for use in the survey.
isHTML(string $a_text)
Checks if a given string contains HTML or not.
setCalculateSumScore(bool $a_val)
string $reminder_last_sent
modifyQuestionblock(int $questionblock_id, string $title, bool $show_questiontext, bool $show_blocktitle, bool $compress_view=false)
setTutorNotificationTarget(int $a_value)
setEvaluationAccess(string $evaluation_access=self::EVALUATION_ACCESS_OFF)
getImportDirectory()
get import directory of survey
deleteSurveyRecord()
Deletes the survey from the database.
getUserSurveyExecutionStatus(string $a_code=null)
Get current user execution status.
createQuestionblock(string $title, bool $show_questiontext, bool $show_blocktitle, array $questions, bool $compress_view=false)
cloneTextblocks(array $mapping)
Clones the text blocks of survey questions.
isAppraiseeClosed(int $a_user_id)
const RESULTS_SELF_EVAL_OWN
sent360Reminders()
Send 360 reminders.
set360RaterSent(int $a_appraisee_id, int $a_user_id, int $a_anonymous_id, int $a_tstamp=null)
getTutorNotificationStatus()
finishSurvey(int $finished_id, int $appr_id=0)
Finishes the survey creating an entry in the database.
isAppraisee(int $a_user_id)
const NOTIFICATION_APPRAISEES
unfoldQuestionblocks(array $questionblocks)
setMailConfirmation(bool $a_value)
getParticipantTextResults(int $active_id)
isSurveyCodeUnique(string $code)
string $evaluation_access
setReminderStart(?ilDate $a_value=null)
setReminderEnd(?ilDate $a_value=null)
setAnonymize(int $a_anonymize)
set anonymize status
removeConstraintsConcerningQuestion(int $question_id)
Remove constraints concerning a question with a given question_id.
importObject(array $file_info, int $svy_qpl_id)
addQuestionToBlock(int $question_id, int $questionblock_id)
removeQuestions(array $remove_questions, array $remove_questionblocks)
getSurveyCodesTableData(array $ids=null, string $lang=null)
Fetches the data for the survey codes table.
set360SelfRaters(bool $a_value)
getRatersData(int $a_appraisee_id)
getMailNotification()
Send mail to tutors each time a participant finishes the survey?
setMailAddresses(string $a_addresses)
Set (Tutor) Recipients of "single participant has finished" mails.
getPrecondition(int $constraint_id)
Returns a precondition with a given id.
checkConstraint(array $constraint_data, ?array $working_data)
Checks if a constraint is valid.
setActivationLimited(bool $a_value)
setPoolUsage(bool $a_value)
insertQuestion(int $question_id)
Inserts a question in the survey and saves the relation to the database.
setMailOwnResults(bool $a_value)
send360ReminderToUser(int $a_user_id, array $a_appraisee_ids)
setActivationStartDate(int $starting_time=null)
array $tutor_ntf_recipients
set360SelfEvaluation(bool $a_value)
setViewOwnResults(bool $a_value)
createExportDirectory()
creates data directory for export files (data_dir/svy_data/svy_<id>/export)
const NOTIFICATION_RATERS
setAuthor(string $author="")
canExportSurveyCode()
Checks if the survey code can be exported with the survey evaluation.
ILIAS Survey InternalDataService $data_manager
getVariables(int $question_id)
Returns all variables (answer options/scale values) of a question.
isAnonymizedParticipant(string $key)
sentReminderPlaceholders(string $a_message, int $a_user_id, array $a_context_params)
ILIAS Survey Code CodeManager $code_manager
ILIAS Survey InternalService $survey_service
const QUESTIONTITLES_HIDDEN
getFullname(int $a_max_strlen=0)
static _lookupFullname(int $a_user_id)
static _lookupId($a_user_str)
static _getUserData(array $a_internalids)
return user data for given user ids
static getUserIdsByEmail(string $a_email)
static _lookupName(int $a_user_id)
lookup user name
static _lookupLogin(int $a_user_id)
static _lookupEmail(int $a_user_id)
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
static getItem(int $ref_id)
static getInstance(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOfflineStatus(bool $status)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Handles survey reminder mail placeholders.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static is_email(string $a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
usesAppraisees()
If raters rate single persons (appraisees) this mode is activated.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
FeatureConfig $feature_config
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...