4 include_once
"Modules/SurveyQuestionPool/classes/class.SurveyQuestionEvaluation.php";
25 for (
$r = 0;
$r < $this->question->getRowCount();
$r++)
32 $this->question->getColumns()
36 $this->question->getRow($r)->title,
50 public function getGrid($a_results, $a_abs =
true, $a_perc =
true)
60 $tmp = array_shift($tmp);
61 $vars = $tmp[1]->getVariables();
64 foreach($vars as $var)
66 $res[
"cols"][] = $var->cat->title;
70 foreach($a_results as $results_row)
74 ++$q_counter.
". ".$results_row[0]
77 $vars = $results_row[1]->getVariables();
80 foreach($vars as $var)
83 ? sprintf(
"%.2f", $var->perc*100).
"%" 86 if((
bool)$a_abs && (
bool)$a_perc)
88 $parsed_row[] = $var->abs.
" / ".$perc;
92 $parsed_row[] = $var->abs;
96 $parsed_row[] = $perc;
101 $res[
"rows"][] = $parsed_row;
110 foreach($a_results as $results_row)
112 $texts = $results_row[1]->getMappedTextAnswers();
115 $idx = $results_row[0];
116 foreach($texts as $answers)
118 foreach($answers as $answer)
120 $res[$idx][] = $answer;
133 include_once
"Services/Chart/classes/class.ilChart.php";
135 $chart->setXAxisToInteger(
true);
139 $chart->setColors($colors);
146 $row_idx =
sizeof($a_results);
149 $text_shortened =
false;
150 foreach($a_results as
$row)
154 $row_title = $row[0];
155 $row_results = $row[1];
158 $row_title = ++$row_counter.
". ".$row_title;
160 if($labels[$row_idx] != $row_title) {
161 $text_shortened =
true;
165 $vars = $row_results->getVariables();
168 foreach($vars as $idx => $var)
170 if(!array_key_exists($idx,
$data))
173 $data[$idx]->setLabel($var->cat->title);
174 $data[$idx]->setBarOptions(0.5,
"center",
true);
175 $data[$idx]->setFill(1);
183 $data[$idx]->addPoint($var->abs, $row_idx);
189 $this->chart_height = count($a_results)*40;
191 if($text_shortened) {
192 $this->chart_width = 500;
194 $chart->setSize($this->chart_width, $this->chart_height);
196 foreach(
$data as $var)
201 $chart->setTicks(
false, $labels,
true);
217 $question = $a_results[0][1]->getQuestion();
234 $row[] = (int)$a_results[0][1]->getUsersAnswered();
235 $row[] = (int)$a_results[0][1]->getUsersSkipped();
244 foreach($a_results as $row_result)
246 $row_title = $row_result[0];
247 $row_res = $row_result[1];
267 $row[] = is_array($row_res->getModeValue())
268 ? implode(
", ", $row_res->getModeValue())
269 : $row_res->getModeValue();
271 $row[] = $row_res->getModeValueAsText();
272 $row[] = (int)$row_res->getModeNrOfSelections();
275 $row[] = $row_res->getMedianAsText();
277 $row[] = $row_res->getMean();
288 for ($i = 0; $i < $this->question->getRowCount(); $i++)
291 $row = $this->question->getRow($i);
293 if($a_do_title && $a_do_label)
295 $a_title_row[] =
$row->title;
296 $a_title_row2[] =
$row->label;
298 if($this->question->getSubtype() == 0)
300 $a_title_row[] =
$row->title;
301 $a_title_row2[] =
$row->label;
306 $a_title_row[] =
$row->title;
307 $a_title_row2[] = $lng->txt(
'other');
312 $a_title_row[] =
$row->title;
313 $a_title_row2[] =
"";
315 if($this->question->getSubtype() == 0)
317 $a_title_row[] =
$row->title;
318 $a_title_row2[] =
"";
323 $a_title_row[] =
$row->title;
324 $a_title_row2[] = $lng->txt(
'other');
329 $a_title_row[] =
$row->label;
330 $a_title_row2[] =
"";
332 if($this->question->getSubtype() == 0)
334 $a_title_row[] =
$row->label;
335 $a_title_row2[] =
"";
340 $a_title_row[] =
$row->label;
341 $a_title_row2[] = $lng->txt(
'other');
346 if($this->question->getSubtype() == 1)
348 for($index = 0; $index < $this->question->getColumnCount(); $index++)
350 $col = $this->question->getColumn($index);
352 $a_title_row[] = $col->title.
" [".$col->scale.
"]";
353 $a_title_row2[] =
"";
361 $answer_map =
array();
362 foreach($a_results as $row_results)
364 $row_title = $row_results[0];
365 $row_result = $row_results[1];
367 $answers = $row_result->getUserResults($a_user_id);
368 if($answers !== null)
370 foreach($answers as $answer)
373 if($this->question->getSubtype() == 1)
375 $answer_map[$row_title.
"|".$answer[2]] = $answer[2];
379 $answer_map[$row_title] = $answer[3];
380 $answer_map[$row_title.
"|scale"] = $answer[2];
384 $answer_map[$row_title.
"|txt"] = $answer[1];
390 if(!
sizeof($answer_map))
399 for ($i = 0; $i < $this->question->getRowCount(); $i++)
401 $row = $this->question->getRow($i);
402 $row_title =
$row->title;
404 $a_row[] = $answer_map[$row_title];
405 if($this->question->getSubtype() == 0)
407 $a_row[] = $answer_map[$row_title .
"|scale"];
412 $a_row[] = $answer_map[$row_title.
"|txt"];
416 if($this->question->getSubtype() == 1)
418 for($index = 0; $index < $this->question->getColumnCount(); $index++)
420 $col = $this->question->getColumn($index);
421 $a_row[] = $answer_map[$row_title.
"|".$col->scale];
getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
exportResults($a_results, $a_do_title, $a_do_label)
Survey question evaluation.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
Survey matrix evaluation.
getTextAnswers($a_results)
Survey evaluation answers.
Create styles array
The data for the language used.
parseResults(ilSurveyEvaluationResults $a_results, array $a_answers, SurveyCategories $a_categories=null)
Parse answer data into results instance.
getSkippedValue()
Get caption for skipped value.
static getInstanceByType($a_type, $a_id)
Get type instance.
getGrid($a_results, $a_abs=true, $a_perc=true)