Skip to content

Commit

Permalink
Merge branch 'MDL-38359-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Jun 11, 2013
2 parents e9416eb + 52fdb05 commit 6217bb5
Show file tree
Hide file tree
Showing 21 changed files with 989 additions and 35 deletions.
9 changes: 7 additions & 2 deletions mod/assign/backup/moodle2/backup_assign_stepslib.php
Expand Up @@ -64,7 +64,10 @@ protected function define_structure() {
'blindmarking',
'revealidentities',
'attemptreopenmethod',
'maxattempts'));
'maxattempts',
'markingworkflow',
'markingallocation'));


$userflags = new backup_nested_element('userflags');

Expand All @@ -73,7 +76,9 @@ protected function define_structure() {
'assignment',
'mailed',
'locked',
'extensionduedate'));
'extensionduedate',
'workflowstate',
'allocatedmarker'));

$submissions = new backup_nested_element('submissions');

Expand Down
6 changes: 6 additions & 0 deletions mod/assign/backup/moodle2/restore_assign_stepslib.php
Expand Up @@ -87,6 +87,12 @@ protected function process_assign($data) {
if (!isset($data->cutoffdate)) {
$data->cutoffdate = 0;
}
if (!isset($data->markingworkflow)) {
$data->markingworkflow = 0;
}
if (!isset($data->markingallocation)) {
$data->markingallocation = 0;
}

if (!empty($data->preventlatesubmissions)) {
$data->cutoffdate = $data->duedate;
Expand Down
62 changes: 62 additions & 0 deletions mod/assign/batchsetallocatedmarkerform.php
@@ -0,0 +1,62 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* This file contains the forms to set the allocated marker for selected submissions.
*
* @package mod_assign
* @copyright 2013 Catalyst IT {@link http://www.catalyst.net.nz}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');

require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/mod/assign/feedback/file/locallib.php');

/**
* Set allocated marker form.
*
* @package mod_assign
* @copyright 2013 Catalyst IT {@link http://www.catalyst.net.nz}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_assign_batch_set_allocatedmarker_form extends moodleform {
/**
* Define this form - called by the parent constructor
*/
public function definition() {
$mform = $this->_form;
$params = $this->_customdata;

$mform->addElement('header', 'general', get_string('batchsetallocatedmarker', 'assign', count($params['users'])));
$mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $params['usershtml']);

$options = $params['markers'];
$mform->addElement('select', 'allocatedmarker', get_string('allocatedmarker', 'assign'), $options);

$mform->addElement('hidden', 'id', $params['cm']);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'action', 'setbatchmarkingallocation');
$mform->setType('action', PARAM_ALPHA);
$mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
$mform->setType('selectedusers', PARAM_SEQUENCE);
$this->add_action_buttons(true, get_string('savechanges'));

}

}

62 changes: 62 additions & 0 deletions mod/assign/batchsetmarkingworkflowstateform.php
@@ -0,0 +1,62 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* This file contains the forms to set the marking workflow for selected submissions.
*
* @package mod_assign
* @copyright 2013 Catalyst IT {@link http://www.catalyst.net.nz}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');

require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/mod/assign/feedback/file/locallib.php');

/**
* Set marking workflow form.
*
* @package mod_assign
* @copyright 2013 Catalyst IT {@link http://www.catalyst.net.nz}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_assign_batch_set_marking_workflow_state_form extends moodleform {
/**
* Define this form - called by the parent constructor
*/
public function definition() {
$mform = $this->_form;
$params = $this->_customdata;

$mform->addElement('header', 'general', get_string('batchsetmarkingworkflowstateforusers', 'assign', count($params['users'])));
$mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $params['usershtml']);

$options = $params['markingworkflowstates'];
$mform->addElement('select', 'markingworkflowstate', get_string('markingworkflowstate', 'assign'), $options);

$mform->addElement('hidden', 'id', $params['cm']);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'action', 'setbatchmarkingworkflowstate');
$mform->setType('action', PARAM_ALPHA);
$mform->addElement('hidden', 'selectedusers', implode(',', $params['users']));
$mform->setType('selectedusers', PARAM_SEQUENCE);
$this->add_action_buttons(true, get_string('savechanges'));

}

}

41 changes: 40 additions & 1 deletion mod/assign/db/access.php
Expand Up @@ -103,6 +103,45 @@
),


);
'mod/assign:reviewgrades' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/grade:manage'
),

'mod/assign:releasegrades' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/grade:manage'
),

'mod/assign:managegrades' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/grade:manage'
),

'mod/assign:manageallocations' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/grade:manage'
),

);

