2006-03-09 04:22:03 +00:00
|
|
|
<?php // $Id$
|
2004-06-25 03:28:12 +00:00
|
|
|
|
|
|
|
/**
|
2006-03-09 04:22:03 +00:00
|
|
|
* enrolment_factory is used to "manufacture" an instance of required enrolment plugin.
|
2004-06-25 03:28:12 +00:00
|
|
|
*/
|
2004-10-07 15:22:47 +00:00
|
|
|
|
2006-03-09 04:22:03 +00:00
|
|
|
class enrolment_factory {
|
|
|
|
function factory($enrol = '') {
|
|
|
|
global $CFG;
|
|
|
|
if (!$enrol) {
|
|
|
|
$enrol = $CFG->enrol;
|
2004-06-25 03:28:12 +00:00
|
|
|
}
|
2006-03-09 05:06:18 +00:00
|
|
|
if (file_exists("$CFG->dirroot/enrol/$enrol/enrol.php")) {
|
|
|
|
require_once("$CFG->dirroot/enrol/$enrol/enrol.php");
|
|
|
|
$class = "enrolment_plugin_$enrol";
|
|
|
|
return new $class;
|
|
|
|
} else {
|
|
|
|
trigger_error("$CFG->dirroot/enrol/$enrol/enrol.php does not exist");
|
2006-09-26 04:38:00 +00:00
|
|
|
notify("Enrolment file $enrol/enrol.php does not exist");
|
2006-03-09 05:06:18 +00:00
|
|
|
}
|
2004-06-25 03:28:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-26 04:38:00 +00:00
|
|
|
?>
|