Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
hayden-MB committed Oct 10, 2024
2 parents efb5d6c + f1bdee9 commit cb75972
Show file tree
Hide file tree
Showing 785 changed files with 110,787 additions and 1,848 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,35 @@ jobs:
strategy:
fail-fast: false
matrix: # I don't know why, but mariadb is much slower, so mostly use pgsql.
# We use a mix of SBCL and GCL, but mostly prefer SBCL as it is faster.
# We use a mix of SBCL and GCL.
# As of Sept 2024, SBCL is not working.
include:
- php: '8.2'
moodle-branch: 'master'
moodle-branch: 'main'
database: 'pgsql'
maxima: 'SBCL'
maxima: 'GCL'
moodle-app: true
- php: '8.2'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
maxima: 'GCL'
moodle-app: true
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
maxima: 'GCL'
moodle-app: true
# Edinburgh is planning to run the setup below for 2023-24.
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'
maxima: 'GCL'
moodle-app: true
- php: '7.4'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'
maxima: 'SBCL'
maxima: 'GCL'
moodle-app: null

steps:
- name: Install Maxima (${{ matrix.maxima }})
Expand Down Expand Up @@ -86,12 +92,12 @@ jobs:

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfexplicitvaildate
Expand All @@ -113,7 +119,7 @@ jobs:
moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASDEBUGGING", "0");'
#cat ${{ github.workspace }}/moodle/config.php
cp ${{ github.workspace }}/moodledata/phpu_moodledata/stack/maxima_opt_auto ${{ github.workspace }}/maxima_opt_auto
# Try a command on the command line.
# echo "1+1; quit();" | timeout --kill-after=100s 100s ${{ github.workspace }}/maxima_opt_auto -eval '(cl-user::run)'
Expand All @@ -122,6 +128,7 @@ jobs:
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
MOODLE_APP: ${{ matrix.moodle-app }}

- name: PHP Lint
if: ${{ always() }}
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# STACK 4.7.0
# STACK 4.8.0

STACK is an assessment system for mathematics, science and related disciplines. STACK is a question type for the Moodle learning management system, and also the ILIAS learning management system. STACK has an API for stand-alone integration into other 3rd party systems.

Expand Down
7 changes: 3 additions & 4 deletions adminui/bulktestall.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@
}

// Login and check permissions.
$context = context_system::instance();
require_login();
require_capability('moodle/site:config', $context);
$context = context_system::instance();
require_capability('qtype/stack:usediagnostictools', $context);

$PAGE->set_url('/question/type/stack/bulktestall.php', $urlparams);
$PAGE->set_context($context);
$title = stack_string('bulktesttitle', $context->get_context_name());
$PAGE->set_title($title);

require_login();

