4 include_once
"./Services/Object/classes/class.ilObject.php";
196 $this->survey_id = -1;
197 $this->introduction =
"";
198 $this->outro = $lng->txt(
"survey_finished");
199 $this->author = $ilUser->getFullname();
200 $this->status = self::STATUS_OFFLINE;
201 $this->evaluation_access = self::EVALUATION_ACCESS_OFF;
202 $this->questions =
array();
204 $this->invitation_mode = self::MODE_PREDEFINED_USERS;
205 $this->anonymize = self::ANONYMIZE_OFF;
206 $this->display_question_titles = self::QUESTIONTITLES_VISIBLE;
207 $this->surveyCodeSecurity = TRUE;
208 $this->template_id = NULL;
209 $this->pool_usage =
true;
212 parent::__construct($a_id,$a_call_by_reference);
234 parent::createMetaData();
248 if (!parent::update())
260 $result = parent::createReference();
283 array_push($this->questions, $question_id);
299 foreach ($this->questions as $question_id)
308 $remove = parent::delete();
327 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy WHERE survey_id = %s",
332 $result = $ilDB->queryF(
"SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
336 $questionblocks =
array();
339 array_push($questionblocks,
$row[
"questionblock_fi"]);
341 if (count($questionblocks))
343 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_qblk WHERE " . $ilDB->in(
'questionblock_id', $questionblocks,
false,
'integer'));
345 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
351 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_anonymous WHERE survey_fi = %s",
358 $directory = $svy_data_dir.
"/svy_".$this->
getId();
359 if (is_dir($directory))
364 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
370 foreach(
$mobs as $mob)
387 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
391 $active_array =
array();
394 array_push($active_array,
$row[
"finished_id"]);
397 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_finished WHERE survey_fi = %s",
402 foreach ($active_array as $active_fi)
404 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE active_fi = %s",
408 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_times WHERE finished_fi = %s",
414 include_once
"Services/Object/classes/class.ilObjectLP.php";
416 $lp_obj->resetLPDataForCompleteObject();
428 $user_ids[] =
array();
430 foreach ($finished_ids as $finished_id)
432 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE finished_id = %s",
440 $user_ids[] =
$row[
"user_fi"];
443 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE active_fi = %s",
448 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_finished WHERE finished_id = %s",
453 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_times WHERE finished_fi = %s",
459 if(
sizeof($user_ids))
461 include_once
"Services/Object/classes/class.ilObjectLP.php";
463 $lp_obj->resetLPDataForUserIds($user_ids);
471 $sql =
"SELECT * FROM svy_finished".
472 " WHERE survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer");
475 $sql .=
" AND ".$ilDB->in(
"finished_id", $finished_ids,
"",
"integer");
479 $participants =
array();
485 $userdata[
"finished"] = (bool)
$row[
"state"];
486 $userdata[
"finished_tstamp"] =
$row[
"tstamp"];
487 $participants[$userdata[
"sortname"] . $userdata[
"active_id"]] = $userdata;
490 return $participants;
501 if (($this->
getTitle())
and (count($this->questions)))
527 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
528 array(
'text',
'integer',
'integer'),
546 $question_gui = $this->
getQuestionGUI($questiontype, $question_id);
549 if($this->
getId() == $question_gui->object->getObjId() && !$a_force)
554 $duplicate_id = $question_gui->object->duplicate(
true,
"",
"",
"", $this->
getId());
555 return $duplicate_id;
567 $this->log->debug(
"insert question, id:".$question_id);
569 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
572 $this->log->debug(
"question is not complete");
579 $result = $ilDB->queryF(
"SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
583 $sequence =
$result->numRows();
585 $this->log->debug(
"duplicate, id: ".$question_id.
", duplicate id: ".$duplicate_id);
593 $next_id = $ilDB->nextId(
'svy_svy_qst');
594 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
595 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
599 $this->log->debug(
"added entry to svy_svy_qst, id: ".$next_id.
", question id: ".$duplicate_id.
", sequence: ".$sequence);
616 $ilDB = $DIC->database();
618 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst ".
619 " WHERE survey_fi = ".
$ilDB->quote($this->getSurveyId(),
"integer").
620 " AND question_fi = ".
$ilDB->quote($a_question_fi,
"integer"));
621 if ($rec =
$ilDB->fetchAssoc($set))
638 $result = $ilDB->queryF(
"SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle,".
639 " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst".
640 " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi".
641 " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi".
642 " AND svy_qblk.questionblock_id = %s".
643 " ORDER BY svy_svy_qst.sequence",
645 array($questionblock_id)
647 $questions =
array();
648 $show_questiontext = 0;
649 $show_blocktitle = 0;
653 array_push($questions, $duplicate_id);
655 $show_questiontext =
$row[
"show_questiontext"];
656 $show_blocktitle =
$row[
"show_blocktitle"];
665 $next_id = $ilDB->nextId(
'svy_settings');
666 $affectedRows = $ilDB->insert(
"svy_settings",
array(
667 "settings_id" =>
array(
"integer", $next_id),
668 "usr_id" =>
array(
"integer", $usr_id),
669 "keyword" =>
array(
"text", $key),
671 "value" =>
array(
"clob", $value)
679 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_settings WHERE settings_id = %s",
683 return $affectedRows;
690 $result = $ilDB->queryF(
"SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
691 array(
'integer',
'text'),
716 if(is_object($rmd_start))
721 if(is_object($rmd_end))
726 include_once(
"./Services/RTE/classes/class.ilRTE.php");
729 $next_id = $ilDB->nextId(
'svy_svy');
730 $affectedRows = $ilDB->insert(
"svy_svy",
array(
731 "survey_id" =>
array(
"integer", $next_id),
761 "reminder_start" =>
array(
"datetime", $rmd_start),
762 "reminder_end" =>
array(
"datetime", $rmd_end),
779 $affectedRows = $ilDB->update(
"svy_svy",
array(
807 "reminder_start" =>
array(
"datetime", $rmd_start),
808 "reminder_end" =>
array(
"datetime", $rmd_end),
833 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
849 $item->update($this->ref_id);
863 $this->log->debug(
"save questions");
866 $old_questions =
array();
867 $result = $ilDB->queryF(
"SELECT survey_question_id,question_fi,sequence".
868 " FROM svy_svy_qst WHERE survey_fi = %s",
874 $old_questions[
$row[
"question_fi"]] =
$row;
879 foreach($this->questions as $seq => $fi)
881 if(!array_key_exists($fi, $old_questions))
885 else if($old_questions[$fi][
"sequence"] != $seq)
887 $update[$fi] = $old_questions[$fi][
"survey_question_id"];
890 unset($old_questions[$fi]);
894 if(
sizeof($old_questions))
897 foreach($old_questions as $fi =>
$old)
899 $del_ids[] =
$old[
"survey_question_id"];
901 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst".
902 " WHERE ".$ilDB->in(
"survey_question_id", $del_ids,
"",
"integer"));
903 $this->log->debug(
"delete: ".$q);
905 unset($old_questions);
908 foreach($this->questions as $seq => $fi)
915 $next_id = $ilDB->nextId(
'svy_svy_qst');
916 $ilDB->manipulateF(
"INSERT INTO svy_svy_qst" .
917 " (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp)" .
918 " VALUES (%s, %s, %s, %s, %s, %s)",
919 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer'),
922 $this->log->debug(
"insert svy_svy_qst, id:" . $next_id .
", fi: " . $fi .
", seq:" . $seq);
925 else if(array_key_exists($fi, $update))
927 $ilDB->manipulate(
"UPDATE svy_svy_qst".
928 " SET sequence = ".$ilDB->quote($seq,
"integer").
929 ", tstamp = ".$ilDB->quote(
time(),
"integer").
930 " WHERE survey_question_id = ".$ilDB->quote($update[$fi],
"integer"));
931 $this->log->debug(
"update svy_svy_qst, id:".$update[$fi].
", fi: ".$fi.
", seq:".$seq);
946 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_finished WHERE anonymous_id = %s",
953 return $row[
"anonymous_id"];
969 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
983 if ($question_id < 1)
return -1;
984 $result = $ilDB->queryF(
"SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
985 "svy_question.questiontype_fi = svy_qtype.questiontype_id",
992 return $data[
"type_tag"];
1016 switch ($a_anonymize)
1018 case self::ANONYMIZE_OFF:
1019 case self::ANONYMIZE_ON:
1020 case self::ANONYMIZE_FREEACCESS:
1021 case self::ANONYMIZE_CODE_ALL:
1022 $this->anonymize = $a_anonymize;
1025 $this->anonymize = self::ANONYMIZE_OFF;
1037 return ($this->anonymize) ? $this->anonymize : 0;
1047 return ($this->
getAnonymize() == self::ANONYMIZE_OFF ||
1070 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi = %s",
1079 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1081 if (strcmp(
$data[
"outro"],
"survey_finished") == 0)
1083 $this->
setOutro($this->lng->txt(
"survey_finished"));
1132 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1134 switch($activation[
"timing_type"])
1159 $this->questions =
array();
1160 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1166 $this->questions[
$data[
"sequence"]] = $data[
"question_fi"];
1177 $ilDB = $DIC->database();
1180 $result =
$ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1187 $to_delete_ids =
array();
1190 if (in_array(
$data[
"question_fi"], $fis))
1192 $to_delete_ids[] =
$data[
"survey_question_id"];
1196 $fis[] =
$data[
"question_fi"];
1201 if (count($to_delete_ids) > 0)
1203 $ilDB->manipulate($q =
"DELETE FROM svy_svy_qst" .
1204 " WHERE " .
$ilDB->in(
"survey_question_id", $to_delete_ids,
false,
"integer") .
1206 $this->log->debug(
"delete: " . $q);
1208 $ilDB->manipulate($q =
"DELETE FROM svy_qblk_qst " .
1209 " WHERE " .
$ilDB->in(
"question_fi", $fis,
true,
"integer") .
1211 $this->log->debug(
"delete: " . $q);
1215 $set =
$ilDB->query(
"SELECT * FROM svy_svy_qst ".
1216 " WHERE survey_fi = " .
$ilDB->quote($this->getSurveyId(),
"integer").
" ORDER BY sequence");
1218 while ($rec =
$ilDB->fetchAssoc($set))
1220 $ilDB->manipulate($q =
"UPDATE svy_svy_qst SET ".
1221 " sequence = ".
$ilDB->quote($seq++ ,
"integer").
1222 " WHERE survey_question_id = ".$ilDB->quote($rec[
"survey_question_id"],
"integer")
1224 $this->log->debug(
"update: " . $q);
1253 $md_life =& $md->getLifecycle();
1256 if (strlen($a_author) == 0)
1259 $a_author = $ilUser->getFullname();
1262 $md_life =& $md->addLifecycle();
1264 $con =& $md_life->addContribute();
1265 $con->setRole(
"Author");
1267 $ent =& $con->addEntity();
1268 $ent->setEntity($a_author);
1283 include_once
"./Services/MetaData/classes/class.ilMD.php";
1285 $md_life =& $md->getLifecycle();
1288 $ids =& $md_life->getContributeIds();
1289 foreach ($ids as
$id)
1291 $md_cont =& $md_life->getContribute($id);
1292 if (strcmp($md_cont->getRole(),
"Author") == 0)
1294 $entids =& $md_cont->getEntityIds();
1295 foreach ($entids as $entid)
1297 $md_ent =& $md_cont->getEntity($entid);
1298 array_push($author, $md_ent->getEntity());
1303 return join($author,
",");
1314 return ($this->display_question_titles) ? 1 : 0;
1325 $this->display_question_titles = ($a_show) ? 1 : 0;
1336 $this->display_question_titles = 1;
1347 $this->display_question_titles = 0;
1359 global
$ilDB, $ilAccess;
1370 $result = $ilDB->query(
"SELECT usr_id FROM usr_data");
1373 if ($ilAccess->checkAccessOfUser(
$row[
"usr_id"],
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
1451 include_once
"./Services/Administration/classes/class.ilSetting.php";
1452 $surveySetting =
new ilSetting(
"survey");
1453 $unlimited_invitation = $surveySetting->get(
"unlimited_invitation");
1454 if (!$unlimited_invitation && $this->invitation_mode == self::MODE_UNLIMITED)
1456 return self::MODE_PREDEFINED_USERS;
1460 return ($this->invitation_mode) ? $this->invitation_mode : self::MODE_UNLIMITED;
1473 return ($this->status) ? $this->status : self::STATUS_OFFLINE;
1485 return ($this->status == self::STATUS_ONLINE) ? true :
false;
1497 return ($this->status == self::STATUS_OFFLINE) ? true :
false;
1511 if (($status == self::STATUS_ONLINE) && (count($this->questions) == 0))
1513 $this->status = self::STATUS_OFFLINE;
1514 $result = $this->lng->txt(
"cannot_switch_to_online_no_questions");
1532 return (strlen($this->start_date)) ? $this->start_date : NULL;
1547 $edit_settings =
false;
1549 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches))
1551 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1553 if ($now < $epoch_time)
1555 array_push(
$messages,$this->lng->txt(
'start_date_not_reached').
' ('.
1558 $edit_settings =
true;
1562 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches))
1564 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1566 if ($now > $epoch_time)
1568 array_push(
$messages,$this->lng->txt(
'end_date_reached').
' ('.
1571 $edit_settings =
true;
1576 if ($this->
getStatus() == self::STATUS_OFFLINE)
1578 array_push(
$messages, $this->lng->txt(
"survey_is_offline"));
1580 $edit_settings =
true;
1583 if (!$a_no_rbac && !$ilAccess->checkAccess(
"read",
"", $this->ref_id))
1585 array_push(
$messages, $this->lng->txt(
"cannot_participate_survey"));
1604 "edit_settings" => $edit_settings
1630 $y =
''; $m =
'';
$d =
'';
$h =
''; $i =
''; $s =
'';
1631 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches))
1637 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches))
1643 $this->start_date = sprintf(
'%04d%02d%02d%02d%02d%02d',
$y, $m,
$d,
$h, $i, $s);
1655 return (strlen($this->end_date)) ? $this->end_date : NULL;
1680 $y =
''; $m =
'';
$d =
'';
$h =
''; $i =
''; $s =
'';
1681 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches))
1687 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches))
1693 $this->end_date = sprintf(
'%04d%02d%02d%02d%02d%02d',
$y, $m,
$d,
$h, $i, $s);
1705 return ($this->evaluation_access) ? $this->evaluation_access : self::EVALUATION_ACCESS_OFF;
1717 $this->evaluation_access = (
$evaluation_access) ? $evaluation_access : self::EVALUATION_ACCESS_OFF;
1722 $this->activation_visibility = (bool) $a_value;
1732 return (
bool)$this->activation_limited;
1737 $this->activation_limited = (bool)$a_value;
1749 return (strlen($this->introduction)) ? $this->introduction : NULL;
1761 return (strlen($this->outro)) ? $this->outro : NULL;
1773 $existing_questions =
array();
1774 $result = $ilDB->queryF(
"SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1775 "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1781 if(
$data[
"original_id"])
1783 array_push($existing_questions,
$data[
"original_id"]);
1786 return $existing_questions;
1797 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1811 $array_pos = array_search($target_index, $this->questions);
1812 if ($insert_mode == 0)
1814 $part1 = array_slice($this->questions, 0, $array_pos);
1815 $part2 = array_slice($this->questions, $array_pos);
1817 else if ($insert_mode == 1)
1819 $part1 = array_slice($this->questions, 0, $array_pos + 1);
1820 $part2 = array_slice($this->questions, $array_pos + 1);
1822 foreach ($move_questions as $question_id)
1824 if (!(array_search($question_id, $part1) === FALSE))
1826 unset($part1[array_search($question_id, $part1)]);
1828 if (!(array_search($question_id, $part2) === FALSE))
1830 unset($part2[array_search($question_id, $part2)]);
1833 $part1 = array_values($part1);
1834 $part2 = array_values($part2);
1835 $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1836 foreach ($move_questions as $question_id)
1839 foreach ($constraints as $idx => $constraint)
1841 foreach ($part2 as $next_question_id)
1843 if ($constraint[
"question"] == $next_question_id)
1862 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1863 $question = self::_instanciateQuestion($question_id);
1864 #20610 if no question found, do nothing. 1867 $question->delete($question_id);
1881 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1882 array(
'integer',
'integer'),
1887 $remove_constraints =
array();
1890 array_push($remove_constraints,
$row[
"constraint_fi"]);
1892 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1893 array(
'integer',
'integer'),
1896 foreach ($remove_constraints as $key => $constraint_id)
1898 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
1900 array($constraint_id)
1917 $block_sizes =
array();
1920 if (in_array($question_id, $remove_questions)
or in_array(
$data[
"questionblock_id"], $remove_questionblocks))
1922 unset($this->questions[array_search($question_id, $this->questions)]);
1925 else if(
$data[
"questionblock_id"])
1927 $block_sizes[
$data[
"questionblock_id"]]++;
1932 foreach($block_sizes as $block_id =>
$size)
1936 $remove_questionblocks[] = $block_id;
1940 foreach (array_unique($remove_questionblocks) as $questionblock_id)
1942 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk WHERE questionblock_id = %s",
1944 array($questionblock_id)
1946 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1947 array(
'integer',
'integer'),
1952 $this->questions = array_values($this->questions);
1965 foreach ($questionblocks as $index)
1967 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk WHERE questionblock_id = %s",
1971 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
1972 array(
'integer',
'integer'),
1982 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
1983 array(
'integer',
'integer',
'integer'),
1995 $next_id = $ilDB->nextId(
'svy_qblk_qst');
1996 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
1997 "question_fi) VALUES (%s, %s, %s, %s)",
1998 array(
'integer',
'integer',
'integer',
'integer'),
2016 $ilDB = $DIC->database();
2018 $set =
$ilDB->query(
"SELECT * FROM svy_qblk_qst ".
2019 " WHERE survey_fi = ".
$ilDB->quote($this->getSurveyId(),
"integer").
2020 " AND question_fi = ".
$ilDB->quote($a_question_fi,
"integer"));
2021 if ($rec =
$ilDB->fetchAssoc($set))
2039 $result = $ilDB->queryF(
"SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM ".
2040 "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
2041 "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
2043 array($questionblock_id)
2048 $titles[
$row[
"question_fi"]] = $row[
"title"];
2049 $survey_id = $row[
"survey_fi"];
2051 $result = $ilDB->queryF(
"SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
2055 $resultarray =
array();
2059 if (array_key_exists(
$row[
"question_fi"], $titles))
2061 $resultarray[
$counter++] = $titles[
$row[
"question_fi"]];
2064 return $resultarray;
2078 $result = $ilDB->queryF(
"SELECT a.question_fi FROM svy_qblk_qst a JOIN svy_svy_qst b ON (a.question_fi = b.question_fi) ".
2079 " WHERE a.questionblock_fi = %s ORDER BY b.sequence",
2081 array($questionblock_id)
2088 if (!in_array(
$data[
'question_fi'], $ids))
2090 array_push($ids,
$data[
'question_fi']);
2108 $result = $ilDB->queryF(
"SELECT * FROM svy_qblk WHERE questionblock_id = %s",
2110 array($questionblock_id)
2127 $next_id = $ilDB->nextId(
'svy_qblk');
2128 $ilDB->manipulateF(
"INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
2129 " show_blocktitle, owner_fi, tstamp) " .
2130 "VALUES (%s, %s, %s, %s, %s, %s)",
2131 array(
'integer',
'text',
'integer',
'integer',
'integer',
'integer'),
2154 $next_id = $ilDB->nextId(
'svy_qblk');
2155 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
2156 " show_blocktitle, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
2157 array(
'integer',
'text',
'text',
'text',
'integer',
'integer'),
2158 array($next_id,
$title, $show_questiontext, $show_blocktitle, $ilUser->getId(),
time())
2162 $questionblock_id = $next_id;
2163 foreach ($questions as $index)
2167 $next_id = $ilDB->nextId(
'svy_qblk_qst');
2168 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
2169 "question_fi) VALUES (%s, %s, %s, %s)",
2170 array(
'integer',
'integer',
'integer',
'integer'),
2189 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_qblk SET title = %s, show_questiontext = %s,".
2190 " show_blocktitle = %s WHERE questionblock_id = %s",
2191 array(
'text',
'text',
'text',
'integer'),
2192 array(
$title, $show_questiontext, $show_blocktitle, $questionblock_id)
2205 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
2206 array(
'integer',
'integer'),
2209 $constraints =
array();
2212 array_push($constraints,
$row[
"constraint_fi"]);
2214 foreach ($constraints as $constraint_id)
2230 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
2232 array($constraint_id)
2234 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
2236 array($constraint_id)
2249 $all_questions =
array();
2250 $result = $ilDB->queryF(
"SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, ".
2251 "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2252 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2253 "ORDER BY svy_svy_qst.sequence",
2257 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2270 $question = self::_instanciateQuestion(
$row[
"question_id"]);
2271 $questionrow = $question->getQuestionDataArray(
$row[
"question_id"]);
2272 foreach (
$row as $key => $value)
2274 $questionrow[$key] = $value;
2276 $all_questions[
$row[
"question_id"]] = $questionrow;
2277 $all_questions[$row[
"question_id"]][
"usableForPrecondition"] = $question->usableForPrecondition();
2278 $all_questions[$row[
"question_id"]][
"availableRelations"] = $question->getAvailableRelations();
2282 $questionblocks =
array();
2283 if (count($all_questions))
2285 $result = $ilDB->queryF(
"SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
2286 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2287 "AND " . $ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2293 $questionblocks[
$row[
'question_fi']] =
$row;
2297 foreach ($all_questions as $question_id =>
$row)
2300 if (isset($questionblocks[$question_id]))
2302 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2303 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2304 $all_questions[$question_id][
"constraints"] = $constraints;
2308 $all_questions[$question_id][
"questionblock_title"] =
"";
2309 $all_questions[$question_id][
"questionblock_id"] =
"";
2310 $all_questions[$question_id][
"constraints"] = $constraints;
2315 $result = $ilDB->queryF(
"SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
2316 "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id ".
2317 "ORDER BY sequence ASC",
2325 array_push($answers,
$data[
"title"]);
2328 $all_questions[$question_id][
"answers"] = $answers;
2331 return $all_questions;
2343 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
2351 if (!array_key_exists(
$row[
"question_fi"], $obligatory_questions))
2353 $obligatory_questions[
$row[
"question_fi"]] = 0;
2359 foreach ($obligatory_questions as $question_fi => $obligatory)
2362 $ilDB->manipulate(
"UPDATE svy_question".
2363 " SET obligatory = ".$ilDB->quote($obligatory,
"integer").
2364 " WHERE question_id = ".$ilDB->quote($question_fi,
"integer"));
2377 $all_questions =
array();
2378 $result = $ilDB->queryF(
"SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
2379 "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2380 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id ".
2381 "ORDER BY svy_svy_qst.sequence",
2387 $all_questions[
$row[
"question_id"]] =
$row;
2390 $questionblocks =
array();
2391 if (count($all_questions))
2393 $result = $ilDB->queryF(
"SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst ".
2394 "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s ".
2395 "AND " . $ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2401 $questionblocks[
$row[
'question_fi']] =
$row;
2405 $all_pages =
array();
2408 foreach ($all_questions as $question_id =>
$row)
2410 $constraints =
array();
2411 if (isset($questionblocks[$question_id]))
2413 if (!$currentblock
or ($currentblock != $questionblocks[$question_id][
'questionblock_id']))
2417 $all_questions[$question_id][
'page'] = $pageindex;
2418 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2419 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2420 $all_questions[$question_id][
"questionblock_show_questiontext"] = $questionblocks[$question_id][
'show_questiontext'];
2421 $all_questions[$question_id][
"questionblock_show_blocktitle"] = $questionblocks[$question_id][
'show_blocktitle'];
2422 $currentblock = $questionblocks[$question_id][
'questionblock_id'];
2424 $all_questions[$question_id][
"constraints"] = $constraints;
2429 $all_questions[$question_id][
'page'] = $pageindex;
2430 $all_questions[$question_id][
"questionblock_title"] =
"";
2431 $all_questions[$question_id][
"questionblock_id"] =
"";
2432 $all_questions[$question_id][
"questionblock_show_questiontext"] = 1;
2433 $all_questions[$question_id][
"questionblock_show_blocktitle"] = 1;
2436 $all_questions[$question_id][
"constraints"] = $constraints;
2438 if (!isset($all_pages[$pageindex]))
2440 $all_pages[$pageindex] =
array();
2442 array_push($all_pages[$pageindex], $all_questions[$question_id]);
2445 $max = count($all_pages);
2447 foreach ($all_pages as $index => $block)
2449 foreach ($block as $blockindex => $question)
2451 $all_pages[$index][$blockindex][
"position"] =
$counter / $max;
2471 if (strcmp($active_page_question_id,
"") == 0)
2475 foreach ($pages as $key => $question_array)
2477 foreach ($question_array as $question)
2479 if ($active_page_question_id == $question[
"question_id"])
2485 if ($foundpage == -1)
2491 $foundpage += $direction;
2496 if ($foundpage >= count($pages))
2500 return $pages[$foundpage];
2512 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
2525 $result_array =
array();
2526 $result = $ilDB->queryF(
"SELECT svy_constraint.*, svy_relation.*, svy_qst_constraint.question_fi ref_question_fi FROM svy_qst_constraint, svy_constraint, ".
2527 "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
2528 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2535 $pc = $ilDB->fetchAssoc(
$result);
2549 $result_array =
array();
2550 $result = $ilDB->queryF(
"SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation ".
2551 "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
2552 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s ".
2553 "AND svy_qst_constraint.survey_fi = %s",
2554 array(
'integer',
'integer'),
2559 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2562 $question =
new $question_type();
2563 $question->loadFromDb(
$row[
"question_fi"]);
2564 $valueoutput = $question->getPreconditionValueOutput(
$row[
"value"]);
2565 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));
2567 return $result_array;
2578 $result_array =
array();
2579 $result = $ilDB->queryF(
"SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* ".
2580 "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id ".
2581 "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2587 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']));
2589 return $result_array;
2602 $result_array =
array();
2603 $result = $ilDB->queryF(
"SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN ".
2604 "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s ".
2605 "ORDER BY svy_variable.sequence",
2611 $result_array[
$row->sequence] =
$row;
2613 return $result_array;
2628 $next_id = $ilDB->nextId(
'svy_constraint');
2629 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES ".
2630 "(%s, %s, %s, %s, %s)",
2631 array(
'integer',
'integer',
'integer',
'float',
'integer'),
2632 array($next_id, $if_question_id, $relation, $value, $conjunction)
2655 $next_id = $ilDB->nextId(
'svy_qst_constraint');
2656 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, ".
2657 "constraint_fi) VALUES (%s, %s, %s, %s)",
2658 array(
'integer',
'integer',
'integer',
'integer'),
2676 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s ".
2677 "WHERE constraint_id = %s",
2678 array(
'integer',
'integer',
'float',
'integer',
'integer'),
2679 array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2686 foreach ($questions as $question_id)
2688 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_constraint SET conjunction = %s ".
2689 "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2690 array(
'integer',
'integer'),
2691 array($conjunction, $question_id)
2706 $custom_order =
array(
"equal",
"not_equal",
"less",
"less_or_equal",
"more",
"more_or_equal");
2707 $custom_order = array_flip($custom_order);
2709 $result_array =
array();
2710 $result = $ilDB->query(
"SELECT * FROM svy_relation");
2715 $result_array[
$row[
"shortname"]] =
array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"id" => $row[
"relation_id"],
"order" => $custom_order[$row[
"longname"]]);
2719 $result_array[
$row[
"relation_id"]] =
array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"order" => $custom_order[$row[
"longname"]]);
2724 foreach($result_array as $idx => $item)
2726 unset($result_array[$idx][
"order"]);
2729 return $result_array;
2738 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2757 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s",
2758 array(
'integer',
'integer'),
2761 include_once
'./Services/User/classes/class.ilObjUser.php';
2775 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE user_fi = %s AND survey_fi = %s",
2776 array(
'integer',
'integer'),
2781 $next_id = $ilDB->nextId(
'svy_inv_usr');
2782 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_inv_usr (invited_user_id, survey_fi, user_fi, tstamp) " .
2783 "VALUES (%s, %s, %s, %s)",
2784 array(
'integer',
'integer',
'integer',
'integer'),
2790 include_once
'./Services/User/classes/class.ilObjUser.php';
2805 $result_array =
array();
2806 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2812 array_push($result_array,
$row[
"user_fi"]);
2814 return $result_array;
2828 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2829 array(
'integer',
'integer'),
2830 array($question_id, $active_id)
2845 $result_array =
array();
2846 $result = $ilDB->queryF(
"SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2847 array(
'integer',
'integer'),
2848 array($question_id, $active_id)
2854 array_push($result_array,
$row);
2856 return $result_array;
2860 return $result_array;
2874 if ($this->
getAnonymize() && (strlen($anonymous_id) == 0))
return;
2876 if (strcmp($user_id,
"") == 0)
2878 if ($user_id == ANONYMOUS_USER_ID)
2883 $next_id = $ilDB->nextId(
'svy_finished');
2884 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp, appr_id) ".
2885 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
2886 array(
'integer',
'integer',
'integer',
'text',
'text',
'integer',
'integer'),
2902 $ilDB->manipulateF(
"UPDATE svy_finished SET state = %s, tstamp = %s".
2903 " WHERE survey_fi = %s AND finished_id = %s",
2904 array(
'text',
'integer',
'integer',
'integer'),
2922 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
2923 array(
'integer',
'integer'),
2924 array(($page_id) ? $page_id : 0, $finished_id)
2930 include_once
"./Services/User/classes/class.ilObjUser.php";
2931 include_once
"./Services/User/classes/class.ilUserUtil.php";
2934 $placeholders =
array(
2935 "FIRST_NAME" =>
"firstname",
2936 "LAST_NAME" =>
"lastname",
2939 "firstname" =>
"firstname" 2942 $recipients = preg_split(
'/,/', $this->mailaddresses);
2943 foreach ($recipients as $recipient)
2946 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
2948 $ntf->setLangModules(
array(
"survey"));
2950 $ntf->setSubjectLangId(
'finished_mail_subject');
2953 if(trim($messagetext))
2960 foreach ($placeholders as $key => $mapping)
2964 $messagetext = str_replace(
'[' . $key .
']',
'', $messagetext);
2968 $messagetext = str_replace(
'[' . $key .
']', trim(
$data[$mapping]), $messagetext);
2971 $ntf->setIntroductionDirect($messagetext);
2975 $ntf->setIntroductionLangId(
'survey_notification_finished_introduction');
2981 $ntf->addAdditionalInfo(
'survey_360_appraisee',
2985 $active_id = $this->
getActiveID($user_id, $anonymize_id, $appr_id);
2986 $ntf->addAdditionalInfo(
'results',
2989 $ntf->setGotoLangId(
'survey_notification_tutor_link');
2990 $ntf->setReasonLangId(
'survey_notification_finished_reason');
2992 $ntf->sendMail(
array($recipient), null, null);
3001 $questioncounter = 1;
3002 foreach ($questions as $question_id => $question_data)
3004 $textresult .= $questioncounter++ .
". " . $question_data[
"title"] .
"\n";
3005 $found = $userResults[$question_id][$active_id];
3007 if (is_array($found))
3009 $text = implode(
"\n", $found);
3015 if (strlen(
$text) == 0)
$text = self::getSurveySkippedValue();
3017 $textresult .=
$text .
"\n\n";
3036 $result = $ilDB->queryF(
"SELECT * FROM svy_finished".
3037 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
3038 array(
'integer',
'text',
'integer'),
3044 $result = $ilDB->queryF(
"SELECT * FROM svy_finished".
3045 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
3046 array(
'integer',
'integer',
'integer'),
3060 return (
int)
$row[
"state"];
3080 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished".
3081 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
3082 array(
'integer',
'text',
'integer'),
3088 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished".
3089 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
3090 array(
'integer',
'integer',
'integer'),
3101 return $row[
"finished_id"];
3115 $result = $ilDB->queryF(
"SELECT lastpage FROM svy_finished WHERE finished_id = %s",
3126 return (
$row[
"lastpage"]) ?
$row[
"lastpage"] :
'';
3140 if (count($working_data) == 0)
3145 if ((count($working_data) == 1)
and (strcmp($working_data[0][
"value"],
"") == 0))
3151 foreach ($working_data as
$data)
3153 switch ($constraint_data[
"short"])
3156 if ($data[
"value"] < $constraint_data[
"value"])
3163 if ($data[
"value"] <= $constraint_data[
"value"])
3170 if ($data[
"value"] == $constraint_data[
"value"])
3177 if ($data[
"value"] <> $constraint_data[
"value"])
3184 if ($data[
"value"] >= $constraint_data[
"value"])
3191 if ($data[
"value"] > $constraint_data[
"value"])
3210 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
3214 return (
$result->numRows()) ?
true :
false;
3228 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE survey_fi = %s",
3236 array_push($users,
$row[
"finished_id"]);
3250 $evaluation =
array();
3252 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3258 $question =
new $question_type();
3259 $question->loadFromDb($question_id);
3262 $q_res = $q_eval->getResults();
3265 foreach($finished_ids as $user_id)
3267 $data[$user_id] = $q_eval->parseUserSpecificResults($q_res, $user_id);
3270 $evaluation[$question_id] =
$data;
3287 $surveySetting =
new ilSetting(
"survey");
3288 $use_anonymous_id = array_key_exists(
"use_anonymous_id",
$_GET) ?
$_GET[
"use_anonymous_id"] : $surveySetting->get(
"use_anonymous_id");
3289 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE finished_id = %s",
3294 $foundrows =
$result->numRows();
3299 $name = ($use_anonymous_id) ?
$row[
"anonymous_id"] : $this->lng->txt(
"anonymous");
3301 "fullname" => $name,
3302 "sortname" => $name,
3307 "active_id" =>
"$active_id" 3311 if ((
$row[
"user_fi"] > 0) &&
3312 ((
$row[
"user_fi"] != ANONYMOUS_USER_ID &&
3315 (
bool)$force_non_anonymous))
3317 include_once
'./Services/User/classes/class.ilObjUser.php';
3320 $userdata[
"fullname"] = $userdata[
"sortname"] = $this->lng->txt(
"deleted_user");
3325 $userdata[
"fullname"] = $user->getFullname();
3326 $gender = $user->getGender();
3327 if (strlen($gender) == 1) $gender = $this->lng->txt(
"gender_$gender");
3328 $userdata[
"gender"] = $gender;
3329 $userdata[
"firstname"] = $user->getFirstname();
3330 $userdata[
"lastname"] = $user->getLastname();
3331 $userdata[
"sortname"] = $user->getLastname() .
", " . $user->getFirstname();
3332 $userdata[
"login"] = $user->getLogin();
3354 $result = $ilDB->queryF(
"SELECT * FROM svy_answer WHERE active_fi = %s",
3360 if (!is_array($answers[
$row[
"question_fi"]]))
3362 $answers[$row[
"question_fi"]] =
array();
3364 array_push($answers[$row[
"question_fi"]], $row);
3368 "name" => $userdata[
"fullname"],
3369 "firstname" => $userdata[
"firstname"],
3370 "lastname" => $userdata[
"lastname"],
3371 "login" => $userdata[
"login"],
3372 "gender" => $userdata[
"gender"],
3373 "answers" =>
array()
3375 foreach ($questions as $key => $question)
3377 if (array_key_exists($key, $answers))
3379 $resultset[
"answers"][$key] = $answers[$key];
3383 $resultset[
"answers"][$key] =
array();
3385 sort($resultset[
"answers"][$key]);
3400 if (is_array($arrFilter))
3402 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
3404 $where .=
" AND " . $ilDB->like(
'svy_question.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3406 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
3408 $where .=
" AND " . $ilDB->like(
'svy_question.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
3410 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
3412 $where .=
" AND " . $ilDB->like(
'svy_question.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
3414 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
3416 $where .=
" AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
3418 if (array_key_exists(
'spl', $arrFilter) && strlen($arrFilter[
'spl']))
3420 $where .=
" AND svy_question.obj_fi = " . $ilDB->quote($arrFilter[
'spl'],
'integer');
3426 $forbidden =
" AND " . $ilDB->in(
'svy_question.obj_fi', array_keys($spls),
false,
'integer');
3427 $forbidden .=
" AND svy_question.complete = " . $ilDB->quote(
"1",
'text');
3430 if (count($existing_questions))
3432 $existing =
" AND " . $ilDB->in(
'svy_question.question_id', $existing_questions,
true,
'integer');
3435 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
3438 $query_result = $ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id".
3439 " FROM svy_question, svy_qtype, object_reference".
3440 " WHERE svy_question.original_id IS NULL".$forbidden.$existing.
3441 " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0".
3442 " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
3445 if ($query_result->numRows())
3447 while (
$row = $ilDB->fetchAssoc($query_result))
3449 if (array_key_exists(
'spl_txt', $arrFilter) && strlen($arrFilter[
'spl_txt']))
3451 if(!stristr($spls[
$row[
"obj_fi"]], $arrFilter[
'spl_txt']))
3457 $row[
'ttype'] = $trans[
$row[
'type_tag']];
3462 array_push($rows, $row);
3467 array_push($rows, $row);
3484 if (is_array($arrFilter))
3486 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
3488 $where .=
" AND " . $ilDB->like(
'svy_qblk.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3492 $query_result = $ilDB->query(
"SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE ".
3493 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi ".
3494 "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, ".
3495 "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
3497 if ($query_result->numRows())
3500 $surveytitles =
array();
3501 foreach ($survey_ref_ids as $survey_ref_id)
3506 while (
$row = $ilDB->fetchAssoc($query_result))
3510 foreach ($questions_array as $key => $value)
3512 $questions_array[$key] =
"$counter. $value";
3515 if (strlen($surveytitles[
$row[
"obj_fi"]]))
3517 $rows[$row[
"questionblock_id"]] =
array(
3518 "questionblock_id" => $row[
"questionblock_id"],
3519 "title" => $row[
"title"],
3520 "svy" => $surveytitles[$row[
"obj_fi"]],
3521 "contains" => join($questions_array,
", "),
3522 "owner" => $row[
"owner_fi"]
3538 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
3543 "xmlns:xsi" =>
"http://www.w3.org/2001/XMLSchema-instance",
3544 "xsi:noNamespaceSchemaLocation" =>
"http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd" 3546 $a_xml_writer->xmlStartTag(
"surveyobject", $attrs);
3551 $a_xml_writer->xmlStartTag(
"survey", $attrs);
3553 $a_xml_writer->xmlElement(
"description", NULL, $this->
getDescription());
3554 $a_xml_writer->xmlElement(
"author", NULL, $this->
getAuthor());
3555 $a_xml_writer->xmlStartTag(
"objectives");
3557 "label" =>
"introduction" 3564 $a_xml_writer->xmlEndTag(
"objectives");
3568 $attribs =
array(
"enabled" =>
"1");
3572 $attribs =
array(
"enabled" =>
"0");
3574 $a_xml_writer->xmlElement(
"anonymisation", $attribs);
3575 $a_xml_writer->xmlStartTag(
"restrictions");
3578 $attribs =
array(
"type" =>
"free");
3582 $attribs =
array(
"type" =>
"restricted");
3584 $a_xml_writer->xmlElement(
"access", $attribs);
3587 $attrs =
array(
"type" =>
"date");
3588 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches);
3589 $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]));
3593 $attrs =
array(
"type" =>
"date");
3594 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches);
3595 $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]));
3598 $a_xml_writer->xmlEndTag(
"restrictions");
3602 $hasconstraints = FALSE;
3603 foreach ($pages as $question_array)
3605 foreach ($question_array as $question)
3607 if (count($question[
"constraints"]))
3609 $hasconstraints = TRUE;
3614 if ($hasconstraints)
3616 $a_xml_writer->xmlStartTag(
"constraints");
3617 foreach ($pages as $question_array)
3619 foreach ($question_array as $question)
3621 if (count($question[
"constraints"]))
3624 foreach ($question[
"constraints"] as $constraint)
3627 "sourceref" => $question[
"question_id"],
3628 "destref" => $constraint[
"question"],
3629 "relation" => $constraint[
"short"],
3630 "value" => $constraint[
"value"],
3631 "conjunction" => $constraint[
"conjunction"]
3633 $a_xml_writer->xmlElement(
"constraint", $attribs);
3638 $a_xml_writer->xmlEndTag(
"constraints");
3642 $a_xml_writer->xmlStartTag(
"metadata");
3644 $custom_properties =
array();
3646 $custom_properties[
"status"] = $this->
getStatus();
3648 $custom_properties[
"pool_usage"] = (int)$this->
getPoolUsage();
3656 $custom_properties[
"mode_360"] = (int)$this->
get360Mode();
3660 $custom_properties[
"mode_360_results"] = $this->
get360Results();
3668 foreach($custom_properties as $label => $value)
3670 $a_xml_writer->xmlStartTag(
"metadatafield");
3671 $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
3672 $a_xml_writer->xmlElement(
"fieldentry", NULL, $value);
3673 $a_xml_writer->xmlEndTag(
"metadatafield");
3676 $a_xml_writer->xmlStartTag(
"metadatafield");
3677 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"SCORM");
3678 include_once
"./Services/MetaData/classes/class.ilMD.php";
3681 $md->toXml($writer);
3682 $metadata = $writer->xmlDumpMem();
3683 $a_xml_writer->xmlElement(
"fieldentry", NULL, $metadata);
3684 $a_xml_writer->xmlEndTag(
"metadatafield");
3686 $a_xml_writer->xmlEndTag(
"metadata");
3687 $a_xml_writer->xmlEndTag(
"survey");
3690 $a_xml_writer->xmlStartTag(
"surveyquestions", $attribs);
3692 foreach ($pages as $question_array)
3694 if (count($question_array) > 1)
3696 $attribs =
array(
"id" => $question_array[0][
"question_id"]);
3697 $attribs =
array(
"showQuestiontext" => $question_array[0][
"questionblock_show_questiontext"],
3698 "showBlocktitle" => $question_array[0][
"questionblock_show_blocktitle"]);
3699 $a_xml_writer->xmlStartTag(
"questionblock", $attribs);
3700 if (strlen($question_array[0][
"questionblock_title"]))
3702 $a_xml_writer->xmlElement(
"questionblocktitle", NULL, $question_array[0][
"questionblock_title"]);
3705 foreach ($question_array as $question)
3707 if (strlen($question[
"heading"]))
3709 $a_xml_writer->xmlElement(
"textblock", NULL, $question[
"heading"]);
3711 $questionObject = self::_instanciateQuestion($question[
"question_id"]);
3715 if ($questionObject !== FALSE) $questionObject->insertXML($a_xml_writer, FALSE);
3717 if (count($question_array) > 1)
3719 $a_xml_writer->xmlEndTag(
"questionblock");
3723 $a_xml_writer->xmlEndTag(
"surveyquestions");
3724 $a_xml_writer->xmlEndTag(
"surveyobject");
3725 $xml = $a_xml_writer->xmlDumpMem(FALSE);
3738 if ($question_id < 1)
return FALSE;
3739 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3741 if (strlen($question_type) == 0)
return FALSE;
3743 $question =
new $question_type();
3744 $question->loadFromDb($question_id);
3756 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
3760 $importDirectory =
"";
3763 $current_dir = opendir($a_dir);
3765 while($entryname = readdir($current_dir))
3772 if(is_dir($a_dir.
"/".$file)
and ($file !=
"." and $file!=
".."))
3775 $importDirectory = $a_dir.
"/".
$file;
3778 closedir($current_dir);
3779 if (strlen($importDirectory))
3782 $current_dir = opendir($importDirectory);
3784 while($entryname = readdir($current_dir))
3790 if(@is_file($importDirectory.
"/".$file) &&
3791 ($file !=
"." && $file!=
"..") &&
3792 (preg_match(
"/^[0-9]{10}__[0-9]+__(svy_)*[0-9]+\.[A-Za-z]{1,3}$/", $file) ||
3793 preg_match(
"/^[0-9]{10}__[0-9]+__(survey__)*[0-9]+\.[A-Za-z]{1,3}$/", $file)))
3796 $xmlFile = $importDirectory.
"/".
$file;
3800 return array(
"dir" => $importDirectory,
"xml" => $xmlFile);
3813 if ($svy_qpl_id < 1) $svy_qpl_id = -1;
3815 $source = $file_info[
"tmp_name"];
3817 if (($source ==
'none') || (!$source) || $file_info[
"error"] > UPLOAD_ERR_OK)
3819 $error = $this->lng->txt(
"import_no_file_selected");
3824 if ((strcmp($file_info[
"type"],
"text/xml") == 0) || (strcmp($file_info[
"type"],
"application/xml") == 0))
3826 $this->log->debug(
"isXML");
3830 $suffix = pathinfo($file_info[
"name"]);
3831 if (strcmp(strtolower($suffix[
"extension"]),
"zip") == 0)
3833 $this->log->debug(
"isZip");
3836 if (!$isXml && !$isZip)
3838 $error = $this->lng->txt(
"import_wrong_file_type");
3839 $this->log->debug(
"Survey: Import error. Filetype was \"" . $file_info[
"type"] .
"\"");
3845 $import_subdir =
"";
3849 $importfile = $import_dir.
"/".$file_info[
"name"];
3853 if (!((strlen($found[
"dir"]) > 0) && (strlen($found[
"xml"]) > 0)))
3855 $error = $this->lng->txt(
"wrong_import_file_structure");
3858 $importfile = $found[
"xml"];
3859 $import_subdir = $found[
"dir"];
3863 $importfile = tempnam($import_dir,
"survey_import");
3867 $this->log->debug(
"Import file = $importfile");
3868 $this->log->debug(
"Import subdir = $import_subdir");
3870 $fh = fopen($importfile,
"r");
3873 $error = $this->lng->txt(
"import_error_opening_file");
3876 $xml = fread(
$fh, filesize($importfile));
3880 $error = $this->lng->txt(
"import_error_closing_file");
3885 if (strpos($xml,
"questestinterop"))
3887 include_once(
"./Modules/Survey/exceptions/class.ilInvalidSurveyImportFileException.php");
3898 $this->log->debug(
"survey id = ".$this->
getId());
3899 $this->log->debug(
"question pool id = ".$svy_qpl_id);
3901 include_once(
"./Services/Export/classes/class.ilImport.php");
3903 $config = $imp->getConfig(
"Modules/Survey");
3904 $config->setQuestionPoolID($svy_qpl_id);
3905 $imp->getMapping()->addMapping(
"Modules/Survey",
"svy", 0, $this->
getId());
3906 $imp->importFromDirectory($import_subdir,
"svy",
"Modules/Survey");
3907 $this->log->debug(
"config(Modules/survey)->getQuestionPoolId =".
$config->getQuestionPoolID());
3911 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
3913 $import->setSurveyObject($this);
3914 $import->setXMLContent($xml);
3915 $import->startParsing();
3918 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
3920 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
3921 include_once
"./Services/RTE/classes/class.ilRTE.php";
3922 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
3923 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
3925 $importfile = $import_subdir .
"/" . $mob[
"uri"];
3926 if (file_exists($importfile))
3930 $mob[
"type"] =
"svy:html";
3936 if ($mob[
"type"] ==
"svy:html")
3939 $this->
setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->
getIntroduction()));
3940 $this->
setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->
getOutro()));
3943 else if($import->questions[$mob[
"id"]])
3945 $new_qid = $import->questions[$mob[
"id"]];
3948 $qtext = $new_question->getQuestiontext();
3950 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
3952 $new_question->setQuestiontext($qtext);
3953 $new_question->saveToDb();
3956 if($new_question->getOriginalId())
3959 $pool_question->setQuestiontext($qtext);
3960 $pool_question->saveToDb();
3967 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
3989 public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree =
false)
3996 $newObj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
3998 $newObj->updateMetaData();
4002 $newObj->setOutro($this->
getOutro());
4020 $newObj->set360Mode(
true);
4040 $question_pointer =
array();
4043 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
4045 foreach ($this->questions as $key => $question_id)
4047 $question = self::_instanciateQuestion($question_id);
4052 $question->saveToDb($original_id);
4053 $newObj->questions[$key] = $question->getId();
4054 $question_pointer[$question_id] = $question->getId();
4055 $mapping[$question_id] = $question->getId();
4062 if(!$cp_options->isRootNode($this->getRefId()))
4064 $newObj->setStatus($this->
isOnline()?self::STATUS_ONLINE: self::STATUS_OFFLINE);
4067 $newObj->saveToDb();
4068 $newObj->cloneTextblocks($mapping);
4074 include_once
"./Modules/Survey/classes/class.ilSurveySkill.php";
4078 foreach($mapping as $src_qst_id => $tgt_qst_id)
4080 $qst_skill = $src_skills->getSkillForQuestion($src_qst_id);
4083 $tgt_skills->addQuestionSkillAssignment($tgt_qst_id, $qst_skill[
"base_skill_id"], $qst_skill[
"tref_id"]);
4089 $questionblocks =
array();
4090 $questionblock_questions =
array();
4091 $result = $ilDB->queryF(
"SELECT * FROM svy_qblk_qst WHERE survey_fi = %s",
4099 array_push($questionblock_questions,
$row);
4100 $questionblocks[
$row[
"questionblock_fi"]] = $row[
"questionblock_fi"];
4104 foreach ($questionblocks as $key => $value)
4106 $questionblock = self::_getQuestionblock($key);
4107 $questionblock_id = self::_addQuestionblock($questionblock[
"title"], $questionblock[
"owner_fi"], $questionblock[
"show_questiontext"], $questionblock[
"show_blocktitle"]);
4108 $questionblocks[$key] = $questionblock_id;
4111 foreach ($questionblock_questions as $key => $value)
4113 if($questionblocks[$value[
"questionblock_fi"]] &&
4114 $question_pointer[$value[
"question_fi"]])
4116 $next_id = $ilDB->nextId(
'svy_qblk_qst');
4117 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) ".
4118 "VALUES (%s, %s, %s, %s)",
4119 array(
'integer',
'integer',
'integer',
'integer'),
4120 array($next_id, $newObj->getSurveyId(), $questionblocks[$value[
"questionblock_fi"]], $question_pointer[$value[
"question_fi"]])
4126 $constraints = self::_getConstraints($this->
getSurveyId());
4127 $newConstraints =
array();
4128 foreach ($constraints as $key => $constraint)
4130 if ($question_pointer[$constraint[
"for_question"]] &&
4131 $question_pointer[$constraint[
"question"]])
4133 if (!array_key_exists($constraint[
'id'], $newConstraints))
4135 $constraint_id = $newObj->addConstraint($question_pointer[$constraint[
"question"]], $constraint[
"relation_id"], $constraint[
"value"], $constraint[
'conjunction']);
4136 $newConstraints[$constraint[
'id']] = $constraint_id;
4138 $newObj->addConstraintToQuestion($question_pointer[$constraint[
"for_question"]], $newConstraints[$constraint[
'id']]);
4143 include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
4145 $obj_settings->cloneSettings($newObj->getId());
4146 unset($obj_settings);
4154 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE question_fi = %s",
4161 return $row[
"heading"];
4176 foreach ($mapping as $original_id => $new_id)
4179 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
4195 if(!is_writable($svy_data_dir))
4197 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4198 throw new ilSurveyException(
"Survey Data Directory (".$svy_data_dir.
") not writeable.");
4202 $svy_dir = $svy_data_dir.
"/svy_".$this->
getId();
4204 if(!@is_dir($svy_dir))
4206 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4210 $export_dir = $svy_dir.
"/export";
4212 if(!@is_dir($export_dir))
4214 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4241 if(!is_writable($svy_data_dir))
4243 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4244 throw new ilSurveyException(
"Survey Data Directory (".$svy_data_dir.
") not writeable.");
4248 $svy_dir = $svy_data_dir.
"/svy_".$this->
getId();
4250 if(!@is_dir($svy_dir))
4252 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4257 $import_dir = $svy_dir.
"/import";
4259 if(!@is_dir($import_dir))
4261 include_once
"Modules/Survey/exceptions/class.ilSurveyException.php";
4272 "/svy_".$this->getId().
"/import";
4273 if (!is_dir($import_dir))
4277 if(@is_dir($import_dir))
4292 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4293 array(
'text',
'integer',
'integer'),
4299 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4300 array(
'text',
'integer',
'integer'),
4310 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_anonymous WHERE survey_key = %s AND survey_fi = %s",
4311 array(
'text',
'integer'),
4314 return (
$result->numRows() == 1) ?
true :
false;
4321 if($user_id == ANONYMOUS_USER_ID)
4328 $ilDB->manipulate(
"UPDATE svy_anonymous".
4329 " SET user_key = ".$ilDB->quote(md5($user_id),
"text").
4330 " WHERE survey_key = ".$ilDB->quote(
$code,
"text"));
4338 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
4339 array(
'text',
'integer'),
4342 return (
$result->numRows() == 1) ?
true :
false;
4375 include_once
"./Services/Link/classes/class.ilLink.php";
4377 $sql =
"SELECT svy_anonymous.*, svy_finished.state".
4378 " FROM svy_anonymous".
4379 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
4380 " WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer").
4381 " AND svy_anonymous.user_key IS NULL";
4385 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.survey_key", $a_codes,
"",
"text");
4389 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.anonymous_id", $a_ids,
"",
"text");
4396 $titles[] =
'"'.$lng->txt(
"survey_code").
'"';
4397 $titles[] =
'"'.$lng->txt(
"email").
'"';
4398 $titles[] =
'"'.$lng->txt(
"lastname").
'"';
4399 $titles[] =
'"'.$lng->txt(
"firstname").
'"';
4400 $titles[] =
'"'.$lng->txt(
"create_date").
'"';
4401 $titles[] =
'"'.$lng->txt(
"used").
'"';
4402 $titles[] =
'"'.$lng->txt(
"mail_sent_short").
'"';
4403 $titles[] =
'"'.$lng->txt(
"survey_code_url").
'"';
4404 $export[] = implode(
";", $titles);
4407 $default_lang = $ilUser->getPref(
"survey_code_language");
4411 $item[] =
$row[
"survey_key"];
4413 if(
$row[
"externaldata"])
4415 $ext = unserialize(
$row[
"externaldata"]);
4416 $item[] = $ext[
"email"];
4417 $item[] = $ext[
"lastname"];
4418 $item[] = $ext[
"firstname"];
4432 $item[] = (
$row[
"sent"]) ? 1 : 0;
4437 $params[
"lang"] = $default_lang;
4441 $export[] =
'"'.implode(
'";"', $item).
'"';
4443 return implode(
"\n", $export);
4457 include_once
"./Services/Link/classes/class.ilLink.php";
4461 $sql =
"SELECT svy_anonymous.*, svy_finished.state".
4462 " FROM svy_anonymous".
4463 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
4464 " WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer")
4469 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.anonymous_id", $ids,
"",
"integer");
4472 $sql .=
" ORDER BY tstamp, survey_key ASC";
4496 'id' =>
$row[
"anonymous_id"],
4497 'code' =>
$row[
"survey_key"],
4498 'date' =>
$row[
"tstamp"],
4500 'sent' =>
$row[
'sent'],
4507 if(
$row[
"externaldata"])
4509 $ext = unserialize(
$row[
"externaldata"]);
4510 $item[
'email'] = $ext[
'email'];
4511 $item[
'last_name'] = $ext[
'lastname'];
4512 $item[
'first_name'] = $ext[
'firstname'];
4515 array_push($codes, $item);
4524 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4525 array(
'integer',
'text'),
4528 return (
$result->numRows() > 0) ?
true :
false;
4534 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4535 array(
'integer',
'text'),
4538 return (
$result->numRows() > 0) ?
false :
true;
4547 for ($i = 0; $i < $nrOfCodes; $i++)
4549 $next_id = $ilDB->nextId(
'svy_anonymous');
4550 $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, tstamp) ".
4551 "VALUES (%s, %s, %s, %s)",
4552 array(
'integer',
'text',
'integer',
'integer'),
4565 $next_id = $ilDB->nextId(
'svy_anonymous');
4566 $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) ".
4567 "VALUES (%s, %s, %s, %s, %s)",
4568 array(
'integer',
'text',
'integer',
'text',
'integer'),
4569 array($next_id, $a_anonymize_key, $this->
getSurveyId(), serialize($a_data), $a_created)
4578 foreach (
$data as $dataset)
4581 $next_id = $ilDB->nextId(
'svy_anonymous');
4582 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) ".
4583 "VALUES (%s, %s, %s, %s, %s)",
4584 array(
'integer',
'text',
'integer',
'text',
'integer'),
4601 $check_finished = ($not_sent > 1);
4603 include_once
"./Services/Mail/classes/class.ilMail.php";
4604 include_once
"./Services/Link/classes/class.ilLink.php";
4607 $user_id = $DIC->user()->getId();
4608 $mail =
new ilMail($user_id);
4610 foreach ($recipients as
$data)
4612 if($data[
'email'] && $data[
'code'])
4615 switch ((
int)$not_sent)
4618 $do_send = !(bool)$data[
'sent'];
4622 $do_send = $data[
'finished'];
4626 $do_send = !$data[
'finished'];
4636 $messagetext = $message;
4639 "accesscode" => $data[
"code"],
4642 $messagetext = str_replace(
'[url]',
$url, $messagetext);
4643 foreach ($data as $key => $value)
4645 $messagetext = str_replace(
'[' . $key .
']', $value, $messagetext);
4663 $ilDB->manipulateF(
"UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
4664 array(
'integer',
'integer'),
4672 $result = $ilDB->queryF(
"SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
4679 if(!
$row[
'externaldata'])
4684 $externaldata = unserialize(
$row[
'externaldata']);
4685 if(!$externaldata[
'email'])
4690 $externaldata[
'code'] =
$row[
'code'];
4691 $externaldata[
'sent'] =
$row[
'sent'];
4693 if($a_check_finished)
4698 array_push(
$res, $externaldata);
4712 if (strlen($survey_code) > 0)
4714 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4715 array(
'integer',
'text'),
4731 $result = $ilDB->queryF(
"SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
4732 array(
'integer',
'text'),
4738 $access_code =
$row[
"survey_key"];
4740 return $access_code;
4755 $next_id = $ilDB->nextId(
'svy_anonymous');
4756 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) ".
4757 "VALUES (%s, %s, %s, %s, %s)",
4758 array(
'integer',
'text',
'integer',
'text',
'integer'),
4771 $codestring =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
4774 for ($i = 1; $i <=5; $i++)
4776 $index = mt_rand(0, strlen($codestring)-1);
4777 $code .= substr($codestring, $index, 1);
4791 $result = $ilDB->queryF(
"SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
4798 return $row[
"tstamp"];
4802 $result = $ilDB->queryF(
"SELECT tstamp FROM svy_finished WHERE finished_id = %s",
4809 return $row[
"tstamp"];
4835 if (preg_match(
"/<[^>]*?>/", $a_text))
4853 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $attribs = NULL)
4855 include_once
"./Services/RTE/classes/class.ilRTE.php";
4856 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
4858 $a_xml_writer->xmlStartTag(
"material", $attribs);
4860 "type" =>
"text/plain" 4862 if ($this->
isHTML($a_material))
4864 $attrs[
"type"] =
"text/xhtml";
4867 $a_xml_writer->xmlElement(
"mattext", $attrs, $mattext);
4872 foreach (
$mobs as $mob)
4874 $mob_id =
"il_" . IL_INST_ID .
"_mob_" . $mob;
4875 if (strpos($mattext, $mob_id) !== FALSE)
4880 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
4881 "type" =>
"svy:html",
4882 "id" => $this->
getId()
4884 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
4888 if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
4903 if ($this->surveyCodeSecurity == FALSE)
4921 if (extension_loaded(
"tidy"))
4925 "output-xml" =>
true,
4926 "numeric-entities" =>
true 4929 $tidy->parseString($print_output,
$config,
'utf8');
4930 $tidy->cleanRepair();
4931 $print_output = tidy_get_output($tidy);
4932 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
4936 $print_output = str_replace(
" ",
" ", $print_output);
4937 $print_output = str_replace(
"⊗",
"X", $print_output);
4940 $print_output = str_replace(
">",
"~|gt|~", $print_output);
4941 $print_output = str_replace(
"<",
"~|lt|~", $print_output);
4942 $print_output = str_replace(
" ",
"~|nbsp|~", $print_output);
4943 $print_output = preg_replace(
'/&(?!amp)/',
'&', $print_output);
4944 $print_output = str_replace(
"~|nbsp|~",
" ", $print_output);
4945 $print_output = str_replace(
"~|gt|~",
">", $print_output);
4946 $print_output = str_replace(
"~|lt|~",
"<", $print_output);
4948 $xsl = file_get_contents(
"./Modules/Survey/xml/question2fo.xsl");
4952 'font-family="Helvetica, unifont"',
4953 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
4956 $args =
array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
4961 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args,
$params);
4965 $this->log->error(
"Print XSLT failed:");
4966 $this->log->error(
"Content: ".$print_output);
4967 $this->log->error(
"Xsl: ".$xsl);
4987 $fp = fopen($fo_file,
"w"); fwrite($fp, $fo); fclose($fp);
4989 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
4998 $ilLog->write(__METHOD__.
': '.$e->getMessage());
5011 global $ilPluginAdmin;
5012 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq", $a_pname))
5042 if (!is_array($ids) || count($ids) ==0)
return array();
5044 $result = $ilDB->query(
"SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " . $ilDB->in(
'usr_id', $ids,
false,
'integer') .
" ORDER BY login");
5045 $result_array =
array();
5048 $result_array[
$row[
"usr_id"]]=
$row;
5050 return $result_array;
5060 $this->mailnotification = ($a_notification) ?
true :
false;
5070 $this->mailaddresses = $a_addresses;
5080 $this->mailparticipantdata = $a_data;
5088 $id = $ilDB->nextId(
'svy_times');
5090 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_times (id, finished_fi, entered_page, left_page, first_question) VALUES (%s, %s, %s, %s,%s)",
5091 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
5092 array(
$id, $finished_id, $time, NULL, $first_question)
5100 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_times SET left_page = %s WHERE finished_fi = %s AND entered_page = %s",
5101 array(
'integer',
'integer',
'integer'),
5111 $result = $ilDB->queryF(
"SELECT * FROM svy_times WHERE finished_fi = %s",
5118 if (
$row[
'left_page'] > 0 &&
$row[
'entered_page'] > 0)
5126 $this->template_id = (int)$template_id;
5136 if(
sizeof($this->questions) ==
sizeof($a_order))
5138 $this->questions = array_flip($a_order);
5139 $this->saveQuestionsToDB();
5150 $this->pool_usage = (bool)$a_value;
5162 if($template_settings)
5164 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
5166 $template_settings = $template_settings->getSettings();
5167 $template_settings = $template_settings[
"use_pool"];
5168 if($template_settings && $template_settings[
"hide"])
5170 $use_pool = (bool)$template_settings[
"value"];
5188 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
5190 $template_settings = $template->getSettings();
5191 if($template_settings)
5193 if($template_settings[
"show_question_titles"] !== NULL)
5195 if($template_settings[
"show_question_titles"][
"value"])
5205 if($template_settings[
"use_pool"] !== NULL)
5207 if($template_settings[
"use_pool"][
"value"])
5217 if($template_settings[
"anonymization_options"][
"value"])
5219 $anon_map =
array(
'personalized' => self::ANONYMIZE_OFF,
5220 'anonymize_with_code' => self::ANONYMIZE_ON,
5221 'anonymize_without_code' => self::ANONYMIZE_FREEACCESS);
5222 $this->
setAnonymize($anon_map[$template_settings[
"anonymization_options"][
"value"]]);
5236 public function updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
5240 $a_email = trim($a_email);
5249 "lastname" => trim($a_last_name),
5250 "firstname" => trim($a_first_name));
5253 "externaldata" =>
array(
"text", serialize(
$data)),
5254 "sent" =>
array(
"integer", $a_sent)
5257 $ilDB->update(
"svy_anonymous", $fields,
5258 array(
"anonymous_id" =>
array(
"integer", $a_id)));
5270 $this->mode_360 = (bool)$a_value;
5280 $this->mode_360_self_eval = (bool)$a_value;
5290 $this->mode_360_self_appr = (bool)$a_value;
5300 $this->mode_360_self_rate = (bool)$a_value;
5310 $this->mode_360_results = (int)$a_value;
5323 $a_user_id != ANONYMOUS_USER_ID)
5327 "user_id" =>
array(
"integer", $a_user_id)
5329 $ilDB->insert(
"svy_360_appr", $fields);
5337 $set = $ilDB->query(
"SELECT user_id".
5338 " FROM svy_360_appr".
5339 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5340 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5341 return (
bool)$ilDB->numRows($set);
5348 $set = $ilDB->query(
"SELECT has_closed".
5349 " FROM svy_360_appr".
5350 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5351 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5352 $row = $ilDB->fetchAssoc($set);
5353 return $row[
"has_closed"];
5360 $ilDB->manipulate(
"DELETE FROM svy_360_appr".
5361 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5362 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5364 $set = $ilDB->query(
"SELECT user_id".
5365 " FROM svy_360_rater".
5366 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5367 " AND appr_id = ".$ilDB->quote($a_user_id,
"integer"));
5368 while(
$row = $ilDB->fetchAssoc($set))
5385 $set = $ilDB->query(
"SELECT * FROM svy_360_appr".
5386 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer"));
5387 while(
$row = $ilDB->fetchAssoc($set))
5391 $name[
"name"] = $name[
"lastname"].
", ".$name[
"firstname"];
5396 foreach($raters as $rater)
5398 if($rater[
"finished"])
5403 $res[$row[
"user_id"]][
"finished"] = $finished.
"/".
sizeof($raters);
5404 $res[$row[
"user_id"]][
"closed"] = $row[
"has_closed"];
5410 public function addRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5415 !$this->
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id))
5419 "appr_id" =>
array(
"integer", $a_appraisee_id),
5420 "user_id" =>
array(
"integer", $a_user_id),
5421 "anonymous_id" =>
array(
"integer", $a_anonymous_id)
5423 $ilDB->insert(
"svy_360_rater", $fields);
5427 public function isRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5434 (!$a_appraisee_id || $a_appraisee_id == $a_user_id))
5441 $sql =
"SELECT user_id".
5442 " FROM svy_360_rater".
5443 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
5444 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
5445 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer");
5448 $sql .=
" AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer");
5450 $set = $ilDB->query($sql);
5451 return (
bool)$ilDB->numRows($set);
5454 public function deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5464 $ilDB->manipulate(
"DELETE FROM svy_360_rater".
5465 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5466 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer").
5467 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
5468 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer"));
5477 $set = $ilDB->query(
"SELECT * FROM svy_360_rater".
5478 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5479 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer"));
5480 while(
$row = $ilDB->fetchAssoc($set))
5482 if(
$row[
"anonymous_id"])
5485 "lastname" =>
"unknown code ".
$row[
"anonymous_id"],
5486 "sent" =>
$row[
"mail_sent"],
5489 $anonymous_ids[] =
$row[
"anonymous_id"];
5494 $name[
"name"] = $name[
"lastname"].
", ".$name[
"firstname"];
5495 $name[
"user_id"] =
"u".$name[
"user_id"];
5497 $name[
"sent"] =
$row[
"mail_sent"];
5499 $res[
"u".$row[
"user_id"]] = $name;
5503 if(
sizeof($anonymous_ids))
5506 foreach(
$data as $item)
5508 if(isset(
$res[
"a".$item[
"id"]]))
5511 "user_id" =>
"a".$item[
"id"],
5512 "lastname" => $item[
"last_name"],
5513 "firstname" => $item[
"first_name"],
5514 "name" => $item[
"last_name"].
", ".$item[
"first_name"],
5516 "email" => $item[
"email"],
5517 "code" => $item[
"code"],
5518 "href" => $item[
"href"],
5519 "sent" =>
$res[
"a".$item[
"id"]][
"sent"],
5535 $sql =
"SELECT appr_id FROM svy_360_rater".
5536 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer");
5540 $sql .=
" AND user_id = ".$ilDB->quote($a_user_id,
"integer");
5544 $sql .=
" AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer");
5547 $set = $ilDB->query($sql);
5548 while(
$row = $ilDB->fetchAssoc($set))
5556 !in_array($a_user_id,
$res))
5558 $res[] = $a_user_id;
5568 $set = $ilDB->query(
"SELECT anonymous_id FROM svy_anonymous".
5569 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5570 " AND survey_key = ".$ilDB->quote($a_code,
"text"));
5571 $res = $ilDB->fetchAssoc($set);
5572 return $res[
"anonymous_id"];
5579 $sql =
"SELECT * FROM svy_finished".
5580 " WHERE survey_fi =".$ilDB->quote($this->
getSurveyId(),
"integer").
5581 " AND appr_id = ".$ilDB->quote($appr_id,
"integer");
5584 $sql .=
" AND user_fi = ".$ilDB->quote($user_id,
"integer");
5588 $sql .=
" AND anonymous_id = ".$ilDB->quote($anonymous_code,
"text");
5598 return (
int)
$row[
"state"];
5606 $user_id = $ilUser->getId();
5615 $user_id != ANONYMOUS_USER_ID &&
5628 else if($user_id == ANONYMOUS_USER_ID ||
5645 $sql =
"SELECT * FROM svy_finished".
5646 " WHERE survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer");
5648 if($user_id != ANONYMOUS_USER_ID)
5650 $sql .=
" AND (user_fi = ".$ilDB->quote($user_id,
"integer").
5651 " OR anonymous_id = ".$ilDB->quote($a_code,
"text").
")";
5656 $sql .=
" AND anonymous_id = ".$ilDB->quote($a_code,
"text");
5658 $set = $ilDB->query($sql);
5659 while(
$row = $ilDB->fetchAssoc($set))
5661 $res[
$row[
"finished_id"]] =
array(
"appr_id" => $row[
"appr_id"],
5662 "user_id" => $row[
"user_fi"],
5663 "code" => $row[
"anonymous_id"],
5664 "finished" => (
bool)$row[
"state"]);
5667 return array(
"code"=>$a_code,
"runs"=>
$res);
5674 if($a_user_id != ANONYMOUS_USER_ID)
5676 $set = $ilDB->query(
"SELECT sf.anonymous_id FROM svy_finished sf".
5677 " WHERE sf.survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5678 " AND sf.user_fi = ".$ilDB->quote($a_user_id,
"integer"));
5679 $a_code = $ilDB->fetchAssoc($set);
5680 return $a_code[
"anonymous_id"];
5688 $set = $ilDB->query(
"SELECT user_fi FROM svy_finished".
5689 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5690 " AND anonymous_id = ".$ilDB->quote($a_code,
"text"));
5691 $user_id = $ilDB->fetchAssoc($set);
5692 $user_id = $user_id[
"user_fi"];
5694 if($user_id && ($user_id != $a_user_id || $user_id == ANONYMOUS_USER_ID))
5707 $set = $ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished".
5708 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5709 " AND appr_id = ".$ilDB->quote($a_appr_id,
"integer"));
5710 while(
$row = $ilDB->fetchAssoc($set))
5712 if ($a_exclude_appraisee &&
$row[
"user_fi"] == $a_appr_id)
5733 $set = $ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished".
5734 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5735 " AND appr_id = ".$ilDB->quote($a_appr_id,
"integer").
5736 " AND user_fi = ".$ilDB->quote($a_rat_id,
"integer"));
5737 $row = $ilDB->fetchAssoc($set);
5738 return $row[
"finished_id"];
5751 $this->mode_360_skill_service = $a_val;
5773 $ilDB->manipulate(
"UPDATE svy_360_rater".
5774 " SET mail_sent = ".$ilDB->quote($a_tstamp,
"integer").
5775 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
5776 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer").
5777 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
5778 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer"));
5786 $ilDB->manipulate(
"UPDATE svy_360_appr".
5787 " SET has_closed = ".$ilDB->quote(
time(),
"integer").
5788 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
5789 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5792 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
5796 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
5798 $sskill->writeAppraiseeSkills($a_user_id);
5806 $ilDB->manipulate(
"UPDATE svy_360_appr".
5807 " SET has_closed = ".$ilDB->quote(null,
"integer").
5808 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer"));
5813 if(!isset(
$_SESSION[
"360_extrtr"][$a_ref_id]))
5815 $svy =
new self($a_ref_id);
5818 if($svy->canStartSurvey(null,
true) &&
5819 $svy->get360Mode() &&
5820 $svy->isAnonymousKey($a_code))
5822 $anonymous_id = $svy->getAnonymousIdByCode($a_code);
5825 if(
sizeof($svy->getAppraiseesToRate(null, $anonymous_id)))
5827 $_SESSION[
"360_extrtr"][$a_ref_id] =
true;
5833 $_SESSION[
"360_extrtr"][$a_ref_id] =
false;
5837 return $_SESSION[
"360_extrtr"][$a_ref_id];
5852 $this->reminder_status = (bool)$a_value;
5862 $this->reminder_start = $a_value;
5872 $this->reminder_end = $a_value;
5882 $this->reminder_frequency = (int)$a_value;
5892 $this->reminder_target = (int)$a_value;
5902 $this->reminder_last_sent = $a_value;
5912 $this->reminder_tmpl = $a_value;
5922 $this->tutor_ntf_status = (bool)$a_value;
5932 $this->tutor_ntf_recipients = $a_value;
5942 $this->tutor_ntf_target = (int)$a_value;
5954 $set = $ilDB->query(
"SELECT COUNT(*) numall FROM svy_finished".
5955 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
5956 " AND state = ".$ilDB->quote(1,
"integer").
5957 " AND ".$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
5958 $row = $ilDB->fetchAssoc($set);
5959 if(
$row[
"numall"] ==
sizeof($user_ids))
5971 if((
bool)$a_use_invited)
5977 $parent_grp_ref_id = $tree->checkForParentType($this->
getRefId(),
"grp");
5978 if($parent_grp_ref_id)
5980 include_once
"Modules/Group/classes/class.ilGroupParticipants.php";
5982 $user_ids = $part->getMembers();
5986 $parent_crs_ref_id = $tree->checkForParentType($this->
getRefId(),
"crs");
5987 if($parent_crs_ref_id)
5989 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
5991 $user_ids = $part->getMembers();
6000 include_once
"./Services/Mail/classes/class.ilMail.php";
6001 include_once
"./Services/User/classes/class.ilObjUser.php";
6002 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
6003 include_once
"./Services/User/classes/class.ilUserUtil.php";
6004 include_once
"./Services/Link/classes/class.ilLink.php";
6011 $ulng->loadLanguageModule(
'survey');
6013 $subject = sprintf($ulng->txt(
'survey_notification_tutor_subject'), $this->
getTitle());
6016 $message .= $ulng->txt(
'survey_notification_tutor_body').
":\n\n";
6017 $message .= $ulng->txt(
'obj_svy').
": ". $this->
getTitle().
"\n";
6018 $message .=
"\n".$ulng->txt(
'survey_notification_tutor_link').
": ".$link;
6020 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
6021 $mail_obj->appendInstallationSignature(
true);
6023 "",
"", $subject, $message,
array(),
array(
"system"));
6029 global
$ilDB, $ilAccess;
6032 $now_with_format =
date(
"YmdHis", $now);
6033 $today =
date(
"Y-m-d");
6056 ($end && $today > $end))
6062 include_once
"Services/Object/classes/class.ilObjectActivation.php";
6065 ($now < $item_data[
"timing_start"] ||
6066 $now > $item_data[
"timing_end"]))
6077 $missing_ids =
array();
6084 $finished_ids =
array();
6085 $set = $ilDB->query(
"SELECT user_fi FROM svy_finished".
6086 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6087 " AND state = ".$ilDB->quote(1,
"text").
6088 " AND ".$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
6089 while(
$row = $ilDB->fetchAssoc($set))
6091 $finished_ids[] =
$row[
"user_fi"];
6095 $missing_ids = array_diff($user_ids, $finished_ids);
6098 foreach($missing_ids as $idx => $user_id)
6101 if(!$ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
6103 unset($missing_ids[$idx]);
6116 return sizeof($missing_ids);
6124 include_once
"./Services/Mail/classes/class.ilMail.php";
6133 $tmpl_params =
array(
6142 include_once
"./Services/Link/classes/class.ilLink.php";
6145 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
6148 foreach($a_recipient_ids as $user_id)
6152 $subject = $tmpl->getSubject();
6160 $ulng->loadLanguageModule(
'survey');
6162 $subject = sprintf($ulng->txt(
'survey_reminder_subject'), $this->
getTitle());
6165 $message .= $ulng->txt(
'survey_reminder_body').
":\n\n";
6166 $message .= $ulng->txt(
'obj_svy').
": ". $this->
getTitle().
"\n";
6167 $message .=
"\n".$ulng->txt(
'survey_reminder_link').
": ".$link;
6170 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
6171 $mail_obj->appendInstallationSignature(
true);
6173 "",
"", $subject, $message,
array(),
array(
"system"));
6179 $this->activation_starting_time = $starting_time;
6184 $this->activation_ending_time = $ending_time;
6189 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
6194 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
6199 $this->view_own_results = (bool)$a_value;
6209 $this->mail_own_results = (bool)$a_value;
6219 $this->mail_confirmation = (bool)$a_value;
6229 $this->anon_user_list = (bool)$a_value;
6243 include_once
"./Services/Administration/classes/class.ilSetting.php";
6244 $surveySetting =
new ilSetting(
"survey");
6245 if(!$surveySetting->get(
"skipped_is_custom",
false))
6247 return $lng->txt(
"skipped");
6251 return $surveySetting->get(
"skipped_custom_value",
"");
6259 include_once
"Services/Mail/classes/class.ilMailTemplateDataProvider.php";
6260 include_once
"Modules/Survey/classes/class.ilSurveyMailTemplateReminderContext.php";
6264 $res[$tmpl->getTplId()] = $tmpl->getTitle();
6273 include_once
"Modules/Survey/classes/class.ilSurveyMailTemplateReminderContext.php";
6277 require_once
'Services/Mail/classes/class.ilMailTemplateService.php';
6282 require_once
'Services/Mail/classes/class.ilMailTemplatePlaceholderResolver.php';
6283 require_once
'Services/Mail/classes/class.ilMailFormCall.php';
6290 require_once
'./Services/Logging/classes/public/class.ilLoggerFactory.php';
createSurveyCodes($nrOfCodes)
showQuestionTitles()
Sets the question titles visible during the query.
sendNotificationMail($user_id, $anonymize_id, $appr_id)
static _lookupLogin($a_user_id)
lookup login
getTutorNotificationTarget()
static _lookupName($a_user_id)
lookup user name
set360RaterSent($a_appraisee_id, $a_user_id, $a_anonymous_id, $a_tstamp=null)
static makeDirParents($a_dir)
Create a new directory and all parent directories.
deliverPDFfromFO($fo)
Delivers a PDF file from a XSL-FO string.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
setInvitationAndMode($invitation=0, $invitation_mode=0)
Sets the invitation status and mode (a more performant solution if you change both) ...
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
getAppraiseesToRate($a_user_id, $a_anonymous_id=null)
getUserSurveyExecutionStatus($a_code=null)
createNewAccessCode()
Returns a new, unused survey access code.
updateConjunctionForQuestions($questions, $conjunction)
is360SurveyStarted($appr_id, $user_id, $anonymous_code=null)
setEndDateAndTime($end_date="", $end_time)
Sets the end date of the survey.
isAnonymizedParticipant($key)
sentReminderPlaceholders($a_message, $a_user_id, array $a_context_params)
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
& getSurveyPages()
Returns the survey pages in an array (a page contains one or more questions)
deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
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...
& getEvaluationByUser($questions, $active_id)
Calculates the evaluation data for a given user or anonymous id.
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setReminderLastSent($a_value)
static _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
const EVALUATION_ACCESS_OFF
getParticipantTextResults($active_id)
applySettingsTemplate($template_id)
Apply settings template.
$activation_starting_time
& getSurveyFinishedIds()
Get the finished id's of all survey participants.
getQuestionGUI($questiontype, $question_id)
Returns a question gui object to a given questiontype and question id.
static validateExternalRaterCode($a_ref_id, $a_code)
setMailNotification($a_notification)
disinviteAllUsers()
Disinvite all users.
Skill management settings.
& getSurveyParticipants($finished_ids=null, $force_non_anonymous=false)
saveUserSettings($usr_id, $key, $title, $value)
getConstraints($question_id)
Returns the constraints to a given question or questionblock.
const EVALUATION_ACCESS_PARTICIPANTS
isOffline()
Gets the survey status.
setTutorNotificationTarget($a_value)
static _getStaticLink($a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static getSurveySkippedValue()
static _lookupFullname($a_user_id)
Lookup Full Name.
deleteSurveyCode($survey_code)
Deletes a given survey access code.
getWorkingtimeForParticipant($finished_id)
getSurveyId()
Returns the survey database id.
updateMetaData()
update meta data entry
getSurveyCodesForExport(array $a_codes=null, array $a_ids=null)
Returns a list of survey codes for file export.
isComplete()
Returns 1, if a survey is complete for use.
removeQuestions($remove_questions, $remove_questionblocks)
Remove questions from the survey.
static _hasDatasets($survey_id)
getAnonymousIdByCode($a_code)
Class ilObject Basic functions for all objects.
isAccessibleWithoutCode()
Checks if the survey is accessable without a survey code.
read()
read object data from db into object public
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
canStartSurvey($anonymous_id=NULL, $a_no_rbac=false)
Checks if the survey can be started.
setReminderFrequency($a_value)
removeQuestion($question_id)
Remove a question from the survey.
static getItem($a_ref_id)
Get item data.
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, instead it parses the serialized rbac_pa entries.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteConstraint($constraint_id)
Deletes a constraint of a question.
setAuthor($author="")
Sets the authors name of the ilObjSurvey object.
isOnline()
Gets the survey status.
const TIMINGS_DEACTIVATED
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static _isComplete($question_id)
Checks whether the question is complete or not.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object.
getUserDataFromActiveId($active_id, $force_non_anonymous=false)
Returns the user information from an active_id (survey_finished.finished_id)
prepareTextareaOutput($txt_output)
Prepares a string for a text area output in surveys.
& getVariables($question_id)
Returns all variables of a question.
locateImportFiles($a_dir)
Locates the import directory and the xml file in a directory with an unzipped import file...
getIntroduction()
Gets the introduction text.
unfoldQuestionblocks($questionblocks)
Unfolds question blocks of a question pool.
static _lookupTitle($a_id)
lookup object title
create($a_upload=false)
create survey object
getAnonymize()
get anonymize status
setViewOwnResults($a_value)
getUserAccessCode($user_id)
Returns a survey access code that was saved for a registered user.
static _getConstraints($survey_id)
Returns the constraints to a given question or questionblock.
closeAppraisee($a_user_id)
bindSurveyCodeToUser($user_id, $code)
setTutorNotificationStatus($a_value)
Survey Question Import Parser.
setObligatoryStates($obligatory_questions)
Sets the obligatory states for questions in a survey from the questions form.
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()
getLastAccess($finished_id)
set360SkillService($a_val)
Set skill service.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
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...
Class ilMailTemplateDataProvider.
canExportSurveyCode()
Checks if the survey code can be exported with the survey evaluation.
for($col=0; $col< 50; $col++) $d
getAllRelations($short_as_key=false)
Returns all available relations.
& getQuestionblockQuestions($questionblock_id)
Returns the question titles of all questions of a question block.
addRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
setMailAddresses($a_addresses)
removeQuestionFromBlock($question_id, $questionblock_id)
getSurveyCodesTableData(array $ids=null, $lang=null)
Fetches the data for the survey codes table.
isSurveyCodeUnique($code)
Skill/Competence handling in surveys.
removeConstraintsConcerningQuestion($question_id)
Remove constraints concerning a question with a given question_id.
insertQuestion($question_id)
Inserts a question in the survey and saves the relation to the database.
getUserSpecificResults($finished_ids)
Calculates the evaluation data for the user specific results.
getInvitationMode()
Gets the invitation mode.
removeSelectedSurveyResults($finished_ids)
Deletes the user data of a given array of survey participants.
getEndDate()
Gets the end date of the survey.
getTutorNotificationRecipients()
insertQuestionblock($questionblock_id)
Inserts a questionblock in the survey and saves the relation to the database.
setStartTime($finished_id, $first_question)
setReminderEnd(ilDate $a_value=null)
getAuthor()
Gets the authors name of the ilObjSurvey object.
isHTML($a_text)
Checks if a given string contains HTML or not.
hideQuestionTitles()
Sets the question titles hidden during the query.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
saveQuestionsToDb()
Saves the survey questions to the database.
duplicateQuestionForSurvey($question_id, $a_force=false)
Takes a question and creates a copy of the question for use in the survey.
deleteSurveyRecord()
Deletes the survey from the database.
updateConstraint($precondition_id, $if_question_id, $relation, $value, $conjunction)
Updates a precondition.
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)
Default behaviour is:
isPluginActive($a_pname)
Checks whether or not a question plugin with a given name is active.
setAnonymousUserList($a_value)
disinviteUser($user_id)
Disinvites a user from a survey.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
hasAnonymizedResults()
Checks if the survey results are to be anonymized.
static _getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
setInvitationMode($invitation_mode=0)
Sets the invitation mode.
inviteUser($user_id)
Invites a user to a survey.
getNextPage($active_page_question_id, $direction)
Returns the next "page" of a running test.
setReminderTemplate($a_value)
setReminderTarget($a_value)
getLastActivePage($active_id)
Returns the question id of the last active page a user visited in a survey.
& getSurveyQuestions($with_answers=false)
Returns the survey questions and questionblocks in an array.
getId()
get object id public
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
const ANONYMIZE_FREEACCESS
set360SelfEvaluation($a_value)
isUnusedCode($a_code, $a_user_id)
setShowQuestionTitles($a_show)
Sets the status of the display_question_titles attribute.
loadFromDb()
Loads a survey object from a database.
setActivationLimited($a_value)
setInvitation($invitation=0)
Sets the invitation status.
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.
const NOTIFICATION_PARENT_COURSE
setMailParticipantData($a_data)
setActivationStartDate($starting_time=NULL)
getFinishedIdsForAppraiseeId($a_appr_id, $a_exclude_appraisee=false)
This class handles base functions for mail handling.
updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
updateOrder(array $a_order)
getEvaluationAccess()
Gets the learners evaluation access.
static _lookupObjId($a_id)
setActivationVisibility($a_value)
addQuestion($question_id)
Adds a question to the survey (used in importer!)
const QUESTIONTITLES_VISIBLE
getActivationVisibility()
getImportDirectory()
get import directory of survey
getQuestionblocksTable($arrFilter)
Calculates the data for the output of the questionblock browser.
const QUESTIONTITLES_HIDDEN
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
getQuestionType($question_id)
Returns the question type of a question with a given id.
setMailOwnResults($a_value)
setReminderStart(ilDate $a_value=null)
static formatDate(ilDateTime $date)
Format a date public.
setTutorNotificationRecipients(array $a_value)
setStatus($status=self::STATUS_OFFLINE)
Sets the survey status.
setIntroduction($introduction="")
Sets the introduction text.
getTitle()
get object title public
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
getDescription()
get object description
set360SelfRaters($a_value)
getShowQuestionTitles()
Gets the status of the display_question_titles attribute.
cloneMetaData($target_obj)
Copy meta data.
toXML()
Returns a QTI xml representation of the survey.
xmlHeader()
Writes xml header public.
static _addQuestionblock($title="", $owner=0, $show_questiontext=true, $show_blocktitle=false)
Adds a questionblock to the database.
& getInvitedUsers()
Returns a list of all invited users in a survey.
addConstraintToQuestion($to_question_id, $constraint_id)
Adds a constraint to a question.
importSurveyCode($a_anonymize_key, $a_created, $a_data)
const MODE_PREDEFINED_USERS
setSurveyId($survey_id)
Sets the survey id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
isQuestionInAnyBlock($a_question_fi)
Is question already in a block?
createQuestionblock($title, $show_questiontext, $show_blocktitle, $questions)
Creates a question block for the survey.
const NOTIFICATION_INVITED_USERS
getInvitation()
Gets the invitation status.
getExportDirectory()
get export directory of survey
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
setMailConfirmation($a_value)
setReminderStatus($a_value)
Class ilMailTemplaceProcessor.
setPage($finished_id, $page_id)
Sets the number of the active survey page.
getType()
get object type public
getNotificationTargetUserIds($a_use_invited)
setEvaluationAccess($evaluation_access=self::EVALUATION_ACCESS_OFF)
Sets the learners evaluation access.
Create styles array
The data for the language used.
createImportDirectory()
creates data directory for import files (data_dir/svy_data/svy_<id>/import, depending on data directo...
& getQuestionpoolTitles($could_be_offline=FALSE, $showPath=FALSE)
Get the titles of all available survey question pools.
createExportDirectory()
creates data directory for export files (data_dir/svy_data/svy_<id>/export, depending on data directo...
setTimingType($a_type)
Set timing type.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
setEndDate($end_date="")
Sets the end date of the survey.
static _getLanguageOfUser($a_usr_id)
Get language object of user.
& getUserData($ids)
Returns a data of all users specified by id list.
getStatus()
Gets the survey status.
finishSurvey($finished_id)
Finishes the survey creating an entry in the database.
const EVALUATION_ACCESS_ALL
getFinishedIdForAppraiseeIdAndRaterId($a_appr_id, $a_rat_id)
Get finished id for an appraisee and a rater.
deleteWorkingData($question_id, $active_id)
Deletes the working data of a question in the database.
saveCompletionStatus()
Saves the completion status of the survey.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
getExternalCodeRecipients($a_check_finished=false)
getStartDate()
Gets the start date of the survey.
checkConstraint($constraint_data, $working_data)
Checks if a constraint is valid.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
createSurveyCodesForExternalData($data)
saveUserAccessCode($user_id, $access_code)
Saves a survey access code for a registered user to the database.
cloneTextblocks($mapping)
Clones the textblocks of survey questions.
saveToDb()
Saves a survey object to a database.
static getDataDir()
get data directory (outside webspace)
createMetaData()
Create meta data entry.
& getExistingQuestions()
Gets the question id's of the questions which are already in the survey.
getQuestionsTable($arrFilter)
Calculates the data for the output of the question browser.
saveHeading($heading="", $insertbefore)
getRatersData($a_appraisee_id)
static _lookupEmail($a_user_id)
Lookup email.
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
update()
update object data
setStartDateAndTime($start_date="", $start_time)
Sets the start date of the survey.
addConstraint($if_question_id, $relation, $value, $conjunction)
Adds a constraint.
isQuestionInSurvey($a_question_fi)
Check if a question is already in the survey.
setActivationEndDate($ending_time=NULL)
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
& getAvailableQuestionpools($use_obj_id=false, $could_be_offline=false, $showPath=FALSE, $permission="read")
Returns the available question pools for the active user.
getRefId()
get reference id public
getAnonymousId($id)
Checks for an anomyous survey id in the database an returns the id.
countReferences()
count references of object
deleteMetaData()
delete meta data entry
get360SkillService()
Get skill service.
getTextblock($question_id)
findCodeForUser($a_user_id)
getActiveID($user_id, $anonymize_id, $appr_id)
Checks if a user already started a survey.
setTemplate($template_id)
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
getOutro()
Gets the outro text.
getUserSettings($usr_id, $key)
sentReminder(array $a_recipient_ids)
getTutorNotificationStatus()
set360SelfAppraisee($a_value)
sendCodes($not_sent, $subject, $message, $lang)
modifyQuestionblock($questionblock_id, $title, $show_questiontext, $show_blocktitle)
Modifies a question block.
Class ilInvalidSurveyImportFileException.
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions and/or questionblocks to another position.
isPoolActive()
Get current pool status.
loadWorkingData($question_id, $active_id)
Gets the working data of question from the database.
setStartDate($start_date="")
Sets the start date of the survey.
static getInstance($a_obj_id)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
deleteConstraints($question_id)
Deletes the constraints for a question.
importObject($file_info, $svy_qpl_id)
Imports a survey from XML into the ILIAS database.
Class ilObjectActivation.
static _getUserData($a_internalids)
return user data for given user ids
Wrapper classes for system notifications.
isAppraiseeClosed($a_user_id)
startSurvey($user_id, $anonymous_id, $appraisee_id)
Starts the survey creating an entry in the database.
setAnonymize($a_anonymize)
set anonymize status
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
Settings template application class.
& getQuestionblockQuestionIds($questionblock_id)
Returns the question id's of all questions of a question block.
deleteAllUserData()
Deletes all user data of a survey.
isSurveyStarted($user_id, $anonymize_id, $appr_id=0)
Checks if a user already started a survey.
loadQuestionsFromDb()
Loads the survey questions from the database.
deleteAppraisee($a_user_id)
getReminderMailTemplates()
setOutro($outro="")
Sets the outro text.
fixSequenceStructure()
Remove duplicate sequence entries, see #22018.
getPrecondition($id)
Returns a precondition with a given id.
addQuestionToBlock($question_id, $questionblock_id)
static getTemplateContextById($a_id)