Proyectos de Subversion Moodle

Rev

Rev 96 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 96 Rev 1101
Línea 2... Línea 2...
2
 
2
 
3
class block_cesa_course_rating_edit_form extends block_edit_form
3
class block_cesa_course_rating_edit_form extends block_edit_form
4
{
4
{
5
    protected function specific_definition($mform)
5
    protected function specific_definition($mform)
6
    {
6
    {
-
 
7
        global $CFG, $DB, $USER;
-
 
8
 
-
 
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
Línea 7... Línea 13...
7
        global $CFG;
13
        ]);
8
 
14
 
Línea 9... Línea 15...
9
        // Section header title according to language file.
15
        // Section header title according to language file.
10
        $mform->addElement('header', 'config_header', get_string('blocksettings', 'block'));
16
        $mform->addElement('header', 'config_header', get_string('blocksettings', 'block'));
11
 
17
 
12
        // Title
18
        // Title
Línea 13... Línea 19...
13
        $mform->addElement('text', 'config_title', get_string('config_title', 'theme_edumy'));
19
        $mform->addElement('text', 'config_title', get_string('config_title', 'theme_edumy'));
14
        $mform->setDefault('config_title', 'Student feedback');
20
        $mform->setDefault('config_title', 'Student feedback');
15
        $mform->setType('config_title', PARAM_RAW);
21
        $mform->setType('config_title', PARAM_RAW);
16
 
22
 
17
       // include($CFG->dirroot . '/theme/edumy/ccn/block_handler/edit.php');
23
        // include($CFG->dirroot . '/theme/edumy/ccn/block_handler/edit.php');
18
       
24
 
19
        $mform->addElement('header', 'config_cocoon_block_settings', get_string('block_settings', 'block_cesa_course_rating'));
25
        $mform->addElement('header', 'config_cocoon_block_settings', get_string('block_settings', 'block_cesa_course_rating'));
Línea 100... Línea 106...
100
            '185' => '185',
106
            '185' => '185',
101
            '190' => '190',
107
            '190' => '190',
102
            '195' => '195',
108
            '195' => '195',
103
            '200' => '200'
109
            '200' => '200'
104
        );
110
        );
-
 
111
        if (!$hasRated) {
105
        $select = $mform->addElement('select', 'config_ccn_margin_top', get_string('config__margin_top', 'block_cesa_course_rating'), $options);
112
            $select = $mform->addElement('select', 'config_ccn_margin_top', get_string('config__margin_top', 'block_cesa_course_rating'), $options);
106
        $select->setSelected('0');
113
            $select->setSelected('0');
-
 
114
        }
107
        
115
 
108
        // Margin bottom
116
        // Margin bottom
109
        $options = array(
117
        $options = array(
110
            '-200' => '-200',
118
            '-200' => '-200',
111
            '-195' => '-195',
119
            '-195' => '-195',
112
            '-190' => '-190',
120
            '-190' => '-190',
Línea 188... Línea 196...
188
            '185' => '185',
196
            '185' => '185',
189
            '190' => '190',
197
            '190' => '190',
190
            '195' => '195',
198
            '195' => '195',
191
            '200' => '200'
199
            '200' => '200'
192
        );
200
        );
-
 
201
        if (!$hasRated) {
193
        $select = $mform->addElement('select', 'config_ccn_margin_bottom', get_string('config_margin_bottom', 'block_cesa_course_rating'), $options);
202
            $select = $mform->addElement('select', 'config_ccn_margin_bottom', get_string('config_margin_bottom', 'block_cesa_course_rating'), $options);
194
        $select->setSelected('0');
203
            $select->setSelected('0');
-
 
204
        }
-
 
205
 
195
        
206
 
196
        // // Padding top
207
        // // Padding top
197
        // $options = array(
208
        // $options = array(
198
        //     '0' => 'Default',
209
        //     '0' => 'Default',
199
        //     'zero' => '0',
210
        //     'zero' => '0',
200
        //     '5' => '5',
211
        //     '5' => '5',
Línea 286... Línea 297...
286
        //     '195' => '195',
297
        //     '195' => '195',
287
        //     '200' => '200'
298
        //     '200' => '200'
288
        // );
299
        // );
289
        // $select = $mform->addElement('select', 'config_ccn_padding_bottom', get_string('config_ccn_padding_bottom', 'theme_edumy'), $options);
300
        // $select = $mform->addElement('select', 'config_ccn_padding_bottom', get_string('config_ccn_padding_bottom', 'theme_edumy'), $options);
290
        // $select->setSelected('0');
301
        // $select->setSelected('0');
291
        
302
 
292
        // Custom CSS Class
303
        // Custom CSS Class
293
        $mform->addElement('text', 'config_ccn_css_class', get_string('config_css_class', 'block_cesa_course_rating'));
304
        $mform->addElement('text', 'config_ccn_css_class', get_string('config_css_class', 'block_cesa_course_rating'));
294
        $mform->setDefault('config_ccn_css_class', '');
305
        $mform->setDefault('config_ccn_css_class', '');
295
        $mform->setType('config_ccn_css_class', PARAM_RAW);
306
        $mform->setType('config_ccn_css_class', PARAM_RAW);
296
    }
307
    }
297
 
-
 
298
}
308
}