MDL-39477 repository: Introducing data generators for repositories

This commit is contained in:
Frederic Massart
2013-05-28 11:08:54 +08:00
committed by Damyon Wiese
parent d3aeeb93c2
commit e5c6694de8
24 changed files with 1378 additions and 0 deletions
+31
View File
@@ -555,6 +555,37 @@ EOD;
return groups_assign_grouping($record['groupingid'], $record['groupid']);
}
/**
* Create an instance of a repository.
*
* @param string type of repository to create an instance for.
* @param array|stdClass $record data to use to up set the instance.
* @param array $options options
* @return stdClass repository instance record
* @since 2.6
*/
public function create_repository($type, $record=null, array $options = null) {
global $CFG;
$generator = $this->get_plugin_generator('repository_'.$type);
return $generator->create_instance($record, $options);
}
/**
* Create an instance of a repository.
*
* @param string type of repository to create an instance for.
* @param array|stdClass $record data to use to up set the instance.
* @param array $options options
* @return repository_type object
* @since 2.6
*/
public function create_repository_type($type, $record=null, array $options = null) {
global $CFG;
$generator = $this->get_plugin_generator('repository_'.$type);
return $generator->create_type($record, $options);
}
/**
* Create a test scale
* @param array|stdClass $record