-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_form.php
66 lines (52 loc) · 2.63 KB
/
mod_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the forms to create and edit an instance of this module
*
* @package mod_jirbis
* @copyright 2021, Yuriy Yurinskiy <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot . '/course/moodleform_mod.php');
/**
* JIRBIS2 settings form.
*
* @package mod_jirbis
* @copyright 2021, Yuriy Yurinskiy <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_jirbis_mod_form extends moodleform_mod {
function definition() {
global $PAGE, $COURSE;
$PAGE->force_settings_menu();
$mform = $this->_form;
$config = get_config('jirbis');
$PAGE->requires->js_call_amd('mod_jirbis/modal_search_handle', 'init', [$COURSE->id, get_config('jirbis', 'debug')]);
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('button', 'modal_search_show', 'Поиск ресурса');
$mform->addElement('text', 'content_name', 'Выбранный ресурс', ['style' => 'width:100%']);
$mform->setType('content_name', PARAM_TEXT);
$mform->addRule('content_name', 'Чтобы заполнить данное поле, необходимо выбрать ресурс в модальном окне', 'required', null, 'client');
$mform->addElement('text', 'content_url', 'URL', ['style' => 'width:100%', 'readonly' => true]);
$mform->setType('content_url', PARAM_TEXT);
$mform->addRule('content_url', 'Чтобы заполнить данное поле, необходимо выбрать ресурс в модальном окне', 'required', null, 'client');
//-------------------------------------------------------
$this->standard_coursemodule_elements();
//-------------------------------------------------------
$this->add_action_buttons();
}
}