Skip to content
Snippets Groups Projects
Commit f49952d3 authored by Astor Bizard's avatar Astor Bizard :dog2:
Browse files

Improved VPL groups consistency check interface for admins.

parent c17fc680
No related branches found
No related tags found
1 merge request!1Dev: Submissions list rework, webservices and bugfixes
...@@ -43,6 +43,9 @@ $string ['browserupdate'] = 'Please update your browser to the last version<br / ...@@ -43,6 +43,9 @@ $string ['browserupdate'] = 'Please update your browser to the last version<br /
$string ['calculate'] = 'Calculate'; $string ['calculate'] = 'Calculate';
$string ['changesNotSaved'] = 'Changes have not been saved'; $string ['changesNotSaved'] = 'Changes have not been saved';
$string ['check_jail_servers'] = 'Check execution servers'; $string ['check_jail_servers'] = 'Check execution servers';
$string ['checkforcourse'] = 'Check for course {$a}';
$string ['checkgroups'] = 'Check groups consistency';
$string ['checksitewide'] = 'Check sitewide';
$string ['clipboard'] = 'Clipboard'; $string ['clipboard'] = 'Clipboard';
$string ['closed'] = 'Closed'; $string ['closed'] = 'Closed';
$string ['comments'] = 'Comments'; $string ['comments'] = 'Comments';
......
...@@ -38,20 +38,40 @@ if (! $course = $DB->get_record( "course", array ( 'id' => $id ) )) { ...@@ -38,20 +38,40 @@ if (! $course = $DB->get_record( "course", array ( 'id' => $id ) )) {
require_course_login( $course ); require_course_login( $course );
$PAGE->set_url( '/mod/vpl/views/checkvpls.php', array ( 'id' => $id ) ); $PAGE->set_url( '/mod/vpl/views/checkvpls.php', array ( 'id' => $id ) );
$admin = is_siteadmin();
$sitewide = $admin && optional_param('sitewide', 0, PARAM_INT);
$strvpls = get_string( 'modulenameplural', VPL ); $strvpls = get_string( 'modulenameplural', VPL );
$pagetitle = get_string( 'checkgroups', VPL );
$coursename = format_string( $course->fullname );
if (!$sitewide) {
$pagetitle .= ' (' . $coursename . ')';
}
$PAGE->navbar->add( $strvpls ); $PAGE->navbar->add( $strvpls );
$PAGE->set_title( get_string('checkall') ); $PAGE->set_title( $pagetitle );
$PAGE->set_heading( $course->fullname ); $PAGE->set_heading( $coursename );
echo $OUTPUT->header(); echo $OUTPUT->header();
echo $OUTPUT->heading( get_string('checkall')); echo $OUTPUT->heading( $pagetitle );
$einfo = array ( 'context' => \context_course::instance( $course->id ), $einfo = array ( 'context' => \context_course::instance( $course->id ),
'objectid' => $course->id, 'objectid' => $course->id,
'userid' => $USER->id 'userid' => $USER->id
); );
\mod_vpl\event\vpl_checkvpls::log( $einfo ); \mod_vpl\event\vpl_checkvpls::log( $einfo );
$admin = is_siteadmin();
if ($admin) { if ($admin) {
$url = $PAGE->url;
$filterurls = array(
$url->out(true, array('sitewide' => 0)),
$url->out(true, array('sitewide' => 1))
);
echo $OUTPUT->url_select( array (
$filterurls [0] => get_string( 'checkforcourse', VPL, $coursename ),
$filterurls [1] => get_string( 'checksitewide', VPL )
), $filterurls [$sitewide], null );
echo '<br>';
}
if ($sitewide) {
$ovpls = $DB->get_records( VPL, array(), 'id' ); $ovpls = $DB->get_records( VPL, array(), 'id' );
} else { } else {
$ovpls = get_all_instances_in_course( VPL, $course ); $ovpls = get_all_instances_in_course( VPL, $course );
...@@ -59,8 +79,8 @@ if ($admin) { ...@@ -59,8 +79,8 @@ if ($admin) {
// Get and select vpls to show. // Get and select vpls to show.
foreach ($ovpls as $ovpl) { foreach ($ovpls as $ovpl) {
$vpl = new mod_vpl( false, $ovpl->id ); $vpl = new mod_vpl( false, $ovpl->id );
$instance = $vpl->get_instance();
if ( $vpl->is_group_activity() ) { if ( $vpl->is_group_activity() ) {
$instance = $vpl->get_instance();
// Check groups concistence. // Check groups concistence.
$groupingid = $vpl->get_course_module()->groupingid; $groupingid = $vpl->get_course_module()->groupingid;
$groups = groups_get_all_groups($vpl->get_course()->id, 0, $groupingid); $groups = groups_get_all_groups($vpl->get_course()->id, 0, $groupingid);
...@@ -98,8 +118,8 @@ foreach ($ovpls as $ovpl) { ...@@ -98,8 +118,8 @@ foreach ($ovpls as $ovpl) {
} }
$title = ''; $title = '';
if ($admin) { if ($sitewide) {
$title = $vpl->get_course()->shortname . ': '; $title = $vpl->get_course()->shortname . ' > ';
} }
$title .= $vpl->get_printable_name(); $title .= $vpl->get_printable_name();
$icon = 'check'; $icon = 'check';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment