Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 371... Línea 371...
371
            $selectcontentindicatorinner = $iscontentitem ?
371
            $selectcontentindicatorinner = $iscontentitem ?
372
                $OUTPUT->pix_icon('i/valid', get_string('contentselected', 'mod_lti'), 'moodle', ['class' => 'mr-1'])
372
                $OUTPUT->pix_icon('i/valid', get_string('contentselected', 'mod_lti'), 'moodle', ['class' => 'mr-1'])
373
                . get_string('contentselected', 'mod_lti') : '';
373
                . get_string('contentselected', 'mod_lti') : '';
374
            $selectcontentindicator = html_writer::div($selectcontentindicatorinner, '',
374
            $selectcontentindicator = html_writer::div($selectcontentindicatorinner, '',
375
                ['aria-role' => 'status', 'id' => 'id_selectcontentindicator']);
375
                ['aria-role' => 'status', 'id' => 'id_selectcontentindicator']);
376
            $selectcontentstatus = $iscontentitem ? 'true' : 'false';
-
 
377
            $selectcontentgrp = [
376
            $selectcontentgrp = [
378
                $mform->createElement('button', 'selectcontent', get_string('selectcontent', 'mod_lti'), $contentbuttonattributes,
377
                $mform->createElement('button', 'selectcontent', get_string('selectcontent', 'mod_lti'), $contentbuttonattributes,
379
                    ['customclassoverride' => 'btn-primary']),
378
                    ['customclassoverride' => 'btn-secondary']),
380
                $mform->createElement('html', $selectcontentindicator),
379
                $mform->createElement('html', $selectcontentindicator),
381
                $mform->createElement('hidden', 'selectcontentstatus', $selectcontentstatus),
-
 
382
            ];
380
            ];
383
            $mform->setType('selectcontentstatus', PARAM_TEXT);
-
 
384
            $mform->addGroup($selectcontentgrp, 'selectcontentgroup', get_string('content'), ' ', false);
381
            $mform->addGroup($selectcontentgrp, 'selectcontentgroup', get_string('content'), ' ', false);
385
            $mform->addRule('selectcontentgroup', get_string('selectcontentvalidationerror', 'mod_lti'), 'required');
-
 
386
        }
382
        }
Línea 387... Línea 383...
387
 
383
 
388
        // Adding the standard "name" field.
384
        // Adding the standard "name" field.
389
        $mform->addElement('text', 'name', get_string('basicltiname', 'lti'), ['size' => '64']);
385
        $mform->addElement('text', 'name', get_string('basicltiname', 'lti'), ['size' => '64']);
Línea 537... Línea 533...
537
                $service->set_instance_form_values( $defaultvalues );
533
                $service->set_instance_form_values( $defaultvalues );
538
            }
534
            }
539
        }
535
        }
540
        parent::set_data($defaultvalues);
536
        parent::set_data($defaultvalues);
541
    }
537
    }
542
 
-
 
543
    public function validation($data, $files) {
-
 
544
        $errors = parent::validation($data, $files);
-
 
545
 
-
 
546
        if (isset($data['selectcontentstatus']) && $data['selectcontentstatus'] === 'false') {
-
 
547
            $errors['selectcontentgroup'] = get_string('selectcontentvalidationerror', 'mod_lti');
-
 
548
        }
-
 
549
 
-
 
550
        return $errors;
-
 
551
    }
-
 
552
}
538
}