1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
if (!defined('MOODLE_INTERNAL')) {
|
|
|
18 |
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
require_once($CFG->dirroot.'/course/moodleform_mod.php');
|
|
|
22 |
|
|
|
23 |
class mod_chat_mod_form extends moodleform_mod {
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Define the chat activity settings form
|
|
|
27 |
*/
|
|
|
28 |
public function definition() {
|
|
|
29 |
global $CFG;
|
|
|
30 |
|
|
|
31 |
$mform = $this->_form;
|
|
|
32 |
|
|
|
33 |
$mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
34 |
|
|
|
35 |
$mform->addElement('text', 'name', get_string('chatname', 'chat'), array('size' => '64'));
|
|
|
36 |
if (!empty($CFG->formatstringstriptags)) {
|
|
|
37 |
$mform->setType('name', PARAM_TEXT);
|
|
|
38 |
} else {
|
|
|
39 |
$mform->setType('name', PARAM_CLEANHTML);
|
|
|
40 |
}
|
|
|
41 |
$mform->addRule('name', null, 'required', null, 'client');
|
|
|
42 |
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
|
|
43 |
|
|
|
44 |
$this->standard_intro_elements(get_string('chatintro', 'chat'));
|
|
|
45 |
|
|
|
46 |
// Chat sessions.
|
|
|
47 |
$mform->addElement('header', 'sessionshdr', get_string('sessions', 'chat'));
|
|
|
48 |
|
|
|
49 |
$mform->addElement('date_time_selector', 'chattime', get_string('chattime', 'chat'));
|
|
|
50 |
|
|
|
51 |
$options = array();
|
|
|
52 |
$options[0] = get_string('donotusechattime', 'chat');
|
|
|
53 |
$options[1] = get_string('repeatnone', 'chat');
|
|
|
54 |
$options[2] = get_string('repeatdaily', 'chat');
|
|
|
55 |
$options[3] = get_string('repeatweekly', 'chat');
|
|
|
56 |
$mform->addElement('select', 'schedule', get_string('repeattimes', 'chat'), $options);
|
|
|
57 |
|
|
|
58 |
$options = array();
|
|
|
59 |
$options[0] = get_string('neverdeletemessages', 'chat');
|
|
|
60 |
$options[365] = get_string('numdays', '', 365);
|
|
|
61 |
$options[180] = get_string('numdays', '', 180);
|
|
|
62 |
$options[150] = get_string('numdays', '', 150);
|
|
|
63 |
$options[120] = get_string('numdays', '', 120);
|
|
|
64 |
$options[90] = get_string('numdays', '', 90);
|
|
|
65 |
$options[60] = get_string('numdays', '', 60);
|
|
|
66 |
$options[30] = get_string('numdays', '', 30);
|
|
|
67 |
$options[21] = get_string('numdays', '', 21);
|
|
|
68 |
$options[14] = get_string('numdays', '', 14);
|
|
|
69 |
$options[7] = get_string('numdays', '', 7);
|
|
|
70 |
$options[2] = get_string('numdays', '', 2);
|
|
|
71 |
$mform->addElement('select', 'keepdays', get_string('savemessages', 'chat'), $options);
|
|
|
72 |
|
|
|
73 |
$mform->addElement('selectyesno', 'studentlogs', get_string('studentseereports', 'chat'));
|
|
|
74 |
$mform->addHelpButton('studentlogs', 'studentseereports', 'chat');
|
|
|
75 |
|
|
|
76 |
$this->standard_coursemodule_elements();
|
|
|
77 |
|
|
|
78 |
$this->add_action_buttons();
|
|
|
79 |
}
|
|
|
80 |
}
|