6 changes: 5 additions & 1 deletion mod/assign/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/assign/db" VERSION="20130308" COMMENT="XMLDB file for Moodle mod/assign"
<XMLDB PATH="mod/assign/db" VERSION="20130314" COMMENT="XMLDB file for Moodle mod/assign"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand Down Expand Up @@ -30,6 +30,8 @@
<FIELD NAME="revealidentities" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Show identities for a blind marking assignment"/>
<FIELD NAME="attemptreopenmethod" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="none" SEQUENCE="false" COMMENT="How to determine when students are allowed to open a new submission. Valid options are none, manual, untilpass"/>
<FIELD NAME="maxattempts" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="-1" SEQUENCE="false" COMMENT="What is the maximum number of student attempts allowed for this assignment? -1 means unlimited."/>
<FIELD NAME="markingworkflow" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, marking workflow features will be used in this assignment."/>
<FIELD NAME="markingallocation" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="If enabled, marking allocation features will be used in this assignment"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="The unique id for this assignment instance."/>
Expand Down Expand Up @@ -120,6 +122,8 @@
<FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Student cannot make any changes to their submission if this flag is set."/>
<FIELD NAME="mailed" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Has the student been sent a notification about this grade update?"/>
<FIELD NAME="extensionduedate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="An extension date assigned to an individual student."/>
<FIELD NAME="workflowstate" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false" COMMENT="The current workflow state of the grade"/>
<FIELD NAME="allocatedmarker" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The allocated marker to this submission"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
2 changes: 2 additions & 0 deletions mod/assign/db/log.php
Expand Up @@ -32,6 +32,7 @@
array('module'=>'assign', 'action'=>'lock submission', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'reveal identities', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'revert submission to draft', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'set marking workflow state', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'submission statement accepted', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'submit', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'submit for grading', 'mtable'=>'assign', 'field'=>'name'),
Expand All @@ -46,4 +47,5 @@
array('module'=>'assign', 'action'=>'view submission grading table', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'view submit assignment form', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'view feedback', 'mtable'=>'assign', 'field'=>'name'),
array('module'=>'assign', 'action'=>'view batch set marking workflow state', 'mtable'=>'assign', 'field'=>'name'),
);
35 changes: 33 additions & 2 deletions mod/assign/db/upgrade.php
Expand Up @@ -424,8 +424,39 @@ function xmldb_assign_upgrade($oldversion) {
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2013061101) {
// Define field markingworkflow to be added to assign
$table = new xmldb_table('assign');
$field = new xmldb_field('markingworkflow', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'maxattempts');

return true;
}
// Conditionally launch add field markingworkflow
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Define field markingallocation to be added to assign.
$field = new xmldb_field('markingallocation', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'markingworkflow');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Define field workflowstate to be added to assign_grades
$table = new xmldb_table('assign_user_flags');
$field = new xmldb_field('workflowstate', XMLDB_TYPE_CHAR, '20', null, null, null, null, 'extensionduedate');

// Conditionally launch add field workflowstate
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Define field allocatedmarker to be added to assign_grades.
$field = new xmldb_field('allocatedmarker', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'workflowstate');
// Conditionally launch add field workflowstate
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2013061101, 'assign');
}

return true;
}
6 changes: 6 additions & 0 deletions mod/assign/gradingbatchoperationsform.php
Expand Up @@ -64,6 +64,12 @@ public function definition() {
}
}
}
if ($instance['markingworkflow']) {
$options['setmarkingworkflowstate'] = get_string('setmarkingworkflowstate', 'assign');
}
if ($instance['markingallocation']) {
$options['setmarkingallocation'] = get_string('setmarkingallocation', 'assign');
}

$mform->addElement('hidden', 'action', 'gradingbatchoperation');
$mform->setType('action', PARAM_ALPHA);
Expand Down
7 changes: 6 additions & 1 deletion mod/assign/gradingoptionsform.php
Expand Up @@ -54,7 +54,12 @@ public function definition() {
if ($instance['submissionsenabled']) {
$mform->addElement('select', 'filter', get_string('filter', 'assign'), $options, $dirtyclass);
}

if (!empty($instance['markingallocationopt'])) {
$mform->addElement('select', 'markerfilter', get_string('markerfilter', 'assign'), $instance['markingallocationopt'], $dirtyclass);
}
if (!empty($instance['markingworkflowopt'])) {
$mform->addElement('select', 'workflowfilter', get_string('workflowfilter', 'assign'), $instance['markingworkflowopt'], $dirtyclass);
}
// Quickgrading.
if ($instance['showquickgrading']) {
$mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', $dirtyclass);
Expand Down

0 comments on commit 6217bb5

Please sign in to comment.