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