mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-43245 Lesson: non editing teacher cannot grade lesson essay
This commit is contained in:
parent
e739fbcf27
commit
5fc6a9e77b
@ -52,6 +52,18 @@ $capabilities = array(
|
||||
)
|
||||
),
|
||||
|
||||
// Grade essay questions.
|
||||
'mod/lesson:grade' => array(
|
||||
'riskbitmask' => RISK_SPAM,
|
||||
'captype' => 'write',
|
||||
'contextlevel' => CONTEXT_MODULE,
|
||||
'archetypes' => array(
|
||||
'teacher' => CAP_ALLOW,
|
||||
'editingteacher' => CAP_ALLOW,
|
||||
'manager' => CAP_ALLOW
|
||||
)
|
||||
),
|
||||
|
||||
'mod/lesson:manage' => array(
|
||||
|
||||
'captype' => 'write',
|
||||
|
@ -38,7 +38,7 @@ $lesson = new lesson($dblesson);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$context = context_module::instance($cm->id);
|
||||
require_capability('mod/lesson:edit', $context);
|
||||
require_capability('mod/lesson:grade', $context);
|
||||
|
||||
$url = new moodle_url('/mod/lesson/essay.php', array('id'=>$id));
|
||||
if ($mode !== 'display') {
|
||||
|
@ -773,12 +773,10 @@ function lesson_supports($feature) {
|
||||
function lesson_extend_settings_navigation($settings, $lessonnode) {
|
||||
global $PAGE, $DB;
|
||||
|
||||
$canedit = has_capability('mod/lesson:edit', $PAGE->cm->context);
|
||||
|
||||
$url = new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id));
|
||||
$lessonnode->add(get_string('preview', 'lesson'), $url);
|
||||
|
||||
if ($canedit) {
|
||||
if (has_capability('mod/lesson:edit', $PAGE->cm->context)) {
|
||||
$url = new moodle_url('/mod/lesson/edit.php', array('id'=>$PAGE->cm->id));
|
||||
$lessonnode->add(get_string('edit', 'lesson'), $url);
|
||||
}
|
||||
@ -791,7 +789,7 @@ function lesson_extend_settings_navigation($settings, $lessonnode) {
|
||||
$reportsnode->add(get_string('detailedstats', 'lesson'), $url);
|
||||
}
|
||||
|
||||
if ($canedit) {
|
||||
if (has_capability('mod/lesson:grade', $PAGE->cm->context)) {
|
||||
$url = new moodle_url('/mod/lesson/essay.php', array('id'=>$PAGE->cm->id));
|
||||
$lessonnode->add(get_string('manualgrading', 'lesson'), $url);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ $attemptscount = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->
|
||||
$row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
|
||||
$row[] = new tabobject('edit', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('edit', 'lesson'), get_string('edita', 'moodle', format_string($lesson->name)));
|
||||
$row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports2', 'lesson', $attemptscount));
|
||||
if (has_capability('mod/lesson:edit', $context)) {
|
||||
if (has_capability('mod/lesson:grade', $context)) {
|
||||
$row[] = new tabobject('essay', "$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id", get_string('manualgrading', 'lesson'));
|
||||
}
|
||||
if ($lesson->highscores) {
|
||||
|
57
mod/lesson/tests/behat/teacher_grade_essays.feature
Normal file
57
mod/lesson/tests/behat/teacher_grade_essays.feature
Normal file
@ -0,0 +1,57 @@
|
||||
@mod @mod_lesson
|
||||
Feature: In a lesson activity, a non editing teacher can grade essay questions
|
||||
As a non editing teacher
|
||||
I need to grade student answers to essay questions in lesson
|
||||
|
||||
@javascript
|
||||
Scenario: non editing teacher grade essay questions
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher2 | Teacher | 2 | teacher2@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| teacher2 | C1 | teacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on homepage
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add a "Lesson" to section "1" and I fill the form with:
|
||||
| Name | Test lesson name |
|
||||
| Description | Test lesson description |
|
||||
And I follow "Test lesson name"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Essay"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Essay question |
|
||||
| Page contents | <p>Please write a story about a frog.</p> |
|
||||
And I press "Save page"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson name"
|
||||
And I set the field "Your answer" to "<p>Once upon a time there was a little green frog."
|
||||
And I press "Submit"
|
||||
And I log out
|
||||
When I log in as "teacher2"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson name"
|
||||
Then I should see "Grade essays"
|
||||
And I follow "Grade essays"
|
||||
And I should see "Student 1"
|
||||
And I should see "Essay question"
|
||||
And I follow "Essay question"
|
||||
And I should see "Student 1's response"
|
||||
And I should see "Once upon a time there was a little green frog."
|
||||
And I set the following fields to these values:
|
||||
| Your comments | Well done. |
|
||||
| Essay score | 1 |
|
||||
And I press "Save changes"
|
||||
And I should see "Changes saved"
|
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014100600; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2014101600; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014050800; // Requires this Moodle version
|
||||
$plugin->component = 'mod_lesson'; // Full name of the plugin (used for diagnostics)
|
||||
$plugin->cron = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user