diff --git a/mod/workshop/eval/best/db/install.xml b/mod/workshop/eval/best/db/install.xml
new file mode 100644
index 00000000000..4a115e706d4
--- /dev/null
+++ b/mod/workshop/eval/best/db/install.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mod/workshop/eval/best/lang/en_utf8/workshopeval_best.php b/mod/workshop/eval/best/lang/en_utf8/workshopeval_best.php
index 86fcd0088dc..befa8442aae 100644
--- a/mod/workshop/eval/best/lang/en_utf8/workshopeval_best.php
+++ b/mod/workshop/eval/best/lang/en_utf8/workshopeval_best.php
@@ -31,5 +31,6 @@ $string['comparisonlevel3'] = 'strict';
$string['comparisonlevel5'] = 'fair';
$string['comparisonlevel7'] = 'lax';
$string['comparisonlevel9'] = 'very lax';
+$string['configcomparison'] = 'Default value of the factor that influnce the grading evaluation.';
$string['pluginname'] = 'Distance to the best assessment';
$string['settings'] = 'Grading evaluation settings';
diff --git a/mod/workshop/eval/best/lib.php b/mod/workshop/eval/best/lib.php
index 6148ed2c894..b4aa88dcae3 100644
--- a/mod/workshop/eval/best/lib.php
+++ b/mod/workshop/eval/best/lib.php
@@ -37,6 +37,9 @@ class workshop_best_evaluation implements workshop_evaluation {
/** @var workshop the parent workshop instance */
protected $workshop;
+ /** @var the recently used settings in this workshop */
+ protected $settings;
+
/**
* Constructor
*
@@ -44,7 +47,9 @@ class workshop_best_evaluation implements workshop_evaluation {
* @return void
*/
public function __construct(workshop $workshop) {
+ global $DB;
$this->workshop = $workshop;
+ $this->settings = $DB->get_record('workshopeval_best_settings', array('workshopid' => $this->workshop->id));
}
/**
@@ -53,6 +58,7 @@ class workshop_best_evaluation implements workshop_evaluation {
* This function relies on the grading strategy subplugin providing get_assessments_recordset() method.
* {@see self::process_assessments()} for the required structure of the recordset.
*
+ * @param stdClass $settings The settings for this round of evaluation
* @param null|int|array $restrict If null, update all reviewers, otherwise update just grades for the given reviewers(s)
*
* @return void
@@ -60,6 +66,18 @@ class workshop_best_evaluation implements workshop_evaluation {
public function update_grading_grades(stdClass $settings, $restrict=null) {
global $DB;
+ // remember the recently used settings for this workshop
+ if (empty($this->settings)) {
+ $record = new stdClass();
+ $record->workshopid = $this->workshop->id;
+ $record->comparison = $settings->comparison;
+ $DB->insert_record('workshopeval_best_settings', $record);
+ } elseif ($this->settings->comparison != $settings->comparison) {
+ $DB->set_field('workshopeval_best_settings', 'comparison', $settings->comparison,
+ array('workshopid' => $this->workshop->id));
+ }
+
+ // get the grading strategy instance
$grader = $this->workshop->grading_strategy_instance();
// get the information about the assessment dimensions
@@ -96,11 +114,11 @@ class workshop_best_evaluation implements workshop_evaluation {
*/
public function get_settings_form(moodle_url $actionurl=null) {
global $CFG; // needed because the included files use it
+ global $DB;
require_once(dirname(__FILE__) . '/settings_form.php');
- $current = null; // the recently used setting - todo where should it be stored?
- $customdata['current'] = $current;
$customdata['workshop'] = $this->workshop;
+ $customdata['current'] = $this->settings;
$attributes = array('class' => 'evalsettingsform best');
return new workshop_best_evaluation_settings_form($actionurl, $customdata, 'post', '', $attributes);
diff --git a/mod/workshop/eval/best/settings.php b/mod/workshop/eval/best/settings.php
new file mode 100644
index 00000000000..9221f608b1e
--- /dev/null
+++ b/mod/workshop/eval/best/settings.php
@@ -0,0 +1,36 @@
+.
+
+/**
+ * The configuration variables for "Best" grading evaluation
+ *
+ * The values defined here are used as defaults for all module instances.
+ *
+ * @package mod-workshop-eval-best
+ * @copyright 2009 David Mudrak
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$options = array();
+for ($i = 9; $i >= 1; $i = $i-2) {
+ $options[$i] = get_string('comparisonlevel' . $i, 'workshopeval_best');
+}
+
+$settings->add(new admin_setting_configselect('workshopeval_best/comparison', get_string('comparison', 'workshopeval_best'),
+ get_string('configcomparison', 'workshopeval_best'), 5, $options));
diff --git a/mod/workshop/eval/best/settings_form.php b/mod/workshop/eval/best/settings_form.php
index 393159bf484..fe0af1c0d8d 100644
--- a/mod/workshop/eval/best/settings_form.php
+++ b/mod/workshop/eval/best/settings_form.php
@@ -32,12 +32,13 @@ class workshop_best_evaluation_settings_form extends moodleform {
function definition() {
$mform = $this->_form;
- $current = $this->_customdata['current'];
- $workshop = $this->_customdata['workshop'];
+ $plugindefaults = get_config('workshopeval_best');
+ $current = $this->_customdata['current'];
+ $workshop = $this->_customdata['workshop'];
$mform->addElement('header', 'general', get_string('settings', 'workshopeval_best'));
- $label = get_string('gradingevaluationmethod', 'workshop');
+ $label = get_string('evaluationmethod', 'workshop');
$mform->addElement('static', 'methodname', $label, get_string('pluginname', 'workshopeval_best'));
$mform->setHelpButton('methodname', array('method', $label, 'workshopeval_best'));
@@ -48,7 +49,7 @@ class workshop_best_evaluation_settings_form extends moodleform {
$label = get_string('comparison', 'workshopeval_best');
$mform->addElement('select', 'comparison', $label, $options);
$mform->setHelpButton('comparison', array('comparison', $label, 'workshopeval_best'));
- $mform->setDefault('comparison', 5);
+ $mform->setDefault('comparison', $plugindefaults->comparison);
$mform->addElement('submit', 'submit', get_string('aggregategrades', 'workshop'));
diff --git a/mod/workshop/eval/best/version.php b/mod/workshop/eval/best/version.php
index 77e48f5e144..87338a355d5 100644
--- a/mod/workshop/eval/best/version.php
+++ b/mod/workshop/eval/best/version.php
@@ -25,5 +25,5 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2009091100;
-$plugin->requires = 2009091100; // Requires this Moodle version
+$plugin->version = 2009102000;
+$plugin->requires = 2009100605; // Requires this Moodle version
diff --git a/mod/workshop/eval/lib.php b/mod/workshop/eval/lib.php
index 36fe679152d..5cf8fdf69f0 100644
--- a/mod/workshop/eval/lib.php
+++ b/mod/workshop/eval/lib.php
@@ -18,7 +18,7 @@
/**
* This file defines interface of all grading evaluation classes
*
- * @package mod-workshop
+ * @package mod-workshop-eval
* @copyright 2009 David Mudrak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,6 +27,8 @@ defined('MOODLE_INTERNAL') || die();
/**
* Defines all methods that grading evaluation subplugins has to implement
+ *
+ * @todo
*/
interface workshop_evaluation {
diff --git a/mod/workshop/lang/en_utf8/workshop.php b/mod/workshop/lang/en_utf8/workshop.php
index 25c2b46c0f0..f41b043cd81 100644
--- a/mod/workshop/lang/en_utf8/workshop.php
+++ b/mod/workshop/lang/en_utf8/workshop.php
@@ -87,7 +87,9 @@ $string['editingsubmission'] = 'Editing submission';
$string['editsubmission'] = 'Edit submission';
$string['err_removegrademappings'] = 'Unable to remove the unused grade mappings';
$string['evaluategradeswait'] = 'Please wait until the assessments are evaluated and total grades are calculated';
-$string['examplesbeforeassessment'] = 'Examples are available after own submission and must be assessed before peer/self assessment phase';
+$string['evaluation'] = 'Grading evaluation';
+$string['evaluationmethod'] = 'Grading evaluation method';
+$string['examplesbeforeassessment'] = 'Examples are available after own submission and must be assessed before assessment phase';
$string['examplesbeforesubmission'] = 'Examples must be assessed before own submission';
$string['examplesmode'] = 'Mode of examples assessment';
$string['examplesvoluntary'] = 'Assessment of example submission is voluntary';
@@ -100,7 +102,6 @@ $string['givengrades'] = 'Given grades';
$string['gradedecimals'] = 'Decimal places in grades';
$string['gradegivento'] = ' > ';
$string['gradereceivedfrom'] = ' < ';
-$string['gradingevaluationmethod'] = 'Grading evaluation method';
$string['gradinggrade'] = 'Grade for assessment';
$string['gradinggradeof'] = 'Grade for assessment (of $a)';
$string['gradingsettings'] = 'Grading settings';
@@ -146,7 +147,6 @@ $string['saveandpreview'] = 'Save and preview';
$string['selfassessmentdisabled'] = 'Self-assessment disabled';
$string['someuserswosubmission'] = 'There are some users who have not submitted yet';
$string['strategyaccumulative'] = 'Accumulative grading';
-$string['strategydummy'] = 'Dummy strategy';
$string['strategy'] = 'Grading strategy';
$string['strategyhaschanged'] = 'The workshop grading strategy has changed since the form was opened for editing.';
$string['strategynograding'] = 'No grading';
diff --git a/mod/workshop/settings.php b/mod/workshop/settings.php
index 6877a1d2b7d..c36bbb9f308 100644
--- a/mod/workshop/settings.php
+++ b/mod/workshop/settings.php
@@ -77,7 +77,17 @@ $strategies = get_plugin_list('workshopform');
foreach ($strategies as $strategy => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopformsetting'.$strategy,
- get_string('pluginname', 'workshopform_' . $strategy), ''));
+ get_string('strategy', 'workshop') . ' - ' . get_string('pluginname', 'workshopform_' . $strategy), ''));
+ include($settingsfile);
+ }
+}
+
+// include the settings of grading evaluation subplugins
+$evaluations = get_plugin_list('workshopeval');
+foreach ($evaluations as $evaluation => $path) {
+ if (file_exists($settingsfile = $path . '/settings.php')) {
+ $settings->add(new admin_setting_heading('workshopevalsetting'.$evaluation,
+ get_string('evaluation', 'workshop') . ' - ' . get_string('pluginname', 'workshopeval_' . $evaluation), ''));
include($settingsfile);
}
}