From: David Mudrak Date: Mon, 4 Jan 2010 18:19:13 +0000 (+0000) Subject: Allow opening assessment forms in read-only mode X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=37f37237c8cd2f5f76adfccf9a891e54f6376c10;p=moodle.git Allow opening assessment forms in read-only mode --- diff --git a/mod/workshop/form/accumulative/lib.php b/mod/workshop/form/accumulative/lib.php index 4a278c510a..6fd2cde4e3 100644 --- a/mod/workshop/form/accumulative/lib.php +++ b/mod/workshop/form/accumulative/lib.php @@ -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); } /** diff --git a/mod/workshop/form/lib.php b/mod/workshop/form/lib.php index 69ba242390..199cd3e364 100644 --- a/mod/workshop/form/lib.php +++ b/mod/workshop/form/lib.php @@ -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 diff --git a/mod/workshop/form/numerrors/lib.php b/mod/workshop/form/numerrors/lib.php index d319b1f8d9..270cea5284 100644 --- a/mod/workshop/form/numerrors/lib.php +++ b/mod/workshop/form/numerrors/lib.php @@ -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); } /** diff --git a/mod/workshop/form/rubric/lib.php b/mod/workshop/form/rubric/lib.php index 41b0eea216..c78dc77d6f 100644 --- a/mod/workshop/form/rubric/lib.php +++ b/mod/workshop/form/rubric/lib.php @@ -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); } /**