Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
b74d0f84
Commit
b74d0f84
authored
Feb 04, 2016
by
David Monllaó
Committed by
Eloy Lafuente
Mar 07, 2016
Browse files
MDL-52378 singleview: Using is_disabled instead of is_locked
parent
71beedee
Changes
4
Hide whitespace changes
Inline
Side-by-side
grade/report/singleview/classes/local/screen/screen.php
View file @
b74d0f84
...
...
@@ -329,7 +329,7 @@ abstract class screen {
continue
;
}
// If the user submits Exclude grade elements without the proper
// If the user submits Exclude grade elements without the proper
.
// permissions then we should refuse to update.
if
(
$matches
[
1
]
===
'exclude'
&&
!
has_capability
(
'moodle/grade:manage'
,
$this
->
context
)){
$warnings
[]
=
get_string
(
'nopermissions'
,
'error'
,
get_string
(
'grade:manage'
,
'role'
));
...
...
grade/report/singleview/classes/local/screen/tablelike.php
View file @
b74d0f84
...
...
@@ -144,7 +144,7 @@ abstract class tablelike extends screen {
// Singleview users without proper permissions should be presented
// disabled checkboxes for the Exclude grade attribute.
if
(
$field
==
'exclude'
&&
!
has_capability
(
'moodle/grade:manage'
,
$this
->
context
)){
$html
->
locked
=
TRUE
;
$html
->
disabled
=
true
;
}
$line
[]
=
$html
;
...
...
grade/report/singleview/classes/local/ui/exclude.php
View file @
b74d0f84
...
...
@@ -35,13 +35,13 @@ use grade_grade;
* @copyright 2014 Moodle Pty Ltd (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
exclude
extends
grade_attribute_format
implements
be_checked
{
class
exclude
extends
grade_attribute_format
implements
be_checked
,
be_disabled
{
/** @var string $name The name of the input */
public
$name
=
'exclude'
;
/** @var bool $
lock
ed Is the
input lock
ed? */
public
$
locked
=
FALSE
;
/** @var bool $
disabl
ed Is the
checkbox disabl
ed? */
public
$
disabled
=
false
;
/**
* Is it checked?
...
...
@@ -53,12 +53,12 @@ class exclude extends grade_attribute_format implements be_checked {
}
/**
* Is it
lock
ed?
* Is it
disabl
ed?
*
* @return bool
*/
public
function
is_
lock
ed
()
{
return
$this
->
lock
ed
;
public
function
is_
disabl
ed
()
{
return
$this
->
disabl
ed
;
}
/**
...
...
@@ -71,8 +71,7 @@ class exclude extends grade_attribute_format implements be_checked {
$this
->
get_name
(),
$this
->
get_label
(),
$this
->
is_checked
(),
// Call checkbox constructor with locked attribute, expects integer.
$this
->
is_locked
()
?
1
:
0
$this
->
is_disabled
()
);
}
...
...
grade/report/singleview/tests/behat/singleview.feature
View file @
b74d0f84
...
...
@@ -11,6 +11,7 @@ Feature: We can use Single view
And the following "users" exist
:
|
username
|
firstname
|
lastname
|
email
|
idnumber
|
alternatename
|
|
teacher1
|
Teacher
|
1
|
teacher1@example.com
|
t1
|
fred
|
|
teacher2
|
No
edit
|
1
|
teacher2@example.com
|
t2
|
nick
|
|
student1
|
Student
|
1
|
student1@example.com
|
s1
|
james
|
|
student2
|
Student
|
2
|
student1@example.com
|
s2
|
holly
|
|
student3
|
Student
|
3
|
student1@example.com
|
s3
|
anna
|
...
...
@@ -27,6 +28,7 @@ Feature: We can use Single view
And the following "course enrolments" exist
:
|
user
|
course
|
role
|
|
teacher1
|
C1
|
editingteacher
|
|
teacher2
|
C1
|
teacher
|
|
student1
|
C1
|
student
|
|
student2
|
C1
|
student
|
|
student3
|
C1
|
student
|
...
...
@@ -44,6 +46,10 @@ Feature: We can use Single view
And the following "grade items" exist
:
|
itemname
|
course
|
gradetype
|
|
Test
grade
item
|
C1
|
Scale
|
And the following "permission overrides" exist
:
|
capability
|
permission
|
role
|
contextlevel
|
reference
|
|
moodle/grade:edit
|
Allow
|
teacher
|
Course
|
C1
|
|
gradereport/singleview:view
|
Allow
|
teacher
|
Course
|
C1
|
And
I log in as
"teacher1"
And
I follow
"Course 1"
And
I follow
"Grades"
...
...
@@ -89,6 +95,14 @@ Feature: We can use Single view
And the following should exist in the "generaltable" table
:
|
First
name
(Alternate
name)
Surname
|
Grade
|
|
james
(Student)
1
|
Very
good
|
And
I log out
And
I log in as
"teacher2"
And
I follow
"Course 1"
And
I navigate to
"Grades"
node in
"Course administration"
And
I click on
"Single view"
"option"
And
I click on
"Student 4"
"option"
And
the
"Exclude for Test assignment one"
"checkbox"
should be disabled
And
the
"Override for Test assignment one"
"checkbox"
should be enabled
Scenario
:
Single view links work on grade report.
Given
I follow
"Single view for Test assignment one"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment