24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
174 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyCategories.php";
176 $this->rows = array();
177 $this->neutralColumn =
"";
178 $this->bipolar_adjective1 =
"";
179 $this->bipolar_adjective2 =
"";
180 $this->rowSeparators = 0;
181 $this->columnSeparators = 0;
182 $this->neutralColumnSeparator = 1;
225 $this->neutralColumn = $a_text;
237 return $this->columns->getCategoryCount();
250 $this->columns->addCategoryAtPosition($columnname, $position);
263 $this->columns->addCategory($columnname);
275 $this->columns->addCategoryArray(
$columns);
287 $this->columns->removeCategory($index);
299 $this->columns->removeCategories($array);
311 $this->columns->removeCategoryWithName(
$name);
332 return $this->columns->getCategory($index);
344 return $this->columns->getCategoryIndex(
$name);
356 $this->columns->flushCategories();
367 return count($this->rows);
377 array_push($this->rows, $a_text);
388 if (array_key_exists($a_position, $this->rows))
390 $head = array_slice($this->rows, 0, $a_position);
391 $tail = array_slice($this->rows, $a_position);
392 $this->rows = array_merge($head, array($a_text), $tail);
396 array_push($this->rows, $a_text);
408 $this->rows = array();
419 if (array_key_exists($a_index, $this->rows))
421 return $this->rows[$a_index];
430 $temp = $this->rows[$index-1];
431 $this->rows[$index - 1] = $this->rows[$index];
432 $this->rows[$index] = $temp;
438 if ($index < (count($this->rows)-1))
440 $temp = $this->rows[$index+1];
441 $this->rows[$index + 1] = $this->rows[$index];
442 $this->rows[$index] = $temp;
455 foreach ($array as $index)
457 unset($this->rows[$index]);
459 $this->rows = array_values($this->rows);
469 unset($this->rows[$index]);
470 $this->rows = array_values($this->rows);
485 return (strlen($this->bipolar_adjective2)) ? $this->bipolar_adjective2 : NULL;
489 return (strlen($this->bipolar_adjective1)) ? $this->bipolar_adjective1 : NULL;
507 $this->bipolar_adjective2 = $a_value;
511 $this->bipolar_adjective1 = $a_value;
527 $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",
528 array(
'integer',
'integer',
'integer'),
529 array($phrase_id, 0, $ilUser->getId())
533 if ((
$row[
"defaultvalue"] == 1) && (
$row[
"owner_fi"] == 0))
561 return $ilDB->fetchAssoc(
$result);
591 include_once(
"./Services/RTE/classes/class.ilRTE.php");
614 $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",
622 if (
$data[
"neutral"] == 0)
633 $result = $ilDB->queryF(
"SELECT * FROM svy_qst_matrixrows WHERE question_fi = %s ORDER BY sequence",
674 function saveToDb($original_id = NULL, $withanswers =
true)
680 if ($affectedRows == 1)
682 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
684 array($this->
getId())
687 question_fi, subtype, column_separators, row_separators, neutral_column_separator,column_placeholders,
688 legend, singleline_row_caption, repeat_column_header, column_header_position, random_rows,
689 column_order, column_images, row_images, bipolar_adjective1, bipolar_adjective2, layout, tstamp)
690 VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
692 'integer',
'integer',
'text',
'text',
'text',
'integer',
'text',
'text',
'text',
693 'text',
'text',
'text',
'text',
'text',
'text',
'text',
'text',
'integer'
729 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET bipolar_adjective1 = %s, bipolar_adjective2 = %s WHERE question_fi = %s",
730 array(
'text',
'text',
'integer'),
731 array((strlen($adjective1)) ? $adjective1 : NULL, (strlen($adjective2)) ? $adjective2 : NULL, $this->
getId())
745 global $ilUser,
$ilDB;
747 $result = $ilDB->queryF(
"SELECT title, category_id FROM svy_category WHERE title = %s AND neutral = %s AND owner_fi = %s",
748 array(
'text',
'text',
'integer'),
749 array($columntext, $neutral, $ilUser->getId())
758 if (strcmp(
$row[
"title"], $columntext) == 0)
760 $returnvalue =
$row[
"category_id"];
771 $next_id = $ilDB->nextId(
'svy_category');
772 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
773 array(
'integer',
'text',
'text',
'integer',
'text',
'integer'),
774 array($next_id, $columntext, 0, $ilUser->getId(), $neutral, time())
776 $returnvalue = $next_id;
786 $question_id = $this->
getId();
787 if (strlen($original_id))
789 $question_id = $original_id;
793 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_variable WHERE question_fi = %s",
802 $next_id = $ilDB->nextId(
'svy_variable');
803 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
804 array(
'integer',
'integer',
'integer',
'float',
'float',
'integer',
'integer'),
805 array($next_id, $column_id, $question_id, ($i + 1), NULL, $i, time())
811 $next_id = $ilDB->nextId(
'svy_variable');
812 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
813 array(
'integer',
'integer',
'integer',
'float',
'float',
'integer',
'integer'),
814 array($next_id, $column_id, $question_id, ($i + 1), NULL, $i, time())
825 $question_id = $this->
getId();
826 if (strlen($original_id))
828 $question_id = $original_id;
832 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
840 $next_id = $ilDB->nextId(
'svy_qst_matrixrows');
841 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_qst_matrixrows (id_svy_qst_matrixrows, title, sequence, question_fi) VALUES (%s, %s, %s, %s)",
842 array(
'integer',
'text',
'integer',
'integer'),
843 array($next_id,
$row, $i, $question_id)
855 function toXML($a_include_header = TRUE, $obligatory_state =
"")
857 include_once(
"./classes/class.ilXmlWriter.php");
860 $this->
insertXML($a_xml_writer, $a_include_header, $obligatory_state);
861 $xml = $a_xml_writer->xmlDumpMem(FALSE);
862 if (!$a_include_header)
864 $pos = strpos($xml,
"?>");
865 $xml = substr($xml, $pos + 2);
878 function insertXML(&$a_xml_writer, $a_include_header = TRUE, $obligatory_state =
"")
881 "id" => $this->
getId(),
883 "type" => $this->getQuestiontype(),
887 $a_xml_writer->xmlStartTag(
"question", $attrs);
889 $a_xml_writer->xmlElement(
"description", NULL, $this->
getDescription());
890 $a_xml_writer->xmlElement(
"author", NULL, $this->
getAuthor());
891 $a_xml_writer->xmlStartTag(
"questiontext");
893 $a_xml_writer->xmlEndTag(
"questiontext");
895 $a_xml_writer->xmlStartTag(
"matrix");
896 $a_xml_writer->xmlStartTag(
"matrixrows");
902 $a_xml_writer->xmlStartTag(
"matrixrow", $attrs);
904 $a_xml_writer->xmlEndTag(
"matrixrow");
906 $a_xml_writer->xmlEndTag(
"matrixrows");
908 $a_xml_writer->xmlStartTag(
"responses");
911 $a_xml_writer->xmlStartTag(
"bipolar_adjectives");
920 $a_xml_writer->xmlEndTag(
"bipolar_adjectives");
930 $a_xml_writer->xmlStartTag(
"response_single", $attrs);
933 $a_xml_writer->xmlStartTag(
"response_multiple", $attrs);
940 $a_xml_writer->xmlEndTag(
"response_single");
943 $a_xml_writer->xmlEndTag(
"response_multiple");
956 $a_xml_writer->xmlStartTag(
"response_single", $attrs);
959 $a_xml_writer->xmlStartTag(
"response_multiple", $attrs);
966 $a_xml_writer->xmlEndTag(
"response_single");
969 $a_xml_writer->xmlEndTag(
"response_multiple");
974 $a_xml_writer->xmlEndTag(
"responses");
975 $a_xml_writer->xmlEndTag(
"matrix");
977 if (count($this->material))
979 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $this->material[
"internal_link"], $matches))
982 "label" => $this->material[
"title"]
984 $a_xml_writer->xmlStartTag(
"material", $attrs);
985 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
986 if (strcmp($matches[1],
"") != 0)
988 $intlink = $this->material[
"internal_link"];
990 $a_xml_writer->xmlElement(
"mattext", NULL, $intlink);
991 $a_xml_writer->xmlEndTag(
"material");
995 $a_xml_writer->xmlStartTag(
"metadata");
996 $a_xml_writer->xmlStartTag(
"metadatafield");
997 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"column_separators");
999 $a_xml_writer->xmlEndTag(
"metadatafield");
1001 $a_xml_writer->xmlStartTag(
"metadatafield");
1002 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"row_separators");
1004 $a_xml_writer->xmlEndTag(
"metadatafield");
1006 $a_xml_writer->xmlStartTag(
"metadatafield");
1007 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"neutral_column_separator");
1009 $a_xml_writer->xmlEndTag(
"metadatafield");
1011 $a_xml_writer->xmlStartTag(
"metadatafield");
1012 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"layout");
1013 $a_xml_writer->xmlElement(
"fieldentry", NULL, serialize($this->
getLayout()));
1014 $a_xml_writer->xmlEndTag(
"metadatafield");
1016 $a_xml_writer->xmlEndTag(
"metadata");
1018 $a_xml_writer->xmlEndTag(
"question");
1041 for ($i = $lower_limit; $i <= $upper_limit; $i++)
1059 $next_id = $ilDB->nextId(
'svy_phrase');
1060 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
1061 array(
'integer',
'text',
'text',
'integer',
'integer'),
1062 array($next_id,
$title, 1, $ilUser->getId(), time())
1064 $phrase_id = $next_id;
1067 foreach ($phrases as $category)
1069 $next_id = $ilDB->nextId(
'svy_category');
1070 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, neutral, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
1071 array(
'integer',
'text',
'text',
'integer',
'text',
'integer'),
1072 array($next_id, $category, 1, $ilUser->getId(), 0, time())
1074 $column_id = $next_id;
1075 $next_id = $ilDB->nextId(
'svy_phrase_cat');
1076 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
1077 array(
'integer',
'integer',
'integer',
'integer'),
1078 array($next_id, $phrase_id, $column_id, $counter)
1092 return "SurveyMatrixQuestion";
1103 return "svy_qst_matrix";
1115 foreach ($post_data as
$key => $value)
1120 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1122 if (is_array($value))
1124 foreach ($value as $val)
1126 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1]));
1131 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1]));
1136 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1138 if (is_array($value))
1140 foreach ($value as $val)
1142 array_push(
$data, array(
"value" => $val,
"rowvalue" => $matches[1]));
1147 array_push(
$data, array(
"value" => $value,
"rowvalue" => $matches[1]));
1172 foreach ($post_data as
$key => $value)
1174 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1179 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_radio_button_not_checked");
1183 foreach ($post_data as
$key => $value)
1185 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1188 if ((!is_array($value)) || (count($value) < 1))
1190 return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1194 if ($counter != $this->
getRowCount())
return $this->lng->txt(
"matrix_question_checkbox_not_checked");
1211 if ($this->getSubType() == 1)
1214 for ($i = 0; $i < $columncount; $i++)
1218 $next_id = $ilDB->nextId(
'svy_answer');
1219 $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)",
1220 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1221 array($next_id, $this->
getId(), $active_id, $i, NULL,
$row, time())
1229 $category = rand(0, $columncount-1);
1230 $next_id = $ilDB->nextId(
'svy_answer');
1231 $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)",
1232 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1233 array($next_id, $this->
getId(), $active_id, $category, NULL,
$row, time())
1246 foreach ($post_data as
$key => $value)
1248 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1250 $next_id = $ilDB->nextId(
'svy_answer');
1251 $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)",
1252 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1253 array($next_id, $this->
getId(), $active_id, $value, NULL, $matches[1], time())
1259 foreach ($post_data as
$key => $value)
1261 if (preg_match(
"/matrix_" . $this->
getId() .
"_(\d+)/",
$key, $matches))
1263 foreach ($value as $checked)
1265 if (strlen($checked))
1267 $next_id = $ilDB->nextId(
'svy_answer');
1268 $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)",
1269 array(
'integer',
'integer',
'integer',
'float',
'text',
'integer',
'integer'),
1270 array($next_id, $this->
getId(), $active_id, $checked, NULL, $matches[1], time())
1291 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_qst_matrixrows WHERE question_fi = %s",
1308 $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",
1309 array(
'integer',
'integer'),
1315 $found[
$row[
"active_fi"].$row[
"question_fi"]] = 1;
1317 return count($found);
1332 $question_id = $this->
getId();
1334 $result_array = array();
1337 $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",
1338 array(
'integer',
'integer',
'integer'),
1354 $numrows =
$result->numRows();
1364 $result_array[
"MODE"] = $prefix . $cat;
1365 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1375 $result_array[
"variables"][
$key] = array(
"title" => $cat,
"selected" => (
int)
$cumulated[
$key],
"percentage" => $percentage);
1392 for ($i = 0; $i <
$key; $i++)
1394 array_push($median, $value+1);
1401 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1402 if (round($median_value) != $median_value)
1404 $cat = $this->
getColumn((
int)floor($median_value)-1);
1405 $cat2 = $this->
getColumn((
int)ceil($median_value)-1);
1406 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2 .
")";
1411 $median_value = $median[((
$total+1)/2)-1];
1418 $result_array[
"ARITHMETIC_MEAN"] =
"";
1419 $result_array[
"MEDIAN"] = $median_value;
1420 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1421 $result_array[
"ROW"] = $this->
getRow($rowindex);
1422 return $result_array;
1436 $question_id = $this->
getId();
1438 $result_array = array();
1441 $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",
1442 array(
'integer',
'integer'),
1458 $numrows =
$result->numRows();
1468 $result_array[
"MODE"] = $prefix . $cat;
1469 $result_array[
"MODE_VALUE"] = key(
$cumulated)+1;
1479 $result_array[
"variables"][
$key] = array(
"title" => $cat,
"selected" => (
int)
$cumulated[
$key],
"percentage" => $percentage);
1496 for ($i = 0; $i <
$key; $i++)
1498 array_push($median, $value+1);
1505 $median_value = 0.5 * ($median[(
$total/2)-1] + $median[(
$total/2)]);
1506 if (round($median_value) != $median_value)
1508 $cat = $this->
getColumn((
int)floor($median_value)-1);
1509 $cat2 = $this->
getColumn((
int)ceil($median_value)-1);
1510 $median_value = $median_value .
"<br />" .
"(" . $this->lng->txt(
"median_between") .
" " . (floor($median_value)) .
"-" . $cat .
" " . $this->lng->txt(
"and") .
" " . (ceil($median_value)) .
"-" . $cat2 .
")";
1515 $median_value = $median[((
$total+1)/2)-1];
1522 $result_array[
"ARITHMETIC_MEAN"] =
"";
1523 $result_array[
"MEDIAN"] = $median_value;
1524 $result_array[
"QUESTION_TYPE"] =
"SurveyMatrixQuestion";
1526 $cumulated_results = array();
1527 $cumulated_results[
"TOTAL"] = $result_array;
1531 $cumulated_results[$i] = $rowresult;
1533 return $cumulated_results;
1549 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1553 $worksheet->write(
$row, 3, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1554 $worksheet->write(
$row, 4, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1557 $worksheet->write(
$row, 7, $eval_data[
"TOTAL"][
"MODE_NR_OF_SELECTIONS"]);
1559 $worksheet->write(
$row, 9, $eval_data[
"TOTAL"][
"ARITHMETIC_MEAN"]);
1561 foreach ($eval_data as $evalkey => $evalvalue)
1563 if (is_numeric($evalkey))
1566 $worksheet->write(
$row, 3, $evalvalue[
"USERS_ANSWERED"]);
1567 $worksheet->write(
$row, 4, $evalvalue[
"USERS_SKIPPED"]);
1570 $worksheet->write(
$row, 7, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1572 $worksheet->write(
$row, 9, $evalvalue[
"ARITHMETIC_MEAN"]);
1593 foreach ($eval_data as $evalkey => $evalvalue)
1596 if (is_numeric($evalkey))
1598 array_push($csvrow,
"");
1599 array_push($csvrow, $evalvalue[
"ROW"]);
1600 array_push($csvrow,
"");
1604 array_push($csvrow, $this->
getTitle());
1606 array_push($csvrow, $this->lng->txt($evalvalue[
"QUESTION_TYPE"]));
1608 array_push($csvrow, $evalvalue[
"USERS_ANSWERED"]);
1609 array_push($csvrow, $evalvalue[
"USERS_SKIPPED"]);
1610 array_push($csvrow, $evalvalue[
"MODE"]);
1611 array_push($csvrow, $evalvalue[
"MODE_NR_OF_SELECTIONS"]);
1612 array_push($csvrow, $evalvalue[
"MEDIAN"]);
1613 array_push($csvrow, $evalvalue[
"ARITHMETIC_MEAN"]);
1630 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1631 $worksheet =& $workbook->addWorksheet();
1639 $worksheet->write(3, 1, $eval_data[
"TOTAL"][
"USERS_ANSWERED"]);
1641 $worksheet->write(4, 1, $eval_data[
"TOTAL"][
"USERS_SKIPPED"]);
1644 preg_match(
"/(.*?)\s+-\s+(.*)/", $eval_data[
"TOTAL"][
"MODE"], $matches);
1659 foreach ($eval_data[
"TOTAL"][
"variables"] as
$key => $value)
1662 $worksheet->write($rowcounter, 2,
$key+1);
1667 foreach ($eval_data as $evalkey => $evalvalue)
1669 if (is_numeric($evalkey))
1674 $worksheet->write($rowcounter + 1, 1, $evalvalue[
"USERS_ANSWERED"]);
1676 $worksheet->write($rowcounter + 2, 1, $evalvalue[
"USERS_SKIPPED"]);
1677 $rowcounter = $rowcounter + 3;
1679 preg_match(
"/(.*?)\s+-\s+(.*)/", $evalvalue[
"MODE"], $matches);
1694 foreach ($evalvalue[
"variables"] as
$key => $value)
1697 $worksheet->write($rowcounter, 2,
$key+1);
1704 $format_center =& $workbook->addFormat();
1705 $format_center->setColor(
'black');
1706 $format_center->setAlign(
'center');
1712 $worksheet->write($rowcounter, $counter,
"", $format_title);
1713 foreach ($eval_data[
"TOTAL"][
"variables"] as $variable)
1720 foreach ($eval_data as $index =>
$data)
1722 if (is_numeric($index))
1726 foreach (
$data[
"variables"] as $vardata)
1728 $worksheet->write($rowcounter, $counter, $vardata[
"selected"], $format_center);
1747 array_push($a_array, $this->
getRow($i));
1756 array_push($a_array, ($index+1) .
" - $col");
1776 if (count($resultset[
"answers"][$this->
getId()]))
1778 array_push($a_array,
"");
1785 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1787 if (
$result[
"rowvalue"] == $i)
1790 array_push($a_array,
$result[
"value"] + 1);
1795 array_push($a_array, $this->lng->txt(
"skipped"));
1803 $checked_values = array();
1804 foreach ($resultset[
"answers"][$this->
getId()] as
$result)
1806 if ($result[
"rowvalue"] == $i)
1809 array_push($checked_values, $result[
"value"] + 1);
1814 array_push($a_array, $this->lng->txt(
"skipped"));
1818 array_push($a_array,
"");
1824 array_push($a_array,
"");
1828 if (in_array($index+1, $checked_values))
1830 array_push($a_array, 1);
1834 array_push($a_array, 0);
1842 array_push($a_array,
"");
1848 array_push($a_array, 1);
1852 array_push($a_array, 0);
1862 array_push($a_array, $this->lng->txt(
"skipped"));
1865 array_push($a_array,
"");
1873 array_push($a_array,
"");
1877 array_push($a_array,
"");
1898 $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",
1899 array(
'integer',
'integer'),
1906 if (!is_array($answers[
$row[
"active_fi"]])) $answers[$row[
"active_fi"]] = array();
1907 array_push($answers[$row[
"active_fi"]], $this->
getRow($row[
"rowvalue"]) .
": " . ($row[
"value"] + 1) .
" - " . $column);
1909 foreach ($answers as
$key => $value)
1911 $answers[
$key] = implode(
"<br />", $value);
1943 $this->subtype = $a_subtype;
1963 $this->columnSeparators = 1;
1967 $this->columnSeparators = 0;
1980 return ($this->columnSeparators) ? 1 : 0;
1994 $this->rowSeparators = 1;
1998 $this->rowSeparators = 0;
2011 return ($this->rowSeparators) ? 1 : 0;
2025 $this->neutralColumnSeparator = 1;
2029 $this->neutralColumnSeparator = 0;
2042 return ($this->neutralColumnSeparator) ? 1 : 0;
2055 foreach ($a_meta as
$key => $value)
2057 switch ($value[
"label"])
2059 case "column_separators":
2062 case "row_separators":
2068 case "neutral_column_separator":
2084 foreach ($a_data as $adjective)
2086 if (is_numeric($adjective[
"label"]))
2106 foreach ($a_data as
$row)
2125 $column .= $material[
"text"];
2127 if (strcmp(
$data[
"label"],
"neutral") == 0)
2171 if (count($this->cumulated) == 0)
2173 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
2178 if (is_numeric(
$type))
2180 foreach ($this->cumulated[
$type][
"variables"] as
$key => $value)
2182 foreach ($value as $key2 => $value2)
2184 $this->cumulated[
"variables"][
$key][$key2] = utf8_decode($value2);
2188 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyChart.php";
2189 $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"]);
2202 function saveLayout($percent_row, $percent_columns, $percent_bipolar_adjective1 =
"", $percent_bipolar_adjective2 =
"", $percent_neutral)
2207 "percent_row" => $percent_row,
2208 "percent_columns" => $percent_columns,
2209 "percent_bipolar_adjective1" => $percent_bipolar_adjective1,
2210 "percent_bipolar_adjective2" => $percent_bipolar_adjective2,
2211 "percent_neutral" => $percent_neutral
2213 $affectedRows = $ilDB->manipulateF(
"UPDATE " . $this->
getAdditionalTableName() .
" SET layout = %s WHERE question_fi = %s",
2214 array(
'text',
'integer'),
2221 if (!is_array($this->layout) || count($this->layout) == 0)
2225 $this->layout = array(
2226 "percent_row" => 30,
2227 "percent_columns" => 40,
2228 "percent_bipolar_adjective1" => 10,
2229 "percent_bipolar_adjective2" => 10,
2230 "percent_neutral" => 10
2235 $this->layout = array(
2236 "percent_row" => 30,
2237 "percent_columns" => 50,
2238 "percent_bipolar_adjective1" => 10,
2239 "percent_bipolar_adjective2" => 10,
2240 "percent_neutral" => 0
2245 $this->layout = array(
2246 "percent_row" => 30,
2247 "percent_columns" => 50,
2248 "percent_bipolar_adjective1" => 0,
2249 "percent_bipolar_adjective2" => 0,
2250 "percent_neutral" => 20
2255 $this->layout = array(
2256 "percent_row" => 30,
2257 "percent_columns" => 70,
2258 "percent_bipolar_adjective1" => 0,
2259 "percent_bipolar_adjective2" => 0,
2260 "percent_neutral" => 0
2275 $this->layout = unserialize(
$layout);
2320 $this->columnPlaceholders = ($a_value) ? 1 : 0;
2330 return ($this->columnPlaceholders) ? 1 : 0;
2340 $this->legend = ($a_value) ? 1 : 0;
2350 return ($this->legend) ? 1 : 0;
2355 $this->singleLineRowCaption = ($a_value) ? 1 : 0;
2360 return ($this->singleLineRowCaption) ? 1 : 0;
2365 $this->repeatColumnHeader = ($a_value) ? 1 : 0;
2370 return ($this->repeatColumnHeader) ? 1 : 0;
2375 $this->columnHeaderPosition = $a_value;
2380 return ($this->columnHeaderPosition) ? $this->columnHeaderPosition : 0;
2385 $this->randomRows = ($a_value) ? 1 : 0;
2390 return ($this->randomRows) ? 1 : 0;
2395 $this->columnOrder = $a_value;
2400 return ($this->columnOrder) ? $this->columnOrder : 0;
2405 $this->columnImages = ($a_value) ? 1 : 0;
2410 return ($this->columnImages) ? 1 : 0;
2415 $this->rowImages = ($a_value) ? 1 : 0;
2420 return ($this->rowImages) ? 1 : 0;
2440 include_once
"./Services/Utilities/classes/class.ilStr.php";
2445 'counter' => $counter,
2448 'users_answered' =>
$cumulated[
'TOTAL'][
'USERS_ANSWERED'],
2449 'users_skipped' =>
$cumulated[
'TOTAL'][
'USERS_SKIPPED'],
2450 'question_type' => $this->lng->txt(
$cumulated[
'TOTAL'][
'QUESTION_TYPE']),
2452 'mode_nr_of_selections' =>
$cumulated[
'TOTAL'][
'MODE_NR_OF_SELECTIONS'],
2454 'arithmetic_mean' =>
$cumulated[
'TOTAL'][
'ARITHMETIC_MEAN']
2459 if (is_numeric(
$key))
2463 'question' => (
$key+1) .
". " . $value[
"ROW"],
2464 'users_answered' => $value[
'USERS_ANSWERED'],
2465 'users_skipped' => $value[
'USERS_SKIPPED'],
2466 'question_type' =>
'',
2467 'mode' => $value[
"MODE"],
2468 'mode_nr_of_selections' => $value[
"MODE_NR_OF_SELECTIONS"],
2469 'median' => $value[
"MEDIAN"],
2470 'arithmetic_mean' => $value[
"ARITHMETIC_MEAN"]