Permalink
Browse files

assignment MDL-24469 fixed an SQL error with get_role_users() when th…

…ere are no graded roles set ( was passing in an empty array as roleid).
  • Loading branch information...
1 parent 6eab1a9 commit dcba9ebe598a8ae886baac125228a8998c5cb995 @nebgor nebgor committed Oct 11, 2010
Showing with 20 additions and 6 deletions.
  1. +20 −6 mod/assignment/lib.php
View
@@ -814,8 +814,11 @@ function display_submission($extra_javascript = '') {
/// Get all ppl that can submit assignments
$currentgroup = groups_get_activity_group($cm);
-
- $gradebookroles = explode(",", $CFG->gradebookroles);
+ if (!empty($CFG->gradebookroles)) {
+ $gradebookroles = explode(",", $CFG->gradebookroles);
+ } else {
+ $gradebookroles = '';
+ }
$users = get_role_users($gradebookroles, $context, true, '', 'u.lastname ASC', true, $currentgroup);
if ($users) {
$users = array_keys($users);
@@ -1073,8 +1076,11 @@ function display_submissions($message='') {
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
-
- $gradebookroles = explode(",", $CFG->gradebookroles);
+ if (!empty($CFG->gradebookroles)) {
+ $gradebookroles = explode(",", $CFG->gradebookroles);
+ } else {
+ $gradebookroles = '';
+ }
$users = get_role_users($gradebookroles, $context, true, '', 'u.lastname ASC', true, $currentgroup);
if ($users) {
$users = array_keys($users);
@@ -2783,7 +2789,11 @@ function assignment_count_real_submissions($cm, $groupid=0) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- $gradebookroles = explode(",", $CFG->gradebookroles);
+ if (!empty($CFG->gradebookroles)) {
+ $gradebookroles = explode(",", $CFG->gradebookroles);
+ } else {
+ $gradebookroles = '';
+ }
$users = get_role_users($gradebookroles, $context, true, '', 'u.lastname ASC', true, $groupid);
if ($users) {
$users = array_keys($users);
@@ -3013,7 +3023,11 @@ function assignment_print_overview($courses, &$htmlarray) {
// count how many people can submit
$submissions = 0; // init
- $gradebookroles = explode(",", $CFG->gradebookroles);
+ if (!empty($CFG->gradebookroles)) {
+ $gradebookroles = explode(",", $CFG->gradebookroles);
+ } else {
+ $gradebookroles = '';
+ }
$students = get_role_users($gradebookroles, $context, true);
if ($students) {
foreach($students as $student){

0 comments on commit dcba9eb

Please sign in to comment.