MDL-32005 Add idnumber field to groups and groupings

This commit is contained in:
Andrew Robert Nicols
2012-05-15 09:38:51 +01:00
parent 71d7bc34a8
commit 74b714df7e
19 changed files with 442 additions and 11 deletions
+39 -1
View File
@@ -93,6 +93,25 @@ function groups_get_group_by_name($courseid, $name) {
return false;
}
/**
* Returns the groupid of a group with the idnumber specified for the course.
* Group idnumbers should be unique within course
*
* @category group
* @param int $courseid The id of the course
* @param string $idnumber idnumber of group
* @return group object
*/
function groups_get_group_by_idnumber($courseid, $idnumber) {
global $DB;
if (empty($idnumber)) {
return false;
} else if ($group = $DB->get_record('groups', array('courseid' => $courseid, 'idnumber' => $idnumber))) {
return $group;
}
return false;
}
/**
* Returns the groupingid of a grouping with the name specified for the course.
* Grouping names should be unique in course
@@ -110,6 +129,25 @@ function groups_get_grouping_by_name($courseid, $name) {
return false;
}
/**
* Returns the groupingid of a grouping with the idnumber specified for the course.
* Grouping names should be unique within course
*
* @category group
* @param int $courseid The id of the course
* @param string $idnumber idnumber of the group
* @return grouping object
*/
function groups_get_grouping_by_idnumber($courseid, $idnumber) {
global $DB;
if (empty($idnumber)) {
return false;
} else if ($grouping = $DB->get_record('groupings', array('courseid' => $courseid, 'idnumber' => $idnumber))) {
return $grouping;
}
return false;
}
/**
* Get the group object
*
@@ -762,4 +800,4 @@ function _group_verify_activegroup($courseid, $groupmode, $groupingid, array $al
$SESSION->activegroup[$courseid][$groupmode][$groupingid] = 0;
}
}
}
}