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
f6336eff
Commit
f6336eff
authored
9 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Implement Gustav's suggestion in issue #78.
parent
83c242d5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
questiontestrun.php
+77
-77
77 additions, 77 deletions
questiontestrun.php
with
77 additions
and
77 deletions
questiontestrun.php
+
77
−
77
View file @
f6336eff
...
...
@@ -218,53 +218,6 @@ if ($question->has_random_variants()) {
}
}
// Display the question.
$renderer
=
$PAGE
->
get_renderer
(
'qtype_stack'
);
echo
$OUTPUT
->
heading
(
stack_string
(
'questionpreview'
),
3
);
echo
$quba
->
render_question
(
$slot
,
$options
);
// Display the question note.
echo
$OUTPUT
->
heading
(
stack_string
(
'questionnote'
),
3
);
echo
html_writer
::
tag
(
'p'
,
stack_ouput_castext
(
$question
->
get_question_summary
()),
array
(
'class'
=>
'questionnote'
));
// Display the question variables.
echo
$OUTPUT
->
heading
(
stack_string
(
'questionvariablevalues'
),
3
);
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'questionvariables'
));
$displayqvs
=
''
;
foreach
(
$question
->
get_question_var_values
()
as
$key
=>
$value
)
{
$displayqvs
.
=
s
(
$key
)
.
' : '
.
s
(
$value
)
.
";
\n
"
;
}
echo
html_writer
::
tag
(
'pre'
,
$displayqvs
);
echo
html_writer
::
end_tag
(
'div'
);
// Display the general feedback, aka "Worked solution".
$qa
=
new
question_attempt
(
$question
,
0
);
echo
$OUTPUT
->
heading
(
stack_string
(
'generalfeedback'
),
3
);
echo
html_writer
::
tag
(
'div'
,
html_writer
::
tag
(
'div'
,
$renderer
->
general_feedback
(
$qa
),
array
(
'class'
=>
'outcome generalfeedback'
)),
array
(
'class'
=>
'que'
));
// Add a link to the cas chat to facilitate editing the general feedback.
if
(
$question
->
options
->
get_option
(
'simplify'
))
{
$simp
=
'on'
;
}
else
{
$simp
=
''
;
}
$questionvarsinputs
=
$question
->
questionvariables
;
foreach
(
$question
->
get_correct_response
()
as
$key
=>
$val
)
{
if
(
substr
(
$key
,
-
4
,
4
)
!==
'_val'
)
{
$questionvarsinputs
.
=
"
\n
{
$key
}
:
{
$val
}
;"
;
}
}
$chatparams
=
$urlparams
;
$chatparams
[
'vars'
]
=
$questionvarsinputs
;
$chatparams
[
'simp'
]
=
$simp
;
$chatparams
[
'cas'
]
=
$question
->
generalfeedback
;
// We've chosen not to send a specific seed since it is helpful
// to test the general feedback in a random context.
echo
$OUTPUT
->
single_button
(
new
moodle_url
(
'/question/type/stack/caschat.php'
,
$chatparams
),
stack_string
(
'chat'
));
// Display the controls to add another question test.
echo
$OUTPUT
->
heading
(
stack_string
(
'questiontests'
),
2
);
...
...
@@ -386,5 +339,52 @@ foreach ($testresults as $key => $result) {
}
}
// Display the question.
$renderer
=
$PAGE
->
get_renderer
(
'qtype_stack'
);
echo
$OUTPUT
->
heading
(
stack_string
(
'questionpreview'
),
3
);
echo
$quba
->
render_question
(
$slot
,
$options
);
// Display the question note.
echo
$OUTPUT
->
heading
(
stack_string
(
'questionnote'
),
3
);
echo
html_writer
::
tag
(
'p'
,
stack_ouput_castext
(
$question
->
get_question_summary
()),
array
(
'class'
=>
'questionnote'
));
// Display the question variables.
echo
$OUTPUT
->
heading
(
stack_string
(
'questionvariablevalues'
),
3
);
echo
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'questionvariables'
));
$displayqvs
=
''
;
foreach
(
$question
->
get_question_var_values
()
as
$key
=>
$value
)
{
$displayqvs
.
=
s
(
$key
)
.
' : '
.
s
(
$value
)
.
";
\n
"
;
}
echo
html_writer
::
tag
(
'pre'
,
$displayqvs
);
echo
html_writer
::
end_tag
(
'div'
);
// Display the general feedback, aka "Worked solution".
$qa
=
new
question_attempt
(
$question
,
0
);
echo
$OUTPUT
->
heading
(
stack_string
(
'generalfeedback'
),
3
);
echo
html_writer
::
tag
(
'div'
,
html_writer
::
tag
(
'div'
,
$renderer
->
general_feedback
(
$qa
),
array
(
'class'
=>
'outcome generalfeedback'
)),
array
(
'class'
=>
'que'
));
// Add a link to the cas chat to facilitate editing the general feedback.
if
(
$question
->
options
->
get_option
(
'simplify'
))
{
$simp
=
'on'
;
}
else
{
$simp
=
''
;
}
$questionvarsinputs
=
$question
->
questionvariables
;
foreach
(
$question
->
get_correct_response
()
as
$key
=>
$val
)
{
if
(
substr
(
$key
,
-
4
,
4
)
!==
'_val'
)
{
$questionvarsinputs
.
=
"
\n
{
$key
}
:
{
$val
}
;"
;
}
}
$chatparams
=
$urlparams
;
$chatparams
[
'vars'
]
=
$questionvarsinputs
;
$chatparams
[
'simp'
]
=
$simp
;
$chatparams
[
'cas'
]
=
$question
->
generalfeedback
;
// We've chosen not to send a specific seed since it is helpful
// to test the general feedback in a random context.
echo
$OUTPUT
->
single_button
(
new
moodle_url
(
'/question/type/stack/caschat.php'
,
$chatparams
),
stack_string
(
'chat'
));
// Finish output.
echo
$OUTPUT
->
footer
();
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