MDL-54734 user: Add tests to demonstrate multi-user issues
[moodle.git] / admin / mnet / profilefields_form.php
blob8ef44569dd5fedfd85bf98180cfb934d3261a6d4
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Allows the admin to configure a list of profile fields that are sent/recieved
21 * @package core
22 * @subpackage mnet
23 * @copyright 2010 onwards Penny Leach <penny@liip.ch>
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 if (!defined('MOODLE_INTERNAL')) {
28 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
31 require_once($CFG->libdir . '/formslib.php');
33 /**
34 * small form to allow the administrator to configure (override) which profile fields are sent/imported over mnet
36 class mnet_profile_form extends moodleform {
38 function definition() {
39 global $CFG;
40 $mform =& $this->_form;
42 $mnetprofileimportfields = '';
43 if (isset($CFG->mnetprofileimportfields)) {
44 $mnetprofileimportfields = str_replace(',', ', ', $CFG->mnetprofileimportfields);
47 $mnetprofileexportfields = '';
48 if (isset($CFG->mnetprofileexportfields)) {
49 $mnetprofileexportfields = str_replace(',', ', ', $CFG->mnetprofileexportfields);
52 $mform->addElement('hidden', 'hostid', $this->_customdata['hostid']);
53 $mform->setType('hostid', PARAM_INT);
55 $fields = mnet_profile_field_options();
57 // Fields to import ----------------------------------------------------
58 $mform->addElement('header', 'import', get_string('importfields', 'mnet'));
60 $select = $mform->addElement('select', 'importfields', get_string('importfields', 'mnet'), $fields['optional']);
61 $select->setMultiple(true);
63 $mform->addElement('checkbox', 'importdefault', get_string('leavedefault', 'mnet'), $mnetprofileimportfields);
65 // Fields to export ----------------------------------------------------
66 $mform->addElement('header', 'export', get_string('exportfields', 'mnet'));
68 $select = $mform->addElement('select', 'exportfields', get_string('exportfields', 'mnet'), $fields['optional']);
69 $select->setMultiple(true);
71 $mform->addElement('checkbox', 'exportdefault', get_string('leavedefault', 'mnet'), $mnetprofileexportfields);
73 $this->add_action_buttons();