diff --git a/mod/choice/report.php b/mod/choice/report.php index dd9c8a1ee0e35..845ff896d9e4e 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -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"; } } }