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
f0c49b68
Commit
f0c49b68
authored
Jun 20, 2015
by
Chris Sangwin
Committed by
Tim Hunt
Jun 22, 2015
Browse files
Options
Downloads
Patches
Plain Diff
Changes to Tim's proposed behaviour to require an active confirm.
parent
cf4a3a92
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
edit_stack_form.php
+29
-28
29 additions, 28 deletions
edit_stack_form.php
renderer.php
+1
-0
1 addition, 0 deletions
renderer.php
with
30 additions
and
28 deletions
edit_stack_form.php
+
29
−
28
View file @
f0c49b68
...
@@ -570,7 +570,7 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -570,7 +570,7 @@ class qtype_stack_edit_form extends question_edit_form {
if
(
$counts
[
self
::
INPUTS
]
==
0
&&
$counts
[
self
::
VALIDATIONS
]
==
0
)
{
if
(
$counts
[
self
::
INPUTS
]
==
0
&&
$counts
[
self
::
VALIDATIONS
]
==
0
)
{
$mform
->
addElement
(
'static'
,
$inputname
.
'warning'
,
''
,
stack_string
(
'inputwillberemoved'
,
$inputname
));
$mform
->
addElement
(
'static'
,
$inputname
.
'warning'
,
''
,
stack_string
(
'inputwillberemoved'
,
$inputname
));
$mform
->
addElement
(
'advcheckbox'
,
$inputname
.
'deleteconfirm'
,
''
,
stack_string
(
'inputremovedconfirm'
));
$mform
->
addElement
(
'advcheckbox'
,
$inputname
.
'deleteconfirm'
,
''
,
stack_string
(
'inputremovedconfirm'
));
$mform
->
setDefault
(
$inputname
.
'deleteconfirm'
,
1
);
$mform
->
setDefault
(
$inputname
.
'deleteconfirm'
,
0
);
$mform
->
setExpanded
(
$inputname
.
'header'
);
$mform
->
setExpanded
(
$inputname
.
'header'
);
}
}
...
@@ -657,7 +657,7 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -657,7 +657,7 @@ class qtype_stack_edit_form extends question_edit_form {
if
(
$count
==
0
)
{
if
(
$count
==
0
)
{
$mform
->
addElement
(
'static'
,
$prtname
.
'prtwarning'
,
''
,
stack_string
(
'prtwillberemoved'
,
$prtname
));
$mform
->
addElement
(
'static'
,
$prtname
.
'prtwarning'
,
''
,
stack_string
(
'prtwillberemoved'
,
$prtname
));
$mform
->
addElement
(
'advcheckbox'
,
$prtname
.
'prtdeleteconfirm'
,
''
,
stack_string
(
'prtremovedconfirm'
));
$mform
->
addElement
(
'advcheckbox'
,
$prtname
.
'prtdeleteconfirm'
,
''
,
stack_string
(
'prtremovedconfirm'
));
$mform
->
setDefault
(
$prtname
.
'prtdeleteconfirm'
,
1
);
$mform
->
setDefault
(
$prtname
.
'prtdeleteconfirm'
,
0
);
$mform
->
setExpanded
(
$prtname
.
'header'
);
$mform
->
setExpanded
(
$prtname
.
'header'
);
}
}
...
@@ -1001,8 +1001,10 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -1001,8 +1001,10 @@ class qtype_stack_edit_form extends question_edit_form {
foreach
(
$inputs
as
$inputname
=>
$counts
)
{
foreach
(
$inputs
as
$inputname
=>
$counts
)
{
list
(
$numinputs
,
$numvalidations
)
=
$counts
;
list
(
$numinputs
,
$numvalidations
)
=
$counts
;
if
(
$numinputs
==
0
&&
$numvalidations
==
0
&&
$fromform
[
$inputname
.
'deleteconfirm'
])
{
if
(
$numinputs
==
0
&&
$numvalidations
==
0
)
{
if
(
!
$fromform
[
$inputname
.
'deleteconfirm'
])
{
$errors
[
'questiontext'
][]
=
stack_string
(
'inputremovedconfirmbelow'
,
$inputname
);
$errors
[
'questiontext'
][]
=
stack_string
(
'inputremovedconfirmbelow'
,
$inputname
);
}
continue
;
continue
;
}
}
...
@@ -1046,15 +1048,6 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -1046,15 +1048,6 @@ class qtype_stack_edit_form extends question_edit_form {
stack_string
(
'specificfeedback'
),
$fromform
[
'specificfeedback'
][
'text'
],
stack_string
(
'specificfeedback'
),
$fromform
[
'specificfeedback'
][
'text'
],
array
(
'input'
,
'validation'
));
array
(
'input'
,
'validation'
));
foreach
(
$prts
as
$prtname
=>
$count
)
{
if
(
$count
==
0
&&
$fromform
[
$prtname
.
'prtdeleteconfirm'
])
{
$errors
[
'specificfeedback'
][]
=
stack_string
(
'prtremovedconfirmbelow'
,
$prtname
);
}
else
if
(
$count
>
1
)
{
$errors
[
'specificfeedback'
][]
=
stack_string
(
'questiontextfeedbackonlycontain'
,
'[[feedback:'
.
$prtname
.
']]'
);
}
}
// General feedback.
// General feedback.
$errors
[
'generalfeedback'
]
=
array
();
$errors
[
'generalfeedback'
]
=
array
();
$errors
=
$this
->
validate_cas_text
(
$errors
,
$fromform
[
'generalfeedback'
][
'text'
],
'generalfeedback'
,
$fixingdollars
);
$errors
=
$this
->
validate_cas_text
(
$errors
,
$fromform
[
'generalfeedback'
][
'text'
],
'generalfeedback'
,
$fixingdollars
);
...
@@ -1083,6 +1076,7 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -1083,6 +1076,7 @@ class qtype_stack_edit_form extends question_edit_form {
$errors
[
$inputname
.
'deleteconfirm'
][]
=
stack_string
(
'youmustconfirm'
);
$errors
[
$inputname
.
'deleteconfirm'
][]
=
stack_string
(
'youmustconfirm'
);
}
}
if
(
array_key_exists
(
$inputname
.
'modelans'
,
$fromform
))
{
$errors
=
$this
->
validate_cas_string
(
$errors
,
$errors
=
$this
->
validate_cas_string
(
$errors
,
$fromform
[
$inputname
.
'modelans'
],
$inputname
.
'modelans'
,
$inputname
.
'modelans'
);
$fromform
[
$inputname
.
'modelans'
],
$inputname
.
'modelans'
,
$inputname
.
'modelans'
);
...
@@ -1095,12 +1089,19 @@ class qtype_stack_edit_form extends question_edit_form {
...
@@ -1095,12 +1089,19 @@ class qtype_stack_edit_form extends question_edit_form {
$errors
[
$inputname
.
'options'
][]
=
stack_string
(
'optionsnotrequired'
);
$errors
[
$inputname
.
'options'
][]
=
stack_string
(
'optionsnotrequired'
);
}
}
}
}
}
// 3) Validate all prts.
// 3) Validate all prts.
foreach
(
$prts
as
$prtname
=>
$count
)
{
foreach
(
$prts
as
$prtname
=>
$count
)
{
if
(
$count
==
0
&&
!
$fromform
[
$prtname
.
'prtdeleteconfirm'
])
{
if
(
$count
==
0
)
{
if
(
!
$fromform
[
$prtname
.
'prtdeleteconfirm'
])
{
$errors
[
'specificfeedback'
][]
=
stack_string
(
'prtremovedconfirmbelow'
,
$prtname
);
$errors
[
$prtname
.
'prtdeleteconfirm'
][]
=
stack_string
(
'youmustconfirm'
);
$errors
[
$prtname
.
'prtdeleteconfirm'
][]
=
stack_string
(
'youmustconfirm'
);
}
}
}
else
if
(
$count
>
1
)
{
$errors
[
'specificfeedback'
][]
=
stack_string
(
'questiontextfeedbackonlycontain'
,
'[[feedback:'
.
$prtname
.
']]'
);
}
$errors
=
$this
->
validate_prt
(
$errors
,
$fromform
,
$prtname
,
$fixingdollars
);
$errors
=
$this
->
validate_prt
(
$errors
,
$fromform
,
$prtname
,
$fixingdollars
);
}
}
...
...
...
...
This diff is collapsed.
Click to expand it.
renderer.php
+
1
−
0
View file @
f0c49b68
...
@@ -76,6 +76,7 @@ class qtype_stack_renderer extends qtype_renderer {
...
@@ -76,6 +76,7 @@ class qtype_stack_renderer extends qtype_renderer {
$questiontext
=
str_replace
(
"[[feedback:
{
$index
}
]]"
,
$feedback
,
$questiontext
);
$questiontext
=
str_replace
(
"[[feedback:
{
$index
}
]]"
,
$feedback
,
$questiontext
);
}
}
// Now format the questiontext. This should be done after the subsitutions of inputs and PRTs.
// Now format the questiontext. This should be done after the subsitutions of inputs and PRTs.
$questiontext
=
$question
->
format_text
(
$questiontext
=
$question
->
format_text
(
stack_maths
::
process_display_castext
(
$questiontext
,
$this
),
stack_maths
::
process_display_castext
(
$questiontext
,
$this
),
...
...
...
...
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
sign in
to comment