Skip to content

Commit

Permalink
Merge pull request #4 from lushonline/MOODLE_311_AND_400
Browse files Browse the repository at this point in the history
Moodle 3.11 and 4.00
  • Loading branch information
lushonline authored Jul 28, 2022
2 parents f0a3152 + b9d3555 commit 58e5c58
Show file tree
Hide file tree
Showing 45 changed files with 658 additions and 429 deletions.
100 changes: 34 additions & 66 deletions .github/workflows/main.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,25 @@ defaults:
jobs:
moodle-plugin-ci:
env:
IGNORE_PATHS : lrs/vendor
IGNORE_PATHS: lrs/vendor

strategy:
fail-fast: true
matrix:
moodle-versions: [
'MOODLE_36_STABLE',
'MOODLE_37_STABLE',
'MOODLE_38_STABLE',
'MOODLE_39_STABLE',
'MOODLE_310_STABLE',
'MOODLE_311_STABLE'
]
database: [
'pgsql',
'mariadb'
]
operating-system: [
ubuntu-latest
]
php-versions: [
'7.3'
]
node-versions: [
'14.15.0'
]

exclude:
- moodle-versions: 'MOODLE_36_STABLE'
node-versions: '14.15.0'

include:
- moodle-versions: 'MOODLE_36_STABLE'
database: 'pgsql'
operating-system: 'ubuntu-latest'
php-versions: '7.3'
node-versions: '8.9'
- moodle-versions: 'MOODLE_36_STABLE'
database: 'mariadb'
operating-system: 'ubuntu-latest'
php-versions: '7.3'
node-versions: '8.9'
moodle-versions: ["MOODLE_311_STABLE", "MOODLE_400_STABLE"]
database: ["pgsql", "mariadb"]
operating-system: [ubuntu-latest]
php-versions: ["7.3", "7.4", "8.0"]
node-versions: ["16.14.0"]

runs-on: ${{ matrix.operating-system }}

services:
postgres:
image: postgres:9.6
image: postgres:12
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
POSTGRES_USER: "postgres"
POSTGRES_HOST_AUTH_METHOD: "trust"
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -66,10 +34,10 @@ jobs:
- 5432:5432

mariadb:
image: mariadb:10.5
image: mariadb:10
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
MYSQL_USER: "root"
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
Expand Down Expand Up @@ -104,18 +72,15 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, pgsql, mysqli, zip, gd
ini-values: max_input_vars=5000
tools: phpunit
coverage: none

- name: Configure Required Composer Version
- name: Downgrade to Composer 1.x
id: install-composer1
if: ${{ matrix.moodle-versions == 'MOODLE_32_STABLE' || matrix.moodle-versions == 'MOODLE_33_STABLE' || matrix.moodle-versions == 'MOODLE_34_STABLE' }}
run: |
echo "::set-output name=COMPOSER_VERSION::--1"
- name: Update Composer
run: |
composer self-update ${{ steps.install-composer1.outputs.COMPOSER_VERSION }}
composer self-update --1
- name: Install moodle-plugin-ci
run: |
Expand All @@ -131,7 +96,7 @@ jobs:
# List all the additional modules you need to install using
# https://moodlehq.github.io/moodle-plugin-ci/AddExtraPlugins.html
# Example below (uncomment obviously):
# moodle-plugin-ci add-plugin lushonline/moodle-tool_uploadexternalcontent
# moodle-plugin-ci add-plugin lushonline/moodle-mod_externalcontent
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-versions }}
Expand All @@ -146,45 +111,48 @@ jobs:
MOODLE_BRANCH: ${{ matrix.moodle-versions }}
NODE_VERSION: ${{ matrix.node-versions }}

- name: Run PHP Lint on the plugin
- name: PHP Lint
if: ${{ always() }}
run: moodle-plugin-ci phplint

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

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

- name: Run Moodle Code Checker on the plugin
- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker
run: moodle-plugin-ci codechecker --max-warnings 0

- name: Run Moodle PHPDoc checker on the plugin
- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc

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

- name: Run check of upgrade Savepoints on the plugin
- name: Check upgrade savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints

- name: Run Mustache Lint on the plugin
- name: Mustache Lint
if: ${{ always() }}
run: moodle-plugin-ci mustache

- name: Run Grunt task on the plugin
- name: Grunt
if: ${{ always() }}
run: moodle-plugin-ci grunt
run: moodle-plugin-ci grunt --max-lint-warnings 0

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

- name: Run Behat on the plugin
- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat
run: moodle-plugin-ci behat --profile chrome
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# External Content with Completion #
# External Content with Completion

