mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-15846 add option to prevent course welcome emails + support for searching in enrolment page
This commit is contained in:
parent
8eb1d25ffe
commit
fb8634e50c
5 changed files with 98 additions and 3 deletions
|
@ -3725,6 +3725,57 @@ class admin_page_managemods extends admin_externalpage {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enrolment manage page
|
||||
*/
|
||||
class admin_enrolment_page extends admin_externalpage {
|
||||
public function admin_enrolment_page() {
|
||||
global $CFG;
|
||||
parent::admin_externalpage('enrolment', get_string('enrolments'), $CFG->wwwroot . '/'.$CFG->admin.'/enrol.php');
|
||||
}
|
||||
|
||||
function search($query) {
|
||||
if ($result = parent::search($query)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
|
||||
if ($modules = get_list_of_plugins('enrol')) {
|
||||
$textlib = textlib_get_instance();
|
||||
foreach ($modules as $plugin) {
|
||||
if (strpos($plugin, $query) !== false) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
$strmodulename = get_string('enrolname', "enrol_$plugin");
|
||||
if (strpos($textlib->strtolower($strmodulename), $query) !== false) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//ugly harcoded hacks
|
||||
if (strpos('sendcoursewelcomemessage', $query) !== false) {
|
||||
$found = true;
|
||||
} else if (strpos($textlib->strtolower(get_string('sendcoursewelcomemessage', 'admin')), $query) !== false) {
|
||||
$found = true;
|
||||
} else if (strpos($textlib->strtolower(get_string('configsendcoursewelcomemessage', 'admin')), $query) !== false) {
|
||||
$found = true;
|
||||
} else if (strpos($textlib->strtolower(get_string('configenrolmentplugins', 'admin')), $query) !== false) {
|
||||
$found = true;
|
||||
}
|
||||
if ($found) {
|
||||
$result = new object();
|
||||
$result->page = $this;
|
||||
$result->settings = array();
|
||||
return array($this->name => $result);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks manage page
|
||||
*/
|
||||
|
|
|
@ -4390,6 +4390,10 @@ function email_is_not_allowed($email) {
|
|||
function email_welcome_message_to_user($course, $user=NULL) {
|
||||
global $CFG, $USER;
|
||||
|
||||
if (isset($CFG->sendcoursewelcomemessage) and !$CFG->sendcoursewelcomemessage) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($user)) {
|
||||
if (!isloggedin()) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue