]> git.mjollnir.org Git - moodle.git/commitdiff
Getting rid of supports_evaluation()
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:17:03 +0000 (18:17 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:17:03 +0000 (18:17 +0000)
This seems to be over-desing-patternized. Methods needed by standard
eval plugins (ie part of standard distribution) are part of strategy
API. Contributed eval methods will have to patch strategy plugins if
they need some other data from them.

mod/workshop/eval/best/lib.php
mod/workshop/form/accumulative/lib.php
mod/workshop/form/lib.php
mod/workshop/form/numerrors/lib.php
mod/workshop/form/rubric/lib.php

index 5e6103fe8407051fe8247aa5c50e0477647baab1..e73c8e80aceadde6da743d0189f5527cc811c69d 100644 (file)
@@ -61,10 +61,6 @@ class workshop_best_evaluation implements workshop_evaluation {
         global $DB;
 
         $grader = $this->workshop->grading_strategy_instance();
-        if (! $grader->supports_evaluation($this)) {
-            throw new coding_exception('The currently selected grading strategy plugin does not
-                support this method of grading evaluation.');
-        }
 
         // get the information about the assessment dimensions
         $diminfo = $grader->get_dimensions_info();
index 41a44eec48a62e37cfb3b076659162b398d2b07b..68c8cf3fddc8c5061739db01f18b20a372b05b1d 100644 (file)
@@ -241,34 +241,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
     }
 
     /**
-     * Returns true if the given evaluation method is supported by this strategy
-     *
-     * To support an evaluation method, the strategy subplugin must usually implement some
-     * required public methods. In theory, this is what interfaces should be used for.
-     * Unfortunatelly, we can't extend "implements" declaration as the interface must
-     * be known to the PHP interpret. So we can't declare implementation of a non-installed
-     * evaluation subplugin.
-     *
-     * @param workshop_evaluation $evaluation the instance of grading evaluation class
-     * @return bool true if the evaluation method is supported, false otherwise
-     */
-    public function supports_evaluation(workshop_evaluation $evaluation) {
-        if (is_a($evaluation, 'workshop_best_evaluation')) {
-            return true;
-        }
-        // all other evaluation methods are not supported yet
-        return false;
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////
-    // Methods required by the 'best' evaluation plugin                           //
-    ////////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * TODO
-     *
-     * @param resource $restrict 
-     * @return TODO
+     * @see parent::get_assessments_recordset()
      */
     public function get_assessments_recordset($restrict) {
         global $DB;
@@ -298,9 +271,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
     }
 
     /**
-     * TODO: short description.
-     *
-     * @return array [dimid] => stdClass (->id ->max ->min ->weight)
+     * @see parent::get_dimensions_info()
      */
     public function get_dimensions_info() {
         global $DB;
index 0f6400771d5d6b1235a30efe276822c490b9f5e3..69ba2423902b8647fb897f50fc37b50f776b7e87 100644 (file)
@@ -79,20 +79,6 @@ interface workshop_strategy {
      */
     public function form_ready();
 
-    /**
-     * Returns true if the given evaluation method is supported by this strategy
-     *
-     * To support an evaluation method, the strategy subplugin must usually implement some
-     * required public methods. In theory, this is what interfaces should be used for.
-     * Unfortunatelly, we can't extend "implements" declaration as the interface must
-     * be known to the PHP interpret. So we can't declare implementation of a non-installed
-     * evaluation subplugin.
-     *
-     * @param workshop_evaluation $evaluation the instance of grading evaluation class
-     * @return bool true if the evaluation method is supported, false otherwise
-     */
-    public function supports_evaluation(workshop_evaluation $evaluation);
-
     /**
      * Returns a general information about the assessment dimensions
      *
index e2d8ea032deebea8ea4c181db1470af66ea5eb2c..02da64b4cfef281ae908a5a0fb3cd1e485287ca6 100644 (file)
@@ -275,26 +275,6 @@ class workshop_numerrors_strategy implements workshop_strategy {
         return false;
     }
 
-    /**
-     * Returns true if the given evaluation method is supported by this strategy
-     *
-     * To support an evaluation method, the strategy subplugin must usually implement some
-     * required public methods. In theory, this is what interfaces should be used for.
-     * Unfortunatelly, we can't extend "implements" declaration as the interface must
-     * be known to the PHP interpret. So we can't declare implementation of a non-installed
-     * evaluation subplugin.
-     *
-     * @param workshop_evaluation $evaluation the instance of grading evaluation class
-     * @return bool true if the evaluation method is supported, false otherwise
-     */
-    public function supports_evaluation(workshop_evaluation $evaluation) {
-        if (is_a($evaluation, 'workshop_best_evaluation')) {
-            return true;
-        }
-        // all other evaluation methods are not supported yet
-        return false;
-    }
-
 ////////////////////////////////////////////////////////////////////////////////
 // Internal methods                                                           //
 ////////////////////////////////////////////////////////////////////////////////
index 12cabcb930006da8b7b2d143203bd97fd05b60f4..41b0eea216cff9d84c6e8176ffedd7e86a8882ba 100644 (file)
@@ -289,36 +289,7 @@ class workshop_rubric_strategy implements workshop_strategy {
     }
 
     /**
-     * Returns true if the given evaluation method is supported by this strategy
-     *
-     * To support an evaluation method, the strategy subplugin must usually implement some
-     * required public methods. In theory, this is what interfaces should be used for.
-     * Unfortunatelly, we can't extend "implements" declaration as the interface must
-     * be known to the PHP interpreter. So we can't declare implementation of a non-installed
-     * evaluation subplugin.
-     *
-     * @param workshop_evaluation $evaluation the instance of grading evaluation class
-     * @return bool true if the evaluation method is supported, false otherwise
-     */
-    public function supports_evaluation(workshop_evaluation $evaluation) {
-        if (is_a($evaluation, 'workshop_best_evaluation')) {
-            return true;
-        }
-        // all other evaluation methods are not supported yet
-        return false;
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////
-    // Methods required by the 'best' evaluation plugin                           //
-    ////////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Returns recordset with information of all assessments done using this strategy
-     *
-     * Required by /eval/best grading evaluation subplugin
-     *
-     * @param array|int|null $restrict optional id or ids of the reviewer
-     * @return moodle_recordset
+     * @see parent::get_assessments_recordset()
      */
     public function get_assessments_recordset($restrict=null) {
         global $DB;
@@ -348,11 +319,7 @@ class workshop_rubric_strategy implements workshop_strategy {
     }
 
     /**
-     * Returns a general information about the assessment dimensions
-     *
-     * In rubric, all dimensions have the same weight.
-     *
-     * @return array [dimid] => stdClass (->id ->max ->min ->weight)
+     * @see parent::get_dimensions_info()
      */
     public function get_dimensions_info() {
         global $DB;