MDL-65788 tool_policy: Prevent two modals rendering for guests.
[moodle.git] / blocks / myprofile / edit_form.php
CommitLineData
03d9401e 1<?php
03d9401e
MD
2// This file is part of Moodle - http://moodle.org/
3//
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.
8//
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.
13//
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/>.
16
0ab727fb
PS
17defined('MOODLE_INTERNAL') || die();
18
03d9401e
MD
19/**
20 * Form for editing profile block settings
21 *
f25a6839 22 * @package block_myprofile
03d9401e
MD
23 * @copyright 2010 Remote-Learner.net
24 * @author Olav Jordan <olav.jordan@remote-learner.ca>
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
27class block_myprofile_edit_form extends block_edit_form {
28 protected function specific_definition($mform) {
29 global $CFG;
30 $mform->addElement('header', 'configheader', get_string('myprofile_settings', 'block_myprofile'));
31
32 $mform->addElement('selectyesno', 'config_display_picture', get_string('display_picture', 'block_myprofile'));
33 if (isset($this->block->config->display_picture)) {
34 $mform->setDefault('config_display_picture', $this->block->config->display_picture);
35 } else {
36 $mform->setDefault('config_display_picture', '1');
37 }
38
39 $mform->addElement('selectyesno', 'config_display_country', get_string('display_country', 'block_myprofile'));
40 if (isset($this->block->config->display_country)) {
41 $mform->setDefault('config_display_country', $this->block->config->display_country);
42 } else {
43 $mform->setDefault('config_display_country', '1');
44 }
45
46 $mform->addElement('selectyesno', 'config_display_city', get_string('display_city', 'block_myprofile'));
47 if (isset($this->block->config->display_city)) {
48 $mform->setDefault('config_display_city', $this->block->config->display_city);
49 } else {
50 $mform->setDefault('config_display_city', '1');
51 }
52
53 $mform->addElement('selectyesno', 'config_display_email', get_string('display_email', 'block_myprofile'));
54 if (isset($this->block->config->display_email)) {
55 $mform->setDefault('config_display_email', $this->block->config->display_email);
56 } else {
57 $mform->setDefault('config_display_email', '1');
58 }
59
03d9401e
MD
60 $mform->addElement('selectyesno', 'config_display_icq', get_string('display_icq', 'block_myprofile'));
61 if (isset($this->block->config->display_icq)) {
62 $mform->setDefault('config_display_icq', $this->block->config->display_icq);
63 } else {
64 $mform->setDefault('config_display_icq', '0');
65 }
66
67 $mform->addElement('selectyesno', 'config_display_skype', get_string('display_skype', 'block_myprofile'));
68 if (isset($this->block->config->display_skype)) {
69 $mform->setDefault('config_display_skype', $this->block->config->display_skype);
70 } else {
71 $mform->setDefault('config_display_skype', '0');
72 }
73
74 $mform->addElement('selectyesno', 'config_display_yahoo', get_string('display_yahoo', 'block_myprofile'));
75 if (isset($this->block->config->display_yahoo)) {
76 $mform->setDefault('config_display_yahoo', $this->block->config->display_yahoo);
77 } else {
78 $mform->setDefault('config_display_yahoo', '0');
79 }
80
81 $mform->addElement('selectyesno', 'config_display_aim', get_string('display_aim', 'block_myprofile'));
82 if (isset($this->block->config->display_aim)) {
83 $mform->setDefault('config_display_aim', $this->block->config->display_aim);
84 } else {
85 $mform->setDefault('config_display_aim', '0');
86 }
87
88 $mform->addElement('selectyesno', 'config_display_msn', get_string('display_msn', 'block_myprofile'));
89 if (isset($this->block->config->display_msn)) {
90 $mform->setDefault('config_display_msn', $this->block->config->display_msn);
91 } else {
92 $mform->setDefault('config_display_msn', '0');
93 }
94
95 $mform->addElement('selectyesno', 'config_display_phone1', get_string('display_phone1', 'block_myprofile'));
96 if (isset($this->block->config->display_phone1)) {
97 $mform->setDefault('config_display_phone1', $this->block->config->display_phone1);
98 } else {
99 $mform->setDefault('config_display_phone1', '0');
100 }
101
102 $mform->addElement('selectyesno', 'config_display_phone2', get_string('display_phone2', 'block_myprofile'));
103 if (isset($this->block->config->display_phone2)) {
104 $mform->setDefault('config_display_phone2', $this->block->config->display_phone2);
105 } else {
106 $mform->setDefault('config_display_phone2', '0');
107 }
108
109 $mform->addElement('selectyesno', 'config_display_institution', get_string('display_institution', 'block_myprofile'));
110 if (isset($this->block->config->display_institution)) {
111 $mform->setDefault('config_display_institution', $this->block->config->display_institution);
112 } else {
113 $mform->setDefault('config_display_institution', '0');
114 }
115
116 $mform->addElement('selectyesno', 'config_display_address', get_string('display_address', 'block_myprofile'));
117 if (isset($this->block->config->display_address)) {
118 $mform->setDefault('config_display_address', $this->block->config->display_address);
119 } else {
120 $mform->setDefault('config_display_address', '0');
121 }
122
123 $mform->addElement('selectyesno', 'config_display_firstaccess', get_string('display_firstaccess', 'block_myprofile'));
124 if (isset($this->block->config->display_firstaccess)) {
125 $mform->setDefault('config_display_firstaccess', $this->block->config->display_firstaccess);
126 } else {
127 $mform->setDefault('config_display_firstaccess', '0');
128 }
129
130 $mform->addElement('selectyesno', 'config_display_lastaccess', get_string('display_lastaccess', 'block_myprofile'));
131 if (isset($this->block->config->display_lastaccess)) {
132 $mform->setDefault('config_display_lastaccess', $this->block->config->display_lastaccess);
133 } else {
134 $mform->setDefault('config_display_lastaccess', '0');
135 }
136
137 $mform->addElement('selectyesno', 'config_display_currentlogin', get_string('display_currentlogin', 'block_myprofile'));
138 if (isset($this->block->config->display_currentlogin)) {
139 $mform->setDefault('config_display_currentlogin', $this->block->config->display_currentlogin);
140 } else {
141 $mform->setDefault('config_display_currentlogin', '0');
142 }
143
144 $mform->addElement('selectyesno', 'config_display_lastip', get_string('display_lastip', 'block_myprofile'));
145 if (isset($this->block->config->display_lastip)) {
146 $mform->setDefault('config_display_lastip', $this->block->config->display_lastip);
147 } else {
148 $mform->setDefault('config_display_lastip', '0');
149 }
150 }
151}