Proyectos de Subversion Moodle

Rev

Rev 96 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
96 efrain 1
<?php
2
 
3
class block_cesa_course_rating_edit_form extends block_edit_form
4
{
5
    protected function specific_definition($mform)
6
    {
1101 ariadna 7
        global $CFG, $DB, $USER;
96 efrain 8
 
1101 ariadna 9
        $courseid = required_param('id', PARAM_INT); // Suponiendo que el ID del curso se pasa como parámetro
10
        $hasRated = $DB->record_exists('block_cesa_course_ratings', [
11
            'courseid' => $courseid,
12
            'userid' => $USER->id
13
        ]);
14
 
96 efrain 15
        // Section header title according to language file.
16
        $mform->addElement('header', 'config_header', get_string('blocksettings', 'block'));
17
 
18
        // Title
19
        $mform->addElement('text', 'config_title', get_string('config_title', 'theme_edumy'));
20
        $mform->setDefault('config_title', 'Student feedback');
21
        $mform->setType('config_title', PARAM_RAW);
22
 
1101 ariadna 23
        // include($CFG->dirroot . '/theme/edumy/ccn/block_handler/edit.php');
24
 
96 efrain 25
        $mform->addElement('header', 'config_cocoon_block_settings', get_string('block_settings', 'block_cesa_course_rating'));
26
        // Margin top
27
        $options = array(
28
            '-200' => '-200',
29
            '-195' => '-195',
30
            '-190' => '-190',
31
            '-185' => '-185',
32
            '-180' => '-180',
33
            '-175' => '-175',
34
            '-170' => '-170',
35
            '-165' => '-165',
36
            '-160' => '-160',
37
            '-155' => '-155',
38
            '-150' => '-150',
39
            '-145' => '-145',
40
            '-140' => '-140',
41
            '-135' => '-135',
42
            '-130' => '-130',
43
            '-125' => '-125',
44
            '-120' => '-120',
45
            '-115' => '-115',
46
            '-110' => '-110',
47
            '-105' => '-105',
48
            '-100' => '-100',
49
            '-95' => '-95',
50
            '-90' => '-90',
51
            '-85' => '-85',
52
            '-80' => '-80',
53
            '-75' => '-75',
54
            '-70' => '-70',
55
            '-65' => '-65',
56
            '-60' => '-60',
57
            '-55' => '-55',
58
            '-50' => '-50',
59
            '-45' => '-45',
60
            '-40' => '-40',
61
            '-35' => '-35',
62
            '-30' => '-30',
63
            '-25' => '-25',
64
            '-20' => '-20',
65
            '-15' => '-15',
66
            '-10' => '-10',
67
            '-5' => '-5',
68
            '0' => 'Default',
69
            'zero' => '0',
70
            '5' => '5',
71
            '10' => '10',
72
            '15' => '15',
73
            '20' => '20',
74
            '25' => '25',
75
            '30' => '30',
76
            '35' => '35',
77
            '40' => '40',
78
            '45' => '45',
79
            '50' => '50',
80
            '55' => '55',
81
            '60' => '60',
82
            '65' => '65',
83
            '70' => '70',
84
            '75' => '75',
85
            '80' => '80',
86
            '85' => '85',
87
            '90' => '90',
88
            '95' => '95',
89
            '100' => '100',
90
            '105' => '105',
91
            '110' => '110',
92
            '115' => '115',
93
            '120' => '120',
94
            '125' => '125',
95
            '130' => '130',
96
            '135' => '135',
97
            '140' => '140',
98
            '145' => '145',
99
            '150' => '150',
100
            '155' => '155',
101
            '160' => '160',
102
            '165' => '165',
103
            '170' => '170',
104
            '175' => '175',
105
            '180' => '180',
106
            '185' => '185',
107
            '190' => '190',
108
            '195' => '195',
109
            '200' => '200'
110
        );
1101 ariadna 111
        if (!$hasRated) {
112
            $select = $mform->addElement('select', 'config_ccn_margin_top', get_string('config__margin_top', 'block_cesa_course_rating'), $options);
113
            $select->setSelected('0');
114
        }
115
 
96 efrain 116
        // Margin bottom
117
        $options = array(
118
            '-200' => '-200',
119
            '-195' => '-195',
120
            '-190' => '-190',
121
            '-185' => '-185',
122
            '-180' => '-180',
123
            '-175' => '-175',
124
            '-170' => '-170',
125
            '-165' => '-165',
126
            '-160' => '-160',
127
            '-155' => '-155',
128
            '-150' => '-150',
129
            '-145' => '-145',
130
            '-140' => '-140',
131
            '-135' => '-135',
132
            '-130' => '-130',
133
            '-125' => '-125',
134
            '-120' => '-120',
135
            '-115' => '-115',
136
            '-110' => '-110',
137
            '-105' => '-105',
138
            '-100' => '-100',
139
            '-95' => '-95',
140
            '-90' => '-90',
141
            '-85' => '-85',
142
            '-80' => '-80',
143
            '-75' => '-75',
144
            '-70' => '-70',
145
            '-65' => '-65',
146
            '-60' => '-60',
147
            '-55' => '-55',
148
            '-50' => '-50',
149
            '-45' => '-45',
150
            '-40' => '-40',
151
            '-35' => '-35',
152
            '-30' => '-30',
153
            '-25' => '-25',
154
            '-20' => '-20',
155
            '-15' => '-15',
156
            '-10' => '-10',
157
            '-5' => '-5',
158
            '0' => 'Default',
159
            'zero' => '0',
160
            '5' => '5',
161
            '10' => '10',
162
            '15' => '15',
163
            '20' => '20',
164
            '25' => '25',
165
            '30' => '30',
166
            '35' => '35',
167
            '40' => '40',
168
            '45' => '45',
169
            '50' => '50',
170
            '55' => '55',
171
            '60' => '60',
172
            '65' => '65',
173
            '70' => '70',
174
            '75' => '75',
175
            '80' => '80',
176
            '85' => '85',
177
            '90' => '90',
178
            '95' => '95',
179
            '100' => '100',
180
            '105' => '105',
181
            '110' => '110',
182
            '115' => '115',
183
            '120' => '120',
184
            '125' => '125',
185
            '130' => '130',
186
            '135' => '135',
187
            '140' => '140',
188
            '145' => '145',
189
            '150' => '150',
190
            '155' => '155',
191
            '160' => '160',
192
            '165' => '165',
193
            '170' => '170',
194
            '175' => '175',
195
            '180' => '180',
196
            '185' => '185',
197
            '190' => '190',
198
            '195' => '195',
199
            '200' => '200'
200
        );
1101 ariadna 201
        if (!$hasRated) {
202
            $select = $mform->addElement('select', 'config_ccn_margin_bottom', get_string('config_margin_bottom', 'block_cesa_course_rating'), $options);
203
            $select->setSelected('0');
204
        }
205
 
206
 
96 efrain 207
        // // Padding top
208
        // $options = array(
209
        //     '0' => 'Default',
210
        //     'zero' => '0',
211
        //     '5' => '5',
212
        //     '10' => '10',
213
        //     '15' => '15',
214
        //     '20' => '20',
215
        //     '25' => '25',
216
        //     '30' => '30',
217
        //     '35' => '35',
218
        //     '40' => '40',
219
        //     '45' => '45',
220
        //     '50' => '50',
221
        //     '55' => '55',
222
        //     '60' => '60',
223
        //     '65' => '65',
224
        //     '70' => '70',
225
        //     '75' => '75',
226
        //     '80' => '80',
227
        //     '85' => '85',
228
        //     '90' => '90',
229
        //     '95' => '95',
230
        //     '100' => '100',
231
        //     '105' => '105',
232
        //     '110' => '110',
233
        //     '115' => '115',
234
        //     '120' => '120',
235
        //     '125' => '125',
236
        //     '130' => '130',
237
        //     '135' => '135',
238
        //     '140' => '140',
239
        //     '145' => '145',
240
        //     '150' => '150',
241
        //     '155' => '155',
242
        //     '160' => '160',
243
        //     '165' => '165',
244
        //     '170' => '170',
245
        //     '175' => '175',
246
        //     '180' => '180',
247
        //     '185' => '185',
248
        //     '190' => '190',
249
        //     '195' => '195',
250
        //     '200' => '200'
251
        // );
252
        // $select = $mform->addElement('select', 'config_ccn_padding_top', get_string('config_ccn_padding_top', 'theme_edumy'), $options);
253
        // $select->setSelected('0');
254
        //
255
        // // Padding bottom
256
        // $options = array(
257
        //     '0' => 'Default',
258
        //     'zero' => '0',
259
        //     '5' => '5',
260
        //     '10' => '10',
261
        //     '15' => '15',
262
        //     '20' => '20',
263
        //     '25' => '25',
264
        //     '30' => '30',
265
        //     '35' => '35',
266
        //     '40' => '40',
267
        //     '45' => '45',
268
        //     '50' => '50',
269
        //     '55' => '55',
270
        //     '60' => '60',
271
        //     '65' => '65',
272
        //     '70' => '70',
273
        //     '75' => '75',
274
        //     '80' => '80',
275
        //     '85' => '85',
276
        //     '90' => '90',
277
        //     '95' => '95',
278
        //     '100' => '100',
279
        //     '105' => '105',
280
        //     '110' => '110',
281
        //     '115' => '115',
282
        //     '120' => '120',
283
        //     '125' => '125',
284
        //     '130' => '130',
285
        //     '135' => '135',
286
        //     '140' => '140',
287
        //     '145' => '145',
288
        //     '150' => '150',
289
        //     '155' => '155',
290
        //     '160' => '160',
291
        //     '165' => '165',
292
        //     '170' => '170',
293
        //     '175' => '175',
294
        //     '180' => '180',
295
        //     '185' => '185',
296
        //     '190' => '190',
297
        //     '195' => '195',
298
        //     '200' => '200'
299
        // );
300
        // $select = $mform->addElement('select', 'config_ccn_padding_bottom', get_string('config_ccn_padding_bottom', 'theme_edumy'), $options);
301
        // $select->setSelected('0');
1101 ariadna 302
 
96 efrain 303
        // Custom CSS Class
304
        $mform->addElement('text', 'config_ccn_css_class', get_string('config_css_class', 'block_cesa_course_rating'));
305
        $mform->setDefault('config_ccn_css_class', '');
306
        $mform->setType('config_ccn_css_class', PARAM_RAW);
307
    }
308
}