Allow opening assessment forms in read-only mode

This commit is contained in:
David Mudrak
2010-01-04 18:19:13 +00:00
parent 1372eaa91b
commit 37f37237c8
4 changed files with 15 additions and 9 deletions
+4 -2
View 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);
}
/**
+4 -2
View 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
+4 -2
View 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);
}
/**
+3 -3
View 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);
}
/**