24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
169 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
172 $this->bipolar_adjective1 =
"";
173 $this->bipolar_adjective2 =
"";
174 $this->rowSeparators = 0;
175 $this->columnSeparators = 0;
176 $this->neutralColumnSeparator = 1;
188 return $this->columns->getCategoryCount();
200 $this->columns->removeCategory($index);
212 $this->columns->removeCategories($array);
224 $this->columns->removeCategoryWithName($name);
245 return $this->columns->getCategory($index);
250 return $this->columns->getCategoryForScale($scale);
262 return $this->columns->getCategoryIndex($name);
274 $this->columns->flushCategories();
285 return $this->rows->getCategoryCount();
293 function addRow($a_text, $a_other, $a_label)
295 $this->rows->addCategory($a_text, $a_other, 0, $a_label);
306 $this->rows->addCategoryAtPosition($a_text, $a_position, $a_other);
328 return $this->rows->getCategory($a_index);
333 $this->rows->moveCategoryUp($index);
338 $this->rows->moveCategoryDown($index);
350 $this->rows->removeCategories($array);
360 $this->rows->removeCategory($index);
375 return (strlen($this->bipolar_adjective2)) ? $this->bipolar_adjective2 : NULL;
379 return (strlen($this->bipolar_adjective1)) ? $this->bipolar_adjective1 : NULL;
397 $this->bipolar_adjective2 = $a_value;
401 $this->bipolar_adjective1 = $a_value;
417 $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",
418 array(
'integer',
'integer',
'integer'),
419 array($phrase_id, 0, $ilUser->getId())
423 if ((
$row[
"defaultvalue"] == 1) && (
$row[
"owner_fi"] == 0))
425 $this->columns->addCategory($this->lng->txt(
$row[
"title"]));
429 $this->columns->addCategory(
$row[
"title"]);
451 return $ilDB->fetchAssoc(
$result);
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",
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())
629 global $ilUser,
$ilDB;
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;
930 $next_id = $ilDB->nextId(
'svy_category');
931 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
932 array(
'integer',
'text',
'text',
'integer',
'integer'),
933 array($next_id, $data[
'answer'], 1, $ilUser->getId(), time())
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())
1115 foreach ($post_data as $key => $value)
1117 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1119 $next_id = $ilDB->nextId(
'svy_answer');
1120 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1121 $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)",
1122 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1123 array($next_id, $this->
getId(), $active_id, $value, $other_value, $matches[1], time())
1129 foreach ($post_data as $key => $value)
1131 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1133 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1134 foreach ($value as $checked)
1136 if (strlen($checked))
1138 $next_id = $ilDB->nextId(
'svy_answer');
1139 $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)",
1140 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1141 array($next_id, $this->
getId(), $active_id, $checked, $other_value, $matches[1], time())
1162 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1179 $result = $ilDB->queryF(
"SELECT svy_answer.active_fi, svy_answer.question_fi FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
1180 array(
'integer',
'integer'),
1186 $found[
$row[
"active_fi"].$row[
"question_fi"]] = 1;
1188 return count($found);
1203 $question_id = $this->
getId();
1205 $result_array = array();
1208 $result = $ilDB->queryF(
"SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_answer.rowvalue = %s AND svy_finished.finished_id = svy_answer.active_fi",
1209 array(
'integer',
'integer',
'integer'),
1221 if ($row[
"textanswer"])
1223 $result_array[
"textanswers"][$row[
"value"]][] = $row[
"textanswer"];
1226 if (is_array($result_array[
"textanswers"]))
1228 ksort($result_array[
"textanswers"], SORT_NUMERIC);
1234 $numrows =
$result->numRows();
1244 $result_array[
"MODE"] = $prefix . $cat->title;
1245 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1250 $scale = $cat->scale-1;
1255 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1258 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1266 for ($i = 0; $i < $key; $i++)
1268 array_push($median, $value+1);
1275 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1276 if (round($median_value) != $median_value)
1280 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1285 $median_value = $median[((
$total+1)/2)-1];
1292 $result_array[
"ARITHMETIC_MEAN"] =
"";
1293 $result_array[
"MEDIAN"] = $median_value;
1294 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1295 $result_array[
"ROW"] = $this->
getRow($rowindex)->title;
1296 return $result_array;
1310 $question_id = $this->
getId();
1312 $result_array = array();
1315 $result = $ilDB->queryF(
"SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
1316 array(
'integer',
'integer'),
1332 $numrows =
$result->numRows();
1342 $result_array[
"MODE"] = $prefix . $cat->title;
1343 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1348 $scale = $cat->scale-1;
1353 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1356 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1364 for ($i = 0; $i < $key; $i++)
1366 array_push($median, $value+1);
1373 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1374 if (round($median_value) != $median_value)
1378 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1383 $median_value = $median[((
$total+1)/2)-1];
1390 $result_array[
"ARITHMETIC_MEAN"] =
"";
1391 $result_array[
"MEDIAN"] = $median_value;
1392 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1394 $cumulated_results = array();
1395 $cumulated_results[
"TOTAL"] = $result_array;
1399 $cumulated_results[$i] = $rowresult;
1401 return $cumulated_results;
1417 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1419 switch ($export_label)
1438 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1440 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1446 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1450 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1453 switch ($export_label)
1462 foreach ($eval_data as $evalkey => $evalvalue)
1464 if (is_numeric($evalkey))
1467 $worksheet->write(
$row, 3+$add, $evalvalue[
"USERS_ANSWERED"]);
1468 $worksheet->write(
$row, 4+$add, $evalvalue[
"USERS_SKIPPED"]);
1471 $worksheet->write(
$row, 7+$add, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1473 $worksheet->write(
$row, 9+$add, $evalvalue[
"ARITHMETIC_MEAN"]);
1494 foreach ($eval_data as $evalkey => $evalvalue)
1497 if (is_numeric($evalkey))
1499 array_push($csvrow,
"");
1500 array_push($csvrow, $evalvalue[
"ROW"]);
1501 array_push($csvrow,
"");
1505 switch ($export_label)
1508 array_push($csvrow, $this->label);
1511 array_push($csvrow, $this->
getTitle());
1514 array_push($csvrow, $this->
getTitle());
1515 array_push($csvrow, $this->label);
1519 array_push($csvrow, $this->lng->txt($evalvalue[
"QUESTION_TYPE"]));
1521 array_push($csvrow, $evalvalue[
"USERS_ANSWERED"]);
1522 array_push($csvrow, $evalvalue[
"USERS_SKIPPED"]);
1523 array_push($csvrow, $evalvalue[
"MODE"]);
1524 array_push($csvrow, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1525 array_push($csvrow, $evalvalue[
"MEDIAN"]);
1526 array_push($csvrow, $evalvalue[
"ARITHMETIC_MEAN"]);
1543 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1544 $worksheet =& $workbook->addWorksheet();
1546 switch ($export_label)
1572 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1575 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1578 preg_match(
"/(.*?)\s+-\s+(.*)/", $eval_data[
"TOTAL"][
"MODE"], $matches);
1593 foreach ($eval_data[
"TOTAL"][
"variables"] as $key => $value)
1596 $worksheet->write($rowcounter, 2, $key+1);
1601 foreach ($eval_data as $evalkey => $evalvalue)
1603 if (is_numeric($evalkey))
1608 $worksheet->write($rowcounter + 1, 1, $evalvalue[
"USERS_ANSWERED"]);
1610 $worksheet->write($rowcounter + 2, 1, $evalvalue[
"USERS_SKIPPED"]);
1611 $rowcounter = $rowcounter + 3;
1613 preg_match(
"/(.*?)\s+-\s+(.*)/", $evalvalue[
"MODE"], $matches);
1628 foreach ($evalvalue[
"variables"] as $key => $value)
1631 $worksheet->write($rowcounter, 2, $key+1);
1636 if (is_array($evalvalue[
"textanswers"]))
1642 foreach ($evalvalue[
"textanswers"] as $key => $answers)
1644 $title = $evalvalue[
"variables"][$key][
"title"];
1645 foreach ($answers as $answer)
1655 $format_center =& $workbook->addFormat();
1656 $format_center->setColor(
'black');
1657 $format_center->setAlign(
'center');
1663 $worksheet->write($rowcounter, $counter,
"", $format_title);
1664 foreach ($eval_data[
"TOTAL"][
"variables"] as $variable)
1671 foreach ($eval_data as $index =>
$data)
1673 if (is_numeric($index))
1677 foreach (
$data[
"variables"] as $vardata)
1679 $worksheet->write($rowcounter, $counter, $vardata[
"selected"], $format_center);
1701 switch ($a_export_label)
1715 array_push($a_array,
$title);
1719 array_push($a_array,
$title.
' - '. $this->lng->txt(
'other'));
1730 array_push($a_array, ($index+1) .
" - " . $col->title);
1746 if (count($resultset[
"answers"][$this->
getId()]))
1748 array_push($a_array,
"");
1757 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1759 if ($result[
"rowvalue"] == $i)
1762 array_push($a_array, $result[
"value"] + 1);
1763 if ($result[
"textanswer"])
1765 $textanswer = $result[
"textanswer"];
1771 array_push($a_array, $this->lng->txt(
"skipped"));
1776 array_push($a_array, $textanswer);
1786 $checked_values = array();
1787 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1789 if ($result[
"rowvalue"] == $i)
1792 array_push($checked_values, $result[
"value"] + 1);
1793 if ($result[
"textanswer"])
1795 $textanswer = $result[
"textanswer"];
1801 array_push($a_array, $this->lng->txt(
"skipped"));
1805 array_push($a_array,
"");
1810 array_push($a_array, $textanswer);
1816 array_push($a_array,
"");
1820 if (in_array($index+1, $checked_values))
1822 array_push($a_array, 1);
1826 array_push($a_array, 0);
1836 array_push($a_array, $this->lng->txt(
"skipped"));
1839 array_push($a_array,
"");
1845 array_push($a_array,
"");
1855 array_push($a_array,
"");
1876 $result = $ilDB->queryF(
"SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_finished.survey_fi = %s AND svy_answer.question_fi = %s AND svy_finished.finished_id = svy_answer.active_fi ORDER BY rowvalue, value",
1877 array(
'integer',
'integer'),
1884 if (!is_array($answers[
$row[
"active_fi"]])) $answers[$row[
"active_fi"]] = array();
1885 $rowobj = $this->
getRow($row[
"rowvalue"]);
1886 array_push($answers[$row[
"active_fi"]], $rowobj->title . (($rowobj->other) ? (
" " . $row[
"textanswer"]) :
"") .
": " . ($row[
"value"] + 1) .
" - " . $column->title);
1888 foreach ($answers as $key => $value)
1890 $answers[$key] = implode(
"<br />", $value);
1922 $this->subtype = $a_subtype;
1942 $this->columnSeparators = 1;
1946 $this->columnSeparators = 0;
1959 return ($this->columnSeparators) ? 1 : 0;
1973 $this->rowSeparators = 1;
1977 $this->rowSeparators = 0;
1990 return ($this->rowSeparators) ? 1 : 0;
2004 $this->neutralColumnSeparator = 1;
2008 $this->neutralColumnSeparator = 0;
2021 return ($this->neutralColumnSeparator) ? 1 : 0;
2034 foreach ($a_meta as $key => $value)
2036 switch ($value[
"label"])
2038 case "column_separators":
2041 case "row_separators":
2047 case "neutral_column_separator":
2063 foreach ($a_data as $adjective)
2065 if (is_numeric($adjective[
"label"]))
2085 foreach ($a_data as
$row)
2087 $this->
addRow($row[
'title'], $row[
'other'], $row[
'label']);
2104 $column .= $material[
"text"];
2106 $this->columns->addCategory($column, null, (strcmp(
$data[
"label"],
"neutral") == 0) ?
true :
false);
2141 include_once
"./Services/Form/classes/class.ilSelectInputGUI.php";
2144 $step3->setOptions($options);
2145 $step3->setValue($default);
2159 if (count($this->cumulated) == 0)
2161 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
2166 if (is_numeric($type))
2168 foreach ($this->cumulated[$type][
"variables"] as $key => $value)
2170 foreach ($value as $key2 => $value2)
2172 $this->cumulated[
"variables"][$key][$key2] = utf8_decode($value2);
2175 $title = preg_replace(
"/<[^>]+?>/ims",
"", $this->
getRow($type)->title);
2176 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyChart.php";
2177 $b1 =
new SurveyChart(
"bars", 400, 250, utf8_decode(
$title),utf8_decode($this->lng->txt(
"answers")), utf8_decode($this->lng->txt(
"users_answered")), $this->cumulated[$type][
"variables"]);
2190 function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
2195 "percent_row" => $percent_row,
2196 "percent_columns" => $percent_columns,
2197 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
2198 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
2199 "percent_neutral" => $percent_neutral
2201 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET layout = %s WHERE question_fi = %s",
2202 array(
'text',
'integer'),
2209 if (!is_array($this->layout) || count($this->layout) == 0)
2213 $this->layout = array(
2214 "percent_row" => 30,
2215 "percent_columns" => 40,
2216 "percent_bipolar_adjective1" => 10,
2217 "percent_bipolar_adjective2" => 10,
2218 "percent_neutral" => 10
2223 $this->layout = array(
2224 "percent_row" => 30,
2225 "percent_columns" => 50,
2226 "percent_bipolar_adjective1" => 10,
2227 "percent_bipolar_adjective2" => 10,
2228 "percent_neutral" => 0
2233 $this->layout = array(
2234 "percent_row" => 30,
2235 "percent_columns" => 50,
2236 "percent_bipolar_adjective1" => 0,
2237 "percent_bipolar_adjective2" => 0,
2238 "percent_neutral" => 20
2243 $this->layout = array(
2244 "percent_row" => 30,
2245 "percent_columns" => 70,
2246 "percent_bipolar_adjective1" => 0,
2247 "percent_bipolar_adjective2" => 0,
2248 "percent_neutral" => 0
2263 $this->layout = unserialize(
$layout);
2291 foreach ($this->columns as $column)
2293 if ($column->neutral && strlen($column->title))
return true;
2305 $this->columnPlaceholders = ($a_value) ? 1 : 0;
2315 return ($this->columnPlaceholders) ? 1 : 0;
2325 $this->legend = ($a_value) ? 1 : 0;
2335 return ($this->legend) ? 1 : 0;
2340 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
2345 return ($this->singleLineRowCaption) ? 1 : 0;
2350 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
2355 return ($this->repeatColumnHeader) ? 1 : 0;
2360 $this->columnHeaderPosition = $a_value;
2365 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
2370 $this->randomRows = ($a_value) ? 1 : 0;
2375 return ($this->randomRows) ? 1 : 0;
2380 $this->columnOrder = $a_value;
2385 return ($this->columnOrder) ? $this->columnOrder : 0;
2390 $this->columnImages = ($a_value) ? 1 : 0;
2395 return ($this->columnImages) ? 1 : 0;
2400 $this->rowImages = ($a_value) ? 1 : 0;
2405 return ($this->rowImages) ? 1 : 0;
2425 include_once
"./Services/Utilities/classes/class.ilStr.php";
2430 'counter' => $counter,
2433 'users_answered' =>
$cumulated[
'TOTAL'][
'USERS_ANSWERED'],
2434 'users_skipped' =>
$cumulated[
'TOTAL'][
'USERS_SKIPPED'],
2435 'question_type' => $this->lng->txt(
$cumulated[
'TOTAL'][
'QUESTION_TYPE']),
2437 'mode_nr_of_selections' =>
$cumulated[
'TOTAL'][
'MODE_NR_OF_SELECTIONS'],
2439 'arithmetic_mean' =>
$cumulated[
'TOTAL'][
'ARITHMETIC_MEAN']
2444 if (is_numeric($key))
2448 'question' => ($key+1) .
". " . $value[
'ROW'],
2449 'users_answered' => $value[
'USERS_ANSWERED'],
2450 'users_skipped' => $value[
'USERS_SKIPPED'],
2451 'question_type' =>
'',
2452 'mode' => $value[
"MODE"],
2453 'mode_nr_of_selections' => $value[
"MODE_NR_OF_SELECTIONS"],
2454 'median' => $value[
"MEDIAN"],
2455 'arithmetic_mean' => $value[
"ARITHMETIC_MEAN"]