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())
1112 $answer_data = array();
1118 foreach ($post_data as $key => $value)
1120 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1124 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data))
1125 ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]])
1127 $answer_data[] = array(
"value"=>$value,
1128 "textanswer"=>$other_value,
1129 "rowvalue"=>$matches[1]);
1136 foreach ($post_data as $key => $value)
1138 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/", $key, $matches))
1140 $other_value = (array_key_exists(
'matrix_other_' . $this->
getId() .
'_' . $matches[1], $post_data))
1141 ? ($post_data[
'matrix_other_' . $this->
getId() .
'_' . $matches[1]])
1143 foreach ($value as $checked)
1145 $answer_data[] = array(
"value"=>$checked,
1146 "textanswer"=>$other_value,
1147 "rowvalue"=>$matches[1]);
1156 return $answer_data;
1160 if(
sizeof($answer_data))
1163 foreach ($answer_data as $item)
1165 $next_id = $ilDB->nextId(
'svy_answer');
1166 $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)",
1167 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1168 array($next_id, $this->
getId(), $active_id, $item[
'value'], $item[
'textanswer'], $item[
'rowvalue'], time())
1185 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1202 $sql =
"SELECT svy_answer.active_fi, svy_answer.question_fi".
1204 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1205 " WHERE svy_answer.question_fi = ".$ilDB->quote($this->
getId(),
"integer").
1206 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1209 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1213 $sql .=
" AND rowvalue = ".$ilDB->quote($rowindex,
"integer");
1220 $found[
$row[
"active_fi"].$row[
"question_fi"]] = 1;
1222 return count($found);
1237 $question_id = $this->
getId();
1239 $result_array = array();
1242 $sql =
"SELECT svy_answer.* FROM svy_answer".
1243 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1244 " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id,
"integer").
1245 " AND svy_answer.rowvalue = ".$ilDB->quote($rowindex,
"integer").
1246 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1249 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1262 if ($row[
"textanswer"])
1264 $result_array[
"textanswers"][$row[
"value"]][] = $row[
"textanswer"];
1268 if (is_array($result_array[
"textanswers"]))
1270 ksort($result_array[
"textanswers"], SORT_NUMERIC);
1276 $numrows =
$result->numRows();
1278 $result_array[
"USERS_SKIPPED"] = $nr_of_users - $result_array[
"USERS_ANSWERED"];
1288 $result_array[
"MODE"] = $prefix . $cat->title;
1289 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1295 $scale = $cat->scale-1;
1300 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1303 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1311 for ($i = 0; $i < $key; $i++)
1313 array_push($median, $value+1);
1320 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1321 if (round($median_value) != $median_value)
1325 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1330 $median_value = $median[((
$total+1)/2)-1];
1337 $result_array[
"ARITHMETIC_MEAN"] =
"";
1338 $result_array[
"MEDIAN"] = $median_value;
1339 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1340 $result_array[
"ROW"] = $this->
getRow($rowindex)->title;
1341 return $result_array;
1355 $question_id = $this->
getId();
1357 $result_array = array();
1360 $sql =
"SELECT svy_answer.* FROM svy_answer".
1361 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1362 " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id,
"integer").
1363 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1366 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1382 $numrows =
$result->numRows();
1394 $result_array[
"MODE"] = $prefix . $cat->title;
1395 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1401 $scale = $cat->scale-1;
1406 $percentage = (float)((
int)
$cumulated[$scale]/$numrows);
1409 $result_array[
"variables"][$key] = array(
"title" => $cat->title,
"selected" => (
int)
$cumulated[$scale],
"percentage" => $percentage);
1417 for ($i = 0; $i < $key; $i++)
1419 array_push($median, $value+1);
1426 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1427 if (round($median_value) != $median_value)
1431 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat->title .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2->title .
")";
1436 $median_value = $median[((
$total+1)/2)-1];
1443 $result_array[
"ARITHMETIC_MEAN"] =
"";
1444 $result_array[
"MEDIAN"] = $median_value;
1445 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1447 $cumulated_results = array();
1448 $cumulated_results[
"TOTAL"] = $result_array;
1452 $cumulated_results[$i] = $rowresult;
1454 return $cumulated_results;
1470 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1472 switch ($export_label)
1491 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1493 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1499 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1503 $worksheet->write(
$row, $column, $eval_data[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1506 switch ($export_label)
1515 foreach ($eval_data as $evalkey => $evalvalue)
1517 if (is_numeric($evalkey))
1520 $worksheet->write(
$row, 3+$add, $evalvalue[
"USERS_ANSWERED"]);
1521 $worksheet->write(
$row, 4+$add, $evalvalue[
"USERS_SKIPPED"]);
1524 $worksheet->write(
$row, 7+$add, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1526 $worksheet->write(
$row, 9+$add, $evalvalue[
"ARITHMETIC_MEAN"]);
1547 foreach ($eval_data as $evalkey => $evalvalue)
1550 if (is_numeric($evalkey))
1552 array_push($csvrow,
"");
1553 array_push($csvrow, $evalvalue[
"ROW"]);
1554 array_push($csvrow,
"");
1558 switch ($export_label)
1561 array_push($csvrow, $this->label);
1564 array_push($csvrow, $this->
getTitle());
1567 array_push($csvrow, $this->
getTitle());
1568 array_push($csvrow, $this->label);
1572 array_push($csvrow, $this->lng->txt($evalvalue[
"QUESTION_TYPE"]));
1574 array_push($csvrow, $evalvalue[
"USERS_ANSWERED"]);
1575 array_push($csvrow, $evalvalue[
"USERS_SKIPPED"]);
1576 array_push($csvrow, $evalvalue[
"MODE"]);
1577 array_push($csvrow, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1578 array_push($csvrow, $evalvalue[
"MEDIAN"]);
1579 array_push($csvrow, $evalvalue[
"ARITHMETIC_MEAN"]);
1596 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1597 $worksheet =& $workbook->addWorksheet();
1599 switch ($export_label)
1625 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1628 $worksheet->write($rowcounter, 1, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1631 preg_match(
"/(.*?)\s+-\s+(.*)/", $eval_data[
"TOTAL"][
"MODE"], $matches);
1646 foreach ($eval_data[
"TOTAL"][
"variables"] as $key => $value)
1649 $worksheet->write($rowcounter, 2, $key+1);
1654 foreach ($eval_data as $evalkey => $evalvalue)
1656 if (is_numeric($evalkey))
1661 $worksheet->write($rowcounter + 1, 1, $evalvalue[
"USERS_ANSWERED"]);
1663 $worksheet->write($rowcounter + 2, 1, $evalvalue[
"USERS_SKIPPED"]);
1664 $rowcounter = $rowcounter + 3;
1666 preg_match(
"/(.*?)\s+-\s+(.*)/", $evalvalue[
"MODE"], $matches);
1681 foreach ($evalvalue[
"variables"] as $key => $value)
1684 $worksheet->write($rowcounter, 2, $key+1);
1690 if (is_array($evalvalue[
"textanswers"]))
1696 foreach ($evalvalue[
"textanswers"] as $key => $answers)
1698 $title = $evalvalue[
"variables"][$key][
"title"];
1699 foreach ($answers as $answer)
1709 $format_center =& $workbook->addFormat();
1710 $format_center->setColor(
'black');
1711 $format_center->setAlign(
'center');
1717 $worksheet->write($rowcounter, $counter,
"", $format_title);
1718 foreach ($eval_data[
"TOTAL"][
"variables"] as $variable)
1725 foreach ($eval_data as $index => $data)
1727 if (is_numeric($index))
1731 foreach ($data[
"variables"] as $vardata)
1733 $worksheet->write($rowcounter, $counter, $vardata[
"selected"], $format_center);
1771 array_push($a_array,
$title);
1775 if(!$a_use_label || $a_substitute)
1777 array_push($a_array,
$title.
' - '. $this->lng->txt(
'other'));
1781 array_push($a_array,
"");
1793 if(!$a_use_label || $a_substitute)
1795 array_push($a_array, ($index+1) .
" - " . $col->title);
1799 array_push($a_array,
"");
1816 if (count($resultset[
"answers"][$this->
getId()]))
1818 array_push($a_array,
"");
1828 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1830 if ($result[
"rowvalue"] == $i)
1833 array_push($a_array, $result[
"value"] + 1);
1835 if ($result[
"textanswer"])
1837 $textanswer = $result[
"textanswer"];
1847 array_push($a_array, $textanswer);
1858 $checked_values = array();
1859 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1861 if ($result[
"rowvalue"] == $i)
1864 array_push($checked_values, $result[
"value"] + 1);
1866 if ($result[
"textanswer"])
1868 $textanswer = $result[
"textanswer"];
1878 array_push($a_array,
"");
1882 array_push($a_array, $textanswer);
1888 array_push($a_array,
"");
1893 $scale = $cat->scale;
1894 if (in_array($scale, $checked_values))
1896 array_push($a_array, $scale);
1900 array_push($a_array, 0);
1913 array_push($a_array,
"");
1919 array_push($a_array,
"");
1929 array_push($a_array,
"");
1950 $sql =
"SELECT svy_answer.* FROM svy_answer".
1951 " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
1952 " WHERE svy_answer.question_fi = ".$ilDB->quote($this->
getId(),
"integer").
1953 " AND svy_finished.survey_fi = ".$ilDB->quote(
$survey_id,
"integer");
1956 $sql .=
" AND ".$ilDB->in(
"svy_finished.finished_id", $finished_ids,
"",
"integer");
1958 $sql .=
" ORDER BY rowvalue, value";
1964 if (!is_array($answers[
$row[
"active_fi"]])) $answers[$row[
"active_fi"]] = array();
1965 $rowobj = $this->
getRow($row[
"rowvalue"]);
1966 array_push($answers[$row[
"active_fi"]], $rowobj->title . (($rowobj->other) ? (
" " . $row[
"textanswer"]) :
"") .
": " . ($row[
"value"] + 1) .
" - " . $column->title);
1968 foreach ($answers as $key => $value)
1970 $answers[$key] = implode(
"<br />", $value);
2002 $this->subtype = $a_subtype;
2022 $this->columnSeparators = 1;
2026 $this->columnSeparators = 0;
2039 return ($this->columnSeparators) ? 1 : 0;
2053 $this->rowSeparators = 1;
2057 $this->rowSeparators = 0;
2070 return ($this->rowSeparators) ? 1 : 0;
2084 $this->neutralColumnSeparator = 1;
2088 $this->neutralColumnSeparator = 0;
2101 return ($this->neutralColumnSeparator) ? 1 : 0;
2114 foreach ($a_meta as $key => $value)
2116 switch ($value[
"label"])
2118 case "column_separators":
2121 case "row_separators":
2127 case "neutral_column_separator":
2143 foreach ($a_data as $adjective)
2145 if (is_numeric($adjective[
"label"]))
2165 foreach ($a_data as
$row)
2167 $this->
addRow($row[
'title'], $row[
'other'], $row[
'label']);
2179 foreach ($a_data as
$id => $data)
2182 foreach ($data[
"material"] as
$material)
2184 $column .= $material[
"text"];
2186 $this->columns->addCategory($column, null, (strcmp($data[
"label"],
"neutral") == 0) ?
true :
false);
2221 include_once
"./Services/Form/classes/class.ilSelectInputGUI.php";
2225 $step3->setValue($default);
2238 function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
2243 "percent_row" => $percent_row,
2244 "percent_columns" => $percent_columns,
2245 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
2246 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
2247 "percent_neutral" => $percent_neutral
2249 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET layout = %s WHERE question_fi = %s",
2250 array(
'text',
'integer'),
2257 if (!is_array($this->layout) || count($this->layout) == 0)
2261 $this->layout = array(
2262 "percent_row" => 30,
2263 "percent_columns" => 40,
2264 "percent_bipolar_adjective1" => 10,
2265 "percent_bipolar_adjective2" => 10,
2266 "percent_neutral" => 10
2271 $this->layout = array(
2272 "percent_row" => 30,
2273 "percent_columns" => 50,
2274 "percent_bipolar_adjective1" => 10,
2275 "percent_bipolar_adjective2" => 10,
2276 "percent_neutral" => 0
2281 $this->layout = array(
2282 "percent_row" => 30,
2283 "percent_columns" => 50,
2284 "percent_bipolar_adjective1" => 0,
2285 "percent_bipolar_adjective2" => 0,
2286 "percent_neutral" => 20
2291 $this->layout = array(
2292 "percent_row" => 30,
2293 "percent_columns" => 70,
2294 "percent_bipolar_adjective1" => 0,
2295 "percent_bipolar_adjective2" => 0,
2296 "percent_neutral" => 0
2311 $this->layout = unserialize(
$layout);
2342 if ($column->neutral && strlen($column->title))
return true;
2354 $this->columnPlaceholders = ($a_value) ? 1 : 0;
2364 return ($this->columnPlaceholders) ? 1 : 0;
2374 $this->legend = ($a_value) ? 1 : 0;
2384 return ($this->legend) ? 1 : 0;
2389 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
2394 return ($this->singleLineRowCaption) ? 1 : 0;
2399 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
2404 return ($this->repeatColumnHeader) ? 1 : 0;
2409 $this->columnHeaderPosition = $a_value;
2414 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
2419 $this->randomRows = ($a_value) ? 1 : 0;
2424 return ($this->randomRows) ? 1 : 0;
2429 $this->columnOrder = $a_value;
2434 return ($this->columnOrder) ? $this->columnOrder : 0;
2439 $this->columnImages = ($a_value) ? 1 : 0;
2444 return ($this->columnImages) ? 1 : 0;
2449 $this->rowImages = ($a_value) ? 1 : 0;
2454 return ($this->rowImages) ? 1 : 0;
2472 include_once
"./Services/Utilities/classes/class.ilStr.php";
2481 'counter' => $counter,
2482 'title' => $counter.
'. '.$this->getTitle(),
2484 'users_answered' =>
$cumulated[
'TOTAL'][
'USERS_ANSWERED'],
2485 'users_skipped' =>
$cumulated[
'TOTAL'][
'USERS_SKIPPED'],
2486 'question_type' => $this->lng->txt(
$cumulated[
'TOTAL'][
'QUESTION_TYPE']),
2488 'mode_nr_of_selections' =>
$cumulated[
'TOTAL'][
'MODE_NR_OF_SELECTIONS'],
2490 'arithmetic_mean' =>
$cumulated[
'TOTAL'][
'ARITHMETIC_MEAN']
2496 if (is_numeric($key))
2498 if (strlen($value[
'ROW']) > $maxlen + 3)
2500 $value[
'ROW'] = ilStr::substr($value[
'ROW'], 0, $maxlen) .
"...";
2505 'question' => ($key+1) .
". " . $value[
'ROW'],
2506 'users_answered' => $value[
'USERS_ANSWERED'],
2507 'users_skipped' => $value[
'USERS_SKIPPED'],
2508 'question_type' =>
'',
2509 'mode' => $value[
"MODE"],
2510 'mode_nr_of_selections' => $value[
"MODE_NR_OF_SELECTIONS"],
2511 'median' => $value[
"MEDIAN"],
2512 'arithmetic_mean' => $value[
"ARITHMETIC_MEAN"]