// Create the helper class.
$bulktester = new stack_bulk_tester();
$allpassed = true;
Expand Down
6 changes: 4 additions & 2 deletions adminui/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,17 @@
'q.id = o.questionid AND ' .
$DB->sql_like('o.compiledcache', ':trg') . ';', ['trg' => '%stack_todo%']);
echo '<h4>Questions containing [[todo]] blocks</h4>';
echo '<table><thead><tr><th>Question</th></thead><tbody>';
echo '<table><thead><tr><th>Question</th><th>Tags</th></thead><tbody>';
// Load the whole question, simpler to get the contexts correct that way.
foreach ($qs as $item) {
$q = question_bank::load_question($item->questionid);
$tags = $q->get_question_todos();
list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($q);
$qurl = qbank_previewquestion\helper::question_preview_url($item->questionid,
null, null, null, null, $context);
echo "<tr><td>" . $q->name . ' ' .
$OUTPUT->action_icon($qurl, new pix_icon('t/preview', get_string('preview'))) . '</td></tr>';
$OUTPUT->action_icon($qurl, new pix_icon('t/preview', get_string('preview'))) .
'</td><td>' . implode(', ', $tags). '<td></tr>';
}
echo '</tbody></table>';
}
Expand Down
2 changes: 2 additions & 0 deletions adminui/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
['link' => (string) new moodle_url('/question/type/stack/adminui/caschat.php')]),
get_string('bulktestindexintro_desc', 'qtype_stack',
['link' => (string) new moodle_url('/question/type/stack/adminui/bulktestindex.php')]),
get_string('todo_desc', 'qtype_stack',
['link' => (string) new moodle_url('/question/type/stack/adminui/todo.php')]),
get_string('dependenciesintro_desc', 'qtype_stack',
['link' => (string) new moodle_url('/question/type/stack/adminui/dependencies.php')]),
get_string('stackInstall_replace_dollars_desc', 'qtype_stack',
Expand Down
127 changes: 127 additions & 0 deletions adminui/todo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php
// This file is part of Stack - http://stack.maths.ed.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 page lets the user find all questions in a course in which they are a techer
* which have a [[todo]] block. The questions are sorted by any tags they might have.
*
* @copyright 2024 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

require_once(__DIR__.'/../../../../config.php');

require_once($CFG->libdir . '/questionlib.php');
require_once(__DIR__ . '/../locallib.php');
require_once(__DIR__ . '/../stack/utils.class.php');
require_once(__DIR__ . '/../stack/bulktester.class.php');

// Get the parameters from the URL.
$context = context_system::instance();
$contextid = optional_param('contextid', $context->__get('id'), PARAM_INT);
$context = context::instance_by_id($contextid);

// Login and check permissions.
require_login();
$PAGE->set_url('/question/type/stack/todo.php');
$PAGE->set_context($context);
$title = stack_string('seetodolist');
$PAGE->set_title($title);

echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo html_writer::tag('p', stack_string('seetodolist_desc'));
echo html_writer::tag('p', stack_string('seetodolist_help'));

$bulktester = new stack_bulk_tester();
$tagsummary = [];

// Loop over all questions which this teache can edit.
foreach ($bulktester->get_num_stack_questions_by_context() as $contextid => $numstackquestions) {
$context = context::instance_by_id($contextid);
if (has_capability('moodle/question:editall', $context)) {
$categories = $bulktester->get_categories_for_context($context->id);

$questiontestsurl = new moodle_url('/question/type/stack/questiontestrun.php');
if ($context->contextlevel == CONTEXT_COURSE) {
$questiontestsurl->param('courseid', $context->instanceid);
} else if ($context->contextlevel == CONTEXT_MODULE) {
$questiontestsurl->param('cmid', $context->instanceid);
} else {
$questiontestsurl->param('courseid', SITEID);
}

foreach ($categories as $currentcategoryid => $nameandcount) {
core_php_time_limit::raise(60); // Prevent PHP timeouts.

$qtodos = [];
$questions = $bulktester->stack_questions_in_category($currentcategoryid);
if (!$questions) {
continue;
}
foreach ($questions as $qid => $qname) {
$q = question_bank::load_question($qid);
list($hastodos, $tags) = $q->get_question_todos();
if ($hastodos) {
$preurl = qbank_previewquestion\helper::question_preview_url($qid,
null, null, null, null, $context);
$dashurl = html_writer::link(new moodle_url($questiontestsurl,
['questionid' => $qid]), $qname). ' ' .
$OUTPUT->action_icon($preurl, new pix_icon('t/preview', get_string('preview')));
// TODO: add in a direct edit URL.
$qtodos[] = ['qid' => $qid,
'qname' => $qname,
'tags' => $tags,
'dashurl' => $dashurl,
];
if ($tags !== []) {
foreach ($tags as $tag) {
if (array_key_exists($tag, $tagsummary)) {
$tagsummary[$tag][] = $dashurl;
} else {
$tagsummary[$tag] = [$dashurl];
}
}
}
}
}
if ($qtodos !== []) {
echo $OUTPUT->heading($context->get_context_name());
echo '<table><thead><tr><th>Question</th><th>Tags</th></thead><tbody>';
// Load the whole question, simpler to get the contexts correct that way.
foreach ($qtodos as $item) {
echo "<tr><td>" . $item['dashurl'] .
'</td><td>' . implode(', ', $item['tags']). '<td></tr>';
}
echo '</tbody></table>';

flush(); // Force output to prevent timeouts and to make progress clear.
}
}
}
}

if ($tagsummary !== []) {
echo "\n\n<hr />\n\n";
foreach ($tagsummary as $tagname => $tagurls) {
echo $OUTPUT->heading($tagname);
foreach ($tagurls as $dashurl) {
echo $dashurl . "\n<br >\n";
}
}
}

echo $OUTPUT->footer();
11 changes: 11 additions & 0 deletions amd/build/library.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cb75972

Please sign in to comment.