]> git.mjollnir.org Git - moodle.git/commitdiff
workshop: general cleanup
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:22:10 +0000 (18:22 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:22:10 +0000 (18:22 +0000)
Moving stuff from lib.php into static methods in localib.php. Removing
things from workshop core that were implemented in a subplugin. Dropping
stuff related to features not to be implemented in 2.0.

16 files changed:
mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php
mod/workshop/allocation/random/lib.php
mod/workshop/allocation/random/settings.php [moved from mod/workshop/allocation/manual/version.php with 65% similarity]
mod/workshop/allocation/random/settings_form.php
mod/workshop/db/access.php
mod/workshop/db/install.xml
mod/workshop/form/accumulative/edit_form.php
mod/workshop/form/comments/edit_form.php
mod/workshop/form/numerrors/edit_form.php
mod/workshop/lang/en_utf8/workshop.php
mod/workshop/lib.php
mod/workshop/locallib.php
mod/workshop/mod_form.php
mod/workshop/settings.php
mod/workshop/simpletest/testlib.php [deleted file]
mod/workshop/submission.php

index b3f51486e2ce24eb50ecc8074bb4861cfcc9dcae..a03600c7a4db0feb75b8199aa7d128a12e1406a4 100644 (file)
@@ -31,9 +31,11 @@ $string['allocationdeallocategraded'] = 'Unable to deallocate already graded ass
 $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['confignumofreviews'] = 'Default number of submissions to be randomly allocated';
 $string['noallocationtoadd'] = 'No allocations to add';
 $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';
index 5150d2b18a66d3879b2f5e8560a8fe19c8b75361..efea09f4c8bbd3e918fab643ca141c30f7865b37 100644 (file)
@@ -181,6 +181,24 @@ class workshop_random_allocator implements workshop_allocator {
         return $out;
     }
 
+    /**
+     * Return an array of possible numbers of reviews to be done
+     *
+     * Should contain numbers 1, 2, 3, ... 10 and possibly others up to a reasonable value
+     *
+     * @return array of integers
+     */
+    public static function available_numofreviews_list() {
+        $options = array();
+        $options[30] = 30;
+        $options[20] = 20;
+        $options[15] = 15;
+        for ($i = 10; $i >= 0; $i--) {
+            $options[$i] = $i;
+        }
+        return $options;
+    }
+
     /**
      * Allocates submissions to their authors for review
      *
similarity index 65%
rename from mod/workshop/allocation/manual/version.php
rename to mod/workshop/allocation/random/settings.php
index 8eac2d681a21ff5fa10bb94d894637aaf8b4f947..016997313a5e128aeadb4648a94d5159d5931605 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Defines the version of manual allocation subplugin 
+ * The configuration variables for "Random allocation" subplugin
  *
- * This code fragment is called by moodle_needs_upgrading() and
- * /admin/index.php
- *
- * @package   mod-workshop
+ * @package   mod-workshopallocation-random
  * @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();
 
-$plugin->version  = 2009081300;
-$plugin->requires = 2009080700;  // Requires this Moodle version
+require_once(dirname(__FILE__) . '/lib.php');
+
+$settings->add(new admin_setting_configselect('workshopallocation_random/numofreviews',
+        get_string('numofreviews', 'workshopallocation_random'),
+        get_string('confignumofreviews', 'workshopallocation_random'), 5,
+                workshop_random_allocator::available_numofreviews_list()));
index 59d6e2b6ce58f044d8aeaadb30c11b52b205fcb6..72d48f1e6a065b8068a164845d034c254e5f9b9e 100644 (file)
@@ -41,8 +41,9 @@ class workshop_random_allocator_form extends moodleform {
      * Definition of the setting form elements
      */
     public function definition() {
-        $mform      = $this->_form;
-        $workshop   = $this->_customdata['workshop'];
+        $mform          = $this->_form;
+        $workshop       = $this->_customdata['workshop'];
+        $plugindefaults = get_config('workshopallocation_random');
 
         $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshopallocation_random'));
 
@@ -60,18 +61,18 @@ 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); // todo
         $options_numper = array(
             workshop_random_allocator::USERTYPE_AUTHOR      => get_string('numperauthor', 'workshopallocation_random'),
             workshop_random_allocator::USERTYPE_REVIEWER    => get_string('numperreviewer', 'workshopallocation_random')
         );
         $grpnumofreviews = array();
-        $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', $options_numofreviewes);
-        $mform->setDefault('numofreviews', 4);
+        $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '',
+                workshop_random_allocator::available_numofreviews_list());
+        $mform->setDefault('numofreviews', $plugindefaults->numofreviews);
         $grpnumofreviews[] = $mform->createElement('select', 'numper', '', $options_numper);
         $mform->setDefault('numper', workshop_random_allocator::USERTYPE_AUTHOR);
-        $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshop'), array(' '), false);
-
+        $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshopallocation_random'),
+                array(' '), false);
         $mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random'));
         $mform->setDefault('removecurrent', 0);
 
index 5868564c7f02dab7a59910436826b1a9f20099ad..4cc47e2c6eb1a16152724902211ebf7819997268 100644 (file)
@@ -168,16 +168,4 @@ $mod_workshop_capabilities = array(
         )
     ),
 
-    // Ability to see the given/calculated grades even before the author did not agree
-    // with the assessment comments yet
-    'mod/workshop:viewgradesbeforeagreement' => array(
-        'captype' => 'read',
-        'contextlevel' => CONTEXT_MODULE,
-        'legacy' => array(
-            'teacher' => CAP_ALLOW,
-            'editingteacher' => CAP_ALLOW,
-            'admin' => CAP_ALLOW
-        )
-    ),
-
 );
