MDL-17457 migrated all modules to new db/install.php; added upgrade.txt file for...
[moodle.git] / enrol / enrol.class.php
CommitLineData
a60952d7 1<?php // $Id$
b8e13a57 2
3/**
a60952d7 4* enrolment_factory is used to "manufacture" an instance of required enrolment plugin.
b8e13a57 5*/
1d9dd1d2 6
a60952d7 7class enrolment_factory {
8 function factory($enrol = '') {
9 global $CFG;
10 if (!$enrol) {
11 $enrol = $CFG->enrol;
b8e13a57 12 }
46a81114 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");
74b34588 19 notify("Enrolment file $enrol/enrol.php does not exist");
46a81114 20 }
b8e13a57 21 }
b8e13a57 22}
23
74b34588 24?>