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