2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 defined('MOODLE_INTERNAL') ||
die();
20 require_once($CFG->libdir
.'/formslib.php');
22 class tempmerge_form
extends moodleform
{
24 public function definition() {
27 $context = context_course
::instance($COURSE->id
);
28 $namefields = get_all_user_name_fields(true
, 'u');
29 $students = get_enrolled_users($context, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields.',u.email',
30 'u.lastname, u.firstname', 0, 0, true
);
32 foreach ($students as $student) {
33 $partarray[$student->id
] = fullname($student).' ('.$student->email
.')';
36 $mform = $this->_form
;
37 $description = $this->_customdata
['description'];
39 $mform->addElement('hidden', 'id', 0);
40 $mform->setType('id', PARAM_INT
);
41 $mform->addElement('hidden', 'userid', 0);
42 $mform->setType('userid', PARAM_INT
);
44 $mform->addElement('header', 'attheader', get_string('tempusermerge', 'attendance'));
45 $mform->addElement('static', 'description', get_string('tempuser', 'attendance'), $description);
47 $mform->addElement('select', 'participant', get_string('participant', 'attendance'), $partarray);
49 $mform->addElement('static', 'requiredentries', '', get_string('requiredentries', 'attendance'));
50 $mform->addHelpButton('requiredentries', 'requiredentry', 'attendance');
52 $this->add_action_buttons(true
, get_string('mergeuser', 'attendance'));