28 protected \ILIAS\SurveyQuestionPool\Editing\EditSessionRepository
$edit_manager;
50 protected \ILIAS\SurveyQuestionPool\Export\ImportSessionRepository
$import_manager;
54 string $description =
"",
56 string $questiontext =
"",
61 $this->
user = $DIC->user();
62 $this->db = $DIC->database();
63 $lng = $DIC->language();
72 $this->cumulated = array();
74 $this->author =
$ilUser->fullname;
77 if ($this->owner === -1) {
78 $this->owner =
$ilUser->getId();
81 $this->survey_id = -1;
82 $this->obligatory = 1;
83 $this->orientation = 0;
84 $this->materials = array();
85 $this->material = array();
86 $this->arrData = array();
89 $this->import_manager = $DIC->surveyQuestionPool()
94 $this->edit_manager = $DIC->surveyQuestionPool()
102 $this->complete = $a_complete;
112 int $questionpool_object = 0
117 if ($questionpool_object > 0) {
120 $ilDB->quote($questionpool_object,
'integer')
123 $result =
$ilDB->queryF(
124 "SELECT question_id FROM svy_question WHERE title = %s$refwhere",
128 return $result->numRows() > 0;
146 public function setId(
int $id = -1): void
153 $this->survey_id =
$id;
162 string $materials_file,
163 string $materials_name =
"" 165 if (empty($materials_name)) {
166 $materials_name = $materials_file;
168 if ((!empty($materials_name)) && (!array_key_exists($materials_name, $this->materials))) {
169 $this->materials[$materials_name] = $materials_file;
177 string $materials_filename,
178 string $materials_tempfilename =
"",
179 string $materials_name =
"" 181 if (!empty($materials_filename)) {
183 if (!file_exists($materialspath)) {
187 $materials_tempfilename,
189 $materialspath . $materials_filename
191 print
"image not uploaded!!!! ";
193 $this->
addMaterials($materials_filename, $materials_name);
199 string $materials_name =
"" 201 foreach ($this->materials as
$key => $value) {
202 if (strcmp(
$key, $materials_name) === 0) {
206 unset($this->materials[
$key]);
217 $this->materials = array();
273 switch ($this->orientation) {
279 $this->orientation = 0;
323 bool $for_survey =
true,
329 if ($this->
getId() <= 0) {
335 $original_id = $this->
getId();
337 if ($a_survey_id > 0) {
338 $clone->setObjId($a_survey_id);
341 $clone->setTitle($title);
344 $clone->setAuthor($author);
347 $clone->setOwner($owner);
350 $clone->saveToDb($original_id);
355 $clone->duplicateMaterials($original_id);
357 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
358 return $clone->getId();
362 int $target_questionpool,
365 if ($this->
getId() <= 0) {
370 $original_id = self::_getOriginalId($this->
getId(),
false);
372 $source_questionpool = $this->
getObjId();
373 $clone->setObjId($target_questionpool);
375 $clone->setTitle($title);
381 $clone->duplicateMaterials($original_id);
383 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
384 return $clone->getId();
394 foreach (
$mobs as $mob) {
407 $result =
$ilDB->queryF(
408 "SELECT * FROM svy_material WHERE question_fi = %s",
410 array($this->
getId())
412 $this->material = array();
413 if ($result->numRows()) {
414 while ($row =
$ilDB->fetchAssoc($result)) {
416 $mat->type = (string) $row[
'material_type'];
417 $mat->internal_link = (string) $row[
'internal_link'];
418 $mat->title = (string) $row[
'material_title'];
419 $mat->import_id = (string) $row[
'import_id'];
420 $mat->text_material = (string) $row[
'text_material'];
421 $mat->external_link = (string) $row[
'external_link'];
422 $mat->file_material = (string) $row[
'file_material'];
423 $this->material[] = $mat;
435 $ilDB = $DIC->database();
437 $result =
$ilDB->queryF(
438 "SELECT complete FROM svy_question WHERE question_id = %s",
442 if ($result->numRows()) {
443 $row =
$ilDB->fetchAssoc($result);
444 if ((
int) $row[
"complete"] === 1) {
459 $question_id = $this->
getId();
460 if ($original_id > 0) {
464 if ($this->
getId() > 0) {
465 $this->log->debug(
"UPDATE svy_question question_id=" . $question_id);
468 $affectedRows =
$ilDB->manipulateF(
469 "UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
470 array(
'text',
'integer',
'integer'),
471 array($this->
isComplete(), time(), $question_id)
486 if ($this->
getId() === -1) {
488 $next_id =
$ilDB->nextId(
'svy_question');
489 $affectedRows =
$ilDB->insert(
"svy_question", array(
490 "question_id" => array(
"integer", $next_id),
492 "obj_fi" => array(
"integer", $this->
getObjId()),
493 "owner_fi" => array(
"integer", $this->
getOwner()),
494 "title" => array(
"text", $this->
getTitle()),
495 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
497 "author" => array(
"text", $this->
getAuthor()),
500 "complete" => array(
"text", $this->
isComplete()),
501 "created" => array(
"integer", time()),
502 "original_id" => array(
"integer", ($original_id) ?: null),
503 "tstamp" => array(
"integer", time())
508 $this->
setId($next_id);
511 $affectedRows =
$ilDB->update(
"svy_question", array(
512 "title" => array(
"text", $this->
getTitle()),
513 "label" => array(
"text", (strlen($this->label)) ? $this->label : null),
515 "author" => array(
"text", $this->
getAuthor()),
518 "complete" => array(
"text", $this->
isComplete()),
519 "tstamp" => array(
"integer", time())
521 "question_id" => array(
"integer", $this->
getId())
524 $this->log->debug(
"UPDATE svy_question id=" . $this->
getId() .
" SET: title=" . $this->
getTitle() .
" ...");
526 return $affectedRows;
533 $this->log->debug(
"DELETE: svy_material question_fi=" . $this->
getId());
535 $affectedRows =
$ilDB->manipulateF(
536 "DELETE FROM svy_material WHERE question_fi = %s",
538 array($this->
getId())
542 foreach ($this->material as $material) {
543 $next_id =
$ilDB->nextId(
'svy_material');
545 $this->log->debug(
"INSERT: svy_material question_fi=" . $this->
getId());
547 $affectedRows =
$ilDB->manipulateF(
548 "INSERT INTO svy_material " .
549 "(material_id, question_fi, internal_link, import_id, material_title, tstamp," .
550 "text_material, external_link, file_material, material_type) " .
551 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
552 array(
'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
'integer'),
554 $next_id, $this->
getId(), $material->internal_link, $material->import_id,
555 $material->title, time(), $material->text_material, $material->external_link,
556 $material->file_material, $material->type)
558 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $material->internal_link, $matches)) {
575 $next_id =
$ilDB->nextId(
'svy_question');
576 $affectedRows =
$ilDB->manipulateF(
577 "INSERT INTO svy_question (question_id, questiontype_fi, " .
578 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
579 "created, original_id, tstamp) VALUES " .
580 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
581 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
582 'text',
'text',
'integer',
'integer',
'integer'),
599 $this->log->debug(
"INSERT INTO svy_question question_id= " . $next_id .
" questiontype_fi= " . $this->
getQuestionTypeID());
601 $this->
setId($next_id);
603 return $this->
getId();
611 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
619 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
652 string $categorytext,
658 $result =
$ilDB->queryF(
659 "SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
660 array(
'text',
'text',
'integer'),
661 array($categorytext, $neutral,
$ilUser->getId())
666 if ($result->numRows()) {
667 while ($row =
$ilDB->fetchAssoc($result)) {
668 if (strcmp($row[
"title"], $categorytext) === 0) {
669 $returnvalue = $row[
"category_id"];
675 $next_id =
$ilDB->nextId(
'svy_category');
676 $affectedRows =
$ilDB->manipulateF(
677 "INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
678 array(
'integer',
'text',
'text',
'integer',
'integer'),
679 array($next_id, $categorytext, $neutral,
$ilUser->getId(), time())
682 $this->log->debug(
"INSERT INTO svy_category id=" . $next_id);
684 $returnvalue = $next_id;
696 $this->log->debug(
"DELETE FROM " . $this->getAdditionalTableName());
699 "DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
708 public function delete(
int $question_id):
void 711 $this->log->debug(
"Question Delete... " . $question_id);
712 if ($question_id < 1) {
716 $result =
$ilDB->queryF(
717 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
721 if ($result->numRows() === 1) {
722 $row =
$ilDB->fetchAssoc($result);
723 $obj_id = $row[
"obj_fi"];
728 $affectedRows =
$ilDB->manipulateF(
729 "DELETE FROM svy_answer WHERE question_fi = %s",
734 $affectedRows =
$ilDB->manipulateF(
735 "DELETE FROM svy_constraint WHERE question_fi = %s",
740 $result =
$ilDB->queryF(
741 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
745 while ($row =
$ilDB->fetchObject($result)) {
746 $affectedRows =
$ilDB->manipulateF(
747 "DELETE FROM svy_constraint WHERE constraint_id = %s",
749 array($row->constraint_fi)
753 $affectedRows =
$ilDB->manipulateF(
754 "DELETE FROM svy_qst_constraint WHERE question_fi = %s",
758 $affectedRows =
$ilDB->manipulateF(
759 "DELETE FROM svy_qblk_qst WHERE question_fi = %s",
763 $affectedRows =
$ilDB->manipulateF(
764 "DELETE FROM svy_svy_qst WHERE question_fi = %s",
768 $affectedRows =
$ilDB->manipulateF(
769 "DELETE FROM svy_variable WHERE question_fi = %s",
773 $affectedRows =
$ilDB->manipulateF(
774 "DELETE FROM svy_question WHERE question_id = %s",
781 $affectedRows =
$ilDB->manipulateF(
782 "DELETE FROM svy_material WHERE question_fi = %s",
787 $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);
791 $directory =
CLIENT_WEB_DIR .
"/survey/" . $obj_id .
"/$question_id";
792 if (preg_match(
"/\d+/", $obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory)) {
801 foreach (
$mobs as $mob) {
806 $this->log->debug(
"Call ilSurveySkill::handleQuestionDeletion, q id: " . $question_id .
807 ", obj id: " . $obj_id);
810 $this->log->debug(
"UPDATE svy_question");
813 $ilDB->manipulate(
"UPDATE svy_question" .
814 " SET original_id = NULL" .
815 " WHERE original_id = " .
$ilDB->quote($question_id,
"integer"));
825 $ilDB = $DIC->database();
827 if ($question_id < 1) {
831 $result =
$ilDB->queryF(
832 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
836 if ($result->numRows() === 1) {
838 return $data[
"type_tag"];
847 public static function _getTitle(
int $question_id): string
851 $ilDB = $DIC->database();
853 $result =
$ilDB->queryF(
854 "SELECT title FROM svy_question WHERE svy_question.question_id = %s",
860 return (
string)
$data[
"title"];
870 bool $a_return_question_id_if_no_original =
true 874 $ilDB = $DIC->database();
875 $result =
$ilDB->queryF(
876 "SELECT * FROM svy_question WHERE question_id = %s",
880 if ($result->numRows() > 0) {
881 $row =
$ilDB->fetchAssoc($result);
882 if ($row[
"original_id"] > 0) {
883 return (
int) $row[
"original_id"];
884 } elseif ($a_return_question_id_if_no_original) {
885 return (
int) $row[
"question_id"];
896 $id = $this->
getId();
906 $this->log->debug(
"DELETE FROM svy_material WHERE question_fi = " . $this->
getOriginalId());
908 $affectedRows =
$ilDB->manipulateF(
909 "DELETE FROM svy_material WHERE question_fi = %s",
914 if (strlen($this->material[
"internal_link"])) {
915 $next_id =
$ilDB->nextId(
'svy_material');
916 $affectedRows =
$ilDB->manipulateF(
917 "INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
918 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
919 array($next_id, $this->
getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"], time())
922 $this->log->debug(
"INSERT svy_material material_id=" . $next_id .
" question_fi=" . $this->
getOriginalId());
924 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
938 $result =
$ilDB->queryF(
939 "SELECT title FROM svy_phrase WHERE phrase_id = %s",
943 if ($row =
$ilDB->fetchAssoc($result)) {
944 return $row[
"title"];
957 $result =
$ilDB->queryF(
958 "SELECT phrase_id FROM svy_phrase WHERE title = %s AND owner_fi = %s",
959 array(
'text',
'integer'),
960 array($title,
$ilUser->getId())
962 return $result->numRows() > 0;
969 $ilDB = $DIC->database();
971 if ($question_id < 1) {
975 $result =
$ilDB->queryF(
976 "SELECT question_id FROM svy_question WHERE question_id = %s",
980 return $result->numRows() === 1;
983 public function addInternalLink(
string $material_id):
void 985 $material_title =
"";
986 if ($material_id !==
'') {
987 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
990 $material_title = $this->
lng->txt(
"obj_$type") .
": ";
994 $cont_obj = $cont_obj_gui->getObject();
995 $material_title .= $cont_obj->getTitle();
1002 $cont_obj = $cont_obj_gui->getObject();
1004 $material_title .= $pg_obj->getTitle();
1011 $cont_obj = $cont_obj_gui->getObject();
1013 $material_title .= $st_obj->getTitle();
1026 $mat->internal_link = $material_id;
1027 $mat->title = $material_title;
1038 foreach ($a_array as $idx) {
1039 unset($this->material[$idx]);
1041 $this->material = array_values($this->material);
1052 foreach ($this->materials as
$filename) {
1054 $materialspath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $materialspath);
1055 if (!file_exists($materialspath)) {
1058 if (!copy($materialspath_original . $filename, $materialspath . $filename)) {
1066 $this->material[] = $obj_material;
1074 public function setMaterial(
1075 string $material_id =
"",
1076 bool $is_import =
false,
1077 string $material_title =
"" 1079 if (strcmp($material_id,
"") !== 0) {
1082 $import_id = $material_id;
1083 $material_id = self::_resolveInternalLink($import_id);
1085 if (strcmp($material_title,
"") === 0) {
1086 if (preg_match(
"/il__(\w+)_(\d+)/", $material_id, $matches)) {
1087 $type = $matches[1];
1089 $material_title = $this->
lng->txt(
"obj_$type") .
": ";
1093 $cont_obj = $cont_obj_gui->getObject();
1094 $material_title .= $cont_obj->getTitle();
1101 $cont_obj = $cont_obj_gui->getObject();
1103 $material_title .= $pg_obj->getTitle();
1110 $cont_obj = $cont_obj_gui->getObject();
1112 $material_title .= $st_obj->getTitle();
1123 $this->material = array(
1124 "internal_link" => $material_id,
1125 "import_id" => $import_id,
1126 "title" => $material_title
1133 string $internal_link
1135 $resolved_link =
"";
1136 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
1137 switch ($matches[2]) {
1154 if (strcmp($resolved_link,
"") === 0) {
1155 $resolved_link = $internal_link;
1158 $resolved_link = $internal_link;
1160 return $resolved_link;
1168 $ilDB = $DIC->database();
1170 $result =
$ilDB->queryF(
1171 "SELECT * FROM svy_material WHERE question_fi = %s",
1175 if ($result->numRows()) {
1176 while ($row =
$ilDB->fetchAssoc($result)) {
1177 $internal_link = $row[
"internal_link"];
1178 $resolved_link = self::_resolveInternalLink($internal_link);
1179 if (strcmp($internal_link, $resolved_link) !== 0) {
1181 $affectedRows =
$ilDB->manipulateF(
1182 "UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
1183 array(
'text',
'integer',
'integer'),
1184 array($resolved_link, time(), $row[
"material_id"])
1190 if ($resolvedlinks) {
1196 $result =
$ilDB->queryF(
1197 "SELECT * FROM svy_material WHERE question_fi = %s",
1201 if ($result->numRows()) {
1202 while ($row =
$ilDB->fetchAssoc($result)) {
1203 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $row[
"internal_link"], $matches)) {
1212 string $target =
"",
1213 int $a_parent_ref_id = null
1216 "lm" =>
"LearningModule",
1217 "pg" =>
"PageObject",
1218 "st" =>
"StructureObject",
1219 "git" =>
"GlossaryItem",
1220 "mob" =>
"MediaObject" 1223 if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches)) {
1224 $type = $matches[1];
1226 switch ($linktypes[$matches[1]]) {
1227 case "StructureObject":
1229 case "GlossaryItem":
1230 case "LearningModule":
1236 ) .
"/ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[
$type] .
"&cmd=media&ref_id=" . $a_parent_ref_id .
"&mob_id=" .
$target_id;
1252 $ilDB = $DIC->database();
1254 if (($question_id < 1) || ($user_id < 1)) {
1258 $result =
$ilDB->queryF(
1259 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
1263 if ($result->numRows() === 1) {
1264 $row =
$ilDB->fetchAssoc($result);
1265 $qpl_object_id = $row[
"obj_fi"];
1275 $result =
$ilDB->queryF(
1276 "SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1280 if ($result->numRows() === 1) {
1281 $row =
$ilDB->fetchAssoc($result);
1282 return (
int) $row[
"questiontype_id"];
1298 string $question_type,
1301 $type = $question_type;
1304 } elseif ($gui === 2) {
1305 $type .=
"Evaluation";
1307 if (file_exists(
"./Modules/SurveyQuestionPool/Questions/class." .
$type .
".php")) {
1312 $component_factory = $DIC[
"component.factory"];
1313 foreach ($component_factory->getActivePluginsInSlot(
"svyq") as $pl) {
1314 if (strcmp($pl->getQuestionType(), $question_type) === 0) {
1331 if (file_exists(
"./Modules/SurveyQuestionPool/Questions/class." . $type_tag .
".php")) {
1332 $lng = $DIC->language();
1333 return $lng->
txt($type_tag);
1335 $component_factory = $DIC[
"component.factory"];
1336 foreach ($component_factory->getActivePluginsInSlot(
"svyq") as $pl) {
1337 if (strcmp($pl->getQuestionType(), $type_tag) === 0) {
1338 return $pl->getQuestionTypeTranslation();
1351 $question_type = self::_getQuestionType($question_id);
1352 if ($question_type) {
1353 self::_includeClass($question_type);
1354 $question =
new $question_type();
1355 $question->loadFromDb($question_id);
1367 $question_type = self::_getQuestionType($question_id);
1368 if ($question_type) {
1369 self::_includeClass($question_type, 1);
1370 $guitype = $question_type .
"GUI";
1371 $question =
new $guitype($question_id);
1379 array $a_finished_ids = null
1381 $question = self::_instanciateQuestion($question_id);
1382 if (is_null($a_finished_ids)) {
1383 $a_finished_ids = [];
1386 $question_type = self::_getQuestionType($question_id);
1387 self::_includeClass($question_type, 2);
1388 $class = $question_type .
"Evaluation";
1389 $ev =
new $class($question, $a_finished_ids);
1400 if (preg_match(
"/<[^>]*?>/", $a_text)) {
1418 if (strcmp($material[
"type"],
"mattext") === 0) {
1419 $result .= $material[
"material"]->getContent();
1421 if (strcmp($material[
"type"],
"matimage") === 0) {
1422 $matimage = $material[
"material"];
1423 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
1425 $this->import_manager->addMob(
1426 $matimage->getLabel(),
1441 bool $close_material_tag =
true,
1442 bool $add_mobs =
true,
1443 ?array $a_attrs = null
1447 "type" =>
"text/plain" 1449 if ($this->
isHTML($a_material)) {
1450 $attrs[
"type"] =
"text/xhtml";
1452 if (is_array($a_attrs)) {
1453 $attrs = array_merge($attrs, $a_attrs);
1459 foreach (
$mobs as $mob) {
1462 "label" =>
"il_" .
IL_INST_ID .
"_mob_" . $mob,
1463 "uri" =>
"objects/" .
"il_" .
IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1464 "type" =>
"spl:html",
1465 "id" => $this->
getId()
1467 $a_xml_writer->
xmlElement(
"matimage", $imgattrs, null);
1470 if ($close_material_tag) {
1480 bool $prepare_for_latex_output =
false 1614 public function __get(
string $value): ?string
1618 if (array_key_exists($value, $this->arrData)) {
1619 return (
string) $this->arrData[$value];
1630 $this->arrData[
$key] = $value;
1645 $ilDB = $DIC->database();
1647 $ilDB->manipulate(
"UPDATE svy_question" .
1648 " SET original_id = " .
$ilDB->quote($a_original_id,
"integer") .
"," .
1649 " obj_fi = " .
$ilDB->quote($a_object_id,
"integer") .
1650 " WHERE question_id = " .
$ilDB->quote($a_question_id,
"integer"));
1654 bool $a_group_by_survey =
false 1658 $set =
$ilDB->query(
"SELECT q.question_id,s.obj_fi" .
1659 " FROM svy_question q" .
1660 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)" .
1661 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)" .
1662 " WHERE original_id = " .
$ilDB->quote($this->getId(),
"integer"));
1664 while ($row =
$ilDB->fetchAssoc($set)) {
1665 if (!$a_group_by_survey) {
1666 $res[] = (
int) $row[
"question_id"];
1668 $res[$row[
"obj_fi"]][] = (
int) $row[
"question_id"];
1684 $ilDB = $DIC->database();
1686 $set =
$ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst" .
1687 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)" .
1688 " WHERE svy_svy_qst.question_fi = " .
$ilDB->quote($a_question_id,
"integer"));
1689 $row =
$ilDB->fetchAssoc($set);
1690 if (
$ilDB->numRows($set)) {
1691 return (
int) $row[
"obj_fi"];
1701 $ilDB = $DIC->database();
1703 $set =
$ilDB->query(
1704 "SELECT obj_fi FROM svy_question " .
1705 " WHERE question_id = " .
$ilDB->quote($a_qid,
"integer")
1707 if ($rec =
$ilDB->fetchAssoc($set)) {
1708 return (
int) $rec[
"obj_fi"];
1720 if ($str !== $a_str) {
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setQuestiontext(string $questiontext="")
addMaterials(string $materials_file, string $materials_name="")
saveCompletionStatus(int $original_id=0)
Saves the complete flag to the database.
deleteMaterial(string $materials_name="")
QTIMaterialToString(ilQTIMaterial $a_material)
Reads an QTI material tag an creates a text string.
setMaterialsfile(string $materials_filename, string $materials_tempfilename="", string $materials_name="")
Uploads and adds a material.
setSubtype(int $a_subtype)
getPreconditionSelectValue(string $default, string $title, string $variable)
Creates a form property for the precondition value.
loadFromDb(int $question_id)
load question data into object note: this base implementation only loads the material data ...
copyXHTMLMediaObjectsOfQuestion(int $a_q_id)
Copy media object usages from other question.
static getLogger(string $a_component_id)
Get component logger.
saveToDb(int $original_id=0)
Saves a SurveyQuestion object to a database.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getPhrase(int $phrase_id)
Returns a phrase title for phrase id.
setObligatory(bool $obligatory=true)
getMaterialsPath()
Returns the materials path for web accessible materials of a question.
setOriginalId(?int $original_id)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
deleteAdditionalTableData(int $question_id)
Deletes datasets from the additional question table in the database.
addMaterial(ilSurveyMaterial $obj_material)
getMaterialsPathWeb()
Returns the web image path for web accessable images of a question.
static _changeOriginalId(int $a_question_id, int $a_original_id, int $a_object_id)
Change original id of existing question in db.
flushMaterials()
Deletes all materials uris.
getQuestionDataArray(int $id)
Returns the question data.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
duplicateMaterials(int $question_id)
Duplicates the materials of a question.
setComplete(bool $a_complete)
usableForPrecondition()
Returns if the question is usable for preconditions.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getTitle(int $question_id)
Returns the question title of a question with a given id.
static _cleanupMediaObjectUsage(string $a_text, string $a_usage_type, int $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
saveCategoryToDb(string $categorytext, int $neutral=0)
Saves a category to the database.
getMaterial(int $a_index)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static handleQuestionDeletion(int $a_question_id, int $a_obj_id)
Remove question skill assignment.
stripSlashesAddSpaceFallback(string $a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
__construct(string $title="", string $description="", string $author="", string $questiontext="", int $owner=-1)
ILIAS SurveyQuestionPool Export ImportSessionRepository $import_manager
getPreconditionOptions()
Returns the options for preconditions.
static _isWriteable(int $object_id)
Returns true, if the question pool is writeable for the current user.
static removeTrailingPathSeparators(string $path)
static _saveLink(string $a_source_type, int $a_source_id, string $a_target_type, int $a_target_id, int $a_target_inst=0, string $a_source_lang="-")
save internal link information
static _isWriteable(int $question_id, int $user_id)
is question writeable by a certain user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _instanciateQuestionEvaluation(int $question_id, array $a_finished_ids=null)
xmlEndTag(string $tag)
Writes an endtag.
__set(string $key, string $value)
setOrientation(int $orientation=0)
static _isComplete(int $question_id)
Checks whether the question is complete or not.
setAuthor(string $author="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMaterialTag(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true, ?array $a_attrs=null)
Creates an XML material tag from a plain text or xhtml text.
getCopyIds(bool $a_group_by_survey=false)
getImagePathWeb()
Returns the web image path for web accessible images of a question.
static _deleteAllLinksOfSource(string $a_source_type, int $a_source_id, string $a_lang="-")
Delete all links of a given source.
importResponses(array $a_data)
Import response data from the question import file.
static _resolveInternalLink(string $internal_link)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static lookupObjFi(int $a_qid)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)
static _lookGlossaryTerm(int $term_id)
get glossary term
static _getIdForImportId(string $a_type, string $a_target)
Get current id for an import id.
static getMaxSumScore(int $survey_id)
Get max sum score for specific survey (and this question type)
static _resolveIntLinks(int $question_id)
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
phraseExists(string $title)
Returns true if the phrase title already exists for the current user(!)
static _getOriginalId(int $question_id, bool $a_return_question_id_if_no_original=true)
Returns the original id of a question.
getAvailableRelations()
Returns the available relations for the question.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
ILIAS SurveyQuestionPool Editing EditSessionRepository $edit_manager
copyObject(int $target_questionpool, string $title="")
setTitle(string $title="")
prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false)
Prepares string for a text area output in surveys.
static _lookupSurveyObjId(int $a_question_id)
getImagePath()
Returns the image path for web accessible images of a question.
duplicate(bool $for_survey=true, string $title="", string $author="", int $owner=0, int $a_survey_id=0)
importAdditionalMetadata(array $a_meta)
Import additional meta data from the question import file.
questionTitleExists(string $title, int $questionpool_object=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteMaterials(array $a_array)
Class ilObjContentObjectGUI.
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _getInternalLinkHref(string $target="", int $a_parent_ref_id=null)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
static _instanciateQuestionGUI(int $question_id)
Get question gui object.
getObjId()
Get the reference(?) id of the container object.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
setDescription(string $description="")
getWorkingDataFromUserInput(array $post_data)
Creates the user data of the svy_answer table from the POST data.
static _instanciateQuestion(int $question_id)
Get question object.
importAdjectives(array $a_data)
Import bipolar adjectives from the question import file.
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
setObjId(int $obj_id=0)
Set the reference(?) id of the container object.
importMatrix(array $a_data)
Import matrix rows from the question import file.
createNewQuestion()
Creates a new question with a 0 timestamp when a new question is created This assures that an ID is g...
static _questionExists(int $question_id)
getPreconditionValueOutput(string $value)
Returns the output for a precondition value.