169 $this->
user = $DIC->user();
170 $this->db = $DIC->database();
171 $lng = $DIC->language();
182 $this->cumulated =
array();
183 if (!$this->author) {
184 $this->author =
$ilUser->fullname;
187 if ($this->owner == -1) {
188 $this->owner =
$ilUser->getId();
191 $this->survey_id = -1;
192 $this->obligatory = 1;
193 $this->orientation = 0;
194 $this->materials =
array();
195 $this->material =
array();
196 $this->arrData =
array();
209 $this->complete = ($a_complete) ? 1 : 0;
236 if (strcmp($questionpool_object,
"") != 0) {
239 $ilDB->quote($questionpool_object,
'integer')
243 "SELECT question_id FROM svy_question WHERE title = %s$refwhere",
247 return ($result->numRows() > 0) ?
true :
false;
307 $this->survey_id =
$id;
332 if (empty($materials_name)) {
333 $materials_name = $materials_file;
335 if ((!empty($materials_name))&&(!array_key_exists($materials_name, $this->materials))) {
336 $this->materials[$materials_name] = $materials_file;
347 public function setMaterialsfile($materials_filename, $materials_tempfilename=
"", $materials_name=
"")
349 if (!empty($materials_filename)) {
351 if (!file_exists($materialspath)) {
354 if (ilUtil::moveUploadedFile(
355 $materials_tempfilename,
357 $materialspath . $materials_filename
359 print
"image not uploaded!!!! ";
361 $this->
addMaterials($materials_filename, $materials_name);
375 foreach ($this->materials as
$key => $value) {
376 if (strcmp(
$key, $materials_name)==0) {
380 unset($this->materials[
$key]);
393 $this->materials =
array();
474 return ($this->obligatory) ? 1 : 0;
498 switch ($this->orientation) {
504 $this->orientation = 0;
520 return (strlen($this->description)) ? $this->description : null;
532 return (strlen($this->author)) ? $this->author : null;
556 return (strlen($this->questiontext)) ? $this->questiontext : null;
590 if ($this->
getId() <= 0) {
596 $original_id = $this->
getId();
598 if ($a_survey_id > 0) {
599 $clone->setObjId($a_survey_id);
611 $clone->saveToDb($original_id);
616 $clone->duplicateMaterials($original_id);
618 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
619 return $clone->getId();
629 if ($this->
getId() <= 0) {
634 $original_id = self::_getOriginalId($this->
getId(),
false);
636 $source_questionpool = $this->
getObjId();
637 $clone->setObjId($target_questionpool);
645 $clone->duplicateMaterials($original_id);
647 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
648 return $clone->getId();
659 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
661 foreach (
$mobs as $mob) {
677 "SELECT * FROM svy_material WHERE question_fi = %s",
681 $this->material =
array();
683 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
686 $mat->type =
$row[
'material_type'];
687 $mat->internal_link =
$row[
'internal_link'];
688 $mat->title =
$row[
'material_title'];
689 $mat->import_id =
$row[
'import_id'];
690 $mat->text_material =
$row[
'text_material'];
691 $mat->external_link =
$row[
'external_link'];
692 $mat->file_material =
$row[
'file_material'];
693 array_push($this->material, $mat);
708 $ilDB = $DIC->database();
711 "SELECT complete FROM svy_question WHERE question_id = %s",
717 if (
$row[
"complete"] == 1) {
733 $question_id = $this->
getId();
734 if (strlen($original_id)) {
735 $question_id = $original_id;
738 if ($this->
getId() > 0) {
739 $this->log->debug(
"UPDATE svy_question question_id=" . $question_id);
742 $affectedRows =
$ilDB->manipulateF(
743 "UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
744 array(
'text',
'integer',
'integer'),
761 include_once(
"./Services/RTE/classes/class.ilRTE.php");
764 if ($this->
getId() == -1) {
766 $next_id =
$ilDB->nextId(
'svy_question');
767 $affectedRows =
$ilDB->insert(
"svy_question",
array(
768 "question_id" =>
array(
"integer", $next_id),
773 "label" =>
array(
"text", (strlen($this->label)) ? $this->label : null),
780 "original_id" =>
array(
"integer", ($original_id) ? $original_id : null),
786 $this->
setId($next_id);
789 $affectedRows =
$ilDB->update(
"svy_question",
array(
791 "label" =>
array(
"text", (strlen($this->label)) ? $this->label : null),
799 "question_id" =>
array(
"integer", $this->
getId())
802 $this->log->debug(
"UPDATE svy_question id=" . $this->
getId() .
" SET: title=" . $this->
getTitle() .
" ...");
805 return $affectedRows;
815 include_once
"./Services/Link/classes/class.ilInternalLink.php";
817 $this->log->debug(
"DELETE: svy_material question_fi=" . $this->
getId());
819 $affectedRows =
$ilDB->manipulateF(
820 "DELETE FROM svy_material WHERE question_fi = %s",
827 $next_id =
$ilDB->nextId(
'svy_material');
829 $this->log->debug(
"INSERT: svy_material question_fi=" . $this->
getId());
831 $affectedRows =
$ilDB->manipulateF(
832 "INSERT INTO svy_material " .
833 "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
834 "text_material, external_link, file_material, material_type) " .
835 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
836 array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
838 $next_id, $this->
getId(), $material->internal_link, $material->import_id,
839 $material->title,
time(), $material->text_material, $material->external_link,
840 $material->file_material, $material->type)
842 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches)) {
860 $next_id =
$ilDB->nextId(
'svy_question');
861 $affectedRows =
$ilDB->manipulateF(
862 "INSERT INTO svy_question (question_id, questiontype_fi, " .
863 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
864 "created, original_id, tstamp) VALUES " .
865 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
866 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
867 'text',
'text',
'integer',
'integer',
'integer'),
884 $this->log->debug(
"INSERT INTO svy_question question_id= " . $next_id .
" questiontype_fi= " . $this->
getQuestionTypeID());
886 $this->
setId($next_id);
888 return $this->
getId();
909 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
920 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
961 "SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
962 array(
'text',
'text',
'integer'),
970 if (strcmp(
$row[
"title"], $categorytext) == 0) {
971 $returnvalue =
$row[
"category_id"];
979 $next_id =
$ilDB->nextId(
'svy_category');
980 $affectedRows =
$ilDB->manipulateF(
981 "INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
982 array(
'integer',
'text',
'text',
'integer',
'integer'),
986 $this->log->debug(
"INSERT INTO svy_category id=" . $next_id);
988 $returnvalue = $next_id;
1003 $this->log->debug(
"DELETE FROM " . $this->getAdditionalTableName());
1005 $affectedRows =
$ilDB->manipulateF(
1006 "DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
1018 public function delete($question_id)
1022 if ($question_id < 1) {
1027 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
1031 if (
$result->numRows() == 1) {
1038 $affectedRows =
$ilDB->manipulateF(
1039 "DELETE FROM svy_answer WHERE question_fi = %s",
1044 $affectedRows =
$ilDB->manipulateF(
1045 "DELETE FROM svy_constraint WHERE question_fi = %s",
1051 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
1056 $affectedRows =
$ilDB->manipulateF(
1057 "DELETE FROM svy_constraint WHERE constraint_id = %s",
1063 $affectedRows =
$ilDB->manipulateF(
1064 "DELETE FROM svy_qst_constraint WHERE question_fi = %s",
1068 $affectedRows =
$ilDB->manipulateF(
1069 "DELETE FROM svy_qblk_qst WHERE question_fi = %s",
1073 $affectedRows =
$ilDB->manipulateF(
1074 "DELETE FROM svy_svy_qst WHERE question_fi = %s",
1078 $affectedRows =
$ilDB->manipulateF(
1079 "DELETE FROM svy_variable WHERE question_fi = %s",
1083 $affectedRows =
$ilDB->manipulateF(
1084 "DELETE FROM svy_question WHERE question_id = %s",
1091 $affectedRows =
$ilDB->manipulateF(
1092 "DELETE FROM svy_material WHERE question_fi = %s",
1097 $this->log->debug(
"SET OF DELETES svy_answer, svy_constraint, svy_qst_constraint, svy_qblk_qst, svy_qst_oblig, svy_svy_qst, svy_variable, svy_question, svy_material WHERE question_fi = " . $question_id);
1099 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1102 $directory = CLIENT_WEB_DIR .
"/survey/" .
$obj_id .
"/$question_id";
1103 if (preg_match(
"/\d+/",
$obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory)) {
1107 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1113 foreach (
$mobs as $mob) {
1119 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1122 $this->log->debug(
"UPDATE svy_question");
1125 $ilDB->manipulate(
"UPDATE svy_question" .
1126 " SET original_id = NULL" .
1127 " WHERE original_id = " .
$ilDB->quote($question_id,
"integer"));
1141 $ilDB = $DIC->database();
1143 if ($question_id < 1) {
1148 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
1152 if (
$result->numRows() == 1) {
1154 return $data[
"type_tag"];
1171 $ilDB = $DIC->database();
1173 if ($question_id < 1) {
1178 "SELECT title FROM svy_question WHERE svy_question.question_id = %s",
1182 if (
$result->numRows() == 1) {
1184 return $data[
"title"];
1197 public static function _getOriginalId($question_id, $a_return_question_id_if_no_original =
true)
1201 $ilDB = $DIC->database();
1203 "SELECT * FROM svy_question WHERE question_id = %s",
1209 if (
$row[
"original_id"] > 0) {
1210 return $row[
"original_id"];
1211 } elseif ((
bool) $a_return_question_id_if_no_original) {
1212 return $row[
"question_id"];
1234 $this->log->debug(
"DELETE FROM svy_material WHERE question_fi = " . $this->
getOriginalId());
1236 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1237 $affectedRows =
$ilDB->manipulateF(
1238 "DELETE FROM svy_material WHERE question_fi = %s",
1243 if (strlen($this->material[
"internal_link"])) {
1244 $next_id =
$ilDB->nextId(
'svy_material');
1245 $affectedRows =
$ilDB->manipulateF(
1246 "INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
1247 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
1248 array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"],
time())
1251 $this->log->debug(
"INSERT svy_material material_id=" . $next_id .
" question_fi=" . $this->
getOriginalId());
1253 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
1271 "SELECT title FROM svy_phrase WHERE phrase_id = %s",
1276 return $row[
"title"];
1294 "SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
1295 array(
'text',
'integer'),
1298 return (
$result->numRows() == 0) ?
false :
true;
1312 $ilDB = $DIC->database();
1314 if ($question_id < 1) {
1319 "SELECT question_id FROM svy_question WHERE question_id = %s",
1323 return (
$result->numRows() == 1) ?
true :
false;
1328 if (strlen($material_id)) {
1329 if (strcmp($material_title,
"") == 0) {
1330 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
1331 $type = $matches[1];
1333 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1336 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1338 $cont_obj = $cont_obj_gui->object;
1339 $material_title .= $cont_obj->getTitle();
1342 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1343 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1345 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1347 $cont_obj = $cont_obj_gui->object;
1349 $material_title .= $pg_obj->getTitle();
1352 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1353 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1355 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1357 $cont_obj = $cont_obj_gui->object;
1359 $material_title .= $st_obj->getTitle();
1362 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1370 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
1373 $mat->internal_link = $material_id;
1374 $mat->title = $material_title;
1387 foreach ($a_array as $idx) {
1388 unset($this->material[$idx]);
1390 $this->material = array_values($this->material);
1402 foreach ($this->materials as
$filename) {
1404 $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $materialspath);
1405 if (!file_exists($materialspath)) {
1408 if (!copy($materialspath_original . $filename, $materialspath . $filename)) {
1409 print
"material could not be duplicated!!!! ";
1416 array_push($this->material, $obj_material);
1426 public function setMaterial($material_id =
"", $is_import =
false, $material_title =
"")
1428 if (strcmp($material_id,
"") != 0) {
1431 $import_id = $material_id;
1432 $material_id = self::_resolveInternalLink($import_id);
1434 if (strcmp($material_title,
"") == 0) {
1435 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
1436 $type = $matches[1];
1438 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1441 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1443 $cont_obj = $cont_obj_gui->object;
1444 $material_title .= $cont_obj->getTitle();
1447 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1448 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1450 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1452 $cont_obj = $cont_obj_gui->object;
1454 $material_title .= $pg_obj->getTitle();
1457 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1458 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1460 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1462 $cont_obj = $cont_obj_gui->object;
1464 $material_title .= $st_obj->getTitle();
1467 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1475 $this->material =
array(
1476 "internal_link" => $material_id,
1477 "import_id" => $import_id,
1478 "title" => $material_title
1486 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
1487 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1488 include_once
"./Modules/LearningModule/classes/class.ilLMObject.php";
1489 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1490 switch ($matches[2]) {
1507 if (strcmp($resolved_link,
"") == 0) {
1508 $resolved_link = $internal_link;
1511 $resolved_link = $internal_link;
1513 return $resolved_link;
1520 $ilDB = $DIC->database();
1523 "SELECT * FROM svy_material WHERE question_fi = %s",
1529 $internal_link =
$row[
"internal_link"];
1530 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1531 $resolved_link = self::_resolveInternalLink($internal_link);
1532 if (strcmp($internal_link, $resolved_link) != 0) {
1534 $affectedRows =
$ilDB->manipulateF(
1535 "UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
1536 array(
'text',
'integer',
'integer'),
1543 if ($resolvedlinks) {
1547 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1551 "SELECT * FROM svy_material WHERE question_fi = %s",
1557 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/",
$row[
"internal_link"], $matches)) {
1569 $ilDB = $DIC->database();
1571 "lm" =>
"LearningModule",
1572 "pg" =>
"PageObject",
1573 "st" =>
"StructureObject",
1574 "git" =>
"GlossaryItem",
1575 "mob" =>
"MediaObject" 1578 if (preg_match(
"/il__(\w+)_(\d+)/",
$target, $matches)) {
1579 $type = $matches[1];
1581 switch ($linktypes[$matches[1]]) {
1582 case "LearningModule":
1586 case "StructureObject":
1589 case "GlossaryItem":
1612 $ilDB = $DIC->database();
1614 if (($question_id < 1) || ($user_id < 1)) {
1619 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
1623 if (
$result->numRows() == 1) {
1625 $qpl_object_id =
$row[
"obj_fi"];
1626 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1643 "SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1647 if (
$result->numRows() == 1) {
1649 return $row[
"questiontype_id"];
1675 $type = $question_type;
1678 } elseif ($gui == 2) {
1679 $type .=
"Evaluation";
1681 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class." .
$type .
".php")) {
1682 include_once
"./Modules/SurveyQuestionPool/classes/class." .
$type .
".php";
1687 $ilPluginAdmin = $DIC[
"ilPluginAdmin"];
1688 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1689 foreach ($pl_names as $pl_name) {
1691 if (strcmp($pl->getQuestionType(), $question_type) == 0) {
1692 $pl->includeClass(
"class." .
$type .
".php");
1708 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class." . $type_tag .
".php")) {
1711 $lng = $DIC->language();
1712 return $lng->txt($type_tag);
1716 $ilPluginAdmin = $DIC[
"ilPluginAdmin"];
1717 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1718 foreach ($pl_names as $pl_name) {
1720 if (strcmp($pl->getQuestionType(), $type_tag) == 0) {
1721 return $pl->getQuestionTypeTranslation();
1738 $question_type = self::_getQuestionType($question_id);
1739 if ($question_type) {
1740 self::_includeClass($question_type);
1741 $question =
new $question_type();
1742 $question->loadFromDb($question_id);
1756 $question_type = self::_getQuestionType($question_id);
1757 if ($question_type) {
1758 self::_includeClass($question_type, 1);
1759 $guitype = $question_type .
"GUI";
1760 $question =
new $guitype($question_id);
1774 $question = self::_instanciateQuestion($question_id);
1776 $question_type = self::_getQuestionType($question_id);
1777 self::_includeClass($question_type, 2);
1778 $class = $question_type .
"Evaluation";
1779 $ev =
new $class($question, $a_finished_ids);
1794 if (preg_match(
"/<[^>]*?>/", $a_text)) {
1811 $svy_log->debug(
"material count: " . $a_material->getMaterialCount());
1814 for (
$i = 0;
$i < $a_material->getMaterialCount();
$i++) {
1816 if (strcmp(
$material[
"type"],
"mattext") == 0) {
1819 if (strcmp(
$material[
"type"],
"matimage") == 0) {
1821 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
1823 if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
1826 array_push(
$_SESSION[
"import_mob_xhtml"],
array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
1841 public function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag =
true, $add_mobs =
true, $a_attrs = null)
1843 include_once
"./Services/RTE/classes/class.ilRTE.php";
1844 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1846 $a_xml_writer->xmlStartTag(
"material");
1848 "type" =>
"text/plain" 1850 if ($this->
isHTML($a_material)) {
1851 $attrs[
"type"] =
"text/xhtml";
1853 if (is_array($a_attrs)) {
1854 $attrs = array_merge($attrs, $a_attrs);
1860 foreach (
$mobs as $mob) {
1863 "label" =>
"il_" . IL_INST_ID .
"_mob_" . $mob,
1864 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1865 "type" =>
"spl:html",
1866 "id" => $this->
getId()
1868 $a_xml_writer->xmlElement(
"matimage", $imgattrs, null);
1871 if ($close_material_tag) {
1872 $a_xml_writer->xmlEndTag(
"material");
2019 $this->original_id = $original_id;
2024 return $this->original_id;
2050 if (array_key_exists($value, $this->arrData)) {
2051 return $this->arrData[$value];
2066 $this->arrData[
$key] = $value;
2082 $ilDB = $DIC->database();
2084 $ilDB->manipulate(
"UPDATE svy_question" .
2085 " SET original_id = " .
$ilDB->quote($a_original_id,
"integer") .
"," .
2086 " obj_fi = " .
$ilDB->quote($a_object_id,
"integer") .
2087 " WHERE question_id = " .
$ilDB->quote($a_question_id,
"integer"));
2094 $set =
$ilDB->query(
"SELECT q.question_id,s.obj_fi" .
2095 " FROM svy_question q" .
2096 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)" .
2097 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)" .
2098 " WHERE original_id = " .
$ilDB->quote($this->getId(),
"integer"));
2100 while (
$row =
$ilDB->fetchAssoc($set)) {
2101 if (!$a_group_by_survey) {
2104 $res[
$row[
"obj_fi"]][] = $row[
"question_id"];
2119 $ilDB = $DIC->database();
2121 $set =
$ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst" .
2122 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)" .
2123 " WHERE svy_svy_qst.question_fi = " .
$ilDB->quote($a_question_id,
"integer"));
2125 if (
$ilDB->numRows($set)) {
2126 return $row[
"obj_fi"];
2140 $ilDB = $DIC->database();
2142 $set =
$ilDB->query(
2143 "SELECT obj_fi FROM svy_question " .
2144 " WHERE question_id = " .
$ilDB->quote($a_qid,
"integer")
2146 $rec =
$ilDB->fetchAssoc($set);
2147 return $rec[
"obj_fi"];
2160 if ($str != $a_str) {
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static _instanciateQuestionGUI($question_id)
Creates an instance of a question GUI with a given question id.
static _resolveInternalLink($internal_link)
saveCategoryToDb($categorytext, $neutral=0)
Saves a category to the database.
addMaterials($materials_file, $materials_name="")
Sets the materials uri.
__construct($title="", $description="", $author="", $questiontext="", $owner=-1)
SurveyQuestion constructor The constructor takes possible arguments an creates an instance of the Sur...
saveCompletionStatus($original_id="")
Saves the complete flag to the database.
getAuthor()
Gets the authors name of the SurveyQuestion object.
$cumulated
An array containing the cumulated results of the question for a given survey.
getTitle()
Gets the title string of the SurveyQuestion object.
phraseExists($title)
Returns true if the phrase title already exists for the current user.
saveToDb($original_id="")
Saves a SurveyQuestion object to a database.
static handleQuestionDeletion($a_question_id, $a_obj_id)
Remove question skill assignment.
getObligatory($survey_id="")
Gets the obligatory state of the question.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
static _lookupSurveyObjId($a_question_id)
stripSlashesAddSpaceFallback($a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
setObligatory($obligatory=1)
Sets the obligatory state of the question.
getMaterialsPath()
Returns the materials path for web accessable materials of a question.
setOrientation($orientation=0)
Sets the orientation of the question output.
__set($key, $value)
Object setter.
copyXHTMLMediaObjectsOfQuestion($a_q_id)
Increases the media object usage counter when a question is duplicated.
importResponses($a_data)
Import response data from the question import file.
importMatrix($a_data)
Import matrix rows from the question import file.
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
static _getIdForImportId($a_import_id)
get current object id for import id (static)
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _resolveIntLinks($question_id)
deleteMaterial($materials_name="")
Deletes a materials uri with a given name.
importAdjectives($a_data)
Import bipolar adjectives from the question import file.
getMaterialsPathWeb()
Returns the web image path for web accessable images of a question.
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
setId($id=-1)
Sets the id of the SurveyQuestion object.
flushMaterials()
Deletes all materials uris.
static _isComplete($question_id)
Checks whether the question is complete or not.
static _changeOriginalId($a_question_id, $a_original_id, $a_object_id)
Change original id of existing question in db.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
usableForPrecondition()
Returns if the question is usable for preconditions.
getQuestionDataArray($id)
Returns the question data fields from the database.
getQuestiontext()
Gets the questiontext of the SurveyQuestion object.
static _getIdForImportId($a_type, $a_target)
Get current id for an import id.
getOrientation()
Gets the orientation of the question output.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static lookupObjFi($a_qid)
Lookip obj fi.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
loadFromDb($question_id)
Loads a SurveyQuestion object from the database.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setOwner($owner="")
Sets the creator/owner ID of the SurveyQuestion object.
setComplete($a_complete)
Sets the complete state of the question.
getPreconditionOptions()
Returns the options for preconditions.
setMaterial($material_id="", $is_import=false, $material_title="")
Sets a material link for the question.
getQuestionTypeID()
Returns the question type ID of the question.
addMaterial($obj_material)
setOriginalId($original_id)
duplicate($for_survey=true, $title="", $author="", $owner="", $a_survey_id=0)
Duplicates a survey question.
getOwner()
Gets the creator/owner ID of the SurveyQuestion object.
setQuestiontext($questiontext="")
Sets the questiontext of the SurveyQuestion object.
static _getOriginalId($question_id, $a_return_question_id_if_no_original=true)
Returns the original id of a question.
foreach($_POST as $key=> $value) $res
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
getId()
Gets the id of the SurveyQuestion object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getPhrase($phrase_id)
Returns a phrase for a given database id.
addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true, $a_attrs=null)
Creates an XML material tag from a plain text or xhtml text.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false)
Prepares a string for a text area output in surveys.
Basic class for all survey question types.
saveMaterial()
save material to db
static _questionExists($question_id)
Returns true if the question already exists in the database.
getAvailableRelations()
Returns the available relations for the question.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
& getWorkingDataFromUserInput($post_data)
Creates the user data of the svy_answer table from the POST data.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static removeTrailingPathSeparators($path)
static _getInternalLinkHref($target="", $a_parent_ref_id=null)
Create styles array
The data for the language used.
setSurveyId($id=-1)
Sets the survey id of the SurveyQuestion object.
addInternalLink($material_id, $title="")
isComplete()
Returns 1, if a question is complete for use.
saveWorkingData($limit_to=LIMIT_NO_LIMIT)
Saves the learners input of the question to the database.
getImagePath()
Returns the image path for web accessable images of a question.
setAuthor($author="")
Sets the authors name of the SurveyQuestion object.
const LIMIT_NO_LIMIT
Assessment constants.
deleteMaterials($a_array)
Deletes materials.
setDescription($description="")
Sets the description string of the SurveyQuestion object.
setMaterialsfile($materials_filename, $materials_tempfilename="", $materials_name="")
Sets and uploads the materials uri.
Class ilObjContentObjectGUI.
static _deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
copyObject($target_questionpool, $title="")
Copies an assOrderingQuestion object.
importAdditionalMetadata($a_meta)
Import additional meta data from the question import file.
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
getDescription()
Gets the description string of the SurveyQuestion object.
static getLogger($a_component_id)
Get component logger.
getObjId()
Get the reference id of the container object.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getPreconditionSelectValue($default="", $title, $variable)
Creates a form property for the precondition value.
duplicateMaterials($question_id)
Duplicates the materials of a question.
setObjId($obj_id=0)
Set the reference id of the container object.
static _saveLink( $a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
isHTML($a_text)
Checks if a given string contains HTML or not.
__get($value)
Object getter.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$arrData
data array containing the question data
static _lookGlossaryTerm($term_id)
get glossary term
getQuestionType()
Returns the question type of the question.
getPreconditionValueOutput($value)
Returns the output for a precondition value.
createNewQuestion()
Creates a new question with a 0 timestamp when a new question is created This assures that an ID is g...
getCopyIds($a_group_by_survey=false)
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
getSurveyId()
Gets the survey id of the SurveyQuestion object.
setTitle($title="")
Sets the title string of the SurveyQuestion object.
questionTitleExists($title, $questionpool_object="")
Returns TRUE if the question title exists in the database.