Merge branch 'MDL-71506-master' of https://github.com/lucaboesch/moodle

This commit is contained in:
Sara Arjona 2023-01-03 13:10:11 +01:00
commit ae71d43924

View File

@ -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++;
}
}
}
@ -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++;
}
}
}
@ -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";
}
}
}