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

Improved group VPLs consistency check display.

parent 5d27ef24
No related branches found
No related tags found
1 merge request!1Dev: Submissions list rework, webservices and bugfixes
......@@ -25,18 +25,19 @@
require_once(dirname(__FILE__).'/../../../config.php');
require_once(dirname(__FILE__).'/../locallib.php');
require_once(dirname(__FILE__).'/../list_util.class.php');
require_once(dirname(__FILE__).'/../vpl_submission.class.php');
$id = required_param( 'id', PARAM_INT ); // Course id.
global $DB, $PAGE, $OUTPUT, $USER;
// Check course existence.
if (! $course = $DB->get_record( "course", array ( 'id' => $id ) )) {
print_error( 'invalidcourseid', '', $id );
}
require_course_login( $course );
$PAGE->set_url( '/mod/views/checkvpls.php', array ( 'id' => $id ) );
$PAGE->set_url( '/mod/vpl/views/checkvpls.php', array ( 'id' => $id ) );
$strvpls = get_string( 'modulenameplural', VPL );
$PAGE->navbar->add( $strvpls );
$PAGE->set_title( get_string('checkall') );
......@@ -55,21 +56,12 @@ if ($admin) {
} else {
$ovpls = get_all_instances_in_course( VPL, $course );
}
$timenow = time();
$vpls = array ();
// Get and select vpls to show.
foreach ($ovpls as $ovpl) {
$vpl = new mod_vpl( false, $ovpl->id );
$instance = $vpl->get_instance();
$vpls[$instance->id] = $vpl;
if ( $vpl->is_group_activity() ) {
// Check groups concistence.
$title = '';
if ($admin) {
$title = $vpl->get_course()->shortname . ': ';
}
$title .= $vpl->get_printable_name();
echo '<h5>' . s($title) . '</h5>';
$groupingid = $vpl->get_course_module()->groupingid;
$groups = groups_get_all_groups($vpl->get_course()->id, 0, $groupingid);
$students = $vpl->get_students();
......@@ -104,25 +96,42 @@ foreach ($ovpls as $ovpl) {
if ( $nogroup > '' ) {
$nogroup .= '</ul>';
}
echo $OUTPUT->box_start();
if ($multigroup > '') {
echo vpl_notice($multigroup, 'error');
$title = '';
if ($admin) {
$title = $vpl->get_course()->shortname . ': ';
}
$title .= $vpl->get_printable_name();
$icon = 'check';
$level = 'success';
$text = '';
if ($nogroup > '') {
echo vpl_notice($nogroup, 'warning');
$icon = 'warning';
$level = 'warning';
$text = $OUTPUT->notification($nogroup, 'warning') . $text;
}
if ( $multigroup == '' ) {
if ($multigroup > '') {
$icon = 'remove';
$level = 'error';
$text = $OUTPUT->notification($multigroup, 'error') . $text;
} else {
$gradersid = array_keys($vpl->get_graders());
$ing = $DB->get_in_or_equal($gradersid);
$select = '( not userid ' . $ing[0] . ' ) and vpl = ? and groupid = 0';
$params = $ing[1];
$params[] = $instance->id;
if ($DB->count_records_select(VPL_SUBMISSIONS, $select, $params) > 0 ) {
echo vpl_notice('Fixing submissions with no group or pre V3.3 data');
$text .= $OUTPUT->notification('Fixing submissions with no group or pre V3.3 data', 'success');
$vpl->update_group_v32();
}
}
echo $OUTPUT->box_end();
echo '<h5>';
echo '<a href="/mod/vpl/view.php?id='.$vpl->get_course_module()->id.'" class="text-'.$level.'">' . s($title) . '</a>';
echo ' <i class="icon fa fa-'.$icon.' text-'.$level.' fa-fw "></i>';
echo '</h5>';
if ($text > '') {
echo $OUTPUT->box($text);
}
}
}
......
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