4include_once
"./Services/Object/classes/class.ilObject.php";
213 public function __construct($a_id = 0, $a_call_by_reference =
true)
217 $this->
user = $DIC->user();
218 $this->lng =
$DIC->language();
219 $this->db =
$DIC->database();
220 $this->access =
$DIC->access();
221 $this->log =
$DIC[
"ilLog"];
222 $this->plugin_admin =
$DIC[
"ilPluginAdmin"];
223 $this->tree =
$DIC->repositoryTree();
228 $this->survey_id = -1;
229 $this->introduction =
"";
230 $this->outro =
$lng->txt(
"survey_finished");
231 $this->author =
$ilUser->getFullname();
234 $this->questions = array();
239 $this->surveyCodeSecurity =
true;
240 $this->template_id =
null;
241 $this->pool_usage =
true;
244 parent::__construct($a_id, $a_call_by_reference);
250 public function create($a_upload =
false)
265 parent::createMetaData();
290 $result = parent::createReference();
313 array_push($this->questions, $question_id);
322 public function delete()
328 foreach ($this->questions as $question_id) {
336 $remove = parent::delete();
354 $affectedRows =
$ilDB->manipulateF(
355 "DELETE FROM svy_svy WHERE survey_id = %s",
361 "SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
365 $questionblocks = array();
367 array_push($questionblocks,
$row[
"questionblock_fi"]);
369 if (count($questionblocks)) {
370 $affectedRows =
$ilDB->manipulate(
"DELETE FROM svy_qblk WHERE " .
$ilDB->in(
'questionblock_id', $questionblocks,
false,
'integer'));
372 $affectedRows =
$ilDB->manipulateF(
373 "DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
379 $affectedRows =
$ilDB->manipulateF(
380 "DELETE FROM svy_anonymous WHERE survey_fi = %s",
387 $directory = $svy_data_dir .
"/svy_" . $this->
getId();
388 if (is_dir($directory)) {
392 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
398 foreach (
$mobs as $mob) {
415 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
419 $active_array = array();
421 array_push($active_array,
$row[
"finished_id"]);
424 $affectedRows =
$ilDB->manipulateF(
425 "DELETE FROM svy_finished WHERE survey_fi = %s",
430 foreach ($active_array as $active_fi) {
431 $affectedRows =
$ilDB->manipulateF(
432 "DELETE FROM svy_answer WHERE active_fi = %s",
436 $affectedRows =
$ilDB->manipulateF(
437 "DELETE FROM svy_times WHERE finished_fi = %s",
443 include_once
"Services/Object/classes/class.ilObjectLP.php";
445 $lp_obj->resetLPDataForCompleteObject();
457 $user_ids[] = array();
459 foreach ($finished_ids as $finished_id) {
461 "SELECT finished_id FROM svy_finished WHERE finished_id = %s",
467 if (
$row[
"user_fi"]) {
468 $user_ids[] =
$row[
"user_fi"];
471 $affectedRows =
$ilDB->manipulateF(
472 "DELETE FROM svy_answer WHERE active_fi = %s",
474 array(
$row[
"finished_id"])
477 $affectedRows =
$ilDB->manipulateF(
478 "DELETE FROM svy_finished WHERE finished_id = %s",
483 $affectedRows =
$ilDB->manipulateF(
484 "DELETE FROM svy_times WHERE finished_fi = %s",
486 array(
$row[
"finished_id"])
490 if (
sizeof($user_ids)) {
491 include_once
"Services/Object/classes/class.ilObjectLP.php";
493 $lp_obj->resetLPDataForUserIds($user_ids);
501 $sql =
"SELECT * FROM svy_finished" .
504 $sql .=
" AND " .
$ilDB->in(
"finished_id", $finished_ids,
"",
"integer");
508 $participants = array();
517 return $participants;
528 if (($this->
getTitle()) and (count($this->questions))) {
549 $affectedRows =
$ilDB->manipulateF(
550 "UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
551 array(
'text',
'integer',
'integer'),
569 $question_gui = $this->
getQuestionGUI($questiontype, $question_id);
572 if ($this->
getId() == $question_gui->object->getObjId() && !$a_force) {
576 $duplicate_id = $question_gui->object->duplicate(
true,
"",
"",
"", $this->
getId());
577 return $duplicate_id;
589 $this->log->debug(
"insert question, id:" . $question_id);
591 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
593 $this->log->debug(
"question is not complete");
599 "SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
603 $sequence =
$result->numRows();
605 $this->log->debug(
"duplicate, id: " . $question_id .
", duplicate id: " . $duplicate_id);
612 $next_id =
$ilDB->nextId(
'svy_svy_qst');
613 $affectedRows =
$ilDB->manipulateF(
614 "INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
615 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
616 array($next_id, $this->
getSurveyId(), $duplicate_id, $sequence, time())
619 $this->log->debug(
"added entry to svy_svy_qst, id: " . $next_id .
", question id: " . $duplicate_id .
", sequence: " . $sequence);
638 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst " .
639 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
640 " AND question_fi = " .
$ilDB->quote($a_question_fi,
"integer"));
641 if ($rec =
$ilDB->fetchAssoc($set)) {
658 "SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle," .
659 " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst" .
660 " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi" .
661 " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi" .
662 " AND svy_qblk.questionblock_id = %s" .
663 " ORDER BY svy_svy_qst.sequence",
665 array($questionblock_id)
668 $show_questiontext = 0;
669 $show_blocktitle = 0;
674 $show_questiontext =
$row[
"show_questiontext"];
675 $show_blocktitle =
$row[
"show_blocktitle"];
684 $next_id =
$ilDB->nextId(
'svy_settings');
685 $affectedRows =
$ilDB->insert(
"svy_settings", array(
686 "settings_id" => array(
"integer", $next_id),
687 "usr_id" => array(
"integer", $usr_id),
688 "keyword" => array(
"text",
$key),
689 "title" => array(
"text",
$title),
690 "value" => array(
"clob", $value)
698 $affectedRows =
$ilDB->manipulateF(
699 "DELETE FROM svy_settings WHERE settings_id = %s",
703 return $affectedRows;
711 "SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
712 array(
'integer',
'text'),
735 if (is_object($rmd_start)) {
739 if (is_object($rmd_end)) {
743 include_once(
"./Services/RTE/classes/class.ilRTE.php");
745 $next_id =
$ilDB->nextId(
'svy_svy');
746 $affectedRows =
$ilDB->insert(
"svy_svy", array(
747 "survey_id" => array(
"integer", $next_id),
748 "obj_fi" => array(
"integer", $this->
getId()),
749 "author" => array(
"text", $this->
getAuthor()),
752 "status" => array(
"text", $this->
getStatus()),
754 "enddate" => array(
"text", $this->
getEndDate()),
758 "complete" => array(
"text", $this->
isComplete()),
759 "created" => array(
"integer", time()),
765 "tstamp" => array(
"integer", time()),
766 "template_id" => array(
"integer", $this->
getTemplate()),
767 "pool_usage" => array(
"integer", $this->
getPoolUsage()),
769 "mode_360" => array(
"integer", $this->
get360Mode()),
773 "mode_360_results" => array(
"integer", $this->
get360Results()),
777 "reminder_start" => array(
"datetime", $rmd_start),
778 "reminder_end" => array(
"datetime", $rmd_end),
793 $affectedRows =
$ilDB->update(
"svy_svy", array(
794 "author" => array(
"text", $this->
getAuthor()),
797 "status" => array(
"text", $this->
getStatus()),
799 "enddate" => array(
"text", $this->
getEndDate()),
803 "complete" => array(
"text", $this->
isComplete()),
809 "tstamp" => array(
"integer", time()),
810 "template_id" => array(
"integer", $this->
getTemplate()),
811 "pool_usage" => array(
"integer", $this->
getPoolUsage()),
813 "mode_360" => array(
"integer", $this->
get360Mode()),
817 "mode_360_results" => array(
"integer", $this->
get360Results()),
821 "reminder_start" => array(
"datetime", $rmd_start),
822 "reminder_end" => array(
"datetime", $rmd_end),
835 "survey_id" => array(
"integer", $this->
getSurveyId())
845 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
858 $item->update($this->ref_id);
872 $this->log->debug(
"save questions");
875 $old_questions = array();
877 "SELECT survey_question_id,question_fi,sequence" .
878 " FROM svy_svy_qst WHERE survey_fi = %s",
883 $old_questions[
$row[
"question_fi"]] =
$row;
887 $insert = $update = $delete = array();
888 foreach ($this->questions as $seq => $fi) {
889 if (!array_key_exists($fi, $old_questions)) {
891 } elseif ($old_questions[$fi][
"sequence"] != $seq) {
892 $update[$fi] = $old_questions[$fi][
"survey_question_id"];
895 unset($old_questions[$fi]);
899 if (
sizeof($old_questions)) {
901 foreach ($old_questions as $fi =>
$old) {
902 $del_ids[] =
$old[
"survey_question_id"];
904 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst" .
905 " WHERE " .
$ilDB->in(
"survey_question_id", $del_ids,
"",
"integer"));
906 $this->log->debug(
"delete: " . $q);
908 unset($old_questions);
911 foreach ($this->questions as $seq => $fi) {
915 $next_id =
$ilDB->nextId(
'svy_svy_qst');
917 "INSERT INTO svy_svy_qst" .
918 " (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp)" .
919 " VALUES (%s, %s, %s, %s, %s, %s)",
920 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer'),
921 array($next_id, $this->
getSurveyId(), $fi,
null, $seq, time())
923 $this->log->debug(
"insert svy_svy_qst, id:" . $next_id .
", fi: " . $fi .
", seq:" . $seq);
925 } elseif (array_key_exists($fi, $update)) {
926 $ilDB->manipulate(
"UPDATE svy_svy_qst" .
927 " SET sequence = " .
$ilDB->quote($seq,
"integer") .
928 ", tstamp = " .
$ilDB->quote(time(),
"integer") .
929 " WHERE survey_question_id = " .
$ilDB->quote($update[$fi],
"integer"));
930 $this->log->debug(
"update svy_svy_qst, id:" . $update[$fi] .
", fi: " . $fi .
", seq:" . $seq);
946 "SELECT anonymous_id FROM svy_finished WHERE anonymous_id = %s",
952 return $row[
"anonymous_id"];
966 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
980 if ($question_id < 1) {
984 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
985 "svy_question.questiontype_fi = svy_qtype.questiontype_id",
991 return $data[
"type_tag"];
1013 switch ($a_anonymize) {
1018 $this->anonymize = $a_anonymize;
1033 return ($this->anonymize) ? $this->anonymize : 0;
1043 return ($this->
getAnonymize() == self::ANONYMIZE_OFF ||
1067 "SELECT * FROM svy_svy WHERE obj_fi = %s",
1069 array($this->
getId())
1071 if (
$result->numRows() == 1) {
1075 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1077 if (strcmp(
$data[
"outro"],
"survey_finished") == 0) {
1078 $this->
setOutro($this->lng->txt(
"survey_finished"));
1123 if ($this->ref_id) {
1124 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1126 switch ($activation[
"timing_type"]) {
1150 $this->questions = array();
1152 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1157 $this->questions[
$data[
"sequence"]] =
$data[
"question_fi"];
1172 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1179 $to_delete_ids = array();
1181 if (in_array(
$data[
"question_fi"], $fis)) {
1182 $to_delete_ids[] =
$data[
"survey_question_id"];
1184 $fis[] =
$data[
"question_fi"];
1189 if (count($to_delete_ids) > 0) {
1190 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst" .
1191 " WHERE " .
$ilDB->in(
"survey_question_id", $to_delete_ids,
false,
"integer") .
1192 " AND survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
1193 $this->log->debug(
"delete: " . $q);
1195 $ilDB->manipulate($q =
"DELETE FROM svy_qblk_qst " .
1196 " WHERE " .
$ilDB->in(
"question_fi", $fis,
true,
"integer") .
1197 " AND survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
1198 $this->log->debug(
"delete: " . $q);
1202 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst " .
1203 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
" ORDER BY sequence");
1205 while ($rec =
$ilDB->fetchAssoc($set)) {
1207 $q =
"UPDATE svy_svy_qst SET " .
1208 " sequence = " .
$ilDB->quote($seq++,
"integer") .
1209 " WHERE survey_question_id = " .
$ilDB->quote($rec[
"survey_question_id"],
"integer")
1211 $this->log->debug(
"update: " . $q);
1240 $md_life =&$md->getLifecycle();
1242 if (strlen($a_author) == 0) {
1244 $a_author =
$ilUser->getFullname();
1247 $md_life =&$md->addLifecycle();
1249 $con =&$md_life->addContribute();
1250 $con->setRole(
"Author");
1252 $ent =&$con->addEntity();
1253 $ent->setEntity($a_author);
1268 include_once
"./Services/MetaData/classes/class.ilMD.php";
1270 $md_life =&$md->getLifecycle();
1272 $ids =&$md_life->getContributeIds();
1273 foreach ($ids as
$id) {
1274 $md_cont =&$md_life->getContribute(
$id);
1275 if (strcmp($md_cont->getRole(),
"Author") == 0) {
1276 $entids =&$md_cont->getEntityIds();
1277 foreach ($entids as $entid) {
1278 $md_ent =&$md_cont->getEntity($entid);
1279 array_push(
$author, $md_ent->getEntity());
1295 return ($this->display_question_titles) ? 1 : 0;
1306 $this->display_question_titles = ($a_show) ? 1 : 0;
1317 $this->display_question_titles = 1;
1328 $this->display_question_titles = 0;
1350 if ($ilAccess->checkAccessOfUser(
$row[
"usr_id"],
"read",
"", $this->getRefId(),
"svy", $this->getId())) {
1427 include_once
"./Services/Administration/classes/class.ilSetting.php";
1428 $surveySetting =
new ilSetting(
"survey");
1429 $unlimited_invitation = $surveySetting->get(
"unlimited_invitation");
1430 if (!$unlimited_invitation && $this->invitation_mode == self::MODE_UNLIMITED) {
1458 return ($this->status == self::STATUS_ONLINE) ? true :
false;
1470 return ($this->status == self::STATUS_OFFLINE) ? true :
false;
1484 if ((
$status == self::STATUS_ONLINE) && (count($this->questions) == 0)) {
1486 $result = $this->lng->txt(
"cannot_switch_to_online_no_questions");
1502 return (strlen($this->start_date)) ? $this->start_date :
null;
1517 $edit_settings =
false;
1519 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches)) {
1520 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1522 if ($now < $epoch_time) {
1523 array_push(
$messages, $this->lng->txt(
'start_date_not_reached') .
' (' .
1526 $edit_settings =
true;
1530 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches)) {
1531 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1533 if ($now > $epoch_time) {
1534 array_push(
$messages, $this->lng->txt(
'end_date_reached') .
' (' .
1537 $edit_settings =
true;
1542 if ($this->
getStatus() == self::STATUS_OFFLINE) {
1543 array_push(
$messages, $this->lng->txt(
"survey_is_offline"));
1545 $edit_settings =
true;
1548 if (!$a_no_rbac && !$ilAccess->checkAccess(
"read",
"", $this->ref_id)) {
1549 array_push(
$messages, $this->lng->txt(
"cannot_participate_survey"));
1568 "edit_settings" => $edit_settings
1600 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/",
$start_date, $matches)) {
1605 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches)) {
1622 return (strlen($this->end_date)) ? $this->end_date :
null;
1653 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/",
$end_date, $matches)) {
1658 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches)) {
1692 $this->activation_visibility = (bool) $a_value;
1702 return (
bool) $this->activation_limited;
1707 $this->activation_limited = (bool) $a_value;
1719 return (strlen($this->introduction)) ? $this->introduction :
null;
1731 return (strlen($this->outro)) ? $this->outro :
null;
1743 $existing_questions = array();
1745 "SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1746 "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1751 if (
$data[
"original_id"]) {
1752 array_push($existing_questions,
$data[
"original_id"]);
1755 return $existing_questions;
1766 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1780 $array_pos = array_search($target_index, $this->questions);
1781 if ($insert_mode == 0) {
1782 $part1 = array_slice($this->questions, 0, $array_pos);
1783 $part2 = array_slice($this->questions, $array_pos);
1784 } elseif ($insert_mode == 1) {
1785 $part1 = array_slice($this->questions, 0, $array_pos + 1);
1786 $part2 = array_slice($this->questions, $array_pos + 1);
1788 foreach ($move_questions as $question_id) {
1789 if (!(array_search($question_id, $part1) ===
false)) {
1790 unset($part1[array_search($question_id, $part1)]);
1792 if (!(array_search($question_id, $part2) ===
false)) {
1793 unset($part2[array_search($question_id, $part2)]);
1796 $part1 = array_values($part1);
1797 $part2 = array_values($part2);
1798 $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1799 foreach ($move_questions as $question_id) {
1801 foreach ($constraints as $idx => $constraint) {
1802 foreach ($part2 as $next_question_id) {
1803 if ($constraint[
"question"] == $next_question_id) {
1821 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1823 #20610 if no question found, do nothing.
1825 $question->delete($question_id);
1840 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1841 array(
'integer',
'integer'),
1845 $remove_constraints = array();
1847 array_push($remove_constraints,
$row[
"constraint_fi"]);
1849 $affectedRows =
$ilDB->manipulateF(
1850 "DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1851 array(
'integer',
'integer'),
1854 foreach ($remove_constraints as
$key => $constraint_id) {
1855 $affectedRows =
$ilDB->manipulateF(
1856 "DELETE FROM svy_constraint WHERE constraint_id = %s",
1858 array($constraint_id)
1875 $block_sizes = array();
1877 if (in_array($question_id, $remove_questions) or in_array(
$data[
"questionblock_id"], $remove_questionblocks)) {
1878 unset($this->questions[array_search($question_id, $this->questions)]);
1880 } elseif (
$data[
"questionblock_id"]) {
1881 $block_sizes[
$data[
"questionblock_id"]]++;
1886 foreach ($block_sizes as $block_id =>
$size) {
1888 $remove_questionblocks[] = $block_id;
1892 foreach (array_unique($remove_questionblocks) as $questionblock_id) {
1893 $affectedRows =
$ilDB->manipulateF(
1894 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1896 array($questionblock_id)
1898 $affectedRows =
$ilDB->manipulateF(
1899 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1900 array(
'integer',
'integer'),
1905 $this->questions = array_values($this->questions);
1918 foreach ($questionblocks as
$index) {
1919 $affectedRows =
$ilDB->manipulateF(
1920 "DELETE FROM svy_qblk WHERE questionblock_id = %s",
1924 $affectedRows =
$ilDB->manipulateF(
1925 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1926 array(
'integer',
'integer'),
1936 $affectedRows =
$ilDB->manipulateF(
1937 "DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
1938 array(
'integer',
'integer',
'integer'),
1939 array($questionblock_id, $this->
getSurveyId(), $question_id)
1949 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
1950 $affectedRows =
$ilDB->manipulateF(
1951 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1952 "question_fi) VALUES (%s, %s, %s, %s)",
1953 array(
'integer',
'integer',
'integer',
'integer'),
1954 array($next_id, $this->
getSurveyId(), $questionblock_id, $question_id)
1973 $set =
$ilDB->query(
"SELECT * FROM svy_qblk_qst " .
1974 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
1975 " AND question_fi = " .
$ilDB->quote($a_question_fi,
"integer"));
1976 if ($rec =
$ilDB->fetchAssoc($set)) {
1994 "SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM " .
1995 "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
1996 "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
1998 array($questionblock_id)
2002 $titles[
$row[
"question_fi"]] =
$row[
"title"];
2006 "SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
2010 $resultarray = array();
2013 if (array_key_exists(
$row[
"question_fi"], $titles)) {
2014 $resultarray[
$counter++] = $titles[
$row[
"question_fi"]];
2017 return $resultarray;
2032 "SELECT a.question_fi FROM svy_qblk_qst a JOIN svy_svy_qst b ON (a.question_fi = b.question_fi) " .
2033 " WHERE a.questionblock_fi = %s ORDER BY b.sequence",
2035 array($questionblock_id)
2040 if (!in_array(
$data[
'question_fi'], $ids)) {
2041 array_push($ids,
$data[
'question_fi']);
2062 "SELECT * FROM svy_qblk WHERE questionblock_id = %s",
2064 array($questionblock_id)
2083 $next_id =
$ilDB->nextId(
'svy_qblk');
2085 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
2086 " show_blocktitle, owner_fi, tstamp) " .
2087 "VALUES (%s, %s, %s, %s, %s, %s)",
2088 array(
'integer',
'text',
'integer',
'integer',
'integer',
'integer'),
2089 array($next_id,
$title, $show_questiontext, $show_blocktitle,
$owner, time())
2111 $next_id =
$ilDB->nextId(
'svy_qblk');
2112 $affectedRows =
$ilDB->manipulateF(
2113 "INSERT INTO svy_qblk (questionblock_id, title, show_questiontext," .
2114 " show_blocktitle, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
2115 array(
'integer',
'text',
'text',
'text',
'integer',
'integer'),
2116 array($next_id,
$title, $show_questiontext, $show_blocktitle,
$ilUser->getId(), time())
2118 if ($affectedRows) {
2119 $questionblock_id = $next_id;
2122 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
2123 $affectedRows =
$ilDB->manipulateF(
2124 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
2125 "question_fi) VALUES (%s, %s, %s, %s)",
2126 array(
'integer',
'integer',
'integer',
'integer'),
2145 $affectedRows =
$ilDB->manipulateF(
2146 "UPDATE svy_qblk SET title = %s, show_questiontext = %s," .
2147 " show_blocktitle = %s WHERE questionblock_id = %s",
2148 array(
'text',
'text',
'text',
'integer'),
2149 array(
$title, $show_questiontext, $show_blocktitle, $questionblock_id)
2163 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
2164 array(
'integer',
'integer'),
2167 $constraints = array();
2169 array_push($constraints,
$row[
"constraint_fi"]);
2171 foreach ($constraints as $constraint_id) {
2186 $affectedRows =
$ilDB->manipulateF(
2187 "DELETE FROM svy_constraint WHERE constraint_id = %s",
2189 array($constraint_id)
2191 $affectedRows =
$ilDB->manipulateF(
2192 "DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
2194 array($constraint_id)
2207 $all_questions = array();
2209 "SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, " .
2210 "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2211 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2212 "ORDER BY svy_svy_qst.sequence",
2216 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2219 if (
$row[
"plugin"]) {
2226 $questionrow = $question->getQuestionDataArray(
$row[
"question_id"]);
2228 $questionrow[
$key] = $value;
2230 $all_questions[
$row[
"question_id"]] = $questionrow;
2231 $all_questions[
$row[
"question_id"]][
"usableForPrecondition"] = $question->usableForPrecondition();
2232 $all_questions[
$row[
"question_id"]][
"availableRelations"] = $question->getAvailableRelations();
2236 $questionblocks = array();
2237 if (count($all_questions)) {
2239 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
2240 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2241 "AND " .
$ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2246 $questionblocks[
$row[
'question_fi']] =
$row;
2250 foreach ($all_questions as $question_id =>
$row) {
2252 if (isset($questionblocks[$question_id])) {
2253 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2254 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2255 $all_questions[$question_id][
"constraints"] = $constraints;
2257 $all_questions[$question_id][
"questionblock_title"] =
"";
2258 $all_questions[$question_id][
"questionblock_id"] =
"";
2259 $all_questions[$question_id][
"constraints"] = $constraints;
2261 if ($with_answers) {
2264 "SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
2265 "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id " .
2266 "ORDER BY sequence ASC",
2272 array_push($answers,
$data[
"title"]);
2275 $all_questions[$question_id][
"answers"] = $answers;
2278 return $all_questions;
2291 "SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
2297 if (!array_key_exists(
$row[
"question_fi"], $obligatory_questions)) {
2298 $obligatory_questions[
$row[
"question_fi"]] = 0;
2304 foreach ($obligatory_questions as $question_fi => $obligatory) {
2306 $ilDB->manipulate(
"UPDATE svy_question" .
2307 " SET obligatory = " .
$ilDB->quote($obligatory,
"integer") .
2308 " WHERE question_id = " .
$ilDB->quote($question_fi,
"integer"));
2321 $all_questions = array();
2323 "SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
2324 "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2325 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2326 "ORDER BY svy_svy_qst.sequence",
2331 $all_questions[
$row[
"question_id"]] =
$row;
2334 $questionblocks = array();
2335 if (count($all_questions)) {
2337 "SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst " .
2338 "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2339 "AND " .
$ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2344 $questionblocks[
$row[
'question_fi']] =
$row;
2348 $all_pages = array();
2351 foreach ($all_questions as $question_id =>
$row) {
2352 $constraints = array();
2353 if (isset($questionblocks[$question_id])) {
2354 if (!$currentblock or ($currentblock != $questionblocks[$question_id][
'questionblock_id'])) {
2357 $all_questions[$question_id][
'page'] = $pageindex;
2358 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2359 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2360 $all_questions[$question_id][
"questionblock_show_questiontext"] = $questionblocks[$question_id][
'show_questiontext'];
2361 $all_questions[$question_id][
"questionblock_show_blocktitle"] = $questionblocks[$question_id][
'show_blocktitle'];
2362 $currentblock = $questionblocks[$question_id][
'questionblock_id'];
2364 $all_questions[$question_id][
"constraints"] = $constraints;
2367 $all_questions[$question_id][
'page'] = $pageindex;
2368 $all_questions[$question_id][
"questionblock_title"] =
"";
2369 $all_questions[$question_id][
"questionblock_id"] =
"";
2370 $all_questions[$question_id][
"questionblock_show_questiontext"] = 1;
2371 $all_questions[$question_id][
"questionblock_show_blocktitle"] = 1;
2374 $all_questions[$question_id][
"constraints"] = $constraints;
2376 if (!isset($all_pages[$pageindex])) {
2377 $all_pages[$pageindex] = array();
2379 array_push($all_pages[$pageindex], $all_questions[$question_id]);
2382 $max = count($all_pages);
2384 foreach ($all_pages as
$index => $block) {
2385 foreach ($block as $blockindex => $question) {
2406 if (strcmp($active_page_question_id,
"") == 0) {
2409 foreach ($pages as
$key => $question_array) {
2410 foreach ($question_array as $question) {
2411 if ($active_page_question_id == $question[
"question_id"]) {
2416 if ($foundpage == -1) {
2419 $foundpage += $direction;
2420 if ($foundpage < 0) {
2423 if ($foundpage >= count($pages)) {
2426 return $pages[$foundpage];
2438 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
2451 $result_array = array();
2453 "SELECT svy_constraint.*, svy_relation.*, svy_qst_constraint.question_fi ref_question_fi FROM svy_qst_constraint, svy_constraint, " .
2454 "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2455 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2475 $result_array = array();
2477 "SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation " .
2478 "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND " .
2479 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s " .
2480 "AND svy_qst_constraint.survey_fi = %s",
2481 array(
'integer',
'integer'),
2485 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2488 $question =
new $question_type();
2489 $question->loadFromDb(
$row[
"question_fi"]);
2490 $valueoutput = $question->getPreconditionValueOutput(
$row[
"value"]);
2491 array_push($result_array, array(
"id" =>
$row[
"constraint_id"],
"question" =>
$row[
"question_fi"],
"short" =>
$row[
"shortname"],
"long" =>
$row[
"longname"],
"value" =>
$row[
"value"],
"conjunction" =>
$row[
"conjunction"],
"valueoutput" => $valueoutput));
2493 return $result_array;
2506 $result_array = array();
2508 "SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* " .
2509 "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id " .
2510 "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2515 array_push($result_array, array(
"id" =>
$row[
"constraint_id"],
"for_question" =>
$row[
"for_question"],
"question" =>
$row[
"question_fi"],
"short" =>
$row[
"shortname"],
"long" =>
$row[
"longname"],
"relation_id" =>
$row[
"relation_id"],
"value" =>
$row[
"value"],
'conjunction' =>
$row[
'conjunction']));
2517 return $result_array;
2530 $result_array = array();
2532 "SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN " .
2533 "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s " .
2534 "ORDER BY svy_variable.sequence",
2539 $result_array[
$row->sequence] =
$row;
2541 return $result_array;
2556 $next_id =
$ilDB->nextId(
'svy_constraint');
2557 $affectedRows =
$ilDB->manipulateF(
2558 "INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES " .
2559 "(%s, %s, %s, %s, %s)",
2560 array(
'integer',
'integer',
'integer',
'float',
'integer'),
2561 array($next_id, $if_question_id, $relation, $value, $conjunction)
2563 if ($affectedRows) {
2581 $next_id =
$ilDB->nextId(
'svy_qst_constraint');
2582 $affectedRows =
$ilDB->manipulateF(
2583 "INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, " .
2584 "constraint_fi) VALUES (%s, %s, %s, %s)",
2585 array(
'integer',
'integer',
'integer',
'integer'),
2586 array($next_id, $this->
getSurveyId(), $to_question_id, $constraint_id)
2600 public function updateConstraint($precondition_id, $if_question_id, $relation, $value, $conjunction)
2603 $affectedRows =
$ilDB->manipulateF(
2604 "UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s " .
2605 "WHERE constraint_id = %s",
2606 array(
'integer',
'integer',
'float',
'integer',
'integer'),
2607 array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2615 $affectedRows =
$ilDB->manipulateF(
2616 "UPDATE svy_constraint SET conjunction = %s " .
2617 "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2618 array(
'integer',
'integer'),
2619 array($conjunction, $question_id)
2634 $custom_order = array(
"equal",
"not_equal",
"less",
"less_or_equal",
"more",
"more_or_equal");
2635 $custom_order = array_flip($custom_order);
2637 $result_array = array();
2640 if ($short_as_key) {
2641 $result_array[
$row[
"shortname"]] = array(
"short" =>
$row[
"shortname"],
"long" =>
$row[
"longname"],
"id" =>
$row[
"relation_id"],
"order" => $custom_order[
$row[
"longname"]]);
2643 $result_array[
$row[
"relation_id"]] = array(
"short" =>
$row[
"shortname"],
"long" =>
$row[
"longname"],
"order" => $custom_order[
$row[
"longname"]]);
2648 foreach ($result_array as $idx => $item) {
2649 unset($result_array[$idx][
"order"]);
2652 return $result_array;
2662 "SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2680 $affectedRows =
$ilDB->manipulateF(
2681 "DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s",
2682 array(
'integer',
'integer'),
2685 include_once
'./Services/User/classes/class.ilObjUser.php';
2700 "SELECT user_fi FROM svy_inv_usr WHERE user_fi = %s AND survey_fi = %s",
2701 array(
'integer',
'integer'),
2705 $next_id =
$ilDB->nextId(
'svy_inv_usr');
2706 $affectedRows =
$ilDB->manipulateF(
2707 "INSERT INTO svy_inv_usr (invited_user_id, survey_fi, user_fi, tstamp) " .
2708 "VALUES (%s, %s, %s, %s)",
2709 array(
'integer',
'integer',
'integer',
'integer'),
2710 array($next_id, $this->
getSurveyId(), $user_id, time())
2714 include_once
'./Services/User/classes/class.ilObjUser.php';
2729 $result_array = array();
2731 "SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2736 array_push($result_array,
$row[
"user_fi"]);
2738 return $result_array;
2752 $affectedRows =
$ilDB->manipulateF(
2753 "DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2754 array(
'integer',
'integer'),
2755 array($question_id, $active_id)
2770 $result_array = array();
2772 "SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2773 array(
'integer',
'integer'),
2774 array($question_id, $active_id)
2776 if (
$result->numRows() >= 1) {
2778 array_push($result_array,
$row);
2780 return $result_array;
2782 return $result_array;
2796 if ($this->
getAnonymize() && (strlen($anonymous_id) == 0)) {
2800 if (strcmp($user_id,
"") == 0) {
2801 if ($user_id == ANONYMOUS_USER_ID) {
2805 $next_id =
$ilDB->nextId(
'svy_finished');
2806 $affectedRows =
$ilDB->manipulateF(
2807 "INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp, appr_id) " .
2808 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
2809 array(
'integer',
'integer',
'integer',
'text',
'text',
'integer',
'integer'),
2810 array($next_id, $this->
getSurveyId(), $user_id, $anonymous_id, 0, time(), $appraisee_id)
2826 "UPDATE svy_finished SET state = %s, tstamp = %s" .
2827 " WHERE survey_fi = %s AND finished_id = %s",
2828 array(
'text',
'integer',
'integer',
'integer'),
2829 array(1, time(), $this->
getSurveyId(), $finished_id)
2846 $affectedRows =
$ilDB->manipulateF(
2847 "UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
2848 array(
'integer',
'integer'),
2849 array(($page_id) ? $page_id : 0, $finished_id)
2855 include_once
"./Services/User/classes/class.ilObjUser.php";
2856 include_once
"./Services/User/classes/class.ilUserUtil.php";
2859 $placeholders = array(
2860 "FIRST_NAME" =>
"firstname",
2861 "LAST_NAME" =>
"lastname",
2864 "firstname" =>
"firstname"
2867 $recipients = preg_split(
'/,/', $this->mailaddresses);
2868 foreach ($recipients as $recipient) {
2870 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
2872 $ntf->setLangModules(array(
"survey"));
2874 $ntf->setSubjectLangId(
'finished_mail_subject');
2877 if (trim($messagetext)) {
2882 foreach ($placeholders as
$key => $mapping) {
2884 $messagetext = str_replace(
'[' .
$key .
']',
'', $messagetext);
2886 $messagetext = str_replace(
'[' .
$key .
']', trim(
$data[$mapping]), $messagetext);
2889 $ntf->setIntroductionDirect($messagetext);
2891 $ntf->setIntroductionLangId(
'survey_notification_finished_introduction');
2896 $ntf->addAdditionalInfo(
2897 'survey_360_appraisee',
2902 $active_id = $this->
getActiveID($user_id, $anonymize_id, $appr_id);
2903 $ntf->addAdditionalInfo(
2909 $ntf->setGotoLangId(
'survey_notification_tutor_link');
2910 $ntf->setReasonLangId(
'survey_notification_finished_reason');
2912 $ntf->sendMail(array($recipient),
null,
null);
2921 $questioncounter = 1;
2922 foreach (
$questions as $question_id => $question_data) {
2923 $textresult .= $questioncounter++ .
". " . $question_data[
"title"] .
"\n";
2924 $found = $userResults[$question_id][$active_id];
2926 if (is_array($found)) {
2927 $text = implode(
"\n", $found);
2931 if (strlen(
$text) == 0) {
2935 $textresult .=
$text .
"\n\n";
2952 if ($anonymize_id) {
2954 "SELECT * FROM svy_finished" .
2955 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2956 array(
'integer',
'text',
'integer'),
2957 array($this->
getSurveyId(), $anonymize_id, $appr_id)
2961 "SELECT * FROM svy_finished" .
2962 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
2963 array(
'integer',
'integer',
'integer'),
2967 if (
$result->numRows() == 0) {
2974 return (
int)
$row[
"state"];
2992 if ($anonymize_id) {
2994 "SELECT finished_id FROM svy_finished" .
2995 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
2996 array(
'integer',
'text',
'integer'),
2997 array($this->
getSurveyId(), $anonymize_id, $appr_id)
3001 "SELECT finished_id FROM svy_finished" .
3002 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
3003 array(
'integer',
'integer',
'integer'),
3007 if (
$result->numRows() == 0) {
3011 return $row[
"finished_id"];
3026 "SELECT lastpage FROM svy_finished WHERE finished_id = %s",
3030 if (
$result->numRows() == 0) {
3034 return (
$row[
"lastpage"]) ?
$row[
"lastpage"] :
'';
3048 if (count($working_data) == 0) {
3052 if ((count($working_data) == 1) and (strcmp($working_data[0][
"value"],
"") == 0)) {
3057 foreach ($working_data as
$data) {
3058 switch ($constraint_data[
"short"]) {
3060 if (
$data[
"value"] < $constraint_data[
"value"]) {
3066 if (
$data[
"value"] <= $constraint_data[
"value"]) {
3072 if (
$data[
"value"] == $constraint_data[
"value"]) {
3078 if (
$data[
"value"] <> $constraint_data[
"value"]) {
3084 if (
$data[
"value"] >= $constraint_data[
"value"]) {
3090 if (
$data[
"value"] > $constraint_data[
"value"]) {
3100 return (
int) $found;
3110 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
3114 return (
$result->numRows()) ? true :
false;
3130 "SELECT * FROM svy_finished WHERE survey_fi = %s",
3150 $evaluation = array();
3152 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3157 $question =
new $question_type();
3158 $question->loadFromDb($question_id);
3161 $q_res = $q_eval->getResults();
3164 foreach ($finished_ids as $user_id) {
3165 $data[$user_id] = $q_eval->parseUserSpecificResults($q_res, $user_id);
3168 $evaluation[$question_id] =
$data;
3185 $surveySetting =
new ilSetting(
"survey");
3186 $use_anonymous_id = array_key_exists(
"use_anonymous_id",
$_GET) ?
$_GET[
"use_anonymous_id"] : $surveySetting->get(
"use_anonymous_id");
3188 "SELECT * FROM svy_finished WHERE finished_id = %s",
3193 $foundrows =
$result->numRows();
3197 $name = ($use_anonymous_id) ?
$row[
"anonymous_id"] : $this->lng->txt(
"anonymous");
3199 "fullname" =>
$name,
3200 "sortname" =>
$name,
3205 "active_id" =>
"$active_id"
3208 if ((
$row[
"user_fi"] > 0) &&
3209 ((
$row[
"user_fi"] != ANONYMOUS_USER_ID &&
3212 (
bool) $force_non_anonymous)) {
3213 include_once
'./Services/User/classes/class.ilObjUser.php';
3219 $gender =
$user->getGender();
3220 if (strlen($gender) == 1) {
3221 $gender = $this->lng->txt(
"gender_$gender");
3250 "SELECT * FROM svy_answer WHERE active_fi = %s",
3255 if (!is_array($answers[
$row[
"question_fi"]])) {
3256 $answers[
$row[
"question_fi"]] = array();
3258 array_push($answers[
$row[
"question_fi"]],
$row);
3267 "answers" => array()
3270 if (array_key_exists(
$key, $answers)) {
3271 $resultset[
"answers"][
$key] = $answers[
$key];
3273 $resultset[
"answers"][
$key] = array();
3275 sort($resultset[
"answers"][
$key]);
3290 if (is_array($arrFilter)) {
3291 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
3292 $where .=
" AND " .
$ilDB->like(
'svy_question.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3294 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
3295 $where .=
" AND " .
$ilDB->like(
'svy_question.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
3297 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
3298 $where .=
" AND " .
$ilDB->like(
'svy_question.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
3300 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
3301 $where .=
" AND svy_qtype.type_tag = " .
$ilDB->quote($arrFilter[
'type'],
'text');
3303 if (array_key_exists(
'spl', $arrFilter) && strlen($arrFilter[
'spl'])) {
3304 $where .=
" AND svy_question.obj_fi = " .
$ilDB->quote($arrFilter[
'spl'],
'integer');
3310 $forbidden =
" AND " .
$ilDB->in(
'svy_question.obj_fi', array_keys($spls),
false,
'integer');
3311 $forbidden .=
" AND svy_question.complete = " .
$ilDB->quote(
"1",
'text');
3314 if (count($existing_questions)) {
3315 $existing =
" AND " .
$ilDB->in(
'svy_question.question_id', $existing_questions,
true,
'integer');
3318 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
3321 $query_result =
$ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id" .
3322 " FROM svy_question, svy_qtype, object_reference" .
3323 " WHERE svy_question.original_id IS NULL" . $forbidden . $existing .
3324 " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0" .
3325 " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
3328 if ($query_result->numRows()) {
3329 while (
$row =
$ilDB->fetchAssoc($query_result)) {
3330 if (array_key_exists(
'spl_txt', $arrFilter) && strlen($arrFilter[
'spl_txt'])) {
3331 if (!stristr($spls[
$row[
"obj_fi"]], $arrFilter[
'spl_txt'])) {
3336 $row[
'ttype'] = $trans[
$row[
'type_tag']];
3337 if (
$row[
"plugin"]) {
3360 if (is_array($arrFilter)) {
3361 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
3362 $where .=
" AND " .
$ilDB->like(
'svy_qblk.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3366 $query_result =
$ilDB->query(
"SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE " .
3367 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi " .
3368 "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, " .
3369 "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
3371 if ($query_result->numRows()) {
3373 $surveytitles = array();
3374 foreach ($survey_ref_ids as $survey_ref_id) {
3378 while (
$row =
$ilDB->fetchAssoc($query_result)) {
3381 foreach ($questions_array as
$key => $value) {
3382 $questions_array[
$key] =
"$counter. $value";
3385 if (strlen($surveytitles[
$row[
"obj_fi"]])) {
3386 $rows[
$row[
"questionblock_id"]] = array(
3387 "questionblock_id" =>
$row[
"questionblock_id"],
3388 "title" =>
$row[
"title"],
3389 "svy" => $surveytitles[
$row[
"obj_fi"]],
3390 "contains" => join($questions_array,
", "),
3391 "owner" =>
$row[
"owner_fi"]
3407 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
3412 "xmlns:xsi" =>
"http://www.w3.org/2001/XMLSchema-instance",
3413 "xsi:noNamespaceSchemaLocation" =>
"http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd"
3415 $a_xml_writer->xmlStartTag(
"surveyobject", $attrs);
3420 $a_xml_writer->xmlStartTag(
"survey", $attrs);
3422 $a_xml_writer->xmlElement(
"description",
null, $this->
getDescription());
3423 $a_xml_writer->xmlElement(
"author",
null, $this->
getAuthor());
3424 $a_xml_writer->xmlStartTag(
"objectives");
3426 "label" =>
"introduction"
3433 $a_xml_writer->xmlEndTag(
"objectives");
3436 $attribs = array(
"enabled" =>
"1");
3438 $attribs = array(
"enabled" =>
"0");
3440 $a_xml_writer->xmlElement(
"anonymisation", $attribs);
3441 $a_xml_writer->xmlStartTag(
"restrictions");
3443 $attribs = array(
"type" =>
"free");
3445 $attribs = array(
"type" =>
"restricted");
3447 $a_xml_writer->xmlElement(
"access", $attribs);
3449 $attrs = array(
"type" =>
"date");
3450 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches);
3451 $a_xml_writer->xmlElement(
"startingtime", $attrs,
sprintf(
"%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
3454 $attrs = array(
"type" =>
"date");
3455 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches);
3456 $a_xml_writer->xmlElement(
"endingtime", $attrs,
sprintf(
"%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
3458 $a_xml_writer->xmlEndTag(
"restrictions");
3462 $hasconstraints =
false;
3463 foreach ($pages as $question_array) {
3464 foreach ($question_array as $question) {
3465 if (count($question[
"constraints"])) {
3466 $hasconstraints =
true;
3471 if ($hasconstraints) {
3472 $a_xml_writer->xmlStartTag(
"constraints");
3473 foreach ($pages as $question_array) {
3474 foreach ($question_array as $question) {
3475 if (count($question[
"constraints"])) {
3477 foreach ($question[
"constraints"] as $constraint) {
3479 "sourceref" => $question[
"question_id"],
3480 "destref" => $constraint[
"question"],
3481 "relation" => $constraint[
"short"],
3482 "value" => $constraint[
"value"],
3483 "conjunction" => $constraint[
"conjunction"]
3485 $a_xml_writer->xmlElement(
"constraint", $attribs);
3490 $a_xml_writer->xmlEndTag(
"constraints");
3494 $a_xml_writer->xmlStartTag(
"metadata");
3496 $custom_properties = array();
3498 $custom_properties[
"status"] = $this->
getStatus();
3500 $custom_properties[
"pool_usage"] = (int) $this->
getPoolUsage();
3508 $custom_properties[
"mode_360"] = (int) $this->
get360Mode();
3510 $custom_properties[
"mode_360_self_rate"] = (int) $this->
get360SelfRaters();
3512 $custom_properties[
"mode_360_results"] = $this->
get360Results();
3520 foreach ($custom_properties as $label => $value) {
3521 $a_xml_writer->xmlStartTag(
"metadatafield");
3522 $a_xml_writer->xmlElement(
"fieldlabel",
null, $label);
3523 $a_xml_writer->xmlElement(
"fieldentry",
null, $value);
3524 $a_xml_writer->xmlEndTag(
"metadatafield");
3527 $a_xml_writer->xmlStartTag(
"metadatafield");
3528 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"SCORM");
3529 include_once
"./Services/MetaData/classes/class.ilMD.php";
3532 $md->toXml($writer);
3534 $a_xml_writer->xmlElement(
"fieldentry",
null,
$metadata);
3535 $a_xml_writer->xmlEndTag(
"metadatafield");
3537 $a_xml_writer->xmlEndTag(
"metadata");
3538 $a_xml_writer->xmlEndTag(
"survey");
3540 $attribs = array(
"id" => $this->
getId());
3541 $a_xml_writer->xmlStartTag(
"surveyquestions", $attribs);
3543 foreach ($pages as $question_array) {
3544 if (count($question_array) > 1) {
3545 $attribs = array(
"id" => $question_array[0][
"question_id"]);
3546 $attribs = array(
"showQuestiontext" => $question_array[0][
"questionblock_show_questiontext"],
3547 "showBlocktitle" => $question_array[0][
"questionblock_show_blocktitle"]);
3548 $a_xml_writer->xmlStartTag(
"questionblock", $attribs);
3549 if (strlen($question_array[0][
"questionblock_title"])) {
3550 $a_xml_writer->xmlElement(
"questionblocktitle",
null, $question_array[0][
"questionblock_title"]);
3553 foreach ($question_array as $question) {
3554 if (strlen($question[
"heading"])) {
3555 $a_xml_writer->xmlElement(
"textblock",
null, $question[
"heading"]);
3561 if ($questionObject !==
false) {
3562 $questionObject->insertXML($a_xml_writer,
false);
3565 if (count($question_array) > 1) {
3566 $a_xml_writer->xmlEndTag(
"questionblock");
3570 $a_xml_writer->xmlEndTag(
"surveyquestions");
3571 $a_xml_writer->xmlEndTag(
"surveyobject");
3572 $xml = $a_xml_writer->xmlDumpMem(
false);
3585 if ($question_id < 1) {
3588 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3590 if (strlen($question_type) == 0) {
3594 $question =
new $question_type();
3595 $question->loadFromDb($question_id);
3607 if (!is_dir($a_dir) || is_int(strpos($a_dir,
".."))) {
3610 $importDirectory =
"";
3613 $current_dir = opendir($a_dir);
3615 while ($entryname = readdir($current_dir)) {
3620 if (is_dir($a_dir .
"/" .
$file) and (
$file !=
"." and
$file!=
"..")) {
3622 $importDirectory = $a_dir .
"/" .
$file;
3625 closedir($current_dir);
3626 if (strlen($importDirectory)) {
3628 $current_dir = opendir($importDirectory);
3630 while ($entryname = readdir($current_dir)) {
3634 if (@is_file($importDirectory .
"/" .
$file) &&
3636 (preg_match(
"/^[0-9]{10}__[0-9]+__(svy_)*[0-9]+\.[A-Za-z]{1,3}$/",
$file) ||
3637 preg_match(
"/^[0-9]{10}__[0-9]+__(survey__)*[0-9]+\.[A-Za-z]{1,3}$/",
$file))) {
3639 $xmlFile = $importDirectory .
"/" .
$file;
3643 return array(
"dir" => $importDirectory,
"xml" => $xmlFile);
3656 if ($svy_qpl_id < 1) {
3660 $source = $file_info[
"tmp_name"];
3662 if ((
$source ==
'none') || (!
$source) || $file_info[
"error"] > UPLOAD_ERR_OK) {
3663 $error = $this->lng->txt(
"import_no_file_selected");
3668 if ((strcmp($file_info[
"type"],
"text/xml") == 0) || (strcmp($file_info[
"type"],
"application/xml") == 0)) {
3669 $this->log->debug(
"isXML");
3673 $suffix = pathinfo($file_info[
"name"]);
3674 if (strcmp(strtolower($suffix[
"extension"]),
"zip") == 0) {
3675 $this->log->debug(
"isZip");
3678 if (!$isXml && !$isZip) {
3679 $error = $this->lng->txt(
"import_wrong_file_type");
3680 $this->log->debug(
"Survey: Import error. Filetype was \"" . $file_info[
"type"] .
"\"");
3682 if (strlen(
$error) == 0) {
3685 $import_subdir =
"";
3688 $importfile = $import_dir .
"/" . $file_info[
"name"];
3689 ilUtil::moveUploadedFile(
$source, $file_info[
"name"], $importfile);
3692 if (!((strlen($found[
"dir"]) > 0) && (strlen($found[
"xml"]) > 0))) {
3693 $error = $this->lng->txt(
"wrong_import_file_structure");
3696 $importfile = $found[
"xml"];
3697 $import_subdir = $found[
"dir"];
3699 $importfile = tempnam($import_dir,
"survey_import");
3700 ilUtil::moveUploadedFile(
$source, $file_info[
"name"], $importfile);
3703 $this->log->debug(
"Import file = $importfile");
3704 $this->log->debug(
"Import subdir = $import_subdir");
3706 $fh = fopen($importfile,
"r");
3708 $error = $this->lng->txt(
"import_error_opening_file");
3711 $xml = fread(
$fh, filesize($importfile));
3714 $error = $this->lng->txt(
"import_error_closing_file");
3719 if (strpos(
$xml,
"questestinterop")) {
3720 include_once(
"./Modules/Survey/exceptions/class.ilInvalidSurveyImportFileException.php");
3729 $this->log->debug(
"survey id = " . $this->
getId());
3730 $this->log->debug(
"question pool id = " . $svy_qpl_id);
3732 include_once(
"./Services/Export/classes/class.ilImport.php");
3734 $config = $imp->getConfig(
"Modules/Survey");
3735 $config->setQuestionPoolID($svy_qpl_id);
3736 $imp->getMapping()->addMapping(
"Modules/Survey",
"svy", 0, $this->
getId());
3737 $imp->importFromDirectory($import_subdir,
"svy",
"Modules/Survey");
3738 $this->log->debug(
"config(Modules/survey)->getQuestionPoolId =" .
$config->getQuestionPoolID());
3742 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
3744 $import->setSurveyObject($this);
3745 $import->setXMLContent(
$xml);
3746 $import->startParsing();
3749 if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
3750 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
3751 include_once
"./Services/RTE/classes/class.ilRTE.php";
3752 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
3753 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
3754 $importfile = $import_subdir .
"/" . $mob[
"uri"];
3755 if (file_exists($importfile)) {
3756 if (!$mob[
"type"]) {
3757 $mob[
"type"] =
"svy:html";
3763 if ($mob[
"type"] ==
"svy:html") {
3765 $this->
setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->getIntroduction()));
3766 $this->
setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->getOutro()));
3769 elseif ($import->questions[$mob[
"id"]]) {
3770 $new_qid = $import->questions[$mob[
"id"]];
3773 $qtext = $new_question->getQuestiontext();
3775 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
3777 $new_question->setQuestiontext($qtext);
3778 $new_question->saveToDb();
3781 if ($new_question->getOriginalId()) {
3783 $pool_question->setQuestiontext($qtext);
3784 $pool_question->saveToDb();
3789 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
3811 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
3818 $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
3820 $newObj->updateMetaData();
3824 $newObj->setOutro($this->
getOutro());
3841 $newObj->set360Mode(
true);
3865 $question_pointer = array();
3868 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3870 foreach ($this->questions as
$key => $question_id) {
3875 $question->saveToDb($original_id);
3876 $newObj->questions[
$key] = $question->getId();
3877 $question_pointer[$question_id] = $question->getId();
3878 $mapping[$question_id] = $question->getId();
3885 if (!$cp_options->isRootNode($this->getRefId())) {
3886 $newObj->setStatus($this->
isOnline()?self::STATUS_ONLINE: self::STATUS_OFFLINE);
3889 $newObj->saveToDb();
3890 $newObj->cloneTextblocks($mapping);
3895 include_once
"./Modules/Survey/classes/class.ilSurveySkill.php";
3899 foreach ($mapping as $src_qst_id => $tgt_qst_id) {
3900 $qst_skill = $src_skills->getSkillForQuestion($src_qst_id);
3902 $tgt_skills->addQuestionSkillAssignment($tgt_qst_id, $qst_skill[
"base_skill_id"], $qst_skill[
"tref_id"]);
3908 $questionblocks = array();
3909 $questionblock_questions = array();
3911 "SELECT * FROM svy_qblk_qst WHERE survey_fi = %s",
3917 array_push($questionblock_questions,
$row);
3918 $questionblocks[
$row[
"questionblock_fi"]] =
$row[
"questionblock_fi"];
3922 foreach ($questionblocks as
$key => $value) {
3924 $questionblock_id =
self::_addQuestionblock($questionblock[
"title"], $questionblock[
"owner_fi"], $questionblock[
"show_questiontext"], $questionblock[
"show_blocktitle"]);
3925 $questionblocks[
$key] = $questionblock_id;
3928 foreach ($questionblock_questions as
$key => $value) {
3929 if ($questionblocks[$value[
"questionblock_fi"]] &&
3930 $question_pointer[$value[
"question_fi"]]) {
3931 $next_id =
$ilDB->nextId(
'svy_qblk_qst');
3932 $affectedRows =
$ilDB->manipulateF(
3933 "INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) " .
3934 "VALUES (%s, %s, %s, %s)",
3935 array(
'integer',
'integer',
'integer',
'integer'),
3936 array($next_id, $newObj->getSurveyId(), $questionblocks[$value[
"questionblock_fi"]], $question_pointer[$value[
"question_fi"]])
3943 $newConstraints = array();
3944 foreach ($constraints as
$key => $constraint) {
3945 if ($question_pointer[$constraint[
"for_question"]] &&
3946 $question_pointer[$constraint[
"question"]]) {
3947 if (!array_key_exists($constraint[
'id'], $newConstraints)) {
3948 $constraint_id = $newObj->addConstraint($question_pointer[$constraint[
"question"]], $constraint[
"relation_id"], $constraint[
"value"], $constraint[
'conjunction']);
3949 $newConstraints[$constraint[
'id']] = $constraint_id;
3951 $newObj->addConstraintToQuestion($question_pointer[$constraint[
"for_question"]], $newConstraints[$constraint[
'id']]);
3956 include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
3958 $obj_settings->cloneSettings($newObj->getId());
3959 unset($obj_settings);
3968 "SELECT * FROM svy_svy_qst WHERE question_fi = %s",
3974 return $row[
"heading"];
3987 foreach ($mapping as $original_id => $new_id) {
3989 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
4005 if (!is_writable($svy_data_dir)) {
4006 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4007 throw new ilSurveyException(
"Survey Data Directory (" . $svy_data_dir .
") not writeable.");
4011 $svy_dir = $svy_data_dir .
"/svy_" . $this->
getId();
4013 if (!@is_dir($svy_dir)) {
4014 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4018 $export_dir = $svy_dir .
"/export";
4020 if (!@is_dir($export_dir)) {
4021 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4048 if (!is_writable($svy_data_dir)) {
4049 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4050 throw new ilSurveyException(
"Survey Data Directory (" . $svy_data_dir .
") not writeable.");
4054 $svy_dir = $svy_data_dir .
"/svy_" . $this->
getId();
4056 if (!@is_dir($svy_dir)) {
4057 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4062 $import_dir = $svy_dir .
"/import";
4064 if (!@is_dir($import_dir)) {
4065 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4076 "/svy_" . $this->
getId() .
"/import";
4077 if (!is_dir($import_dir)) {
4080 if (@is_dir($import_dir)) {
4091 $affectedRows =
$ilDB->manipulateF(
4092 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4093 array(
'text',
'integer',
'integer'),
4094 array($heading, $this->
getSurveyId(), $insertbefore)
4097 $affectedRows =
$ilDB->manipulateF(
4098 "UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4099 array(
'text',
'integer',
'integer'),
4110 "SELECT anonymous_id FROM svy_anonymous WHERE survey_key = %s AND survey_fi = %s",
4111 array(
'text',
'integer'),
4114 return (
$result->numRows() == 1) ? true :
false;
4121 if ($user_id == ANONYMOUS_USER_ID) {
4126 $ilDB->manipulate(
"UPDATE svy_anonymous" .
4127 " SET user_key = " .
$ilDB->quote(md5($user_id),
"text") .
4128 " WHERE survey_key = " .
$ilDB->quote(
$code,
"text"));
4137 "SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
4138 array(
'text',
'integer'),
4141 return (
$result->numRows() == 1) ? true :
false;
4170 include_once
"./Services/Link/classes/class.ilLink.php";
4172 $sql =
"SELECT svy_anonymous.*, svy_finished.state" .
4173 " FROM svy_anonymous" .
4174 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
4175 " WHERE svy_anonymous.survey_fi = " .
$ilDB->quote($this->
getSurveyId(),
"integer") .
4176 " AND svy_anonymous.user_key IS NULL";
4179 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.survey_key", $a_codes,
"",
"text");
4181 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.anonymous_id", $a_ids,
"",
"text");
4188 $titles[] =
'"' .
$lng->txt(
"survey_code") .
'"';
4189 $titles[] =
'"' .
$lng->txt(
"email") .
'"';
4190 $titles[] =
'"' .
$lng->txt(
"lastname") .
'"';
4191 $titles[] =
'"' .
$lng->txt(
"firstname") .
'"';
4192 $titles[] =
'"' .
$lng->txt(
"create_date") .
'"';
4193 $titles[] =
'"' .
$lng->txt(
"used") .
'"';
4194 $titles[] =
'"' .
$lng->txt(
"mail_sent_short") .
'"';
4195 $titles[] =
'"' .
$lng->txt(
"survey_code_url") .
'"';
4196 $export[] = implode(
";", $titles);
4199 $default_lang =
$ilUser->getPref(
"survey_code_language");
4202 $item[] =
$row[
"survey_key"];
4204 if (
$row[
"externaldata"]) {
4205 $ext = unserialize(
$row[
"externaldata"]);
4206 $item[] = $ext[
"email"];
4207 $item[] = $ext[
"lastname"];
4208 $item[] = $ext[
"firstname"];
4220 $item[] = (
$row[
"sent"]) ? 1 : 0;
4222 $params = array(
"accesscode" =>
$row[
"survey_key"]);
4223 if ($default_lang) {
4224 $params[
"lang"] = $default_lang;
4228 $export[] =
'"' . implode(
'";"', $item) .
'"';
4230 return implode(
"\n", $export);
4244 include_once
"./Services/Link/classes/class.ilLink.php";
4248 $sql =
"SELECT svy_anonymous.*, svy_finished.state" .
4249 " FROM svy_anonymous" .
4250 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)" .
4251 " WHERE svy_anonymous.survey_fi = " .
$ilDB->quote($this->
getSurveyId(),
"integer")
4255 $sql .=
" AND " .
$ilDB->in(
"svy_anonymous.anonymous_id", $ids,
"",
"integer");
4258 $sql .=
" ORDER BY tstamp, survey_key ASC";
4267 $params = array(
"accesscode" =>
$row[
"survey_key"]);
4276 'id' =>
$row[
"anonymous_id"],
4277 'code' =>
$row[
"survey_key"],
4278 'date' =>
$row[
"tstamp"],
4280 'sent' =>
$row[
'sent'],
4287 if (
$row[
"externaldata"]) {
4288 $ext = unserialize(
$row[
"externaldata"]);
4289 $item[
'email'] = $ext[
'email'];
4290 $item[
'last_name'] = $ext[
'lastname'];
4291 $item[
'first_name'] = $ext[
'firstname'];
4294 array_push($codes, $item);
4304 "SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4305 array(
'integer',
'text'),
4308 return (
$result->numRows() > 0) ? true :
false;
4315 "SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4316 array(
'integer',
'text'),
4319 return (
$result->numRows() > 0) ? false :
true;
4328 for (
$i = 0;
$i < $nrOfCodes;
$i++) {
4329 $next_id =
$ilDB->nextId(
'svy_anonymous');
4331 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, tstamp) " .
4332 "VALUES (%s, %s, %s, %s)",
4333 array(
'integer',
'text',
'integer',
'integer'),
4346 $next_id =
$ilDB->nextId(
'svy_anonymous');
4348 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
4349 "VALUES (%s, %s, %s, %s, %s)",
4350 array(
'integer',
'text',
'integer',
'text',
'integer'),
4351 array($next_id, $a_anonymize_key, $this->
getSurveyId(), serialize($a_data), $a_created)
4362 $next_id =
$ilDB->nextId(
'svy_anonymous');
4363 $affectedRows =
$ilDB->manipulateF(
4364 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) " .
4365 "VALUES (%s, %s, %s, %s, %s)",
4366 array(
'integer',
'text',
'integer',
'text',
'integer'),
4383 $check_finished = ($not_sent > 1);
4385 include_once
"./Services/Mail/classes/class.ilMail.php";
4386 include_once
"./Services/Link/classes/class.ilLink.php";
4389 $user_id =
$DIC->user()->getId();
4390 $mail =
new ilMail($user_id);
4392 foreach ($recipients as
$data) {
4395 switch ((
int) $not_sent) {
4397 $do_send = !(bool)
$data[
'sent'];
4401 $do_send =
$data[
'finished'];
4405 $do_send = !
$data[
'finished'];
4419 "accesscode" =>
$data[
"code"],
4423 $messagetext = str_replace(
'[url]',
$url, $messagetext);
4425 $messagetext = str_replace(
'[' .
$key .
']', $value, $messagetext);
4444 "UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
4445 array(
'integer',
'integer'),
4454 "SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
4460 if (!
$row[
'externaldata']) {
4464 $externaldata = unserialize(
$row[
'externaldata']);
4465 if (!$externaldata[
'email']) {
4469 $externaldata[
'code'] =
$row[
'code'];
4470 $externaldata[
'sent'] =
$row[
'sent'];
4472 if ($a_check_finished) {
4478 array_push(
$res, $externaldata);
4491 "SELECT state FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4492 array(
'integer',
'text'),
4498 return $row[
'state'];
4510 if (strlen($survey_code) > 0) {
4511 $affectedRows =
$ilDB->manipulateF(
4512 "DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4513 array(
'integer',
'text'),
4530 "SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
4531 array(
'integer',
'text'),
4536 $access_code =
$row[
"survey_key"];
4538 return $access_code;
4553 $next_id =
$ilDB->nextId(
'svy_anonymous');
4554 $affectedRows =
$ilDB->manipulateF(
4555 "INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) " .
4556 "VALUES (%s, %s, %s, %s, %s)",
4557 array(
'integer',
'text',
'integer',
'text',
'integer'),
4558 array($next_id, $access_code, $this->
getSurveyId(), md5($user_id), time())
4570 $codestring =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4573 for (
$i = 1;
$i <=5;
$i++) {
4574 $index = mt_rand(0, strlen($codestring)-1);
4589 "SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
4595 return $row[
"tstamp"];
4598 "SELECT tstamp FROM svy_finished WHERE finished_id = %s",
4604 return $row[
"tstamp"];
4630 if (preg_match(
"/<[^>]*?>/", $a_text)) {
4645 public function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag =
true, $add_mobs =
true, $attribs =
null)
4647 include_once
"./Services/RTE/classes/class.ilRTE.php";
4648 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
4650 $a_xml_writer->xmlStartTag(
"material", $attribs);
4652 "type" =>
"text/plain"
4654 if ($this->
isHTML($a_material)) {
4655 $attrs[
"type"] =
"text/xhtml";
4658 $a_xml_writer->xmlElement(
"mattext", $attrs, $mattext);
4662 foreach (
$mobs as $mob) {
4663 $mob_id =
"il_" . IL_INST_ID .
"_mob_" . $mob;
4664 if (strpos($mattext, $mob_id) !==
false) {
4668 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
4669 "type" =>
"svy:html",
4670 "id" => $this->getId()
4672 $a_xml_writer->xmlElement(
"matimage", $imgattrs,
null);
4676 if ($close_material_tag) {
4677 $a_xml_writer->xmlEndTag(
"material");
4692 if ($this->surveyCodeSecurity ==
false) {
4708 if (extension_loaded(
"tidy")) {
4711 "output-xml" =>
true,
4712 "numeric-entities" =>
true
4715 $tidy->parseString($print_output,
$config,
'utf8');
4716 $tidy->cleanRepair();
4717 $print_output = tidy_get_output($tidy);
4718 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
4720 $print_output = str_replace(
" ",
" ", $print_output);
4721 $print_output = str_replace(
"⊗",
"X", $print_output);
4724 $print_output = str_replace(
">",
"~|gt|~", $print_output);
4725 $print_output = str_replace(
"<",
"~|lt|~", $print_output);
4726 $print_output = str_replace(
" ",
"~|nbsp|~", $print_output);
4727 $print_output = preg_replace(
'/&(?!amp)/',
'&', $print_output);
4728 $print_output = str_replace(
"~|nbsp|~",
" ", $print_output);
4729 $print_output = str_replace(
"~|gt|~",
">", $print_output);
4730 $print_output = str_replace(
"~|lt|~",
"<", $print_output);
4732 $xsl = file_get_contents(
"./Modules/Survey/xml/question2fo.xsl");
4736 'font-family="Helvetica, unifont"',
4737 'font-family="' .
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont') .
'"',
4740 $args = array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
4744 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",
null, $args,
$params);
4745 }
catch (Exception $e) {
4746 $this->log->error(
"Print XSLT failed:");
4747 $this->log->error(
"Content: " . $print_output);
4748 $this->log->error(
"Xsl: " . $xsl);
4768 $fp = fopen($fo_file,
"w");
4772 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
4777 }
catch (Exception $e) {
4778 $ilLog->write(__METHOD__ .
': ' . $e->getMessage());
4792 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq", $a_pname)) {
4819 if (!is_array($ids) || count($ids) ==0) {
4823 $result =
$ilDB->query(
"SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " .
$ilDB->in(
'usr_id', $ids,
false,
'integer') .
" ORDER BY login");
4824 $result_array = array();
4826 $result_array[
$row[
"usr_id"]]=
$row;
4828 return $result_array;
4838 $this->mailnotification = ($a_notification) ?
true :
false;
4848 $this->mailaddresses = $a_addresses;
4858 $this->mailparticipantdata = $a_data;
4868 $affectedRows =
$ilDB->manipulateF(
4869 "INSERT INTO svy_times (id, finished_fi, entered_page, left_page, first_question) VALUES (%s, %s, %s, %s,%s)",
4870 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
4871 array(
$id, $finished_id,
$time,
null, $first_question)
4879 $affectedRows =
$ilDB->manipulateF(
4880 "UPDATE svy_times SET left_page = %s WHERE finished_fi = %s AND entered_page = %s",
4881 array(
'integer',
'integer',
'integer'),
4892 "SELECT * FROM svy_times WHERE finished_fi = %s",
4898 if (
$row[
'left_page'] > 0 &&
$row[
'entered_page'] > 0) {
4917 if (
sizeof($this->questions) ==
sizeof($a_order)) {
4918 $this->questions = array_flip($a_order);
4919 $this->saveQuestionsToDB();
4930 $this->pool_usage = (bool) $a_value;
4942 if ($template_settings) {
4943 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
4945 $template_settings = $template_settings->getSettings();
4946 $template_settings = $template_settings[
"use_pool"];
4947 if ($template_settings && $template_settings[
"hide"]) {
4948 $use_pool = (bool) $template_settings[
"value"];
4965 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
4967 $template_settings =
$template->getSettings();
4969 if ($template_settings) {
4970 if ($template_settings[
"show_question_titles"] !==
null) {
4971 if ($template_settings[
"show_question_titles"][
"value"]) {
4978 if ($template_settings[
"use_pool"] !==
null) {
4979 if ($template_settings[
"use_pool"][
"value"]) {
4998 $codes = (bool) $template_settings[
"acc_codes"][
"value"];
4999 $anon = (bool) $template_settings[
"anonymization_options"][
"value"];
5029 public function updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
5033 $a_email = trim($a_email);
5040 $data = array(
"email" => $a_email,
5041 "lastname" => trim($a_last_name),
5042 "firstname" => trim($a_first_name));
5045 "externaldata" => array(
"text", serialize(
$data)),
5046 "sent" => array(
"integer", $a_sent)
5052 array(
"anonymous_id" => array(
"integer", $a_id))
5065 $this->mode_360 = (bool) $a_value;
5075 $this->mode_360_self_eval = (bool) $a_value;
5085 $this->mode_360_self_appr = (bool) $a_value;
5095 $this->mode_360_self_rate = (bool) $a_value;
5105 $this->mode_360_results = (int) $a_value;
5121 $a_user_id != ANONYMOUS_USER_ID) {
5123 "obj_id" => array(
"integer", $this->
getSurveyId()),
5124 "user_id" => array(
"integer", $a_user_id)
5126 $ilDB->insert(
"svy_360_appr", $fields);
5129 if (
$access->checkAccessOfUser($a_user_id,
"read",
"", $this->getRefId())) {
5144 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
5146 $ntf->setLangModules(array(
"svy",
"survey"));
5148 $ntf->setGotoLangId(
'url');
5151 $lng = $ntf->getUserLanguage($a_user_id);
5153 $ntf->setIntroductionLangId(
"svy_user_added_360_appraisee_mail");
5154 $subject = str_replace(
"%1", $this->
getTitle(),
$lng->txt(
"svy_user_added_360_appraisee"));
5157 $mail =
new ilMail(ANONYMOUS_USER_ID);
5164 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
5177 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
5179 $ntf->setLangModules(array(
"svy",
"survey"));
5181 $ntf->setGotoLangId(
'url');
5184 $lng = $ntf->getUserLanguage($a_user_id);
5186 $ntf->setIntroductionLangId(
"svy_user_added_360_appraisee_close_mail");
5187 $subject = str_replace(
"%1", $this->
getTitle(),
$lng->txt(
"svy_user_added_360_appraisee"));
5190 $mail =
new ilMail(ANONYMOUS_USER_ID);
5197 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
5210 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
5212 $ntf->setLangModules(array(
"svy",
"survey"));
5214 $ntf->setGotoLangId(
'url');
5217 $lng = $ntf->getUserLanguage($a_user_id);
5219 $ntf->setIntroductionLangId(
"svy_user_added_360_rater_mail");
5220 $subject = str_replace(
"%1", $this->
getTitle(),
$lng->txt(
"svy_user_added_360_rater"));
5224 $mail =
new ilMail(ANONYMOUS_USER_ID);
5231 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
5241 $set =
$ilDB->query(
"SELECT user_id" .
5242 " FROM svy_360_appr" .
5243 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5244 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
5245 return (
bool)
$ilDB->numRows($set);
5252 $set =
$ilDB->query(
"SELECT has_closed" .
5253 " FROM svy_360_appr" .
5254 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5255 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
5257 return $row[
"has_closed"];
5264 $ilDB->manipulate(
"DELETE FROM svy_360_appr" .
5265 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5266 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
5268 $set =
$ilDB->query(
"SELECT user_id" .
5269 " FROM svy_360_rater" .
5270 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5271 " AND appr_id = " .
$ilDB->quote($a_user_id,
"integer"));
5272 while (
$row =
$ilDB->fetchAssoc($set)) {
5287 $set =
$ilDB->query(
"SELECT * FROM svy_360_appr" .
5288 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
5289 while (
$row =
$ilDB->fetchAssoc($set)) {
5297 foreach ($raters as $rater) {
5298 if ($rater[
"finished"]) {
5302 $res[
$row[
"user_id"]][
"finished"] = $finished .
"/" .
sizeof($raters);
5309 public function addRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5317 !$this->
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id)) {
5319 "obj_id" => array(
"integer", $this->
getSurveyId()),
5320 "appr_id" => array(
"integer", $a_appraisee_id),
5321 "user_id" => array(
"integer", $a_user_id),
5322 "anonymous_id" => array(
"integer", $a_anonymous_id)
5324 $ilDB->insert(
"svy_360_rater", $fields);
5327 if (
$access->checkAccessOfUser($a_user_id,
"read",
"", $this->getRefId())) {
5335 public function isRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5342 (!$a_appraisee_id || $a_appraisee_id == $a_user_id)) {
5348 $sql =
"SELECT user_id" .
5349 " FROM svy_360_rater" .
5351 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
5352 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer");
5353 if ($a_appraisee_id) {
5354 $sql .=
" AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer");
5356 $set =
$ilDB->query($sql);
5357 return (
bool)
$ilDB->numRows($set);
5360 public function deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5369 $ilDB->manipulate(
"DELETE FROM svy_360_rater" .
5370 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5371 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer") .
5372 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
5373 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer"));
5380 $res = $anonymous_ids = array();
5382 $set =
$ilDB->query(
"SELECT * FROM svy_360_rater" .
5383 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5384 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer"));
5385 while (
$row =
$ilDB->fetchAssoc($set)) {
5386 if (
$row[
"anonymous_id"]) {
5387 $res[
"a" .
$row[
"anonymous_id"]] = array(
5388 "lastname" =>
"unknown code " .
$row[
"anonymous_id"],
5389 "sent" =>
$row[
"mail_sent"],
5392 $anonymous_ids[] =
$row[
"anonymous_id"];
5404 if (
sizeof($anonymous_ids)) {
5406 foreach (
$data as $item) {
5407 if (isset(
$res[
"a" . $item[
"id"]])) {
5408 $res[
"a" . $item[
"id"]] = array(
5409 "user_id" =>
"a" . $item[
"id"],
5410 "lastname" => $item[
"last_name"],
5411 "firstname" => $item[
"first_name"],
5412 "name" => $item[
"last_name"] .
", " . $item[
"first_name"],
5414 "email" => $item[
"email"],
5415 "code" => $item[
"code"],
5416 "href" => $item[
"href"],
5417 "sent" =>
$res[
"a" . $item[
"id"]][
"sent"],
5433 $sql =
"SELECT appr_id FROM svy_360_rater" .
5437 $sql .=
" AND user_id = " .
$ilDB->quote($a_user_id,
"integer");
5439 $sql .=
" AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer");
5442 $set =
$ilDB->query($sql);
5443 while (
$row =
$ilDB->fetchAssoc($set)) {
5450 !in_array($a_user_id,
$res)) {
5451 $res[] = $a_user_id;
5461 $set =
$ilDB->query(
"SELECT anonymous_id FROM svy_anonymous" .
5462 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5463 " AND survey_key = " .
$ilDB->quote($a_code,
"text"));
5465 return $res[
"anonymous_id"];
5472 $sql =
"SELECT * FROM svy_finished" .
5474 " AND appr_id = " .
$ilDB->quote($appr_id,
"integer");
5476 $sql .=
" AND user_fi = " .
$ilDB->quote($user_id,
"integer");
5478 $sql .=
" AND anonymous_id = " .
$ilDB->quote($anonymous_code,
"text");
5481 if (
$result->numRows() == 0) {
5485 return (
int)
$row[
"state"];
5501 $user_id != ANONYMOUS_USER_ID &&
5502 $this->
isRater(0, $user_id)) {
5510 } elseif ($user_id == ANONYMOUS_USER_ID ||
5523 $sql =
"SELECT * FROM svy_finished" .
5526 if ($user_id != ANONYMOUS_USER_ID) {
5527 $sql .=
" AND (user_fi = " .
$ilDB->quote($user_id,
"integer") .
5528 " OR anonymous_id = " .
$ilDB->quote($a_code,
"text") .
")";
5532 $sql .=
" AND anonymous_id = " .
$ilDB->quote($a_code,
"text");
5534 $set =
$ilDB->query($sql);
5535 while (
$row =
$ilDB->fetchAssoc($set)) {
5536 $res[
$row[
"finished_id"]] = array(
"appr_id" =>
$row[
"appr_id"],
5537 "user_id" =>
$row[
"user_fi"],
5538 "code" =>
$row[
"anonymous_id"],
5539 "finished" => (
bool)
$row[
"state"]);
5542 return array(
"code"=>$a_code,
"runs"=>
$res);
5549 if ($a_user_id != ANONYMOUS_USER_ID) {
5550 $set =
$ilDB->query(
"SELECT sf.anonymous_id FROM svy_finished sf" .
5551 " WHERE sf.survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5552 " AND sf.user_fi = " .
$ilDB->quote($a_user_id,
"integer"));
5553 $a_code =
$ilDB->fetchAssoc($set);
5554 return $a_code[
"anonymous_id"];
5562 $set =
$ilDB->query(
"SELECT user_fi FROM svy_finished" .
5563 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5564 " AND anonymous_id = " .
$ilDB->quote($a_code,
"text"));
5565 $user_id =
$ilDB->fetchAssoc($set);
5566 $user_id = $user_id[
"user_fi"];
5568 if ($user_id && ($user_id != $a_user_id || $user_id == ANONYMOUS_USER_ID)) {
5580 $set =
$ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished" .
5581 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5582 " AND appr_id = " .
$ilDB->quote($a_appr_id,
"integer"));
5583 while (
$row =
$ilDB->fetchAssoc($set)) {
5584 if ($a_exclude_appraisee &&
$row[
"user_fi"] == $a_appr_id) {
5604 $set =
$ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished" .
5605 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5606 " AND appr_id = " .
$ilDB->quote($a_appr_id,
"integer") .
5607 " AND user_fi = " .
$ilDB->quote($a_rat_id,
"integer"));
5609 return $row[
"finished_id"];
5622 $this->mode_360_skill_service = $a_val;
5635 public function set360RaterSent($a_appraisee_id, $a_user_id, $a_anonymous_id, $a_tstamp =
null)
5643 $ilDB->manipulate(
"UPDATE svy_360_rater" .
5644 " SET mail_sent = " .
$ilDB->quote($a_tstamp,
"integer") .
5645 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5646 " AND appr_id = " .
$ilDB->quote($a_appraisee_id,
"integer") .
5647 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer") .
5648 " AND anonymous_id = " .
$ilDB->quote($a_anonymous_id,
"integer"));
5659 $ilDB->manipulate(
"UPDATE svy_360_appr" .
5660 " SET has_closed = " .
$ilDB->quote(time(),
"integer") .
5661 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5662 " AND user_id = " .
$ilDB->quote($a_user_id,
"integer"));
5665 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
5668 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
5670 $sskill->writeAppraiseeSkills($a_user_id);
5674 if (
$user->getId() != $a_user_id) {
5683 $ilDB->manipulate(
"UPDATE svy_360_appr" .
5684 " SET has_closed = " .
$ilDB->quote(
null,
"integer") .
5685 " WHERE obj_id = " .
$ilDB->quote($this->getSurveyId(),
"integer"));
5690 if (!isset(
$_SESSION[
"360_extrtr"][$a_ref_id])) {
5691 $svy =
new self($a_ref_id);
5694 if ($svy->canStartSurvey(
null,
true) &&
5695 $svy->get360Mode() &&
5696 $svy->isAnonymousKey($a_code)) {
5697 $anonymous_id = $svy->getAnonymousIdByCode($a_code);
5698 if ($anonymous_id) {
5699 if (
sizeof($svy->getAppraiseesToRate(
null, $anonymous_id))) {
5700 $_SESSION[
"360_extrtr"][$a_ref_id] =
true;
5706 $_SESSION[
"360_extrtr"][$a_ref_id] =
false;
5710 return $_SESSION[
"360_extrtr"][$a_ref_id];
5725 $this->reminder_status = (bool) $a_value;
5735 $this->reminder_start = $a_value;
5745 $this->reminder_end = $a_value;
5755 $this->reminder_frequency = (int) $a_value;
5765 $this->reminder_target = (int) $a_value;
5775 $this->reminder_last_sent = $a_value;
5785 $this->reminder_tmpl = $a_value;
5795 $this->tutor_ntf_status = (bool) $a_value;
5805 $this->tutor_ntf_recipients = $a_value;
5815 $this->tutor_ntf_target = (int) $a_value;
5825 $set =
$ilDB->query(
"SELECT COUNT(*) numall FROM svy_finished" .
5826 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
5827 " AND state = " .
$ilDB->quote(1,
"integer") .
5828 " AND " .
$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
5830 if (
$row[
"numall"] ==
sizeof($user_ids)) {
5850 $rater_ids = array();
5852 $this->log->debug(
"Handle appraisee " . $app[
'user_id']);
5860 $this->log->debug(
"...1");
5863 $this->log->debug(
"...2");
5864 if (!is_array($rater_ids[$app[
'user_id']])) {
5865 $rater_ids[$app[
'user_id']] = array();
5867 if (!in_array($app[
"user_id"], $rater_ids[$app[
'user_id']])) {
5868 $rater_ids[$app[
'user_id']][] = $app[
"user_id"];
5873 $this->log->debug(
"Check raters.");
5879 if (!$rater[
"anonymous_id"] && !$rater[
"finished"]) {
5880 if (!is_array($rater_ids[$rater[
"user_id"]])) {
5881 $rater_ids[$rater[
"user_id"]] = array();
5883 if (!in_array($app[
"user_id"], $rater_ids[$rater[
"user_id"]])) {
5884 $rater_ids[$rater[
"user_id"]][] = $app[
"user_id"];
5892 $this->log->debug(
"Found raters:" . count($rater_ids));
5894 foreach ($rater_ids as
$id => $app) {
5895 if (
$access->checkAccessOfUser(
$id,
"read",
"", $this->getRefId())) {
5908 $this->log->debug(
"Send mail to:" . $a_user_id);
5910 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
5912 $ntf->setLangModules(array(
"svy",
"survey"));
5914 $ntf->setGotoLangId(
'url');
5917 $lng = $ntf->getUserLanguage($a_user_id);
5919 $ntf->setIntroductionLangId(
"svy_user_added_360_rater_reminder_mail");
5920 $subject = str_replace(
"%1", $this->
getTitle(),
$lng->txt(
"svy_user_added_360_rater"));
5922 foreach ($a_appraisee_ids as $appraisee_id) {
5927 $mail =
new ilMail(ANONYMOUS_USER_ID);
5928 $mail->enableSOAP(
false);
5934 $ntf->composeAndGetMessage($a_user_id,
null,
"read",
true),
5945 if ((
bool) $a_use_invited) {
5948 $parent_grp_ref_id =
$tree->checkForParentType($this->
getRefId(),
"grp");
5949 if ($parent_grp_ref_id) {
5950 include_once
"Modules/Group/classes/class.ilGroupParticipants.php";
5952 $user_ids = $part->getMembers();
5954 $parent_crs_ref_id =
$tree->checkForParentType($this->
getRefId(),
"crs");
5955 if ($parent_crs_ref_id) {
5956 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
5958 $user_ids = $part->getMembers();
5967 include_once
"./Services/Mail/classes/class.ilMail.php";
5968 include_once
"./Services/User/classes/class.ilObjUser.php";
5969 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
5970 include_once
"./Services/User/classes/class.ilUserUtil.php";
5971 include_once
"./Services/Link/classes/class.ilLink.php";
5977 $ulng->loadLanguageModule(
'survey');
5979 $subject =
sprintf($ulng->txt(
'survey_notification_tutor_subject'), $this->getTitle());
5982 $message .= $ulng->txt(
'survey_notification_tutor_body') .
":\n\n";
5984 $message .=
"\n" . $ulng->txt(
'survey_notification_tutor_link') .
": " . $link;
5986 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
5987 $mail_obj->appendInstallationSignature(
true);
5988 $mail_obj->sendMail(
6006 $now_with_format =
date(
"YmdHis", $now);
6007 $today =
date(
"Y-m-d");
6009 $this->log->debug(
"Check status and dates.");
6028 if ($today < $start ||
6033 $this->log->debug(
"Check access period.");
6036 include_once
"Services/Object/classes/class.ilObjectActivation.php";
6039 ($now < $item_data[
"timing_start"] ||
6040 $now > $item_data[
"timing_end"])) {
6044 $this->log->debug(
"Check frequency.");
6051 $missing_ids = array();
6054 $this->log->debug(
"Entering survey mode.");
6060 $finished_ids = array();
6061 $set =
$ilDB->query(
"SELECT user_fi FROM svy_finished" .
6062 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer") .
6063 " AND state = " .
$ilDB->quote(1,
"text") .
6064 " AND " .
$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
6065 while (
$row =
$ilDB->fetchAssoc($set)) {
6066 $finished_ids[] =
$row[
"user_fi"];
6070 $missing_ids = array_diff($user_ids, $finished_ids);
6072 foreach ($missing_ids as $idx => $user_id) {
6074 if (!$ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->getId())) {
6075 unset($missing_ids[$idx]);
6084 $this->log->debug(
"Entering 360 mode.");
6093 return sizeof($missing_ids);
6101 include_once
"./Services/Mail/classes/class.ilMail.php";
6109 $tmpl_params = array(
6116 include_once
"./Services/Link/classes/class.ilLink.php";
6119 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
6122 foreach ($a_recipient_ids as $user_id) {
6124 $subject = $tmpl->getSubject();
6131 $ulng->loadLanguageModule(
'survey');
6133 $subject =
sprintf($ulng->txt(
'survey_reminder_subject'), $this->getTitle());
6136 $message .= $ulng->txt(
'survey_reminder_body') .
":\n\n";
6138 $message .=
"\n" . $ulng->txt(
'survey_reminder_link') .
": " . $link;
6141 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
6142 $mail_obj->appendInstallationSignature(
true);
6143 $mail_obj->sendMail(
6157 $this->activation_starting_time = $starting_time;
6162 $this->activation_ending_time = $ending_time;
6167 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time :
null;
6172 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time :
null;
6177 $this->view_own_results = (bool) $a_value;
6187 $this->mail_own_results = (bool) $a_value;
6197 $this->mail_confirmation = (bool) $a_value;
6207 $this->anon_user_list = (bool) $a_value;
6223 include_once
"./Services/Administration/classes/class.ilSetting.php";
6224 $surveySetting =
new ilSetting(
"survey");
6225 if (!$surveySetting->get(
"skipped_is_custom",
false)) {
6226 return $lng->txt(
"skipped");
6228 return $surveySetting->get(
"skipped_custom_value",
"");
6236 include_once
"Services/Mail/classes/class.ilMailTemplateDataProvider.php";
6237 include_once
"Modules/Survey/classes/class.ilSurveyMailTemplateReminderContext.php";
6240 $res[$tmpl->getTplId()] = $tmpl->getTitle();
6249 include_once
"Modules/Survey/classes/class.ilSurveyMailTemplateReminderContext.php";
6252 require_once
'Services/Mail/classes/class.ilMailTemplateService.php';
6257 require_once
'Services/Mail/classes/class.ilMailTemplatePlaceholderResolver.php';
6258 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
6261 }
catch (Exception $e) {
6262 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$metadata['__DYNAMIC:1__']
An exception for terminatinating execution or to throw for unit testing.
Survey Question Import Parser.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
static _isComplete($question_id)
Checks whether the question is complete or not.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
Class ilInvalidSurveyImportFileException.
static _getLanguageOfUser($a_usr_id)
Get language object of user.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static getLogger($a_component_id)
Get component logger.
Class ilMailTemplateDataProvider.
Class ilMailTemplaceProcessor.
static getTemplateContextById($a_id)
This class handles base functions for mail handling.
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
static _getAvailableQuestionpools($use_object_id=false, $could_be_offline=false, $showPath=false, $permission="read")
Returns the available question pools for the active user.
static _getQuestionTypeTranslations()
setShowQuestionTitles($a_show)
Sets the status of the display_question_titles attribute.
isAccessibleWithoutCode()
Checks if the survey is accessable without a survey code.
setAuthor($author="")
Sets the authors name of the ilObjSurvey object.
setActivationVisibility($a_value)
const MODE_PREDEFINED_USERS
getUserAccessCode($user_id)
Returns a survey access code that was saved for a registered user.
getParticipantTextResults($active_id)
deleteConstraints($question_id)
Deletes the constraints for a question.
insertQuestion($question_id)
Inserts a question in the survey and saves the relation to the database.
const EVALUATION_ACCESS_PARTICIPANTS
finishSurvey($finished_id)
Finishes the survey creating an entry in the database.
getActiveID($user_id, $anonymize_id, $appr_id)
Checks if a user already started a survey.
setTutorNotificationStatus($a_value)
deleteAppraisee($a_user_id)
deleteSurveyCode($survey_code)
Deletes a given survey access code.
getExportDirectory()
get export directory of survey
getStatus()
Gets the survey status.
removeConstraintsConcerningQuestion($question_id)
Remove constraints concerning a question with a given question_id.
isOffline()
Gets the survey status.
getInvitation()
Gets the invitation status.
getAnonymize()
get anonymize status
setActivationStartDate($starting_time=null)
addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true, $attribs=null)
Creates an XML material tag from a plain text or xhtml text.
getConstraints($question_id)
Returns the constraints to a given question or questionblock.
addQuestion($question_id)
Adds a question to the survey (used in importer!)
getActivationVisibility()
prepareTextareaOutput($txt_output)
Prepares a string for a text area output in surveys.
getQuestionType($question_id)
Returns the question type of a question with a given id.
setIntroduction($introduction="")
Sets the introduction text.
showQuestionTitles()
Sets the question titles visible during the query.
setMailOwnResults($a_value)
deleteWorkingData($question_id, $active_id)
Deletes the working data of a question in the database.
setActivationLimited($a_value)
createImportDirectory()
creates data directory for import files (data_dir/svy_data/svy_<id>/import, depending on data directo...
setStartDateAndTime($start_date="", $start_time)
Sets the start date of the survey.
setInvitationMode($invitation_mode=0)
Sets the invitation mode.
hasAnonymizedResults()
Checks if the survey results are to be anonymized.
updateConstraint($precondition_id, $if_question_id, $relation, $value, $conjunction)
Updates a precondition.
findCodeForUser($a_user_id)
setTutorNotificationTarget($a_value)
disinviteUser($user_id)
Disinvites a user from a survey.
updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
loadQuestionsFromDb()
Loads the survey questions from the database.
static _getConstraints($survey_id)
Returns the constraints to a given question or questionblock.
getReminderMailTemplates()
setMailAddresses($a_addresses)
addQuestionToBlock($question_id, $questionblock_id)
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
getOutro()
Gets the outro text.
create($a_upload=false)
create survey object
isQuestionInAnyBlock($a_question_fi)
Is question already in a block?
getRatersData($a_appraisee_id)
getTutorNotificationRecipients()
createSurveyCodesForExternalData($data)
getQuestionGUI($questiontype, $question_id)
Returns a question gui object to a given questiontype and question id.
createMetaData()
Create meta data entry.
sendAppraiseeCloseNotification($a_user_id)
Send appraisee notification.
cloneTextblocks($mapping)
Clones the textblocks of survey questions.
getPrecondition($id)
Returns a precondition with a given id.
setReminderLastSent($a_value)
importSurveyCode($a_anonymize_key, $a_created, $a_data)
setOutro($outro="")
Sets the outro text.
setActivationEndDate($ending_time=null)
setObligatoryStates($obligatory_questions)
Sets the obligatory states for questions in a survey from the questions form.
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object.
saveHeading($heading="", $insertbefore)
getFinishedIdForAppraiseeIdAndRaterId($a_appr_id, $a_rat_id)
Get finished id for an appraisee and a rater.
addRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
deleteConstraint($constraint_id)
Deletes a constraint of a question.
getUserSurveyExecutionStatus($a_code=null)
const NOTIFICATION_INVITED_USERS
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getInvitationMode()
Gets the invitation mode.
locateImportFiles($a_dir)
Locates the import directory and the xml file in a directory with an unzipped import file.
sendCodes($not_sent, $subject, $message, $lang)
duplicateQuestionForSurvey($question_id, $a_force=false)
Takes a question and creates a copy of the question for use in the survey.
isHTML($a_text)
Checks if a given string contains HTML or not.
getWorkingtimeForParticipant($finished_id)
checkConstraint($constraint_data, $working_data)
Checks if a constraint is valid.
setSurveyId($survey_id)
Sets the survey id.
disinviteAllUsers()
Disinvite all users.
setReminderStart(ilDate $a_value=null)
deleteAllUserData()
Deletes all user data of a survey.
const NOTIFICATION_PARENT_COURSE
setMailConfirmation($a_value)
const EVALUATION_ACCESS_ALL
closeAppraisee($a_user_id)
setStatus($status=self::STATUS_OFFLINE)
Sets the survey status.
deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
setMailNotification($a_notification)
getTextblock($question_id)
setReminderTemplate($a_value)
applySettingsTemplate($template_id)
Apply settings template.
isUnusedCode($a_code, $a_user_id)
setMailParticipantData($a_data)
setInvitation($invitation=0)
Sets the invitation status.
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions and/or questionblocks to another position.
canStartSurvey($anonymous_id=null, $a_no_rbac=false)
Checks if the survey can be started.
isAnonymizedParticipant($key)
updateConjunctionForQuestions($questions, $conjunction)
getQuestionblocksTable($arrFilter)
Calculates the data for the output of the questionblock browser.
getTutorNotificationTarget()
isPoolActive()
Get current pool status.
getUserSettings($usr_id, $key)
getFinishedIdsForAppraiseeId($a_appr_id, $a_exclude_appraisee=false)
const QUESTIONTITLES_VISIBLE
isQuestionInSurvey($a_question_fi)
Check if a question is already in the survey.
isSurveyCodeUnique($code)
& getInvitedUsers()
Returns a list of all invited users in a survey.
getExternalCodeRecipients($a_check_finished=false)
& getSurveyParticipants($finished_ids=null, $force_non_anonymous=false)
toXML()
Returns a QTI xml representation of the survey.
getEvaluationAccess()
Gets the learners evaluation access.
createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions)
Creates a question block for the survey.
static _hasDatasets($survey_id)
getAnonymousIdByCode($a_code)
getLastAccess($finished_id)
getAppraiseesToRate($a_user_id, $a_anonymous_id=null)
const NOTIFICATION_APPRAISEES_AND_RATERS
& getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)
saveToDb()
Saves a survey object to a database.
insertQuestionblock($questionblock_id)
Inserts a questionblock in the survey and saves the relation to the database.
hideQuestionTitles()
Sets the question titles hidden during the query.
setAnonymousUserList($a_value)
const ANONYMIZE_FREEACCESS
saveQuestionsToDb()
Saves the survey questions to the database.
modifyQuestionblock($questionblock_id, $title, $show_questiontext, $show_blocktitle)
Modifies a question block.
updateOrder(array $a_order)
createNewAccessCode()
Returns a new, unused survey access code.
read()
read object data from db into object @access public
loadFromDb()
Loads a survey object from a database.
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
setStartTime($finished_id, $first_question)
getQuestionsTable($arrFilter)
Calculates the data for the output of the question browser.
sendNotificationMail($user_id, $anonymize_id, $appr_id)
saveUserSettings($usr_id, $key, $title, $value)
unfoldQuestionblocks($questionblocks)
Unfolds question blocks of a question pool.
deliverPDFfromFO($fo)
Delivers a PDF file from a XSL-FO string.
is360SurveyStarted($appr_id, $user_id, $anonymous_code=null)
removeSelectedSurveyResults($finished_ids)
Deletes the user data of a given array of survey participants.
setViewOwnResults($a_value)
& getSurveyQuestions($with_answers=false)
Returns the survey questions and questionblocks in an array.
getSurveyId()
Returns the survey database id.
isSurveyFinishedByCode($a_code)
Get if survey is finished for an specific anonymous user code.
setStartDate($start_date="")
Sets the start date of the survey.
removeQuestionFromBlock($question_id, $questionblock_id)
getUserSpecificResults($finished_ids)
Calculates the evaluation data for the user specific results.
sentReminderPlaceholders($a_message, $a_user_id, array $a_context_params)
setInvitationAndMode($invitation=0, $invitation_mode=0)
Sets the invitation status and mode (a more performant solution if you change both)
update()
update object data
setEvaluationAccess($evaluation_access=self::EVALUATION_ACCESS_OFF)
Sets the learners evaluation access.
getEndDate()
Gets the end date of the survey.
sendRaterNotification($a_user_id, $a_appraisee_id)
Send rater notification.
set360SelfEvaluation($a_value)
setTutorNotificationRecipients(array $a_value)
send360ReminderToUser($a_user_id, $a_appraisee_ids)
Send rater notification.
isComplete()
Returns 1, if a survey is complete for use.
getSurveyCodesForExport(array $a_codes=null, array $a_ids=null)
Returns a list of survey codes for file export.
getUserDataFromActiveId($active_id, $force_non_anonymous=false)
Returns the user information from an active_id (survey_finished.finished_id)
setReminderTarget($a_value)
$activation_starting_time
set360RaterSent($a_appraisee_id, $a_user_id, $a_anonymous_id, $a_tstamp=null)
saveCompletionStatus()
Saves the completion status of the survey.
static getSurveySkippedValue()
getAllRelations($short_as_key=false)
Returns all available relations.
getNextPage($active_page_question_id, $direction)
Returns the next "page" of a running test.
const EVALUATION_ACCESS_OFF
& getUserData($ids)
Returns a data of all users specified by id list.
createReference()
creates reference for object
static validateExternalRaterCode($a_ref_id, $a_code)
removeQuestion($question_id)
Remove a question from the survey.
bindSurveyCodeToUser($user_id, $code)
& getEvaluationByUser($questions, $active_id)
Calculates the evaluation data for a given user or anonymous id.
getStartDate()
Gets the start date of the survey.
static _addQuestionblock($title="", $owner=0, $show_questiontext=true, $show_blocktitle=false)
Adds a questionblock to the database.
& getVariables($question_id)
Returns all variables of a question.
getImportDirectory()
get import directory of survey
deleteSurveyRecord()
Deletes the survey from the database.
getSurveyCodesTableData(array $ids=null, $lang=null)
Fetches the data for the survey codes table.
getNotificationTargetUserIds($a_use_invited)
setReminderStatus($a_value)
startSurvey($user_id, $anonymous_id, $appraisee_id)
Starts the survey creating an entry in the database.
sent360Reminders()
Send 360 reminders.
& getQuestionblockQuestions($questionblock_id)
Returns the question titles of all questions of a question block.
saveUserAccessCode($user_id, $access_code)
Saves a survey access code for a registered user to the database.
getTutorNotificationStatus()
const NOTIFICATION_APPRAISEES
removeQuestions($remove_questions, $remove_questionblocks)
Remove questions from the survey.
sentReminder(array $a_recipient_ids)
fixSequenceStructure()
Remove duplicate sequence entries, see #22018.
& getSurveyFinishedIds()
Get the finished id's of all survey participants.
set360SelfAppraisee($a_value)
getLastActivePage($active_id)
Returns the question id of the last active page a user visited in a survey.
getIntroduction()
Gets the introduction text.
setReminderEnd(ilDate $a_value=null)
setEndDateAndTime($end_date="", $end_time)
Sets the end date of the survey.
setEndDate($end_date="")
Sets the end date of the survey.
sendAppraiseeNotification($a_user_id)
Send appraisee notification.
setTemplate($template_id)
setReminderFrequency($a_value)
createSurveyCodes($nrOfCodes)
getAuthor()
Gets the authors name of the ilObjSurvey object.
& getExistingQuestions()
Gets the question id's of the questions which are already in the survey.
& getQuestionblockQuestionIds($questionblock_id)
Returns the question id's of all questions of a question block.
getShowQuestionTitles()
Gets the status of the display_question_titles attribute.
setAnonymize($a_anonymize)
set anonymize status
isSurveyStarted($user_id, $anonymize_id, $appr_id=0)
Checks if a user already started a survey.
addConstraint($if_question_id, $relation, $value, $conjunction)
Adds a constraint.
& getQuestionpoolTitles($could_be_offline=false, $showPath=false)
Get the titles of all available survey question pools.
set360SelfRaters($a_value)
getAnonymousId($id)
Checks for an anomyous survey id in the database an returns the id.
loadWorkingData($question_id, $active_id)
Gets the working data of question from the database.
isAppraiseeClosed($a_user_id)
addConstraintToQuestion($to_question_id, $constraint_id)
Adds a constraint to a question.
set360SkillService($a_val)
Set skill service.
createExportDirectory()
creates data directory for export files (data_dir/svy_data/svy_<id>/export, depending on data directo...
isOnline()
Gets the survey status.
setPage($finished_id, $page_id)
Sets the number of the active survey page.
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
const NOTIFICATION_RATERS
get360SkillService()
Get skill service.
canExportSurveyCode()
Checks if the survey code can be exported with the survey evaluation.
importObject($file_info, $svy_qpl_id)
Imports a survey from XML into the ILIAS database.
isPluginActive($a_pname)
Checks whether or not a question plugin with a given name is active.
inviteUser($user_id)
Invites a user to a survey.
const QUESTIONTITLES_HIDDEN
& getAvailableQuestionpools($use_obj_id=false, $could_be_offline=false, $showPath=false, $permission="read")
Returns the available question pools for the active user.
static _lookupEmail($a_user_id)
Lookup email.
static _getUserData($a_internalids)
return user data for given user ids
static _lookupLogin($a_user_id)
lookup login
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _lookupName($a_user_id)
lookup user name
static _lookupFullname($a_user_id)
Lookup Full Name.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
setTimingType($a_type)
Set timing type.
static getItem($a_ref_id)
Get item data.
static getInstance($a_obj_id)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
deleteMetaData()
delete meta data entry
updateMetaData()
update meta data entry
getRefId()
get reference id @access public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
getTitle()
get object title @access public
countReferences()
count references of object
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
Settings template application class.
Skill management settings.
Skill/Competence handling in surveys.
Wrapper classes for system notifications.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlHeader()
Writes xml header @access public.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
catch(Exception $e) $message
update($pash, $contents, Config $config)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res