1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
if (!defined('MOODLE_INTERNAL')) {
|
|
|
4 |
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
require_once($CFG->dirroot . '/lib/formslib.php');
|
|
|
8 |
|
|
|
9 |
class mod_wiki_comments_form extends moodleform {
|
|
|
10 |
protected function definition() {
|
|
|
11 |
$mform = $this->_form;
|
|
|
12 |
|
|
|
13 |
$current = $this->_customdata['current'] ?? null;
|
|
|
14 |
$commentoptions = $this->_customdata['commentoptions'] ?? null;
|
|
|
15 |
|
|
|
16 |
// visible elements
|
|
|
17 |
$mform->addElement('editor', 'entrycomment_editor', get_string('comment', 'glossary'), null, $commentoptions);
|
|
|
18 |
$mform->addRule('entrycomment_editor', get_string('required'), 'required', null, 'client');
|
|
|
19 |
$mform->setType('entrycomment_editor', PARAM_RAW); // processed by trust text or cleaned before the display
|
|
|
20 |
|
|
|
21 |
// hidden optional params
|
|
|
22 |
$mform->addElement('hidden', 'id', '');
|
|
|
23 |
$mform->setType('id', PARAM_INT);
|
|
|
24 |
|
|
|
25 |
$mform->addElement('hidden', 'action', '');
|
|
|
26 |
$mform->setType('action', PARAM_ALPHAEXT);
|
|
|
27 |
|
|
|
28 |
//-------------------------------------------------------------------------------
|
|
|
29 |
// buttons
|
|
|
30 |
$this->add_action_buttons(true);
|
|
|
31 |
|
|
|
32 |
//-------------------------------------------------------------------------------
|
|
|
33 |
$this->set_data($current);
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
public function edit_definition($current, $commentoptions) {
|
|
|
37 |
$this->set_data($current);
|
|
|
38 |
$this->set_data($commentoptions);
|
|
|
39 |
}
|
|
|
40 |
}
|
|
|
41 |
|