24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
168 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
171 $this->bipolar_adjective1 =
"";
172 $this->bipolar_adjective2 =
"";
173 $this->rowSeparators = 0;
174 $this->columnSeparators = 0;
175 $this->neutralColumnSeparator = 1;
187 return $this->columns->getCategoryCount();
199 $this->columns->removeCategory($index);
211 $this->columns->removeCategories($array);
223 $this->columns->removeCategoryWithName($name);
244 return $this->columns->getCategory($index);
249 return $this->columns->getCategoryForScale($scale);
261 return $this->columns->getCategoryIndex($name);
273 $this->columns->flushCategories();
284 return $this->rows->getCategoryCount();
292 function addRow($a_text, $a_other, $a_label)
294 $this->rows->addCategory($a_text, $a_other, 0, $a_label);
305 $this->rows->addCategoryAtPosition($a_text, $a_position, $a_other);
327 return $this->rows->getCategory($a_index);
332 $this->rows->moveCategoryUp($index);
337 $this->rows->moveCategoryDown($index);
349 $this->rows->removeCategories($array);
359 $this->rows->removeCategory($index);
374 return (strlen($this->bipolar_adjective2)) ? $this->bipolar_adjective2 : NULL;
378 return (strlen($this->bipolar_adjective1)) ? $this->bipolar_adjective1 : NULL;
396 $this->bipolar_adjective2 = $a_value;
400 $this->bipolar_adjective1 = $a_value;
416 $result = $ilDB->queryF(
"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",
417 array(
'integer',
'integer',
'integer'),
418 array($phrase_id, 0, $ilUser->getId())
422 $neutral =
$row[
"neutral"];
423 if ((
$row[
"defaultvalue"] == 1) && (
$row[
"owner_fi"] == 0))
425 $this->columns->addCategory($this->lng->txt(
$row[
"title"]), 0, $neutral);
429 $this->columns->addCategory(
$row[
"title"], 0, $neutral);
451 return $ilDB->fetchAssoc(
$result);
474 $data = $ilDB->fetchAssoc(
$result);
475 $this->
setId($data[
"question_id"]);
477 $this->label = $data[
'label'];
482 include_once(
"./Services/RTE/classes/class.ilRTE.php");
505 $result = $ilDB->queryF(
"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",
511 while ($data = $ilDB->fetchAssoc(
$result))
513 $this->columns->addCategory($data[
"title"], $data[
"other"], $data[
"neutral"], null, ($data[
'scale']) ? $data[
'scale'] : ($data[
'sequence'] + 1));
517 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_matrixrows WHERE question_fi = %s ORDER BY sequence",
558 function saveToDb($original_id = NULL, $withanswers =
true)
564 if ($affectedRows == 1)
566 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
568 array($this->
getId())
571 question_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,
572 legend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,
573 column_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)
574 VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
576 'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
577 'text',
'text',
'text',
'text',
'text',
'text',
'text',
'text',
'integer'
613 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET bipolar_adjective1 = %s, bipolar_adjective2 = %s WHERE question_fi = %s",
614 array(
'text',
'text',
'integer'),
615 array((strlen($adjective1)) ? $adjective1 : NULL, (strlen($adjective2)) ? $adjective2 : NULL, $this->
getId())
631 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
632 array(
'text',
'text',
'integer'),
633 array($columntext, $neutral, $ilUser->getId())
642 if (strcmp(
$row[
"title"], $columntext) == 0)
644 $returnvalue =
$row[
"category_id"];
655 $next_id = $ilDB->nextId(
'svy_category');
656 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
657 array(
'integer',
'text',
'text',
'integer',
'text',
'integer'),
658 array($next_id, $columntext, 0, $ilUser->getId(), $neutral, time())
660 $returnvalue = $next_id;
670 $question_id = $this->
getId();
671 if (strlen($original_id))
673 $question_id = $original_id;
677 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
686 $next_id = $ilDB->nextId(
'svy_variable');
687 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, other, sequence, scale, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
688 array(
'integer',
'integer',
'integer',
'float',
'integer',
'integer',
'integer',
'integer'),
689 array($next_id, $column_id, $question_id, ($i + 1), $cat->other, $i, ($cat->scale > 0) ? $cat->scale : null, time())
700 $question_id = $this->
getId();
701 if (strlen($original_id))
703 $question_id = $original_id;
707 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
715 $next_id = $ilDB->nextId(
'svy_qst_matrixrows');
716 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_matrixrows (id_svy_qst_matrixrows, title, label, other, sequence, question_fi) VALUES (%s, %s, %s, %s, %s, %s)",
717 array(
'integer',
'text',
'text',
'integer',
'integer',
'integer'),
718 array($next_id,
$row->title,
$row->label, (
$row->other) ? 1 : 0, $i, $question_id)
730 function toXML($a_include_header = TRUE, $obligatory_state =
"")
732 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
735 $this->
insertXML($a_xml_writer, $a_include_header, $obligatory_state);
736 $xml = $a_xml_writer->xmlDumpMem(FALSE);
737 if (!$a_include_header)
739 $pos = strpos($xml,
"?>");
740 $xml = substr($xml, $pos + 2);
753 function insertXML(&$a_xml_writer, $a_include_header = TRUE, $obligatory_state =
"")
756 "id" => $this->
getId(),
758 "type" => $this->getQuestiontype(),
762 $a_xml_writer->xmlStartTag(
"question", $attrs);
764 $a_xml_writer->xmlElement(
"description", NULL, $this->
getDescription());
765 $a_xml_writer->xmlElement(
"author", NULL, $this->
getAuthor());
766 $a_xml_writer->xmlStartTag(
"questiontext");
768 $a_xml_writer->xmlEndTag(
"questiontext");
770 $a_xml_writer->xmlStartTag(
"matrix");
771 $a_xml_writer->xmlStartTag(
"matrixrows");
777 if (strlen($this->
getRow($i)->label))
779 $attrs[
'label'] = $this->
getRow($i)->label;
781 if ($this->
getRow($i)->other)
785 $a_xml_writer->xmlStartTag(
"matrixrow", $attrs);
787 $a_xml_writer->xmlEndTag(
"matrixrow");
789 $a_xml_writer->xmlEndTag(
"matrixrows");
791 $a_xml_writer->xmlStartTag(
"responses");
794 $a_xml_writer->xmlStartTag(
"bipolar_adjectives");
803 $a_xml_writer->xmlEndTag(
"bipolar_adjectives");
812 $attrs[
'label'] =
'neutral';
817 $a_xml_writer->xmlStartTag(
"response_single", $attrs);
820 $a_xml_writer->xmlStartTag(
"response_multiple", $attrs);
827 $a_xml_writer->xmlEndTag(
"response_single");
830 $a_xml_writer->xmlEndTag(
"response_multiple");
835 $a_xml_writer->xmlEndTag(
"responses");
836 $a_xml_writer->xmlEndTag(
"matrix");
838 if (count($this->material))
840 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
843 "label" => $this->material[
"title"]
845 $a_xml_writer->xmlStartTag(
"material", $attrs);
846 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
847 if (strcmp($matches[1],
"") != 0)
849 $intlink = $this->material[
"internal_link"];
851 $a_xml_writer->xmlElement(
"mattext", NULL, $intlink);
852 $a_xml_writer->xmlEndTag(
"material");
856 $a_xml_writer->xmlStartTag(
"metadata");
857 $a_xml_writer->xmlStartTag(
"metadatafield");
858 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"column_separators");
860 $a_xml_writer->xmlEndTag(
"metadatafield");
862 $a_xml_writer->xmlStartTag(
"metadatafield");
863 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"row_separators");
865 $a_xml_writer->xmlEndTag(
"metadatafield");
867 $a_xml_writer->xmlStartTag(
"metadatafield");
868 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"neutral_column_separator");
870 $a_xml_writer->xmlEndTag(
"metadatafield");
872 $a_xml_writer->xmlStartTag(
"metadatafield");
873 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"layout");
874 $a_xml_writer->xmlElement(
"fieldentry", NULL, serialize($this->
getLayout()));
875 $a_xml_writer->xmlEndTag(
"metadatafield");
877 $a_xml_writer->xmlEndTag(
"metadata");
879 $a_xml_writer->xmlEndTag(
"question");
902 for ($i = $lower_limit; $i <= $upper_limit; $i++)
904 $this->columns->addCategory($i);
920 $next_id = $ilDB->nextId(
'svy_phrase');
921 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
922 array(
'integer',
'text',
'text',
'integer',
'integer'),
923 array($next_id,
$title, 1, $ilUser->getId(), time())
925 $phrase_id = $next_id;
928 foreach (
$_SESSION[
'save_phrase_data'] as $data)
930 $next_id = $ilDB->nextId(
'svy_category');
931 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
932 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
933 array($next_id, $data[
'answer'], 1, $ilUser->getId(), time(), $data[
'neutral'])
935 $category_id = $next_id;
936 $next_id = $ilDB->nextId(
'svy_phrase_cat');
937 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence, other, scale) VALUES (%s, %s, %s, %s, %s, %s)",
938 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
939 array($next_id, $phrase_id, $category_id, $counter, ($data[
'other']) ? 1 : 0, $data[
'scale'])
953 return "SurveyMatrixQuestion";
964 return "svy_qst_matrix";
976 foreach ($post_data as $key => $value)
981 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
983 if (is_array($value))
985 foreach ($value as $val)
987 array_push($data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
992 array_push($data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
997 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
999 if (is_array($value))
1001 foreach ($value as $val)
1003 array_push($data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
1008 array_push($data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
1033 foreach ($post_data as $key => $value)
1035 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1037 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0)
1039 return $this->lng->txt(
"question_mr_no_other_answer");
1044 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_radio_button_not_checked");
1048 foreach ($post_data as $key => $value)
1050 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1052 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0)
1054 return $this->lng->txt(
"question_mr_no_other_answer");
1057 if ((!is_array($value)) || (count($value) < 1))
1059 return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1063 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1080 if ($this->getSubType() == 1)
1083 for ($i = 0; $i < $columncount; $i++)
1087 $next_id = $ilDB->nextId(
'svy_answer');
1088 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1089 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1090 array($next_id, $this->
getId(), $active_id, $i, NULL,
$row, time())
1098 $category = rand(0, $columncount-1);
1099 $next_id = $ilDB->nextId(
'svy_answer');
1100 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1101 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1102 array($next_id, $this->
getId(), $active_id, $category, NULL,
$row, time())
1114 $return_data = array();
1119 foreach ($post_data as $key => $value)
1121 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1123 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1126 $next_id = $ilDB->nextId(
'svy_answer');
1127 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1128 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1129 array($next_id, $this->
getId(), $active_id, $value, $other_value, $matches[1], time())
1134 $return_data[] = array(
"value"=>$value,
1135 "textanswer"=>$other_value,
1136 "rowvalue"=>$matches[1]);
1142 foreach ($post_data as $key => $value)
1144 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1146 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1147 foreach ($value as $checked)
1149 if (strlen($checked))
1153 $next_id = $ilDB->nextId(
'svy_answer');
1154 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, rowvalue, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1155 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1156 array($next_id, $this->
getId(), $active_id, $checked, $other_value, $matches[1], time())
1161 $return_data[] = array(
"value"=>$checked,
1162 "textanswer"=>$other_value,
1163 "rowvalue"=>$matches[1]);
1173 return $return_data;
1188 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1205 $sql =
"SELECT svy_answer.active_fi, svy_answer.question_fi".
1207 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1208 " WHERE svy_answer.question_fi = ".$ilDB->quote($this->
getId(),
"integer").
1209 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1212 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1219 $found[
$row[
"active_fi"].$row[
"question_fi"]] = 1;
1221 return count($found);
1236 $question_id = $this->
getId();
1238 $result_array = array();
1241 $sql =
"SELECT svy_answer.* FROM svy_answer".
1242 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1243 " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id,
"integer").
1244 " AND svy_answer.rowvalue = ".$ilDB->quote($rowindex,
"integer").
1245 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1248 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1261 if ($row[
"textanswer"])
1263 $result_array[
"textanswers"][$row[
"value"]][] = $row[
"textanswer"];
1267 if (is_array($result_array[
"textanswers"]))
1269 ksort($result_array[
"textanswers"], SORT_NUMERIC);
1275 $numrows =
$result->numRows();
1287 $result_array[
"MODE"] = $prefix . $cat->title;
1288 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1294 $scale = $cat->scale-1;
1299 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1302 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1310 for ($i = 0; $i < $key; $i++)
1312 array_push($median, $value+1);
1319 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1320 if (round($median_value) != $median_value)
1324 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1329 $median_value = $median[((
$total+1)/2)-1];
1336 $result_array[
"ARITHMETIC_MEAN"] =
"";
1337 $result_array[
"MEDIAN"] = $median_value;
1338 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1339 $result_array[
"ROW"] = $this->
getRow($rowindex)->title;
1340 return $result_array;
1354 $question_id = $this->
getId();
1356 $result_array = array();
1359 $sql =
"SELECT svy_answer.* FROM svy_answer".
1360 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1361 " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id,
"integer").
1362 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1365 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1381 $numrows =
$result->numRows();
1393 $result_array[
"MODE"] = $prefix . $cat->title;
1394 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1400 $scale = $cat->scale-1;
1405 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1408 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1416 for ($i = 0; $i < $key; $i++)
1418 array_push($median, $value+1);
1425 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1426 if (round($median_value) != $median_value)
1430 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1435 $median_value = $median[((
$total+1)/2)-1];
1442 $result_array[
"ARITHMETIC_MEAN"] =
"";
1443 $result_array[
"MEDIAN"] = $median_value;
1444 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1446 $cumulated_results = array();
1447 $cumulated_results[
"TOTAL"] = $result_array;
1451 $cumulated_results[$i] = $rowresult;
1453 return $cumulated_results;
1469 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1471 switch ($export_label)
1490 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1492 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1498 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1502 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1505 switch ($export_label)
1514 foreach ($eval_data as $evalkey => $evalvalue)
1516 if (is_numeric($evalkey))
1519 $worksheet->write(
$row, 3+$add, $evalvalue[
"USERS_ANSWERED"]);
1520 $worksheet->write(
$row, 4+$add, $evalvalue[
"USERS_SKIPPED"]);
1523 $worksheet->write(
$row, 7+$add, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1525 $worksheet->write(
$row, 9+$add, $evalvalue[
"ARITHMETIC_MEAN"]);
1546 foreach ($eval_data as $evalkey => $evalvalue)
1549 if (is_numeric($evalkey))
1551 array_push($csvrow,
"");
1552 array_push($csvrow, $evalvalue[
"ROW"]);
1553 array_push($csvrow,
"");
1557 switch ($export_label)
1560 array_push($csvrow, $this->label);
1563 array_push($csvrow, $this->
getTitle());
1566 array_push($csvrow, $this->
getTitle());
1567 array_push($csvrow, $this->label);
1571 array_push($csvrow, $this->lng->txt($evalvalue[
"QUESTION_TYPE"]));
1573 array_push($csvrow, $evalvalue[
"USERS_ANSWERED"]);
1574 array_push($csvrow, $evalvalue[
"USERS_SKIPPED"]);
1575 array_push($csvrow, $evalvalue[
"MODE"]);
1576 array_push($csvrow, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1577 array_push($csvrow, $evalvalue[
"MEDIAN"]);
1578 array_push($csvrow, $evalvalue[
"ARITHMETIC_MEAN"]);
1595 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1596 $worksheet =& $workbook->addWorksheet();
1598 switch ($export_label)
1624 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1627 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1630 preg_match(
"/(.*?)\s+-\s+(.*)/", $eval_data[
"TOTAL"][
"MODE"], $matches);
1645 foreach ($eval_data[
"TOTAL"][
"variables"] as $key => $value)
1648 $worksheet->write($rowcounter, 2, $key+1);
1653 foreach ($eval_data as $evalkey => $evalvalue)
1655 if (is_numeric($evalkey))
1660 $worksheet->write($rowcounter + 1, 1, $evalvalue[
"USERS_ANSWERED"]);
1662 $worksheet->write($rowcounter + 2, 1, $evalvalue[
"USERS_SKIPPED"]);
1663 $rowcounter = $rowcounter + 3;
1665 preg_match(
"/(.*?)\s+-\s+(.*)/", $evalvalue[
"MODE"], $matches);
1680 foreach ($evalvalue[
"variables"] as $key => $value)
1683 $worksheet->write($rowcounter, 2, $key+1);
1689 if (is_array($evalvalue[
"textanswers"]))
1695 foreach ($evalvalue[
"textanswers"] as $key => $answers)
1697 $title = $evalvalue[
"variables"][$key][
"title"];
1698 foreach ($answers as $answer)
1708 $format_center =& $workbook->addFormat();
1709 $format_center->setColor(
'black');
1710 $format_center->setAlign(
'center');
1716 $worksheet->write($rowcounter, $counter,
"", $format_title);
1717 foreach ($eval_data[
"TOTAL"][
"variables"] as $variable)
1724 foreach ($eval_data as $index => $data)
1726 if (is_numeric($index))
1730 foreach ($data[
"variables"] as $vardata)
1732 $worksheet->write($rowcounter, $counter, $vardata[
"selected"], $format_center);
1770 array_push($a_array,
$title);
1774 if(!$a_use_label || $a_substitute)
1776 array_push($a_array,
$title.
' - '. $this->lng->txt(
'other'));
1780 array_push($a_array,
"");
1792 if(!$a_use_label || $a_substitute)
1794 array_push($a_array, ($index+1) .
" - " . $col->title);
1798 array_push($a_array,
"");
1815 if (count($resultset[
"answers"][$this->
getId()]))
1817 array_push($a_array,
"");
1827 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1829 if ($result[
"rowvalue"] == $i)
1832 array_push($a_array, $result[
"value"] + 1);
1834 if ($result[
"textanswer"])
1836 $textanswer = $result[
"textanswer"];
1846 array_push($a_array, $textanswer);
1857 $checked_values = array();
1858 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1860 if ($result[
"rowvalue"] == $i)
1863 array_push($checked_values, $result[
"value"] + 1);
1865 if ($result[
"textanswer"])
1867 $textanswer = $result[
"textanswer"];
1877 array_push($a_array,
"");
1881 array_push($a_array, $textanswer);
1887 array_push($a_array,
"");
1892 $scale = $cat->scale;
1893 if (in_array($scale, $checked_values))
1895 array_push($a_array, $scale);
1899 array_push($a_array, 0);
1912 array_push($a_array,
"");
1918 array_push($a_array,
"");
1928 array_push($a_array,
"");
1949 $sql =
"SELECT svy_answer.* FROM svy_answer".
1950 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1951 " WHERE svy_answer.question_fi = ".$ilDB->quote($this->
getId(),
"integer").
1952 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1955 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1957 $sql .=
" ORDER BY rowvalue, value";
1963 if (!is_array($answers[
$row[
"active_fi"]])) $answers[$row[
"active_fi"]] = array();
1964 $rowobj = $this->
getRow($row[
"rowvalue"]);
1965 array_push($answers[$row[
"active_fi"]], $rowobj->title . (($rowobj->other) ? (
" " . $row[
"textanswer"]) :
"") .
": " . ($row[
"value"] + 1) .
" - " . $column->title);
1967 foreach ($answers as $key => $value)
1969 $answers[$key] = implode(
"<br />", $value);
2001 $this->subtype = $a_subtype;
2021 $this->columnSeparators = 1;
2025 $this->columnSeparators = 0;
2038 return ($this->columnSeparators) ? 1 : 0;
2052 $this->rowSeparators = 1;
2056 $this->rowSeparators = 0;
2069 return ($this->rowSeparators) ? 1 : 0;
2083 $this->neutralColumnSeparator = 1;
2087 $this->neutralColumnSeparator = 0;
2100 return ($this->neutralColumnSeparator) ? 1 : 0;
2113 foreach ($a_meta as $key => $value)
2115 switch ($value[
"label"])
2117 case "column_separators":
2120 case "row_separators":
2126 case "neutral_column_separator":
2142 foreach ($a_data as $adjective)
2144 if (is_numeric($adjective[
"label"]))
2164 foreach ($a_data as
$row)
2166 $this->
addRow($row[
'title'], $row[
'other'], $row[
'label']);
2178 foreach ($a_data as
$id => $data)
2181 foreach ($data[
"material"] as
$material)
2183 $column .= $material[
"text"];
2185 $this->columns->addCategory($column, null, (strcmp($data[
"label"],
"neutral") == 0) ?
true :
false);
2220 include_once
"./Services/Form/classes/class.ilSelectInputGUI.php";
2224 $step3->setValue($default);
2237 function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
2242 "percent_row" => $percent_row,
2243 "percent_columns" => $percent_columns,
2244 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
2245 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
2246 "percent_neutral" => $percent_neutral
2248 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET layout = %s WHERE question_fi = %s",
2249 array(
'text',
'integer'),
2256 if (!is_array($this->layout) || count($this->layout) == 0)
2260 $this->layout = array(
2261 "percent_row" => 30,
2262 "percent_columns" => 40,
2263 "percent_bipolar_adjective1" => 10,
2264 "percent_bipolar_adjective2" => 10,
2265 "percent_neutral" => 10
2270 $this->layout = array(
2271 "percent_row" => 30,
2272 "percent_columns" => 50,
2273 "percent_bipolar_adjective1" => 10,
2274 "percent_bipolar_adjective2" => 10,
2275 "percent_neutral" => 0
2280 $this->layout = array(
2281 "percent_row" => 30,
2282 "percent_columns" => 50,
2283 "percent_bipolar_adjective1" => 0,
2284 "percent_bipolar_adjective2" => 0,
2285 "percent_neutral" => 20
2290 $this->layout = array(
2291 "percent_row" => 30,
2292 "percent_columns" => 70,
2293 "percent_bipolar_adjective1" => 0,
2294 "percent_bipolar_adjective2" => 0,
2295 "percent_neutral" => 0
2310 $this->layout = unserialize(
$layout);
2341 if ($column->neutral && strlen($column->title))
return true;
2353 $this->columnPlaceholders = ($a_value) ? 1 : 0;
2363 return ($this->columnPlaceholders) ? 1 : 0;
2373 $this->legend = ($a_value) ? 1 : 0;
2383 return ($this->legend) ? 1 : 0;
2388 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
2393 return ($this->singleLineRowCaption) ? 1 : 0;
2398 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
2403 return ($this->repeatColumnHeader) ? 1 : 0;
2408 $this->columnHeaderPosition = $a_value;
2413 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
2418 $this->randomRows = ($a_value) ? 1 : 0;
2423 return ($this->randomRows) ? 1 : 0;
2428 $this->columnOrder = $a_value;
2433 return ($this->columnOrder) ? $this->columnOrder : 0;
2438 $this->columnImages = ($a_value) ? 1 : 0;
2443 return ($this->columnImages) ? 1 : 0;
2448 $this->rowImages = ($a_value) ? 1 : 0;
2453 return ($this->rowImages) ? 1 : 0;
2471 include_once
"./Services/Utilities/classes/class.ilStr.php";
2480 'counter' => $counter,
2481 'title' => $counter.
'. '.$this->getTitle(),
2483 'users_answered' =>
$cumulated[
'TOTAL'][
'USERS_ANSWERED'],
2484 'users_skipped' =>
$cumulated[
'TOTAL'][
'USERS_SKIPPED'],
2485 'question_type' => $this->lng->txt(
$cumulated[
'TOTAL'][
'QUESTION_TYPE']),
2487 'mode_nr_of_selections' =>
$cumulated[
'TOTAL'][
'MODE_NR_OF_SELECTIONS'],
2489 'arithmetic_mean' =>
$cumulated[
'TOTAL'][
'ARITHMETIC_MEAN']
2495 if (is_numeric($key))
2497 if (strlen($value[
'ROW']) > $maxlen + 3)
2499 $value[
'ROW'] = ilStr::substr($value[
'ROW'], 0, $maxlen) .
"...";
2504 'question' => ($key+1) .
". " . $value[
'ROW'],
2505 'users_answered' => $value[
'USERS_ANSWERED'],
2506 'users_skipped' => $value[
'USERS_SKIPPED'],
2507 'question_type' =>
'',
2508 'mode' => $value[
"MODE"],
2509 'mode_nr_of_selections' => $value[
"MODE_NR_OF_SELECTIONS"],
2510 'median' => $value[
"MEDIAN"],
2511 'arithmetic_mean' => $value[
"ARITHMETIC_MEAN"]