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
fcb66291
Commit
fcb66291
authored
13 years ago
by
Tim Hunt
Browse files
Options
Downloads
Patches
Plain Diff
Move to plots storage to moodledata.
parent
82d28b39
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
plot.php
+52
-0
52 additions, 0 deletions
plot.php
stack/healthcheck.php
+7
-6
7 additions, 6 deletions
stack/healthcheck.php
with
59 additions
and
6 deletions
plot.php
0 → 100644
+
52
−
0
View file @
fcb66291
<?php
// This file is part of Stack - http://stack.bham.ac.uk//
//
// Stack is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Stack is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.
/**
* This script serves plot files that have been saved in the moodledata folder.
*
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once
(
dirname
(
__FILE__
)
.
'/../../../config.php'
);
require_once
(
$CFG
->
libdir
.
'/filelib.php'
);
$plot
=
$CFG
->
dataroot
.
'/stack/plots/'
.
clean_filename
(
get_file_argument
());
if
(
!
is_readable
(
$plot
))
{
header
(
'HTTP/1.0 404 Not Found'
);
header
(
'Content-Type: text/plain;charset=UTF-8'
);
echo
'File not found'
;
die
();
}
// Handle If-Modified-Since
$filedate
=
filemtime
(
$plot
);
if
(
isset
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
&&
strtotime
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
>=
$filedate
)
{
header
(
'HTTP/1.0 304 Not Modified'
);
die
();
}
header
(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
,
$filedate
)
.
' GMT'
);
// Type
header
(
'Content-Type: '
.
mimeinfo
(
'type'
,
'x.png'
));
header
(
'Content-Length: '
.
filesize
(
$plot
));
// Output file
session_get_instance
()
->
write_close
();
// unlock session during file serving.
readfile
(
$plot
);
This diff is collapsed.
Click to expand it.
stack/healthcheck.php
+
7
−
6
View file @
fcb66291
...
@@ -97,8 +97,8 @@ function stack_generate_maximalocal() {
...
@@ -97,8 +97,8 @@ function stack_generate_maximalocal() {
}
}
$maximalocal
[
'TMP_IMAGE_DIR'
]
=
$path
=
$CFG
->
dataroot
.
'/stack/'
;
$maximalocal
[
'TMP_IMAGE_DIR'
]
=
$path
=
$CFG
->
dataroot
.
'/stack/'
;
//TODO where do we put plots properly?!
//TODO where do we put plots properly?!
$maximalocal
[
'IMAGE_DIR'
]
=
'C:/xampp/htdocs/tmp/'
;
// $CFG->dataroot
;
$maximalocal
[
'IMAGE_DIR'
]
=
$CFG
->
dataroot
.
'/stack/plots/'
;
$maximalocal
[
'URL_BASE'
]
=
'http://localhost/tmp/'
;
//$CFG->wwwroot
;
$maximalocal
[
'URL_BASE'
]
=
moodle_url
::
make_file_url
(
'/question/type/stack/plot.php'
,
''
)
;
// Loop over this array to format them correctly...
// Loop over this array to format them correctly...
foreach
(
$maximalocal
as
$var
=>
$val
)
{
foreach
(
$maximalocal
as
$var
=>
$val
)
{
...
@@ -135,13 +135,14 @@ STACK generates LaTeX on the fly, and enables teachers to write LaTeX in questio
...
@@ -135,13 +135,14 @@ STACK generates LaTeX on the fly, and enables teachers to write LaTeX in questio
It assumes that LaTeX will be converted by a moodle filter. Below are samples of displayed and inline expressions in LaTeX which should be
It assumes that LaTeX will be converted by a moodle filter. Below are samples of displayed and inline expressions in LaTeX which should be
appear correctly in your browser. Problems here indicate incorrect moodle filter settings, not faults with STACK itself.
appear correctly in your browser. Problems here indicate incorrect moodle filter settings, not faults with STACK itself.
<h3>
Single and double dollar math environments
</h3>
<h3>
Single and double dollar math environments
</h3>
$$ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$$
<?php
echo
format_text
(
'
$$ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$$
'
);
?>
<br
/>
<br
/>
$ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$
<?php
echo
format_text
(
'$ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$'
);
?>
<h3>
Matching displayed and inline LaTeX tags.
</h3>
<h3>
Matching displayed and inline LaTeX tags.
</h3>
\[ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.\]
<?php
echo
format_text
(
'
\[ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.\]
'
);
?>
<br
/>
<br
/>
\( \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.\)
<?php
echo
format_text
(
'
\( \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.\)
'
);
?>
<br
/>
<br
/>
(These are currently not generated by STACK on the fly, but may be written by some question authors.)
(These are currently not generated by STACK on the fly, but may be written by some question authors.)
...
...
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