Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
c2c934b6
Commit
c2c934b6
authored
Sep 20, 2019
by
Robert Lyon
Committed by
Gerrit Code Review
Sep 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1836653: Allow LTI submissions to be revoked"
parents
e99f16f2
17e7e95f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
3 deletions
+86
-3
htdocs/module/lti/lang/en.utf8/module.lti.php
htdocs/module/lti/lang/en.utf8/module.lti.php
+2
-1
htdocs/module/lti/lib.php
htdocs/module/lti/lib.php
+78
-1
htdocs/module/lti/submission.php
htdocs/module/lti/submission.php
+2
-0
htdocs/theme/raw/plugintype/module/lti/templates/submittedforgrading.tpl
...w/plugintype/module/lti/templates/submittedforgrading.tpl
+4
-1
No files found.
htdocs/module/lti/lang/en.utf8/module.lti.php
View file @
c2c934b6
...
...
@@ -43,10 +43,11 @@ $string['notconfigured'] = 'Currently, this activity does not allow submissions.
$string
[
'notreadylabel'
]
=
'Not ready'
;
$string
[
'oauthprotocolenabled'
]
=
'OAuth protocol enabled'
;
$string
[
'parentauthforlti'
]
=
'Parent authority'
;
$string
[
'portfoliosubmitted'
]
=
'You submitted the portfolio "
%s
" for assessment on %s.'
;
$string
[
'portfoliosubmitted
forgrading
'
]
=
'You submitted the portfolio "
<strong><a href="%s">%s</a></strong>
" for assessment on %s.'
;
$string
[
'portfoliosubmittedheader'
]
=
'Portfolio Submitted'
;
$string
[
'readylabel'
]
=
'Ready'
;
$string
[
'restprotocolenabled'
]
=
'REST protocol enabled'
;
$string
[
'revokesubmission'
]
=
'Revoke submission'
;
$string
[
'usernameexists2'
]
=
'Username "%s" is not valid.'
;
$string
[
'saveandrelease'
]
=
'Save and allow submissions'
;
$string
[
'submitportfolio'
]
=
'Submit a portfolio for assessment'
;
...
...
htdocs/module/lti/lib.php
View file @
c2c934b6
...
...
@@ -436,7 +436,7 @@ class PluginModuleLti extends PluginModule {
'text1'
=>
array
(
'type'
=>
'html'
,
'class'
=>
'text-inline'
,
'value'
=>
get_string
(
'submitto'
,
'module.lti'
,
$assessment
->
resourcelinktitle
,
$assessment
->
contexttitle
),
'value'
=>
get_string
(
'submitto'
,
'module.lti'
,
$assessment
->
resourcelinktitle
,
$assessment
->
contexttitle
)
.
' '
,
),
'inputgroup'
=>
array
(
'type'
=>
'fieldset'
,
...
...
@@ -706,6 +706,83 @@ class PluginModuleLti extends PluginModule {
redirect
(
'/module/lti/submission.php'
);
}
public
static
function
can_revokesubmission
()
{
global
$SESSION
,
$USER
;
if
(
empty
(
$SESSION
->
get
(
'lti.assessment'
)))
{
return
false
;
}
if
(
!
$sub
=
new
ModuleLtiSubmission
(
$SESSION
->
get
(
'lti.assessment'
),
$USER
->
get
(
'id'
)))
{
return
false
;
}
if
(
!
$sub
->
is_submitted
())
{
return
false
;
}
// If the assessment has been graded it can't be unsubmitted as
// the portfolio has either already been released or the submission option is locked
if
(
$sub
->
grade
)
{
return
false
;
}
return
$sub
;
}
public
static
function
revokesubmission_form
()
{
if
(
!
$sub
=
self
::
can_revokesubmission
())
{
return
false
;
}
$form
=
array
(
'name'
=>
'revokesubmission'
,
'successcallback'
=>
'PluginModuleLti::revokesubmission_submit'
,
'method'
=>
'post'
,
'action'
=>
''
,
'plugintype'
=>
'module'
,
'pluginname'
=>
'lti'
,
'elements'
=>
array
(
'id'
=>
array
(
'type'
=>
'hidden'
,
'value'
=>
$sub
->
id
,
),
'submit'
=>
array
(
'type'
=>
'submit'
,
'value'
=>
get_string
(
'revokesubmission'
,
'module.lti'
),
'class'
=>
'btn btn-primary'
,
)
),
);
return
(
pieform
(
$form
));
}
public
function
revokesubmission_submit
(
Pieform
$form
,
$values
)
{
global
$USER
;
if
(
!
$sub
=
self
::
can_revokesubmission
())
{
return
false
;
}
// Archive/Unlock if required by settings
if
(
!
empty
(
$sub
->
collectionid
))
{
$portfolio
=
new
Collection
(
$sub
->
collectionid
);
}
if
(
!
empty
(
$sub
->
viewid
))
{
$portfolio
=
new
View
(
$sub
->
viewid
);
}
$portfolio
->
release
(
$USER
);
delete_records
(
'lti_assessment_submission'
,
'id'
,
$values
[
'id'
]);
redirect
(
'/module/lti/submission.php'
);
}
}
class
ModuleLtiSubmission
{
...
...
htdocs/module/lti/submission.php
View file @
c2c934b6
...
...
@@ -55,6 +55,7 @@ if (PluginModuleLti::can_grade()) {
else
if
(
PluginModuleLti
::
can_submit_for_grading
())
{
$sub
=
PluginModuleLti
::
get_submission
();
$revokeform
=
PluginModuleLti
::
revokesubmission_form
();
if
(
$sub
&&
$sub
->
is_submitted
())
{
$smarty
->
assign
(
'PAGEHEADING'
,
get_string
(
'portfoliosubmittedheader'
,
'module.lti'
));
...
...
@@ -68,6 +69,7 @@ else if (PluginModuleLti::can_submit_for_grading()) {
$smarty
->
assign
(
'grade'
,
$sub
->
grade
);
$smarty
->
assign
(
'gradedby'
,
empty
(
$grader
)
?
''
:
display_name
(
$grader
));
$smarty
->
assign
(
'timegraded'
,
$sub
->
timegraded
);
$smarty
->
assign
(
'revokeform'
,
$revokeform
);
$smarty
->
display
(
'module:lti:submittedforgrading.tpl'
);
}
...
...
htdocs/theme/raw/plugintype/module/lti/templates/submittedforgrading.tpl
View file @
c2c934b6
{
include
file
=
"header.tpl"
}
<p>
{
str
tag
=
'portfoliosubmitted'
section
=
'module.lti'
arg1
=
$title
arg2
=
$timesubmitted
|
strtotime
|
format_date
}
</p>
<p>
{
str
tag
=
'portfoliosubmittedforgrading'
section
=
'module.lti'
arg1
=
$link
arg2
=
$title
arg3
=
$timesubmitted
|
strtotime
|
format_date
}
</p>
{
$revokeform
|
safe
}
{
if
$timegraded
}
<p>
{
str
tag
=
'gradereceived'
section
=
'module.lti'
arg1
=
$grade
arg2
=
$gradedby
arg3
=
$timegraded
|
strtotime
|
format_date
}
</p>
{/
if
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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