Merge branch 'MDL-33937-master' of git://github.com/sammarshallou/moodle

This commit is contained in:
Dan Poltawski 2012-07-03 12:29:57 +08:00
commit eb85dafc8b
2 changed files with 22 additions and 4 deletions

View file

@ -202,9 +202,17 @@ class course_modinfo extends stdClass {
/**
* Gets data about specific numbered section.
* @param int $sectionnumber Number (not id) of section
* @return section_info Information for numbered section
* @param int $strictness Use MUST_EXIST to throw exception if it doesn't
* @return section_info Information for numbered section or null if not found
*/
public function get_section_info($sectionnumber) {
public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) {
if (!array_key_exists($sectionnumber, $this->sectioninfo)) {
if ($strictness === MUST_EXIST) {
throw new moodle_exception('sectionnotexist');
} else {
return null;
}
}
return $this->sectioninfo[$sectionnumber];
}