Survey matrix evaluation.
More...
|
| getResults () |
|
| getGrid ($a_results, $a_abs=true, $a_perc=true) |
|
| getTextAnswers ($a_results) |
|
| getChart ($a_results) |
|
| exportResults ($a_results, $a_do_title, $a_do_label) |
|
| getUserSpecificVariableTitles (array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label) |
|
| addUserSpecificResults (array &$a_row, $a_user_id, $a_results) |
|
| __construct (SurveyQuestion $a_question, array $a_finished_ids=null) |
| Constructor. More...
|
|
| getResults () |
| Get results. More...
|
|
| parseUserSpecificResults ($a_qres, $a_user_id) |
|
| getGrid ($a_results, $a_abs=true, $a_perc=true) |
| Get grid data. More...
|
|
| getTextAnswers ($a_results) |
| Get text answers. More...
|
|
| getChart ($a_results) |
| Get chart. More...
|
|
| getSkippedValue () |
| Get caption for skipped value. More...
|
|
| exportResults ($a_results, $a_do_title, $a_do_label) |
|
| getExportGrid ($a_results) |
| Get grid data. More...
|
|
| getUserSpecificVariableTitles (array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label) |
| Get title columns for user-specific export. More...
|
|
| addUserSpecificResults (array &$a_row, $a_user_id, $a_results) |
|
◆ addUserSpecificResults()
SurveyMatrixQuestionEvaluation::addUserSpecificResults |
( |
array & |
$a_row, |
|
|
|
$a_user_id, |
|
|
|
$a_results |
|
) |
| |
Definition at line 320 of file class.SurveyMatrixQuestionEvaluation.php.
References $i, $index, $row, array, and SurveyQuestionEvaluation\getSkippedValue().
322 $answer_map =
array();
323 foreach ($a_results as $row_results) {
324 $row_title = $row_results[0];
325 $row_result = $row_results[1];
327 $answers = $row_result->getUserResults($a_user_id);
328 if ($answers !== null) {
329 foreach ($answers as $answer) {
331 if ($this->question->getSubtype() == 1) {
332 $answer_map[$row_title .
"|" . $answer[2]] = $answer[2];
334 $answer_map[$row_title] = $answer[3];
335 $answer_map[$row_title .
"|scale"] = $answer[2];
338 $answer_map[$row_title .
"|txt"] = $answer[1];
344 if (!
sizeof($answer_map)) {
350 for (
$i = 0;
$i < $this->question->getRowCount();
$i++) {
351 $row = $this->question->getRow(
$i);
352 $row_title =
$row->title;
354 $a_row[] = $answer_map[$row_title];
355 if ($this->question->getSubtype() == 0) {
356 $a_row[] = $answer_map[$row_title .
"|scale"];
360 $a_row[] = $answer_map[$row_title .
"|txt"];
364 if ($this->question->getSubtype() == 1) {
366 $col = $this->question->getColumn(
$index);
367 $a_row[] = $answer_map[$row_title .
"|" . $col->scale];
Create styles array
The data for the language used.
getSkippedValue()
Get caption for skipped value.
◆ exportResults()
SurveyMatrixQuestionEvaluation::exportResults |
( |
|
$a_results, |
|
|
|
$a_do_title, |
|
|
|
$a_do_label |
|
) |
| |
Definition at line 195 of file class.SurveyMatrixQuestionEvaluation.php.
References SurveyQuestionEvaluation\$question, $row, $rows, SurveyQuestion\_getQuestionTypeName(), and array.
197 $question = $a_results[0][1]->getQuestion();
212 $row[] = (int) $a_results[0][1]->getUsersAnswered();
213 $row[] = (int) $a_results[0][1]->getUsersSkipped();
222 foreach ($a_results as $row_result) {
223 $row_title = $row_result[0];
224 $row_res = $row_result[1];
242 $row[] = is_array($row_res->getModeValue())
243 ? implode(
", ", $row_res->getModeValue())
244 : $row_res->getModeValue();
246 $row[] = $row_res->getModeValueAsText();
247 $row[] = (int) $row_res->getModeNrOfSelections();
250 $row[] = $row_res->getMedianAsText();
252 $row[] = $row_res->getMean();
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
Create styles array
The data for the language used.
◆ getChart()
SurveyMatrixQuestionEvaluation::getChart |
( |
|
$a_results | ) |
|
Definition at line 114 of file class.SurveyMatrixQuestionEvaluation.php.
References $chart, $data, $legend, SurveyQuestionEvaluation\$lng, $row, array, ilChartGrid\DATA_BARS, SurveyQuestionEvaluation\getChartColors(), ilChart\getInstanceByType(), ilUtil\shortenText(), and ilChart\TYPE_GRID.
118 include_once
"Services/Chart/classes/class.ilChart.php";
120 $chart->setXAxisToInteger(
true);
124 $chart->setColors($colors);
131 $row_idx =
sizeof($a_results);
134 $text_shortened =
false;
135 foreach ($a_results as
$row) {
138 $row_title = $row[0];
139 $row_results = $row[1];
142 $row_title = ++$row_counter .
". " . $row_title;
144 if ($labels[$row_idx] != $row_title) {
145 $text_shortened =
true;
149 $vars = $row_results->getVariables();
151 foreach ($vars as $idx => $var) {
152 if (!array_key_exists($idx,
$data)) {
154 $data[$idx]->setLabel($var->cat->title);
155 $data[$idx]->setBarOptions(0.5,
"center",
true);
156 $data[$idx]->setFill(1);
164 $data[$idx]->addPoint($var->abs, $row_idx);
170 $this->chart_height = count($a_results)*40;
172 if ($text_shortened) {
173 $this->chart_width = 500;
175 $chart->setSize($this->chart_width, $this->chart_height);
177 foreach (
$data as $var) {
181 $chart->setTicks(
false, $labels,
true);
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
Create styles array
The data for the language used.
static getInstanceByType($a_type, $a_id)
Get type instance.
◆ getGrid()
SurveyMatrixQuestionEvaluation::getGrid |
( |
|
$a_results, |
|
|
|
$a_abs = true , |
|
|
|
$a_perc = true |
|
) |
| |
Definition at line 49 of file class.SurveyMatrixQuestionEvaluation.php.
References SurveyQuestionEvaluation\$lng, $res, and array.
59 $tmp = array_shift($tmp);
60 $vars = $tmp[1]->getVariables();
62 foreach ($vars as $var) {
63 $res[
"cols"][] = $var->cat->title;
67 foreach ($a_results as $results_row) {
70 ++$q_counter .
". " . $results_row[0]
73 $vars = $results_row[1]->getVariables();
75 foreach ($vars as $var) {
77 ? sprintf(
"%.2f", $var->perc*100) .
"%" 80 if ((
bool) $a_abs && (
bool) $a_perc) {
81 $parsed_row[] = $var->abs .
" / " . $perc;
82 } elseif ((
bool) $a_abs) {
83 $parsed_row[] = $var->abs;
85 $parsed_row[] = $perc;
90 $res[
"rows"][] = $parsed_row;
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
◆ getResults()
SurveyMatrixQuestionEvaluation::getResults |
( |
| ) |
|
◆ getTextAnswers()
SurveyMatrixQuestionEvaluation::getTextAnswers |
( |
|
$a_results | ) |
|
Definition at line 95 of file class.SurveyMatrixQuestionEvaluation.php.
References $res, and array.
99 foreach ($a_results as $results_row) {
100 $texts = $results_row[1]->getMappedTextAnswers();
102 $idx = $results_row[0];
103 foreach ($texts as $answers) {
104 foreach ($answers as $answer) {
105 $res[$idx][] = $answer;
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
◆ getUserSpecificVariableTitles()
SurveyMatrixQuestionEvaluation::getUserSpecificVariableTitles |
( |
array & |
$a_title_row, |
|
|
array & |
$a_title_row2, |
|
|
|
$a_do_title, |
|
|
|
$a_do_label |
|
) |
| |
Definition at line 259 of file class.SurveyMatrixQuestionEvaluation.php.
References $i, $index, SurveyQuestionEvaluation\$lng, and $row.
263 for (
$i = 0;
$i < $this->question->getRowCount();
$i++) {
265 $row = $this->question->getRow(
$i);
267 if ($a_do_title && $a_do_label) {
268 $a_title_row[] =
$row->title;
269 $a_title_row2[] =
$row->label;
271 if ($this->question->getSubtype() == 0) {
272 $a_title_row[] =
$row->title;
273 $a_title_row2[] =
$row->label;
277 $a_title_row[] =
$row->title;
278 $a_title_row2[] =
$lng->txt(
'other');
280 } elseif ($a_do_title) {
281 $a_title_row[] =
$row->title;
282 $a_title_row2[] =
"";
284 if ($this->question->getSubtype() == 0) {
285 $a_title_row[] =
$row->title;
286 $a_title_row2[] =
"";
290 $a_title_row[] =
$row->title;
291 $a_title_row2[] =
$lng->txt(
'other');
294 $a_title_row[] =
$row->label;
295 $a_title_row2[] =
"";
297 if ($this->question->getSubtype() == 0) {
298 $a_title_row[] =
$row->label;
299 $a_title_row2[] =
"";
303 $a_title_row[] =
$row->label;
304 $a_title_row2[] =
$lng->txt(
'other');
309 if ($this->question->getSubtype() == 1) {
311 $col = $this->question->getColumn(
$index);
313 $a_title_row[] = $col->title .
" [" . $col->scale .
"]";
314 $a_title_row2[] =
"";
The documentation for this class was generated from the following file: