From: David Mudrak Date: Mon, 4 Jan 2010 17:58:45 +0000 (+0000) Subject: Removed the Dummy grading strategy X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0121d6302c5112e3d3edfef19a685531d26ae01a;p=moodle.git Removed the Dummy grading strategy This was here for the code reviewing purposes only. --- diff --git a/mod/workshop/grading/dummy/assessment_form.php b/mod/workshop/grading/dummy/assessment_form.php deleted file mode 100644 index 047371ba7b..0000000000 --- a/mod/workshop/grading/dummy/assessment_form.php +++ /dev/null @@ -1,51 +0,0 @@ -. - -/** - * This file defines an mform to assess a submission by dummy grading strategy - * - * @package mod-workshop - * @copyright 2009 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -require_once(dirname(dirname(__FILE__)).'/assessment_form.php'); // parent class definition - -/** - * Class representing a form for assessing submissions by dummy grading strategy - * - * @uses moodleform - */ -class workshop_dummy_assessment_form extends workshop_assessment_form { - - /** - * Define the elements to be displayed at the form - * - * Called by the parent::definition() - * - * @return void - */ - protected function definition_inner(&$mform) { - - $mform->addElement('modgrade', 'grade', 'This is the dummy assessment form. - The output of every review is always a grade 0-100. So, you can fake the calculated grade - by direct setting it here. The dummy strategy does not save it.'); - - } -} diff --git a/mod/workshop/grading/dummy/edit_form.php b/mod/workshop/grading/dummy/edit_form.php deleted file mode 100644 index 5a68ff4efe..0000000000 --- a/mod/workshop/grading/dummy/edit_form.php +++ /dev/null @@ -1,48 +0,0 @@ -. - -/** - * This file defines an mform to edit dummy grading strategy forms. - * - * @package mod-workshop - * @copyright 2009 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -require_once(dirname(dirname(dirname(__FILE__))).'/lib.php'); // module library -require_once(dirname(dirname(__FILE__)).'/edit_form.php'); // parent class definition - -/** - * Class for editing dummy grading strategy forms. - * - * @uses moodleform - */ -class workshop_edit_dummy_strategy_form extends workshop_edit_strategy_form { - - /** - * Define the elements to be displayed at the form - * - * Called by the parent::definition() - * - * @return void - */ - protected function definition_inner(&$mform) { - $mform->addElement('static', 'just_a_text', 'Nothing to do here in this dummy strategy'); - } -} diff --git a/mod/workshop/grading/dummy/strategy.php b/mod/workshop/grading/dummy/strategy.php deleted file mode 100644 index 712d39189e..0000000000 --- a/mod/workshop/grading/dummy/strategy.php +++ /dev/null @@ -1,122 +0,0 @@ -. - -/** - * This file defines a class with dummy grading strategy logic - * - * @package mod-workshop - * @copyright 2009 David Mudrak - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition - -/** - * Dummy grading strategy logic - * - * This is not a real strategy, it is used during the development only to demonstrate - * the basic idea of the strategy plugin. Consider this as a "hello world" grading strategy. - */ -class workshop_dummy_strategy implements workshop_strategy { - - /** @var workshop the parent workshop instance */ - protected $workshop; - - /** - * Constructor - * - * @param workshop $workshop The workshop instance record - * @return void - */ - public function __construct(workshop $workshop) { - $this->workshop = $workshop; - } - -/// Public API - - /** - * @param $actionurl URL of form handler, defaults to auto detect the current url - */ - public function get_edit_strategy_form($actionurl=null) { - global $CFG; // needed because the included files use it - global $PAGE; - - require_once(dirname(__FILE__) . '/edit_form.php'); - - $customdata = array(); - $customdata['workshop'] = $this->workshop; - $customdata['strategy'] = $this; - $attributes = array('class' => 'editstrategyform'); - - return new workshop_edit_dummy_strategy_form($actionurl, $customdata, 'post', '', $attributes); - } - - /** - * In dummy strategy, we can't really edit the assessment form. All other "real" strategies save - * the form definition into {workshop_forms} and {workshop_forms_*} tables. - * - * @param stdClass $data Raw data returned by the dimension editor form - */ - public function save_edit_strategy_form(stdClass $data) { } - - /** - * Factory method returning an instance of an assessment form - * - * This dummy strategy uses the static assessment form that does not saves the filled data. - * All other "real" strategies load the form definition from {workshop_forms} and {workshop_forms_*} tables - * and save the filled data into {workshop_grades} table. - * - * @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 - */ - public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) { - global $CFG; // needed because the included files use it - require_once(dirname(__FILE__) . '/assessment_form.php'); - - // set up the required custom data common for all strategies - $customdata['strategy'] = $this; - $customdata['mode'] = $mode; - - // set up strategy-specific custom data - $attributes = array('class' => 'assessmentform dummy'); - - return new workshop_dummy_assessment_form($actionurl, $customdata, 'post', '', $attributes); - } - - /** - * Real strategies would calculate and save the filled assessment here - * - * This method processes data submitted using the form returned by {@link get_assessment_form()} - * We do not calculate nor save anything in this dummy strategy. - * - * @param stdClass $assessment Assessment being filled - * @param stdClass $data Raw data as returned by the assessment form - * @return float|null Percentual grade for submission as suggested by the peer - */ - public function save_assessment(stdClass $assessment, stdClass $data) { - global $DB; - - if ($grade >= 0) { - return $data->grade / 100; - } else { - return 0; - } - } - -}