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
73289c68
Commit
73289c68
authored
3 years ago
by
Matti Harjula
Browse files
Options
Downloads
Patches
Plain Diff
Fix to [[textdownload]] numbering and make it simpler to use it outside STACK.
parent
911cb439
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
question.php
+6
-0
6 additions, 0 deletions
question.php
stack/cas/castext2/blocks/textdownload.block.php
+14
-2
14 additions, 2 deletions
stack/cas/castext2/blocks/textdownload.block.php
with
20 additions
and
2 deletions
question.php
+
6
−
0
View file @
73289c68
...
...
@@ -1706,6 +1706,12 @@ class qtype_stack_question extends question_graded_automatically_with_countback
$forbiddenkeys
=
[];
$sec
=
new
stack_cas_security
();
// Some counter resets to ensure that the result is the same even if
// we for some reason would compile twice in a session.
// Happens during first preview and can lead to cache being always out
// of sync if textdownload is in play.
stack_cas_castext2_textdownload
::
$countfiles
=
1
;
// First handle the question variables.
if
(
$questionvariables
===
null
||
trim
(
$questionvariables
)
===
''
)
{
$cc
[
'statement-qv'
]
=
null
;
...
...
This diff is collapsed.
Click to expand it.
stack/cas/castext2/blocks/textdownload.block.php
+
14
−
2
View file @
73289c68
...
...
@@ -35,7 +35,7 @@ require_once(__DIR__ . '/../utils.php');
*/
class
stack_cas_castext2_textdownload
extends
stack_cas_castext2_block
{
p
rivate
static
$countfiles
=
1
;
p
ublic
static
$countfiles
=
1
;
public
function
compile
(
$format
,
$options
):
?string
{
if
(
!
isset
(
$options
[
'in main content'
])
||
!
$options
[
'in main content'
])
{
...
...
@@ -45,7 +45,12 @@ class stack_cas_castext2_textdownload extends stack_cas_castext2_block {
$format
=
castext2_parser_utils
::
RAWFORMAT
;
$code
=
'["textdownload",'
.
stack_utils
::
php_string_to_maxima_string
(
$this
->
params
[
'name'
])
.
',"'
.
self
::
$countfiles
.
'"]'
;
self
::
$countfiles
;
if
(
isset
(
$options
[
'stateful'
])
&&
$options
[
'stateful'
]
===
true
)
{
$code
.
=
',"stateful"'
;
}
$code
.
=
'"]'
;
// Collect the content for future.
$content
=
'["%root",""'
;
...
...
@@ -72,6 +77,13 @@ class stack_cas_castext2_textdownload extends stack_cas_castext2_block {
}
public
function
postprocess
(
array
$params
,
castext2_processor
$processor
):
string
{
// Note different systems serve out through different logic.
if
(
count
(
$params
)
>
3
&&
$params
[
3
]
===
'stateful'
)
{
return
(
new
moodle_url
(
'/question/type/stateful/textdownload.php'
,
[
'qaid'
=>
$processor
->
qa
->
get_database_id
(),
'id'
=>
$params
[
2
],
'name'
=>
$params
[
1
]]))
->
out
(
false
);
}
// Simply form the URL for getting the content out.
return
(
new
moodle_url
(
'/question/type/stack/textdownload.php'
,
[
'qaid'
=>
$processor
->
qa
->
get_database_id
(),
...
...
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