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
84ee2306
Commit
84ee2306
authored
2 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Use CSS to style question variables, etc. in monospace font.
parent
2b295ffd
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
adminui/caschat.php
+2
-2
2 additions, 2 deletions
adminui/caschat.php
adminui/equivdemo.php
+3
-84
3 additions, 84 deletions
adminui/equivdemo.php
questiontestrun.php
+1
-1
1 addition, 1 deletion
questiontestrun.php
styles.css
+4
-0
4 additions, 0 deletions
styles.css
with
10 additions
and
87 deletions
adminui/caschat.php
+
2
−
2
View file @
84ee2306
...
@@ -65,7 +65,7 @@ $debuginfo = '';
...
@@ -65,7 +65,7 @@ $debuginfo = '';
$errs
=
''
;
$errs
=
''
;
$varerrs
=
array
();
$varerrs
=
array
();
$vars
=
optional_param
(
'vars'
,
''
,
PARAM_RAW
);
$vars
=
optional_param
(
'
maxima
vars'
,
''
,
PARAM_RAW
);
$string
=
optional_param
(
'cas'
,
''
,
PARAM_RAW
);
$string
=
optional_param
(
'cas'
,
''
,
PARAM_RAW
);
$simp
=
optional_param
(
'simp'
,
''
,
PARAM_RAW
);
$simp
=
optional_param
(
'simp'
,
''
,
PARAM_RAW
);
...
@@ -144,7 +144,7 @@ echo html_writer::tag('form',
...
@@ -144,7 +144,7 @@ echo html_writer::tag('form',
html_writer
::
tag
(
'h2'
,
stack_string
(
'questionvariables'
))
.
html_writer
::
tag
(
'h2'
,
stack_string
(
'questionvariables'
))
.
html_writer
::
tag
(
'p'
,
implode
(
$varerrs
))
.
html_writer
::
tag
(
'p'
,
implode
(
$varerrs
))
.
html_writer
::
tag
(
'p'
,
html_writer
::
tag
(
'textarea'
,
$vars
,
html_writer
::
tag
(
'p'
,
html_writer
::
tag
(
'textarea'
,
$vars
,
array
(
'cols'
=>
100
,
'rows'
=>
$varlen
,
'name'
=>
'vars'
)))
.
array
(
'cols'
=>
100
,
'rows'
=>
$varlen
,
'name'
=>
'
maxima
vars'
)))
.
html_writer
::
tag
(
'p'
,
$simp
)
.
html_writer
::
tag
(
'p'
,
$simp
)
.
html_writer
::
tag
(
'h2'
,
stack_string
(
'castext'
))
.
html_writer
::
tag
(
'h2'
,
stack_string
(
'castext'
))
.
html_writer
::
tag
(
'p'
,
$errs
)
.
html_writer
::
tag
(
'p'
,
$errs
)
.
...
...
This diff is collapsed.
Click to expand it.
adminui/equivdemo.php
+
3
−
84
View file @
84ee2306
...
@@ -56,7 +56,7 @@ if (!$questionid) {
...
@@ -56,7 +56,7 @@ if (!$questionid) {
$context
=
context_system
::
instance
();
$context
=
context_system
::
instance
();
$PAGE
->
set_context
(
$context
);
$PAGE
->
set_context
(
$context
);
$PAGE
->
set_url
(
'/question/type/stack/equivdemo.php'
,
$urlparams
);
$PAGE
->
set_url
(
'/question/type/stack/
adminui/
equivdemo.php'
,
$urlparams
);
$title
=
"Equivalence reasoning test cases"
;
$title
=
"Equivalence reasoning test cases"
;
$PAGE
->
set_title
(
$title
);
$PAGE
->
set_title
(
$title
);
...
@@ -231,11 +231,11 @@ foreach ($samplearguments as $argument) {
...
@@ -231,11 +231,11 @@ foreach ($samplearguments as $argument) {
/* Use the real validation code, and also create something which can be pasted into a live input box. */
/* Use the real validation code, and also create something which can be pasted into a live input box. */
if
(
$onlyarg
)
{
if
(
$onlyarg
)
{
$teacheranswer
=
$cs1
->
get_inputform
();
$teacheranswer
=
$cs1
->
get_inputform
();
$input
=
new
stack_equiv_input
(
'
ans1
'
,
$teacheranswer
,
$options
,
array
(
'options'
=>
'comments'
));
$input
=
new
stack_equiv_input
(
'
maximavars
'
,
$teacheranswer
,
$options
,
array
(
'options'
=>
'comments'
));
$response
=
$input
->
get_correct_response
(
$teacheranswer
);
$response
=
$input
->
get_correct_response
(
$teacheranswer
);
$security
=
new
stack_cas_security
();
$security
=
new
stack_cas_security
();
$state
=
$input
->
validate_student_response
(
$response
,
$options
,
$teacheranswer
,
$security
);
$state
=
$input
->
validate_student_response
(
$response
,
$options
,
$teacheranswer
,
$security
);
echo
$input
->
render
(
$state
,
'
ans1
'
,
false
,
$teacheranswer
);
echo
$input
->
render
(
$state
,
'
maximavars
'
,
false
,
$teacheranswer
);
}
}
}
}
...
@@ -272,85 +272,4 @@ if ($debug) {
...
@@ -272,85 +272,4 @@ if ($debug) {
echo
'<hr />'
;
echo
'<hr />'
;
}
}
/* caschat.php script functions. */
$debuginfo
=
''
;
$errs
=
''
;
$varerrs
=
''
;
$vars
=
optional_param
(
'vars'
,
''
,
PARAM_RAW
);
$string
=
optional_param
(
'cas'
,
''
,
PARAM_RAW
);
$simp
=
optional_param
(
'simp'
,
''
,
PARAM_RAW
);
// Always fix dollars in this script.
// Very useful for converting existing text for use elswhere in Moodle, such as in pages of text.
$string
=
stack_maths
::
replace_dollars
(
$string
);
// Sort out simplification.
if
(
'on'
==
$simp
)
{
$simp
=
true
;
}
else
{
$simp
=
false
;
}
// Initially simplification should be on.
if
(
!
$vars
&&
!
$string
)
{
$simp
=
true
;
}
if
(
$string
)
{
$options
=
new
stack_options
();
$options
->
set_site_defaults
();
$options
->
set_option
(
'simplify'
,
$simp
);
$session
=
new
stack_cas_session2
(
null
,
$options
);
if
(
$vars
)
{
$keyvals
=
new
stack_cas_keyval
(
$vars
,
$options
,
0
);
$session
=
$keyvals
->
get_session
();
$varerrs
=
$keyvals
->
get_errors
();
}
if
(
!
$varerrs
)
{
$ct
=
castext2_evaluatable
::
make_from_source
(
$string
,
'equivdemo'
);
$session
->
add_statement
(
$ct
);
$session
->
instantiate
();
$displaytext
=
$ct
->
get_rendered
();
$errs
=
$ct
->
get_errors
();
$debuginfo
=
$session
->
get_debuginfo
();
}
}
if
(
!
$varerrs
)
{
if
(
$string
)
{
echo
$OUTPUT
->
box
(
stack_ouput_castext
(
$displaytext
));
}
}
if
(
$simp
)
{
$simp
=
stack_string
(
'autosimplify'
)
.
' '
.
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'checkbox'
,
'checked'
=>
$simp
,
'name'
=>
'simp'
));
}
else
{
$simp
=
stack_string
(
'autosimplify'
)
.
' '
.
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'checkbox'
,
'name'
=>
'simp'
));
}
$varlen
=
substr_count
(
$vars
,
"
\n
"
)
+
3
;
$stringlen
=
max
(
substr_count
(
$string
,
"
\n
"
)
+
3
,
8
);
echo
html_writer
::
tag
(
'form'
,
html_writer
::
tag
(
'h2'
,
stack_string
(
'questionvariables'
))
.
html_writer
::
tag
(
'p'
,
$varerrs
)
.
html_writer
::
tag
(
'p'
,
html_writer
::
tag
(
'textarea'
,
$vars
,
array
(
'cols'
=>
100
,
'rows'
=>
$varlen
,
'name'
=>
'vars'
)))
.
html_writer
::
tag
(
'p'
,
$simp
)
.
html_writer
::
tag
(
'h2'
,
stack_string
(
'castext'
))
.
html_writer
::
tag
(
'p'
,
$errs
)
.
html_writer
::
tag
(
'p'
,
html_writer
::
tag
(
'textarea'
,
$string
,
array
(
'cols'
=>
100
,
'rows'
=>
$stringlen
,
'name'
=>
'cas'
)))
.
html_writer
::
tag
(
'p'
,
html_writer
::
empty_tag
(
'input'
,
array
(
'type'
=>
'submit'
,
'value'
=>
stack_string
(
'chat'
)))),
array
(
'action'
=>
$PAGE
->
url
,
'method'
=>
'post'
));
if
(
''
!=
trim
(
$debuginfo
))
{
echo
$OUTPUT
->
box
(
$debuginfo
);
}
echo
$OUTPUT
->
footer
();
echo
$OUTPUT
->
footer
();
This diff is collapsed.
Click to expand it.
questiontestrun.php
+
1
−
1
View file @
84ee2306
...
@@ -150,7 +150,7 @@ foreach ($question->get_correct_response() as $key => $val) {
...
@@ -150,7 +150,7 @@ foreach ($question->get_correct_response() as $key => $val) {
// We've chosen not to send a specific seed since it is helpful to test the general feedback in a random context.
// We've chosen not to send a specific seed since it is helpful to test the general feedback in a random context.
$chatparams
=
$urlparams
;
$chatparams
=
$urlparams
;
$chatparams
[
'vars'
]
=
$questionvarsinputs
;
$chatparams
[
'
maxima
vars'
]
=
$questionvarsinputs
;
$chatparams
[
'simp'
]
=
$simp
;
$chatparams
[
'simp'
]
=
$simp
;
$chatparams
[
'cas'
]
=
$question
->
generalfeedback
;
$chatparams
[
'cas'
]
=
$question
->
generalfeedback
;
$chatlink
=
new
moodle_url
(
'/question/type/stack/adminui/caschat.php'
,
$chatparams
);
$chatlink
=
new
moodle_url
(
'/question/type/stack/adminui/caschat.php'
,
$chatparams
);
...
...
This diff is collapsed.
Click to expand it.
styles.css
+
4
−
0
View file @
84ee2306
...
@@ -66,6 +66,10 @@
...
@@ -66,6 +66,10 @@
max-width
:
100%
;
max-width
:
100%
;
resize
:
both
;
resize
:
both
;
}
}
#id_questionvariables
,
textarea
[
id
*=
feedbackvariables
],
textarea
[
name
=
maximavars
]
{
min-width
:
100%
;
font-family
:
monospace
;
}
.que.stack
input
[
type
=
checkbox
]
{
.que.stack
input
[
type
=
checkbox
]
{
margin-right
:
0.4em
;
margin-right
:
0.4em
;
}
}
...
...
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