MDL-33327: Layout changes for the assignment grading table

Move the grading actions to a single drop down list above the header
Move the grading options below the grading table (although that is inconsistent)

Conflicts:

	mod/assign/gradingtable.php
	mod/assign/locallib.php
This commit is contained in:
Damyon Wiese
2012-06-14 15:22:42 +08:00
parent 414ce30812
commit a1e54f4d6c
8 changed files with 36 additions and 106 deletions
-63
View File
@@ -1,63 +0,0 @@
<?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/>.
/**
* This file contains the forms to create and edit an instance of this module
*
* @package mod_assign
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
/** Include formslib.php */
require_once ($CFG->libdir.'/formslib.php');
/** Include locallib.php */
require_once($CFG->dirroot . '/mod/assign/locallib.php');
/**
* Assignment grading actions form
*
* @package mod_assign
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_assign_grading_actions_form extends moodleform {
/**
* The definition for this form (called by the parent constructor)
*/
function definition() {
$mform = $this->_form;
$data = $this->_customdata;
$links = $data['links'];
$cm = $data['cm'];
$mform->addElement('header', 'general', get_string('gradingactions', 'assign'));
// visible elements
$autosubmit = array('onchange'=>'form.submit();');
$mform->addElement('select', 'url', '', $links, $autosubmit);
// hidden params
$mform->addElement('hidden', 'id', $cm);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'action', 'redirect');
$mform->setType('action', PARAM_ALPHA);
// buttons
$this->add_action_buttons(false, get_string('submitaction', 'assign'));
}
}
+5 -4
View File
@@ -45,7 +45,6 @@ class mod_assign_grading_batch_operations_form extends moodleform {
$mform = $this->_form;
$instance = $this->_customdata;
$mform->addElement('header', 'general', get_string('batchoperations', 'assign'));
// visible elements
$options = array();
$options['lock'] = get_string('locksubmissions', 'assign');
@@ -53,14 +52,16 @@ class mod_assign_grading_batch_operations_form extends moodleform {
if ($instance['submissiondrafts']) {
$options['reverttodraft'] = get_string('reverttodraft', 'assign');
}
$mform->addElement('select', 'operation', get_string('batchoperationsdescription', 'assign'), $options, array('class'=>'operation ignoredirty'));
$mform->addHelpButton('operation', 'batchoperationsdescription', 'assign');
$mform->addElement('hidden', 'action', 'batchgradingoperation');
$mform->addElement('hidden', 'id', $instance['cm']);
$mform->addElement('hidden', 'selectedusers', '', array('class'=>'selectedusers'));
$mform->addElement('hidden', 'returnaction', 'grading');
$mform->addElement('submit', 'submit', get_string('submit'));
$objs = array();
$objs[] =& $mform->createElement('select', 'operation', '', $options);
$objs[] =& $mform->createElement('submit', 'submit', get_string('go'));
$mform->addElement('group', 'actionsgrp', get_string('batchoperationsdescription', 'assign'), $objs, ' ', false);
}
}
+3 -6
View File
@@ -56,9 +56,7 @@ $string['assignsubmission'] = 'Submission plugin';
$string['assignsubmissionpluginname'] = 'Submission plugin';
$string['availability'] = 'Availability';
$string['backtoassignment'] = 'Back to assignment';
$string['batchoperations'] = 'Batch operations';
$string['batchoperationsdescription'] = 'Perform action on selected row(s)';
$string['batchoperationsdescription_help'] = 'The selected operation will be performed on all of the selected rows in the grading table. ';
$string['batchoperationsdescription'] = 'With selected...';
$string['batchoperationconfirmlock'] = 'Lock all selected submissions?';
$string['batchoperationconfirmunlock'] = 'Unlock all selected submissions?';
$string['batchoperationconfirmreverttodraft'] = 'Revert selected submissions to draft?';
@@ -135,8 +133,7 @@ $string['gradeoutofhelp'] = 'Grade';
$string['gradeoutofhelp_help'] = 'Enter the grade for the student\'s submission here. You may include decimals.';
$string['gradestudent'] = 'Grade student: (id={$a->id}, fullname={$a->fullname}). ';
$string['grading'] = 'Grading';
$string['gradingoptions'] = 'Grade listing options';
$string['gradingactions'] = 'Grading actions';
$string['gradingoptions'] = 'Options';
$string['gradingstatus'] = 'Grading status';
$string['gradingstudentprogress'] = 'Grading student {$a->index} of {$a->count}';
$string['gradingsummary'] = 'Grading summary';
@@ -196,7 +193,7 @@ $string['reverttodraft'] = 'Revert the submission to draft status.';
$string['reverttodraftshort'] = 'Revert the submission to draft';
$string['reviewed'] = 'Reviewed';
$string['savechanges'] = 'Save changes';
$string['saveallchanges'] = 'Save all changes';
$string['saveallquickgradingchanges'] = 'Save all quick grading changes';
$string['savenext'] = 'Save and show next';
$string['sendnotifications'] = 'Notify graders about submissions';
$string['sendnotifications_help'] = 'If enabled, graders (usually teachers) receive a message whenever a student submits an assignment, early, on time and late. Message methods are configurable.';
+15 -26
View File
@@ -361,8 +361,6 @@ class assign {
} else if ($action == 'nextgrade') {
$mform = null;
$o .= $this->view_single_grade_page($mform, 1);
} else if ($action == 'redirect') {
redirect(required_param('url', PARAM_TEXT));
} else if ($action == 'grade') {
$o .= $this->view_single_grade_page($mform);
} else if ($action == 'viewpluginassignfeedback') {
@@ -904,10 +902,12 @@ class assign {
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade,2);
$o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
return $o;
} else if ($grade == -1 || $grade === null) {
return '-';
} else {
return format_float(($grade),2) .'&nbsp;/&nbsp;'. format_float($this->get_instance()->grade,2);
if ($grade == -1 || $grade === null) {
return '-';
} else {
return format_float(($grade),2) .'&nbsp;/&nbsp;'. format_float($this->get_instance()->grade,2);
}
}
} else {
@@ -1690,32 +1690,22 @@ class assign {
global $USER, $CFG;
// Include grading options form
require_once($CFG->dirroot . '/mod/assign/gradingoptionsform.php');
require_once($CFG->dirroot . '/mod/assign/gradingactionsform.php');
require_once($CFG->dirroot . '/mod/assign/quickgradingform.php');
require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php');
$o = '';
$links = array();
$selecturl = (string)(new moodle_url('/mod/assign/view.php',
array('action'=>'grading', 'id'=>$this->get_course_module()->id)));
$links[$selecturl] = get_string('selectlink', 'assign');
if (has_capability('gradereport/grader:view', $this->get_course_context()) &&
has_capability('moodle/grade:viewall', $this->get_course_context())) {
$gradebookurl = (string) (new moodle_url('/grade/report/grader/index.php',
array('id' => $this->get_course()->id)));
$gradebookurl = '/grade/report/grader/index.php?id=' . $this->get_course()->id;
$links[$gradebookurl] = get_string('viewgradebook', 'assign');
}
if ($this->is_any_submission_plugin_enabled()) {
$downloadurl = (string) (new moodle_url('/mod/assign/view.php',
array('id' => $this->get_course_module()->id,
'action' => 'downloadall')));
$downloadurl = '/mod/assign/view.php?id=' . $this->get_course_module()->id . '&action=downloadall';
$links[$downloadurl] = get_string('downloadall', 'assign');
}
$gradingactionsform = new mod_assign_grading_actions_form(null,
array('links'=>$links,
'cm'=>$this->get_course_module()->id),
'post', '',
array('class'=>'gradingactionsform'));
$gradingactions = new url_select($links);
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
@@ -1757,8 +1747,11 @@ class assign {
plagiarism_update_status($this->get_course(), $this->get_course_module());
}
$o .= $this->output->render(new assign_form('gradingactionsform', $gradingactionsform));
$o .= $this->output->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options'));
$actionformtext = $this->output->render($gradingactions);
$o .= $this->output->render(new assign_header($this->get_instance(),
$this->get_context(), false, $this->get_course_module()->id, get_string('grading', 'assign'), $actionformtext));
$o .= groups_print_activity_menu($this->get_course_module(), $CFG->wwwroot . '/mod/assign/view.php?id=' . $this->get_course_module()->id.'&action=grading', true);
// load and print the table of submissions
if ($showquickgrading && $quickgrading) {
@@ -1777,6 +1770,7 @@ class assign {
// if no enrolled user in a course then don't display the batch operations feature
$o .= $this->output->render(new assign_form('gradingbatchoperationsform', $gradingbatchoperationsform));
}
$o .= $this->output->render(new assign_form('gradingoptionsform', $gradingoptionsform, 'M.mod_assign.init_grading_options'));
return $o;
}
@@ -1795,11 +1789,6 @@ class assign {
// only load this if it is
$o .= $this->output->render(new assign_header($this->get_instance(),
$this->get_context(), false, $this->get_course_module()->id, get_string('grading', 'assign')));
$o .= groups_print_activity_menu($this->get_course_module(), $CFG->wwwroot . '/mod/assign/view.php?id=' . $this->get_course_module()->id.'&action=grading', true);
$o .= $this->view_grading_table();
$o .= $this->view_footer();
+1 -2
View File
@@ -55,8 +55,7 @@ class mod_assign_quick_grading_form extends moodleform {
$mform->setType('action', PARAM_ALPHA);
// buttons
$mform->addElement('header', 'general', get_string('quickgrading', 'assign'));
$mform->addElement('submit', 'savequickgrades', get_string('saveallchanges', 'assign'));
$mform->addElement('submit', 'savequickgrades', get_string('saveallquickgradingchanges', 'assign'));
}
}
+5 -1
View File
@@ -365,6 +365,8 @@ class assign_header implements renderable {
var $coursemoduleid = 0;
/** @var string $subpage optional subpage (extra level in the breadcrumbs) */
var $subpage = '';
/** @var string $preface optional preface (text to show before the heading) */
var $preface = '';
/**
* Constructor
@@ -374,13 +376,15 @@ class assign_header implements renderable {
* @param bool $showintro - show or hide the intro
* @param int $coursemoduleid - the course module id
* @param string $subpage - an optional sub page in the navigation
* @param string $preface - an optional preface to show before the heading
*/
public function __construct(stdClass $assign, $context, $showintro, $coursemoduleid, $subpage='') {
public function __construct(stdClass $assign, $context, $showintro, $coursemoduleid, $subpage='', $preface='') {
$this->assign = $assign;
$this->context = $context;
$this->showintro = $showintro;
$this->coursemoduleid = $coursemoduleid;
$this->subpage = $subpage;
$this->preface = $preface;
}
}
+3
View File
@@ -206,6 +206,9 @@ class mod_assign_renderer extends plugin_renderer_base {
$this->page->set_heading($header->assign->name);
$o .= $this->output->header();
if ($header->preface) {
$o .= $header->preface;
}
$o .= $this->output->heading(format_string($header->assign->name,false, array('context' => $header->context)));
if ($header->showintro) {
+4 -4
View File
@@ -24,7 +24,6 @@ div.gradingsummary .generaltable {
.gradingsummarytable,
.feedbacktable,
.lockedsubmission,
.gradingbatchoperationsform,
.submissionsummarytable {
margin-top: 1em;
}
@@ -39,9 +38,10 @@ div.submissionsummarytable table tbody tr td.c0 {
font-weight: 900;
}
.jsenabled .gradingactionsform .hidden {display: none;}
.jsenabled .gradingoptionsform .hidden {display: none;}
.jsenabled .gradingoptionsform .fsubmit {display: none;}
.jsenabled .gradingtable .c1 select {display: none;}
.quickgradingform .mform fieldset { margin: 0px; padding: 0px; }
.gradingbatchoperationsform .mform fieldset { margin: 0px; padding: 0px; }
td.submissionstatus,
div.submissionstatus,
@@ -127,4 +127,4 @@ div.earlysubmission {
#page-mod-assign-view div.gradingtable tr .quickgrademodified {
background-color: #FFCC99;
}
}