![Moodle Plugin CI](https://github.com/lushonline/moodle-mod_externalcontent/workflows/Moodle%20Plugin%20CI/badge.svg)

The module enables a teacher to create a resource using the text editor.
Expand All @@ -16,6 +17,7 @@ the completion can then be imported using [moodle-tool_uploadexternalcontentresu
## Installation

---

1. Install the External content activity module:

```sh
Expand Down Expand Up @@ -48,34 +50,34 @@ If the Statement [Results](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-

### What has been implemented

| Resource | HTTP Methods | Comments |
| -------- | ------------ | --------- |
| Resource | HTTP Methods | Comments |
| ----------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Statements Resource](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#stmtres) | GET, PUT, POST | This is WRITE ONLY and so supports POST, PUT only. GET requests return a "null" response so as to be "valid" but the functionality is not implemented. The JSON statements received are parsed using [TinCan PHP](https://github.com/RusticiSoftware/TinCanPHP), and used to set the viewed status, completion status and score for the content if available. |
| [About Resource](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#aboutresource) | GET | This returns tha xAPI version supported which for this is 1.0.0 |
| [About Resource](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#aboutresource) | GET | This returns tha xAPI version supported which for this is 1.0.0 |

<br>

### Setup Activity Settings

| Name | Setting | Description |
| ---- | ------- | ----------- |
| Enable xAPI LRS basic support | xapienable | Enable the basic xAPI support, if disabled all calls to the xAPI endpoint return a 401 Unauthorized status. The default is enabled. |
| xAPI LRS Username | xapiusername | Configure the username which is used for basic authentication of the basic LRS endpoint. The default is a random string, setup when module is installed. |
| xAPI LRS Password | xapipassword | Configure the password which is used for basic authentication of the basic LRS endpoint. The default is a random string, setup when module is installed. |
| Name | Setting | Description |
| ----------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enable xAPI LRS basic support | xapienable | Enable the basic xAPI support, if disabled all calls to the xAPI endpoint return a 401 Unauthorized status. The default is enabled. |
| xAPI LRS Username | xapiusername | Configure the username which is used for basic authentication of the basic LRS endpoint. The default is a random string, setup when module is installed. |
| xAPI LRS Password | xapipassword | Configure the password which is used for basic authentication of the basic LRS endpoint. The default is a random string, setup when module is installed. |
| List of completion xAPI verbs | xapicompletionverbs | Set the xAPI verbs that will be used to indicate the content has been "completed", if a verb that matches one of these values is received the completed externally flag is updated. Any other verb simply sets the viewed flag. The defaults are http://adlnet.gov/expapi/verbs/completed and http://adlnet.gov/expapi/verbs/passed |

<br>

### Setup Activity Provider

| Setup | Description |
| ----- | ----------- |
| LRS Endpoint | In your activity provider you need to configure the path to this modules LRS endpoint. This will be https://{moodlehostname}/mod/externalcontent/lrs/index.php |
| Authentication | The modules LRS only supports Basic Authentication and so you will need to use the username/password you configured above. |
| Setup | Description |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| LRS Endpoint | In your activity provider you need to configure the path to this modules LRS endpoint. This will be https://{moodlehostname}/mod/externalcontent/lrs/index.php |
| Authentication | The modules LRS only supports Basic Authentication and so you will need to use the username/password you configured above. |

## License

2019-2021 LushOnline
2019-2022 LushOnline

This program 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
Expand Down
4 changes: 2 additions & 2 deletions backup/moodle2/backup_externalcontent_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @package mod_externalcontent
* @category backup
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -34,7 +34,7 @@
/**
* The class provides all the settings and steps to perform one complete backup of mod_externalcontent.
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_externalcontent_activity_task extends backup_activity_task {
Expand Down
6 changes: 2 additions & 4 deletions backup/moodle2/backup_externalcontent_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@
*
* @package mod_externalcontent
* @category backup
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

// For more information about the backup and restore process, please visit:
// https://docs.moodle.org/dev/Backup_2.0_for_developers.
// https://docs.moodle.org/dev/Restore_2.0_for_developers.

/**
* Define the complete structure for backup, with file and id annotations.
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_externalcontent_activity_structure_step extends backup_activity_structure_step {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* The task that provides a complete restore of mod_externalcontent is defined here.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand All @@ -33,7 +33,7 @@
/**
* Restore task for mod_externalcontent.
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_externalcontent_activity_task extends restore_activity_task {
Expand Down
6 changes: 2 additions & 4 deletions backup/moodle2/restore_externalcontent_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@
* All the steps to restore mod_externalcontent are defined here.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

// For more information about the backup and restore process, please visit:
// https://docs.moodle.org/dev/Backup_2.0_for_developers.
// https://docs.moodle.org/dev/Restore_2.0_for_developers.

/**
* Defines the structure step to restore one mod_externalcontent activity.
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_externalcontent_activity_structure_step extends restore_activity_structure_step {
Expand Down
6 changes: 2 additions & 4 deletions classes/analytics/indicator/activity_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@
* Activity base class.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_externalcontent\analytics\indicator;

defined('MOODLE_INTERNAL') || die();

/**
* Activity base class.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity {
Expand Down
6 changes: 2 additions & 4 deletions classes/analytics/indicator/cognitive_depth.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@
* Cognitive depth indicator - externalcontent.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_externalcontent\analytics\indicator;

defined('MOODLE_INTERNAL') || die();

/**
* Cognitive depth indicator - externalcontent.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cognitive_depth extends activity_base {
Expand Down
6 changes: 2 additions & 4 deletions classes/analytics/indicator/social_breadth.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@
* Social breadth indicator - externalcontent.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace mod_externalcontent\analytics\indicator;

defined('MOODLE_INTERNAL') || die();

/**
* Social breadth indicator - externalcontent.
*
* @package mod_externalcontent
* @copyright 2019-2021 LushOnline
* @copyright 2019-2022 LushOnline
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class social_breadth extends activity_base {
Expand Down
Loading

0 comments on commit 58e5c58

Please sign in to comment.