public function display_results($rids = false, $sort = '', $anonymous = false) { $output = ''; if (is_array($rids)) { $prtotal = 1; } else { if (is_int($rids)) { $prtotal = 0; } } if ($rows = $this->get_results($rids, $anonymous)) { // Count identical answers (numeric questions only). foreach ($rows as $row) { if (!empty($row->response) || $row->response === "0") { $this->text = $row->response; $textidx = clean_text($this->text); $this->counts[$textidx] = !empty($this->counts[$textidx]) ? $this->counts[$textidx] + 1 : 1; $this->userid[$textidx] = !empty($this->counts[$textidx]) ? $this->counts[$textidx] + 1 : 1; } } $isnumeric = $this->question->type_id == QUESNUMERIC; if ($isnumeric) { $output .= \mod_questionnaire\response\display_support::mkreslistnumeric($this->counts, count($rids), $this->question->precise); } else { $output .= \mod_questionnaire\response\display_support::mkreslisttext($rows); } } else { $output .= '<p class="generaltable"> ' . get_string('noresponsedata', 'questionnaire') . '</p>'; } return $output; }