-
Notifications
You must be signed in to change notification settings - Fork 13
/
signup_form.php
62 lines (50 loc) · 2.46 KB
/
signup_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once "$CFG->dirroot/lib/formslib.php";
class mod_facetoface_signup_form extends moodleform {
function definition()
{
$mform =& $this->_form;
$manageremail = $this->_customdata['manageremail'];
$showdiscountcode = $this->_customdata['showdiscountcode'];
$mform->addElement('hidden', 's', $this->_customdata['s']);
$mform->addElement('hidden', 'backtoallsessions', $this->_customdata['backtoallsessions']);
if ($manageremail === false) {
$mform->addElement('hidden', 'manageremail', '');
}
else {
$mform->addElement('html', get_string('manageremailinstructionconfirm', 'facetoface')); // instructions
$mform->addElement('text', 'manageremail', get_string('manageremail', 'facetoface'), 'size="35"');
$mform->addRule('manageremail', null, 'required', null, 'client');
$mform->addRule('manageremail', null, 'email', null, 'client');
$mform->setType('manageremail', PARAM_TEXT);
}
if ($showdiscountcode) {
$mform->addElement('text', 'discountcode', get_string('discountcode', 'facetoface'), 'size="6"');
$mform->addRule('discountcode', null, 'required', null, 'client');
$mform->setType('discountcode', PARAM_TEXT);
}
else {
$mform->addElement('hidden', 'discountcode', '');
}
$options = array(MDL_F2F_BOTH => get_string('notificationboth', 'facetoface'),
MDL_F2F_TEXT => get_string('notificationemail', 'facetoface'),
MDL_F2F_ICAL => get_string('notificationical', 'facetoface'),
);
$mform->addElement('select', 'notificationtype', get_string('notificationtype', 'facetoface'), $options);
$mform->addHelpButton('notificationtype', 'notificationtype', 'facetoface');
$mform->addRule('notificationtype', null, 'required', null, 'client');
$mform->setDefault('notificationtype', 0);
$this->add_action_buttons(true, get_string('signup', 'facetoface'));
}
function validation($data, $files)
{
$errors = parent::validation($data, $files);
$manageremail = $data['manageremail'];
if (!empty($manageremail)) {
if (!facetoface_check_manageremail($manageremail)) {
$errors['manageremail'] = facetoface_get_manageremailformat();
}
}
return $errors;
}
}