Index: temp_moodle_dev/moodle/mod/choice/lib.php =================================================================== diff -u -r8f9656622d74eae9e5a336a7cd99ab2f9f5d6c14 -raca9f00eec05f594be36b6397b9c363742db6022 --- temp_moodle_dev/moodle/mod/choice/lib.php (.../lib.php) (revision 8f9656622d74eae9e5a336a7cd99ab2f9f5d6c14) +++ temp_moodle_dev/moodle/mod/choice/lib.php (.../lib.php) (revision aca9f00eec05f594be36b6397b9c363742db6022) @@ -328,8 +328,9 @@ $forcepublish = $choice->publish; } - if (!$allresponses) { + if (empty($allresponses)) { print_heading(get_string("nousersyet")); + return false; } $totalresponsecount = 0; @@ -380,15 +381,17 @@ // we do not get
erro from w3c validator // MDL-7861 echo ""; - foreach ($allresponses[0] as $user) { - echo ""; - echo ""; + if (!empty($allresponses[0])) { + foreach ($allresponses[0] as $user) { + echo ""; + echo ""; + } } echo "
"; - print_user_picture($user->id, $course->id, $user->picture); - echo ""; - echo "wwwroot/user/view.php?id=$user->id&course=$course->id\">"; - echo fullname($user, $hascapfullnames); - echo ""; - echo "
"; + print_user_picture($user->id, $course->id, $user->picture); + echo ""; + echo "wwwroot/user/view.php?id=$user->id&course=$course->id\">"; + echo fullname($user, $hascapfullnames); + echo ""; + echo "
"; } @@ -717,7 +720,7 @@ /// First get all the users who have access here /// To start with we assume they are all "unanswered" then move them later - $allresponses[0] = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC', '', '', $currentgroup, '', false, true); + $allresponses[0] = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.lastname ASC,u.firstname ASC', '', '', $currentgroup, '', false, true); /// Get all the recorded responses for this choice $rawresponses = get_records('choice_answers', 'choiceid', $choice->id); @@ -733,7 +736,9 @@ } } } - + if (empty($allresponses[0])) { + unset($allresponses[0]); + } return $allresponses; } @@ -743,8 +748,8 @@ function choice_get_extra_capabilities() { return array('moodle/site:accessallgroups'); } -//m new + /** * LAMS Function * This function clones an existing instance of Moodle choice @@ -945,5 +950,5 @@ } -//fi new + ?>