index bc4f63e8448559402106b3048b900f5d92e3dbf2..ea4bffa48accb2c7f3cdbb1252e6e1969fedf968 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/workshop/db" VERSION="20091022" COMMENT="XMLDB file for Moodle mod/workshop"
+<XMLDB PATH="mod/workshop/db" VERSION="20091028" COMMENT="XMLDB file for Moodle mod/workshop"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="gradedecimals" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Number of digits that should be shown after the decimal point when displaying grades" PREVIOUS="strategy" NEXT="nattachments"/>
         <FIELD NAME="nattachments" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Number of required submission attachments" PREVIOUS="gradedecimals" NEXT="latesubmissions"/>
         <FIELD NAME="latesubmissions" TYPE="int" LENGTH="2" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allow submitting the work after the deadline" PREVIOUS="nattachments" NEXT="maxbytes"/>
-        <FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="100000" SEQUENCE="false" COMMENT="Maximum size of the one attached file" PREVIOUS="latesubmissions" NEXT="nexassessments"/>
-        <FIELD NAME="nexassessments" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="If useexamples == 1: the number of required assessments of teacher examples (0 = all, greater than 0: the number)" PREVIOUS="maxbytes" NEXT="examplesmode"/>
-        <FIELD NAME="examplesmode" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = example assessments are voluntary, 1 = examples must be assessed before submission, 2 = examples are available after own submission and must be assessed before peer/self assessment phase" PREVIOUS="nexassessments" NEXT="teacherweight"/>
-        <FIELD NAME="teacherweight" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="The weight of the teacher's assessments" PREVIOUS="examplesmode" NEXT="agreeassessments"/>
-        <FIELD NAME="agreeassessments" TYPE="int" LENGTH="2" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Boolean - determines if author may comment assessments and agree/disagree with it" PREVIOUS="teacherweight" NEXT="assessmentcomps"/>
-        <FIELD NAME="assessmentcomps" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="2" SEQUENCE="false" COMMENT="Comparison of assessments = required level of assessment similarity (0 = very lax, 1 = lax, 2 = fair, 3 = strict, 4 = very strict)" PREVIOUS="agreeassessments" NEXT="submissionstart"/>
-        <FIELD NAME="submissionstart" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = will be started manually, greater than 0 the timestamp of the start of the submission phase" PREVIOUS="assessmentcomps" NEXT="submissionend"/>
+        <FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="100000" SEQUENCE="false" COMMENT="Maximum size of the one attached file" PREVIOUS="latesubmissions" NEXT="examplesmode"/>
+        <FIELD NAME="examplesmode" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = example assessments are voluntary, 1 = examples must be assessed before submission, 2 = examples are available after own submission and must be assessed before peer/self assessment phase" PREVIOUS="maxbytes" NEXT="submissionstart"/>
+        <FIELD NAME="submissionstart" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = will be started manually, greater than 0 the timestamp of the start of the submission phase" PREVIOUS="examplesmode" NEXT="submissionend"/>
         <FIELD NAME="submissionend" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = will be closed manually, greater than 0 the timestamp of the end of the submission phase" PREVIOUS="submissionstart" NEXT="assessmentstart"/>
         <FIELD NAME="assessmentstart" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = will be started manually, greater than 0 the timestamp of the start of the assessment phase" PREVIOUS="submissionend" NEXT="assessmentend"/>
         <FIELD NAME="assessmentend" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 = will be closed manually, greater than 0 the timestamp of the end of the assessment phase" PREVIOUS="assessmentstart" NEXT="releasegrades"/>
@@ -76,9 +72,8 @@
         <FIELD NAME="reviewerid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The id of the reviewer who makes this assessment" PREVIOUS="submissionid" NEXT="weight"/>
         <FIELD NAME="weight" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="The weight of the assessment for the purposes of aggregation" PREVIOUS="reviewerid" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 then the assessment was allocated but the reviewer has not assessed yet. If greater than 0 then the timestamp of when the reviewer assessed for the first time" PREVIOUS="weight" NEXT="timemodified"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 then the assessment was allocated but the reviewer has not assessed yet. If greater than 0 then the timestamp of when the reviewer assessed for the last time" PREVIOUS="timecreated" NEXT="timeagreed"/>
-        <FIELD NAME="timeagreed" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 then the assessment was not agreed by the author. If greater than 0 then the timestamp of when the assessment was agreed by the author" PREVIOUS="timemodified" NEXT="grade"/>
-        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" COMMENT="The aggregated grade for submission suggested by the reviewer. The grade 0..100 is computed from the values assigned to the assessment dimensions fields. If NULL then it has not been aggregated yet." PREVIOUS="timeagreed" NEXT="gradinggrade"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="If 0 then the assessment was allocated but the reviewer has not assessed yet. If greater than 0 then the timestamp of when the reviewer assessed for the last time" PREVIOUS="timecreated" NEXT="grade"/>
+        <FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" COMMENT="The aggregated grade for submission suggested by the reviewer. The grade 0..100 is computed from the values assigned to the assessment dimensions fields. If NULL then it has not been aggregated yet." PREVIOUS="timemodified" NEXT="gradinggrade"/>
         <FIELD NAME="gradinggrade" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" COMMENT="The computed grade 0..100 for this assessment. If NULL then it has not been computed yet." PREVIOUS="grade" NEXT="gradinggradeover"/>
         <FIELD NAME="gradinggradeover" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" DECIMALS="5" COMMENT="Grade for the assessment manually overridden by a teacher. Grade is always from interval 0..100. If NULL then the grade is not overriden." PREVIOUS="gradinggrade" NEXT="gradinggradeoverby"/>
         <FIELD NAME="gradinggradeoverby" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The id of the user who has overridden the grade for submission." PREVIOUS="gradinggradeover" NEXT="feedbackauthor"/>
