libdir.'/adminlib.php'); $enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR); $savesettings = optional_param('savesettings', 0, PARAM_BOOL); admin_externalpage_setup('enrolment'); if (!isset($CFG->sendcoursewelcomemessage)) { set_config('sendcoursewelcomemessage', 1); } require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class /// Save settings if ($frm = data_submitted() and !$savesettings) { if (!confirm_sesskey()) { print_error('confirmsesskeybad', 'error'); } if (empty($frm->enable)) { $frm->enable = array(); } if (empty($frm->default)) { $frm->default = ''; } if ($frm->default && $frm->default != 'manual' && !in_array($frm->default, $frm->enable)) { $frm->enable[] = $frm->default; } asort($frm->enable); $frm->enable = array_merge(array('manual'), $frm->enable); // make sure manual plugin is called first set_config('enrol_plugins_enabled', implode(',', $frm->enable)); set_config('enrol', $frm->default); redirect("enrol.php", get_string("changessaved"), 1); } else if ($frm = data_submitted() and $savesettings) { if (!confirm_sesskey()) { print_error('confirmsesskeybad', 'error'); } set_config('sendcoursewelcomemessage', required_param('sendcoursewelcomemessage', PARAM_BOOL)); } /// Print the form $str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit')); echo $OUTPUT->header(); $modules = get_plugin_list('enrol'); $options = array(); foreach ($modules as $module => $moduledir) { $options[$module] = get_string("enrolname", "enrol_$module"); } asort($options); echo $OUTPUT->box(get_string('configenrolmentplugins', 'admin')); echo "
"; echo "
"; echo ""; $table = new html_table(); $table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings); $table->align = array('left', 'center', 'center', 'center'); $table->size = array('60%', '', '', '15%'); $table->attributes['class'] = 'generaltable enrolplugintable'; $table->data = array(); $enabledplugins = explode(',', $CFG->enrol_plugins_enabled); foreach ($modules as $module => $moduledir) { // skip if directory is empty if (!file_exists("$moduledir/enrol.php")) { continue; } $name = get_string("enrolname", "enrol_$module"); $plugin = enrolment_factory::factory($module); $enable = 'enrol == $module) { $default .= ' checked="checked"'; } $default .= ' />'; } else { $default = ''; } $table->data[$name] = array($name, $enable, $default, ''.$str->edit.''); } asort($table->data); echo html_writer::table($table); echo "
\n"; echo "
"; echo "
"; echo '
'; $yesnooptions = array(0=>get_string('no'), 1=>get_string('yes')); echo '
'; echo '
'; echo $OUTPUT->heading(get_string('commonsettings', 'admin')); echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo '
'; echo html_writer::select($yesnooptions, 'sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, false); echo '
'.get_string('defaultsettinginfo', 'admin', get_string('yes')).'
'; echo '
' . get_string('configsendcoursewelcomemessage', 'admin') . '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo $OUTPUT->footer();