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 $neutral =
$row[
"neutral"];
424 if ((
$row[
"defaultvalue"] == 1) && (
$row[
"owner_fi"] == 0))
426 $this->columns->addCategory($this->lng->txt(
$row[
"title"]), 0, $neutral);
430 $this->columns->addCategory(
$row[
"title"], 0, $neutral);
452 return $ilDB->fetchAssoc(
$result);
478 $this->label =
$data[
'label'];
483 include_once(
"./Services/RTE/classes/class.ilRTE.php");
506 $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",
518 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_matrixrows WHERE question_fi = %s ORDER BY sequence",
559 function saveToDb($original_id = NULL, $withanswers =
true)
565 if ($affectedRows == 1)
567 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
569 array($this->
getId())
572 question_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,
573 legend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,
574 column_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)
575 VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
577 'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
578 'text',
'text',
'text',
'text',
'text',
'text',
'text',
'text',
'integer'
614 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET bipolar_adjective1 = %s, bipolar_adjective2 = %s WHERE question_fi = %s",
615 array(
'text',
'text',
'integer'),
616 array((strlen($adjective1)) ? $adjective1 : NULL, (strlen($adjective2)) ? $adjective2 : NULL, $this->
getId())
630 global $ilUser,
$ilDB;
632 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
633 array(
'text',
'text',
'integer'),
634 array($columntext, $neutral, $ilUser->getId())
643 if (strcmp(
$row[
"title"], $columntext) == 0)
645 $returnvalue =
$row[
"category_id"];
656 $next_id = $ilDB->nextId(
'svy_category');
657 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
658 array(
'integer',
'text',
'text',
'integer',
'text',
'integer'),
659 array($next_id, $columntext, 0, $ilUser->getId(), $neutral, time())
661 $returnvalue = $next_id;
671 $question_id = $this->
getId();
672 if (strlen($original_id))
674 $question_id = $original_id;
678 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
687 $next_id = $ilDB->nextId(
'svy_variable');
688 $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)",
689 array(
'integer',
'integer',
'integer',
'float',
'integer',
'integer',
'integer',
'integer'),
690 array($next_id, $column_id, $question_id, ($i + 1), $cat->other, $i, ($cat->scale > 0) ? $cat->scale : null, time())
701 $question_id = $this->
getId();
702 if (strlen($original_id))
704 $question_id = $original_id;
708 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
716 $next_id = $ilDB->nextId(
'svy_qst_matrixrows');
717 $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)",
718 array(
'integer',
'text',
'text',
'integer',
'integer',
'integer'),
719 array($next_id,
$row->title,
$row->label, (
$row->other) ? 1 : 0, $i, $question_id)
731 function toXML($a_include_header = TRUE, $obligatory_state =
"")
733 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
736 $this->
insertXML($a_xml_writer, $a_include_header, $obligatory_state);
737 $xml = $a_xml_writer->xmlDumpMem(FALSE);
738 if (!$a_include_header)
740 $pos = strpos($xml,
"?>");
741 $xml = substr($xml, $pos + 2);
754 function insertXML(&$a_xml_writer, $a_include_header = TRUE, $obligatory_state =
"")
757 "id" => $this->
getId(),
759 "type" => $this->getQuestiontype(),
763 $a_xml_writer->xmlStartTag(
"question", $attrs);
765 $a_xml_writer->xmlElement(
"description", NULL, $this->
getDescription());
766 $a_xml_writer->xmlElement(
"author", NULL, $this->
getAuthor());
767 $a_xml_writer->xmlStartTag(
"questiontext");
769 $a_xml_writer->xmlEndTag(
"questiontext");
771 $a_xml_writer->xmlStartTag(
"matrix");
772 $a_xml_writer->xmlStartTag(
"matrixrows");
778 if (strlen($this->
getRow($i)->label))
780 $attrs[
'label'] = $this->
getRow($i)->label;
782 if ($this->
getRow($i)->other)
786 $a_xml_writer->xmlStartTag(
"matrixrow", $attrs);
788 $a_xml_writer->xmlEndTag(
"matrixrow");
790 $a_xml_writer->xmlEndTag(
"matrixrows");
792 $a_xml_writer->xmlStartTag(
"responses");
795 $a_xml_writer->xmlStartTag(
"bipolar_adjectives");
804 $a_xml_writer->xmlEndTag(
"bipolar_adjectives");
813 $attrs[
'label'] =
'neutral';
818 $a_xml_writer->xmlStartTag(
"response_single", $attrs);
821 $a_xml_writer->xmlStartTag(
"response_multiple", $attrs);
828 $a_xml_writer->xmlEndTag(
"response_single");
831 $a_xml_writer->xmlEndTag(
"response_multiple");
836 $a_xml_writer->xmlEndTag(
"responses");
837 $a_xml_writer->xmlEndTag(
"matrix");
839 if (count($this->material))
841 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
844 "label" => $this->material[
"title"]
846 $a_xml_writer->xmlStartTag(
"material", $attrs);
847 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
848 if (strcmp($matches[1],
"") != 0)
850 $intlink = $this->material[
"internal_link"];
852 $a_xml_writer->xmlElement(
"mattext", NULL, $intlink);
853 $a_xml_writer->xmlEndTag(
"material");
857 $a_xml_writer->xmlStartTag(
"metadata");
858 $a_xml_writer->xmlStartTag(
"metadatafield");
859 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"column_separators");
861 $a_xml_writer->xmlEndTag(
"metadatafield");
863 $a_xml_writer->xmlStartTag(
"metadatafield");
864 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"row_separators");
866 $a_xml_writer->xmlEndTag(
"metadatafield");
868 $a_xml_writer->xmlStartTag(
"metadatafield");
869 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"neutral_column_separator");
871 $a_xml_writer->xmlEndTag(
"metadatafield");
873 $a_xml_writer->xmlStartTag(
"metadatafield");
874 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"layout");
875 $a_xml_writer->xmlElement(
"fieldentry", NULL, serialize($this->
getLayout()));
876 $a_xml_writer->xmlEndTag(
"metadatafield");
878 $a_xml_writer->xmlEndTag(
"metadata");
880 $a_xml_writer->xmlEndTag(
"question");
903 for ($i = $lower_limit; $i <= $upper_limit; $i++)
905 $this->columns->addCategory($i);
921 $next_id = $ilDB->nextId(
'svy_phrase');
922 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
923 array(
'integer',
'text',
'text',
'integer',
'integer'),
924 array($next_id,
$title, 1, $ilUser->getId(), time())
926 $phrase_id = $next_id;
931 $next_id = $ilDB->nextId(
'svy_category');
932 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
933 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
934 array($next_id, $data[
'answer'], 1, $ilUser->getId(), time(), $data[
'neutral'])
936 $category_id = $next_id;
937 $next_id = $ilDB->nextId(
'svy_phrase_cat');
938 $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)",
939 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
940 array($next_id, $phrase_id, $category_id, $counter, ($data[
'other']) ? 1 : 0, $data[
'scale'])
954 return "SurveyMatrixQuestion";
965 return "svy_qst_matrix";
977 foreach ($post_data as $key => $value)
982 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
984 if (is_array($value))
986 foreach ($value as $val)
988 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
993 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
998 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1000 if (is_array($value))
1002 foreach ($value as $val)
1004 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
1009 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1],
"textanswer" => $post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]));
1034 foreach ($post_data as $key => $value)
1036 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1038 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0)
1040 return $this->lng->txt(
"question_mr_no_other_answer");
1045 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_radio_button_not_checked");
1049 foreach ($post_data as $key => $value)
1051 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1053 if (array_key_exists(
'matrix_other_' . $this->
getId() .
"_" . $matches[1], $post_data) && strlen($post_data[
'matrix_other_' . $this->
getId() .
"_" . $matches[1]]) == 0)
1055 return $this->lng->txt(
"question_mr_no_other_answer");
1058 if ((!is_array($value)) || (count($value) < 1))
1060 return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1064 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1081 if ($this->getSubType() == 1)
1084 for ($i = 0; $i < $columncount; $i++)
1088 $next_id = $ilDB->nextId(
'svy_answer');
1089 $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)",
1090 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1091 array($next_id, $this->
getId(), $active_id, $i, NULL,
$row, time())
1099 $category = rand(0, $columncount-1);
1100 $next_id = $ilDB->nextId(
'svy_answer');
1101 $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)",
1102 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1103 array($next_id, $this->
getId(), $active_id, $category, NULL,
$row, time())
1115 $return_data = array();
1120 foreach ($post_data as $key => $value)
1122 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1124 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1127 $next_id = $ilDB->nextId(
'svy_answer');
1128 $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)",
1129 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1130 array($next_id, $this->
getId(), $active_id, $value, $other_value, $matches[1], time())
1135 $return_data[] = array(
"value"=>$value,
1136 "textanswer"=>$other_value,
1137 "rowvalue"=>$matches[1]);
1143 foreach ($post_data as $key => $value)
1145 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1147 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data)) ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]]) : null;
1148 foreach ($value as $checked)
1150 if (strlen($checked))
1154 $next_id = $ilDB->nextId(
'svy_answer');
1155 $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)",
1156 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1157 array($next_id, $this->
getId(), $active_id, $checked, $other_value, $matches[1], time())
1162 $return_data[] = array(
"value"=>$checked,
1163 "textanswer"=>$other_value,
1164 "rowvalue"=>$matches[1]);
1174 return $return_data;
1189 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1206 $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",
1207 array(
'integer',
'integer'),
1213 $found[
$row[
"active_fi"].$row[
"question_fi"]] = 1;
1215 return count($found);
1230 $question_id = $this->
getId();
1232 $result_array = array();
1235 $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",
1236 array(
'integer',
'integer',
'integer'),
1249 if ($row[
"textanswer"])
1251 $result_array[
"textanswers"][$row[
"value"]][] = $row[
"textanswer"];
1255 if (is_array($result_array[
"textanswers"]))
1257 ksort($result_array[
"textanswers"], SORT_NUMERIC);
1263 $numrows =
$result->numRows();
1273 $result_array[
"MODE"] = $prefix . $cat->title;
1274 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1279 $scale = $cat->scale-1;
1284 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1287 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1295 for ($i = 0; $i < $key; $i++)
1297 array_push($median, $value+1);
1304 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1305 if (round($median_value) != $median_value)
1309 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1314 $median_value = $median[((
$total+1)/2)-1];
1321 $result_array[
"ARITHMETIC_MEAN"] =
"";
1322 $result_array[
"MEDIAN"] = $median_value;
1323 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1324 $result_array[
"ROW"] = $this->
getRow($rowindex)->title;
1325 return $result_array;
1339 $question_id = $this->
getId();
1341 $result_array = array();
1344 $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",
1345 array(
'integer',
'integer'),
1361 $numrows =
$result->numRows();
1371 $result_array[
"MODE"] = $prefix . $cat->title;
1372 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1377 $scale = $cat->scale-1;
1382 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1385 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1393 for ($i = 0; $i < $key; $i++)
1395 array_push($median, $value+1);
1402 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1403 if (round($median_value) != $median_value)
1407 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1412 $median_value = $median[((
$total+1)/2)-1];
1419 $result_array[
"ARITHMETIC_MEAN"] =
"";
1420 $result_array[
"MEDIAN"] = $median_value;
1421 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1423 $cumulated_results = array();
1424 $cumulated_results[
"TOTAL"] = $result_array;
1428 $cumulated_results[$i] = $rowresult;
1430 return $cumulated_results;
1446 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1448 switch ($export_label)
1467 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1469 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1475 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1479 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1482 switch ($export_label)
1491 foreach ($eval_data as $evalkey => $evalvalue)
1493 if (is_numeric($evalkey))
1496 $worksheet->write(
$row, 3+$add, $evalvalue[
"USERS_ANSWERED"]);
1497 $worksheet->write(
$row, 4+$add, $evalvalue[
"USERS_SKIPPED"]);
1500 $worksheet->write(
$row, 7+$add, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1502 $worksheet->write(
$row, 9+$add, $evalvalue[
"ARITHMETIC_MEAN"]);
1523 foreach ($eval_data as $evalkey => $evalvalue)
1526 if (is_numeric($evalkey))
1528 array_push($csvrow,
"");
1529 array_push($csvrow, $evalvalue[
"ROW"]);
1530 array_push($csvrow,
"");
1534 switch ($export_label)
1537 array_push($csvrow, $this->label);
1540 array_push($csvrow, $this->
getTitle());
1543 array_push($csvrow, $this->
getTitle());
1544 array_push($csvrow, $this->label);
1548 array_push($csvrow, $this->lng->txt($evalvalue[
"QUESTION_TYPE"]));
1550 array_push($csvrow, $evalvalue[
"USERS_ANSWERED"]);
1551 array_push($csvrow, $evalvalue[
"USERS_SKIPPED"]);
1552 array_push($csvrow, $evalvalue[
"MODE"]);
1553 array_push($csvrow, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1554 array_push($csvrow, $evalvalue[
"MEDIAN"]);
1555 array_push($csvrow, $evalvalue[
"ARITHMETIC_MEAN"]);
1572 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1573 $worksheet =& $workbook->addWorksheet();
1575 switch ($export_label)
1601 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1604 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1607 preg_match(
"/(.*?)\s+-\s+(.*)/", $eval_data[
"TOTAL"][
"MODE"], $matches);
1622 foreach ($eval_data[
"TOTAL"][
"variables"] as $key => $value)
1625 $worksheet->write($rowcounter, 2, $key+1);
1630 foreach ($eval_data as $evalkey => $evalvalue)
1632 if (is_numeric($evalkey))
1637 $worksheet->write($rowcounter + 1, 1, $evalvalue[
"USERS_ANSWERED"]);
1639 $worksheet->write($rowcounter + 2, 1, $evalvalue[
"USERS_SKIPPED"]);
1640 $rowcounter = $rowcounter + 3;
1642 preg_match(
"/(.*?)\s+-\s+(.*)/", $evalvalue[
"MODE"], $matches);
1657 foreach ($evalvalue[
"variables"] as $key => $value)
1660 $worksheet->write($rowcounter, 2, $key+1);
1666 if (is_array($evalvalue[
"textanswers"]))
1672 foreach ($evalvalue[
"textanswers"] as $key => $answers)
1674 $title = $evalvalue[
"variables"][$key][
"title"];
1675 foreach ($answers as $answer)
1685 $format_center =& $workbook->addFormat();
1686 $format_center->setColor(
'black');
1687 $format_center->setAlign(
'center');
1693 $worksheet->write($rowcounter, $counter,
"", $format_title);
1694 foreach ($eval_data[
"TOTAL"][
"variables"] as $variable)
1701 foreach ($eval_data as $index =>
$data)
1703 if (is_numeric($index))
1707 foreach (
$data[
"variables"] as $vardata)
1709 $worksheet->write($rowcounter, $counter, $vardata[
"selected"], $format_center);
1731 switch ($a_export_label)
1745 array_push($a_array,
$title);
1749 array_push($a_array,
$title.
' - '. $this->lng->txt(
'other'));
1760 array_push($a_array, ($index+1) .
" - " . $col->title);
1776 if (count($resultset[
"answers"][$this->
getId()]))
1778 array_push($a_array,
"");
1788 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1790 if ($result[
"rowvalue"] == $i)
1793 array_push($a_array, $result[
"value"] + 1);
1795 if ($result[
"textanswer"])
1797 $textanswer = $result[
"textanswer"];
1803 array_push($a_array, $this->lng->txt(
"skipped"));
1807 array_push($a_array, $textanswer);
1818 $checked_values = array();
1819 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1821 if ($result[
"rowvalue"] == $i)
1824 array_push($checked_values, $result[
"value"] + 1);
1826 if ($result[
"textanswer"])
1828 $textanswer = $result[
"textanswer"];
1834 array_push($a_array, $this->lng->txt(
"skipped"));
1838 array_push($a_array,
"");
1842 array_push($a_array, $textanswer);
1848 array_push($a_array,
"");
1853 $scale = $cat->scale;
1854 if (in_array($scale, $checked_values))
1856 array_push($a_array, $scale);
1860 array_push($a_array, 0);
1870 array_push($a_array, $this->lng->txt(
"skipped"));
1873 array_push($a_array,
"");
1879 array_push($a_array,
"");
1889 array_push($a_array,
"");
1910 $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",
1911 array(
'integer',
'integer'),
1919 if (!is_array($answers[
$row[
"active_fi"]])) $answers[$row[
"active_fi"]] = array();
1920 $rowobj = $this->
getRow($row[
"rowvalue"]);
1921 array_push($answers[$row[
"active_fi"]], $rowobj->title . (($rowobj->other) ? (
" " . $row[
"textanswer"]) :
"") .
": " . ($row[
"value"] + 1) .
" - " . $column->title);
1923 foreach ($answers as $key => $value)
1925 $answers[$key] = implode(
"<br />", $value);
1957 $this->subtype = $a_subtype;
1977 $this->columnSeparators = 1;
1981 $this->columnSeparators = 0;
1994 return ($this->columnSeparators) ? 1 : 0;
2008 $this->rowSeparators = 1;
2012 $this->rowSeparators = 0;
2025 return ($this->rowSeparators) ? 1 : 0;
2039 $this->neutralColumnSeparator = 1;
2043 $this->neutralColumnSeparator = 0;
2056 return ($this->neutralColumnSeparator) ? 1 : 0;
2069 foreach ($a_meta as $key => $value)
2071 switch ($value[
"label"])
2073 case "column_separators":
2076 case "row_separators":
2082 case "neutral_column_separator":
2098 foreach ($a_data as $adjective)
2100 if (is_numeric($adjective[
"label"]))
2120 foreach ($a_data as
$row)
2122 $this->
addRow($row[
'title'], $row[
'other'], $row[
'label']);
2139 $column .= $material[
"text"];
2141 $this->columns->addCategory($column, null, (strcmp(
$data[
"label"],
"neutral") == 0) ?
true :
false);
2176 include_once
"./Services/Form/classes/class.ilSelectInputGUI.php";
2179 $step3->setOptions($options);
2180 $step3->setValue($default);
2193 function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
2198 "percent_row" => $percent_row,
2199 "percent_columns" => $percent_columns,
2200 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
2201 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
2202 "percent_neutral" => $percent_neutral
2204 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET layout = %s WHERE question_fi = %s",
2205 array(
'text',
'integer'),
2212 if (!is_array($this->layout) || count($this->layout) == 0)
2216 $this->layout = array(
2217 "percent_row" => 30,
2218 "percent_columns" => 40,
2219 "percent_bipolar_adjective1" => 10,
2220 "percent_bipolar_adjective2" => 10,
2221 "percent_neutral" => 10
2226 $this->layout = array(
2227 "percent_row" => 30,
2228 "percent_columns" => 50,
2229 "percent_bipolar_adjective1" => 10,
2230 "percent_bipolar_adjective2" => 10,
2231 "percent_neutral" => 0
2236 $this->layout = array(
2237 "percent_row" => 30,
2238 "percent_columns" => 50,
2239 "percent_bipolar_adjective1" => 0,
2240 "percent_bipolar_adjective2" => 0,
2241 "percent_neutral" => 20
2246 $this->layout = array(
2247 "percent_row" => 30,
2248 "percent_columns" => 70,
2249 "percent_bipolar_adjective1" => 0,
2250 "percent_bipolar_adjective2" => 0,
2251 "percent_neutral" => 0
2266 $this->layout = unserialize(
$layout);
2294 foreach ($this->columns as $column)
2296 if ($column->neutral && strlen($column->title))
return true;
2308 $this->columnPlaceholders = ($a_value) ? 1 : 0;
2318 return ($this->columnPlaceholders) ? 1 : 0;
2328 $this->legend = ($a_value) ? 1 : 0;
2338 return ($this->legend) ? 1 : 0;
2343 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
2348 return ($this->singleLineRowCaption) ? 1 : 0;
2353 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
2358 return ($this->repeatColumnHeader) ? 1 : 0;
2363 $this->columnHeaderPosition = $a_value;
2368 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
2373 $this->randomRows = ($a_value) ? 1 : 0;
2378 return ($this->randomRows) ? 1 : 0;
2383 $this->columnOrder = $a_value;
2388 return ($this->columnOrder) ? $this->columnOrder : 0;
2393 $this->columnImages = ($a_value) ? 1 : 0;
2398 return ($this->columnImages) ? 1 : 0;
2403 $this->rowImages = ($a_value) ? 1 : 0;
2408 return ($this->rowImages) ? 1 : 0;
2426 include_once
"./Services/Utilities/classes/class.ilStr.php";
2435 'counter' => $counter,
2438 'users_answered' =>
$cumulated[
'TOTAL'][
'USERS_ANSWERED'],
2439 'users_skipped' =>
$cumulated[
'TOTAL'][
'USERS_SKIPPED'],
2440 'question_type' => $this->lng->txt(
$cumulated[
'TOTAL'][
'QUESTION_TYPE']),
2442 'mode_nr_of_selections' =>
$cumulated[
'TOTAL'][
'MODE_NR_OF_SELECTIONS'],
2444 'arithmetic_mean' =>
$cumulated[
'TOTAL'][
'ARITHMETIC_MEAN']
2450 if (is_numeric($key))
2452 if (strlen($value[
'ROW']) > $maxlen + 3)
2454 $value[
'ROW'] = ilStr::substr($value[
'ROW'], 0, $maxlen) .
"...";
2459 'question' => ($key+1) .
". " . $value[
'ROW'],
2460 'users_answered' => $value[
'USERS_ANSWERED'],
2461 'users_skipped' => $value[
'USERS_SKIPPED'],
2462 'question_type' =>
'',
2463 'mode' => $value[
"MODE"],
2464 'mode_nr_of_selections' => $value[
"MODE_NR_OF_SELECTIONS"],
2465 'median' => $value[
"MEDIAN"],
2466 'arithmetic_mean' => $value[
"ARITHMETIC_MEAN"]