index 41a55d686e848981c592cf94f0e630cc56642a66..729c6d3e6e9a333794c589b4ef589373a9e38da1 100644 (file)
@@ -52,19 +52,17 @@ class workshop_edit_accumulative_strategy_form extends workshop_edit_strategy_fo
         // value not to be overridden by submitted value
         $mform->setConstants(array('norepeats' => $norepeats));
 
-        $weights = workshop_get_dimension_weights();
-
         for ($i = 0; $i < $norepeats; $i++) {
             $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_accumulative', $i+1));
             $mform->addElement('hidden', 'dimensionid__idx_'.$i);
             $mform->addElement('editor', 'description__idx_'.$i.'_editor',
-                                get_string('dimensiondescription', 'workshopform_accumulative'), '', $descriptionopts);
+                    get_string('dimensiondescription', 'workshopform_accumulative'), '', $descriptionopts);
             // todo replace modgrade with an advanced element (usability issue discussed with Olli)
             $mform->addElement('modgrade', 'grade__idx_'.$i,
-                                get_string('dimensionmaxgrade','workshopform_accumulative'), null, true);
+                    get_string('dimensionmaxgrade','workshopform_accumulative'), null, true);
             $mform->setDefault('grade__idx_'.$i, 10);
             $mform->addElement('select', 'weight__idx_'.$i,
-                                get_string('dimensionweight', 'workshopform_accumulative'), $weights);
+                    get_string('dimensionweight', 'workshopform_accumulative'), workshop::available_dimension_weights_list());
             $mform->setDefault('weight__idx_'.$i, 1);
         }
 
