Ok, I think I've figured this out. The elseif statement in tabs.php around line 153 should be:
} else if (($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_ALWAYS ||
($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENCLOSED
&& $questionnaire->is_closed()) ||
($questionnaire->resp_view == $QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENANSWERED
&& !$questionnaire->user_can_take($USER->id))) &&
The other pieces cause this to work incorrectly.
$questionnaire->capabilities->readallresponses checks for the mod/questionnaire:readallresponses capability ("Read response summaries, subject to open times") looks like it should be part of the elseif (i.e. users should have this capability in order to view all responses). However, this capability is Not Set for students by default, which makes this whole drop-down menu of options for when students can view all responses moot, not to mention confusing to instructors. We could keep this line in the elseif, but we'd probably also want to set this capability to Allow for students by default, which would require seeing where else in the code this capability comes into play. (We don't want students viewing all responses when they shouldn't!)
The second part of the elseif, ($numresp > 0) , is problematic because if the resp_view variable is set to allow students to see all responses Always, they should not be required to have > 0 responses in order to see all responses. (Actually, should this statement be part of the "WHENANSWERED" portion of the elseif?)
I'll attach the patch file momentarily.