Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
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_stack
Commits
937c0aec
Commit
937c0aec
authored
11 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Use the method correct_response from render.php.
parent
cbea8642
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
question.php
+17
-16
17 additions, 16 deletions
question.php
renderer.php
+5
-0
5 additions, 0 deletions
renderer.php
with
22 additions
and
16 deletions
question.php
+
17
−
16
View file @
937c0aec
...
@@ -365,34 +365,35 @@ class qtype_stack_question extends question_graded_automatically_with_countback
...
@@ -365,34 +365,35 @@ class qtype_stack_question extends question_graded_automatically_with_countback
}
}
public
function
format_generalfeedback
(
$qa
)
{
public
function
format_generalfeedback
(
$qa
)
{
if
(
empty
(
$this
->
generalfeedback
))
{
return
''
;
}
$gftext
=
new
stack_cas_text
(
$this
->
generalfeedback
,
$this
->
session
,
$this
->
seed
,
't'
,
false
,
true
);
if
(
$gftext
->
get_errors
())
{
throw
new
stack_exception
(
'Error rendering the general feedback text: '
.
$gftext
->
get_errors
());
}
return
$this
->
format_text
(
stack_maths
::
process_display_castext
(
$gftext
->
get_display_castext
()),
$this
->
generalfeedbackformat
,
$qa
,
'question'
,
'generalfeedback'
,
$this
->
id
);
}
$feedback
=
'<hr>'
;
public
function
format_correct_response
(
$qa
)
{
// We need to make sure the inputs are displayed in the order in which they
// We need to make sure the inputs are displayed in the order in which they
// occur in the question text. This is not necessarily the order in which they
// occur in the question text. This is not necessarily the order in which they
// are listed in the array $this->inputs
// are listed in the array $this->inputs
$feedback
=
''
;
$inputs
=
stack_utils
::
extract_placeholders
(
$this
->
questiontextinstantiated
,
'input'
);
$inputs
=
stack_utils
::
extract_placeholders
(
$this
->
questiontextinstantiated
,
'input'
);
foreach
(
$inputs
as
$name
)
{
foreach
(
$inputs
as
$name
)
{
$input
=
$this
->
inputs
[
$name
];
$input
=
$this
->
inputs
[
$name
];
$feedback
.
=
html_writer
::
tag
(
'p'
,
$input
->
get_teacher_answer_display
(
$this
->
session
->
get_value_key
(
$name
),
$this
->
session
->
get_display_key
(
$name
)));
$feedback
.
=
html_writer
::
tag
(
'p'
,
$input
->
get_teacher_answer_display
(
$this
->
session
->
get_value_key
(
$name
),
$this
->
session
->
get_display_key
(
$name
)));
}
}
if
(
empty
(
$this
->
generalfeedback
))
{
return
$feedback
;
return
$feedback
;
}
}
$feedback
.
=
'<hr/>'
;
$gftext
=
new
stack_cas_text
(
$this
->
generalfeedback
,
$this
->
session
,
$this
->
seed
,
't'
,
false
,
true
);
if
(
$gftext
->
get_errors
())
{
throw
new
stack_exception
(
'Error rendering the general feedback text: '
.
$gftext
->
get_errors
());
}
return
$this
->
format_text
(
stack_maths
::
process_display_castext
(
$feedback
.
$gftext
->
get_display_castext
()),
$this
->
generalfeedbackformat
,
$qa
,
'question'
,
'generalfeedback'
,
$this
->
id
);
}
public
function
get_expected_data
()
{
public
function
get_expected_data
()
{
$expected
=
array
();
$expected
=
array
();
foreach
(
$this
->
inputs
as
$input
)
{
foreach
(
$this
->
inputs
as
$input
)
{
...
...
This diff is collapsed.
Click to expand it.
renderer.php
+
5
−
0
View file @
937c0aec
...
@@ -430,4 +430,9 @@ class qtype_stack_renderer extends qtype_renderer {
...
@@ -430,4 +430,9 @@ class qtype_stack_renderer extends qtype_renderer {
$result
=
new
stack_potentialresponse_tree_state
(
1
,
true
,
$fraction
);
$result
=
new
stack_potentialresponse_tree_state
(
1
,
true
,
$fraction
);
return
$this
->
standard_prt_feedback
(
$qa
,
$qa
->
get_question
(),
$result
);
return
$this
->
standard_prt_feedback
(
$qa
,
$qa
->
get_question
(),
$result
);
}
}
public
function
correct_response
(
question_attempt
$qa
)
{
$question
=
$qa
->
get_question
();
return
'<hr />'
.
$question
->
format_correct_response
(
$qa
);
}
}
}
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