index a8c7d0b18a01c5468751fad934bdc6a3acad85d3..44397598f06a6bed573f85b729a0fcba78c57aa1 100644 (file)
@@ -52,8 +52,6 @@ class workshop_edit_comments_strategy_form extends workshop_edit_strategy_form {
         // value not to be overridden by submitted value
         $mform->setConstants(array('norepeats' => $norepeats));
 
-        $weights = workshop_get_dimension_weights();
-
         for ($i = 0; $i < $norepeats; $i++) {
             $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_comments', $i+1));
             $mform->addElement('hidden', 'dimensionid__idx_'.$i);
index 0fb2e9ad23575ff1adb0cd4bbcfd9af4a03a272c..24199b9bc936feff0c88c09d99d947de0a06d9f8 100644 (file)
@@ -54,20 +54,19 @@ class workshop_edit_numerrors_strategy_form extends workshop_edit_strategy_form
         // value not to be overridden by submitted value
         $mform->setConstants(array('norepeats' => $norepeats));
 
-        $weights = workshop_get_dimension_weights();
-
         for ($i = 0; $i < $norepeats; $i++) {
             $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_numerrors', $i+1));
             $mform->addElement('hidden', 'dimensionid__idx_'.$i);   // the id in workshop_forms
             $mform->addElement('editor', 'description__idx_'.$i.'_editor',
-                                get_string('dimensiondescription', 'workshopform_numerrors'), '', $descriptionopts);
+                    get_string('dimensiondescription', 'workshopform_numerrors'), '', $descriptionopts);
             $mform->addElement('text', 'grade0__idx_'.$i, get_string('grade0', 'workshopform_numerrors'), array('size'=>'15'));
             $mform->setDefault('grade0__idx_'.$i, $plugindefaults->grade0);
             $mform->setType('grade0__idx_'.$i, PARAM_TEXT);
             $mform->addElement('text', 'grade1__idx_'.$i, get_string('grade1', 'workshopform_numerrors'), array('size'=>'15'));
             $mform->setDefault('grade1__idx_'.$i, $plugindefaults->grade1);
             $mform->setType('grade1__idx_'.$i, PARAM_TEXT);
-            $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshopform_numerrors'), $weights);
+            $mform->addElement('select', 'weight__idx_'.$i,
+                    get_string('dimensionweight', 'workshopform_numerrors'), workshop::available_dimension_weights_list());
             $mform->setDefault('weight__idx_'.$i, 1);
         }
 
index 3c735c401cceffeae526d49716c92c7a99f25d90..9f71411f9d95b223f31caa0434731fc342936079 100644 (file)
@@ -37,8 +37,6 @@ $string[''] = '';
 $string['accesscontrol'] = 'Access control';
 $string['aggregategrades'] = 'Re-calculate grades';
 $string['aggregation'] = 'Grades aggregation';
-$string['agreeassessments'] = 'Assessments must be agreed';
-$string['agreeassessmentsdesc'] = 'Authors may comment assessments of their work and agree/disagree with it';
 $string['allocate'] = 'Allocate submissions';
 $string['allocatedetails'] = 'expected: $a->expected<br />submitted: $a->submitted<br />to allocate: $a->allocate';
 $string['allocationdone'] = 'Allocation done';
@@ -48,14 +46,12 @@ $string['alreadygraded'] = 'Already graded';
 $string['areainstructauthors'] = 'Instructions for submitting';
 $string['areasubmissionattachment'] = 'Submission attachments';
 $string['areasubmissioncontent'] = 'Submission texts';
-$string['assessallexamples'] = 'Assess all examples';
 $string['assess'] = 'Assess';
 $string['assessedsubmission'] = 'Assessed submission';
 $string['assessingsubmission'] = 'Assessing submission';
 $string['assessmentbyknown'] = 'Assessment by $a';
 $string['assessmentbyunknown'] = 'Assessment';
 $string['assessmentbyyourself'] = 'Assessment by yourself';
-$string['assessmentcomps'] = 'Required level of assessments similarity';
 $string['assessmentdeleted'] = 'Assessment deallocated';
 $string['assessmentend'] = 'End of assessment phase';
 $string['assessmentform'] = 'Assessment form';
@@ -67,20 +63,11 @@ $string['backtoeditform'] = 'Back to editing form';
 $string['byfullname'] = 'by <a href=\"{$a->url}\">{$a->name}</a>';
 $string['calculatetotalgrades'] = 'Calculate total grades';
 $string['calculatetotalgradesdetails'] = 'expected: $a->expected<br />known: $a->known';
-$string['comparisonhigh'] = 'High';
-$string['comparisonlow'] = 'Low';
-$string['comparisonnormal'] = 'Normal';
-$string['comparisonveryhigh'] = 'Very high';
-$string['comparisonverylow'] = 'Very low';
-$string['configanonymity'] = 'Default anonymity mode in workshops';
-$string['configassessmentcomps'] = 'Default value of the setting that influences the calculation of the grade for assessment.';
 $string['configexamplesmode'] = 'Default mode of examples assessment in workshops';
 $string['configgradedecimals'] = 'Default number of digits that should be shown after the decimal point when displaying grades.';
 $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['confignsassessments'] = 'Default number of allocated submissions to be reviewed by a user in the assessment phase';
 $string['configstrategy'] = 'Default grading strategy for workshops';
 $string['editassessmentform'] = 'Edit assessment form';
 $string['editassessmentformstrategy'] = 'Edit assessment form ($a)';
@@ -124,7 +111,6 @@ $string['modulenameplural'] = 'Workshops';
 $string['modulename'] = 'Workshop';
 $string['mysubmission'] = 'My submission';
 $string['nattachments'] = 'Maximum number of submission attachments';
-$string['nexassessments'] = 'Number of required assessments of examples';
 $string['nogradeyet'] = 'No grade yet';
 $string['nosubmissionfound'] = 'No submission found for this user';
 $string['nosubmissions'] = 'No submissions yet in this workshop';
@@ -132,9 +118,7 @@ $string['nothingtoreview'] = 'Nothing to review';
 $string['notoverridden'] = 'Not overriden';
 $string['noworkshops'] = 'There are no workshops in this course';
 $string['noyoursubmission'] = 'You have not submitted your work yet';
-$string['nsassessments'] = 'Number of required assessments of other users\' work';
 $string['nullgrade'] = '-';
-$string['numofreviews'] = 'Number of reviews';
 $string['participant'] = 'Participant';
 $string['participantrevierof'] = 'Participant is reviewer of';
 $string['participantreviewedby'] = 'Participant is reviewed by';
@@ -180,7 +164,6 @@ $string['taskinstructauthors'] = 'Provide instructions for submitting';
 $string['taskinstructreviewers'] = 'Provide instructions for assessing';
 $string['taskintro'] = 'Set the workshop introduction';
 $string['tasksubmit'] = 'Submit your work';
-$string['teacherweight'] = 'Weight of the teacher\'s assessments';
 $string['totalgradeof'] = 'Total grade (of $a)';
 $string['totalgradesmissing'] = 'Unable to calculate some total grades - they will have to be set manually in Gradebook';
 $string['totalgrade'] = 'Total grade';
index b4292a638bf0ca62b88b6ca05e2eac8ff6f61ba6..a07946461e3057531dfaa96cf6cc502157c28071 100644 (file)
@@ -20,9 +20,6 @@
  *
  * All the core Moodle functions, neeeded to allow the module to work
  * integrated in Moodle should be placed here.
- * All the workshop specific functions, needed to implement all the module
- * logic, should go to locallib.php. This will help to save some memory when
- * Moodle is performing actions across all modules.
  *
  * @package   mod-workshop
  * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
 
 defined('MOODLE_INTERNAL') || die();
 
-/**
- * The internal codes of the example assessment modes
- */
-define('WORKSHOP_EXAMPLES_VOLUNTARY',           0);
-define('WORKSHOP_EXAMPLES_BEFORE_SUBMISSION',   1);
-define('WORKSHOP_EXAMPLES_BEFORE_ASSESSMENT',   2);
-
-/**
- * The internal codes of the required level of assessment similarity
- */
-define('WORKSHOP_COMPARISON_VERYLOW',   0);     /* f = 1.00 */
-define('WORKSHOP_COMPARISON_LOW',       1);     /* f = 1.67 */
-define('WORKSHOP_COMPARISON_NORMAL',    2);     /* f = 2.50 */
-define('WORKSHOP_COMPARISON_HIGH',      3);     /* f = 3.00 */
-define('WORKSHOP_COMPARISON_VERYHIGH',  4);     /* f = 5.00 */
-
 /**
  * Returns the information if the module supports a feature
  *
@@ -623,144 +604,3 @@ function workshop_extend_settings_navigation(settings_navigation $settingsnav, s
         $workshopnode->add(get_string('allocate', 'workshop'), $url, settings_navigation::TYPE_SETTING);
     }
 }
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Other functions needed by Moodle core follows. They can't be put into      //
-// locallib.php because they are used by some core scripts (like modedit.php) //
-// where locallib.php is not included.                                        //
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Return an array of numeric values that can be used as maximum grades
- *
- * Used at several places where maximum grade for submission and grade for
- * assessment are defined via a HTML select form element. By default it returns
- * an array 0, 1, 2, ..., 98, 99, 100.
- *
- * @return array Array of integers
- */
-function workshop_get_maxgrades() {
-    $grades = array();
-    for ($i=100; $i>=0; $i--) {
-        $grades[$i] = $i;
-    }
-    return $grades;
-}
-
-/**
- * Return an array of possible numbers of assessments to be done
- *
- * Should always contain numbers 1, 2, 3, ... 10 and possibly others up to a reasonable value
- *
- * @return array Array of integers
- */
-function workshop_get_numbers_of_assessments() {
-    $options = array();
-    $options[30] = 30;
-    $options[20] = 20;
-    $options[15] = 15;
-    for ($i=10; $i>0; $i--) {
-        $options[$i] = $i;
-    }
-    return $options;
-}
-
-/**
- * Return an array of possible values for weight of teacher assessment
- *
- * @return array Array of integers 0, 1, 2, ..., 10
- */
-function workshop_get_teacher_weights() {
-    $weights = array();
-    for ($i=10; $i>=0; $i--) {
-        $weights[$i] = $i;
-    }
-    return $weights;
-}
-
-/**
- * Return an array of possible values of assessment dimension weight
- *
- * @return array Array of integers 0, 1, 2, ..., 16
- */
-function workshop_get_dimension_weights() {
-    $weights = array();
-    for ($i=16; $i>=0; $i--) {
-        $weights[$i] = $i;
-    }
-    return $weights;
-}
-
-/**
- * Return an array of the localized grading strategy names
- *
- * @todo remove this function from lib.php
- * $return array Array ['string' => 'string']
- */
-function workshop_get_strategies() {
-    $installed = get_plugin_list('workshopform');
-    $forms = array();
-    foreach ($installed as $strategy => $strategypath) {
-        if (file_exists($strategypath . '/lib.php')) {
-            $forms[$strategy] = get_string('pluginname', 'workshopform_' . $strategy);
-        }
-    }
-    return $forms;
-}
-
-/**
- * Return an array of available example assessment modes
- *
- * @return array Array 'mode DB code'=>'mode name'
- */
-function workshop_get_example_modes() {
-    $modes = array();
-    $modes[WORKSHOP_EXAMPLES_VOLUNTARY]         = get_string('examplesvoluntary', 'workshop');
-    $modes[WORKSHOP_EXAMPLES_BEFORE_SUBMISSION] = get_string('examplesbeforesubmission', 'workshop');
-    $modes[WORKSHOP_EXAMPLES_BEFORE_ASSESSMENT] = get_string('examplesbeforeassessment', 'workshop');
-
-    return $modes;
-}
-
-/**
- * Return array of assessment comparison levels
- *
- * The assessment comparison level influence how the grade for assessment is calculated.
- * Each object in the returned array provides information about the name of the level
- * and the value of the factor to be used in the calculation.
- * The structure of the returned array is
- * array[code int] of stdClass (
- *                      ->name string,
- *                      ->value number,
- *                      )
- * where code if the integer code that is actually stored in the database.
- *
- * @return array Array of objects
- */
-function workshop_get_comparison_levels() {
-    $levels = array();
-
-    $levels[WORKSHOP_COMPARISON_VERYHIGH] = new stdClass();
-    $levels[WORKSHOP_COMPARISON_VERYHIGH]->name = get_string('comparisonveryhigh', 'workshop');
-    $levels[WORKSHOP_COMPARISON_VERYHIGH]->value = 5.00;
-
-    $levels[WORKSHOP_COMPARISON_HIGH] = new stdClass();
-    $levels[WORKSHOP_COMPARISON_HIGH]->name = get_string('comparisonhigh', 'workshop');
-    $levels[WORKSHOP_COMPARISON_HIGH]->value = 3.00;
-
-    $levels[WORKSHOP_COMPARISON_NORMAL] = new stdClass();
-    $levels[WORKSHOP_COMPARISON_NORMAL]->name = get_string('comparisonnormal', 'workshop');
-    $levels[WORKSHOP_COMPARISON_NORMAL]->value = 2.50;
-
-    $levels[WORKSHOP_COMPARISON_LOW] = new stdClass();
-    $levels[WORKSHOP_COMPARISON_LOW]->name = get_string('comparisonlow', 'workshop');
-    $levels[WORKSHOP_COMPARISON_LOW]->value = 1.67;
-
-    $levels[WORKSHOP_COMPARISON_VERYLOW] = new stdClass();
-    $levels[WORKSHOP_COMPARISON_VERYLOW]->name = get_string('comparisonverylow', 'workshop');
-    $levels[WORKSHOP_COMPARISON_VERYLOW]->value = 1.00;
-
-    return $levels;
-}
index e8e4597f0a124cd5c06057699373fc0b9c7b2001..72e20125a4b938aab161830ae9f5f06d3f7a6e66 100644 (file)
@@ -43,15 +43,20 @@ require_once($CFG->libdir . '/gradelib.php');   // we use some rounding and comp
 class workshop {
 
     /** return statuses of {@link add_allocation} to be passed to a workshop renderer method */
-    const ALLOCATION_EXISTS = -1;
-    const ALLOCATION_ERROR  = -2;
+    const ALLOCATION_EXISTS             = -1;
+    const ALLOCATION_ERROR              = -2;
 
     /** the internal code of the workshop phases as are stored in the database */
-    const PHASE_SETUP       = 10;
-    const PHASE_SUBMISSION  = 20;
-    const PHASE_ASSESSMENT  = 30;
-    const PHASE_EVALUATION  = 40;
-    const PHASE_CLOSED      = 50;
+    const PHASE_SETUP                   = 10;
+    const PHASE_SUBMISSION              = 20;
+    const PHASE_ASSESSMENT              = 30;
+    const PHASE_EVALUATION              = 40;
+    const PHASE_CLOSED                  = 50;
+
+    /** the internal code of the examples modes as are stored in the database */
+    const EXAMPLES_VOLUNTARY            = 0;
+    const EXAMPLES_BEFORE_SUBMISSION    = 1;
+    const EXAMPLES_BEFORE_ASSESSMENT    = 2;
 
     /** @var stdClass course module record */
     public $cm = null;
@@ -59,6 +64,9 @@ class workshop {
     /** @var stdClass course record */
     public $course = null;
 
+    /** @var stdClass context object */
+    public $context = null;
+
     /**
      * @var workshop_strategy grading strategy instance
      * Do not use directly, get the instance using {@link workshop::grading_strategy_instance()}
@@ -150,6 +158,83 @@ class workshop {
         return $total * $percent / 100;
     }
 
+    /**
+     * Returns an array of numeric values that can be used as maximum grades
+     *
+     * @return array Array of integers
+     */
+    public static function available_maxgrades_list() {
+        $grades = array();
+        for ($i=100; $i>=0; $i--) {
+            $grades[$i] = $i;
+        }
+        return $grades;
+    }
+
+    /**
+     * Returns the localized list of supported examples modes
+     *
+     * @return array
+     */
+    public static function available_example_modes_list() {
+        $options = array();
+        $options[self::EXAMPLES_VOLUNTARY]         = get_string('examplesvoluntary', 'workshop');
+        $options[self::EXAMPLES_BEFORE_SUBMISSION] = get_string('examplesbeforesubmission', 'workshop');
+        $options[self::EXAMPLES_BEFORE_ASSESSMENT] = get_string('examplesbeforeassessment', 'workshop');
+        return $options;
+    }
+
+    /**
+     * Returns the list of available grading strategy methods
+     *
+     * @return array ['string' => 'string']
+     */
+    public static function available_strategies_list() {
+        $installed = get_plugin_list('workshopform');
+        $forms = array();
+        foreach ($installed as $strategy => $strategypath) {
+            if (file_exists($strategypath . '/lib.php')) {
+                $forms[$strategy] = get_string('pluginname', 'workshopform_' . $strategy);
+            }
+        }
+        return $forms;
+    }
+
+    /**
+     * Return an array of possible values of assessment dimension weight
+     *
+     * @return array of integers 0, 1, 2, ..., 16
+     */
+    public static function available_dimension_weights_list() {
+        $weights = array();
+        for ($i=16; $i>=0; $i--) {
+            $weights[$i] = $i;
+        }
+        return $weights;
+    }
+
+    /**
+     * Helper function returning the greatest common divisor
+     *
+     * @param int $a
+     * @param int $b
+     * @return int
+     */
+    public static function gcd($a, $b) {
+        return ($b == 0) ? ($a):(self::gcd($b, $a % $b));
+    }
+
+    /**
+     * Helper function returning the least common multiple
+     *
+     * @param int $a
+     * @param int $b
+     * @return int
+     */
+    public static function lcm($a, $b) {
+        return ($a / self::gcd($a,$b)) * $b;
+    }
+
     ////////////////////////////////////////////////////////////////////////////////
     // Workshop API                                                               //
     ////////////////////////////////////////////////////////////////////////////////
@@ -348,7 +433,7 @@ class workshop {
     public function get_all_assessments() {
         global $DB;
 
-        $sql = 'SELECT a.id, a.submissionid, a.reviewerid, a.timecreated, a.timemodified, a.timeagreed,
+        $sql = 'SELECT a.id, a.submissionid, a.reviewerid, a.timecreated, a.timemodified,
                        a.grade, a.gradinggrade, a.gradinggradeover, a.gradinggradeoverby,
                        reviewer.id AS reviewerid,reviewer.firstname AS reviewerfirstname,reviewer.lastname as reviewerlastname,
                        s.title,
@@ -639,24 +724,14 @@ class workshop {
      * Can the given grades be displayed to the authors?
      *
      * Grades are not displayed if {@link self::assessments_available()} return false. The returned
-     * value may be true (if yes, display grades), false (no, hide grades yet) or null (only
-     * display grades if the assessment has been agreed by the author).
+     * value may be true (if yes, display grades) or false (no, hide grades yet)
      *
-     * @return bool|null
+     * @return bool
      */
     public function grades_available() {
         return true;
     }
 
-    /**
-     * Returns the localized name of the grading strategy method to be displayed to the users
-     *
-     * @return string
-     */
-    public function strategy_name() {
-        return get_string('pluginname', 'workshopform_' . $this->strategy);
-    }
-
     /**
      * Prepare an individual workshop plan for the given user.
      *
@@ -691,7 +766,7 @@ class workshop {
             $task = new stdClass();
             $task->title = get_string('editassessmentform', 'workshop');
             $task->link = $this->editform_url();
-            if ($this->assessment_form_ready()) {
+            if ($this->grading_strategy_instance()->form_ready()) {
                 $task->completed = true;
             } elseif ($this->phase > self::PHASE_SETUP) {
                 $task->completed = false;
@@ -906,15 +981,6 @@ class workshop {
         return $phases;
     }
 
-    /**
-     * Has the assessment form been defined?
-     *
-     * @return bool
-     */
-    public function assessment_form_ready() {
-        return $this->grading_strategy_instance()->form_ready();
-    }
-
     /**
      * Switch to a new workshop phase
      *
@@ -930,6 +996,12 @@ class workshop {
         if (!isset($known[$newphase])) {
             return false;
         }
+
+        if (self::PHASE_CLOSED == $newphase) {
+            // push the total grades into the gradebook
+
+        }
+
         $DB->set_field('workshop', 'phase', $newphase, array('id' => $this->id));
         return true;
     }
@@ -1377,10 +1449,9 @@ class workshop {
     }
 
     /**
-     * TODO: short description.
+     * Returns the mform the teachers use to put a feedback for the reviewer
      *
-     * @param array $actionurl 
-     * @return TODO
+     * @return workshop_feedbackreviewer_form
      */
     public function get_feedbackreviewer_form(moodle_url $actionurl, stdClass $assessment, $editable=true) {
         global $CFG;
@@ -1404,32 +1475,6 @@ class workshop {
                 'post', '', null, $editable);
     }
 
-    ////////////////////////////////////////////////////////////////////////////
-    // Helper methods                                                         //
-    ////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Helper function returning the greatest common divisor
-     *
-     * @param int $a
-     * @param int $b
-     * @return int
-     */
-    public static function gcd($a, $b) {
-        return ($b == 0) ? ($a):(self::gcd($b, $a % $b));
-    }
-
-    /**
-     * Helper function returning the least common multiple
-     *
-     * @param int $a
-     * @param int $b
-     * @return int
-     */
-    public static function lcm($a, $b) {
-        return ($a / self::gcd($a,$b)) * $b;
-    }
-
     ////////////////////////////////////////////////////////////////////////////////
     // Internal methods (implementation details)                                  //
     ////////////////////////////////////////////////////////////////////////////////
index 5e232a7b2d9b8b45d3aca27ab1451b87473296e9..ac4432a78c97a5326580ce95e4e0250519bb3fca 100644 (file)
@@ -85,7 +85,7 @@ class mod_workshop_mod_form extends moodleform_mod {
         // Grading settings -----------------------------------------------------------
         $mform->addElement('header', 'gradingsettings', get_string('gradingsettings', 'workshop'));
 
-        $grades = workshop_get_maxgrades();
+        $grades = workshop::available_maxgrades_list();
 
         $label = get_string('submissiongrade', 'workshop');
         $mform->addElement('select', 'grade', $label, $grades);
@@ -98,7 +98,7 @@ class mod_workshop_mod_form extends moodleform_mod {
         $mform->setHelpButton('gradinggrade', array('gradinggrade', $label, 'workshop'));
 
         $label = get_string('strategy', 'workshop');
-        $mform->addElement('select', 'strategy', $label, workshop_get_strategies());
+        $mform->addElement('select', 'strategy', $label, workshop::available_strategies_list());
         $mform->setDefault('strategy', $workshopconfig->strategy);
         $mform->setHelpButton('strategy', array('strategy', $label, 'workshop'));
 
@@ -128,17 +128,18 @@ class mod_workshop_mod_form extends moodleform_mod {
         $mform->setDefault('nattachments', 1);
         $mform->setHelpButton('nattachments', array('nattachments', $label, 'workshop'));
 
-        $label = get_string('latesubmissions', 'workshop');
-        $text = get_string('latesubmissionsdesc', 'workshop');
-        $mform->addElement('advcheckbox', 'latesubmissions', $label, $text);
-        $mform->setHelpButton('latesubmissions', array('latesubmissions', $label, 'workshop'));
-
         $options = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
         $options[0] = get_string('courseuploadlimit') . ' ('.display_size($COURSE->maxbytes).')';
         $mform->addElement('select', 'maxbytes', get_string('maximumsize', 'assignment'), $options);
         $mform->setDefault('maxbytes', $workshopconfig->maxbytes);
         $mform->setHelpButton('maxbytes', array('maxbytes', $label, 'workshop'));
 
+        $label = get_string('latesubmissions', 'workshop');
+        $text = get_string('latesubmissionsdesc', 'workshop');
+        $mform->addElement('advcheckbox', 'latesubmissions', $label, $text);
+        $mform->setHelpButton('latesubmissions', array('latesubmissions', $label, 'workshop'));
+        $mform->setAdvanced('latesubmissions');
+
         // Assessment settings --------------------------------------------------------
         $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
 
@@ -146,43 +147,14 @@ class mod_workshop_mod_form extends moodleform_mod {
         $mform->addElement('editor', 'instructreviewerseditor', $label, null,
                             workshop::instruction_editors_options($this->context));
 
-        $label = get_string('nexassessments', 'workshop');
-        $options = workshop_get_numbers_of_assessments();
-        $options[0] = get_string('assessallexamples', 'workshop');
-        $mform->addElement('select', 'nexassessments', $label, $options);
-        $mform->setDefault('nexassessments', $workshopconfig->nexassessments);
-        $mform->setHelpButton('nexassessments', array('nexassessments', $label, 'workshop'));
-        $mform->disabledIf('nexassessments', 'useexamples');
-
         $label = get_string('examplesmode', 'workshop');
-        $options = workshop_get_example_modes();
+        $options = workshop::available_example_modes_list();
         $mform->addElement('select', 'examplesmode', $label, $options);
         $mform->setDefault('examplesmode', $workshopconfig->examplesmode);
         $mform->setHelpButton('examplesmode', array('examplesmode', $label, 'workshop'));
-        $mform->disabledIf('nexassessments', 'useexamples');
+        $mform->disabledIf('examplesmode', 'useexamples');
         $mform->setAdvanced('examplesmode');
 
-        $label = get_string('teacherweight', 'workshop');
-        $options = workshop_get_teacher_weights();
-        $mform->addElement('select', 'teacherweight', $label, $options);
-        $mform->setDefault('teacherweight', 1);
-        $mform->setHelpButton('teacherweight', array('teacherweight', $label, 'workshop'));
-
-        $label = get_string('agreeassessments', 'workshop');
-        $text = get_string('agreeassessmentsdesc', 'workshop');
-        $mform->addElement('advcheckbox', 'agreeassessments', $label, $text);
-        $mform->setHelpButton('agreeassessments', array('agreeassessments', $label, 'workshop'));
-        $mform->setAdvanced('agreeassessments');
-
-        $label = get_string('assessmentcomps', 'workshop');
-        $levels = array();
-        foreach (workshop_get_comparison_levels() as $code => $level) {
-            $levels[$code] = $level->name;
-        }
-        $mform->addElement('select', 'assessmentcomps', $label, $levels);
-        $mform->setDefault('assessmentcomps', $workshopconfig->assessmentcomps);
-        $mform->setHelpButton('assessmentcomps', array('assessmentcomps', $label, 'workshop'));
-
         // Access control -------------------------------------------------------------
         $mform->addElement('header', 'accesscontrol', get_string('accesscontrol', 'workshop'));
 
index c36bbb9f308d6518dd98d0a01b3d6ef725c7ce69..fe435ac82a578801fdd9a5575b634664ec6cb1f4 100644 (file)
@@ -28,8 +28,9 @@
 defined('MOODLE_INTERNAL') || die();
 
 require_once($CFG->dirroot.'/mod/workshop/lib.php');
+require_once($CFG->dirroot.'/mod/workshop/locallib.php');
 
-$grades = workshop_get_maxgrades();
+$grades = workshop::available_maxgrades_list();
 
 $settings->add(new admin_setting_configselect('workshop/grade', get_string('submissiongrade', 'workshop'),
                     get_string('configgrade', 'workshop'), 80, $grades));
@@ -50,27 +51,21 @@ $settings->add(new admin_setting_configselect('workshop/maxbytes', get_string('m
                     get_string('configmaxbytes', 'workshop'), 0, $options));
 
 $settings->add(new admin_setting_configselect('workshop/strategy', get_string('strategy', 'workshop'),
-                    get_string('configstrategy', 'workshop'), 'accumulative', workshop_get_strategies()));
+                    get_string('configstrategy', 'workshop'), 'accumulative', workshop::available_strategies_list()));
 
-$options = workshop_get_numbers_of_assessments();
-$settings->add(new admin_setting_configselect('workshop/nsassessments', get_string('nsassessments', 'workshop'),
-                    get_string('confignsassessments', 'workshop'), 3, $options));
-
-$options = workshop_get_numbers_of_assessments();
-$options[0] = get_string('assessallexamples', 'workshop');
-$settings->add(new admin_setting_configselect('workshop/nexassessments', get_string('nexassessments', 'workshop'),
-                    get_string('confignexassessments', 'workshop'), 0, $options));
-
-$options = workshop_get_example_modes();
+$options = workshop::available_example_modes_list();
 $settings->add(new admin_setting_configselect('workshop/examplesmode', get_string('examplesmode', 'workshop'),
-                    get_string('configexamplesmode', 'workshop'), WORKSHOP_EXAMPLES_VOLUNTARY, $options));
+                    get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));
 
-$levels = array();
-foreach (workshop_get_comparison_levels() as $code => $level) {
-    $levels[$code] = $level->name;
+// include the settings of allocation subplugins
+$allocators = get_plugin_list('workshopallocation');
+foreach ($allocators as $allocator => $path) {
+    if (file_exists($settingsfile = $path . '/settings.php')) {
+        $settings->add(new admin_setting_heading('workshopallocationsetting'.$allocator,
+                get_string('allocation', 'workshop') . ' - ' . get_string('pluginname', 'workshopallocation_' . $allocator), ''));
+        include($settingsfile);
+    }
 }
-$settings->add(new admin_setting_configselect('workshop/assessmentcomps', get_string('assessmentcomps', 'workshop'),
-                    get_string('configassessmentcomps', 'workshop'), WORKSHOP_COMPARISON_NORMAL, $levels));
 
 // include the settings of grading strategy subplugins
 $strategies = get_plugin_list('workshopform');
diff --git a/mod/workshop/simpletest/testlib.php b/mod/workshop/simpletest/testlib.php
deleted file mode 100644 (file)
index 6ac80f0..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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/>.
-
-/**
- * Unit tests for (some of) mod/workshop/lib.php
- *
- * @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();
-
-// Make sure the code being tested is accessible.
-require_once($CFG->dirroot . '/mod/workshop/lib.php'); // Include the code to test
-
-/**
- * Test cases for the functions in lib.php
- */
-class workshop_lib_test extends UnitTestCase {
-
-    function test_workshop_get_maxgrades() {
-        $this->assertIsA(workshop_get_maxgrades(), 'Array');
-        $this->assertTrue(workshop_get_maxgrades());
-        $values_are_integers = True;
-        foreach(workshop_get_maxgrades() as $key => $val) {
-            if (!is_int($val)) {
-                $values_are_integers = false;
-                break;
-            }
-        }
-        $this->assertTrue($values_are_integers, 'Array values must be integers');
-    }
-
-}
index 0e11cd5b2105ae36ec40b05efc975f38d41fa63e..a071624077aa6210b248d71e4f47f4717695bc37 100644 (file)
@@ -167,9 +167,6 @@ if ($isreviewer) {
     $canviewgrades = true;  // reviewers can always see the grades they gave even they are not available yet
 } elseif ($ownsubmission or $canviewallassessments) {
     $canviewgrades = $workshop->grades_available(); // bool|null, see the function phpdoc
-    if (!$canviewgrades and has_capability('mod/workshop:viewgradesbeforeagreement', $PAGE->context)) {
-        $canviewgrades = true;
-    }
 }
 
 if ($isreviewer) {