mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-23502 improved new instance function name
This commit is contained in:
parent
42761bc637
commit
e25f24669b
@ -53,7 +53,7 @@ class enrol_category_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
// instances are added automatically as necessary
|
||||
return NULL;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ if ($courseadmin && $courseadmin->get('users') && $courseadmin->get('users')->ge
|
||||
|
||||
|
||||
$enrol = enrol_get_plugin('cohort');
|
||||
if (!$enrol->get_candidate_link($course->id)) {
|
||||
if (!$enrol->get_newinstance_link($course->id)) {
|
||||
redirect(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class enrol_cohort_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $DB;
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
|
@ -36,7 +36,7 @@ require_sesskey();
|
||||
|
||||
$enrol = enrol_get_plugin('guest');
|
||||
|
||||
if ($enrol->get_candidate_link($course->id)) {
|
||||
if ($enrol->get_newinstance_link($course->id)) {
|
||||
$enrol->add_default_instance($course);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class enrol_guest_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $DB;
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST))) {
|
||||
|
@ -222,7 +222,7 @@ echo html_writer::table($table);
|
||||
// access security is in each plugin
|
||||
$candidates = array();
|
||||
foreach (enrol_get_plugins(true) as $name=>$plugin) {
|
||||
if (!$link = $plugin->get_candidate_link($course->id)) {
|
||||
if (!$link = $plugin->get_newinstance_link($course->id)) {
|
||||
continue;
|
||||
}
|
||||
$candidates[$link->out(false)] = get_string('pluginname', 'enrol_'.$name);
|
||||
|
@ -126,7 +126,7 @@ class enrol_manual_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
|
@ -36,7 +36,7 @@ require_login($course);
|
||||
require_capability('moodle/course:enrolconfig', $context);
|
||||
|
||||
$enrol = enrol_get_plugin('meta');
|
||||
if (!$enrol->get_candidate_link($course->id)) {
|
||||
if (!$enrol->get_newinstance_link($course->id)) {
|
||||
redirect(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class enrol_meta_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
if (!has_capability('moodle/course:enrolconfig', get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST))) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ if ($courseadmin && $courseadmin->get('users') && $courseadmin->get('users')->ge
|
||||
|
||||
$enrol = enrol_get_plugin('mnet');
|
||||
// make sure we were allowed to get here form the Enrolment methods page
|
||||
if (!$enrol->get_candidate_link($course->id)) {
|
||||
if (!$enrol->get_newinstance_link($course->id)) {
|
||||
redirect(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
|
||||
}
|
||||
$service = mnetservice_enrol::get_instance();
|
||||
|
@ -71,7 +71,7 @@ class enrol_mnet_plugin extends enrol_plugin {
|
||||
* @param int $courseid id of the course to add the instance to
|
||||
* @return moodle_url|null page url or null if instance can not be created
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php');
|
||||
|
||||
|
@ -100,7 +100,7 @@ class enrol_paypal_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/paypal:config', $context)) {
|
||||
|
@ -118,7 +118,7 @@ class enrol_self_plugin extends enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid, MUST_EXIST);
|
||||
|
||||
if (!has_capability('moodle/course:enrolconfig', $context) or !has_capability('enrol/manual:config', $context)) {
|
||||
|
@ -1055,7 +1055,7 @@ abstract class enrol_plugin {
|
||||
* @param int $courseid
|
||||
* @return moodle_url page url
|
||||
*/
|
||||
public function get_candidate_link($courseid) {
|
||||
public function get_newinstance_link($courseid) {
|
||||
// override for most plugins, check if instance already exists in cases only one instance is supported
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user