-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreminders_form.php
More file actions
83 lines (66 loc) · 3.69 KB
/
Copy pathreminders_form.php
File metadata and controls
83 lines (66 loc) · 3.69 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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/>.
/**
* The Augmented Teacher
*
* @package local_augmented_teacher
* @author Michael Gardener <mgardener@cissq.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2017 SmartLearning Inc https://www.smartlearning.dk
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
class reminder_form extends moodleform {
public function definition() {
$mform = $this->_form;
$customdata = $this->_customdata;
$mform->addElement('header', '', get_string('reminder', 'local_augmented_teacher'), '');
$mform->addElement('text', 'title', get_string('title', 'local_augmented_teacher'));
$mform->setType('title', PARAM_TEXT);
$mform->addRule('title', null, 'required', null, 'client');
$mform->addElement('editor', 'message', get_string('message', 'local_augmented_teacher'));
$mform->setType('message', PARAM_RAW);
$mform->addRule('message', null, 'required', null, 'client');
if ($customdata['editorplugin'] === 'atto_texteditor' || $customdata['editorplugin'] === 'editor_tiny\editor') {
$mform->addElement('static', 'shortcodes', get_string('shortcodes', 'local_augmented_teacher'),
'<button class="btn btn-secondary shortcode">{{firstname}}</button> ' .
'<button class="btn btn-secondary shortcode">{{lastname}}</button> ' .
'<button class="btn btn-secondary shortcode">{{coursename}}</button> ' .
'<button class="btn btn-secondary shortcode">{{activityname}}</button> ' .
'<button class="btn btn-secondary shortcode">{{completionrate}}</button>');
} else {
$mform->addElement('static', 'shortcodes', get_string('shortcodes', 'local_augmented_teacher'),
'{{firstname}} {{lastname}} {{coursename}} {{activityname}} {{completionrate}}');
}
$mform->addHelpButton('shortcodes', 'shortcodes', 'local_augmented_teacher');
$mform->addElement('selectyesno', 'enabled', get_string('enabled', 'local_augmented_teacher'));
$mform->addRule('enabled', null, 'required', null, 'client');
$mform->setDefault('enabled', '1');
$typeoptions = array(
REMINDER_BEFORE_DUE => get_string('before', 'local_augmented_teacher'),
REMINDER_AFTER_DUE => get_string('after', 'local_augmented_teacher')
);
$mform->addElement('select', 'type', get_string('type', 'local_augmented_teacher'), $typeoptions);
$mform->addRule('type', null, 'required', null, 'client');
$mform->addElement('duration', 'timeinterval', get_string('timeinterval', 'local_augmented_teacher'));
$mform->addRule('timeinterval', null, 'required', null, 'client');
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'cmid');
$mform->setType('cmid', PARAM_INT);
$this->add_action_buttons(true, get_string('submit', 'local_augmented_teacher'));
}
}