Skip to content

Commit

Permalink
MDL-23502 improved new instance function name
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 31, 2010
1 parent 42761bc commit e25f246
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion enrol/category/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function instance_deleteable($instance) {
* @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;
}
Expand Down
2 changes: 1 addition & 1 deletion enrol/cohort/addinstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


$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)));
}

Expand Down
2 changes: 1 addition & 1 deletion enrol/cohort/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function get_instance_name($instance) {
* @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);
Expand Down
2 changes: 1 addition & 1 deletion enrol/guest/addinstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

$enrol = enrol_get_plugin('guest');

if ($enrol->get_candidate_link($course->id)) {
if ($enrol->get_newinstance_link($course->id)) {
$enrol->add_default_instance($course);
}

Expand Down
2 changes: 1 addition & 1 deletion enrol/guest/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function try_guestaccess(stdClass $instance) {
* @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))) {
Expand Down
2 changes: 1 addition & 1 deletion enrol/instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
// 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);
Expand Down
2 changes: 1 addition & 1 deletion enrol/manual/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function get_action_icons(stdClass $instance) {
* @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);
Expand Down
2 changes: 1 addition & 1 deletion enrol/meta/addinstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
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)));
}

Expand Down
2 changes: 1 addition & 1 deletion enrol/meta/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function get_instance_name($instance) {
* @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;
}
Expand Down
2 changes: 1 addition & 1 deletion enrol/mnet/addinstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

$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();
Expand Down
2 changes: 1 addition & 1 deletion enrol/mnet/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function get_instance_name($instance) {
* @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');

Expand Down
2 changes: 1 addition & 1 deletion enrol/paypal/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function get_action_icons(stdClass $instance) {
* @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)) {
Expand Down
2 changes: 1 addition & 1 deletion enrol/self/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function get_action_icons(stdClass $instance) {
* @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)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/enrollib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ public function sync_user_enrolments($user) {
* @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;
}
Expand Down

0 comments on commit e25f246

Please sign in to comment.