28 protected \ILIAS\SurveyQuestionPool\Editing\EditSessionRepository
$edit_manager;
49 protected \ILIAS\SurveyQuestionPool\Export\ImportSessionRepository
$import_manager;
60 $this->
user = $DIC->user();
61 $this->db =
$DIC->database();
63 $ilUser =
$DIC->user();
70 $this->author =
$author ?: $ilUser->getFullname();
71 $this->cumulated = array();
73 if ($this->owner === -1) {
74 $this->owner = $ilUser->getId();
77 $this->survey_id = -1;
78 $this->obligatory = 1;
79 $this->orientation = 0;
80 $this->materials = array();
81 $this->material = array();
82 $this->arrData = array();
85 $this->import_manager =
$DIC->surveyQuestionPool()
90 $this->edit_manager =
$DIC->surveyQuestionPool()
98 $this->complete = $a_complete;
108 int $questionpool_object = 0
113 if ($questionpool_object > 0) {
116 $ilDB->quote($questionpool_object,
'integer')
119 $result =
$ilDB->queryF(
120 "SELECT question_id FROM svy_question WHERE title = %s$refwhere",
124 return $result->numRows() > 0;
129 $this->title = $title;
134 $this->obligatory = $obligatory;
139 $this->orientation = $orientation;
149 $this->survey_id =
$id;
154 $this->description = $description;
158 string $materials_file,
159 string $materials_name =
""
161 if (empty($materials_name)) {
162 $materials_name = $materials_file;
164 if ((!empty($materials_name)) && (!array_key_exists($materials_name, $this->materials))) {
165 $this->materials[$materials_name] = $materials_file;
173 string $materials_filename,
174 string $materials_tempfilename =
"",
175 string $materials_name =
""
177 if (!empty($materials_filename)) {
178 $materialspath = $this->getMaterialsPath();
179 if (!file_exists($materialspath)) {
183 $materials_tempfilename,
185 $materialspath . $materials_filename
187 print
"image not uploaded!!!! ";
189 $this->addMaterials($materials_filename, $materials_name);
195 string $materials_name =
""
197 foreach ($this->materials as $key => $value) {
198 if (strcmp($key, $materials_name) === 0) {
199 if (file_exists($this->getMaterialsPath() . $value)) {
200 unlink($this->getMaterialsPath() . $value);
202 unset($this->materials[$key]);
213 $this->materials = array();
218 $this->author = $author ?: $this->
user->getFullname();
223 $this->questiontext = $questiontext;
231 $this->owner = $owner;
251 return $this->obligatory;
256 return $this->survey_id;
264 switch ($this->orientation) {
270 $this->orientation = 0;
273 return $this->orientation;
279 return $this->description;
284 return $this->author;
294 return $this->questiontext;
302 return $this->obj_id;
310 $this->obj_id = $obj_id;
314 bool $for_survey =
true,
326 $original_id = $this->
getId();
328 if ($a_survey_id > 0) {
329 $clone->setObjId($a_survey_id);
332 $clone->setTitle($title);
335 $clone->setAuthor($author);
338 $clone->setOwner($owner);
341 $clone->saveToDb($original_id);
346 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
347 return $clone->getId();
351 int $target_questionpool,
359 $original_id = self::_getOriginalId($this->
getId(),
false);
361 $source_questionpool = $this->getObjId();
362 $clone->setObjId($target_questionpool);
364 $clone->setTitle($title);
370 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
371 return $clone->getId();
381 foreach ($mobs as $mob) {
392 $this->material = [];
404 $result =
$ilDB->queryF(
405 "SELECT complete FROM svy_question WHERE question_id = %s",
409 if ($result->numRows()) {
410 $row =
$ilDB->fetchAssoc($result);
411 if ((
int) $row[
"complete"] === 1) {
426 $question_id = $this->
getId();
427 if ($original_id > 0) {
428 $question_id = $original_id;
431 if ($this->
getId() > 0) {
432 $this->log->debug(
"UPDATE svy_question question_id=" . $question_id);
435 $affectedRows =
$ilDB->manipulateF(
436 "UPDATE svy_question SET complete = %s, tstamp = %s WHERE question_id = %s",
437 array(
'text',
'integer',
'integer'),
438 array($this->isComplete(), time(), $question_id)
453 if ($this->
getId() === -1) {
455 $next_id =
$ilDB->nextId(
'svy_question');
456 $affectedRows =
$ilDB->insert(
"svy_question", array(
457 "question_id" => array(
"integer", $next_id),
458 "questiontype_fi" => array(
"integer", $this->getQuestionTypeID()),
459 "obj_fi" => array(
"integer", $this->getObjId()),
460 "owner_fi" => array(
"integer", $this->getOwner()),
461 "title" => array(
"text", $this->
getTitle()),
462 "label" => array(
"text", (strlen($this->label ??
"")) ? $this->label :
null),
463 "description" => array(
"text", $this->getDescription()),
464 "author" => array(
"text", $this->getAuthor()),
466 "obligatory" => array(
"text", $this->getObligatory()),
467 "complete" => array(
"text", $this->isComplete()),
468 "created" => array(
"integer", time()),
469 "original_id" => array(
"integer", ($original_id) ?:
null),
470 "tstamp" => array(
"integer", time())
475 $this->setId($next_id);
478 $affectedRows =
$ilDB->update(
"svy_question", array(
479 "title" => array(
"text", $this->
getTitle()),
480 "label" => array(
"text", (strlen($this->label ??
"")) ? $this->label :
null),
481 "description" => array(
"text", $this->getDescription()),
482 "author" => array(
"text", $this->getAuthor()),
484 "obligatory" => array(
"text", $this->getObligatory()),
485 "complete" => array(
"text", $this->isComplete()),
486 "tstamp" => array(
"integer", time())
488 "question_id" => array(
"integer", $this->
getId())
491 $this->log->debug(
"UPDATE svy_question id=" . $this->
getId() .
" SET: title=" . $this->
getTitle() .
" ...");
493 return $affectedRows;
505 $obj_id = $this->getObjId();
507 $next_id =
$ilDB->nextId(
'svy_question');
508 $affectedRows =
$ilDB->manipulateF(
509 "INSERT INTO svy_question (question_id, questiontype_fi, " .
510 "obj_fi, owner_fi, title, description, author, questiontext, obligatory, complete, " .
511 "created, original_id, tstamp) VALUES " .
512 "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
513 array(
'integer',
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text',
514 'text',
'text',
'integer',
'integer',
'integer'),
517 $this->getQuestionTypeID(),
531 $this->log->debug(
"INSERT INTO svy_question question_id= " . $next_id .
" questiontype_fi= " . $this->getQuestionTypeID());
533 $this->setId($next_id);
535 return $this->
getId();
543 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/images/";
551 return CLIENT_WEB_DIR .
"/survey/$this->obj_id/$this->id/materials/";
584 string $categorytext,
587 $ilUser = $this->
user;
590 $result =
$ilDB->queryF(
591 "SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
592 array(
'text',
'text',
'integer'),
593 array($categorytext, $neutral, $ilUser->getId())
598 if ($result->numRows()) {
599 while ($row =
$ilDB->fetchAssoc($result)) {
600 if (strcmp($row[
"title"], $categorytext) === 0) {
601 $returnvalue = $row[
"category_id"];
607 $next_id =
$ilDB->nextId(
'svy_category');
608 $affectedRows =
$ilDB->manipulateF(
609 "INSERT INTO svy_category (category_id, title, neutral, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
610 array(
'integer',
'text',
'text',
'integer',
'integer'),
611 array($next_id, $categorytext, $neutral, $ilUser->getId(), time())
614 $this->log->debug(
"INSERT INTO svy_category id=" . $next_id);
616 $returnvalue = $next_id;
628 $this->log->debug(
"DELETE FROM " . $this->getAdditionalTableName());
631 "DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
640 public function delete(
int $question_id):
void
643 $this->log->debug(
"Question Delete... " . $question_id);
644 if ($question_id < 1) {
648 $result =
$ilDB->queryF(
649 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
653 if ($result->numRows() === 1) {
654 $row =
$ilDB->fetchAssoc($result);
655 $obj_id = $row[
"obj_fi"];
660 $affectedRows =
$ilDB->manipulateF(
661 "DELETE FROM svy_answer WHERE question_fi = %s",
666 $affectedRows =
$ilDB->manipulateF(
667 "DELETE FROM svy_constraint WHERE question_fi = %s",
672 $result =
$ilDB->queryF(
673 "SELECT constraint_fi FROM svy_qst_constraint WHERE question_fi = %s",
677 while ($row =
$ilDB->fetchObject($result)) {
678 $affectedRows =
$ilDB->manipulateF(
679 "DELETE FROM svy_constraint WHERE constraint_id = %s",
681 array($row->constraint_fi)
685 $affectedRows =
$ilDB->manipulateF(
686 "DELETE FROM svy_qst_constraint WHERE question_fi = %s",
690 $affectedRows =
$ilDB->manipulateF(
691 "DELETE FROM svy_qblk_qst WHERE question_fi = %s",
695 $affectedRows =
$ilDB->manipulateF(
696 "DELETE FROM svy_svy_qst WHERE question_fi = %s",
700 $affectedRows =
$ilDB->manipulateF(
701 "DELETE FROM svy_variable WHERE question_fi = %s",
705 $affectedRows =
$ilDB->manipulateF(
706 "DELETE FROM svy_question WHERE question_id = %s",
711 $this->deleteAdditionalTableData($question_id);
713 $affectedRows =
$ilDB->manipulateF(
714 "DELETE FROM svy_material WHERE question_fi = %s",
719 $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);
723 $directory =
CLIENT_WEB_DIR .
"/survey/" . $obj_id .
"/$question_id";
724 if (preg_match(
"/\d+/", $obj_id) and preg_match(
"/\d+/", $question_id) and is_dir($directory)) {
733 foreach ($mobs as $mob) {
738 $this->log->debug(
"Call ilSurveySkill::handleQuestionDeletion, q id: " . $question_id .
739 ", obj id: " . $obj_id);
742 $this->log->debug(
"UPDATE svy_question");
745 $ilDB->manipulate(
"UPDATE svy_question" .
746 " SET original_id = NULL" .
747 " WHERE original_id = " .
$ilDB->quote($question_id,
"integer"));
759 if ($question_id < 1) {
763 $result =
$ilDB->queryF(
764 "SELECT type_tag FROM svy_question, svy_qtype WHERE svy_question.question_id = %s AND svy_question.questiontype_fi = svy_qtype.questiontype_id",
768 if ($result->numRows() === 1) {
770 return $data[
"type_tag"];
779 public static function _getTitle(
int $question_id): string
785 $result =
$ilDB->queryF(
786 "SELECT title FROM svy_question WHERE svy_question.question_id = %s",
792 return (
string)
$data[
"title"];
802 bool $a_return_question_id_if_no_original =
true
807 $result =
$ilDB->queryF(
808 "SELECT * FROM svy_question WHERE question_id = %s",
812 if ($result->numRows() > 0) {
813 $row =
$ilDB->fetchAssoc($result);
814 if ($row[
"original_id"] > 0) {
815 return (
int) $row[
"original_id"];
816 } elseif ($a_return_question_id_if_no_original) {
817 return (
int) $row[
"question_id"];
827 if ($this->getOriginalId()) {
829 $original = $this->getOriginalId();
831 $this->setId($this->getOriginalId());
832 $this->setOriginalId(
null);
836 $this->setOriginalId($original);
838 $this->log->debug(
"DELETE FROM svy_material WHERE question_fi = " . $this->getOriginalId());
840 $affectedRows =
$ilDB->manipulateF(
841 "DELETE FROM svy_material WHERE question_fi = %s",
843 array($this->getOriginalId())
846 if (strlen($this->material[
"internal_link"] ??
"")) {
847 $next_id =
$ilDB->nextId(
'svy_material');
848 $affectedRows =
$ilDB->manipulateF(
849 "INSERT INTO svy_material (material_id, question_fi, internal_link, import_id, material_title, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
850 array(
'integer',
'integer',
'text',
'text',
'text',
'integer'),
851 array($next_id, $this->getOriginalId(), $this->material[
"internal_link"], $this->material[
"import_id"], $this->material[
"title"], time())
854 $this->log->debug(
"INSERT svy_material material_id=" . $next_id .
" question_fi=" . $this->getOriginalId());
856 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
869 if ($question_id < 1) {
873 $result =
$ilDB->queryF(
874 "SELECT question_id FROM svy_question WHERE question_id = %s",
878 return $result->numRows() === 1;
883 string $internal_link
886 if (preg_match(
"/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
887 switch ($matches[2]) {
904 if (strcmp($resolved_link,
"") === 0) {
905 $resolved_link = $internal_link;
908 $resolved_link = $internal_link;
910 return $resolved_link;
920 $result =
$ilDB->queryF(
921 "SELECT * FROM svy_material WHERE question_fi = %s",
925 if ($result->numRows()) {
926 while ($row =
$ilDB->fetchAssoc($result)) {
927 $internal_link = $row[
"internal_link"];
928 $resolved_link = self::_resolveInternalLink($internal_link);
929 if (strcmp($internal_link, $resolved_link) !== 0) {
931 $affectedRows =
$ilDB->manipulateF(
932 "UPDATE svy_material SET internal_link = %s, tstamp = %s WHERE material_id = %s",
933 array(
'text',
'integer',
'integer'),
934 array($resolved_link, time(), $row[
"material_id"])
940 if ($resolvedlinks) {
946 $result =
$ilDB->queryF(
947 "SELECT * FROM svy_material WHERE question_fi = %s",
951 if ($result->numRows()) {
952 while ($row =
$ilDB->fetchAssoc($result)) {
953 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $row[
"internal_link"], $matches)) {
963 ?
int $a_parent_ref_id =
null
966 "lm" =>
"LearningModule",
967 "pg" =>
"PageObject",
968 "st" =>
"StructureObject",
969 "git" =>
"GlossaryItem",
970 "mob" =>
"MediaObject"
973 if (preg_match(
"/il__(\w+)_(\d+)/", $target, $matches)) {
975 $target_id = $matches[2];
976 switch ($linktypes[$matches[1]]) {
977 case "StructureObject":
980 case "LearningModule":
986 ) .
"/ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] .
"&cmd=media&ref_id=" . $a_parent_ref_id .
"&mob_id=" . $target_id;
1004 if (($question_id < 1) || (
$user_id < 1)) {
1008 $result =
$ilDB->queryF(
1009 "SELECT obj_fi FROM svy_question WHERE question_id = %s",
1013 if ($result->numRows() === 1) {
1014 $row =
$ilDB->fetchAssoc($result);
1015 $qpl_object_id = $row[
"obj_fi"];
1025 $result =
$ilDB->queryF(
1026 "SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
1028 array($this->getQuestionType())
1030 if ($result->numRows() === 1) {
1031 $row =
$ilDB->fetchAssoc($result);
1032 return (
int) $row[
"questiontype_id"];
1048 string $question_type,
1051 $type = $question_type;
1054 } elseif ($gui === 2) {
1055 $type .=
"Evaluation";
1057 if (file_exists(
"./components/ILIAS/SurveyQuestionPool/Questions/class." . $type .
".php")) {
1072 return $lng->txt($type_tag);
1081 $question_type = self::_getQuestionType($question_id);
1082 if ($question_type) {
1083 self::_includeClass($question_type);
1084 $question =
new $question_type();
1085 $question->loadFromDb($question_id);
1097 $question_type = self::_getQuestionType($question_id);
1098 if ($question_type) {
1099 self::_includeClass($question_type, 1);
1100 $guitype = $question_type .
"GUI";
1101 $question =
new $guitype($question_id);
1109 ?array $a_finished_ids =
null
1111 $question = self::_instanciateQuestion($question_id);
1112 if (is_null($a_finished_ids)) {
1113 $a_finished_ids = [];
1116 $question_type = self::_getQuestionType($question_id);
1117 self::_includeClass($question_type, 2);
1118 $class = $question_type .
"Evaluation";
1119 $ev =
new $class($question, $a_finished_ids);
1130 if (preg_match(
"/<[^>]*?>/", $a_text)) {
1148 if (strcmp($material[
"type"],
"mattext") === 0) {
1149 $result .= $material[
"material"]->getContent();
1151 if (strcmp($material[
"type"],
"matimage") === 0) {
1152 $matimage = $material[
"material"];
1153 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
1155 $this->import_manager->addMob(
1156 $matimage->getLabel(),
1171 bool $close_material_tag =
true,
1172 bool $add_mobs =
true,
1173 ?array $a_attrs =
null
1175 $a_xml_writer->xmlStartTag(
"material");
1177 "type" =>
"text/plain"
1179 if ($this->isHTML($a_material)) {
1180 $attrs[
"type"] =
"text/xhtml";
1182 if (is_array($a_attrs)) {
1183 $attrs = array_merge($attrs, $a_attrs);
1189 foreach ($mobs as $mob) {
1192 "label" =>
"il_" .
IL_INST_ID .
"_mob_" . $mob,
1193 "uri" =>
"objects/" .
"il_" .
IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle(),
1194 "type" =>
"spl:html",
1195 "id" => $this->getId()
1197 $a_xml_writer->
xmlElement(
"matimage", $imgattrs,
null);
1200 if ($close_material_tag) {
1210 bool $prepare_for_latex_output =
false
1320 $this->original_id = $original_id;
1325 return $this->original_id;
1330 return $this->material;
1344 public function __get(
string $value): ?string
1348 if (array_key_exists($value, $this->arrData)) {
1349 return (
string) $this->arrData[$value];
1356 public function __set(
string $key,
string $value): void
1360 $this->arrData[$key] = $value;
1377 $ilDB->manipulate(
"UPDATE svy_question" .
1378 " SET original_id = " .
$ilDB->quote($a_original_id,
"integer") .
"," .
1379 " obj_fi = " .
$ilDB->quote($a_object_id,
"integer") .
1380 " WHERE question_id = " .
$ilDB->quote($a_question_id,
"integer"));
1384 bool $a_group_by_survey =
false
1388 $set =
$ilDB->query(
"SELECT q.question_id,s.obj_fi" .
1389 " FROM svy_question q" .
1390 " JOIN svy_svy_qst sq ON (sq.question_fi = q.question_id)" .
1391 " JOIN svy_svy s ON (s.survey_id = sq.survey_fi)" .
1392 " WHERE original_id = " .
$ilDB->quote($this->getId(),
"integer"));
1394 while ($row =
$ilDB->fetchAssoc($set)) {
1395 if (!$a_group_by_survey) {
1396 $res[] = (
int) $row[
"question_id"];
1398 $res[$row[
"obj_fi"]][] = (
int) $row[
"question_id"];
1406 return (
bool) count($this->getCopyIds());
1416 $set =
$ilDB->query(
"SELECT svy_svy.obj_fi FROM svy_svy_qst" .
1417 " JOIN svy_svy ON (svy_svy.survey_id = svy_svy_qst.survey_fi)" .
1418 " WHERE svy_svy_qst.question_fi = " .
$ilDB->quote($a_question_id,
"integer"));
1419 $row =
$ilDB->fetchAssoc($set);
1420 if (
$ilDB->numRows($set)) {
1421 return (
int) $row[
"obj_fi"];
1433 $set =
$ilDB->query(
1434 "SELECT obj_fi FROM svy_question " .
1435 " WHERE question_id = " .
$ilDB->quote($a_qid,
"integer")
1437 if ($rec =
$ilDB->fetchAssoc($set)) {
1438 return (
int) $rec[
"obj_fi"];
1450 if ($str !== $a_str) {
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importMatrix(array $a_data)
Import matrix rows from the question import file.
static getMaxSumScore(int $survey_id)
Get max sum score for specific survey (and this question type)
static _getTitle(int $question_id)
Returns the question title of a question with a given id.
copyObject(int $target_questionpool, string $title="")
ILIAS SurveyQuestionPool Editing EditSessionRepository $edit_manager
static _getOriginalId(int $question_id, bool $a_return_question_id_if_no_original=true)
Returns the original id of a question.
getCopyIds(bool $a_group_by_survey=false)
getQuestionDataArray(int $id)
Returns the question data.
stripSlashesAddSpaceFallback(string $a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
getObjId()
Get the reference(?) id of the container object.
setTitle(string $title="")
ILIAS SurveyQuestionPool Export ImportSessionRepository $import_manager
copyXHTMLMediaObjectsOfQuestion(int $a_q_id)
Copy media object usages from other question.
deleteAdditionalTableData(int $question_id)
Deletes datasets from the additional question table in the database.
static _resolveIntLinks(int $question_id)
static _resolveInternalLink(string $internal_link)
loadFromDb(int $question_id)
load question data into object note: this base implementation only loads the material data
static _instanciateQuestionEvaluation(int $question_id, ?array $a_finished_ids=null)
static _lookupSurveyObjId(int $a_question_id)
createNewQuestion()
Creates a new question with a 0 timestamp when a new question is created This assures that an ID is g...
setMaterialsfile(string $materials_filename, string $materials_tempfilename="", string $materials_name="")
Uploads and adds a material.
QTIMaterialToString(ilQTIMaterial $a_material)
Reads an QTI material tag an creates a text string.
getMaterialsPath()
Returns the materials path for web accessible materials of a question.
duplicate(bool $for_survey=true, string $title="", string $author="", int $owner=0, int $a_survey_id=0)
getPreconditionSelectValue(string $default, string $title, string $variable)
Creates a form property for the precondition value.
importResponses(array $a_data)
Import response data from the question import file.
getWorkingDataFromUserInput(array $post_data)
Creates the user data of the svy_answer table from the POST data.
getMaterialsPathWeb()
Returns the web image path for web accessable images of a question.
getImagePath()
Returns the image path for web accessible images of a question.
static _getInternalLinkHref(string $target="", ?int $a_parent_ref_id=null)
saveCategoryToDb(string $categorytext, int $neutral=0)
Saves a category to the database.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
deleteMaterial(string $materials_name="")
__set(string $key, string $value)
importAdditionalMetadata(array $a_meta)
Import additional meta data from the question import file.
setQuestiontext(string $questiontext="")
setSubtype(int $a_subtype)
setDescription(string $description="")
static _isWriteable(int $question_id, int $user_id)
is question writeable by a certain user
static _includeClass(string $question_type, int $gui=0)
Include the php class file for a given question type.
getPreconditionOptions()
Returns the options for preconditions.
static _changeOriginalId(int $a_question_id, int $a_original_id, int $a_object_id)
Change original id of existing question in db.
saveToDb(int $original_id=0)
Saves a SurveyQuestion object to a database.
static lookupObjFi(int $a_qid)
setObjId(int $obj_id=0)
Set the reference(?) id of the container object.
setOrientation(int $orientation=0)
static _questionExists(int $question_id)
static _getQuestionType(int $question_id)
Returns the question type of a question with a given id.
__construct(string $title="", string $description="", string $author="", string $questiontext="", int $owner=-1)
static _instanciateQuestion(int $question_id)
Get question object.
getAvailableRelations()
Returns the available relations for the question.
addMaterials(string $materials_file, string $materials_name="")
setComplete(bool $a_complete)
setOriginalId(?int $original_id)
static _instanciateQuestionGUI(int $question_id)
Get question gui object.
usableForPrecondition()
Returns if the question is usable for preconditions.
getPreconditionValueOutput(string $value)
Returns the output for a precondition value.
flushMaterials()
Deletes all materials uris.
prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false)
Prepares string for a text area output in surveys.
static _isComplete(int $question_id)
Checks whether the question is complete or not.
saveCompletionStatus(int $original_id=0)
Saves the complete flag to the database.
setObligatory(bool $obligatory=true)
getImagePathWeb()
Returns the web image path for web accessible images of a question.
setAuthor(string $author="")
importAdjectives(array $a_data)
Import bipolar adjectives from the question import file.
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.
questionTitleExists(string $title, int $questionpool_object=0)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static removeTrailingPathSeparators(string $path)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _deleteAllLinksOfSource(string $a_source_type, int $a_source_id, string $a_lang="-")
Delete all links of a given source.
static _getIdForImportId(string $a_type, string $a_target)
Get current id for an import id.
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 _getIdForImportId(string $a_import_id)
get current object id for import id (static)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
static _isWriteable(int $object_id)
Returns true, if the question pool is writeable for the current user.
getMaterial(int $a_index)
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.
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...
static handleQuestionDeletion(int $a_question_id, int $a_obj_id)
Remove question skill assignment.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))