2009-11-04 08:11:02 +00:00
|
|
|
<?php
|
2011-11-02 11:57:56 +01:00
|
|
|
// 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/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Participation report
|
|
|
|
*
|
|
|
|
* @package report
|
|
|
|
* @subpackage participation
|
|
|
|
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2021-02-22 09:32:12 +05:30
|
|
|
use core\report_helper;
|
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
require('../../config.php');
|
|
|
|
require_once($CFG->dirroot.'/lib/tablelib.php');
|
2017-11-07 10:32:51 +08:00
|
|
|
require_once($CFG->dirroot.'/notes/lib.php');
|
2014-04-09 16:06:40 +08:00
|
|
|
require_once($CFG->dirroot.'/report/participation/locallib.php');
|
2011-11-02 11:57:56 +01:00
|
|
|
|
2021-12-20 14:54:11 +01:00
|
|
|
$participantsperpage = intval(get_config('moodlecourse', 'participantsperpage'));
|
|
|
|
define('DEFAULT_PAGE_SIZE', (!empty($participantsperpage) ? $participantsperpage : 20));
|
2011-11-02 11:57:56 +01:00
|
|
|
define('SHOW_ALL_PAGE_SIZE', 5000);
|
|
|
|
|
|
|
|
$id = required_param('id', PARAM_INT); // course id.
|
|
|
|
$roleid = optional_param('roleid', 0, PARAM_INT); // which role to show
|
|
|
|
$instanceid = optional_param('instanceid', 0, PARAM_INT); // instance we're looking at.
|
|
|
|
$timefrom = optional_param('timefrom', 0, PARAM_INT); // how far back to look...
|
|
|
|
$action = optional_param('action', '', PARAM_ALPHA);
|
|
|
|
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
|
|
|
$perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT); // how many per page
|
2014-10-13 11:46:37 +13:00
|
|
|
$currentgroup = optional_param('group', null, PARAM_INT); // Get the active group.
|
2011-11-02 11:57:56 +01:00
|
|
|
|
|
|
|
$url = new moodle_url('/report/participation/index.php', array('id'=>$id));
|
|
|
|
if ($roleid !== 0) $url->param('roleid');
|
|
|
|
if ($instanceid !== 0) $url->param('instanceid');
|
|
|
|
if ($timefrom !== 0) $url->param('timefrom');
|
|
|
|
if ($action !== '') $url->param('action');
|
|
|
|
if ($page !== 0) $url->param('page');
|
|
|
|
if ($perpage !== DEFAULT_PAGE_SIZE) $url->param('perpage');
|
|
|
|
$PAGE->set_url($url);
|
|
|
|
$PAGE->set_pagelayout('admin');
|
|
|
|
|
|
|
|
if ($action != 'view' and $action != 'post') {
|
|
|
|
$action = ''; // default to all (don't restrict)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception('invalidcourse');
|
2011-11-02 11:57:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($roleid != 0 and !$role = $DB->get_record('role', array('id'=>$roleid))) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception('invalidrole');
|
2011-11-02 11:57:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course);
|
2012-07-24 16:57:51 +08:00
|
|
|
$context = context_course::instance($course->id);
|
2011-11-02 11:57:56 +01:00
|
|
|
require_capability('report/participation:view', $context);
|
|
|
|
|
|
|
|
$strparticipation = get_string('participationreport');
|
|
|
|
$strviews = get_string('views');
|
|
|
|
$strposts = get_string('posts');
|
|
|
|
$strreports = get_string('reports');
|
|
|
|
|
2014-04-09 16:06:40 +08:00
|
|
|
$actionoptions = report_participation_get_action_options();
|
2011-11-02 11:57:56 +01:00
|
|
|
if (!array_key_exists($action, $actionoptions)) {
|
|
|
|
$action = '';
|
|
|
|
}
|
|
|
|
|
2017-03-07 23:32:43 +01:00
|
|
|
$PAGE->set_title(format_string($course->shortname, true, array('context' => $context)) .': '. $strparticipation);
|
|
|
|
$PAGE->set_heading(format_string($course->fullname, true, array('context' => $context)));
|
2011-11-02 11:57:56 +01:00
|
|
|
echo $OUTPUT->header();
|
|
|
|
|
2021-02-22 09:32:12 +05:30
|
|
|
// Print the selector dropdown.
|
|
|
|
$pluginname = get_string('pluginname', 'report_participation');
|
|
|
|
report_helper::print_report_selector($pluginname);
|
|
|
|
// Release session lock.
|
|
|
|
\core\session\manager::write_close();
|
|
|
|
|
2019-06-25 20:15:20 +08:00
|
|
|
// Logs will not have been recorded before the course timecreated time.
|
|
|
|
$minlog = $course->timecreated;
|
2014-02-18 15:45:24 +08:00
|
|
|
$onlyuselegacyreader = false; // Use only legacy log table to aggregate records.
|
|
|
|
|
2014-04-09 16:06:40 +08:00
|
|
|
$logtable = report_participation_get_log_table_name(); // Log table to use for fetaching records.
|
2014-02-18 15:45:24 +08:00
|
|
|
|
2014-04-09 16:06:40 +08:00
|
|
|
// If no log table, then use legacy records.
|
|
|
|
if (empty($logtable)) {
|
|
|
|
$onlyuselegacyreader = true;
|
2014-02-18 15:45:24 +08:00
|
|
|
}
|
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$modinfo = get_fast_modinfo($course);
|
|
|
|
|
2014-04-09 16:06:40 +08:00
|
|
|
// Print first controls.
|
|
|
|
report_participation_print_filter_form($course, $timefrom, $minlog, $action, $roleid, $instanceid);
|
2011-11-02 11:57:56 +01:00
|
|
|
|
2014-10-13 11:46:37 +13:00
|
|
|
$baseurl = new moodle_url('/report/participation/index.php', array(
|
|
|
|
'id' => $course->id,
|
|
|
|
'roleid' => $roleid,
|
|
|
|
'instanceid' => $instanceid,
|
|
|
|
'timefrom' => $timefrom,
|
|
|
|
'action' => $action,
|
|
|
|
'perpage' => $perpage,
|
|
|
|
'group' => $currentgroup
|
|
|
|
));
|
2012-10-30 11:29:53 +08:00
|
|
|
$select = groups_allgroups_course_menu($course, $baseurl, true, $currentgroup);
|
|
|
|
|
|
|
|
// User cannot see any group.
|
|
|
|
if (empty($select)) {
|
|
|
|
echo $OUTPUT->heading(get_string("notingroup"));
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
echo $select;
|
|
|
|
}
|
2011-11-02 11:57:56 +01:00
|
|
|
|
2013-09-12 10:08:48 +08:00
|
|
|
// Fetch current active group.
|
|
|
|
$groupmode = groups_get_course_groupmode($course);
|
|
|
|
$currentgroup = $SESSION->activegroup[$course->id][$groupmode][$course->defaultgroupingid];
|
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
if (!empty($instanceid) && !empty($roleid)) {
|
2019-06-25 20:15:20 +08:00
|
|
|
$uselegacyreader = $DB->record_exists('log', ['course' => $course->id]);
|
2014-03-04 16:13:28 +08:00
|
|
|
|
|
|
|
// Trigger a report viewed event.
|
|
|
|
$event = \report_participation\event\report_viewed::create(array('context' => $context,
|
|
|
|
'other' => array('instanceid' => $instanceid, 'groupid' => $currentgroup, 'roleid' => $roleid,
|
|
|
|
'timefrom' => $timefrom, 'action' => $action)));
|
|
|
|
$event->trigger();
|
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
// from here assume we have at least the module we're using.
|
|
|
|
$cm = $modinfo->cms[$instanceid];
|
2012-10-30 11:29:53 +08:00
|
|
|
|
|
|
|
// Group security checks.
|
|
|
|
if (!groups_group_visible($currentgroup, $course, $cm)) {
|
|
|
|
echo $OUTPUT->heading(get_string("notingroup"));
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$table = new flexible_table('course-participation-'.$course->id.'-'.$cm->id.'-'.$roleid);
|
|
|
|
$table->course = $course;
|
|
|
|
|
2015-11-03 16:08:10 +00:00
|
|
|
$actionheader = !empty($action) ? get_string($action) : get_string('allactions');
|
|
|
|
|
|
|
|
if (empty($CFG->messaging)) {
|
|
|
|
$table->define_columns(array('fullname', 'count'));
|
|
|
|
$table->define_headers(array(get_string('user'), $actionheader));
|
|
|
|
} else {
|
|
|
|
$table->define_columns(array('fullname', 'count', 'select'));
|
2019-03-14 12:32:09 +08:00
|
|
|
$mastercheckbox = new \core\output\checkbox_toggleall('participants-table', true, [
|
|
|
|
'id' => 'select-all-participants',
|
|
|
|
'name' => 'select-all-participants',
|
|
|
|
'label' => get_string('select'),
|
|
|
|
// Consistent labels to prevent select column from resizing.
|
|
|
|
'selectall' => get_string('select'),
|
|
|
|
'deselectall' => get_string('select'),
|
|
|
|
]);
|
|
|
|
$table->define_headers(array(get_string('user'), $actionheader, $OUTPUT->render($mastercheckbox)));
|
2015-11-03 16:08:10 +00:00
|
|
|
}
|
2011-11-02 11:57:56 +01:00
|
|
|
$table->define_baseurl($baseurl);
|
|
|
|
|
|
|
|
$table->set_attribute('class', 'generaltable generalbox reporttable');
|
|
|
|
|
|
|
|
$table->sortable(true,'lastname','ASC');
|
|
|
|
$table->no_sorting('select');
|
|
|
|
|
|
|
|
$table->set_control_variables(array(
|
|
|
|
TABLE_VAR_SORT => 'ssort',
|
|
|
|
TABLE_VAR_HIDE => 'shide',
|
|
|
|
TABLE_VAR_SHOW => 'sshow',
|
|
|
|
TABLE_VAR_IFIRST => 'sifirst',
|
|
|
|
TABLE_VAR_ILAST => 'silast',
|
|
|
|
TABLE_VAR_PAGE => 'spage'
|
|
|
|
));
|
|
|
|
$table->setup();
|
|
|
|
|
2013-07-09 13:34:39 +08:00
|
|
|
// We want to query both the current context and parent contexts.
|
2014-02-18 15:45:24 +08:00
|
|
|
list($relatedctxsql, $params) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
|
|
|
|
$params['roleid'] = $roleid;
|
|
|
|
$params['instanceid'] = $instanceid;
|
|
|
|
$params['timefrom'] = $timefrom;
|
2011-11-02 11:57:56 +01:00
|
|
|
|
2012-10-30 11:29:53 +08:00
|
|
|
$groupsql = "";
|
|
|
|
if (!empty($currentgroup)) {
|
|
|
|
$groupsql = "JOIN {groups_members} gm ON (gm.userid = u.id AND gm.groupid = :groupid)";
|
|
|
|
$params['groupid'] = $currentgroup;
|
|
|
|
}
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$countsql = "SELECT COUNT(DISTINCT(ra.userid))
|
|
|
|
FROM {role_assignments} ra
|
2011-11-10 10:15:50 +13:00
|
|
|
JOIN {user} u ON u.id = ra.userid
|
2012-10-30 11:29:53 +08:00
|
|
|
$groupsql
|
2013-07-09 13:34:39 +08:00
|
|
|
WHERE ra.contextid $relatedctxsql AND ra.roleid = :roleid";
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$totalcount = $DB->count_records_sql($countsql, $params);
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2014-02-18 15:45:24 +08:00
|
|
|
list($twhere, $tparams) = $table->get_sql_where();
|
2011-11-02 11:57:56 +01:00
|
|
|
if ($twhere) {
|
2014-09-02 09:39:57 +08:00
|
|
|
$params = array_merge($params, $tparams);
|
2011-11-02 11:57:56 +01:00
|
|
|
$matchcount = $DB->count_records_sql($countsql.' AND '.$twhere, $params);
|
|
|
|
} else {
|
|
|
|
$matchcount = $totalcount;
|
|
|
|
}
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2014-02-18 15:45:24 +08:00
|
|
|
$modulename = get_string('modulename', $cm->modname);
|
2011-11-02 11:57:56 +01:00
|
|
|
echo '<div id="participationreport">' . "\n";
|
2014-02-18 15:45:24 +08:00
|
|
|
echo '<p class="modulename">' . $modulename . ' ' . $strviews . '<br />'."\n"
|
|
|
|
. $modulename . ' ' . $strposts . '</p>'."\n";
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$table->initialbars($totalcount > $perpage);
|
|
|
|
$table->pagesize($perpage, $matchcount);
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2014-02-18 15:45:24 +08:00
|
|
|
if ($uselegacyreader || $onlyuselegacyreader) {
|
2014-04-09 16:06:40 +08:00
|
|
|
list($actionsql, $actionparams) = report_participation_get_action_sql($action, $cm->modname);
|
2014-02-18 15:45:24 +08:00
|
|
|
$params = array_merge($params, $actionparams);
|
|
|
|
}
|
|
|
|
|
2014-04-09 16:06:40 +08:00
|
|
|
if (!$onlyuselegacyreader) {
|
|
|
|
list($crudsql, $crudparams) = report_participation_get_crud_sql($action);
|
2014-02-18 15:45:24 +08:00
|
|
|
$params = array_merge($params, $crudparams);
|
|
|
|
}
|
|
|
|
|
2021-03-15 15:36:32 +00:00
|
|
|
$userfieldsapi = \core_user\fields::for_name();
|
2020-10-12 17:51:20 +01:00
|
|
|
$usernamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
|
2014-02-18 15:45:24 +08:00
|
|
|
$users = array();
|
|
|
|
// If using legacy log then get users from old table.
|
|
|
|
if ($uselegacyreader || $onlyuselegacyreader) {
|
|
|
|
$sql = "SELECT ra.userid, $usernamefields, u.idnumber, l.actioncount AS count
|
2014-05-28 14:37:36 -03:00
|
|
|
FROM (SELECT DISTINCT userid FROM {role_assignments} WHERE contextid $relatedctxsql AND roleid = :roleid ) ra
|
2014-02-18 15:45:24 +08:00
|
|
|
JOIN {user} u ON u.id = ra.userid
|
|
|
|
$groupsql
|
|
|
|
LEFT JOIN (
|
|
|
|
SELECT userid, COUNT(action) AS actioncount
|
|
|
|
FROM {log}
|
|
|
|
WHERE cmid = :instanceid
|
2019-06-25 20:15:20 +08:00
|
|
|
AND time > :timefrom " . $actionsql .
|
2014-02-18 15:45:24 +08:00
|
|
|
" GROUP BY userid) l ON (l.userid = ra.userid)";
|
|
|
|
if ($twhere) {
|
|
|
|
$sql .= ' WHERE '.$twhere; // Initial bar.
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($table->get_sql_sort()) {
|
|
|
|
$sql .= ' ORDER BY '.$table->get_sql_sort();
|
|
|
|
}
|
|
|
|
if (!$users = $DB->get_records_sql($sql, $params, $table->get_page_start(), $table->get_page_size())) {
|
|
|
|
$users = array(); // Tablelib will handle saying 'Nothing to display' for us.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-23 16:18:51 +08:00
|
|
|
// Get record from sql_internal_table_reader and merge with records got from legacy log (if needed).
|
2014-02-18 15:45:24 +08:00
|
|
|
if (!$onlyuselegacyreader) {
|
2015-06-24 14:09:23 +08:00
|
|
|
$sql = "SELECT ra.userid, $usernamefields, u.idnumber, COUNT(DISTINCT l.timecreated) AS count
|
|
|
|
FROM {user} u
|
|
|
|
JOIN {role_assignments} ra ON u.id = ra.userid AND ra.contextid $relatedctxsql AND ra.roleid = :roleid
|
2014-02-18 15:45:24 +08:00
|
|
|
$groupsql
|
2015-06-24 14:09:23 +08:00
|
|
|
LEFT JOIN {" . $logtable . "} l
|
|
|
|
ON l.contextinstanceid = :instanceid
|
|
|
|
AND l.timecreated > :timefrom" . $crudsql ."
|
|
|
|
AND l.edulevel = :edulevel
|
|
|
|
AND l.anonymous = 0
|
|
|
|
AND l.contextlevel = :contextlevel
|
|
|
|
AND (l.origin = 'web' OR l.origin = 'ws')
|
|
|
|
AND l.userid = ra.userid";
|
2014-10-13 12:27:17 +13:00
|
|
|
// We add this after the WHERE statement that may come below.
|
|
|
|
$groupbysql = " GROUP BY ra.userid, $usernamefields, u.idnumber";
|
2014-02-18 15:45:24 +08:00
|
|
|
|
|
|
|
$params['edulevel'] = core\event\base::LEVEL_PARTICIPATING;
|
|
|
|
$params['contextlevel'] = CONTEXT_MODULE;
|
|
|
|
|
|
|
|
if ($twhere) {
|
|
|
|
$sql .= ' WHERE '.$twhere; // Initial bar.
|
|
|
|
}
|
2014-10-13 12:27:17 +13:00
|
|
|
$sql .= $groupbysql;
|
2014-02-18 15:45:24 +08:00
|
|
|
if ($table->get_sql_sort()) {
|
|
|
|
$sql .= ' ORDER BY '.$table->get_sql_sort();
|
|
|
|
}
|
|
|
|
if ($u = $DB->get_records_sql($sql, $params, $table->get_page_start(), $table->get_page_size())) {
|
|
|
|
if (empty($users)) {
|
|
|
|
$users = $u;
|
|
|
|
} else {
|
|
|
|
// Merge two users array.
|
|
|
|
foreach ($u as $key => $value) {
|
|
|
|
if (isset($users[$key]) && !empty($users[$key]->count)) {
|
|
|
|
if ($value->count) {
|
|
|
|
$users[$key]->count += $value->count;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$users[$key] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset($u);
|
|
|
|
$u = null;
|
|
|
|
}
|
2011-11-02 11:57:56 +01:00
|
|
|
}
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$data = array();
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2012-01-15 13:37:53 +01:00
|
|
|
$a = new stdClass();
|
2011-11-02 11:57:56 +01:00
|
|
|
$a->count = $totalcount;
|
2017-03-07 23:32:43 +01:00
|
|
|
$a->items = format_string($role->name, true, array('context' => $context));
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
if ($matchcount != $totalcount) {
|
|
|
|
$a->count = $matchcount.'/'.$a->count;
|
|
|
|
}
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
echo '<h2>'.get_string('counteditems', '', $a).'</h2>'."\n";
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2016-09-07 12:38:08 +01:00
|
|
|
if (!empty($CFG->messaging)) {
|
2017-11-07 10:32:51 +08:00
|
|
|
echo '<form action="'.$CFG->wwwroot.'/user/action_redir.php" method="post" id="participantsform">'."\n";
|
2016-09-07 12:38:08 +01:00
|
|
|
echo '<div>'."\n";
|
|
|
|
echo '<input type="hidden" name="id" value="'.$id.'" />'."\n";
|
|
|
|
echo '<input type="hidden" name="returnto" value="'. s($PAGE->url) .'" />'."\n";
|
|
|
|
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'."\n";
|
|
|
|
}
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
foreach ($users as $u) {
|
2015-11-03 16:08:10 +00:00
|
|
|
$data = array();
|
|
|
|
$data[] = html_writer::link(new moodle_url('/user/view.php', array('id' => $u->userid, 'course' => $course->id)),
|
|
|
|
fullname($u, true));
|
|
|
|
$data[] = !empty($u->count) ? get_string('yes').' ('.$u->count.') ' : get_string('no');
|
|
|
|
|
|
|
|
if (!empty($CFG->messaging)) {
|
2019-03-14 12:32:09 +08:00
|
|
|
$togglegroup = 'participants-table';
|
|
|
|
if (empty($u->count)) {
|
|
|
|
$togglegroup .= ' no';
|
|
|
|
}
|
|
|
|
$checkbox = new \core\output\checkbox_toggleall($togglegroup, false, [
|
|
|
|
'classes' => 'usercheckbox',
|
|
|
|
'name' => 'user' . $u->userid,
|
|
|
|
'value' => $u->count,
|
|
|
|
]);
|
|
|
|
$data[] = $OUTPUT->render($checkbox);
|
2015-11-03 16:08:10 +00:00
|
|
|
}
|
2011-11-02 11:57:56 +01:00
|
|
|
$table->add_data($data);
|
|
|
|
}
|
2006-03-09 08:24:10 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
$table->print_html();
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2011-11-02 11:57:56 +01:00
|
|
|
if ($perpage == SHOW_ALL_PAGE_SIZE) {
|
2014-10-13 11:46:37 +13:00
|
|
|
$perpageurl = new moodle_url($baseurl, array('perpage' => DEFAULT_PAGE_SIZE));
|
|
|
|
echo html_writer::start_div('', array('id' => 'showall'));
|
|
|
|
echo html_writer::link($perpageurl, get_string('showperpage', '', DEFAULT_PAGE_SIZE));
|
|
|
|
echo html_writer::end_div();
|
|
|
|
} else if ($matchcount > 0 && $perpage < $matchcount) {
|
|
|
|
$perpageurl = new moodle_url($baseurl, array('perpage' => SHOW_ALL_PAGE_SIZE));
|
|
|
|
echo html_writer::start_div('', array('id' => 'showall'));
|
|
|
|
echo html_writer::link($perpageurl, get_string('showall', '', $matchcount));
|
|
|
|
echo html_writer::end_div();
|
2006-03-09 08:24:10 +00:00
|
|
|
}
|
2007-08-17 19:09:11 +00:00
|
|
|
|
2015-11-03 16:08:10 +00:00
|
|
|
if (!empty($CFG->messaging)) {
|
2016-11-16 16:09:20 +00:00
|
|
|
echo '<div class="selectbuttons btn-group">';
|
2015-11-03 16:08:10 +00:00
|
|
|
if ($perpage >= $matchcount) {
|
2019-03-14 12:32:09 +08:00
|
|
|
$checknos = new \core\output\checkbox_toggleall('participants-table no', true, [
|
|
|
|
'id' => 'select-nos',
|
|
|
|
'name' => 'select-nos',
|
|
|
|
'label' => get_string('selectnos'),
|
|
|
|
'selectall' => get_string('selectnos'),
|
|
|
|
'deselectall' => get_string('deselectnos'),
|
|
|
|
], true);
|
|
|
|
echo $OUTPUT->render($checknos);
|
2015-11-03 16:08:10 +00:00
|
|
|
}
|
|
|
|
echo '</div>';
|
2020-01-27 15:06:29 +01:00
|
|
|
echo '<div class="py-3">';
|
2019-08-15 08:44:16 +08:00
|
|
|
echo html_writer::label(get_string('withselectedusers'), 'formactionid');
|
2017-11-07 10:32:51 +08:00
|
|
|
$displaylist['#messageselect'] = get_string('messageselectadd');
|
2019-03-14 12:32:09 +08:00
|
|
|
$withselectedparams = array(
|
|
|
|
'id' => 'formactionid',
|
|
|
|
'data-action' => 'toggle',
|
|
|
|
'data-togglegroup' => 'participants-table',
|
|
|
|
'data-toggle' => 'action',
|
|
|
|
'disabled' => true
|
|
|
|
);
|
|
|
|
echo html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), $withselectedparams);
|
2015-11-03 16:08:10 +00:00
|
|
|
echo '</div>';
|
|
|
|
echo '</div>'."\n";
|
|
|
|
echo '</form>'."\n";
|
|
|
|
|
2017-11-07 10:32:51 +08:00
|
|
|
$options = new stdClass();
|
|
|
|
$options->courseid = $course->id;
|
|
|
|
$options->noteStateNames = note_get_state_names();
|
|
|
|
$options->stateHelpIcon = $OUTPUT->help_icon('publishstate', 'notes');
|
2020-05-18 10:16:55 +08:00
|
|
|
$PAGE->requires->js_call_amd('report_participation/participants', 'init', [$options]);
|
2011-11-02 11:57:56 +01:00
|
|
|
}
|
2016-09-07 12:38:08 +01:00
|
|
|
echo '</div>'."\n";
|
2011-11-02 11:57:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo $OUTPUT->footer();
|