162 function __construct($title =
"", $description =
"", $author =
"", $questiontext =
"", $owner = -1)
174 $this->cumulated =
array();
177 $this->author = $this->
ilias->account->fullname;
180 if ($this->owner == -1)
182 $this->owner = $this->
ilias->account->id;
185 $this->survey_id = -1;
186 $this->obligatory = 1;
187 $this->orientation = 0;
188 $this->materials =
array();
189 $this->material =
array();
190 $this->arrData =
array();
203 $this->complete = ($a_complete) ? 1 : 0;
230 if (strcmp($questionpool_object,
"") != 0)
232 $refwhere = sprintf(
" AND obj_fi = %s",
233 $ilDB->quote($questionpool_object,
'integer')
236 $result = $ilDB->queryF(
"SELECT question_id FROM svy_question WHERE title = %s$refwhere",
240 return ($result->numRows() > 0) ?
true :
false;
300 $this->survey_id =
$id;
325 if (empty($materials_name))
327 $materials_name = $materials_file;
329 if ((!empty($materials_name))&&(!array_key_exists($materials_name, $this->materials)))
331 $this->materials[$materials_name] = $materials_file;
342 function setMaterialsfile($materials_filename, $materials_tempfilename=
"", $materials_name=
"")
344 if (!empty($materials_filename))
347 if (!file_exists($materialspath))
352 $materialspath.$materials_filename))
354 print
"image not uploaded!!!! ";
358 $this->
addMaterials($materials_filename, $materials_name);
372 foreach ($this->materials as $key => $value)
374 if (strcmp($key, $materials_name)==0)
380 unset($this->materials[$key]);
393 $this->materials =
array();
407 $author = $this->
ilias->account->fullname;
473 return ($this->obligatory) ? 1 : 0;
497 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;
587 function duplicate($for_survey =
true, $title =
"", $author =
"", $owner =
"", $a_survey_id = 0)
589 if ($this->
getId() <= 0)
596 $original_id = $this->
getId();
598 if ($a_survey_id > 0)
600 $clone->setObjId($a_survey_id);
604 $clone->setTitle($title);
608 $clone->setAuthor($author);
612 $clone->setOwner($owner);
616 $clone->saveToDb($original_id);
623 $clone->duplicateMaterials($original_id);
625 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
626 return $clone->getId();
636 if ($this->
getId() <= 0)
642 $original_id = self::_getOriginalId($this->
getId(),
false);
644 $source_questionpool = $this->
getObjId();
645 $clone->setObjId($target_questionpool);
648 $clone->setTitle($title);
654 $clone->duplicateMaterials($original_id);
656 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
657 return $clone->getId();
668 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
670 foreach (
$mobs as $mob)
686 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
690 $this->material =
array();
693 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
697 $mat->type =
$row[
'material_type'];
698 $mat->internal_link =
$row[
'internal_link'];
699 $mat->title =
$row[
'material_title'];
700 $mat->import_id =
$row[
'import_id'];
701 $mat->text_material =
$row[
'text_material'];
702 $mat->external_link =
$row[
'external_link'];
703 $mat->file_material =
$row[
'file_material'];
704 array_push($this->material, $mat);
719 $result = $ilDB->queryF(
"SELECT complete FROM svy_question WHERE question_id = %s",
726 if (
$row[
"complete"] == 1)
743 $question_id = $this->
getId();
744 if (strlen($original_id))
746 $question_id = $original_id;
749 if ($this->
getId() > 0)
751 $this->log->debug(
"UPDATE svy_question question_id=".$question_id);
754 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
755 array(
'text',
'integer',
'integer'),
772 include_once(
"./Services/RTE/classes/class.ilRTE.php");
775 if ($this->
getId() == -1)
778 $next_id = $ilDB->nextId(
'svy_question');
779 $affectedRows = $ilDB->insert(
"svy_question",
array(
780 "question_id" =>
array(
"integer", $next_id),
785 "label" =>
array(
"text", (strlen($this->label)) ? $this->label : null),
792 "original_id" =>
array(
"integer", ($original_id) ? $original_id : NULL),
798 $this->
setId($next_id);
803 $affectedRows = $ilDB->update(
"svy_question",
array(
805 "label" =>
array(
"text", (strlen($this->label)) ? $this->label : null),
813 "question_id" =>
array(
"integer", $this->
getId())
816 $this->log->debug(
"UPDATE svy_question id=".$this->
getId().
" SET: title=".$this->
getTitle().
" ...");
819 return $affectedRows;
829 include_once
"./Services/Link/classes/class.ilInternalLink.php";
831 $this->log->debug(
"DELETE: svy_material question_fi=".$this->
getId());
833 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
839 foreach ($this->material as $material)
841 $next_id = $ilDB->nextId(
'svy_material');
843 $this->log->debug(
"INSERT: svy_material question_fi=".$this->
getId());
845 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_material " .
846 "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
847 "text_material, external_link, file_material, material_type) ".
848 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
849 array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
851 $next_id, $this->
getId(), $material->internal_link, $material->import_id,
852 $material->title,
time(), $material->text_material, $material->external_link,
853 $material->file_material, $material->type)
855 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches))
875 $next_id = $ilDB->nextId(
'svy_question');
876 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_question (question_id, questiontype_fi, " .
877 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
878 "created, original_id, tstamp) VALUES " .
879 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
880 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
881 'text',
'text',
'integer',
'integer',
'integer'),
898 $this->log->debug(
"INSERT INTO svy_question question_id= ".$next_id.
" questiontype_fi= ".$this->getQuestionTypeID());
900 $this->
setId($next_id);
902 return $this->
getId();
923 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
934 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
973 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
974 array(
'text',
'text',
'integer'),
975 array($categorytext, $neutral, $ilUser->getId())
984 if (strcmp(
$row[
"title"], $categorytext) == 0)
986 $returnvalue =
$row[
"category_id"];
997 $next_id = $ilDB->nextId(
'svy_category');
998 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
999 array(
'integer',
'text',
'text',
'integer',
'integer'),
1000 array($next_id, $categorytext, $neutral, $ilUser->getId(),
time())
1003 $this->log->debug(
"INSERT INTO svy_category id=".$next_id);
1005 $returnvalue = $next_id;
1007 return $returnvalue;
1020 $this->log->debug(
"DELETE FROM ".$this->getAdditionalTableName());
1022 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
1034 function delete($question_id)
1038 if ($question_id < 1)
return;
1040 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1047 $obj_id =
$row[
"obj_fi"];
1054 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_answer WHERE question_fi = %s",
1059 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE question_fi = %s",
1064 $result = $ilDB->queryF(
"SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
1070 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_constraint WHERE constraint_id = %s",
1076 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_constraint WHERE question_fi = %s",
1080 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qblk_qst WHERE question_fi = %s",
1084 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_svy_qst WHERE question_fi = %s",
1088 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
1092 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_question WHERE question_id = %s",
1099 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1104 $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);
1106 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1109 $directory = CLIENT_WEB_DIR .
"/survey/" . $obj_id .
"/$question_id";
1110 if (preg_match(
"/\d+/", $obj_id)
and preg_match(
"/\d+/", $question_id)
and is_dir($directory))
1115 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1121 foreach(
$mobs as $mob)
1128 include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
1131 $this->log->debug(
"UPDATE svy_question");
1134 $ilDB->manipulate(
"UPDATE svy_question".
1135 " SET original_id = NULL".
1136 " WHERE original_id = ".$ilDB->quote($question_id,
"integer"));
1150 if ($question_id < 1)
return "";
1152 $result = $ilDB->queryF(
"SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
1159 return $data[
"type_tag"];
1178 if ($question_id < 1)
return "";
1180 $result = $ilDB->queryF(
"SELECT title FROM svy_question WHERE svy_question.question_id = %s",
1187 return $data[
"title"];
1202 static function _getOriginalId($question_id, $a_return_question_id_if_no_original =
true)
1205 $result = $ilDB->queryF(
"SELECT * FROM svy_question WHERE question_id = %s",
1212 if (
$row[
"original_id"] > 0)
1214 return $row[
"original_id"];
1216 else if((
bool)$a_return_question_id_if_no_original)
1218 return $row[
"question_id"];
1233 $id = $this->
getId();
1243 $this->log->debug(
"DELETE FROM svy_material WHERE question_fi = ".$this->
getOriginalId());
1245 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1246 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_material WHERE question_fi = %s",
1251 if (strlen($this->material[
"internal_link"]))
1253 $next_id = $ilDB->nextId(
'svy_material');
1254 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
1255 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
1256 array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"],
time())
1259 $this->log->debug(
"INSERT svy_material material_id=".$next_id.
" question_fi=".$this->getOriginalId());
1261 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
1279 $result = $ilDB->queryF(
"SELECT title FROM svy_phrase WHERE phrase_id = %s",
1285 return $row[
"title"];
1301 $result = $ilDB->queryF(
"SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
1302 array(
'text',
'integer'),
1303 array($title, $ilUser->getId())
1305 return (
$result->numRows() == 0) ?
false :
true;
1319 if ($question_id < 1)
1324 $result = $ilDB->queryF(
"SELECT question_id FROM svy_question WHERE question_id = %s",
1328 return (
$result->numRows() == 1) ?
true :
false;
1333 if (strlen($material_id))
1335 if (strcmp($material_title,
"") == 0)
1337 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1339 $type = $matches[1];
1341 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1345 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1347 $cont_obj = $cont_obj_gui->object;
1348 $material_title .= $cont_obj->getTitle();
1351 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1352 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1354 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1356 $cont_obj = $cont_obj_gui->object;
1358 $material_title .= $pg_obj->getTitle();
1361 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1362 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1364 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1366 $cont_obj = $cont_obj_gui->object;
1368 $material_title .= $st_obj->getTitle();
1371 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1379 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyMaterial.php";
1382 $mat->internal_link = $material_id;
1383 $mat->title = $material_title;
1396 foreach ($a_array as $idx)
1398 unset($this->material[$idx]);
1400 $this->material = array_values($this->material);
1415 $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $materialspath);
1416 if (!file_exists($materialspath))
1420 if (!copy($materialspath_original . $filename, $materialspath . $filename))
1422 print
"material could not be duplicated!!!! ";
1429 array_push($this->material, $obj_material);
1439 function setMaterial($material_id =
"", $is_import =
false, $material_title =
"")
1441 if (strcmp($material_id,
"") != 0)
1446 $import_id = $material_id;
1447 $material_id = self::_resolveInternalLink($import_id);
1449 if (strcmp($material_title,
"") == 0)
1451 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches))
1453 $type = $matches[1];
1455 $material_title = $this->lng->txt(
"obj_$type") .
": ";
1459 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1461 $cont_obj = $cont_obj_gui->object;
1462 $material_title .= $cont_obj->getTitle();
1465 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
1466 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1468 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1470 $cont_obj = $cont_obj_gui->object;
1472 $material_title .= $pg_obj->getTitle();
1475 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
1476 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
1478 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
1480 $cont_obj = $cont_obj_gui->object;
1482 $material_title .= $st_obj->getTitle();
1485 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1493 $this->material =
array(
1494 "internal_link" => $material_id,
1495 "import_id" => $import_id,
1496 "title" => $material_title
1504 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches))
1506 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1507 include_once
"./Modules/LearningModule/classes/class.ilLMObject.php";
1508 include_once
"./Modules/Glossary/classes/class.ilGlossaryTerm.php";
1509 switch ($matches[2])
1527 if (strcmp($resolved_link,
"") == 0)
1529 $resolved_link = $internal_link;
1534 $resolved_link = $internal_link;
1536 return $resolved_link;
1543 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1551 $internal_link =
$row[
"internal_link"];
1552 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
1553 $resolved_link = self::_resolveInternalLink($internal_link);
1554 if (strcmp($internal_link, $resolved_link) != 0)
1557 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
1558 array(
'text',
'integer',
'integer'),
1570 include_once
"./Services/Link/classes/class.ilInternalLink.php";
1573 $result = $ilDB->queryF(
"SELECT * FROM svy_material WHERE question_fi = %s",
1581 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/",
$row[
"internal_link"], $matches))
1594 "lm" =>
"LearningModule",
1595 "pg" =>
"PageObject",
1596 "st" =>
"StructureObject",
1597 "git" =>
"GlossaryItem",
1598 "mob" =>
"MediaObject" 1601 if (preg_match(
"/il__(\w+)_(\d+)/",
$target, $matches))
1603 $type = $matches[1];
1605 switch($linktypes[$matches[1]])
1607 case "LearningModule":
1611 case "StructureObject":
1614 case "GlossaryItem":
1637 if (($question_id < 1) || ($user_id < 1))
1642 $result = $ilDB->queryF(
"SELECT obj_fi FROM svy_question WHERE question_id = %s",
1649 $qpl_object_id =
$row[
"obj_fi"];
1650 include_once
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
1668 $result = $ilDB->queryF(
"SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1675 return $row[
"questiontype_id"];
1703 $type = $question_type;
1704 if ($gui == 1) $type .=
"GUI";
1705 else if ($gui == 2) $type .=
"Evaluation";
1706 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php"))
1708 include_once
"./Modules/SurveyQuestionPool/classes/class.".$type.
".php";
1713 global $ilPluginAdmin;
1714 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1715 foreach ($pl_names as $pl_name)
1718 if (strcmp($pl->getQuestionType(), $question_type) == 0)
1720 $pl->includeClass(
"class.".$type.
".php");
1736 if (file_exists(
"./Modules/SurveyQuestionPool/classes/class.".$type_tag.
".php"))
1739 return $lng->txt($type_tag);
1743 global $ilPluginAdmin;
1744 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"SurveyQuestionPool",
"svyq");
1745 foreach ($pl_names as $pl_name)
1748 if (strcmp($pl->getQuestionType(), $type_tag) == 0)
1750 return $pl->getQuestionTypeTranslation();
1767 $question_type = self::_getQuestionType($question_id);
1770 self::_includeClass($question_type);
1771 $question =
new $question_type();
1772 $question->loadFromDb($question_id);
1786 $question_type = self::_getQuestionType($question_id);
1789 self::_includeClass($question_type, 1);
1790 $guitype = $question_type .
"GUI";
1791 $question =
new $guitype($question_id);
1805 $question = self::_instanciateQuestion($question_id);
1808 $question_type = self::_getQuestionType($question_id);
1809 self::_includeClass($question_type, 2);
1810 $class = $question_type .
"Evaluation";
1811 $ev =
new $class($question, $a_finished_ids);
1826 if (preg_match(
"/<[^>]*?>/", $a_text))
1846 $svy_log->debug(
"material count: ".$a_material->getMaterialCount());
1849 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
1851 $material = $a_material->getMaterial($i);
1852 if (strcmp($material[
"type"],
"mattext") == 0)
1854 $result .= $material[
"material"]->getContent();
1856 if (strcmp($material[
"type"],
"matimage") == 0)
1858 $matimage = $material[
"material"];
1859 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
1863 array_push(
$_SESSION[
"import_mob_xhtml"],
array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
1878 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $a_attrs = null)
1880 include_once
"./Services/RTE/classes/class.ilRTE.php";
1881 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1883 $a_xml_writer->xmlStartTag(
"material");
1885 "type" =>
"text/plain" 1887 if ($this->
isHTML($a_material))
1889 $attrs[
"type"] =
"text/xhtml";
1891 if (is_array($a_attrs))
1893 $attrs = array_merge($attrs, $a_attrs);
1900 foreach (
$mobs as $mob)
1904 "label" =>
"il_" . IL_INST_ID .
"_mob_" . $mob,
1905 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1906 "type" =>
"spl:html",
1907 "id" => $this->
getId()
1909 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
1912 if ($close_material_tag) $a_xml_writer->xmlEndTag(
"material");
2058 $this->original_id = $original_id;
2063 return $this->original_id;
2090 if (array_key_exists($value, $this->arrData))
2092 return $this->arrData[$value];
2110 $this->arrData[$key] = $value;
2126 $ilDB->manipulate(
"UPDATE svy_question".
2127 " SET original_id = ".$ilDB->quote($a_original_id,
"integer").
",".
2128 " obj_fi = ".$ilDB->quote($a_object_id,
"integer").
2129 " WHERE question_id = ".$ilDB->quote($a_question_id,
"integer"));
2136 $set = $ilDB->query(
"SELECT q.question_id,s.obj_fi".
2137 " FROM svy_question q".
2138 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)".
2139 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)".
2140 " WHERE original_id = ".$ilDB->quote($this->getId(),
"integer"));
2142 while(
$row = $ilDB->fetchAssoc($set))
2144 if(!$a_group_by_survey)
2150 $res[
$row[
"obj_fi"]][] = $row[
"question_id"];
2165 $set = $ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst".
2166 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)".
2167 " WHERE svy_svy_qst.question_fi = ".$ilDB->quote($a_question_id,
"integer"));
2168 $row = $ilDB->fetchAssoc($set);
2169 if($ilDB->numRows($set))
2171 return $row[
"obj_fi"];
2185 $set = $ilDB->query(
"SELECT obj_fi FROM svy_question ".
2186 " WHERE question_id = ".$ilDB->quote($a_qid,
"integer")
2188 $rec = $ilDB->fetchAssoc($set);
2189 return $rec[
"obj_fi"];
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.
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...
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 _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 _saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
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.
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.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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.
redirection script todo: (a better solution should control the processing via a xml file) ...
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.
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.
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.
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.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output in surveys.
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.