Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Moodle Qtype Moopt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
Moodle Qtype Moopt
Commits
f359ecf6
Commit
f359ecf6
authored
2 years ago
by
Isabel Uffinger
Browse files
Options
Downloads
Patches
Plain Diff
Colorized file attachements for teachers
parent
235c5199
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/output/renderer.php
+52
-34
52 additions, 34 deletions
classes/output/renderer.php
styles.css
+2
-2
2 additions, 2 deletions
styles.css
with
54 additions
and
36 deletions
classes/output/renderer.php
+
52
−
34
View file @
f359ecf6
...
...
@@ -180,7 +180,7 @@ class qtype_moopt_renderer extends qtype_renderer {
global
$PAGE
;
$o
=
'<br>'
;
$o
.
=
$this
->
output
->
heading
(
get_string
(
'gradingscheme'
,
'qtype_moopt'
),
3
);
#
$o
.
=
$this
->
output
->
heading
(
get_string
(
'gradingscheme'
,
'qtype_moopt'
),
3
);
$blockid
=
"moopt-gradingscheme-"
.
$qa
->
get_usage_id
()
.
"-"
.
$qa
->
get_slot
();
$PAGE
->
requires
->
js_call_amd
(
'qtype_moopt/toggle_all_grading_scheme_buttons'
,
'init'
,
[
$blockid
]);
...
...
@@ -215,27 +215,45 @@ class qtype_moopt_renderer extends qtype_renderer {
private
function
render_downloadable_files
(
question_attempt
$qa
,
question_display_options
$options
)
{
global
$DB
;
$question
=
$qa
->
get_question
();
$questionid
=
$question
->
id
;
$o
=
''
;
$isteacher
=
has_capability
(
'mod/quiz:grade'
,
$options
->
context
);
$studentfiles
=
$DB
->
get_records
(
'qtype_moopt_files'
,
array
(
'questionid'
=>
$questionid
,
'visibletostudents'
=>
'yes'
,
'usagebylms'
=>
'download'
));
if
(
count
(
$studentfiles
)
!=
0
)
{
$o
.
=
$this
->
render_downloadable_files_only
(
$qa
,
$options
,
$studentfiles
,
'providedfiles'
);
}
if
(
$isteacher
){
$teacherfiles
=
$DB
->
get_records
(
'qtype_moopt_files'
,
array
(
'questionid'
=>
$questionid
,
'visibletostudents'
=>
'no'
));
if
(
count
(
$teacherfiles
)
!=
0
)
{
$o
.
=
$this
->
render_downloadable_files_only
(
$qa
,
$options
,
$teacherfiles
,
'providedfilesteacher'
);
}
}
return
$o
;
}
private
function
render_downloadable_files_only
(
question_attempt
$qa
,
question_display_options
$options
,
$files
,
$divclass
)
{
$question
=
$qa
->
get_question
();
$qubaid
=
$qa
->
get_usage_id
();
$slot
=
$qa
->
get_slot
();
$questionid
=
$question
->
id
;
$o
=
''
;
$isteacher
=
has_capability
(
'mod/quiz:grade'
,
$options
->
context
);
$o
=
''
;
$files
=
$DB
->
get_records
(
'qtype_moopt_files'
,
array
(
'questionid'
=>
$questionid
));
$anythingtodisplay
=
false
;
if
(
count
(
$files
)
!=
0
)
{
// TODO: this check should happen before these render methods are called
$downloadurls
=
''
;
$downloadurls
.
=
$this
->
output
->
heading
(
get_string
(
'providedfiles'
,
'qtype_moopt'
),
3
);
$downloadurls
.
=
html_writer
::
start_div
(
'providedfiles'
);
if
(
!
$isteacher
)
{
$o
.
=
$this
->
output
->
heading
(
get_string
(
'providedfiles'
,
'qtype_moopt'
),
3
);
}
$downloadurls
.
=
html_writer
::
start_div
(
$divclass
);
$downloadurls
.
=
'<ul>'
;
foreach
(
$files
as
$file
)
{
// skip files that are
// - not configured to be downloadable (usagebylms)
// - not visible to students
if
(
$file
->
usagebylms
==
'display'
||
(
$file
->
visibletostudents
==
'no'
&&
!
$isteacher
)
||
(
$file
->
usagebylms
==
'edit'
&&
!
$isteacher
))
{
if
(
$file
->
usagebylms
==
'display'
)
{
continue
;
}
...
...
@@ -253,12 +271,12 @@ class qtype_moopt_renderer extends qtype_renderer {
$downloadurls
.
=
'<li><a href="'
.
$url
.
'">'
.
$linkdisplay
.
'</a></li>'
;
}
$downloadurls
.
=
'</ul>'
;
$downloadurls
.
=
html_writer
::
end_div
(
'providedfiles'
);
$downloadurls
.
=
html_writer
::
end_div
(
$divclass
);
if
(
$anythingtodisplay
)
{
$o
.
=
$downloadurls
;
}
}
return
$o
;
}
...
...
This diff is collapsed.
Click to expand it.
styles.css
+
2
−
2
View file @
f359ecf6
...
...
@@ -73,7 +73,7 @@ p.expandcollapselink a {
margin-left
:
10px
;
}
.providedfiles
{
.providedfiles
,
.providedfilesteacher
{
margin-left
:
10px
;
}
...
...
@@ -90,7 +90,7 @@ p.expandcollapselink a {
100%
{
transform
:
rotate
(
360deg
);
}
}
.internaldescription
,
.gradingscheme
{
.internaldescription
,
.gradingscheme
,
.providedfilesteacher
{
background-color
:
#73afdc
;
margin-top
:
10px
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment