]> git.mjollnir.org Git - moodle.git/commitdiff
Remember the recently used grading evaluation settings
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:18:53 +0000 (18:18 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:18:53 +0000 (18:18 +0000)
mod/workshop/eval/best/db/install.xml [new file with mode: 0644]
mod/workshop/eval/best/lang/en_utf8/workshopeval_best.php
mod/workshop/eval/best/lib.php
mod/workshop/eval/best/settings.php [new file with mode: 0644]
mod/workshop/eval/best/settings_form.php
mod/workshop/eval/best/version.php
mod/workshop/eval/lib.php
mod/workshop/lang/en_utf8/workshop.php
mod/workshop/settings.php

diff --git a/mod/workshop/eval/best/db/install.xml b/mod/workshop/eval/best/db/install.xml
new file mode 100644 (file)
index 0000000..4a115e7
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<XMLDB PATH="mod/workshop/eval/best/db" VERSION="20091020" COMMENT="XMLDB file for Moodle mod/workshop/eval/best"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd"
+>
+  <TABLES>
+    <TABLE NAME="workshopeval_best_settings" COMMENT="Settings for the grading evaluation subplugin Distance from the best assessment.">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="workshopid"/>
+        <FIELD NAME="workshopid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="id" NEXT="comparison"/>
+        <FIELD NAME="comparison" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="5" SEQUENCE="false" COMMENT="Here we store the recently set factor of comparison of assessment in the given workshop. Reasonable values are from 1 to 10 or so. Default to 5." PREVIOUS="workshopid"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fkuq_workshop"/>
+        <KEY NAME="fkuq_workshop" TYPE="foreign-unique" FIELDS="workshopid" REFTABLE="workshop" REFFIELDS="id" COMMENT="Every workshop can have only one settings record" PREVIOUS="primary"/>
+      </KEYS>
+    </TABLE>
+  </TABLES>
+</XMLDB>
\ No newline at end of file
index 86fcd0088dc516011977abdd15072db4c276c62d..befa8442aae38ede5b5b0ee6e0f45ae250d6539e 100644 (file)
@@ -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';
index 6148ed2c894062a7f4b44f75bd12805cc1c08f1e..b4aa88dcae3b7477c54ac4cd4173a2fc6226c182 100644 (file)
@@ -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 (file)
index 0000000..9221f60
--- /dev/null
@@ -0,0 +1,36 @@
+<?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/>.
+
+/**
+ * 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 <david.mudrak@gmail.com>
+ * @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));
index 393159bf4848738286c185cba975cf2f8711f354..fe0af1c0d8de79e27eab959f62a219c1f78218bf 100644 (file)
@@ -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'));
 
index 77e48f5e14457a3586a5a09d4b821e0b4cad9cb5..87338a355d5d44c54fe4f602793fa02414fc6165 100644 (file)
@@ -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
index 36fe679152dfda6a6252fde0b697eaee4dfd412b..5cf8fdf69f0b1fddc22614b82e6c35a55d06ed23 100644 (file)
@@ -18,7 +18,7 @@
 /**
  * This file defines interface of all grading evaluation classes
  *
- * @package   mod-workshop
+ * @package   mod-workshop-eval
  * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
  * @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 {
 
index 25c2b46c0f03bbc7fcf20e18c8f1feec155c0f8f..f41b043cd81bdd177b709cca83e6a503f6d10392 100644 (file)
@@ -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'] = ' &gt; ';
 $string['gradereceivedfrom'] = ' &lt; ';
-$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';
index 6877a1d2b7dd7179c717ffcb6444ce3db70e9a6f..c36bbb9f308d6518dd98d0a01b3d6ef725c7ce69 100644 (file)
@@ -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);
     }
 }