Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/controller/RenderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public function __invoke(Request $request, Response $response, array $args): Res
$question->get_ta_for_input($name)
);

StackPlotReplacer::replace_plots($plots, $apiinput->samplesolutionrender, "solrender", $storeprefix);
$apiinput->validationtype = $input->get_parameter('showValidation', 1);
$apiinput->configuration = $input->render_api_data($question->get_ta_for_input($name));

Expand Down
12 changes: 6 additions & 6 deletions api/public/sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ function toggleAnswer(button) {
<span style="display: flex; align-items: center; font-size: 20px">
<span style="display: flex; align-items: center;">
<img src="logo_large.png" style="height: 50px;">
<span style="font-size: 50px;"><b>STACK API demonstration</b></span>
<span style="font-size: 50px;"><b>STACK</b></span>
</span>
&nbsp;| Online assessment
</span>
</a>
</div>
<br>
<h2>API Demonstration</h2>
<div class="col-lg-9">
<p>
STACK is the world-leading open-source online assessment system for mathematics and STEM.
Expand All @@ -142,7 +142,7 @@ function toggleAnswer(button) {
For more information visit <a href="https://stack-assessment.org/">the STACK community page</a>.
</p>
<p>
There is also a <a href="/stack.php">library of STACK questions</a> on this demo site.
There is a <a href="/stack.php">library of STACK questions</a> on this demo site.
</p>
<hr>
</div>
Expand All @@ -154,7 +154,7 @@ function toggleAnswer(button) {
</div>
<div class="main-content">
<br>
<div class="col-lg-8">
<div class="col-lg-10">
<div id='errors'></div>
<h1 id="stackapi_name"></h1>
<br>
Expand Down Expand Up @@ -186,9 +186,9 @@ function toggleAnswer(button) {
<div class="col-lg-9">
<hr />
<p style="font-size: 0.875em;color:gray;">
The STACK source code, including this API, is Licensed under the GNU General Public, License Version 3.
The STACK source code, including this API, is licensed under the GNU General Public, License Version 3.
Documentation, sample questions and materials, are licensed under Creative Commons Attribution-ShareAlike 4.0 International.
See the <a href="https://docs.stack-assessment.org/en/About/License/">STACK licence</a> page for full details.
See the <a href="https://docs.stack-assessment.org/en/About/License/">STACK license</a> page for full details.
</p>
<? readfile(__DIR__ . '/stackfooter.html') ?>
</div>
Expand Down
9 changes: 6 additions & 3 deletions api/public/stack.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,26 @@ function setQuestion(question) {
<span style="display: flex; align-items: center; font-size: 20px">
<span style="display: flex; align-items: center;">
<img src="logo_large.png" style="height: 50px;">
<span style="font-size: 50px;"><b>STACK </b></span>
<span style="font-size: 50px;"><b>STACK</b></span>
</span>
&nbsp;| Online assessment
</span>
</a>
</div>
<a href="/sample.php" class="nav-link">
<h2>API Demonstration</h2>
</a>
Choose a STACK sample file:
<?php
$files = stack_question_library::get_file_list('../../samplequestions/stacklibrary/*');
function render_directory($dirdetails) {
echo '<div style="margin-left: 30px;">';
foreach ($dirdetails as $file) {
if (!$file->isdirectory) {
if (!$file->isdirectory && pathinfo($file->path, PATHINFO_EXTENSION) === 'xml') {
echo '<button class="btn btn-link library-file-link" type="button" onclick="getQuestionFile(\'cors.php?name='
. $file->path . '&question=true\')">' .
$file->label . '</button><br>';
} else {
} else if ($file->isdirectory) {
echo '<button class="btn btn-link" type="button" data-toggle="collapse" ' .
'data-target="#' . $file->divid . '" aria-expanded="false" aria-controls="' . $file->divid . '">' .
$file->label . '</button><br><div class="collapse" id="' . $file->divid . '">';
Expand Down
14 changes: 7 additions & 7 deletions samplequestions/stackdemo/70_Drag_drop_Using_images.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</name>
<questiontext format="moodle_auto_format">
<text><![CDATA[<p>Drag the items to match up the functions with their derivatives. </p>
[[parsons input="ans1" columns="3" rows="2" item-height="230" item-width="230"]]
[[parsons input="ans1" columns="3" rows="2" item-height="200" item-width="200"]]
{
"steps" : {#match_encode(steps)#},
"headers" : {#headers#},
Expand Down Expand Up @@ -38,12 +38,12 @@ wa: [

/*options to drag from, can be changed*/
steps: [
["f", plot(x^2,[x,-1,1], [size, 200, 200])],
["g", plot(x^3,[x,-1,1], [size, 200, 200])],
["dfdx", plot(2*x,[x,-1,1], [size, 200, 200])],
["dgdx", plot(3*x^2,[x,-1,1], [size, 200, 200])],
["df2d2x", plot(2,[x,-1,1], [size, 200, 200])],
["dg2d2x", plot(6*x,[x,-1,1], [size, 200, 200])]
["f", plot(x^2,[x,-1,1], [size, 190, 190])],
["g", plot(x^3,[x,-1,1], [size, 190, 190])],
["dfdx", plot(2*x,[x,-1,1], [size, 190, 190])],
["dgdx", plot(3*x^2,[x,-1,1], [size, 190, 190])],
["df2d2x", plot(2,[x,-1,1], [size, 190, 190])],
["dg2d2x", plot(6*x,[x,-1,1], [size, 190, 190])]
];

/*create random order*/
Expand Down
4 changes: 2 additions & 2 deletions tests/api_stackquestionloader_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ public function test_detect_difference_yml(): void {
"value: '2'\n autosimplify: '1'\n feedbackstyle: '1'\n " .
"node:\n - name: '0'\n answertest: AlgEquiv\n " .
"sans: ans1\n tans: ta1\n quiet: '1'\n - name: prt2\n " .
"value: '1.0000001'\n autosimplify: '1'\n feedbackstyle: '1'\n node:\n - name: '0'\n " . "
answertest: AlgEquiv\n sans: ans2\n tans: ta2\n quiet: '0'\n falsescore: '1'\n" .
"value: '1.0000001'\n autosimplify: '1'\n feedbackstyle: '1'\n node:\n - name: '0'\n " .
"answertest: AlgEquiv\n sans: ans2\n tans: ta2\n quiet: '0'\n falsescore: '1'\n" .
"deployedseed:\n - '1'\n - '2'\n - '3'\nqtest:\n - testcase: '1'\n description: 'A test'\n " .
"testinput:\n - name: ans1\n - name: ans2\n value: ta2\n expected:\n - name: prt1" .
"\n expectedscore: '1.0000000'\n expectedpenalty: '0.0000000'\n " .
Expand Down
Loading