]> git.mjollnir.org Git - moodle.git/commitdiff
Allow opening assessment forms in read-only mode
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:19:13 +0000 (18:19 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:19:13 +0000 (18:19 +0000)
mod/workshop/form/accumulative/lib.php
mod/workshop/form/lib.php
mod/workshop/form/numerrors/lib.php
mod/workshop/form/rubric/lib.php

index 4a278c510a9a26d2002304853dbd5990e5658898..6fd2cde4e3df2570e628adec19a7e882f75114b4 100644 (file)
@@ -149,8 +149,10 @@ class workshop_accumulative_strategy implements workshop_strategy {
      *
      * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
      * @param string $mode          Mode to open the form in: preview/assessment
+     * @param stdClass $assessment  The current assessment
+     * @param bool $editable
      */
-    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) {
+    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null, $editable=true) {
         global $CFG;    // needed because the included files use it
         global $PAGE;
         global $DB;
@@ -190,7 +192,7 @@ class workshop_accumulative_strategy implements workshop_strategy {
         $customdata['current']  = isset($current) ? $current : null;
         $attributes = array('class' => 'assessmentform accumulative');
 
-        return new workshop_accumulative_assessment_form($actionurl, $customdata, 'post', '', $attributes);
+        return new workshop_accumulative_assessment_form($actionurl, $customdata, 'post', '', $attributes, $editable);
     }
 
     /**
index 69ba2423902b8647fb897f50fc37b50f776b7e87..199cd3e364208164bd963789ef2571a3dbc03cef 100644 (file)
@@ -54,9 +54,11 @@ interface workshop_strategy {
      * Factory method returning an instance of an assessment form
      *
      * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
-     * @param string $mode          Mode to open the form in: preview or assessment
+     * @param string $mode          Mode to open the form in: preview|assessment
+     * @param stdClass $assessment  If opening in the assessment mode, the current assessment record
+     * @param bool $editable        Shall the form be opened as editable (true) or read-only (false)
      */
-    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview');
+    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null, $editable=true);
 
     /**
      * Saves the filled assessment and returns the grade for submission as suggested by the reviewer
index d319b1f8d9b5e4413b18fba832731f552d5b1fb6..270cea528434a5e33f9356d1d0f6ef5d76fbef77 100644 (file)
@@ -184,8 +184,10 @@ class workshop_numerrors_strategy implements workshop_strategy {
      *
      * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
      * @param string $mode          Mode to open the form in: preview/assessment
+     * @param stdClass $assessment
+     * @param bool $editable
      */
-    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) {
+    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null, $editable=true) {
         global $CFG;    // needed because the included files use it
         global $PAGE;
         global $DB;
@@ -225,7 +227,7 @@ class workshop_numerrors_strategy implements workshop_strategy {
         $customdata['current']  = isset($current) ? $current : null;
         $attributes = array('class' => 'assessmentform numerrors');
 
-        return new workshop_numerrors_assessment_form($actionurl, $customdata, 'post', '', $attributes);
+        return new workshop_numerrors_assessment_form($actionurl, $customdata, 'post', '', $attributes, $editable);
     }
 
     /**
index 41b0eea216cff9d84c6e8176ffedd7e86a8882ba..c78dc77d6fc6c59abb4657ec3a597b3ca79d90e8 100644 (file)
@@ -189,9 +189,9 @@ class workshop_rubric_strategy implements workshop_strategy {
      * Factory method returning an instance of an assessment form
      *
      * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url
-     * @param string $mode          Mode to open the form in: preview/assessment
+     * @param string $mode          Mode to open the form in: preview/assessment/readonly
      */
-    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) {
+    public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null, $editable=true) {
         global $CFG;    // needed because the included files use it
         global $DB;
         require_once(dirname(__FILE__) . '/assessment_form.php');
@@ -241,7 +241,7 @@ class workshop_rubric_strategy implements workshop_strategy {
         $attributes = array('class' => 'assessmentform rubric ' . $this->config->layout);
 
         $formclassname = 'workshop_rubric_' . $this->config->layout . '_assessment_form';
-        return new $formclassname($actionurl, $customdata, 'post', '', $attributes);
+        return new $formclassname($actionurl, $customdata, 'post', '', $attributes, $editable);
     }
 
     /**