]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20192 Allocators and grading strategies are proper subplugins now
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 17:59:34 +0000 (17:59 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 17:59:34 +0000 (17:59 +0000)
17 files changed:
mod/workshop/allocation/manual/allocator.php
mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php [new file with mode: 0644]
mod/workshop/allocation/manual/renderer.php
mod/workshop/allocation/random/allocator.php
mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php [new file with mode: 0644]
mod/workshop/allocation/random/settings_form.php
mod/workshop/grading/accumulative/assessment_form.php
mod/workshop/grading/accumulative/edit_form.php
mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php [new file with mode: 0644]
mod/workshop/grading/noerrors/assessment_form.php
mod/workshop/grading/noerrors/edit_form.php
mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php [new file with mode: 0644]
mod/workshop/lang/en_utf8/workshop.php
mod/workshop/lib.php
mod/workshop/locallib.php
mod/workshop/renderer.php
mod/workshop/view.php

index c10dbbc93960df5311354206771e3142e2bbd6ee..40f04aa24642fbbff15fef78bebcc06eb1811c9e 100644 (file)
@@ -145,13 +145,13 @@ class workshop_manual_allocator implements workshop_allocator {
             case WORKSHOP_ALLOCATION_MANUAL_MSG_ADDED:
                 $hlauthorid     = $m[1];
                 $hlreviewerid   = $m[2];
-                $msg->text      = get_string('allocationadded', 'workshop');
+                $msg->text      = get_string('allocationadded', 'workshopallocation_manual');
                 $msg->sty       = 'ok';
                 break;
             case WORKSHOP_ALLOCATION_MANUAL_MSG_EXISTS:
                 $hlauthorid     = $m[1];
                 $hlreviewerid   = $m[2];
-                $msg->text      = get_string('allocationexists', 'workshop');
+                $msg->text      = get_string('allocationexists', 'workshopallocation_manual');
                 $msg->sty       = 'info';
                 break;
             case WORKSHOP_ALLOCATION_MANUAL_MSG_NOSUBMISSION:
@@ -163,10 +163,10 @@ class workshop_manual_allocator implements workshop_allocator {
                 $hlauthorid     = $m[2];
                 $hlreviewerid   = $m[3];
                 if ($m[4] == 0) {
-                    $msg->text  = get_string('areyousuretodeallocate', 'workshop');
+                    $msg->text  = get_string('areyousuretodeallocate', 'workshopallocation_manual');
                     $msg->sty   = 'info';
                 } else {
-                    $msg->text  = get_string('areyousuretodeallocategraded', 'workshop');
+                    $msg->text  = get_string('areyousuretodeallocategraded', 'workshopallocation_manual');
                     $msg->sty   = 'error';
                 }
                 break;
@@ -226,7 +226,7 @@ class workshop_manual_allocator implements workshop_allocator {
         // We have all data. Let it pass to the renderer and return the output
         // Here, we do not use neither the core renderer nor the workshop one but use an own one
         require_once(dirname(__FILE__) . '/renderer.php');
-        $uioutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE, 'allocation_manual');
+        $uioutput = $PAGE->theme->get_renderer('workshopallocation_manual', $PAGE);
         echo $uioutput->display_allocations($this->workshop, $peer, $hlauthorid, $hlreviewerid, $msg);
     }
 
diff --git a/mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php b/mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php
new file mode 100644 (file)
index 0000000..fd1ad48
--- /dev/null
@@ -0,0 +1,34 @@
+<?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/>.
+
+/**
+ * English strings for Workshop - manual allocation subplugin
+ *
+ * @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();
+
+$string['addreviewee'] = 'Add reviewee';
+$string['addreviewer'] = 'Add reviewer';
+$string['allocationadded'] = 'The submission has been successfully allocated';
+$string['allocationexists'] = 'The allocation already exists';
+$string['areyousuretodeallocate'] = 'Are you sure you want deallocate the selected assessment?';
+$string['areyousuretodeallocategraded'] = 'You are going to remove the assessment that has already been graded. Are you really sure you want to do it?';
+$string['pluginname'] = 'Manual allocation';
index 20cb6cf3b279a6af1cf795ec8645ff5d6825f35e..4f9edb98799460f7ed88c8db4334b33f0020bc36 100644 (file)
@@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Manual allocation renderer class
  */
-class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_base  {
+class moodle_workshopallocation_manual_renderer extends moodle_renderer_base  {
 
     /** the underlying renderer to use */
     protected $output;
@@ -139,9 +139,9 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas
             $handler = new moodle_url($this->page->url, array('mode' => 'new', 'of' => $user->id, 'sesskey' => sesskey()));
             $options = $this->users_to_menu_options($workshop->get_peer_reviewers(), $exclude);
             $select = html_select::make_popup_form($handler, 'by', $options, 'addreviewof' . $user->id, '',
-                get_string('addreviewer', 'workshop'));
+                get_string('addreviewer', 'workshopallocation_manual'));
             $select->nothinglabel = get_string('chooseuser', 'workshop');
-            $select->set_label(get_string('addreviewer', 'workshop'), $select->id);
+            $select->set_label(get_string('addreviewer', 'workshopallocation_manual'), $select->id);
             $o .= $this->output->select($select);
         }
         $o .= $this->output->output_start_tag('ul', array());
@@ -186,9 +186,9 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas
         $handler = new moodle_url($this->page->url, array('mode' => 'new', 'by' => $user->id, 'sesskey' => sesskey()));
         $options = $this->users_to_menu_options($workshop->get_peer_authors(), $exclude);
         $select = html_select::make_popup_form($handler, 'of', $options, 'addreviewby' . $user->id, '',
-            get_string('addreviewee', 'workshop'));
+            get_string('addreviewee', 'workshopallocation_manual'));
         $select->nothinglabel = get_string('chooseuser', 'workshop');
-        $select->set_label(get_string('addreviewee', 'workshop'), $select->id);
+        $select->set_label(get_string('addreviewee', 'workshopallocation_manual'), $select->id);
         $o .= $this->output->select($select);
         $o .= $this->output->output_start_tag('ul', array());
         foreach ($user->reviewerof as $authorid => $assessmentid) {
index a710b3e0002eae15c3c8e6befcfaac8fcfbbab37..fe11840259b03126be8e41cee03c6a395785b6fb 100644 (file)
@@ -105,17 +105,17 @@ class workshop_random_allocator implements workshop_allocator {
                 $randomallocations  = $this->random_allocation($authors, $reviewers, $curassessments, $numofreviews, $numper, $o);
                 $this->filter_current_assessments($randomallocations, $assessments);
                 $newallocations     = array_merge($newallocations, $randomallocations);
-                $o[] = 'ok::' . get_string('numofrandomlyallocatedsubmissions', 'workshop', count($randomallocations));
+                $o[] = 'ok::' . get_string('numofrandomlyallocatedsubmissions', 'workshopallocation_random', count($randomallocations));
                 unset($randomallocations);
             }
             if ($addselfassessment) {
                 $selfallocations    = $this->self_allocation($authors, $reviewers, $assessments);
                 $newallocations     = array_merge($newallocations, $selfallocations);
-                $o[] = 'ok::' . get_string('numofselfallocatedsubmissions', 'workshop', count($selfallocations));
+                $o[] = 'ok::' . get_string('numofselfallocatedsubmissions', 'workshopallocation_random', count($selfallocations));
                 unset($selfallocations);
             }
             if (empty($newallocations)) {
-                $o[] = 'info::' . get_string('noallocationtoadd', 'workshop');
+                $o[] = 'info::' . get_string('noallocationtoadd', 'workshopallocation_random');
             } else {
                 $this->add_new_allocations($newallocations, $authors, $reviewers);
                 foreach ($newallocations as $newallocation) {
@@ -123,14 +123,14 @@ class workshop_random_allocator implements workshop_allocator {
                     $a                  = new stdClass();
                     $a->reviewername    = fullname($reviewers[0][$reviewerid]);
                     $a->authorname      = fullname($authors[0][$authorid]);
-                    $o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshop', $a);
+                    $o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshopallocation_random', $a);
                 }
             }
             if ($removecurrent) {
                 $delassessments = $this->get_unkept_assessments($assessments, $newallocations, $addselfassessment);
                 // random allocator should not be able to delete assessments that have already been graded
                 // by reviewer
-                $o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshop', count($delassessments));
+                $o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshopallocation_random', count($delassessments));
                 foreach ($delassessments as $delassessmentkey => $delassessmentid) {
                     $a = new stdClass();
                     $a->authorname      = fullname((object)array(
@@ -140,10 +140,10 @@ class workshop_random_allocator implements workshop_allocator {
                             'lastname'  => $assessments[$delassessmentid]->reviewerlastname,
                             'firstname' => $assessments[$delassessmentid]->reviewerfirstname));
                     if (!is_null($assessments[$delassessmentid]->grade)) {
-                        $o[] = 'error::indent::' . get_string('allocationdeallocategraded', 'workshop', $a);
+                        $o[] = 'error::indent::' . get_string('allocationdeallocategraded', 'workshopallocation_random', $a);
                         unset($delassessments[$delassessmentkey]);
                     } else {
-                        $o[] = 'info::indent::' . get_string('assessmentdeleteddetail', 'workshop', $a);
+                        $o[] = 'info::indent::' . get_string('assessmentdeleteddetail', 'workshopallocation_random', $a);
                     }
                 }
                 $this->workshop->delete_assessment($delassessments);
@@ -165,7 +165,7 @@ class workshop_random_allocator implements workshop_allocator {
         $m = optional_param('m', null, PARAM_INT);  // status message code
         $msg = new stdClass();
         if ($m == WORKSHOP_ALLOCATION_RANDOM_MSG_SUCCESS) {
-            $msg = (object)array('text' => get_string('randomallocationdone', 'workshop'), 'sty' => 'ok');
+            $msg = (object)array('text' => get_string('randomallocationdone', 'workshopallocation_random'), 'sty' => 'ok');
         }
 
         echo $OUTPUT->container_start('random-allocator');
diff --git a/mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php b/mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php
new file mode 100644 (file)
index 0000000..07420af
--- /dev/null
@@ -0,0 +1,42 @@
+<?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/>.
+
+/**
+ * English strings for Workshop allocation subplugin - Random allocation
+ *
+ * @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();
+
+$string['addselfassessment'] = 'Add self-assessments';
+$string['allocationaddeddetail'] = 'New assessment to be done: <strong>$a->reviewername</strong> is reviewer of <strong>$a->authorname</strong>';
+$string['allocationdeallocategraded'] = 'Unable to deallocate already graded assessment: reviewer <strong>$a->reviewername</strong>, submission author: <strong>$a->authorname</strong>';
+$string['allocationsettings'] = 'Allocation settings';
+$string['assessmentdeleteddetail'] = 'Assessment deallocated: <strong>$a->reviewername</strong> is no longer reviewer of <strong>$a->authorname</strong>';
+$string['assesswosubmission'] = 'Participants can assess without having submitted anything';
+$string['noallocationtoadd'] = 'No allocations to add';
+$string['numofdeallocatedassessment'] = 'Deallocating $a assessment(s)';
+$string['numofrandomlyallocatedsubmissions'] = 'Randomly allocating $a submissions';
+$string['numofselfallocatedsubmissions'] = 'Self-allocating $a submission(s)';
+$string['numperauthor'] = 'per submission';
+$string['numperreviewer'] = 'per reviewer';
+$string['pluginname'] = 'Random allocation';
+$string['randomallocationdone'] = 'Random allocation done';
+$string['removecurrentallocations'] = 'Remove current allocations';
index 4570c839b2ea9e2e634f8772d83ee3cf2da6c0e6..178a009314fb6211c3d2891ce2a59da6a46d3751 100644 (file)
@@ -44,7 +44,7 @@ class workshop_random_allocator_form extends moodleform {
         $mform      = $this->_form;
         $workshop   = $this->_customdata['workshop'];
 
-        $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshop'));
+        $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshopallocation_random'));
 
         $gmode = groups_get_activity_groupmode($workshop->cm, $workshop->course);
         switch ($gmode) {
@@ -61,8 +61,8 @@ class workshop_random_allocator_form extends moodleform {
         $mform->addElement('static', 'groupmode', get_string('groupmode', 'group'), $grouplabel);
 
         $options_numofreviewes = array(0=>0,1=>1, 2=>2, 3=>3, 4=>4);
-        $options_numper = array(WORKSHOP_USERTYPE_AUTHOR    => get_string('numperauthor', 'workshop'),
-                                WORKSHOP_USERTYPE_REVIEWER  => get_string('numperreviewer', 'workshop'));
+        $options_numper = array(WORKSHOP_USERTYPE_AUTHOR    => get_string('numperauthor', 'workshopallocation_random'),
+                                WORKSHOP_USERTYPE_REVIEWER  => get_string('numperreviewer', 'workshopallocation_random'));
         $grpnumofreviews = array();
         $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', $options_numofreviewes);
         $mform->setDefault('numofreviews', 4);
@@ -70,13 +70,13 @@ class workshop_random_allocator_form extends moodleform {
         $mform->setDefault('numper', WORKSHOP_USERTYPE_AUTHOR);
         $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshop'), array(' '), false);
 
-        $mform->addElement('advcheckbox', 'removecurrent', get_string('removecurrentallocations', 'workshop'));
+        $mform->addElement('advcheckbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random'));
         $mform->setDefault('removecurrent', 0);
 
-        $mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshop'));
+        $mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random'));
         $mform->setDefault('assesswosubmission', 0);
 
-        $mform->addElement('advcheckbox', 'addselfassessment', get_string('addselfassessment', 'workshop'));
+        $mform->addElement('advcheckbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
         $mform->setDefault('addselfassessment', 0);
 
         $this->add_action_buttons();
index f2163d25a540167fc53a9d0beca3461f5cd3cafb..3d4c1ffa5066a4b61c0a0bca834c0058719d9a05 100644 (file)
@@ -50,7 +50,7 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form {
 
         for ($i = 0; $i < $nodims; $i++) {
             // dimension header
-            $dimtitle = get_string('dimensionnumberaccumulative', 'workshop', $i+1);
+            $dimtitle = get_string('dimensionnumber', 'workshopgrading_accumulative', $i+1);
             $mform->addElement('header', "dimensionhdr__idx_$i", $dimtitle);
 
             // dimension id
@@ -66,12 +66,12 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form {
             $mform->addElement('html', $desc);
 
             // grade for this aspect
-            $label = get_string('dimensiongrade', 'workshop');
+            $label = get_string('dimensiongrade', 'workshopgrading_accumulative');
             $options = make_grades_menu($fields->{'grade__idx_' . $i});
             $mform->addElement('select', 'grade__idx_' . $i, $label, $options);
 
             // comment
-            $label = get_string('dimensioncomment', 'workshop');
+            $label = get_string('dimensioncomment', 'workshopgrading_accumulative');
             //$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0));
             $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5));
         }
index 79bb7e9dcb943ecf908fca87855d492e1399b344..dcb2a79e72942c7f8bdf4d04758ddecb5b9aa4f0 100644 (file)
@@ -55,18 +55,20 @@ class workshop_edit_accumulative_strategy_form extends workshop_edit_strategy_fo
         $weights = workshop_get_dimension_weights();
 
         for ($i = 0; $i < $norepeats; $i++) {
-            $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumberaccumulative', 'workshop', $i+1));
+            $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopgrading_accumulative', $i+1));
             $mform->addElement('hidden', 'dimensionid__idx_'.$i);   // the id in workshop_forms
-            $mform->addElement('editor', 'description__idx_'.$i.'_editor', get_string('dimensiondescription', 'workshop'),
-                                    '', $descriptionopts);
-            $mform->addElement('modgrade', 'grade__idx_'.$i, get_string('dimensionmaxgrade','workshop'), null, true);
+            $mform->addElement('editor', 'description__idx_'.$i.'_editor',
+                                get_string('dimensiondescription', 'workshopgrading_accumulative'), '', $descriptionopts);
+            $mform->addElement('modgrade', 'grade__idx_'.$i,
+                                get_string('dimensionmaxgrade','workshopgrading_accumulative'), null, true);
             $mform->setDefault('grade__idx_'.$i, 10);
-            $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshop'), $weights);
+            $mform->addElement('select', 'weight__idx_'.$i,
+                                get_string('dimensionweight', 'workshopgrading_accumulative'), $weights);
             $mform->setDefault('weight__idx_'.$i, 1);
         }
 
         $mform->registerNoSubmitButton('noadddims');
-        $mform->addElement('submit', 'noadddims', get_string('addmoredimensionsaccumulative', 'workshop',
+        $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopgrading_accumulative',
                                                                     WORKSHOP_STRATEGY_ADDDIMS));
         $mform->closeHeaderBefore('noadddims');
         $this->set_data($current);
diff --git a/mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php b/mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php
new file mode 100644 (file)
index 0000000..7dbcd96
--- /dev/null
@@ -0,0 +1,35 @@
+<?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/>.
+
+/**
+ * English strings for Workshop subplugin - "Accumulative" grading strategy
+ *
+ * @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();
+
+$string['addmoredimensions'] = 'Blanks for $a more aspects';
+$string['dimensioncomment'] = 'Comment';
+$string['dimensiondescription'] = 'Description';
+$string['dimensiongrade'] = 'Grade';
+$string['dimensionmaxgrade'] = 'Best possible grade / Scale to use';
+$string['dimensionnumber'] = 'Aspect $a';
+$string['dimensionweight'] = 'Weight';
+$string['pluginname'] = 'Accumulative grading';
index 43f958acf873ee54b2450d8dbb58c4e0e9de889f..56d6685b5bacb258ca71d75c1a340f4022f649e8 100644 (file)
@@ -50,7 +50,7 @@ class workshop_noerrors_assessment_form extends workshop_assessment_form {
 
         for ($i = 0; $i < $nodims; $i++) {
             // dimension header
-            $dimtitle = get_string('dimensionnumbernoerrors', 'workshop', $i+1);
+            $dimtitle = get_string('dimensionnumber', 'workshopgrading_noerrors', $i+1);
             $mform->addElement('header', "dimensionhdr__idx_$i", $dimtitle);
 
             // dimension id
@@ -66,13 +66,13 @@ class workshop_noerrors_assessment_form extends workshop_assessment_form {
             $mform->addElement('html', $desc);
 
             // evaluation of the assertion
-            $label = get_string('dimensiongradenoerrors', 'workshop');
+            $label = get_string('dimensiongrade', 'workshopgrading_noerrors');
             $mform->addElement('radio', 'grade__idx_' . $i, 'Your assessment', $fields->{'grade0__idx_'.$i}, 0); // todo localize
             $mform->addElement('radio', 'grade__idx_' . $i, '', $fields->{'grade1__idx_'.$i}, 1);
             $mform->setDefault('grade__idx_' . $i, 0);
 
             // comment
-            $label = get_string('dimensioncomment', 'workshop');
+            $label = get_string('dimensioncomment', 'workshopgrading_noerrors');
             $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5));
         }
         $this->set_data($current);
index 8ab6d33b70b43ca47d1d4ee7ef2a4277b21a18ef..1e03e8a7f30d45328598d34b03a47f6c9eb9b5ca 100644 (file)
@@ -57,23 +57,23 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form {
         $weights = workshop_get_dimension_weights();
 
         for ($i = 0; $i < $norepeats; $i++) {
-            $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumbernoerrors', 'workshop', $i+1));
+            $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopgrading_noerrors', $i+1));
             $mform->addElement('hidden', 'dimensionid__idx_'.$i);   // the id in workshop_forms
-            $mform->addElement('editor', 'description__idx_'.$i.'_editor', get_string('dimensiondescription', 'workshop'),
-                                    '', $descriptionopts);
-            $mform->addElement('text', 'grade0__idx_'.$i, get_string('noerrorsgrade0', 'workshop'), array('size'=>'15'));
+            $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->setType('grade0__idx_'.$i, PARAM_TEXT);
-            $mform->addElement('text', 'grade1__idx_'.$i, get_string('noerrorsgrade1', 'workshop'), array('size'=>'15'));
+            $mform->addElement('text', 'grade1__idx_'.$i, get_string('grade1', 'workshopgrading_noerrors'), array('size'=>'15'));
             $mform->setDefault('grade1__idx_'.$i, $workshopconfig->noerrorsgrade1);
             $mform->setType('grade1__idx_'.$i, PARAM_TEXT);
-            $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshop'), $weights);
+            $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshopgrading_noerrors'), $weights);
             $mform->setDefault('weight__idx_'.$i, 1);
         }
 
-        $mform->addElement('header', 'mappingheader', get_string('noerrorsgrademapping', 'workshop'));
-        $mform->addElement('static', 'mappinginfo', get_string('noerrorsmaperror', 'workshop'),
-                                                            get_string('noerrorsmapgrade', 'workshop'));
+        $mform->addElement('header', 'mappingheader', get_string('grademapping', 'workshopgrading_noerrors'));
+        $mform->addElement('static', 'mappinginfo', get_string('maperror', 'workshopgrading_noerrors'),
+                                                            get_string('mapgrade', 'workshopgrading_noerrors'));
 
         // get the total weight of all items == maximum weighted number of errors
         $totalweight = 0;
@@ -87,20 +87,20 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form {
         $percents = array();
         $percents[''] = '';
         for ($i = 100; $i >= 0; $i--) {
-            $percents[$i] = get_string('percents', 'workshop', $i);
+            $percents[$i] = get_string('percents', 'workshopgrading_noerrors', $i);
         }
-        $mform->addElement('static', 'mappingzero', 0, get_string('percents', 'workshop', 100));
+        $mform->addElement('static', 'mappingzero', 0, get_string('percents', 'workshopgrading_noerrors', 100));
         for ($i = 1; $i <= $totalweight; $i++) {
             $selects = array();
             $selects[] = $mform->createElement('select', 'map__idx_'.$i, $i, $percents);
             $selects[] = $mform->createElement('static', 'mapdefault__idx_'.$i, '',
-                                        get_string('percents', 'workshop', floor(100 - $i * 100 / $totalweight)));
+                                        get_string('percents', 'workshopgrading_noerrors', floor(100 - $i * 100 / $totalweight)));
             $mform->addGroup($selects, 'grademapping'.$i, $i, array(' '), false);
             $mform->setDefault('map__idx_'.$i, '');
         }
 
         $mform->registerNoSubmitButton('noadddims');
-        $mform->addElement('submit', 'noadddims', get_string('addmoredimensionsaccumulative', 'workshop',
+        $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopgrading_noerrors',
                                                                     WORKSHOP_STRATEGY_ADDDIMS));
         $mform->closeHeaderBefore('noadddims');
         $this->set_data($current);
diff --git a/mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php b/mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php
new file mode 100644 (file)
index 0000000..3572be7
--- /dev/null
@@ -0,0 +1,44 @@
+<?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/>.
+
+/**
+ * English strings for Workshop plugin - "Number of errors" grading strategy
+ *
+ * @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();
+
+$string['addmoredimensions'] = 'Blanks for $a more assertions';
+$string['configgrade0'] = 'The default word describing the negative assessment of an assertion.';
+$string['configgrade1'] = 'The default word describing the positive assessment of an assertion.';
+$string['dimensioncomment'] = 'Comment';
+$string['dimensiondescription'] = 'Description';
+$string['dimensiongrade'] = 'Grade';
+$string['dimensionnumber'] = 'Assertion $a';
+$string['dimensionweight'] = 'Weight';
+$string['grademapping'] = 'Grade mapping table';
+$string['grade0default'] = 'No';
+$string['grade0'] = 'Word for the error';
+$string['grade1default'] = 'Yes';
+$string['grade1'] = 'Word for the success';
+$string['maperror'] = 'Weighted number of errors is less than or equals';
+$string['mapgrade'] = 'Grade for submission';
+$string['percents'] = '$a %';
+$string['pluginname'] = 'Number of errors';
index 6f81038ffecc434ebd84d64b60cb67ea1de0f033..8741436cad6c65befca96f20a081afe1134755d0 100644 (file)
 
 defined('MOODLE_INTERNAL') || die();
 
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
-$string[''] = '';
 $string['accesscontrol'] = 'Access control';
-$string['addmoredimensionsaccumulative'] = 'Blanks for $a more aspects';
-$string['addmoredimensionsnoerrors'] = 'Blanks for $a more assertions';
-$string['addreviewee'] = 'Add reviewee';
-$string['addreviewer'] = 'Add reviewer';
-$string['addselfassessment'] = 'Add self-assessments';
-$string['addsubmissiontoreview'] = 'Assign submission';
 $string['agreeassessments'] = 'Assessments must be agreed';
 $string['agreeassessmentsdesc'] = 'Authors may comment assessments of their work and agree/disagree with it';
-$string['allocationaddeddetail'] = 'New assessment to be done: <strong>$a->reviewername</strong> is reviewer of <strong>$a->authorname</strong>';
-$string['allocationadded'] = 'The submission has been successfully allocated';
-$string['allocationdeallocategraded'] = 'Unable to deallocate already graded assessment: reviewer <strong>$a->reviewername</strong>, submission author: <strong>$a->authorname</strong>';
-$string['allocationexists'] = 'The allocation already exists';
-$string['allocationmanual'] = 'Manual allocation';
-$string['allocationrandom'] = 'Random allocation';
-$string['allocationsettings'] = 'Allocation settings';
 $string['allocation'] = 'Submission allocation';
-$string['allocationview'] = 'View current allocations';
+$string['allocationdone'] = 'Allocation done';
+$string['allocationerror'] = 'Allocation error';
 $string['areadimensiondescription'] = 'Assessment form fields';
 $string['areasubmissionattachment'] = 'Submission attachments';
 $string['areasubmissioncontent'] = 'Submission texts';
-$string['areyousuretodeallocate'] = 'Are you sure you want deallocate the selected assessment?';
-$string['areyousuretodeallocategraded'] = 'You are going to remove the assessment that has already been graded. Are you really sure you want to do it?';
 $string['assessallexamples'] = 'Assess all examples';
 $string['assessingsubmission'] = 'Assessing submission';
 $string['assessmentcomps'] = 'Required level of assessments similarity';
 $string['assessmentdeleted'] = 'Assessment deallocated';
-$string['assessmentdeleteddetail'] = 'Assessment deallocated: <strong>$a->reviewername</strong> is no longer reviewer of <strong>$a->authorname</strong>';
 $string['assessmentend'] = 'End of assessment phase';
 $string['assessmentform'] = 'Assessment form';
 $string['assessmentresult'] = 'Assessment result';
 $string['assessmentsettings'] = 'Assessment settings';
 $string['assessmentstart'] = 'Start of assessment phase';
-$string['assesswosubmission'] = 'Participants can assess without having submitted anything';
 $string['backtoeditform'] = 'Back to editing form';
 $string['byfullname'] = 'by <a href=\"{$a->url}\">{$a->name}</a>';
 $string['comparisonhigh'] = 'High';
@@ -89,17 +57,8 @@ $string['configgrade'] = 'Default maximum grade for submission in workshops';
 $string['configgradinggrade'] = 'Default maximum grade for assessment in workshops';
 $string['configmaxbytes'] = 'Default maximum submission file size for all workshops on the site (subject to course limits and other local settings)';
 $string['confignexassessments'] = 'Default number of examples to be reviewed by a user in the example assessment phase';
-$string['confignoerrorsgrade0'] = 'The default word describing the negative assessment of an assertion in "Number of errors" grading strategy.';
-$string['confignoerrorsgrade1'] = 'The default word describing the positive assessment of an assertion in "Number of errors" grading strategy.';
 $string['confignsassessments'] = 'Default number of allocated submissions to be reviewed by a user in the assessment phase';
 $string['configstrategy'] = 'Default grading strategy for workshops';
-$string['dimensioncomment'] = 'Comment';
-$string['dimensiondescription'] = 'Description';
-$string['dimensiongrade'] = 'Grade';
-$string['dimensionmaxgrade'] = 'Best possible grade / Scale to use';
-$string['dimensionnumberaccumulative'] = 'Aspect $a';
-$string['dimensionnumbernoerrors'] = 'Assertion $a';
-$string['dimensionweight'] = 'Weight';
 $string['editingassessmentform'] = 'Editing assessment form';
 $string['editingsubmission'] = 'Editing submission';
 $string['editsubmission'] = 'Edit submission';
@@ -122,34 +81,18 @@ $string['modulenameplural'] = 'Workshops';
 $string['modulename'] = 'Workshop';
 $string['nattachments'] = 'Maximum number of submission attachments';
 $string['nexassessments'] = 'Number of required assessments of examples';
-$string['noallocationtoadd'] = 'No allocations to add';
-$string['noerrorsgrademapping'] = 'Grade mapping table';
-$string['noerrorsgrade0default'] = 'No';
-$string['noerrorsgrade0'] = 'Word for the error';
-$string['noerrorsgrade1default'] = 'Yes';
-$string['noerrorsgrade1'] = 'Word for the success';
-$string['noerrorsmaperror'] = 'Weighted number of errors is less than or equals';
-$string['noerrorsmapgrade'] = 'Grade for submission';
 $string['nogradeyet'] = 'No grade yet';
 $string['nosubmissionfound'] = 'No submission found for this user';
 $string['nosubmissions'] = 'No submissions yet in this workshop';
 $string['nothingtoreview'] = 'Nothing to review';
 $string['noworkshops'] = 'There are no workshops in this course';
 $string['nsassessments'] = 'Number of required assessments of other users\' work';
-$string['numofdeallocatedassessment'] = 'Deallocating $a assessment(s)';
-$string['numofrandomlyallocatedsubmissions'] = 'Randomly allocating $a submissions';
 $string['numofreviews'] = 'Number of reviews';
-$string['numofselfallocatedsubmissions'] = 'Self-allocating $a submission(s)';
-$string['numperauthor'] = 'per submission';
-$string['numperreviewer'] = 'per reviewer';
 $string['participant'] = 'Participant';
 $string['participantrevierof'] = 'Participant is reviewer of';
 $string['participantreviewedby'] = 'Participant is reviewed by';
-$string['percents'] = '$a%';
 $string['previewassessmentform'] = 'Preview';
-$string['randomallocationdone'] = 'Random allocation done';
 $string['releasegrades'] = 'Push final grades into the gradebook';
-$string['removecurrentallocations'] = 'Remove current allocations';
 $string['saveandclose'] = 'Save and close';
 $string['saveandcontinue'] = 'Save and continue editing';
 $string['saveandpreview'] = 'Save and preview';
@@ -157,7 +100,6 @@ $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['strategynoerrors'] = 'Number of errors';
 $string['strategynograding'] = 'No grading';
 $string['strategyrubric'] = 'Rubric grading';
 $string['submissionattachment'] = 'Attachment';
index 4e73c7137a437cc1b85e42b088dc64c839141775..d735d520c7d884cf3702bf9a19a53cf8626bbd39 100644 (file)
@@ -516,12 +516,13 @@ function workshop_get_dimension_weights() {
  * $return array Array ['string' => 'string']
  */
 function workshop_get_strategies() {
-    $installed = get_list_of_plugins('mod/workshop/grading');
+    $installed = get_plugin_list('workshopgrading');
     $forms = array();
-    foreach ($installed as $strategy) {
-        $forms[$strategy] = get_string('strategy' . $strategy, 'workshop');
+    foreach ($installed as $strategy => $strategypath) {
+        if (file_exists($strategypath . '/strategy.php')) {
+            $forms[$strategy] = get_string('pluginname', 'workshopgrading_' . $strategy);
+        }
     }
-
     return $forms;
 }
 
index bc04bf74f7a7fd5cea8ba6363f7dc45e13d9d484..1edb6cd6e7ae3241e5c46fa1d5832f357a806781 100644 (file)
@@ -32,7 +32,8 @@ defined('MOODLE_INTERNAL') || die();
 
 require_once(dirname(__FILE__).'/lib.php'); // we extend this library here
 
-define('WORKSHOP_ALLOCATION_EXISTS',        -1);    // return status of {@link add_allocation}
+define('WORKSHOP_ALLOCATION_EXISTS', -1);   // return status of {@link add_allocation}
+define('WORKSHOP_ALLOCATION_ERROR',  -2);   // can be passed to a workshop renderer method
 
 /**
  * Full-featured workshop API
@@ -513,10 +514,12 @@ class workshop {
      * @return array Array ['string' => 'string'] of localized allocation method names
      */
     public function installed_allocators() {
-        $installed = get_list_of_plugins('mod/workshop/allocation');
+        $installed = get_plugin_list('workshopallocation');
         $forms = array();
-        foreach ($installed as $allocation) {
-            $forms[$allocation] = get_string('allocation' . $allocation, 'workshop');
+        foreach ($installed as $allocation => $allocationpath) {
+            if (file_exists($allocationpath . '/allocator.php')) {
+                $forms[$allocation] = get_string('pluginname', 'workshopallocation_' . $allocation);
+            }
         }
         // usability - make sure that manual allocation appears the first
         if (isset($forms['manual'])) {
index 6ee7ac3ea681d153d2fe139fba8124af1df4c729..33616593c80cf530493599a84b9dfaa83c344430 100644 (file)
@@ -87,10 +87,10 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base {
      */
     public function allocation_init_result($result='') {
         $msg = new stdClass();
-        if ($result === 'WORKSHOP_ALLOCATION_RANDOM_ERROR') {
-            $msg = (object)array('text' => get_string('randomallocationerror', 'workshop'), 'sty' => 'error');
+        if ($result === WORKSHOP_ALLOCATION_ERROR) {
+            $msg = (object)array('text' => get_string('allocationerror', 'workshop'), 'sty' => 'error');
         } else {
-            $msg = (object)array('text' => get_string('randomallocationdone', 'workshop'), 'sty' => 'ok');
+            $msg = (object)array('text' => get_string('allocationdone', 'workshop'), 'sty' => 'ok');
         }
         $o = $this->status_message($msg);
         if (is_array($result)) {
index bdedfa8ea9f36734b9a9c0b7a792254c9ccdecd5..d32aaec1efb330f79fc4a112d242a25a992a1d81 100644 (file)
@@ -90,7 +90,7 @@ echo $OUTPUT->header($navigation);
 echo $OUTPUT->box_start();
 echo $OUTPUT->heading('Workshop testing', 1);
 echo "<ol>\n";
-echo '<li><a href="' . $workshop->editform_url()->out()  . '">Edit grading form (' . get_string('strategy' . $workshop->strategy, 'workshop') . ')</a></li>' . "\n";
+echo '<li><a href="' . $workshop->editform_url()->out()  . '">Edit grading form (' . get_string('pluginname', 'workshopgrading_' . $workshop->strategy) . ')</a></li>' . "\n";
 echo "<li><a href=\"submission.php?cmid={$cm->id}\">View/edit your own submission</a></li>\n";
 echo "<li><a href=\"develtools.php?tool=mksubmissions&amp;cmid={$cm->id}\">Fake others' submissions</a></li>\n";
 echo "<li><a href=\"allocation.php?cmid={$cm->id}\">Allocate submissions</a></li>\n";