Skip to content

Commit

Permalink
Merge branch 'MOODLE_401_STABLE' of github.com:tonyjbutler/moodle-mod…
Browse files Browse the repository at this point in the history
…_leganto into MOODLE_403_STABLE
  • Loading branch information
trevor-c committed Mar 11, 2024
2 parents 8c7b050 + 25401be commit 83d012e
Show file tree
Hide file tree
Showing 19 changed files with 279 additions and 220 deletions.
51 changes: 29 additions & 22 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04

services:
postgres:
image: postgres:10
image: postgres:13
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3

mariadb:
image: mariadb:10
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"

ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3

strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4', '8.0']
moodle-branch: ['MOODLE_400_STABLE']
php: ['7.4', '8.0', '8.1']
moodle-branch: ['MOODLE_401_STABLE']
database: [pgsql, mariadb]

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: plugin

Expand All @@ -46,65 +46,72 @@ jobs:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
# If you are not using code coverage, keep "none". Otherwise, use "pcov" (Moodle 3.10 and up) or "xdebug".
# If you try to use code coverage with "none", it will fallback to phpdbg (which has known problems).
coverage: none

- 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 install --plugin ./plugin --db-host=127.0.0.1
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
# Uncomment this to run Behat tests using the Moodle App.
# MOODLE_APP: 'true'

- name: PHP Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpdoc --max-warnings 0

- name: Validating
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpunit --fail-on-warning

- name: Behat features
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci behat --profile chrome

- name: Mark cancelled jobs as failed.
if: ${{ cancelled() }}
run: exit 1
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.

copyright 2017 Lancaster University (http://www.lancaster.ac.uk/)
license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
author Tony Butler <[email protected]>
copyright 2017 Lancaster University (http://www.lancaster.ac.uk/)
license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
author Tony Butler <[email protected]>


Leganto reading list module for Moodle
Expand All @@ -33,28 +33,39 @@ visibility).
Changelog
---------

2024-01-05 v4.1.0

* Fix inline list display inconsistencies in Moodle 4.1+
* Refactor output renderer and renderable classes
* Address new issues identified by code checker and CI tests

2022-06-01 v4.0.0

* Fix JS selectors and make transitions less jarring
* Various fixes to improve support for Moodle 4.0
* Address issues identified by Moodle Plugin CI tests

2020-10-27 v3.5.1

* Tell set_content() that list content is already formatted
* Reset cached list data when loading course module config

2018-09-07 v3.5.0

* Add option to display list content inline and auto-expanded
* Redirect to the list rather than just the course section
* Add null privacy provider for GDPR support
* Add support for new chapter metadata attributes in API

2018-01-30 v3.1.1, v3.3.1

* Display chapter titles for citations of type 'Book Chapter'
* Support course/list/section/citation ids of > 16 characters
* Add option to include public notes in citation display
* Expand list fieldset if it contains pre-selected citations

2017-09-29 v3.1.0, v3.3.0

* Initial stable release


Expand All @@ -65,14 +76,14 @@ Installing from the Git repository (recommended if you installed Moodle from
Git):

Follow the instructions at
https://docs.moodle.org/400/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository,
e.g. for the Moodle 4.0.x code:
https://docs.moodle.org/401/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository,
e.g. for the Moodle 4.1.x code:

$ cd /path/to/your/moodle/
$ cd mod/
$ git clone https://github.com/tonyjbutler/moodle-mod_leganto.git leganto
$ cd leganto/
$ git checkout -b MOODLE_400_STABLE origin/MOODLE_400_STABLE
$ git checkout -b MOODLE_401_STABLE origin/MOODLE_401_STABLE
$ git branch -d master
$ cd /path/to/your/moodle/
$ echo /mod/leganto/ >> .git/info/exclude
Expand All @@ -93,7 +104,7 @@ Updating Moodle
---------------
If you installed Moodle and the Leganto reading list module from Git you can
run the following commands to update both (see
https://docs.moodle.org/400/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository):
https://docs.moodle.org/401/en/Git_for_Administrators#Installing_a_contributed_extension_from_its_Git_repository):

$ cd /path/to/your/moodle/
$ git pull
Expand Down
6 changes: 3 additions & 3 deletions backup/moodle2/backup_leganto_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ protected function define_structure() {
$userinfo = $this->get_setting_value('userinfo');

// Define each element separated.
$leganto = new backup_nested_element('leganto', array('id'), array('name', 'intro', 'introformat', 'timemodified',
'display', 'citations', 'displaynotes'));
$leganto = new backup_nested_element('leganto', ['id'], ['name', 'intro', 'introformat', 'timemodified',
'display', 'citations', 'displaynotes']);

// Build the tree.
// (nice mono-tree, lol).

// Define sources.
$leganto->set_source_table('leganto', array('id' => backup::VAR_ACTIVITYID));
$leganto->set_source_table('leganto', ['id' => backup::VAR_ACTIVITYID]);

// Define id annotations.
// (none).
Expand Down
10 changes: 5 additions & 5 deletions backup/moodle2/restore_leganto_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ protected function define_my_steps() {
* @return array
*/
public static function define_decode_contents() {
$contents = array();
$contents = [];

$contents[] = new restore_decode_content('leganto', array('intro'), 'leganto');
$contents[] = new restore_decode_content('leganto', ['intro'], 'leganto');

return $contents;
}
Expand All @@ -73,7 +73,7 @@ public static function define_decode_contents() {
* @return array
*/
public static function define_decode_rules() {
$rules = array();
$rules = [];

$rules[] = new restore_decode_rule('LEGANTOVIEWBYID', '/mod/leganto/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('LEGANTOINDEX', '/mod/leganto/index.php?id=$1', 'course');
Expand All @@ -88,7 +88,7 @@ public static function define_decode_rules() {
* @return array
*/
public static function define_restore_log_rules() {
$rules = array();
$rules = [];

$rules[] = new restore_log_rule('leganto', 'add', 'view.php?id={course_module}', '{leganto}');
$rules[] = new restore_log_rule('leganto', 'edit', 'edit.php?id={course_module}', '{leganto}');
Expand All @@ -107,7 +107,7 @@ public static function define_restore_log_rules() {
* @return array
*/
public static function define_restore_log_rules_for_course() {
$rules = array();
$rules = [];

$rules[] = new restore_log_rule('leganto', 'view all', 'index.php?id={course}', null);

Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/restore_leganto_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class restore_leganto_activity_structure_step extends restore_activity_structure
* @return array
*/
protected function define_structure() {
$paths = array();
$paths = [];
$paths[] = new restore_path_element('leganto', '/activity/leganto');

// Return the paths wrapped into standard activity structure.
Expand Down
55 changes: 55 additions & 0 deletions classes/output/leganto_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace mod_leganto\output;

use cm_info;
use context;
use context_module;
use renderable;
use stdClass;

/**
* Leganto list renderable class.
*
* @package mod_leganto
* @copyright 2017 Lancaster University {@link http://www.lancaster.ac.uk/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Tony Butler <[email protected]>
*/
class leganto_list implements renderable {

/** @var context The context of the course module for this leganto_list instance. */
public $context;

/** @var stdClass The leganto database record for this leganto_list instance. */
public $leganto;

/** @var cm_info The course module info object for this leganto_list instance. */
public $cm;

/**
* Constructor for the leganto_list class.
*
* @param stdClass $leganto The leganto record.
* @param cm_info $cm The course module info.
*/
public function __construct($leganto, $cm) {
$this->leganto = $leganto;
$this->cm = $cm;
$this->context = context_module::instance($cm->id);
}
}
Loading

0 comments on commit 83d012e

Please sign in to comment.