Skip to content
Permalink
Browse files

MDL-36135 Display the workshop grading evaluation method chooser

Teachers can now choose the actual grading evaluation method to use
during the grading evaluation phase. The workshopeval_best is still used
as the default one (this may be made configurable later, although there
is no big benefit of it).
  • Loading branch information...
mudrd8mz committed Oct 19, 2012
1 parent 7e8ae12 commit a93dc3ecb700ac1407e5ce1a7cde8c5c522d1481
Showing with 56 additions and 3 deletions.
  1. +1 −1 mod/workshop/lang/en/workshop.php
  2. +0 −1 mod/workshop/lib.php
  3. +35 −1 mod/workshop/locallib.php
  4. +5 −0 mod/workshop/styles.css
  5. +15 −0 mod/workshop/view.php
@@ -100,7 +100,7 @@
$string['evaluategradeswait'] = 'Please wait until the assessments are evaluated and the grades are calculated';
$string['evaluation'] = 'Grading evaluation';
$string['evaluationmethod'] = 'Grading evaluation method';
$string['evaluationmethod_help'] = 'The grading evaluation method determines how the grade for assessment is calculated. There is currently just one option - comparison with the best assessment.';
$string['evaluationmethod_help'] = 'The grading evaluation method determines how the grade for assessment is calculated. You can let it re-calculate grades repeatedly with different settings unless you are happy with the result.';
$string['example'] = 'Example submission';
$string['exampleadd'] = 'Add example submission';
$string['exampleassess'] = 'Assess example submission';
@@ -136,7 +136,6 @@ function workshop_update_instance(stdclass $workshop) {
$workshop->useselfassessment = (int)!empty($workshop->useselfassessment);
$workshop->latesubmissions = (int)!empty($workshop->latesubmissions);
$workshop->phaseswitchassessment = (int)!empty($workshop->phaseswitchassessment);
$workshop->evaluation = 'best';
// todo - if the grading strategy is being changed, we must replace all aggregated peer grades with nulls
// todo - if maximum grades are being changed, we should probably recalculate or invalidate them
@@ -185,7 +185,6 @@ public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course,
} else {
$this->context = $context;
}
$this->evaluation = 'best'; // todo make this configurable although we have no alternatives yet
}
////////////////////////////////////////////////////////////////////////////////
@@ -283,6 +282,19 @@ public static function available_strategies_list() {
return $forms;
}
/**
* Returns the list of available grading evaluation methods
*
* @return array of (string)name => (string)localized title
*/
public static function available_evaluators_list() {
$evals = array();
foreach (get_plugin_list_with_file('workshopeval', 'lib.php', false) as $eval => $evalpath) {
$evals[$eval] = get_string('pluginname', 'workshopeval_' . $eval);
}
return $evals;
}
/**
* Return an array of possible values of assessment dimension weight
*
@@ -1229,6 +1241,28 @@ public function grading_strategy_instance() {
return $this->strategyinstance;
}
/**
* Sets the current evaluation method to the given plugin.
*
* @param string $method the name of the workshopeval subplugin
* @return bool true if successfully set
* @throws coding_exception if attempting to set a non-installed evaluation method
*/
public function set_grading_evaluation_method($method) {
global $DB;
$evaluationlib = dirname(__FILE__) . '/eval/' . $method . '/lib.php';
if (is_readable($evaluationlib)) {
$this->evaluationinstance = null;
$this->evaluation = $method;
$DB->set_field('workshop', 'evaluation', $method, array('id' => $this->id));
return true;
}
throw new coding_exception('Attempt to set a non-existing evaluation method.');
}
/**
* Returns instance of grading evaluation class
*
@@ -520,3 +520,8 @@
.path-mod-workshop div.buttonwithhelp div {
display: inline;
}

.path-mod-workshop #evaluationmethodchooser {
margin: 2em auto;
text-align: center;
}
@@ -38,6 +38,7 @@
$perpage = optional_param('perpage', null, PARAM_INT);
$sortby = optional_param('sortby', 'lastname', PARAM_ALPHA);
$sorthow = optional_param('sorthow', 'ASC', PARAM_ALPHA);
$eval = optional_param('eval', null, PARAM_PLUGIN);
if ($id) {
$cm = get_coursemodule_from_id('workshop', $id, 0, false, MUST_EXIST);
@@ -73,6 +74,13 @@
redirect($PAGE->url);
}
if ($eval) {
require_sesskey();
require_capability('mod/workshop:overridegrades', $workshop->context);
$workshop->set_grading_evaluation_method($eval);
redirect($PAGE->url);
}
$output = $PAGE->get_renderer('mod_workshop');
$userplan = new workshop_user_plan($workshop, $USER->id);
@@ -395,6 +403,13 @@
$showreviewernames = has_capability('mod/workshop:viewreviewernames', $workshop->context);
if (has_capability('mod/workshop:overridegrades', $PAGE->context)) {
// Print a drop-down selector to change the current evaluation method.
$selector = new single_select($PAGE->url, 'eval', workshop::available_evaluators_list(),
$workshop->evaluation, false, 'evaluationmethodchooser');
$selector->set_label(get_string('evaluationmethod', 'mod_workshop'));
$selector->set_help_icon('evaluationmethod', 'mod_workshop');
$selector->method = 'post';
echo $output->render($selector);
// load the grading evaluator
$evaluator = $workshop->grading_evaluation_instance();
$form = $evaluator->get_settings_form(new moodle_url($workshop->aggregate_url(),

0 comments on commit a93dc3e

Please sign in to comment.
You can’t perform that action at this time.