moodlelib:remove_course_contents() does not need to 'clearcache'
[moodle-pu.git] / enrol / enrol.class.php
blob97ba121930ef4d492561d2c1e5c4cbb081b5a462
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 notify("Enrolment file $enrol/enrol.php does not exist");