4 include_once
"./Services/Object/classes/class.ilObject.php";
184 $this->survey_id = -1;
185 $this->introduction =
"";
186 $this->outro = $lng->txt(
"survey_finished");
187 $this->author = $ilUser->getFullname();
188 $this->status = self::STATUS_OFFLINE;
189 $this->evaluation_access = self::EVALUATION_ACCESS_OFF;
190 $this->questions = array();
192 $this->invitation_mode = self::MODE_PREDEFINED_USERS;
193 $this->anonymize = self::ANONYMIZE_OFF;
194 $this->display_question_titles = self::QUESTIONTITLES_VISIBLE;
195 $this->surveyCodeSecurity = TRUE;
196 $this->template_id = NULL;
197 $this->pool_usage =
true;
199 parent::__construct($a_id,$a_call_by_reference);
221 parent::createMetaData();
235 if (!parent::update())
247 $result = parent::createReference();
257 function read($a_force_db =
false)
259 parent::read($a_force_db);
271 array_push($this->questions, $question_id);
283 $remove = parent::delete();
293 foreach ($this->questions as $question_id)
312 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy WHERE survey_id = %s",
317 $result = $ilDB->queryF(
"SELECT questionblock_fi FROM svy_qblk_qst WHERE survey_fi = %s",
321 $questionblocks = array();
324 array_push($questionblocks,
$row[
"questionblock_fi"]);
326 if (count($questionblocks))
328 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_qblk WHERE " . $ilDB->in(
'questionblock_id', $questionblocks,
false,
'integer'));
330 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE survey_fi = %s",
336 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_anonymous WHERE survey_fi = %s",
342 include_once
"./Services/Utilities/classes/class.ilUtil.php";
344 $directory = $svy_data_dir.
"/svy_".$this->
getId();
345 if (is_dir($directory))
347 include_once
"./Services/Utilities/classes/class.ilUtil.php";
351 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
357 foreach(
$mobs as $mob)
374 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
378 $active_array = array();
381 array_push($active_array,
$row[
"finished_id"]);
384 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_finished WHERE survey_fi = %s",
389 foreach ($active_array as $active_fi)
391 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE active_fi = %s",
395 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_times WHERE finished_fi = %s",
411 foreach ($finished_ids as $finished_id)
413 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE finished_id = %s",
419 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE active_fi = %s",
421 array(
$row[
"finished_id"])
424 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_finished WHERE finished_id = %s",
429 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_times WHERE finished_fi = %s",
431 array(
$row[
"finished_id"])
440 $sql =
"SELECT * FROM svy_finished".
441 " WHERE survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer");
444 $sql .=
" AND ".$ilDB->in(
"finished_id", $finished_ids,
"",
"integer");
448 $participants = array();
454 $participants[$userdata[
"sortname"] . $userdata[
"active_id"]] = $userdata;
457 return $participants;
473 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
513 if ($a_node_id==
$_GET[
"ref_id"])
515 $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
516 $parent_type = $parent_obj->getType();
517 if($parent_type == $this->
getType())
519 $a_node_id = (int) $tree->getParentId($a_node_id);
523 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
534 if (($this->
getTitle()) and (count($this->questions)))
553 $survey->loadFromDb();
554 if (($survey->getTitle()) and (count($survey->questions)))
573 $survey->loadFromDb();
575 if (($survey->getTitle()) and ($survey->author) and (count($survey->questions)))
583 $result[
"evaluation_access"] = $survey->getEvaluationAccess();
603 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy SET complete = %s, tstamp = %s WHERE survey_id = %s",
604 array(
'text',
'integer',
'integer'),
622 $question_gui = $this->
getQuestionGUI($questiontype, $question_id);
625 if($this->
getId() == $question_gui->object->getObjId() && !$a_force)
630 $duplicate_id = $question_gui->object->duplicate(
true);
631 return $duplicate_id;
643 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
651 $result = $ilDB->queryF(
"SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
655 $sequence =
$result->numRows();
657 $next_id = $ilDB->nextId(
'svy_svy_qst');
658 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
659 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
660 array($next_id, $this->
getSurveyId(), $duplicate_id, $sequence, time())
676 $result = $ilDB->queryF(
"SELECT svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle,".
677 " svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst, svy_svy_qst".
678 " WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi".
679 " AND svy_svy_qst.question_fi = svy_qblk_qst.question_fi".
680 " AND svy_qblk.questionblock_id = %s".
681 " ORDER BY svy_svy_qst.sequence",
683 array($questionblock_id)
685 $questions = array();
686 $show_questiontext = 0;
687 $show_blocktitle = 0;
691 array_push($questions, $duplicate_id);
693 $show_questiontext =
$row[
"show_questiontext"];
694 $show_blocktitle =
$row[
"show_blocktitle"];
719 include_once(
"./Services/RTE/classes/class.ilRTE.php");
720 $completecontent =
"";
723 $completecontent .= $content;
733 $next_id = $ilDB->nextId(
'svy_settings');
734 $affectedRows = $ilDB->insert(
"svy_settings", array(
735 "settings_id" => array(
"integer", $next_id),
736 "usr_id" => array(
"integer",
$usr_id),
737 "keyword" => array(
"text", $key),
738 "title" => array(
"text",
$title),
739 "value" => array(
"clob", $value)
747 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_settings WHERE settings_id = %s",
751 return $affectedRows;
758 $result = $ilDB->queryF(
"SELECT * FROM svy_settings WHERE usr_id = %s AND keyword = %s",
759 array(
'integer',
'text'),
784 if(is_object($rmd_start))
789 if(is_object($rmd_end))
794 include_once(
"./Services/RTE/classes/class.ilRTE.php");
797 $next_id = $ilDB->nextId(
'svy_svy');
798 $affectedRows = $ilDB->insert(
"svy_svy", array(
799 "survey_id" => array(
"integer", $next_id),
800 "obj_fi" => array(
"integer", $this->
getId()),
801 "author" => array(
"text", $this->
getAuthor()),
804 "status" => array(
"text", $this->
getStatus()),
806 "enddate" => array(
"text", $this->
getEndDate()),
810 "complete" => array(
"text", $this->
isComplete()),
811 "created" => array(
"integer", time()),
817 "tstamp" => array(
"integer", time()),
818 "template_id" => array(
"integer", $this->
getTemplate()),
819 "pool_usage" => array(
"integer", $this->
getPoolUsage()),
821 "mode_360" => array(
"integer", $this->
get360Mode()),
825 "mode_360_results" => array(
"integer", $this->
get360Results()),
829 "reminder_start" => array(
"datetime", $rmd_start),
830 "reminder_end" => array(
"datetime", $rmd_end),
842 $affectedRows = $ilDB->update(
"svy_svy", array(
843 "author" => array(
"text", $this->
getAuthor()),
846 "status" => array(
"text", $this->
getStatus()),
848 "enddate" => array(
"text", $this->
getEndDate()),
852 "complete" => array(
"text", $this->
isComplete()),
858 "tstamp" => array(
"integer", time()),
859 "template_id" => array(
"integer", $this->
getTemplate()),
860 "pool_usage" => array(
"integer", $this->
getPoolUsage()),
862 "mode_360" => array(
"integer", $this->
get360Mode()),
866 "mode_360_results" => array(
"integer", $this->
get360Results()),
870 "reminder_start" => array(
"datetime", $rmd_start),
871 "reminder_end" => array(
"datetime", $rmd_end),
879 "survey_id" => array(
"integer", $this->
getSurveyId())
891 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
907 $item->update($this->ref_id);
921 $old_questions = array();
922 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
930 $old_questions[
$row[
"question_fi"]] =
$row;
935 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy_qst WHERE survey_fi = %s",
940 foreach ($this->questions as $key => $value)
942 $next_id = $ilDB->nextId(
'svy_svy_qst');
943 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_svy_qst (survey_question_id, survey_fi, question_fi, heading, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
944 array(
'integer',
'integer',
'integer',
'text',
'integer',
'integer'),
945 array($next_id, $this->
getSurveyId(), $value, (strlen($old_questions[$value][
"heading"])) ? $old_questions[$value][
"heading"] : NULL, $key, time())
960 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_finished WHERE anonymous_id = %s",
967 return $row[
"anonymous_id"];
983 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
997 if ($question_id < 1)
return -1;
998 $result = $ilDB->queryF(
"SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND " .
999 "svy_question.questiontype_fi = svy_qtype.questiontype_id",
1006 return $data[
"type_tag"];
1030 switch ($a_anonymize)
1032 case self::ANONYMIZE_OFF:
1033 case self::ANONYMIZE_ON:
1034 case self::ANONYMIZE_FREEACCESS:
1035 case self::ANONYMIZE_CODE_ALL:
1036 $this->anonymize = $a_anonymize;
1039 $this->anonymize = self::ANONYMIZE_OFF;
1051 return ($this->anonymize) ? $this->anonymize : 0;
1091 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi = %s",
1093 array($this->
getId())
1100 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1102 if (strcmp(
$data[
"outro"],
"survey_finished") == 0)
1104 $this->
setOutro($this->lng->txt(
"survey_finished"));
1146 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1148 switch($activation[
"timing_type"])
1173 $this->questions = array();
1174 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
1180 $this->questions[
$data[
"sequence"]] = $data[
"question_fi"];
1208 $md_life =& $md->getLifecycle();
1211 if (strlen($a_author) == 0)
1214 $a_author = $ilUser->getFullname();
1217 $md_life =& $md->addLifecycle();
1219 $con =& $md_life->addContribute();
1220 $con->setRole(
"Author");
1222 $ent =& $con->addEntity();
1223 $ent->setEntity($a_author);
1238 include_once
"./Services/MetaData/classes/class.ilMD.php";
1240 $md_life =& $md->getLifecycle();
1243 $ids =& $md_life->getContributeIds();
1244 foreach ($ids as
$id)
1246 $md_cont =& $md_life->getContribute($id);
1247 if (strcmp($md_cont->getRole(),
"Author") == 0)
1249 $entids =& $md_cont->getEntityIds();
1250 foreach ($entids as $entid)
1252 $md_ent =& $md_cont->getEntity($entid);
1253 array_push($author, $md_ent->getEntity());
1258 return join($author,
",");
1269 return ($this->display_question_titles) ? 1 : 0;
1280 $this->display_question_titles = ($a_show) ? 1 : 0;
1291 $this->display_question_titles = 1;
1302 $this->display_question_titles = 0;
1325 $result = $ilDB->query(
"SELECT usr_id FROM usr_data");
1328 if ($ilAccess->checkAccessOfUser(
$row[
"usr_id"],
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
1406 include_once
"./Services/Administration/classes/class.ilSetting.php";
1407 $surveySetting =
new ilSetting(
"survey");
1408 $unlimited_invitation = $surveySetting->get(
"unlimited_invitation");
1409 if (!$unlimited_invitation && $this->invitation_mode == self::MODE_UNLIMITED)
1411 return self::MODE_PREDEFINED_USERS;
1415 return ($this->invitation_mode) ? $this->invitation_mode : self::MODE_UNLIMITED;
1428 return ($this->status) ? $this->status : self::STATUS_OFFLINE;
1440 return ($this->status == self::STATUS_ONLINE) ? true :
false;
1452 return ($this->status == self::STATUS_OFFLINE) ? true :
false;
1466 if (($status == self::STATUS_ONLINE) && (count($this->questions) == 0))
1468 $this->status = self::STATUS_OFFLINE;
1469 $result = $this->lng->txt(
"cannot_switch_to_online_no_questions");
1487 return (strlen($this->start_date)) ? $this->start_date : NULL;
1502 $edit_settings =
false;
1504 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches))
1506 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1508 if ($now < $epoch_time)
1510 array_push(
$messages,$this->lng->txt(
'start_date_not_reached').
' ('.
1513 $edit_settings =
true;
1517 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches))
1519 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
1521 if ($now > $epoch_time)
1523 array_push(
$messages,$this->lng->txt(
'end_date_reached').
' ('.
1526 $edit_settings =
true;
1531 if ($this->
getStatus() == self::STATUS_OFFLINE)
1533 array_push(
$messages, $this->lng->txt(
"survey_is_offline"));
1535 $edit_settings =
true;
1538 if (!$a_no_rbac && !$ilAccess->checkAccess(
"read",
"", $this->ref_id))
1540 array_push(
$messages, $this->lng->txt(
"cannot_participate_survey"));
1559 "edit_settings" => $edit_settings
1585 $y =
''; $m =
'';
$d =
''; $h =
''; $i =
''; $s =
'';
1586 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $start_date, $matches))
1592 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $start_time, $matches))
1598 $this->start_date = sprintf(
'%04d%02d%02d%02d%02d%02d', $y, $m,
$d, $h, $i, $s);
1610 return (strlen($this->end_date)) ? $this->end_date : NULL;
1635 $y =
''; $m =
'';
$d =
''; $h =
''; $i =
''; $s =
'';
1636 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2})/", $end_date, $matches))
1642 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $end_time, $matches))
1648 $this->end_date = sprintf(
'%04d%02d%02d%02d%02d%02d', $y, $m,
$d, $h, $i, $s);
1660 return ($this->evaluation_access) ? $this->evaluation_access : self::EVALUATION_ACCESS_OFF;
1672 $this->evaluation_access = (
$evaluation_access) ? $evaluation_access : self::EVALUATION_ACCESS_OFF;
1677 $this->activation_visibility = (bool) $a_value;
1687 return (
bool)$this->activation_limited;
1692 $this->activation_limited = (bool)$a_value;
1704 return (strlen($this->introduction)) ? $this->introduction : NULL;
1716 return (strlen($this->outro)) ? $this->outro : NULL;
1728 $existing_questions = array();
1729 $result = $ilDB->queryF(
"SELECT svy_question.original_id FROM svy_question, svy_svy_qst WHERE " .
1730 "svy_svy_qst.survey_fi = %s AND svy_svy_qst.question_fi = svy_question.question_id",
1736 if(
$data[
"original_id"])
1738 array_push($existing_questions,
$data[
"original_id"]);
1741 return $existing_questions;
1752 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1764 $move_questions = array($question_id);
1767 foreach ($pages as $idx => $page)
1769 if ($page[0][
"question_id"] == $question_id)
1776 $this->
moveQuestions($move_questions, $pages[$pageindex-1][0][
"question_id"], 0);
1782 $questions = array_keys($questions);
1783 $index = array_search($question_id, $questions);
1784 if (($index !== FALSE) && ($index > 0))
1786 $this->
moveQuestions($move_questions, $questions[$index-1], 0);
1798 $move_questions = array($question_id);
1801 foreach ($pages as $idx => $page)
1803 if (($page[0][
"question_id"] == $question_id) && (strcmp($page[0][
"questionblock_id"],
"") == 0))
1808 if (($pageindex < count($pages)-1) && ($pageindex >= 0))
1810 $this->
moveQuestions($move_questions, $pages[$pageindex+1][count($pages[$pageindex+1])-1][
"question_id"], 1);
1816 $questions = array_keys($questions);
1817 $index = array_search($question_id, $questions);
1818 if (($index !== FALSE) && ($index < count($questions)-1))
1820 $this->
moveQuestions($move_questions, $questions[$index+1], 1);
1834 $move_questions = array();
1836 foreach ($pages as $idx => $page)
1838 if ($page[0][
"questionblock_id"] == $questionblock_id)
1840 foreach ($page as $pageidx => $question)
1842 array_push($move_questions, $question[
"question_id"]);
1849 $this->
moveQuestions($move_questions, $pages[$pageindex-1][0][
"question_id"], 0);
1862 $move_questions = array();
1864 foreach ($pages as $idx => $page)
1866 if ($page[0][
"questionblock_id"] == $questionblock_id)
1868 foreach ($page as $pageidx => $question)
1870 array_push($move_questions, $question[
"question_id"]);
1875 if ($pageindex < count($pages)-1)
1877 $this->
moveQuestions($move_questions, $pages[$pageindex+1][count($pages[$pageindex+1])-1][
"question_id"], 1);
1891 $array_pos = array_search($target_index, $this->questions);
1892 if ($insert_mode == 0)
1894 $part1 = array_slice($this->questions, 0, $array_pos);
1895 $part2 = array_slice($this->questions, $array_pos);
1897 else if ($insert_mode == 1)
1899 $part1 = array_slice($this->questions, 0, $array_pos + 1);
1900 $part2 = array_slice($this->questions, $array_pos + 1);
1902 foreach ($move_questions as $question_id)
1904 if (!(array_search($question_id, $part1) === FALSE))
1906 unset($part1[array_search($question_id, $part1)]);
1908 if (!(array_search($question_id, $part2) === FALSE))
1910 unset($part2[array_search($question_id, $part2)]);
1913 $part1 = array_values($part1);
1914 $part2 = array_values($part2);
1915 $this->questions = array_values(array_merge($part1, $move_questions, $part2));
1916 foreach ($move_questions as $question_id)
1919 foreach ($constraints as $idx => $constraint)
1921 foreach ($part2 as $next_question_id)
1923 if ($constraint[
"question"] == $next_question_id)
1942 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1944 $question->delete($question_id);
1957 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1958 array(
'integer',
'integer'),
1963 $remove_constraints = array();
1966 array_push($remove_constraints,
$row[
"constraint_fi"]);
1968 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
1969 array(
'integer',
'integer'),
1972 foreach ($remove_constraints as $key => $constraint_id)
1974 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
1976 array($constraint_id)
1993 $block_sizes = array();
1996 if (in_array($question_id, $remove_questions) or in_array(
$data[
"questionblock_id"], $remove_questionblocks))
1998 unset($this->questions[array_search($question_id, $this->questions)]);
2001 else if(
$data[
"questionblock_id"])
2003 $block_sizes[
$data[
"questionblock_id"]]++;
2008 foreach($block_sizes as $block_id =>
$size)
2012 $remove_questionblocks[] = $block_id;
2016 foreach (array_unique($remove_questionblocks) as $questionblock_id)
2018 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk WHERE questionblock_id = %s",
2020 array($questionblock_id)
2022 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
2023 array(
'integer',
'integer'),
2028 $this->questions = array_values($this->questions);
2041 foreach ($questionblocks as $index)
2043 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk WHERE questionblock_id = %s",
2047 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s",
2048 array(
'integer',
'integer'),
2058 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE questionblock_fi = %s AND survey_fi = %s AND question_fi = %s",
2059 array(
'integer',
'integer',
'integer'),
2060 array($questionblock_id, $this->
getSurveyId(), $question_id)
2069 $next_id = $ilDB->nextId(
'svy_qblk_qst');
2070 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
2071 "question_fi) VALUES (%s, %s, %s, %s)",
2072 array(
'integer',
'integer',
'integer',
'integer'),
2073 array($next_id, $this->
getSurveyId(), $questionblock_id, $question_id)
2089 $result = $ilDB->queryF(
"SELECT svy_question.title, svy_qblk_qst.question_fi, svy_qblk_qst.survey_fi FROM ".
2090 "svy_qblk, svy_qblk_qst, svy_question WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND " .
2091 "svy_question.question_id = svy_qblk_qst.question_fi AND svy_qblk.questionblock_id = %s",
2093 array($questionblock_id)
2098 $titles[
$row[
"question_fi"]] = $row[
"title"];
2099 $survey_id = $row[
"survey_fi"];
2101 $result = $ilDB->queryF(
"SELECT question_fi, sequence FROM svy_svy_qst WHERE survey_fi = %s ORDER BY sequence",
2105 $resultarray = array();
2109 if (array_key_exists(
$row[
"question_fi"], $titles))
2111 $resultarray[$counter++] = $titles[
$row[
"question_fi"]];
2114 return $resultarray;
2126 $result = $ilDB->queryF(
"SELECT question_fi FROM svy_qblk_qst WHERE questionblock_fi = %s",
2128 array($questionblock_id)
2135 array_push($ids,
$data[
'question_fi']);
2151 $result = $ilDB->queryF(
"SELECT * FROM svy_qblk WHERE questionblock_id = %s",
2153 array($questionblock_id)
2155 return $ilDB->fetchAssoc(
$result);
2168 $result = $ilDB->queryF(
"SELECT * FROM svy_qblk WHERE questionblock_id = %s",
2170 array($questionblock_id)
2187 $next_id = $ilDB->nextId(
'svy_qblk');
2188 $ilDB->manipulateF(
"INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
2189 " show_blocktitle, owner_fi, tstamp) " .
2190 "VALUES (%s, %s, %s, %s, %s, %s)",
2191 array(
'integer',
'text',
'integer',
'integer',
'integer',
'integer'),
2192 array($next_id,
$title, $show_questiontext, $show_blocktitle,
$owner, time())
2214 $next_id = $ilDB->nextId(
'svy_qblk');
2215 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk (questionblock_id, title, show_questiontext,".
2216 " show_blocktitle, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
2217 array(
'integer',
'text',
'text',
'text',
'integer',
'integer'),
2218 array($next_id,
$title, $show_questiontext, $show_blocktitle, $ilUser->getId(), time())
2222 $questionblock_id = $next_id;
2223 foreach ($questions as $index)
2225 $next_id = $ilDB->nextId(
'svy_qblk_qst');
2226 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, " .
2227 "question_fi) VALUES (%s, %s, %s, %s)",
2228 array(
'integer',
'integer',
'integer',
'integer'),
2229 array($next_id, $this->
getSurveyId(), $questionblock_id, $index)
2246 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_qblk SET title = %s, show_questiontext = %s,".
2247 " show_blocktitle = %s WHERE questionblock_id = %s",
2248 array(
'text',
'text',
'text',
'integer'),
2249 array(
$title, $show_questiontext, $show_blocktitle, $questionblock_id)
2262 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s AND survey_fi = %s",
2263 array(
'integer',
'integer'),
2266 $constraints = array();
2269 array_push($constraints,
$row[
"constraint_fi"]);
2271 foreach ($constraints as $constraint_id)
2287 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
2289 array($constraint_id)
2291 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE constraint_fi = %s",
2293 array($constraint_id)
2307 $all_questions = array();
2308 $result = $ilDB->queryF(
"SELECT svy_qtype.type_tag, svy_qtype.plugin, svy_question.question_id, ".
2309 "svy_svy_qst.heading FROM svy_qtype, svy_question, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2310 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id " .
2311 "ORDER BY svy_svy_qst.sequence",
2315 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2329 $questionrow = $question->_getQuestionDataArray(
$row[
"question_id"]);
2330 foreach (
$row as $key => $value)
2332 $questionrow[$key] = $value;
2334 $all_questions[
$row[
"question_id"]] = $questionrow;
2335 $all_questions[$row[
"question_id"]][
"usableForPrecondition"] = $question->usableForPrecondition();
2336 $all_questions[$row[
"question_id"]][
"availableRelations"] = $question->getAvailableRelations();
2337 if (array_key_exists($row[
"question_id"], $obligatory_states))
2339 $all_questions[$row[
"question_id"]][
"obligatory"] = $obligatory_states[$row[
"question_id"]];
2344 $questionblocks = array();
2345 if (count($all_questions))
2347 $result = $ilDB->queryF(
"SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst WHERE " .
2348 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s " .
2349 "AND " . $ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2355 $questionblocks[
$row[
'question_fi']] =
$row;
2359 foreach ($all_questions as $question_id =>
$row)
2362 if (isset($questionblocks[$question_id]))
2364 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2365 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2366 $all_questions[$question_id][
"constraints"] = $constraints;
2370 $all_questions[$question_id][
"questionblock_title"] =
"";
2371 $all_questions[$question_id][
"questionblock_id"] =
"";
2372 $all_questions[$question_id][
"constraints"] = $constraints;
2377 $result = $ilDB->queryF(
"SELECT svy_variable.*, svy_category.title FROM svy_variable, svy_category " .
2378 "WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id ".
2379 "ORDER BY sequence ASC",
2387 array_push($answers,
$data[
"title"]);
2390 $all_questions[$question_id][
"answers"] = $answers;
2393 return $all_questions;
2405 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE survey_fi = %s",
2413 if (!array_key_exists(
$row[
"question_fi"], $obligatory_questions))
2415 $obligatory_questions[
$row[
"question_fi"]] = 0;
2421 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_oblig WHERE survey_fi = %s",
2427 foreach ($obligatory_questions as $question_fi => $obligatory)
2429 $next_id = $ilDB->nextId(
'svy_qst_oblig');
2430 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " .
2431 "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
2432 array(
'integer',
'integer',
'integer',
'text',
'integer'),
2433 array($next_id, $this->
getSurveyId(), $question_fi, (strlen($obligatory)) ? $obligatory : 0, time())
2437 $ilDB->manipulate(
"UPDATE svy_question".
2438 " SET obligatory = ".$ilDB->quote($obligatory,
"integer").
2439 " WHERE question_id = ".$ilDB->quote($question_fi,
"integer"));
2452 $obligatory_states = array();
2453 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_oblig WHERE survey_fi = %s",
2461 $obligatory_states[
$row[
"question_fi"]] = $row[
"obligatory"];
2464 return $obligatory_states;
2477 $all_questions = array();
2478 $result = $ilDB->queryF(
"SELECT svy_question.*, svy_qtype.type_tag, svy_svy_qst.heading FROM " .
2479 "svy_question, svy_qtype, svy_svy_qst WHERE svy_svy_qst.survey_fi = %s AND " .
2480 "svy_svy_qst.question_fi = svy_question.question_id AND svy_question.questiontype_fi = svy_qtype.questiontype_id ".
2481 "ORDER BY svy_svy_qst.sequence",
2487 $all_questions[
$row[
"question_id"]] =
$row;
2490 $questionblocks = array();
2491 if (count($all_questions))
2493 $result = $ilDB->queryF(
"SELECT svy_qblk.*, svy_qblk_qst.question_fi FROM svy_qblk, svy_qblk_qst ".
2494 "WHERE svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_qblk_qst.survey_fi = %s ".
2495 "AND " . $ilDB->in(
'svy_qblk_qst.question_fi', array_keys($all_questions),
false,
'integer'),
2501 $questionblocks[
$row[
'question_fi']] =
$row;
2505 $all_pages = array();
2508 foreach ($all_questions as $question_id =>
$row)
2510 if (array_key_exists($question_id, $obligatory_states))
2512 $all_questions[$question_id][
"obligatory"] = $obligatory_states[$question_id];
2514 $constraints = array();
2515 if (isset($questionblocks[$question_id]))
2517 if (!$currentblock or ($currentblock != $questionblocks[$question_id][
'questionblock_id']))
2521 $all_questions[$question_id][
'page'] = $pageindex;
2522 $all_questions[$question_id][
"questionblock_title"] = $questionblocks[$question_id][
'title'];
2523 $all_questions[$question_id][
"questionblock_id"] = $questionblocks[$question_id][
'questionblock_id'];
2524 $all_questions[$question_id][
"questionblock_show_questiontext"] = $questionblocks[$question_id][
'show_questiontext'];
2525 $all_questions[$question_id][
"questionblock_show_blocktitle"] = $questionblocks[$question_id][
'show_blocktitle'];
2526 $currentblock = $questionblocks[$question_id][
'questionblock_id'];
2528 $all_questions[$question_id][
"constraints"] = $constraints;
2533 $all_questions[$question_id][
'page'] = $pageindex;
2534 $all_questions[$question_id][
"questionblock_title"] =
"";
2535 $all_questions[$question_id][
"questionblock_id"] =
"";
2536 $all_questions[$question_id][
"questionblock_show_questiontext"] = 1;
2537 $all_questions[$question_id][
"questionblock_show_blocktitle"] = 1;
2540 $all_questions[$question_id][
"constraints"] = $constraints;
2542 if (!isset($all_pages[$pageindex]))
2544 $all_pages[$pageindex] = array();
2546 array_push($all_pages[$pageindex], $all_questions[$question_id]);
2549 $max = count($all_pages);
2551 foreach ($all_pages as $index => $block)
2553 foreach ($block as $blockindex => $question)
2555 $all_pages[$index][$blockindex][
"position"] = $counter / $max;
2574 if (strcmp($active_page_question_id,
"") == 0)
2578 foreach ($pages as $key => $question_array)
2580 foreach ($question_array as $question)
2582 if ($active_page_question_id == $question[
"question_id"])
2588 if ($foundpage == -1)
2594 $foundpage += $direction;
2599 if ($foundpage >= count($pages))
2603 return $pages[$foundpage];
2615 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
2628 $result_array = array();
2629 $result = $ilDB->queryF(
"SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, ".
2630 "svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
2631 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_constraint.constraint_id = %s",
2638 $pc = $ilDB->fetchAssoc(
$result);
2652 $result_array = array();
2653 $result = $ilDB->queryF(
"SELECT svy_constraint.*, svy_relation.* FROM svy_qst_constraint, svy_constraint, svy_relation ".
2654 "WHERE svy_constraint.relation_fi = svy_relation.relation_id AND ".
2655 "svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.question_fi = %s ".
2656 "AND svy_qst_constraint.survey_fi = %s",
2657 array(
'integer',
'integer'),
2662 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
2665 $question =
new $question_type();
2666 $question->loadFromDb(
$row[
"question_fi"]);
2667 $valueoutput = $question->getPreconditionValueOutput(
$row[
"value"]);
2668 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));
2670 return $result_array;
2681 $result_array = array();
2682 $result = $ilDB->queryF(
"SELECT svy_qst_constraint.question_fi as for_question, svy_constraint.*, svy_relation.* ".
2683 "FROM svy_qst_constraint, svy_constraint, svy_relation WHERE svy_constraint.relation_fi = svy_relation.relation_id ".
2684 "AND svy_qst_constraint.constraint_fi = svy_constraint.constraint_id AND svy_qst_constraint.survey_fi = %s",
2690 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']));
2692 return $result_array;
2705 $result_array = array();
2706 $result = $ilDB->queryF(
"SELECT svy_variable.*, svy_category.title FROM svy_variable LEFT JOIN ".
2707 "svy_category ON svy_variable.category_fi = svy_category.category_id WHERE svy_variable.question_fi = %s ".
2708 "ORDER BY svy_variable.sequence",
2714 $result_array[
$row->sequence] =
$row;
2716 return $result_array;
2731 $next_id = $ilDB->nextId(
'svy_constraint');
2732 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_constraint (constraint_id, question_fi, relation_fi, value, conjunction) VALUES ".
2733 "(%s, %s, %s, %s, %s)",
2734 array(
'integer',
'integer',
'integer',
'float',
'integer'),
2735 array($next_id, $if_question_id, $relation, $value, $conjunction)
2758 $next_id = $ilDB->nextId(
'svy_qst_constraint');
2759 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_constraint (question_constraint_id, survey_fi, question_fi, ".
2760 "constraint_fi) VALUES (%s, %s, %s, %s)",
2761 array(
'integer',
'integer',
'integer',
'integer'),
2762 array($next_id, $this->
getSurveyId(), $to_question_id, $constraint_id)
2779 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_constraint SET question_fi = %s, relation_fi = %s, value = %s, conjunction = %s ".
2780 "WHERE constraint_id = %s",
2781 array(
'integer',
'integer',
'float',
'integer',
'integer'),
2782 array($if_question_id, $relation, $value, $conjunction, $precondition_id)
2789 foreach ($questions as $question_id)
2791 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_constraint SET conjunction = %s ".
2792 "WHERE constraint_id IN (SELECT constraint_fi FROM svy_qst_constraint WHERE svy_qst_constraint.question_fi = %s)",
2793 array(
'integer',
'integer'),
2794 array($conjunction, $question_id)
2809 $custom_order = array(
"equal",
"not_equal",
"less",
"less_or_equal",
"more",
"more_or_equal");
2810 $custom_order = array_flip($custom_order);
2812 $result_array = array();
2813 $result = $ilDB->query(
"SELECT * FROM svy_relation");
2818 $result_array[
$row[
"shortname"]] = array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"id" => $row[
"relation_id"],
"order" => $custom_order[$row[
"longname"]]);
2822 $result_array[
$row[
"relation_id"]] = array(
"short" => $row[
"shortname"],
"long" => $row[
"longname"],
"order" => $custom_order[$row[
"longname"]]);
2827 foreach($result_array as $idx => $item)
2829 unset($result_array[$idx][
"order"]);
2832 return $result_array;
2841 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2860 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_inv_usr WHERE survey_fi = %s AND user_fi = %s",
2861 array(
'integer',
'integer'),
2864 include_once
'./Services/User/classes/class.ilObjUser.php';
2878 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE user_fi = %s AND survey_fi = %s",
2879 array(
'integer',
'integer'),
2884 $next_id = $ilDB->nextId(
'svy_inv_usr');
2885 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_inv_usr (invited_user_id, survey_fi, user_fi, tstamp) " .
2886 "VALUES (%s, %s, %s, %s)",
2887 array(
'integer',
'integer',
'integer',
'integer'),
2888 array($next_id, $this->
getSurveyId(), $user_id, time())
2893 include_once
'./Services/User/classes/class.ilObjUser.php';
2908 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
2910 $members = $group->getGroupMemberIds();
2911 foreach ($members as $user_id)
2913 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
2918 include_once
'./Services/User/classes/class.ilObjUser.php';
2937 $members = $rbacreview->assignedUsers($role_id);
2938 foreach ($members as $user_id)
2940 if ($ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
2945 include_once
'./Services/User/classes/class.ilObjUser.php';
2963 $result_array = array();
2964 $result = $ilDB->queryF(
"SELECT user_fi FROM svy_inv_usr WHERE survey_fi = %s",
2970 array_push($result_array,
$row[
"user_fi"]);
2972 return $result_array;
2986 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
2987 array(
'integer',
'integer'),
2988 array($question_id, $active_id)
3003 $result_array = array();
3004 $result = $ilDB->queryF(
"SELECT * FROM svy_answer WHERE question_fi = %s AND active_fi = %s",
3005 array(
'integer',
'integer'),
3006 array($question_id, $active_id)
3012 array_push($result_array,
$row);
3014 return $result_array;
3018 return $result_array;
3035 $active_id = $ilDB->nextId(
'svy_finished');
3036 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp) ".
3037 "VALUES (%s, %s, %s, %s, %s, %s)",
3038 array(
'integer',
'integer',
'integer',
'text',
'text',
'integer'),
3039 array($active_id, $this->
getSurveyId(), $user_id, $anonymous_id, 1, time())
3043 foreach ($pages as $key => $question_array)
3045 foreach ($question_array as $question)
3048 require_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3050 $question->saveRandomData($active_id);
3065 if ($this->
getAnonymize() && (strlen($anonymous_id) == 0))
return;
3067 if (strcmp($user_id,
"") == 0)
3069 if ($user_id == ANONYMOUS_USER_ID)
3074 $next_id = $ilDB->nextId(
'svy_finished');
3075 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_finished (finished_id, survey_fi, user_fi, anonymous_id, state, tstamp, appr_id) ".
3076 "VALUES (%s, %s, %s, %s, %s, %s, %s)",
3077 array(
'integer',
'integer',
'integer',
'text',
'text',
'integer',
'integer'),
3078 array($next_id, $this->
getSurveyId(), $user_id, $anonymous_id, 0, time(), $appraisee_id)
3093 $ilDB->manipulateF(
"UPDATE svy_finished SET state = %s, tstamp = %s".
3094 " WHERE survey_fi = %s AND finished_id = %s",
3095 array(
'text',
'integer',
'integer',
'integer'),
3096 array(1, time(), $this->
getSurveyId(), $finished_id)
3113 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_finished SET lastpage = %s WHERE finished_id = %s",
3114 array(
'integer',
'integer'),
3115 array(($page_id) ? $page_id : 0, $finished_id)
3121 include_once
"./Services/User/classes/class.ilObjUser.php";
3122 include_once
"./Services/User/classes/class.ilUserUtil.php";
3125 $placeholders = array(
3126 "FIRST_NAME" =>
"firstname",
3127 "LAST_NAME" =>
"lastname",
3130 "firstname" =>
"firstname" 3133 $recipients = preg_split(
'/,/', $this->mailaddresses);
3134 foreach ($recipients as $recipient)
3137 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
3139 $ntf->setLangModules(array(
"survey"));
3141 $ntf->setSubjectLangId(
'finished_mail_subject');
3144 if(trim($messagetext))
3148 foreach ($placeholders as $key => $mapping)
3152 $messagetext = str_replace(
'[' . $key .
']',
'', $messagetext);
3156 $messagetext = str_replace(
'[' . $key .
']', trim(
$data[$mapping]), $messagetext);
3159 $ntf->setIntroductionDirect($messagetext);
3163 $ntf->setIntroductionLangId(
'survey_notification_finished_introduction');
3169 $ntf->addAdditionalInfo(
'survey_360_appraisee',
3173 $active_id = $this->
getActiveID($user_id, $anonymize_id, $appr_id);
3174 $ntf->addAdditionalInfo(
'results',
3177 $ntf->setGotoLangId(
'survey_notification_tutor_link');
3178 $ntf->setReasonLangId(
'survey_notification_finished_reason');
3180 $ntf->sendMail(array($recipient), null, null);
3189 $questioncounter = 1;
3190 foreach ($questions as $question_id => $question_data)
3192 $textresult .= $questioncounter++ .
". " . $question_data[
"title"] .
"\n";
3193 $found = $userResults[$question_id][$active_id];
3195 if (is_array($found))
3197 $text = implode(
"\n", $found);
3203 if (strlen($text) == 0) $text = self::getSurveySkippedValue();
3204 $text = str_replace(
"<br />",
"\n", $text);
3205 $textresult .= $text .
"\n\n";
3215 foreach ($questions as
$data)
3217 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3274 $result = $ilDB->queryF(
"SELECT * FROM svy_finished".
3275 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
3276 array(
'integer',
'text',
'integer'),
3277 array($this->
getSurveyId(), $anonymize_id, $appr_id)
3282 $result = $ilDB->queryF(
"SELECT * FROM svy_finished".
3283 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
3284 array(
'integer',
'integer',
'integer'),
3299 return (
int)
$row[
"state"];
3359 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished".
3360 " WHERE survey_fi = %s AND anonymous_id = %s AND appr_id = %s",
3361 array(
'integer',
'text',
'integer'),
3362 array($this->
getSurveyId(), $anonymize_id, $appr_id)
3367 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished".
3368 " WHERE survey_fi = %s AND user_fi = %s AND appr_id = %s",
3369 array(
'integer',
'integer',
'integer'),
3380 return $row[
"finished_id"];
3433 $result = $ilDB->queryF(
"SELECT lastpage FROM svy_finished WHERE finished_id = %s",
3444 return (
$row[
"lastpage"]) ?
$row[
"lastpage"] :
'';
3458 if (count($working_data) == 0)
3463 if ((count($working_data) == 1) and (strcmp($working_data[0][
"value"],
"") == 0))
3469 foreach ($working_data as
$data)
3471 switch ($constraint_data[
"short"])
3474 if ($data[
"value"] < $constraint_data[
"value"])
3481 if ($data[
"value"] <= $constraint_data[
"value"])
3488 if ($data[
"value"] == $constraint_data[
"value"])
3495 if ($data[
"value"] <> $constraint_data[
"value"])
3502 if ($data[
"value"] >= $constraint_data[
"value"])
3509 if ($data[
"value"] > $constraint_data[
"value"])
3528 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
3532 return (
$result->numRows()) ?
true :
false;
3546 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE survey_fi = %s",
3554 array_push($users,
$row[
"finished_id"]);
3570 $evaluation = array();
3572 foreach ($questions as $question_id => $question_data)
3574 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
3577 $question =
new $question_type();
3578 $question->loadFromDb($question_id);
3580 $evaluation[$question_id] =
$data;
3596 $surveySetting =
new ilSetting(
"survey");
3597 $use_anonymous_id = array_key_exists(
"use_anonymous_id",
$_GET) ?
$_GET[
"use_anonymous_id"] : $surveySetting->get(
"use_anonymous_id");
3598 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE finished_id = %s",
3603 $foundrows =
$result->numRows();
3608 $name = ($use_anonymous_id) ?
$row[
"anonymous_id"] : $this->lng->txt(
"anonymous");
3610 "fullname" => $name,
3611 "sortname" => $name,
3616 "active_id" =>
"$active_id" 3620 if ((
$row[
"user_fi"] > 0) && (
$row[
"user_fi"] != ANONYMOUS_USER_ID) && ($this->
getAnonymize() == 0))
3622 include_once
'./Services/User/classes/class.ilObjUser.php';
3625 $userdata[
"fullname"] = $userdata[
"sortname"] = $this->lng->txt(
"deleted_user");
3630 $userdata[
"fullname"] = $user->getFullname();
3631 $gender = $user->getGender();
3632 if (strlen($gender) == 1) $gender = $this->lng->txt(
"gender_$gender");
3633 $userdata[
"gender"] = $gender;
3634 $userdata[
"firstname"] = $user->getFirstname();
3635 $userdata[
"lastname"] = $user->getLastname();
3636 $userdata[
"sortname"] = $user->getLastname() .
", " . $user->getFirstname();
3637 $userdata[
"login"] = $user->getLogin();
3659 $result = $ilDB->queryF(
"SELECT * FROM svy_answer WHERE active_fi = %s",
3665 if (!is_array($answers[
$row[
"question_fi"]]))
3667 $answers[$row[
"question_fi"]] = array();
3669 array_push($answers[$row[
"question_fi"]], $row);
3673 "name" => $userdata[
"fullname"],
3674 "firstname" => $userdata[
"firstname"],
3675 "lastname" => $userdata[
"lastname"],
3676 "login" => $userdata[
"login"],
3677 "gender" => $userdata[
"gender"],
3678 "answers" => array()
3680 foreach ($questions as $key => $question)
3682 if (array_key_exists($key, $answers))
3684 $resultset[
"answers"][$key] = $answers[$key];
3688 $resultset[
"answers"][$key] = array();
3690 sort($resultset[
"answers"][$key]);
3709 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
3713 $nr_of_users =
$result->numRows();
3717 $nr_of_users =
sizeof($finished_ids);
3720 $result_array =& $question->getCumulatedResults($this->
getSurveyId(), $nr_of_users, $finished_ids);
3721 return $result_array;
3735 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s",
3746 $result_array = array();
3747 $result = $ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag FROM svy_question, svy_qtype WHERE ".
3748 "svy_question.questiontype_fi = svy_qtype.questiontype_id AND svy_question.tstamp > 0 AND ".
3749 $ilDB->in(
'svy_question.question_id', $question_ids,
false,
'integer'));
3752 array_push($result_array,
$row);
3754 return $result_array;
3767 if (is_array($arrFilter))
3769 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
3771 $where .=
" AND " . $ilDB->like(
'svy_question.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3773 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
3775 $where .=
" AND " . $ilDB->like(
'svy_question.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
3777 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
3779 $where .=
" AND " . $ilDB->like(
'svy_question.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
3781 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
3783 $where .=
" AND svy_qtype.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
3785 if (array_key_exists(
'spl', $arrFilter) && strlen($arrFilter[
'spl']))
3787 $where .=
" AND svy_question.obj_fi = " . $ilDB->quote($arrFilter[
'spl'],
'integer');
3793 $forbidden =
" AND " . $ilDB->in(
'svy_question.obj_fi', array_keys($spls),
false,
'integer');
3794 $forbidden .=
" AND svy_question.complete = " . $ilDB->quote(
"1",
'text');
3797 if (count($existing_questions))
3799 $existing =
" AND " . $ilDB->in(
'svy_question.question_id', $existing_questions,
true,
'integer');
3802 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
3805 $query_result = $ilDB->query(
"SELECT svy_question.*, svy_qtype.type_tag, svy_qtype.plugin, object_reference.ref_id".
3806 " FROM svy_question, svy_qtype, object_reference".
3807 " WHERE svy_question.original_id IS NULL".$forbidden.$existing.
3808 " AND svy_question.obj_fi = object_reference.obj_id AND svy_question.tstamp > 0".
3809 " AND svy_question.questiontype_fi = svy_qtype.questiontype_id " . $where);
3812 if ($query_result->numRows())
3814 while (
$row = $ilDB->fetchAssoc($query_result))
3816 if (array_key_exists(
'spl_txt', $arrFilter) && strlen($arrFilter[
'spl_txt']))
3818 if(!stristr($spls[
$row[
"obj_fi"]], $arrFilter[
'spl_txt']))
3824 $row[
'ttype'] = $trans[
$row[
'type_tag']];
3829 array_push($rows, $row);
3834 array_push($rows, $row);
3851 if (is_array($arrFilter))
3853 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
3855 $where .=
" AND " . $ilDB->like(
'svy_qblk.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
3859 $query_result = $ilDB->query(
"SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE ".
3860 "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi ".
3861 "$where GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, ".
3862 "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
3864 if ($query_result->numRows())
3867 $surveytitles = array();
3868 foreach ($survey_ref_ids as $survey_ref_id)
3873 while (
$row = $ilDB->fetchAssoc($query_result))
3877 foreach ($questions_array as $key => $value)
3879 $questions_array[$key] =
"$counter. $value";
3882 if (strlen($surveytitles[
$row[
"obj_fi"]]))
3884 $rows[$row[
"questionblock_id"]] = array(
3885 "questionblock_id" => $row[
"questionblock_id"],
3886 "title" => $row[
"title"],
3887 "svy" => $surveytitles[$row[
"obj_fi"]],
3888 "contains" => join($questions_array,
", "),
3889 "owner" => $row[
"owner_fi"]
3905 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
3910 "xmlns:xsi" =>
"http://www.w3.org/2001/XMLSchema-instance",
3911 "xsi:noNamespaceSchemaLocation" =>
"http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd" 3913 $a_xml_writer->xmlStartTag(
"surveyobject", $attrs);
3918 $a_xml_writer->xmlStartTag(
"survey", $attrs);
3920 $a_xml_writer->xmlElement(
"description", NULL, $this->
getDescription());
3921 $a_xml_writer->xmlElement(
"author", NULL, $this->
getAuthor());
3922 $a_xml_writer->xmlStartTag(
"objectives");
3924 "label" =>
"introduction" 3931 $a_xml_writer->xmlEndTag(
"objectives");
3935 $attribs = array(
"enabled" =>
"1");
3939 $attribs = array(
"enabled" =>
"0");
3941 $a_xml_writer->xmlElement(
"anonymisation", $attribs);
3942 $a_xml_writer->xmlStartTag(
"restrictions");
3945 $attribs = array(
"type" =>
"free");
3949 $attribs = array(
"type" =>
"restricted");
3951 $a_xml_writer->xmlElement(
"access", $attribs);
3954 $attrs = array(
"type" =>
"date");
3955 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartDate(), $matches);
3956 $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]));
3960 $attrs = array(
"type" =>
"date");
3961 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndDate(), $matches);
3962 $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]));
3965 $a_xml_writer->xmlEndTag(
"restrictions");
3969 $hasconstraints = FALSE;
3970 foreach ($pages as $question_array)
3972 foreach ($question_array as $question)
3974 if (count($question[
"constraints"]))
3976 $hasconstraints = TRUE;
3981 if ($hasconstraints)
3983 $a_xml_writer->xmlStartTag(
"constraints");
3984 foreach ($pages as $question_array)
3986 foreach ($question_array as $question)
3988 if (count($question[
"constraints"]))
3991 foreach ($question[
"constraints"] as $constraint)
3994 "sourceref" => $question[
"question_id"],
3995 "destref" => $constraint[
"question"],
3996 "relation" => $constraint[
"short"],
3997 "value" => $constraint[
"value"],
3998 "conjunction" => $constraint[
"conjunction"]
4000 $a_xml_writer->xmlElement(
"constraint", $attribs);
4005 $a_xml_writer->xmlEndTag(
"constraints");
4009 $a_xml_writer->xmlStartTag(
"metadata");
4011 $custom_properties = array();
4013 $custom_properties[
"status"] = $this->
getStatus();
4015 $custom_properties[
"pool_usage"] = (int)$this->
getPoolUsage();
4018 $custom_properties[
"mode_360"] = (int)$this->
get360Mode();
4022 $custom_properties[
"mode_360_results"] = $this->
get360Results();
4029 foreach($custom_properties as $label => $value)
4031 $a_xml_writer->xmlStartTag(
"metadatafield");
4032 $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
4033 $a_xml_writer->xmlElement(
"fieldentry", NULL, $value);
4034 $a_xml_writer->xmlEndTag(
"metadatafield");
4037 $a_xml_writer->xmlStartTag(
"metadatafield");
4038 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"SCORM");
4039 include_once
"./Services/MetaData/classes/class.ilMD.php";
4042 $md->toXml($writer);
4043 $metadata = $writer->xmlDumpMem();
4044 $a_xml_writer->xmlElement(
"fieldentry", NULL, $metadata);
4045 $a_xml_writer->xmlEndTag(
"metadatafield");
4047 $a_xml_writer->xmlEndTag(
"metadata");
4048 $a_xml_writer->xmlEndTag(
"survey");
4050 $attribs = array(
"id" => $this->
getId());
4051 $a_xml_writer->xmlStartTag(
"surveyquestions", $attribs);
4054 foreach ($pages as $question_array)
4056 if (count($question_array) > 1)
4058 $attribs = array(
"id" => $question_array[0][
"question_id"]);
4059 $attribs = array(
"showQuestiontext" => $question_array[0][
"questionblock_show_questiontext"],
4060 "showBlocktitle" => $question_array[0][
"questionblock_show_blocktitle"]);
4061 $a_xml_writer->xmlStartTag(
"questionblock", $attribs);
4062 if (strlen($question_array[0][
"questionblock_title"]))
4064 $a_xml_writer->xmlElement(
"questionblocktitle", NULL, $question_array[0][
"questionblock_title"]);
4067 foreach ($question_array as $question)
4069 if (strlen($question[
"heading"]))
4071 $a_xml_writer->xmlElement(
"textblock", NULL, $question[
"heading"]);
4074 if ($questionObject !== FALSE) $questionObject->insertXML($a_xml_writer, FALSE, $obligatory_states[$question[
"question_id"]]);
4076 if (count($question_array) > 1)
4078 $a_xml_writer->xmlEndTag(
"questionblock");
4082 $a_xml_writer->xmlEndTag(
"surveyquestions");
4083 $a_xml_writer->xmlEndTag(
"surveyobject");
4084 $xml = $a_xml_writer->xmlDumpMem(FALSE);
4097 if ($question_id < 1)
return FALSE;
4098 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
4100 if (strlen($question_type) == 0)
return FALSE;
4102 $question =
new $question_type();
4103 $question->loadFromDb($question_id);
4115 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
4119 $importDirectory =
"";
4122 $current_dir = opendir($a_dir);
4124 while($entryname = readdir($current_dir))
4126 $files[] = $entryname;
4129 foreach($files as
$file)
4131 if(is_dir($a_dir.
"/".$file) and ($file !=
"." and $file!=
".."))
4134 $importDirectory = $a_dir.
"/".
$file;
4137 closedir($current_dir);
4138 if (strlen($importDirectory))
4141 $current_dir = opendir($importDirectory);
4143 while($entryname = readdir($current_dir))
4145 $files[] = $entryname;
4147 foreach($files as $file)
4149 if(@is_file($importDirectory.
"/".$file) && ($file !=
"." && $file!=
"..") && (ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(svy_)*[0-9]+\.[a-z]{1,3}\$", $file) || ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(survey__)*[0-9]+\.[a-z]{1,3}\$", $file)))
4152 $xmlFile = $importDirectory.
"/".
$file;
4156 return array(
"dir" => $importDirectory,
"xml" => $xmlFile);
4167 if ($svy_qpl_id < 1) $svy_qpl_id = -1;
4169 $source = $file_info[
"tmp_name"];
4171 if (($source ==
'none') || (!$source) || $file_info[
"error"] > UPLOAD_ERR_OK)
4173 $error = $this->lng->txt(
"import_no_file_selected");
4178 if ((strcmp($file_info[
"type"],
"text/xml") == 0) || (strcmp($file_info[
"type"],
"application/xml") == 0))
4183 $suffix = pathinfo($file_info[
"name"]);
4184 if (strcmp(strtolower($suffix[
"extension"]),
"zip") == 0)
4188 if (!$isXml && !$isZip)
4190 $error = $this->lng->txt(
"import_wrong_file_type");
4192 $ilLog->write(
"Survey: Import error. Filetype was \"" . $file_info[
"type"] .
"\"");
4194 if (strlen($error) == 0)
4198 $import_subdir =
"";
4200 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4203 $importfile = $import_dir.
"/".$file_info[
"name"];
4207 if (!((strlen($found[
"dir"]) > 0) && (strlen($found[
"xml"]) > 0)))
4209 $error = $this->lng->txt(
"wrong_import_file_structure");
4212 $importfile = $found[
"xml"];
4213 $import_subdir = $found[
"dir"];
4217 $importfile = tempnam($import_dir,
"survey_import");
4220 $fh = fopen($importfile,
"r");
4223 $error = $this->lng->txt(
"import_error_opening_file");
4226 $xml = fread($fh, filesize($importfile));
4230 $error = $this->lng->txt(
"import_error_closing_file");
4235 if (strpos($xml,
"questestinterop"))
4237 include_once
"./Services/Survey/classes/class.SurveyImportParserPre38.php";
4239 $import->setSurveyObject($this);
4240 $import->setXMLContent($xml);
4241 $import->startParsing();
4245 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
4247 $import->setSurveyObject($this);
4248 $import->setXMLContent($xml);
4249 $import->startParsing();
4252 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
4254 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
4255 include_once
"./Services/RTE/classes/class.ilRTE.php";
4256 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
4257 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
4259 $importfile = $import_subdir .
"/" . $mob[
"uri"];
4260 if (file_exists($importfile))
4264 $mob[
"type"] =
"svy:html";
4270 if ($mob[
"type"] ==
"svy:html")
4273 $this->
setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->
getIntroduction()));
4274 $this->
setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $this->
getOutro()));
4277 else if($import->questions[$mob[
"id"]])
4279 $new_qid = $import->questions[$mob[
"id"]];
4282 $qtext = $new_question->getQuestiontext();
4284 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
4286 $new_question->setQuestiontext($qtext);
4287 $new_question->saveToDb();
4290 if($new_question->getOriginalId())
4293 $pool_question->setQuestiontext($qtext);
4294 $pool_question->saveToDb();
4301 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
4330 $newObj = parent::cloneObject($a_target_id,$a_copy_id);
4332 $newObj->updateMetaData();
4336 $newObj->setOutro($this->
getOutro());
4350 $newObj->set360Mode(
true);
4369 $question_pointer = array();
4372 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
4373 foreach ($this->questions as $key => $question_id)
4380 $question->saveToDb($original_id);
4381 $newObj->questions[$key] = $question->getId();
4382 $question_pointer[$question_id] = $question->getId();
4383 $mapping[$question_id] = $question->getId();
4387 $newObj->saveToDb();
4388 $newObj->cloneTextblocks($mapping);
4391 $questionblocks = array();
4392 $questionblock_questions = array();
4393 $result = $ilDB->queryF(
"SELECT * FROM svy_qblk_qst WHERE survey_fi = %s",
4401 array_push($questionblock_questions,
$row);
4402 $questionblocks[
$row[
"questionblock_fi"]] = $row[
"questionblock_fi"];
4406 foreach ($questionblocks as $key => $value)
4409 $questionblock_id =
ilObjSurvey::_addQuestionblock($questionblock[
"title"], $questionblock[
"owner_fi"], $questionblock[
"show_questiontext"], $questionblock[
"show_blocktitle"]);
4410 $questionblocks[$key] = $questionblock_id;
4413 foreach ($questionblock_questions as $key => $value)
4415 if($questionblocks[$value[
"questionblock_fi"]] &&
4416 $question_pointer[$value[
"question_fi"]])
4418 $next_id = $ilDB->nextId(
'svy_qblk_qst');
4419 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) ".
4420 "VALUES (%s, %s, %s, %s)",
4421 array(
'integer',
'integer',
'integer',
'integer'),
4422 array($next_id, $newObj->getSurveyId(), $questionblocks[$value[
"questionblock_fi"]], $question_pointer[$value[
"question_fi"]])
4429 $newConstraints = array();
4430 foreach ($constraints as $key => $constraint)
4432 if ($question_pointer[$constraint[
"for_question"]] &&
4433 $question_pointer[$constraint[
"question"]])
4435 if (!array_key_exists($constraint[
'id'], $newConstraints))
4437 $constraint_id = $newObj->addConstraint($question_pointer[$constraint[
"question"]], $constraint[
"relation_id"], $constraint[
"value"], $constraint[
'conjunction']);
4438 $newConstraints[$constraint[
'id']] = $constraint_id;
4440 $newObj->addConstraintToQuestion($question_pointer[$constraint[
"for_question"]], $newConstraints[$constraint[
'id']]);
4445 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_oblig WHERE survey_fi = %s",
4453 if($question_pointer[
$row[
"question_fi"]])
4455 $next_id = $ilDB->nextId(
'svy_qst_oblig');
4456 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, ".
4457 "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)",
4458 array(
'integer',
'integer',
'integer',
'text',
'integer'),
4459 array($next_id, $newObj->getSurveyId(), $question_pointer[$row[
"question_fi"]], $row[
"obligatory"], time())
4470 $result = $ilDB->queryF(
"SELECT * FROM svy_svy_qst WHERE question_fi = %s",
4477 return $row[
"heading"];
4492 foreach ($mapping as $original_id => $new_id)
4495 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
4507 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4510 if(!is_writable($svy_data_dir))
4512 $this->
ilias->raiseError(
"Survey Data Directory (".$svy_data_dir
4513 .
") not writeable.",$this->
ilias->error_obj->FATAL);
4517 $svy_dir = $svy_data_dir.
"/svy_".$this->
getId();
4519 if(!@is_dir($svy_dir))
4521 $this->
ilias->raiseError(
"Creation of Survey Directory failed.",$this->
ilias->error_obj->FATAL);
4524 $export_dir = $svy_dir.
"/export";
4526 if(!@is_dir($export_dir))
4528 $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->FATAL);
4537 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4549 if (!@is_dir($dir) or
4550 !is_writeable($dir))
4562 while ($entry = $dir->read())
4564 if ($entry !=
"." && $entry !=
".." && ereg(
"^[0-9]{10}_{2}[0-9]+_{2}(svy_)*[0-9]+\.[a-z]{1,3}\$", $entry))
4586 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4590 if(!is_writable($svy_data_dir))
4592 $this->
ilias->raiseError(
"Survey Data Directory (".$svy_data_dir
4593 .
") not writeable.",$this->
ilias->error_obj->FATAL);
4597 $svy_dir = $svy_data_dir.
"/svy_".$this->
getId();
4599 if(!@is_dir($svy_dir))
4601 $this->
ilias->raiseError(
"Creation of Survey Directory failed.",$this->
ilias->error_obj->FATAL);
4605 $import_dir = $svy_dir.
"/import";
4607 if(!@is_dir($import_dir))
4609 $this->
ilias->raiseError(
"Creation of Import Directory failed.",$this->
ilias->error_obj->FATAL);
4618 include_once
"./Services/Utilities/classes/class.ilUtil.php";
4620 "/svy_".$this->getId().
"/import";
4621 if (!is_dir($import_dir))
4625 if(@is_dir($import_dir))
4640 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4641 array(
'text',
'integer',
'integer'),
4642 array($heading, $this->
getSurveyId(), $insertbefore)
4647 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_svy_qst SET heading=%s WHERE survey_fi=%s AND question_fi=%s",
4648 array(
'text',
'integer',
'integer'),
4658 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_anonymous WHERE survey_key = %s AND survey_fi = %s",
4659 array(
'text',
'integer'),
4662 return (
$result->numRows() == 1) ?
true :
false;
4670 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
4671 array(
'integer',
'integer'),
4677 return $row[
"anonymous_id"];
4689 if($user_id == ANONYMOUS_USER_ID)
4696 $ilDB->manipulate(
"UPDATE svy_anonymous".
4697 " SET user_key = ".$ilDB->quote(md5($user_id),
"text").
4698 " WHERE survey_key = ".$ilDB->quote($code,
"text"));
4706 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE anonymous_id = %s AND survey_fi = %s",
4707 array(
'text',
'integer'),
4710 return (
$result->numRows() == 1) ?
true :
false;
4742 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND user_key IS NULL",
4760 include_once
"./Services/Link/classes/class.ilLink.php";
4762 $sql =
"SELECT svy_anonymous.*, svy_finished.state".
4763 " FROM svy_anonymous".
4764 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
4765 " WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer").
4766 " AND svy_anonymous.user_key IS NULL";
4770 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.survey_key", $a_codes,
"",
"text");
4774 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.anonymous_id", $a_ids,
"",
"text");
4779 $default_lang = $ilUser->getPref(
"survey_code_language");
4783 $item[] =
$row[
"survey_key"];
4785 if(
$row[
"externaldata"])
4787 $ext = unserialize(
$row[
"externaldata"]);
4788 $item[] = $ext[
"email"];
4789 $item[] = $ext[
"lastname"];
4790 $item[] = $ext[
"firstname"];
4804 $item[] = (
$row[
"sent"]) ? 1 : 0;
4806 $params = array(
"accesscode" =>
$row[
"survey_key"]);
4809 $params[
"lang"] = $default_lang;
4813 $export[] =
'"'.implode(
'";"', $item).
'"';
4815 return implode(
"\n", $export);
4829 include_once
"./Services/Link/classes/class.ilLink.php";
4833 $sql =
"SELECT svy_anonymous.*, svy_finished.state".
4834 " FROM svy_anonymous".
4835 " LEFT JOIN svy_finished ON (svy_anonymous.survey_key = svy_finished.anonymous_id)".
4836 " WHERE svy_anonymous.survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer")
4841 $sql .=
" AND ".$ilDB->in(
"svy_anonymous.anonymous_id", $ids,
"",
"integer");
4844 $sql .=
" ORDER BY tstamp, survey_key ASC";
4858 $params = array(
"accesscode" =>
$row[
"survey_key"]);
4861 $params[
"lang"] =
$lang;
4868 'id' =>
$row[
"anonymous_id"],
4869 'code' =>
$row[
"survey_key"],
4870 'date' =>
$row[
"tstamp"],
4872 'sent' =>
$row[
'sent'],
4879 if(
$row[
"externaldata"])
4881 $ext = unserialize(
$row[
"externaldata"]);
4882 $item[
'email'] = $ext[
'email'];
4883 $item[
'last_name'] = $ext[
'lastname'];
4884 $item[
'first_name'] = $ext[
'firstname'];
4887 array_push($codes, $item);
4896 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE survey_fi = %s AND anonymous_id = %s",
4897 array(
'integer',
'text'),
4900 return (
$result->numRows() > 0) ?
true :
false;
4906 $result = $ilDB->queryF(
"SELECT anonymous_id FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
4907 array(
'integer',
'text'),
4910 return (
$result->numRows() > 0) ?
false :
true;
4919 for ($i = 0; $i < $nrOfCodes; $i++)
4921 $next_id = $ilDB->nextId(
'svy_anonymous');
4922 $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, tstamp) ".
4923 "VALUES (%s, %s, %s, %s)",
4924 array(
'integer',
'text',
'integer',
'integer'),
4938 foreach (
$data as $dataset)
4941 $next_id = $ilDB->nextId(
'svy_anonymous');
4942 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, externaldata, tstamp) ".
4943 "VALUES (%s, %s, %s, %s, %s)",
4944 array(
'integer',
'text',
'integer',
'text',
'integer'),
4945 array($next_id, $anonymize_key, $this->
getSurveyId(), serialize($dataset), time())
4960 $check_finished = ($not_sent > 1);
4962 include_once
"./Services/Mail/classes/class.ilMail.php";
4963 include_once
"./Services/Link/classes/class.ilLink.php";
4965 $mail =
new ilMail($user_id);
4967 foreach ($recipients as
$data)
4969 if($data[
'email'] && $data[
'code'])
4972 switch ((
int)$not_sent)
4975 $do_send = !(bool)$data[
'sent'];
4979 $do_send = $data[
'finished'];
4983 $do_send = !$data[
'finished'];
4993 $messagetext = $message;
4996 "accesscode" => $data[
"code"],
4999 $messagetext = str_replace(
'[url]',
"<" . $url .
">", $messagetext);
5000 foreach ($data as $key => $value)
5002 $messagetext = str_replace(
'[' . $key .
']', $value, $messagetext);
5020 $ilDB->manipulateF(
"UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL",
5021 array(
'integer',
'integer'),
5029 $result = $ilDB->queryF(
"SELECT survey_key code, externaldata, sent FROM svy_anonymous WHERE survey_fi = %s",
5036 if(!
$row[
'externaldata'])
5041 $externaldata = unserialize(
$row[
'externaldata']);
5042 if(!$externaldata[
'email'])
5047 $externaldata[
'code'] =
$row[
'code'];
5048 $externaldata[
'sent'] =
$row[
'sent'];
5050 if($a_check_finished)
5055 array_push(
$res, $externaldata);
5069 if (strlen($survey_code) > 0)
5071 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_anonymous WHERE survey_fi = %s AND survey_key = %s",
5072 array(
'integer',
'text'),
5088 $result = $ilDB->queryF(
"SELECT survey_key FROM svy_anonymous WHERE survey_fi = %s AND user_key = %s",
5089 array(
'integer',
'text'),
5095 $access_code =
$row[
"survey_key"];
5097 return $access_code;
5109 $next_id = $ilDB->nextId(
'svy_anonymous');
5110 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_anonymous (anonymous_id, survey_key, survey_fi, user_key, tstamp) ".
5111 "VALUES (%s, %s, %s, %s, %s)",
5112 array(
'integer',
'text',
'integer',
'text',
'integer'),
5113 array($next_id, $access_code, $this->
getSurveyId(), md5($user_id), time())
5125 $codestring =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
5128 for ($i = 1; $i <=5; $i++)
5130 $index = mt_rand(0, strlen($codestring)-1);
5131 $code .= substr($codestring, $index, 1);
5154 $resultarray = array();
5155 foreach (
$row as $rowindex => $entry)
5157 if(is_array($entry))
5159 $entry = implode(
"/", $entry);
5166 if (strpos($entry,
"\"") !== FALSE)
5168 $entry = str_replace(
"\"",
"\"\"", $entry);
5176 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
5179 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
5183 $resultarray[$rowindex] = utf8_decode($entry);
5186 return $resultarray;
5193 $result = $ilDB->queryF(
"SELECT tstamp FROM svy_answer WHERE active_fi = %s ORDER BY tstamp DESC",
5200 return $row[
"tstamp"];
5204 $result = $ilDB->queryF(
"SELECT tstamp FROM svy_finished WHERE finished_id = %s",
5211 return $row[
"tstamp"];
5225 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5238 if (preg_match(
"/<[^>]*?>/", $a_text))
5256 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $attribs = NULL)
5258 include_once
"./Services/RTE/classes/class.ilRTE.php";
5259 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
5261 $a_xml_writer->xmlStartTag(
"material", $attribs);
5263 "type" =>
"text/plain" 5265 if ($this->
isHTML($a_material))
5267 $attrs[
"type"] =
"text/xhtml";
5270 $a_xml_writer->xmlElement(
"mattext", $attrs, $mattext);
5275 foreach (
$mobs as $mob)
5277 $mob_id =
"il_" . IL_INST_ID .
"_mob_" . $mob;
5278 if (strpos($mattext, $mob_id) !== FALSE)
5283 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
5284 "type" =>
"svy:html",
5285 "id" => $this->
getId()
5287 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
5291 if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
5306 if ($this->surveyCodeSecurity == FALSE)
5325 if (extension_loaded(
"tidy"))
5329 "output-xml" =>
true,
5330 "numeric-entities" =>
true 5333 $tidy->parseString($print_output, $config,
'utf8');
5334 $tidy->cleanRepair();
5335 $print_output = tidy_get_output($tidy);
5336 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
5340 $print_output = str_replace(
" ",
" ", $print_output);
5341 $print_output = str_replace(
"⊗",
"X", $print_output);
5344 $print_output = str_replace(
">",
">", $print_output);
5345 $print_output = str_replace(
"<",
"<", $print_output);
5346 $print_output = str_replace(
" ",
"~|nbsp|~", $print_output);
5347 $print_output = preg_replace(
'/&(?!amp)/',
'&', $print_output);
5348 $print_output = str_replace(
"~|nbsp|~",
" ", $print_output);
5350 $xsl = file_get_contents(
"./Modules/Survey/xml/question2fo.xsl");
5354 'font-family="Helvetica, unifont"',
5355 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
5359 $args = array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
5362 $output =
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", NULL, $args, $params);
5365 $ilLog->write($output);
5379 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5381 $fp = fopen($fo_file,
"w"); fwrite($fp, $fo); fclose($fp);
5383 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
5392 $ilLog->write(__METHOD__.
': '.$e->getMessage());
5397 $ilLog->write(__METHOD__.
': '.$e->getMessage());
5414 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
5420 include_once(
"./Modules/Survey/classes/class.ilObjSurveyAccess.php");
5445 global $ilPluginAdmin;
5446 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq", $a_pname))
5476 if (!is_array($ids) || count($ids) ==0)
return array();
5478 $result = $ilDB->query(
"SELECT usr_id, login, lastname, firstname FROM usr_data WHERE " . $ilDB->in(
'usr_id', $ids,
false,
'integer') .
" ORDER BY login");
5479 $result_array = array();
5482 $result_array[
$row[
"usr_id"]]=
$row;
5484 return $result_array;
5489 if (!is_array($ids) || count($ids) ==0)
return array();
5501 if (!is_array($ids) || count($ids) ==0)
return array();
5503 foreach ($ids as $obj_id)
5517 $this->mailnotification = ($a_notification) ?
true :
false;
5527 $this->mailaddresses = $a_addresses;
5537 $this->mailparticipantdata = $a_data;
5544 $result = $ilDB->queryF(
"SELECT * FROM svy_times, svy_finished WHERE svy_finished.survey_fi = %s",
5546 array($this->
getId())
5551 if (strlen(
$row[
'left_page']) && strlen(
$row[
'entered_page']))
5552 $times[
$row[
'finished_fi']] += (
$row[
'left_page']-
$row[
'entered_page']);
5562 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_times (finished_fi, entered_page, left_page, first_question) VALUES (%s, %s, %s, %s)",
5563 array(
'integer',
'integer',
'integer',
'integer'),
5564 array($finished_id, $time, NULL, $first_question)
5572 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_times SET left_page = %s WHERE finished_fi = %s AND entered_page = %s",
5573 array(
'integer',
'integer',
'integer'),
5574 array($time, $finished_id,
$_SESSION[
'svy_entered_page'])
5583 $result = $ilDB->queryF(
"SELECT * FROM svy_times WHERE finished_fi = %s",
5590 if (
$row[
'left_page'] > 0 &&
$row[
'entered_page'] > 0)
5598 $this->template_id = (int)$template_id;
5608 if(
sizeof($this->questions) ==
sizeof($a_order))
5610 $this->questions = array_flip($a_order);
5611 $this->saveQuestionsToDB();
5622 $this->pool_usage = (bool)$a_value;
5634 if($template_settings)
5636 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
5638 $template_settings = $template_settings->getSettings();
5639 $template_settings = $template_settings[
"use_pool"];
5640 if($template_settings && $template_settings[
"hide"])
5642 $use_pool = (bool)$template_settings[
"value"];
5660 include_once
"Services/Administration/classes/class.ilSettingsTemplate.php";
5662 $template_settings = $template->getSettings();
5663 if($template_settings)
5665 if($template_settings[
"show_question_titles"] !== NULL)
5667 if($template_settings[
"show_question_titles"][
"value"])
5677 if($template_settings[
"use_pool"] !== NULL)
5679 if($template_settings[
"use_pool"][
"value"])
5689 if($template_settings[
"anonymization_options"][
"value"])
5691 $anon_map = array(
'personalized' => self::ANONYMIZE_OFF,
5692 'anonymize_with_code' => self::ANONYMIZE_ON,
5693 'anonymize_without_code' => self::ANONYMIZE_FREEACCESS);
5694 $this->
setAnonymize($anon_map[$template_settings[
"anonymization_options"][
"value"]]);
5708 public function updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
5712 $a_email = trim($a_email);
5720 $data = array(
"email" => $a_email,
5721 "lastname" => trim($a_last_name),
5722 "firstname" => trim($a_first_name));
5725 "externaldata" => array(
"text", serialize(
$data)),
5726 "sent" => array(
"integer", $a_sent)
5729 $ilDB->update(
"svy_anonymous", $fields,
5730 array(
"anonymous_id" => array(
"integer", $a_id)));
5740 $this->mode_360 = (bool)$a_value;
5750 $this->mode_360_self_eval = (bool)$a_value;
5760 $this->mode_360_self_appr = (bool)$a_value;
5770 $this->mode_360_self_rate = (bool)$a_value;
5780 $this->mode_360_results = (int)$a_value;
5793 $a_user_id != ANONYMOUS_USER_ID)
5796 "obj_id" => array(
"integer", $this->
getSurveyId()),
5797 "user_id" => array(
"integer", $a_user_id)
5799 $ilDB->insert(
"svy_360_appr", $fields);
5807 $set = $ilDB->query(
"SELECT user_id".
5808 " FROM svy_360_appr".
5809 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5810 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5811 return (
bool)$ilDB->numRows($set);
5818 $set = $ilDB->query(
"SELECT has_closed".
5819 " FROM svy_360_appr".
5820 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5821 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5822 $row = $ilDB->fetchAssoc($set);
5823 return $row[
"has_closed"];
5830 $ilDB->manipulate(
"DELETE FROM svy_360_appr".
5831 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5832 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
5834 $set = $ilDB->query(
"SELECT user_id".
5835 " FROM svy_360_rater".
5836 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5837 " AND appr_id = ".$ilDB->quote($a_user_id,
"integer"));
5838 while(
$row = $ilDB->fetchAssoc($set))
5855 $set = $ilDB->query(
"SELECT * FROM svy_360_appr".
5856 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer"));
5857 while(
$row = $ilDB->fetchAssoc($set))
5865 foreach($raters as $rater)
5867 if($rater[
"finished"])
5872 $res[$row[
"user_id"]][
"finished"] = $finished.
"/".
sizeof($raters);
5873 $res[$row[
"user_id"]][
"closed"] = $row[
"has_closed"];
5879 public function addRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5884 !$this->
isRater($a_appraisee_id, $a_user_id, $a_anonymous_id))
5887 "obj_id" => array(
"integer", $this->
getSurveyId()),
5888 "appr_id" => array(
"integer", $a_appraisee_id),
5889 "user_id" => array(
"integer", $a_user_id),
5890 "anonymous_id" => array(
"integer", $a_anonymous_id)
5892 $ilDB->insert(
"svy_360_rater", $fields);
5896 public function isRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5903 (!$a_appraisee_id || $a_appraisee_id == $a_user_id))
5910 $sql =
"SELECT user_id".
5911 " FROM svy_360_rater".
5912 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
5913 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
5914 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer");
5917 $sql .=
" AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer");
5919 $set = $ilDB->query($sql);
5920 return (
bool)$ilDB->numRows($set);
5923 public function deleteRater($a_appraisee_id, $a_user_id, $a_anonymous_id = 0)
5933 $ilDB->manipulate(
"DELETE FROM svy_360_rater".
5934 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5935 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer").
5936 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
5937 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer"));
5944 $res = $anonymous_ids = array();
5946 $set = $ilDB->query(
"SELECT * FROM svy_360_rater".
5947 " WHERE obj_id = ".$ilDB->quote($this->getSurveyId(),
"integer").
5948 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer"));
5949 while(
$row = $ilDB->fetchAssoc($set))
5951 if(
$row[
"anonymous_id"])
5953 $res[
"a".$row[
"anonymous_id"]] = array(
5954 "lastname" =>
"unknown code ".
$row[
"anonymous_id"],
5955 "sent" =>
$row[
"mail_sent"],
5958 $anonymous_ids[] =
$row[
"anonymous_id"];
5963 $name[
"user_id"] =
"u".$name[
"user_id"];
5965 $name[
"sent"] =
$row[
"mail_sent"];
5967 $res[
"u".$row[
"user_id"]] = $name;
5971 if(
sizeof($anonymous_ids))
5974 foreach(
$data as $item)
5976 if(isset(
$res[
"a".$item[
"id"]]))
5978 $res[
"a".$item[
"id"]] = array(
5979 "user_id" =>
"a".$item[
"id"],
5980 "lastname" => $item[
"last_name"],
5981 "firstname" => $item[
"first_name"],
5983 "email" => $item[
"email"],
5984 "code" => $item[
"code"],
5985 "href" => $item[
"href"],
5986 "sent" =>
$res[
"a".$item[
"id"]][
"sent"],
6002 $sql =
"SELECT appr_id FROM svy_360_rater".
6003 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer");
6007 $sql .=
" AND user_id = ".$ilDB->quote($a_user_id,
"integer");
6011 $sql .=
" AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer");
6014 $set = $ilDB->query($sql);
6015 while(
$row = $ilDB->fetchAssoc($set))
6023 !in_array($a_user_id,
$res))
6025 $res[] = $a_user_id;
6035 $set = $ilDB->query(
"SELECT anonymous_id FROM svy_anonymous".
6036 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6037 " AND survey_key = ".$ilDB->quote($a_code,
"text"));
6038 $res = $ilDB->fetchAssoc($set);
6039 return $res[
"anonymous_id"];
6046 $sql =
"SELECT * FROM svy_finished".
6047 " WHERE survey_fi =".$ilDB->quote($this->
getSurveyId(),
"integer").
6048 " AND appr_id = ".$ilDB->quote($appr_id,
"integer");
6051 $sql .=
" AND user_fi = ".$ilDB->quote($user_id,
"integer");
6055 $sql .=
" AND anonymous_id = ".$ilDB->quote($anonymous_code,
"text");
6065 return (
int)
$row[
"state"];
6073 $user_id = $ilUser->getId();
6082 $user_id != ANONYMOUS_USER_ID &&
6095 else if($user_id == ANONYMOUS_USER_ID || $this->
getAnonymize())
6111 $sql =
"SELECT * FROM svy_finished".
6112 " WHERE survey_fi = ".$ilDB->quote($this->
getSurveyId(),
"integer");
6114 if($user_id != ANONYMOUS_USER_ID)
6116 $sql .=
" AND (user_fi = ".$ilDB->quote($user_id,
"integer").
6117 " OR anonymous_id = ".$ilDB->quote($a_code,
"text").
")";
6122 $sql .=
" AND anonymous_id = ".$ilDB->quote($a_code,
"text");
6124 $set = $ilDB->query($sql);
6125 while(
$row = $ilDB->fetchAssoc($set))
6127 $res[
$row[
"finished_id"]] = array(
"appr_id" => $row[
"appr_id"],
6128 "user_id" => $row[
"user_fi"],
6129 "code" => $row[
"anonymous_id"],
6130 "finished" => (
bool)$row[
"state"]);
6133 return array(
"code"=>$a_code,
"runs"=>
$res);
6140 if($a_user_id != ANONYMOUS_USER_ID)
6142 $set = $ilDB->query(
"SELECT sf.anonymous_id FROM svy_finished sf".
6143 " WHERE sf.survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6144 " AND sf.user_fi = ".$ilDB->quote($a_user_id,
"integer"));
6145 $a_code = $ilDB->fetchAssoc($set);
6146 return $a_code[
"anonymous_id"];
6154 $set = $ilDB->query(
"SELECT user_fi FROM svy_finished".
6155 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6156 " AND anonymous_id = ".$ilDB->quote($a_code,
"text"));
6157 $user_id = $ilDB->fetchAssoc($set);
6158 $user_id = $user_id[
"user_fi"];
6160 if($user_id && ($user_id != $a_user_id || $user_id == ANONYMOUS_USER_ID))
6173 $set = $ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished".
6174 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6175 " AND appr_id = ".$ilDB->quote($a_appr_id,
"integer"));
6176 while(
$row = $ilDB->fetchAssoc($set))
6178 if ($a_exclude_appraisee &&
$row[
"user_fi"] == $a_appr_id)
6199 $set = $ilDB->query(
"SELECT finished_id, user_fi FROM svy_finished".
6200 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6201 " AND appr_id = ".$ilDB->quote($a_appr_id,
"integer").
6202 " AND user_fi = ".$ilDB->quote($a_rat_id,
"integer"));
6203 $row = $ilDB->fetchAssoc($set);
6204 return $row[
"finished_id"];
6217 $this->mode_360_skill_service = $a_val;
6239 $ilDB->manipulate(
"UPDATE svy_360_rater".
6240 " SET mail_sent = ".$ilDB->quote($a_tstamp,
"integer").
6241 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
6242 " AND appr_id = ".$ilDB->quote($a_appraisee_id,
"integer").
6243 " AND user_id = ".$ilDB->quote($a_user_id,
"integer").
6244 " AND anonymous_id = ".$ilDB->quote($a_anonymous_id,
"integer"));
6252 $ilDB->manipulate(
"UPDATE svy_360_appr".
6253 " SET has_closed = ".$ilDB->quote(time(),
"integer").
6254 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer").
6255 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
6258 include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
6262 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
6264 $sskill->writeAppraiseeSkills($a_user_id);
6272 $ilDB->manipulate(
"UPDATE svy_360_appr".
6273 " SET has_closed = ".$ilDB->quote(null,
"integer").
6274 " WHERE obj_id = ".$ilDB->quote($this->
getSurveyId(),
"integer"));
6279 if(!isset(
$_SESSION[
"360_extrtr"][$a_ref_id]))
6281 $svy =
new self($a_ref_id);
6284 if($svy->canStartSurvey(null,
true) &&
6285 $svy->get360Mode() &&
6286 $svy->isAnonymousKey($a_code))
6288 $anonymous_id = $svy->getAnonymousIdByCode($a_code);
6291 if(
sizeof($svy->getAppraiseesToRate(null, $anonymous_id)))
6293 $_SESSION[
"360_extrtr"][$a_ref_id] =
true;
6299 $_SESSION[
"360_extrtr"][$a_ref_id] =
false;
6303 return $_SESSION[
"360_extrtr"][$a_ref_id];
6318 $this->reminder_status = (bool)$a_value;
6328 $this->reminder_start = $a_value;
6338 $this->reminder_end = $a_value;
6348 $this->reminder_frequency = (int)$a_value;
6358 $this->reminder_target = (int)$a_value;
6368 $this->reminder_last_sent = $a_value;
6378 $this->tutor_ntf_status = (bool)$a_value;
6388 $this->tutor_ntf_recipients = $a_value;
6398 $this->tutor_ntf_target = (int)$a_value;
6410 $set = $ilDB->query(
"SELECT COUNT(*) numall FROM svy_finished".
6411 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6412 " AND state = ".$ilDB->quote(1,
"integer").
6413 " AND ".$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
6414 $row = $ilDB->fetchAssoc($set);
6415 if(
$row[
"numall"] ==
sizeof($user_ids))
6427 if((
bool)$a_use_invited)
6433 $parent_grp_ref_id = $tree->checkForParentType($this->
getRefId(),
"grp");
6434 if($parent_grp_ref_id)
6436 include_once
"Modules/Group/classes/class.ilGroupParticipants.php";
6438 $user_ids = $part->getMembers();
6442 $parent_crs_ref_id = $tree->checkForParentType($this->
getRefId(),
"crs");
6443 if($parent_crs_ref_id)
6445 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
6447 $user_ids = $part->getMembers();
6456 include_once
"./Services/Mail/classes/class.ilMail.php";
6457 include_once
"./Services/User/classes/class.ilObjUser.php";
6458 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
6459 include_once
"./Services/User/classes/class.ilUserUtil.php";
6460 include_once
"./Services/Link/classes/class.ilLink.php";
6467 $ulng->loadLanguageModule(
'survey');
6469 $subject = sprintf($ulng->txt(
'survey_notification_tutor_subject'), $this->
getTitle());
6472 $message .= $ulng->txt(
'survey_notification_tutor_body').
":\n\n";
6473 $message .= $ulng->txt(
'obj_svy').
": ". $this->
getTitle().
"\n";
6474 $message .=
"\n".$ulng->txt(
'survey_notification_tutor_link').
": ".$link;
6476 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
6477 $mail_obj->appendInstallationSignature(
true);
6479 "",
"", $subject, $message, array(), array(
"system"));
6485 global $ilDB, $ilAccess;
6488 $today = date(
"Y-m-d");
6510 if($today < $start ||
6511 ($end && $today > $end))
6517 include_once
"Services/Object/classes/class.ilObjectActivation.php";
6520 ($now < $item_data[
"timing_start"] ||
6521 $now > $item_data[
"timing_end"]))
6537 $finished_ids = array();
6538 $set = $ilDB->query(
"SELECT user_fi FROM svy_finished".
6539 " WHERE survey_fi = ".$ilDB->quote($this->getSurveyId(),
"integer").
6540 " AND state = ".$ilDB->quote(1,
"text").
6541 " AND ".$ilDB->in(
"user_fi", $user_ids,
"",
"integer"));
6542 while(
$row = $ilDB->fetchAssoc($set))
6544 $finished_ids[] =
$row[
"user_fi"];
6548 $missing_ids = array_diff($user_ids, $finished_ids);
6551 foreach($missing_ids as $idx => $user_id)
6554 if(!$ilAccess->checkAccessOfUser($user_id,
"read",
"", $this->getRefId(),
"svy", $this->
getId()))
6556 unset($missing_ids[$idx]);
6577 include_once
"./Services/Mail/classes/class.ilMail.php";
6578 include_once
"./Services/User/classes/class.ilObjUser.php";
6579 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
6580 include_once
"./Services/User/classes/class.ilUserUtil.php";
6581 include_once
"./Services/Link/classes/class.ilLink.php";
6584 foreach($a_recipient_ids as $user_id)
6588 $ulng->loadLanguageModule(
'survey');
6590 $subject = sprintf($ulng->txt(
'survey_reminder_subject'), $this->
getTitle());
6593 $message .= $ulng->txt(
'survey_reminder_body').
":\n\n";
6594 $message .= $ulng->txt(
'obj_svy').
": ". $this->
getTitle().
"\n";
6595 $message .=
"\n".$ulng->txt(
'survey_reminder_link').
": ".$link;
6597 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
6598 $mail_obj->appendInstallationSignature(
true);
6600 "",
"", $subject, $message, array(), array(
"system"));
6606 $this->activation_starting_time = $starting_time;
6611 $this->activation_ending_time = $ending_time;
6616 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
6621 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
6630 include_once
"./Services/Administration/classes/class.ilSetting.php";
6631 $surveySetting =
new ilSetting(
"survey");
6632 if(!$surveySetting->get(
"skipped_is_custom",
false))
6634 return $lng->txt(
"skipped");
6638 return $surveySetting->get(
"skipped_custom_value",
"");
createSurveyCodes($nrOfCodes)
showQuestionTitles()
Sets the question titles visible during the query.
sendNotificationMail($user_id, $anonymize_id, $appr_id)
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.
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)
_getQuestionblock($questionblock_id)
Returns the database row for a given question block.
read($a_force_db=false)
read object data from db into object
setEndDateAndTime($end_date="", $end_time)
Sets the end date of the survey.
isAnonymizedParticipant($key)
& 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)
& 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.
isAccessibleWithCodeForAll()
isAllowedToTakeMultipleSurveys($userid="")
Checks if a user is allowed to take multiple survey.
setReminderLastSent($a_value)
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)
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
disinviteAllUsers()
Disinvite all users.
Skill management settings.
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()
getQuestionblock($questionblock_id)
Returns the database row for a given question block.
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.
& getSurveyParticipants($finished_ids=null)
isComplete()
Returns 1, if a survey is complete for use.
removeQuestions($remove_questions, $remove_questionblocks)
Remove questions from the survey.
getAnonymousIdByCode($a_code)
Class ilObject Basic functions for all objects.
isAccessibleWithoutCode()
Checks if the survey is accessable without a survey code.
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.
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 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.
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
getUserAccessCode($user_id)
Returns a survey access code that was saved for a registered user.
closeAppraisee($a_user_id)
bindSurveyCodeToUser($user_id, $code)
moveUpQuestionblock($questionblock_id)
Moves a questionblock up in the list of survey questions.
setTutorNotificationStatus($a_value)
Survey Question Import Parser.
_addQuestionblock($title="", $owner=0, $show_questiontext=true, $show_blocktitle=false)
Adds a questionblock to the database.
setObligatoryStates($obligatory_questions)
Sets the obligatory states for questions in a survey from the questions form.
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table ...
getOwner()
get object owner
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
set360SkillService($a_val)
Set skill service.
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
canExportSurveyCode()
Checks if the survey code can be exported with the survey evaluation.
getAllRelations($short_as_key=false)
Returns all available relations.
& getQuestionblockQuestions($questionblock_id)
Returns the question titles of all questions of a question block.
inviteRole($role_id)
Invites a role to a survey.
addRater($a_appraisee_id, $a_user_id, $a_anonymous_id=0)
_lookupFullname($a_user_id)
Lookup Full Name.
& processCSVRow($row, $quoteAll=FALSE, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
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)
Default behaviour is:
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.
moveUpQuestion($question_id)
Moves a question up in the list of survey questions.
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)
& getUserSpecificResults($finished_ids)
Calculates the evaluation data for the user specific results.
getAuthor()
Gets the authors name of the ilObjSurvey object.
fetchAssoc($a_set)
Fetch row as associative array from result set.
isHTML($a_text)
Checks if a given string contains HTML or not.
hideQuestionTitles()
Sets the question titles hidden during the query.
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.
cloneObject($a_target_id, $a_copy_id=0)
Clone object.
deleteSurveyRecord()
Deletes the survey from the database.
updateConstraint($precondition_id, $if_question_id, $relation, $value, $conjunction)
Updates a precondition.
isPluginActive($a_pname)
Checks whether or not a question plugin with a given name is active.
disinviteUser($user_id)
Disinvites a user from a survey.
getSurveyCodesCount()
Returns the number of generated survey codes for the survey.
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.
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.
_getLastAccess($finished_id)
getId()
get object id public
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)
_lookupFinished($a_obj_id, $a_user_id="")
get finished status
_checkCondition($a_svy_id, $a_operator, $a_value, $a_usr_id=0)
setActivationStartDate($starting_time=NULL)
& getObligatoryStates()
Gets specific obligatory states of the survey.
static _lookupDescription($a_id)
lookup object description
getFinishedIdsForAppraiseeId($a_appr_id, $a_exclude_appraisee=false)
Class Mail this class handles base functions for mail handling.
updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
xslt_process(&$proc, $xml_var, $xslt_var, $dummy, $args, $params, $a_no_warnings=false)
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.
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
static & _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
& getQuestions($question_ids)
getQuestionType($question_id)
Returns the question type of a question with a given id.
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
ilObjSurvey($a_id=0, $a_call_by_reference=true)
Constructor 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.
redirection script todo: (a better solution should control the processing via a xml file) ...
cloneMetaData($target_obj)
Copy meta data.
toXML()
Returns a QTI xml representation of the survey.
xmlHeader()
Writes xml header public.
& getInvitedUsers()
Returns a list of all invited users in a survey.
_lookupLogin($a_user_id)
lookup login
addConstraintToQuestion($to_question_id, $constraint_id)
Adds a constraint to a question.
const MODE_PREDEFINED_USERS
_lookupEmail($a_user_id)
Lookup email.
getUserDataFromActiveId($active_id)
Returns the user information from an active_id (survey_finished.finished_id)
setSurveyId($survey_id)
Sets the survey id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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
fillSurveyForUser($user_id=ANONYMOUS_USER_ID)
Fills a survey randomly with data for a given user.
setReminderStatus($a_value)
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.
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
& _getGlobalSurveyData($obj_id)
Returns an array with data needed in the repository, personal desktop or courses. ...
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.
getExportFiles($dir)
get export files
static factory($a_package)
Create an XML_RPC2 client instance.
saveCompletionStatus()
Saves the completion status of the survey.
_getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
getExternalCodeRecipients($a_check_finished=false)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
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
getAllRTEContent()
Returns the content of all RTE enabled text areas in the test.
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.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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.
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
getQuestionsTable($arrFilter)
Calculates the data for the output of the question browser.
saveHeading($heading="", $insertbefore)
getCumulatedResults(&$question, $finished_ids)
Calculates the evaluation data for a question.
getRatersData($a_appraisee_id)
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.
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...
& 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.
deleteMetaData()
delete meta data entry
get360SkillService()
Get skill service.
moveDownQuestion($question_id)
Moves a question down in the list of survey questions.
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)
getOutro()
Gets the outro text.
getUserSettings($usr_id, $key)
sentReminder(array $a_recipient_ids)
getTutorNotificationStatus()
set360SelfAppraisee($a_value)
getUserSurveyCode($user_id)
sendCodes($not_sent, $subject, $message, $lang)
_isComplete($obj_id)
Returns 1, if a survey is complete for use.
modifyQuestionblock($questionblock_id, $title, $show_questiontext, $show_blocktitle)
Modifies a question block.
_getNrOfParticipants($survey_id)
Returns the number of participants for a survey.
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions and/or questionblocks to another position.
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
isPoolActive()
Get current pool status.
_isComplete($question_id)
Checks whether the question is complete or not.
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 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.
Survey Question Import Parser.
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
_getConstraints($survey_id)
Returns the constraints to a given question or questionblock.
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
Wrapper classes for system notifications.
getDetailedParticipantResultsAsText()
isAppraiseeClosed($a_user_id)
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
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.
_getAvailableQuestionpools($use_object_id=FALSE, $could_be_offline=FALSE, $showPath=FALSE, $permission="read")
Returns the available question pools for the active user.
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)
setOutro($outro="")
Sets the outro text.
moveDownQuestionblock($questionblock_id)
Moves a questionblock down in the list of survey questions.
static & _getQuestionTypeTranslations()
inviteGroup($group_id)
Invites a group to a survey.
getPrecondition($id)
Returns a precondition with a given id.
addQuestionToBlock($question_id, $questionblock_id)