Skip to content

Commit

Permalink
MDL-71506 mod_choice: suppress non respondents in downloads if set so.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch authored and = committed Jan 2, 2023
1 parent 7e1aa84 commit dcb0de7
Showing 1 changed file with 56 additions and 50 deletions.
106 changes: 56 additions & 50 deletions mod/choice/report.php
Expand Up @@ -134,26 +134,28 @@
$row = 1;
if ($users) {
foreach ($users as $option => $userid) {
$option_text = choice_get_option_text($choice, $option);
foreach ($userid as $user) {
$i = 0;
$myxls->write_string($row, $i++, $user->lastname);
$myxls->write_string($row, $i++, $user->firstname);
foreach ($extrafields as $field) {
$myxls->write_string($row, $i++, $user->$field);
}
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2 . $ug->name;
if (!($choice->showunanswered == 0 && $option == 0)) {
$option_text = choice_get_option_text($choice, $option);
foreach ($userid as $user) {
$i = 0;
$myxls->write_string($row, $i++, $user->lastname);
$myxls->write_string($row, $i++, $user->firstname);
foreach ($extrafields as $field) {
$myxls->write_string($row, $i++, $user->$field);
}
}
$myxls->write_string($row, $i++, $ug2);
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2 . $ug->name;
}
}
$myxls->write_string($row, $i++, $ug2);

if (isset($option_text)) {
$myxls->write_string($row, $i++, format_string($option_text, true));
if (isset($option_text)) {
$myxls->write_string($row, $i++, format_string($option_text, true));
}
$row++;
}
$row++;
}
}
}
Expand Down Expand Up @@ -196,25 +198,27 @@
if ($users) {
foreach ($users as $option => $userid) {
$i = 0;
$option_text = choice_get_option_text($choice, $option);
foreach($userid as $user) {
$i = 0;
$myxls->write_string($row, $i++, $user->lastname);
$myxls->write_string($row, $i++, $user->firstname);
foreach ($extrafields as $field) {
$myxls->write_string($row, $i++, $user->$field);
}
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2 . $ug->name;
if (!($choice->showunanswered == 0 && $option == 0)) {
$option_text = choice_get_option_text($choice, $option);
foreach($userid as $user) {
$i = 0;
$myxls->write_string($row, $i++, $user->lastname);
$myxls->write_string($row, $i++, $user->firstname);
foreach ($extrafields as $field) {
$myxls->write_string($row, $i++, $user->$field);
}
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2 . $ug->name;
}
}
$myxls->write_string($row, $i++, $ug2);
if (isset($option_text)) {
$myxls->write_string($row, $i++, format_string($option_text, true));
}
$row++;
}
$myxls->write_string($row, $i++, $ug2);
if (isset($option_text)) {
$myxls->write_string($row, $i++, format_string($option_text, true));
}
$row++;
}
}
}
Expand Down Expand Up @@ -251,24 +255,26 @@
$i=0;
if ($users) {
foreach ($users as $option => $userid) {
$option_text = choice_get_option_text($choice, $option);
foreach($userid as $user) {
echo $user->lastname . "\t";
echo $user->firstname . "\t";
foreach ($extrafields as $field) {
echo $user->$field . "\t";
}
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2. $ug->name;
if (!($choice->showunanswered == 0 && $option == 0)) {
$option_text = choice_get_option_text($choice, $option);
foreach($userid as $user) {
echo $user->lastname . "\t";
echo $user->firstname . "\t";
foreach ($extrafields as $field) {
echo $user->$field . "\t";
}
$ug2 = '';
if ($usergrps = groups_get_all_groups($course->id, $user->id)) {
foreach ($usergrps as $ug) {
$ug2 = $ug2. $ug->name;
}
}
echo $ug2. "\t";
if (isset($option_text)) {
echo format_string($option_text,true);
}
echo "\n";
}
echo $ug2. "\t";
if (isset($option_text)) {
echo format_string($option_text,true);
}
echo "\n";
}
}
}
Expand Down

0 comments on commit dcb0de7

Please sign in to comment.