mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
Merge branch 'MDL-35696-master-course-meta-link-sort-order' of https://github.com/amandadoughty/moodle
This commit is contained in:
commit
7c96d1e81d
@ -42,7 +42,11 @@ class enrol_meta_addinstance_form extends moodleform {
|
||||
$courses = array('' => get_string('choosedots'));
|
||||
$select = ', ' . context_helper::get_preload_record_columns_sql('ctx');
|
||||
$join = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
|
||||
$sql = "SELECT c.id, c.fullname, c.shortname, c.visible $select FROM {course} c $join ORDER BY c.sortorder ASC";
|
||||
|
||||
$plugin = enrol_get_plugin('meta');
|
||||
$sortorder = 'c.' . $plugin->get_config('coursesort', 'sortorder') . ' ASC';
|
||||
|
||||
$sql = "SELECT c.id, c.fullname, c.shortname, c.visible $select FROM {course} c $join ORDER BY " . $sortorder;
|
||||
$rs = $DB->get_recordset_sql($sql, array('contextlevel' => CONTEXT_COURSE));
|
||||
foreach ($rs as $c) {
|
||||
if ($c->id == SITEID or $c->id == $course->id or isset($existing[$c->id])) {
|
||||
|
@ -22,6 +22,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['coursesort'] = 'Sort course list';
|
||||
$string['coursesort_help'] = 'This determines whether the list of courses that can be linked are sorted by sort order (i.e. the order set in Site administration > Courses > Manage courses and categories) or alphabetically by course setting.';
|
||||
$string['linkedcourse'] = 'Link course';
|
||||
$string['meta:config'] = 'Configure meta enrol instances';
|
||||
$string['meta:selectaslinked'] = 'Select course as meta linked';
|
||||
|
@ -41,5 +41,19 @@ if ($ADMIN->fulltree) {
|
||||
ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'core_enrol'),
|
||||
);
|
||||
$settings->add(new admin_setting_configselect('enrol_meta/unenrolaction', get_string('extremovedaction', 'enrol'), get_string('extremovedaction_help', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
|
||||
|
||||
$sortoptions = array(
|
||||
'sortorder' => new lang_string('sort_sortorder', 'admin'),
|
||||
'fullname' => new lang_string('sort_fullname', 'admin'),
|
||||
'shortname' => new lang_string('sort_shortname', 'admin'),
|
||||
'idnumber' => new lang_string('sort_idnumber', 'admin'),
|
||||
);
|
||||
$settings->add(new admin_setting_configselect(
|
||||
'enrol_meta/coursesort',
|
||||
new lang_string('coursesort', 'enrol_meta'),
|
||||
new lang_string('coursesort_help', 'enrol_meta'),
|
||||
'sortorder',
|
||||
$sortoptions
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2014112400; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->component = 'enrol_meta'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->cron = 60*60; // run cron every hour by default, it is not out-of-sync often
|
||||
|
Loading…
x
Reference in New Issue
Block a user