mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-72093 mod_choice: Replace strings in secondary nav
This commit is contained in:
parent
55dd65a1f2
commit
a6f665a971
1 changed files with 2 additions and 22 deletions
|
@ -864,28 +864,8 @@ function choice_extend_settings_navigation(settings_navigation $settings, naviga
|
||||||
global $PAGE;
|
global $PAGE;
|
||||||
|
|
||||||
if (has_capability('mod/choice:readresponses', $PAGE->cm->context)) {
|
if (has_capability('mod/choice:readresponses', $PAGE->cm->context)) {
|
||||||
|
$choicenode->add(get_string('responses', 'choice'),
|
||||||
$groupmode = groups_get_activity_groupmode($PAGE->cm);
|
new moodle_url('/mod/choice/report.php', array('id' => $PAGE->cm->id)));
|
||||||
if ($groupmode) {
|
|
||||||
groups_get_activity_group($PAGE->cm, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$choice = choice_get_choice($PAGE->cm->instance);
|
|
||||||
|
|
||||||
// Check if we want to include responses from inactive users.
|
|
||||||
$onlyactive = $choice->includeinactive ? false : true;
|
|
||||||
|
|
||||||
// Big function, approx 6 SQL calls per user.
|
|
||||||
$allresponses = choice_get_response_data($choice, $PAGE->cm, $groupmode, $onlyactive);
|
|
||||||
|
|
||||||
$allusers = [];
|
|
||||||
foreach($allresponses as $optionid => $userlist) {
|
|
||||||
if ($optionid) {
|
|
||||||
$allusers = array_merge($allusers, array_keys($userlist));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$responsecount = count(array_unique($allusers));
|
|
||||||
$choicenode->add(get_string("viewallresponses", "choice", $responsecount), new moodle_url('/mod/choice/report.php', array('id'=>$PAGE->cm->id)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue