This repository has been archived by the owner on Nov 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
form.php
73 lines (62 loc) · 2.57 KB
/
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
66
67
68
69
70
71
72
73
<?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/>.
/**
* Form for student activity report table controls
*
* @package report_studentactivity
* @copyright 2017 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
/**
* Form that lets users filter the student activity list by group membership.
*
* @copyright 2017 UC Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tracking_users_filter_form extends moodleform {
/**
* Defines the form
* @return void
*/
public function definition() {
global $CFG, $DB;
$manager = $this->_customdata['manager'];
$mform = $this->_form;
$allgroups = $manager->get_all_groups();
$groupnames = array();
foreach ($allgroups as $group) {
$groupnames[$group->id] = $group->name;
}
// Filter by student group membership.
$dirtyclass = array('class' => 'ignoredirty', 'style' => 'width: auto');
$mform->addElement('select', 'tgid', get_string('groupfilter', 'report_studentactivity'),
array(0 => get_string('allparticipants', 'report_studentactivity')) + $groupnames, $dirtyclass);
$courseid = $this->_customdata['id'];
$allforums = forum_menu_list($courseid);
// Filter by forum.
$mform->addElement(
'select', 'tfid', ' ' . get_string('forumfilter', 'report_studentactivity'),
array(0 => get_string('allforums', 'report_studentactivity')) + $allforums, $dirtyclass
);
// Submit button does not use add_action_buttons because that adds
// another fieldset which causes the CSS style to break in an unfixable
// way due to fieldset quirks.
// Add hidden fields required by page.
$mform->addElement('hidden', 'id', $this->_customdata['id']);
$mform->setType('id', PARAM_INT);
}
}