diff --git a/mod/workshop/db/install.xml b/mod/workshop/db/install.xml index e570e0e128a..6a323986064 100644 --- a/mod/workshop/db/install.xml +++ b/mod/workshop/db/install.xml @@ -1,5 +1,5 @@ - @@ -9,11 +9,11 @@ - + - + - + @@ -32,7 +32,8 @@ - + + @@ -48,14 +49,14 @@ - + - + @@ -80,9 +81,9 @@ - + - + @@ -99,7 +100,7 @@ - + diff --git a/mod/workshop/db/upgrade.php b/mod/workshop/db/upgrade.php index dd9fb9e514c..6fc5d8db064 100644 --- a/mod/workshop/db/upgrade.php +++ b/mod/workshop/db/upgrade.php @@ -18,8 +18,8 @@ /** * Keeps track of upgrades to the workshop module * - * @package mod - * @subpackage workshop + * @package mod_workshop + * @category upgrade * @copyright 2009 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -38,9 +38,17 @@ function xmldb_workshop_upgrade($oldversion) { $dbman = $DB->get_manager(); - // Moodle v2.2.0 release upgrade line - // Put any upgrade step following this + + if ($oldversion < 2012033100) { + // add the field 'phaseswitchassessment' to the 'workshop' table + $table = new xmldb_table('workshop'); + $field = new xmldb_field('phaseswitchassessment', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'assessmentend'); + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + upgrade_mod_savepoint(true, 2012033100, 'workshop'); + } return true; } diff --git a/mod/workshop/lang/en/workshop.php b/mod/workshop/lang/en/workshop.php index 84bf166447d..57c8f6f5199 100644 --- a/mod/workshop/lang/en/workshop.php +++ b/mod/workshop/lang/en/workshop.php @@ -211,6 +211,10 @@ $string['submissioncontent'] = 'Submission content'; $string['submissionend'] = 'Submissions deadline'; $string['submissionendbeforestart'] = 'Submissions deadline can not be specified before the open for submissions date'; $string['submissionenddatetime'] = 'Submissions deadline: {$a->daydatetime} ({$a->distanceday})'; +$string['submissionendswitch'] = 'Switch to the next phase after the submissions deadline'; +$string['submissionendswitch_help'] = 'If the submissions deadline is specified and this box is checked, the workshop will automatically switch to the assessment phase after the submissions deadline. + +If you enable this feature, it is recommended to set up the scheduled allocation method, too. If the submissions are not allocated, no assessment can be done even if the workshop itself is in the assessment phase.'; $string['submissiongrade'] = 'Grade for submission'; $string['submissiongrade_help'] = 'This setting specifies the maximum grade that may be obtained for submitted work.'; $string['submissiongradeof'] = 'Grade for submission (of {$a})'; diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index c12c7f5c55b..5b5ebe245a5 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -70,14 +70,15 @@ function workshop_add_instance(stdclass $workshop) { global $CFG, $DB; require_once(dirname(__FILE__) . '/locallib.php'); - $workshop->phase = workshop::PHASE_SETUP; - $workshop->timecreated = time(); - $workshop->timemodified = $workshop->timecreated; - $workshop->useexamples = (int)!empty($workshop->useexamples); // unticked checkbox hack - $workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); // unticked checkbox hack - $workshop->useselfassessment = (int)!empty($workshop->useselfassessment); // unticked checkbox hack - $workshop->latesubmissions = (int)!empty($workshop->latesubmissions); // unticked checkbox hack - $workshop->evaluation = 'best'; + $workshop->phase = workshop::PHASE_SETUP; + $workshop->timecreated = time(); + $workshop->timemodified = $workshop->timecreated; + $workshop->useexamples = (int)!empty($workshop->useexamples); + $workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); + $workshop->useselfassessment = (int)!empty($workshop->useselfassessment); + $workshop->latesubmissions = (int)!empty($workshop->latesubmissions); + $workshop->phaseswitchassessment = (int)!empty($workshop->phaseswitchassessment); + $workshop->evaluation = 'best'; // insert the new record so we get the id $workshop->id = $DB->insert_record('workshop', $workshop); @@ -122,13 +123,14 @@ function workshop_update_instance(stdclass $workshop) { global $CFG, $DB; require_once(dirname(__FILE__) . '/locallib.php'); - $workshop->timemodified = time(); - $workshop->id = $workshop->instance; - $workshop->useexamples = (int)!empty($workshop->useexamples); // unticked checkbox hack - $workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); // unticked checkbox hack - $workshop->useselfassessment = (int)!empty($workshop->useselfassessment); // unticked checkbox hack - $workshop->latesubmissions = (int)!empty($workshop->latesubmissions); // unticked checkbox hack - $workshop->evaluation = 'best'; + $workshop->timemodified = time(); + $workshop->id = $workshop->instance; + $workshop->useexamples = (int)!empty($workshop->useexamples); + $workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); + $workshop->useselfassessment = (int)!empty($workshop->useselfassessment); + $workshop->latesubmissions = (int)!empty($workshop->latesubmissions); + $workshop->phaseswitchassessment = (int)!empty($workshop->phaseswitchassessment); + $workshop->evaluation = 'best'; // todo - if the grading strategy is being changed, we must replace all aggregated peer grades with nulls // todo - if maximum grades are being changed, we should probably recalculate or invalidate them diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index ca59e77a752..dd1aa2b2ecc 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -146,6 +146,9 @@ class workshop { /** @var int if greater than 0 then the peer assessment is not allowed after this timestamp */ public $assessmentend; + /** @var bool automatically switch to the assessment phase after the submissions deadline */ + public $phaseswitchassessment; + /** * @var workshop_strategy grading strategy instance * Do not use directly, get the instance using {@link workshop::grading_strategy_instance()} diff --git a/mod/workshop/mod_form.php b/mod/workshop/mod_form.php index 078efe4a7d7..a58c36b9688 100644 --- a/mod/workshop/mod_form.php +++ b/mod/workshop/mod_form.php @@ -183,6 +183,12 @@ class mod_workshop_mod_form extends moodleform_mod { $mform->addElement('date_time_selector', 'submissionend', $label, array('optional' => true)); $mform->setAdvanced('submissionend'); + $label = get_string('submissionendswitch', 'mod_workshop'); + $mform->addElement('checkbox', 'phaseswitchassessment', $label); + $mform->setAdvanced('phaseswitchassessment'); + $mform->disabledIf('phaseswitchassessment', 'submissionend[enabled]'); + $mform->addHelpButton('phaseswitchassessment', 'submissionendswitch', 'mod_workshop'); + $label = get_string('assessmentstart', 'workshop'); $mform->addElement('date_time_selector', 'assessmentstart', $label, array('optional' => true)); $mform->setAdvanced('assessmentstart'); diff --git a/mod/workshop/version.php b/mod/workshop/version.php index 18762e8fb48..8d899559c26 100644 --- a/mod/workshop/version.php +++ b/mod/workshop/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2012032900; // the current module version (YYYYMMDDXX) +$module->version = 2012033100; // the current module version (YYYYMMDDXX) $module->requires = 2012032300; // requires this Moodle version $module->component = 'mod_workshop'; // full name of the plugin (used for diagnostics) $module->cron = 60; // give as a chance every minute