Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions questionnaire.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ private function has_required($section = 0) {
return true;
}
}
} else {
} else if (key_exists($section, $this->questionsbysec)) {
foreach ($this->questionsbysec[$section] as $questionid) {
if ($this->questions[$questionid]->required()) {
return true;
Expand Down Expand Up @@ -1326,21 +1326,23 @@ private function survey_render(&$formdata, $section = 1, $message = '') {
$this->page->add_to_page('progressbar',
$this->renderer->render_progress_bar($section, $this->questionsbysec));
}
foreach ($this->questionsbysec[$section] as $questionid) {
if ($this->questions[$questionid]->is_numbered()) {
$i++;
}
// Need questionnaire id to get the questionnaire object in sectiontext (Label) question class.
$formdata->questionnaire_id = $this->id;
if (isset($formdata->rid) && !empty($formdata->rid)) {
$this->add_response($formdata->rid);
} else {
$this->add_response_from_formdata($formdata);
if (key_exists($section, $this->questionsbysec)) {
foreach ($this->questionsbysec[$section] as $questionid) {
if ($this->questions[$questionid]->is_numbered()) {
$i++;
}
// Need questionnaire id to get the questionnaire object in sectiontext (Label) question class.
$formdata->questionnaire_id = $this->id;
if (isset($formdata->rid) && !empty($formdata->rid)) {
$this->add_response($formdata->rid);
} else {
$this->add_response_from_formdata($formdata);
}
$this->page->add_to_page('questions',
$this->renderer->question_output($this->questions[$questionid],
(isset($this->responses[$formdata->rid]) ? $this->responses[$formdata->rid] : []),
$i, $this->usehtmleditor, []));
}
$this->page->add_to_page('questions',
$this->renderer->question_output($this->questions[$questionid],
(isset($this->responses[$formdata->rid]) ? $this->responses[$formdata->rid] : []),
$i, $this->usehtmleditor, []));
}

$this->print_survey_end($section, $numsections);
Expand Down