OKAY! THIS IS IT! MOODLE 1.6!
[moodle.git] / enrol / enrol.class.php
blob180a696be3d0544f2ce2225fd811c74f3f84173f
1 <?php // $Id$
3 /**
4 * enrolment_factory is used to "manufacture" an instance of required enrolment plugin.
5 */
7 class enrolment_factory {
8 function factory($enrol = '') {
9 global $CFG;
10 if (!$enrol) {
11 $enrol = $CFG->enrol;
13 if (file_exists("$CFG->dirroot/enrol/$enrol/enrol.php")) {
14 require_once("$CFG->dirroot/enrol/$enrol/enrol.php");
15 $class = "enrolment_plugin_$enrol";
16 return new $class;
17 } else {
18 trigger_error("$CFG->dirroot/enrol/$enrol/enrol.php does not exist");
19 error("$CFG->dirroot/enrol/$enrol/enrol.php does not exist");