]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20192 Moving settings.php into suplugins and a small fix
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:00:02 +0000 (18:00 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:00:02 +0000 (18:00 +0000)
mod/workshop/editform.php
mod/workshop/grading/noerrors/edit_form.php
mod/workshop/grading/noerrors/settings.php [new file with mode: 0644]
mod/workshop/settings.php

index 35d36ae7c5c2e8e0429bce6bd09b1529ce50e381..ef6c7d0e3187f1e01786bbb9826967dedc3eef97 100644 (file)
@@ -67,7 +67,7 @@ if ($mform->is_cancelled()) {
 // Output starts here
 
 echo $OUTPUT->header();
-echo $OUTPUT->heading(get_string('strategy' . $workshop->strategy, 'workshop'));
+echo $OUTPUT->heading(get_string('pluginname', 'workshopgrading_' . $workshop->strategy));
 
 $mform->display();
 
index 1e03e8a7f30d45328598d34b03a47f6c9eb9b5ca..9f78138aae08b0dbec7eae38a25482ec2938eee7 100644 (file)
@@ -44,7 +44,7 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form {
      */
     protected function definition_inner(&$mform) {
 
-        $workshopconfig     = get_config('workshop');
+        $plugindefaults     = get_config('workshopgrading_noerrors');
         $nodimensions       = $this->_customdata['nodimensions'];       // number of currently filled dimensions
         $norepeats          = $this->_customdata['norepeats'];          // number of dimensions to display
         $descriptionopts    = $this->_customdata['descriptionopts'];    // wysiwyg fields options
@@ -62,10 +62,10 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form {
             $mform->addElement('editor', 'description__idx_'.$i.'_editor',
                                 get_string('dimensiondescription', 'workshopgrading_noerrors'), '', $descriptionopts);
             $mform->addElement('text', 'grade0__idx_'.$i, get_string('grade0', 'workshopgrading_noerrors'), array('size'=>'15'));
-            $mform->setDefault('grade0__idx_'.$i, $workshopconfig->noerrorsgrade0);
+            $mform->setDefault('grade0__idx_'.$i, $plugindefaults->grade0);
             $mform->setType('grade0__idx_'.$i, PARAM_TEXT);
             $mform->addElement('text', 'grade1__idx_'.$i, get_string('grade1', 'workshopgrading_noerrors'), array('size'=>'15'));
-            $mform->setDefault('grade1__idx_'.$i, $workshopconfig->noerrorsgrade1);
+            $mform->setDefault('grade1__idx_'.$i, $plugindefaults->grade1);
             $mform->setType('grade1__idx_'.$i, PARAM_TEXT);
             $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshopgrading_noerrors'), $weights);
             $mform->setDefault('weight__idx_'.$i, 1);
diff --git a/mod/workshop/grading/noerrors/settings.php b/mod/workshop/grading/noerrors/settings.php
new file mode 100644 (file)
index 0000000..6567b9a
--- /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 "Number of errors" grading strategy
+ *
+ * The values defined here are often used as defaults for all module instances.
+ *
+ * @package   mod-workshop
+ * @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();
+
+$settings->add(new admin_setting_configtext('workshopgrading_noerrors/grade0', get_string('grade0', 'workshopgrading_noerrors'),
+                    get_string('configgrade0', 'workshopgrading_noerrors'),
+                    get_string('grade0default', 'workshopgrading_noerrors'), $paramtype=PARAM_TEXT, $size=15));
+
+$settings->add(new admin_setting_configtext('workshopgrading_noerrors/grade1', get_string('grade1', 'workshopgrading_noerrors'),
+                    get_string('configgrade1', 'workshopgrading_noerrors'),
+                    get_string('grade1default', 'workshopgrading_noerrors'), $paramtype=PARAM_TEXT, $size=15));
index 6ae78675e15b2b244cb9f8516caf9ab31e4885ac..972ebb0c5317447a9b84823187e40420bb61405c 100644 (file)
@@ -65,15 +65,12 @@ foreach (workshop_get_comparison_levels() as $code => $level) {
 $settings->add(new admin_setting_configselect('workshop/assessmentcomps', get_string('assessmentcomps', 'workshop'),
                     get_string('configassessmentcomps', 'workshop'), WORKSHOP_COMPARISON_NORMAL, $levels));
 
-$settings->add(new admin_setting_configtext('workshop/noerrorsgrade0', get_string('noerrorsgrade0', 'workshop'),
-                    get_string('confignoerrorsgrade0', 'workshop'), get_string('noerrorsgrade0default', 'workshop'),
-                    $paramtype=PARAM_TEXT, $size=15));
-
-$settings->add(new admin_setting_configtext('workshop/noerrorsgrade1', get_string('noerrorsgrade1', 'workshop'),
-                    get_string('confignoerrorsgrade1', 'workshop'), get_string('noerrorsgrade1default', 'workshop'),
-                    $paramtype=PARAM_TEXT, $size=15));
-
-/*
-$settings->add(new admin_setting_configcheckbox('assignment_showrecentsubmissions', get_string('showrecentsubmissions', 'assignment'),
-                   get_string('configshowrecentsubmissions', 'assignment'), 1));
-*/
+// include the settings of grading strategy subplugins
+$strategies = get_plugin_list('workshopgrading');
+foreach ($strategies as $strategy => $path) {
+    if (file_exists($settingsfile = $path . '/settings.php')) {
+        $settings->add(new admin_setting_heading('workshopgradingsetting'.$strategy,
+                                                get_string('pluginname', 'workshopgrading_' . $strategy), ''));
+        include($settingsfile);
+    }
+}