53 $this->survey = $this->mgr->item;
54 $qPk = $this->mgr->getQuestionKey();
58 $this->questions = $this->mgr->getQuestions();
60 if(count($this->questions) > 0)
65 $this->responseCount = $this->mgr->getResponseCount();
66 $this->answers = regroupList(
$answers, $qPk);
81 $qPk = $this->mgr->getQuestionKey();
122 trace(
"getAggregateData: Unknown question type {$questionType->class_name}", 2);
123 die(
"QuestionniareDataView getAggregateData: Unknown question type {$questionType->class_name}");
134 $qPk = $this->mgr->getQuestionKey();
141 $answerValues = regroupList(
$answers,
"value");
143 $answerValues = array();
148 $count = count($answerValues[$idx]);
165 $qPk = $this->mgr->getQuestionKey();
167 $answerValues = regroupList(
$answers,
"value");
172 $steps = count($optionText);
174 for($idx = 1; $idx <= $steps; ++$idx)
178 $counts[$idx] = count($answerValues[$idx]);
193 $optionText = array();
197 if (!
$to)
$to =
"Highest";
198 if (!$steps) $steps = 5;
200 for($idx = 1; $idx <= $steps; ++$idx)
202 if($idx > 1 AND $idx < $steps)
203 $optionText[$idx] = $idx;
205 $optionText[$idx] = ($idx == 1) ?
$from :
$to;
215 foreach($counts as $value =>
$count)
217 $total += $value *
$count;
221 $mean = ($num > 0) ? round($total / $num, 2) : 0;
238 $odd = $no_elements % 2;
244 $the_index_1 = $no_elements / 2;
247 settype($the_index_1,
"integer");
255 $the_index_1 = $no_elements / 2;
256 $the_index_2 = $the_index_1 - 1;
273 $qPk = $this->mgr->getQuestionKey();
285 $count = $answerCounts[$idx];
307 if(strlen($values)==1 AND is_numeric($values))
308 $values = array($values);
309 elseif(strlen($values)==0)
312 $values = explode(
",", $values);
314 foreach($values as $value => $idx)
324 $script = $this->optionDataView->writeScript();
325 $script .= $this->textDataView->writeScript();
332 $dataView =
new GroupedDataListView($this->optionAnswers,
"OptionDataList");
333 $dataView->column(
"Option",
"{option}",
false,
"width: 90%")
334 ->column(
"Count",
"{count}",
false,
"width: 10%");
335 $dataView->groupBy($this->questions, array($this,
getGroupTitle));
336 $dataView->mode =
'tree';
337 $dataView->emptyMessage =
"There are no aggregated data results.";
338 $dataView->excelFile =
"option_surveyData.xls";
339 $this->optionDataView = $dataView;
352 $table =
new GroupedDataListView($this->textAnswers,
"AnswerTextList");
356 $table->emptyMessage =
"There are no text results.";
357 $table->excelFile =
"text_surveyData.xls";
359 $this->textDataView =
$table;
377 $this->optionDataView->drawView();
378 echo
"<h4>Free Text Responses</h4>";
379 $this->textDataView->drawView();
392 $fn = array($this->mgr, formatResultsHeading);
393 if (is_callable($fn))
395 return call_user_func($fn);
398 $recipientCount = $this->mgr->getRecipientCount();
401 $text =
"<h3>Aggregated Survey Answers based on $countText ";
402 $text .= ($recipientCount) ?
"out of $recipientCount " :
"";
403 $text .=
"Respondents</h3>\n";
static usingFeature()
Uses the specified framework feature(s).
static using()
Import the datamodels, views and manifest for the specified component(s).
static getQuestionTypeList()
getCheckListQuestionResultData($question, $answers)
static formatQuestion($question)
QuestionnaireDataView($mgr)
getAggregateData($question, $answers)
static formatAnswer($answer)
static getCheckListAnswerCounts($answers)
getRatingsQuestionResultData($question, $answers)
getSingleSelectQuestionResultData($question, $answers)
getMedian($optionAnswers)