148 $this->
user = $DIC->user();
149 $this->db =
$DIC->database();
155 $this->bipolar_adjective1 =
"";
156 $this->bipolar_adjective2 =
"";
157 $this->rowSeparators = 0;
158 $this->columnSeparators = 0;
159 $this->neutralColumnSeparator = 1;
171 return $this->columns->getCategoryCount();
183 $this->columns->removeCategory(
$index);
195 $this->columns->removeCategories($array);
207 $this->columns->removeCategoryWithName(
$name);
228 return $this->columns->getCategory(
$index);
233 return $this->columns->getCategoryForScale($scale);
245 return $this->columns->getCategoryIndex(
$name);
257 $this->columns->flushCategories();
268 return $this->rows->getCategoryCount();
276 public function addRow($a_text, $a_other, $a_label)
278 $this->rows->addCategory($a_text, $a_other, 0, $a_label);
289 $this->rows->addCategoryAtPosition($a_text, $a_position, $a_other);
311 return $this->rows->getCategory($a_index);
316 $this->rows->moveCategoryUp(
$index);
321 $this->rows->moveCategoryDown(
$index);
333 $this->rows->removeCategories($array);
343 $this->rows->removeCategory(
$index);
357 return (strlen($this->bipolar_adjective2)) ? $this->bipolar_adjective2 :
null;
361 return (strlen($this->bipolar_adjective1)) ? $this->bipolar_adjective1 :
null;
378 $this->bipolar_adjective2 = $a_value;
382 $this->bipolar_adjective1 = $a_value;
399 "SELECT svy_category.* FROM svy_category, svy_phrase_cat WHERE svy_phrase_cat.category_fi = svy_category.category_id AND svy_phrase_cat.phrase_fi = %s AND (svy_category.owner_fi = %s OR svy_category.owner_fi = %s) ORDER BY svy_phrase_cat.sequence",
400 array(
'integer',
'integer',
'integer'),
401 array($phrase_id, 0,
$ilUser->getId())
404 $neutral = $row[
"neutral"];
405 if (($row[
"defaultvalue"] == 1) && ($row[
"owner_fi"] == 0)) {
406 $this->columns->addCategory($this->lng->txt($row[
"title"]), 0, $neutral);
408 $this->columns->addCategory($row[
"title"], 0, $neutral);
454 $this->label =
$data[
'label'];
482 "SELECT svy_variable.*, svy_category.title, svy_category.neutral FROM svy_variable, svy_category WHERE svy_variable.question_fi = %s AND svy_variable.category_fi = svy_category.category_id ORDER BY sequence ASC",
493 "SELECT * FROM svy_qst_matrixrows WHERE question_fi = %s ORDER BY sequence",
498 $this->
addRow($row[
"title"], $row[
'other'], $row[
'label']);
501 parent::loadFromDb(
$id);
530 public function saveToDb($original_id =
null, $withanswers =
true)
534 $affectedRows = parent::saveToDb($original_id);
536 if ($affectedRows == 1) {
537 $affectedRows =
$ilDB->manipulateF(
540 array($this->
getId())
542 $affectedRows =
$ilDB->manipulateF(
544 question_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,
545 legend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,
546 column_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)
547 VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
549 'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
550 'text',
'text',
'text',
'text',
'text',
'text',
'text',
'text',
'integer'
586 $affectedRows =
$ilDB->manipulateF(
587 "UPDATE " . $this->
getAdditionalTableName() .
" SET bipolar_adjective1 = %s, bipolar_adjective2 = %s WHERE question_fi = %s",
588 array(
'text',
'text',
'integer'),
589 array((strlen($adjective1)) ? $adjective1 :
null, (strlen($adjective2)) ? $adjective2 :
null, $this->
getId())
607 "SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
608 array(
'text',
'text',
'integer'),
609 array($columntext, $neutral,
$ilUser->getId())
616 if (strcmp($row[
"title"], $columntext) == 0) {
617 $returnvalue = $row[
"category_id"];
625 $next_id =
$ilDB->nextId(
'svy_category');
626 $affectedRows =
$ilDB->manipulateF(
627 "INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
628 array(
'integer',
'text',
'text',
'integer',
'text',
'integer'),
629 array($next_id, $columntext, 0,
$ilUser->getId(), $neutral, time())
631 $returnvalue = $next_id;
641 $question_id = $this->
getId();
642 if (strlen($original_id)) {
643 $question_id = $original_id;
647 $affectedRows =
$ilDB->manipulateF(
648 "DELETE FROM svy_variable WHERE question_fi = %s",
656 $next_id =
$ilDB->nextId(
'svy_variable');
657 $affectedRows =
$ilDB->manipulateF(
658 "INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, other, sequence, scale, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
659 array(
'integer',
'integer',
'integer',
'float',
'integer',
'integer',
'integer',
'integer'),
660 array($next_id, $column_id, $question_id, (
$i + 1), $cat->other,
$i, ($cat->scale > 0) ? $cat->scale :
null, time())
671 $question_id = $this->
getId();
672 if (strlen($original_id)) {
673 $question_id = $original_id;
677 $affectedRows =
$ilDB->manipulateF(
678 "DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
685 $next_id =
$ilDB->nextId(
'svy_qst_matrixrows');
686 $affectedRows =
$ilDB->manipulateF(
687 "INSERT INTO svy_qst_matrixrows (id_svy_qst_matrixrows, title, label, other, sequence, question_fi) VALUES (%s, %s, %s, %s, %s, %s)",
688 array(
'integer',
'text',
'text',
'integer',
'integer',
'integer'),
689 array($next_id, $row->title, $row->label, ($row->other) ? 1 : 0,
$i, $question_id)
701 public function toXML($a_include_header =
true, $obligatory_state =
"")
705 $this->
insertXML($a_xml_writer, $a_include_header, $obligatory_state);
706 $xml = $a_xml_writer->xmlDumpMem(
false);
707 if (!$a_include_header) {
708 $pos = strpos(
$xml,
"?>");
721 public function insertXML(&$a_xml_writer, $a_include_header =
true)
724 "id" => $this->
getId(),
726 "type" => $this->getQuestiontype(),
730 $a_xml_writer->xmlStartTag(
"question", $attrs);
732 $a_xml_writer->xmlElement(
"description",
null, $this->
getDescription());
733 $a_xml_writer->xmlElement(
"author",
null, $this->
getAuthor());
734 $a_xml_writer->xmlStartTag(
"questiontext");
736 $a_xml_writer->xmlEndTag(
"questiontext");
738 $a_xml_writer->xmlStartTag(
"matrix");
739 $a_xml_writer->xmlStartTag(
"matrixrows");
744 if (strlen($this->
getRow(
$i)->label)) {
745 $attrs[
'label'] = $this->
getRow(
$i)->label;
750 $a_xml_writer->xmlStartTag(
"matrixrow", $attrs);
752 $a_xml_writer->xmlEndTag(
"matrixrow");
754 $a_xml_writer->xmlEndTag(
"matrixrows");
756 $a_xml_writer->xmlStartTag(
"responses");
758 $a_xml_writer->xmlStartTag(
"bipolar_adjectives");
767 $a_xml_writer->xmlEndTag(
"bipolar_adjectives");
774 $attrs[
'label'] =
'neutral';
778 $a_xml_writer->xmlStartTag(
"response_single", $attrs);
781 $a_xml_writer->xmlStartTag(
"response_multiple", $attrs);
787 $a_xml_writer->xmlEndTag(
"response_single");
790 $a_xml_writer->xmlEndTag(
"response_multiple");
795 $a_xml_writer->xmlEndTag(
"responses");
796 $a_xml_writer->xmlEndTag(
"matrix");
798 if (count($this->material)) {
799 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches)) {
801 "label" => $this->material[
"title"]
803 $a_xml_writer->xmlStartTag(
"material", $attrs);
804 $intlink =
"il_" .
IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
805 if (strcmp($matches[1],
"") != 0) {
806 $intlink = $this->material[
"internal_link"];
808 $a_xml_writer->xmlElement(
"mattext",
null, $intlink);
809 $a_xml_writer->xmlEndTag(
"material");
813 $a_xml_writer->xmlStartTag(
"metadata");
814 $a_xml_writer->xmlStartTag(
"metadatafield");
815 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"column_separators");
817 $a_xml_writer->xmlEndTag(
"metadatafield");
819 $a_xml_writer->xmlStartTag(
"metadatafield");
820 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"row_separators");
822 $a_xml_writer->xmlEndTag(
"metadatafield");
824 $a_xml_writer->xmlStartTag(
"metadatafield");
825 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"neutral_column_separator");
827 $a_xml_writer->xmlEndTag(
"metadatafield");
829 $a_xml_writer->xmlStartTag(
"metadatafield");
830 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"layout");
831 $a_xml_writer->xmlElement(
"fieldentry",
null, serialize($this->
getLayout()));
832 $a_xml_writer->xmlEndTag(
"metadatafield");
834 $a_xml_writer->xmlEndTag(
"metadata");
836 $a_xml_writer->xmlEndTag(
"question");
842 parent::syncWithOriginal();
858 for (
$i = $lower_limit;
$i <= $upper_limit;
$i++) {
859 $this->columns->addCategory(
$i);
875 $next_id =
$ilDB->nextId(
'svy_phrase');
876 $affectedRows =
$ilDB->manipulateF(
877 "INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
878 array(
'integer',
'text',
'text',
'integer',
'integer'),
881 $phrase_id = $next_id;
885 $next_id =
$ilDB->nextId(
'svy_category');
886 $affectedRows =
$ilDB->manipulateF(
887 "INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
888 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
891 $category_id = $next_id;
892 $next_id =
$ilDB->nextId(
'svy_phrase_cat');
893 $affectedRows =
$ilDB->manipulateF(
894 "INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence, other, scale) VALUES (%s, %s, %s, %s, %s, %s)",
895 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
896 array($next_id, $phrase_id, $category_id, $counter, (
$data[
'other']) ? 1 : 0,
$data[
'scale'])
910 return "SurveyMatrixQuestion";
921 return "svy_qst_matrix";
933 foreach ($post_data as $key => $value) {
936 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
937 if (is_array($value)) {
938 foreach ($value as $val) {
939 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
942 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
947 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
948 if (is_array($value)) {
949 foreach ($value as $val) {
950 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
953 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
979 foreach ($post_data as $key => $value) {
980 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
981 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0) {
982 return $this->lng->txt(
"question_mr_no_other_answer");
988 return $this->lng->txt(
"matrix_question_radio_button_not_checked");
993 foreach ($post_data as $key => $value) {
994 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
995 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0) {
996 return $this->lng->txt(
"question_mr_no_other_answer");
999 if ((!is_array($value)) || (count($value) < 1)) {
1000 return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1005 return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1016 $answer_data = array();
1021 foreach ($post_data as $key => $value) {
1022 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
1023 if (strlen($value)) {
1024 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data))
1027 $answer_data[] = array(
"value" => $value,
1028 "textanswer" => $other_value,
1029 "rowvalue" => $matches[1]);
1036 foreach ($post_data as $key => $value) {
1037 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches)) {
1038 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data))
1041 foreach ($value as $checked) {
1042 $answer_data[] = array(
"value" => $checked,
1043 "textanswer" => $other_value,
1044 "rowvalue" => $matches[1]);
1052 return $answer_data;
1056 if (
sizeof($answer_data)) {
1058 foreach ($answer_data as $item) {
1059 $next_id =
$ilDB->nextId(
'svy_answer');
1062 $fields[
'answer_id'] = array(
"integer", $next_id);
1063 $fields[
'question_fi'] = array(
"integer", $this->
getId());
1064 $fields[
'active_fi'] = array(
"integer", $active_id);
1065 $fields[
'value'] = array(
"float", $item[
'value']);
1066 $fields[
'textanswer'] = array(
"clob", $item[
'textanswer']);
1067 $fields[
'rowvalue'] = array(
"integer", $item[
'rowvalue']);
1068 $fields[
'tstamp'] = array(
"integer", time());
1070 $affectedRows =
$ilDB->insert(
"svy_answer", $fields);
1083 parent::deleteAdditionalTableData($question_id);
1086 $affectedRows =
$ilDB->manipulateF(
1087 "DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1112 switch ($a_subtype) {
1119 $this->subtype = $a_subtype;
1138 $this->columnSeparators = 1;
1142 $this->columnSeparators = 0;
1155 return ($this->columnSeparators) ? 1 : 0;
1168 $this->rowSeparators = 1;
1172 $this->rowSeparators = 0;
1185 return ($this->rowSeparators) ? 1 : 0;
1198 $this->neutralColumnSeparator = 1;
1202 $this->neutralColumnSeparator = 0;
1215 return ($this->neutralColumnSeparator) ? 1 : 0;
1228 foreach ($a_meta as $key => $value) {
1229 switch ($value[
"label"]) {
1230 case "column_separators":
1233 case "row_separators":
1239 case "neutral_column_separator":
1255 foreach ($a_data as $adjective) {
1256 if (is_numeric($adjective[
"label"])) {
1273 foreach ($a_data as $row) {
1274 $this->
addRow($row[
'title'], $row[
'other'], $row[
'label']);
1286 foreach ($a_data as
$id =>
$data) {
1291 $this->columns->addCategory($column,
null, (strcmp(
$data[
"label"],
"neutral") == 0) ?
true :
false);
1328 $step3->setOptions($options);
1329 $step3->setValue($default);
1342 public function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
1347 "percent_row" => $percent_row,
1348 "percent_columns" => $percent_columns,
1349 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
1350 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
1351 "percent_neutral" => $percent_neutral
1353 $affectedRows =
$ilDB->manipulateF(
1355 array(
'text',
'integer'),
1362 if (!is_array($this->layout) || count($this->layout) == 0) {
1364 $this->layout = array(
1365 "percent_row" => 30,
1366 "percent_columns" => 40,
1367 "percent_bipolar_adjective1" => 10,
1368 "percent_bipolar_adjective2" => 10,
1369 "percent_neutral" => 10
1372 $this->layout = array(
1373 "percent_row" => 30,
1374 "percent_columns" => 50,
1375 "percent_bipolar_adjective1" => 10,
1376 "percent_bipolar_adjective2" => 10,
1377 "percent_neutral" => 0
1380 $this->layout = array(
1381 "percent_row" => 30,
1382 "percent_columns" => 50,
1383 "percent_bipolar_adjective1" => 0,
1384 "percent_bipolar_adjective2" => 0,
1385 "percent_neutral" => 20
1388 $this->layout = array(
1389 "percent_row" => 30,
1390 "percent_columns" => 70,
1391 "percent_bipolar_adjective1" => 0,
1392 "percent_bipolar_adjective2" => 0,
1393 "percent_neutral" => 0
1405 $this->layout = unserialize(
$layout);
1432 if ($column->neutral && strlen($column->title)) {
1446 $this->columnPlaceholders = ($a_value) ? 1 : 0;
1456 return ($this->columnPlaceholders) ? 1 : 0;
1466 $this->legend = ($a_value) ? 1 : 0;
1476 return ($this->legend) ? 1 : 0;
1481 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
1486 return ($this->singleLineRowCaption) ? 1 : 0;
1491 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
1496 return ($this->repeatColumnHeader) ? 1 : 0;
1501 $this->columnHeaderPosition = $a_value;
1506 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
1511 $this->randomRows = ($a_value) ? 1 : 0;
1516 return ($this->randomRows) ? 1 : 0;
1521 $this->columnOrder = $a_value;
1526 return ($this->columnOrder) ? $this->columnOrder : 0;
1531 $this->columnImages = ($a_value) ? 1 : 0;
1536 return ($this->columnImages) ? 1 : 0;
1541 $this->rowImages = ($a_value) ? 1 : 0;
1546 return ($this->rowImages) ? 1 : 0;
1565 "SELECT MAX(scale) max_sum_score, q.question_id FROM svy_svy_qst sq " .
1566 "JOIN svy_question q ON (sq.question_fi = q.question_id) " .
1567 "JOIN svy_variable v ON (v.question_fi = q.question_id) " .
1568 "WHERE sq.survey_fi = %s AND q.questiontype_fi = %s " .
1569 "GROUP BY (q.question_id)",
1570 [
"integer",
"integer"],
1574 while ($rec =
$db->fetchAssoc($set)) {
1575 $max_score[$rec[
"question_id"]] = $rec[
"max_sum_score"];
1579 "SELECT COUNT(mr.id_svy_qst_matrixrows) cnt_rows, q.question_id FROM svy_svy_qst sq " .
1580 "JOIN svy_question q ON (sq.question_fi = q.question_id) " .
1581 "JOIN svy_qst_matrixrows mr ON (mr.question_fi = q.question_id) " .
1582 "WHERE sq.survey_fi = %s AND q.questiontype_fi = %s " .
1583 "GROUP BY (q.question_id)",
1584 [
"integer",
"integer"],
1588 while ($rec =
$db->fetchAssoc($set)) {
1589 $cnt_rows[$rec[
"question_id"]] = $rec[
"cnt_rows"];
1593 foreach ($max_score as $qid => $s) {
1594 $sum_sum_score += $s * $cnt_rows[$qid];
1597 return $sum_sum_score;
An exception for terminatinating execution or to throw for unit testing.
The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix quest...
hasNeutralColumn()
Returns TRUE if a neutral column exists.
addRow($a_text, $a_other, $a_label)
Adds a row to the question.
addStandardNumbers($lower_limit, $upper_limit)
Adds standard numbers as columns.
setSubtype($a_subtype=0)
Sets the subtype of the matrix question.
__construct($title="", $description="", $author="", $questiontext="", $owner=-1)
SurveyMatrixQuestion constructor The constructor takes possible arguments an creates an instance of t...
getAdditionalTableName()
Returns the name of the additional question data table in the database.
saveColumnsToDb($original_id="")
setRowSeparators($enable=0)
Enables/Disables separators for the matrix rows.
setBipolarAdjective($a_index, $a_value)
Sets one of the bipolar adjectives.
importMatrix($a_data)
Import matrix rows from the question import file.
removeRow($index)
Removes a row.
importAdjectives($a_data)
Import bipolar adjectives from the question import file.
saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1="", $percent_bipolar_adjective2="", $percent_neutral)
Saves the layout of a matrix question.
saveRowsToDb($original_id="")
getColumnIndex($name)
Returns the index of a column with a given name.
removeRows($array)
Removes rows from the question.
setRandomRows($a_value=0)
getQuestionDataArray($id)
Returns the question data fields from the database.
flushRows()
Empties the row list.
getBipolarAdjective($a_index)
Returns one of the bipolar adjectives.
saveUserInput($post_data, $active_id, $a_return=false)
setColumnHeaderPosition($a_value)
removeColumnWithName($name)
Removes a column from the list of columns.
setColumnSeparators($enable=0)
Enables/Disables separators for the matrix columns.
getSubtype()
Returns the subtype of the matrix question.
savePhrase($title)
Saves a set of columns to a default phrase.
getNeutralColumnSeparator()
Gets the separator enable state for the neutral column.
getLegend()
Get whether the legend should be shown or not.
saveColumnToDb($columntext, $neutral=0)
Saves a column to the database.
setColumnImages($a_value=0)
saveToDb($original_id=null, $withanswers=true)
Saves a SurveyMatrixQuestion object to a database.
& getWorkingDataFromUserInput($post_data)
Creates the user data of the svy_answer table from the POST data.
setSingleLineRowCaption($a_value=0)
getQuestionType()
Returns the question type of the question.
getColumn($index)
Returns the name of a column for a given index.
flushColumns()
Empties the columns list.
usableForPrecondition()
Returns if the question is usable for preconditions.
checkUserInput($post_data, $survey_id)
Checks the input of the active user for obligatory status and entered values.
setNeutralColumnSeparator($enable=0)
Enables/Disables a separator for the neutral column.
addPhrase($phrase_id)
Adds a phrase to the question.
importAdditionalMetadata($a_meta)
Import additional meta data from the question import file.
setColumnPlaceholders($a_value=0)
Set whether placeholders should be used for the column titles or not.
getColumnHeaderPosition()
getColumnSeparators()
Gets the separators enable state for the matrix columns.
getSingleLineRowCaption()
setLegend($a_value=0)
Set whether the legend should be shown or not.
removeColumn($index)
Removes a column from the list of columns.
removeColumns($array)
Removes many columns from the list of columns.
toXML($a_include_header=true, $obligatory_state="")
Returns an xml representation of the question.
getColumnPlaceholders()
Get whether placeholders should be used for the column titles or not.
saveBipolarAdjectives($adjective1, $adjective2)
getColumnCount()
Returns the number of columns.
hasBipolarAdjectives()
Returns TRUE if bipolar adjectives exist.
getPreconditionValueOutput($value)
Returns the output for a precondition value.
loadFromDb($id)
Loads a SurveyMatrixQuestion object from the database.
insertXML(&$a_xml_writer, $a_include_header=true)
Adds the question XML to a given XMLWriter object.
getRow($a_index)
Returns a specific row.
setRepeatColumnHeader($a_value=0)
importResponses($a_data)
Import response data from the question import file.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
getPreconditionSelectValue($default="", $title, $variable)
Creates a form property for the precondition value.
getColumnForScale($scale)
getRowCount()
Returns the number of rows in the question.
static getMaxSumScore(int $survey_id)
@inheritDoc
addRowAtPosition($a_text, $a_other, $a_position)
Adds a row at a given position.
getColumns()
Return the columns.
getRowSeparators()
Gets the separators enable state for the matrix rows.
isComplete()
Returns 1 if the question is complete for use.
Basic class for all survey question types.
setQuestiontext($questiontext="")
Sets the questiontext of the SurveyQuestion object.
setId($id=-1)
Sets the id of the SurveyQuestion object.
setAuthor($author="")
Sets the authors name of the SurveyQuestion object.
stripSlashesAddSpaceFallback($a_str)
Strip slashes with add space fallback, see https://mantis.ilias.de/view.php?id=19727 and https://mant...
getDescription()
Gets the description string of the SurveyQuestion object.
getId()
Gets the id of the SurveyQuestion object.
setDescription($description="")
Sets the description string of the SurveyQuestion object.
setObjId($obj_id=0)
Set the reference id of the container object.
getAuthor()
Gets the authors name of the SurveyQuestion object.
setOriginalId($original_id)
getQuestiontext()
Gets the questiontext of the SurveyQuestion object.
getObligatory($survey_id="")
Gets the obligatory state of the question.
getTitle()
Gets the title string of the SurveyQuestion object.
setComplete($a_complete)
Sets the complete state of the question.
getPreconditionOptions()
Returns the options for preconditions.
saveMaterial()
save material to db
setOwner($owner="")
Sets the creator/owner ID of the SurveyQuestion object.
setTitle($title="")
Sets the title string of the SurveyQuestion object.
saveCompletionStatus($original_id="")
Saves the complete flag to the database.
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.
setObligatory($obligatory=1)
Sets the obligatory state of the question.
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...
xmlHeader()
Writes xml header @access public.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc