Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gamahachaa/grav-xapi
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.3.0
Choose a base ref
...
head repository: gamahachaa/grav-xapi
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Mar 3, 2020

  1. Copy the full SHA
    2f5c522 View commit details
  2. user username rather than login

    bbaudry committed Mar 3, 2020
    Copy the full SHA
    79f21fc View commit details

Commits on Mar 4, 2020

  1. documentation's typos and cleanup

    bbaudry committed Mar 4, 2020
    Copy the full SHA
    2eff80f View commit details
  2. documentation's typos and cleanup

    bbaudry committed Mar 4, 2020
    Copy the full SHA
    edcfad9 View commit details

Commits on May 13, 2020

  1. Copy the full SHA
    e42e002 View commit details

Commits on Nov 5, 2020

  1. lower cases for actor iri and query filter by key only (was key valku…

    …e pair match before)
    bbaudry committed Nov 5, 2020
    Copy the full SHA
    beb3d60 View commit details

Commits on Nov 9, 2020

  1. Copy the full SHA
    8e2735e View commit details
  2. Copy the full SHA
    01d724e View commit details
  3. Copy the full SHA
    1ab2ed2 View commit details
  4. Copy the full SHA
    21a5536 View commit details
  5. Copy the full SHA
    467cf8a View commit details
  6. Copy the full SHA
    a8f34cf View commit details
  7. Copy the full SHA
    539a837 View commit details
  8. Copy the full SHA
    bcaf006 View commit details
  9. Copy the full SHA
    4b86ace View commit details

Commits on Nov 10, 2020

  1. Copy the full SHA
    d816d7d View commit details
  2. Copy the full SHA
    21557b3 View commit details
  3. Copy the full SHA
    051eab5 View commit details
  4. Copy the full SHA
    aad6217 View commit details
  5. Copy the full SHA
    46c1552 View commit details
  6. Copy the full SHA
    b02a140 View commit details
  7. Copy the full SHA
    a2c7a39 View commit details
  8. Copy the full SHA
    969baeb View commit details
  9. Copy the full SHA
    31ac446 View commit details
  10. Copy the full SHA
    709e28c View commit details
  11. Copy the full SHA
    956ef73 View commit details
  12. Copy the full SHA
    040467c View commit details
  13. Copy the full SHA
    9c554e0 View commit details
  14. Copy the full SHA
    a541633 View commit details
  15. Copy the full SHA
    12e3d50 View commit details
  16. Copy the full SHA
    1e621db View commit details
  17. Copy the full SHA
    2c0b211 View commit details

Commits on Jul 7, 2021

  1. cleanup

    bbaudry committed Jul 7, 2021
    Copy the full SHA
    0f1dc22 View commit details
  2. updating the blueprint

    bbaudry committed Jul 7, 2021
    Copy the full SHA
    2071cf6 View commit details

Commits on Jul 8, 2021

  1. Update blueprints.yaml

    gamahachaa authored Jul 8, 2021
    Copy the full SHA
    3812267 View commit details
  2. Update blueprints.yaml

    gamahachaa authored Jul 8, 2021
    Copy the full SHA
    76262c9 View commit details
  3. Update CHANGELOG.md

    gamahachaa authored Jul 8, 2021
    Copy the full SHA
    84de907 View commit details
  4. Update CHANGELOG.md

    gamahachaa authored Jul 8, 2021
    Copy the full SHA
    337a992 View commit details
  5. Update CHANGELOG.md

    gamahachaa authored Jul 8, 2021
    Copy the full SHA
    8f34144 View commit details

Commits on Jul 13, 2021

  1. Update blueprints.yaml

    gamahachaa authored Jul 13, 2021
    Copy the full SHA
    fe75ad3 View commit details

Commits on Jan 14, 2022

  1. Copy the full SHA
    86cdc6f View commit details
  2. Copy the full SHA
    7514b5f View commit details
  3. Copy the full SHA
    5b4229f View commit details
  4. Copy the full SHA
    f8bac5e View commit details
  5. Copy the full SHA
    4c0ad91 View commit details
  6. Copy the full SHA
    99a6307 View commit details
  7. Copy the full SHA
    1dddc44 View commit details
  8. Copy the full SHA
    ef26589 View commit details
  9. Copy the full SHA
    b7d3185 View commit details
  10. Copy the full SHA
    8f11cd2 View commit details
Showing with 274 additions and 133 deletions.
  1. +3 −1 .gitignore
  2. +8 −0 CHANGELOG.md
  3. +29 −32 README.md
  4. +25 −26 blueprints.yaml
  5. +30 −0 classes/Verbs.php
  6. +5 −0 composer.json
  7. +30 −4 languages.yaml
  8. +7 −0 nbproject/project.properties
  9. +9 −0 nbproject/project.xml
  10. +119 −67 xapi.php
  11. +9 −3 xapi.yaml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/vendor/rusticisoftware/tincan/nbproject/private/
/vendor/rusticisoftware/tincan/nbproject/private/
/nbproject/private/
/vendor/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v0.3.6
## 08/07/2020

1. [](#improved)
* Query filtering
1. [](#new)
* Cleanings before refactoring

# v0.3.0
## 03/01/2020

61 changes: 29 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# Xapi Plugin
# xAPI Plugin

The **Xapi** Plugin is for [Grav CMS](http://github.com/getgrav/grav) to send [XAPI (Tincan)](https://github.com/adlnet/xAPI-Spec) statements to an LRS. So far this plugin only sends statements. It doesn't provide yet any LRS query.
The **xAPI** Plugin is for [Grav CMS](http://github.com/getgrav/grav) to send [xAPI (Tincan)](https://adlnet.gov/projects/xapi/) [statements](https://drive.google.com/file/d/0BxhK5TH2EsphZFBXeVNnSGozWEE/view) to an [LRS](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-About.md#def-learning-record-store). So far this plugin only sends statements for storage. It doesn't provide yet any LRS query.

How does it works :
- When a user opens a page:
a [statement](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-About.md#def-statement) is sent to the LRS. You can map a group of users to different LRS. You can map the page template to [verbs](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#verb) and/or [activityTypes](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#2441-when-the-objecttype-is-activity)
- When a from is submited:
You can add a xapi process to a form so that its submission triggers a statement.
You can add a xAPI process to a form so that its submission triggers a statement.

- You can add js script to your pages/templates to configure trigger special statements.
_Nothing more is configured for tincanjs yet. Opened toproposals_

*There would be a lot of work to take full advantage of the specifications. So feel free to comment, raising issues, or to submit PRs*

## Installation

Installing the Xapi plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
Installing the xAPI plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

### GPM Installation (Preferred)

The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:

bin/gpm install xapi

This will install the Xapi plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/xapi`.
This will install the xAPI plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/xapi`.

### Manual Installation

@@ -31,12 +32,10 @@ You should now have all the plugin files under

/your/site/grav/user/plugins/xapi

> NOTE: This plugin is a modular component for Grav which requires
> NOTE: This plugin is a modular component for Grav which requires the following to operate :
- [Grav](http://github.com/getgrav/grav)
- [Error](https://github.com/getgrav/grav-plugin-error)
- [Problems](https://github.com/getgrav/grav-plugin-problems)
- [Login](https://github.com/getgrav/grav-plugin-login)
to operate.
- [Form](https://github.com/getgrav/grav-plugin-form) (when triggering statements with [forms](#forms))

### Admin Plugin

@@ -97,30 +96,32 @@ Note that if you use the admin plugin, a file with your configuration, and named

### Activity / Object

[Xapi object](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#object)
[xAPI object](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#object)
The statement's object is defined by the page's route.
_ nothing configurable yet but opened to any proposal_

*nothing configurable, make a proposal should you need it to*

### Context

[xapi context](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#context)
[xAPI context](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#context)
Is defined by the site's title and the current language.

_ nothing configurable yet but opened to any proposal_
*nothing configurable, make a proposal should you need it to*

### JS

Activating the tincan js will add the [minified TinCanJS library](http://rusticisoftware.github.io/TinCanJS/)to the page html head, then up to you to configre and trigger the statememnts.
Activating the tincan js will add the [minified TinCanJS library](http://rusticisoftware.github.io/TinCanJS/) to the page html head, then up to you to configre and trigger the statememnts.

### lrs

A sequence of
- **Naming** As [group](https://learn.getgrav.org/16/advanced/groups-and-permissions) Naming to a group so that when set to
- **endpoint** [see xapi doc](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-About.md#def-endpoint)
- Credentials to connect to it
- **naming**
An identifier for an LRS to bemapped to a grav user's [group](https://learn.getgrav.org/16/advanced/groups-and-permissions). (user belonging to a group matching the name of the LRS will have their statements sent to that LRS)
- **endpoint** [see xAPI doc](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-About.md#def-endpoint)
- **Credentials** to connect to the LRS
- username
- password
- **version** (the LRS's xapi version)
- **version** (the LRS's xAPI version)

A **default** setup is mandatory.
You can add as many LRS as you want
@@ -141,7 +142,7 @@ lrs:
version: "1.0.1"
```
So if a user has group 'new_starter0 statements will be sent to that LRS else to the default one.
So if a user has group 'new_starters' statements will be sent to that LRS, else to the 'default' one.
### template_verb
@@ -209,23 +210,19 @@ filter:
### Forms
Just add in your form's process definition form processing result to match a [xapi extension](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#miscext)
Just add in your form's process definition (frontmatter) the form's results to match a [xAPI extension](https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#miscext)
```yaml
process:
xapi:
extensions:
_id: "{{ grav.user.username }}{{now|date('HisDdMy') }}"
sourceFiles: sourceFiles
totalWords: totalWords
targetLangs: targetLangs
http://id.tincanapi.com/extension/purpose: todo
targetDocType: targetDocType
http://id.tincanapi.com/extension/date: deadline
http://id.tincanapi.com/extension/severity: criticality
comments: comments
sourceLang: sourceLang
onbehalf: '{{ (form.value.onbehalf == "Myself" or form.value.onbehalf is null)? grav.user.email : form.value.onbehalf~"@salt.ch"|raw}}'
_id: "{{ grav.user.username }}{{now|date('HisDdMy') }}" #twig computed expl
http://id.tincanapi.com/extension/purpose: todo-form-field
targetDocType: targetDocType-form-field
http://id.tincanapi.com/extension/date: deadline-form-field
http://id.tincanapi.com/extension/severity: criticality-form-field
comments: comments-form-field
sourceLang: sourceLang-form-field
```
51 changes: 25 additions & 26 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Grav-Xapi
version: 0.3.0
description: Add to grav LRS connectivity and basic page activity statements tracking. Turns your favorite grav app into an Learning Management System.
name: Xapi
version: 0.3.6
description: Add to grav LRS connectivity and basic page activity statements tracking. Turns your favorite Grav app into an simple Learning Management System.
icon: graduation-cap
author:
name: Gamahachaa
@@ -46,90 +46,89 @@ form:
lrs:
type: list
style: vertical
label: "list of LRSs"
label: PLUGIN_XAPI.LRS.LIST
fields:
.naming:
type: text
label: Name (to be mapped to user's group)
label: PLUGIN_XAPI.LRS.FIELDS.NAMING
.endpoint:
type: text
label: Endpoint (LRS's url)
label: PLUGIN_XAPI.LRS.FIELDS.ENDPOINT
.username:
type: text
label: Username (LRS's username)
label: PLUGIN_XAPI.LRS.FIELDS.USERNAME
.password:
type: text
label: Password (LRS's password)
label: PLUGIN_XAPI.LRS.FIELDS.PASSWORD
.version:
type: text
label: Version (LRS's version)
label: PLUGIN_XAPI.LRS.FIELDS.VERSION

template_activityType:
type: list
style: vertical
label: "Activity types vs template"
label: PLUGIN_XAPI.TEMPLATES.ACTIVITYTYPE.MAIN
fields:
.naming:
type: text
label: Template (to be mapped to an ActivityType)
label: PLUGIN_XAPI.TEMPLATES.ACTIVITYTYPE.NAMING
.activityIRI:
type: text
label: ActivityType IRI (custom or from the registry https://registry.tincanapi.com/)
label: PLUGIN_XAPI.TEMPLATES.ACTIVITYTYPE.IRI
template_verb:
type: list
style: vertical
label: "Verbs vs template"
label: PLUGIN_XAPI.TEMPLATES.VERB.MAIN
fields:
.naming:
type: text
label: Template (to be mapped to a Verb)
label: PLUGIN_XAPI.TEMPLATES.VERB.NAMING
.verbIRI:
type: text
label: Verb IRI (custom or from the registry https://registry.tincanapi.com/#home/verbs)
label: PLUGIN_XAPI.TEMPLATES.VERB.IRI
filter:
type: fieldset
title: Filters
help: "Add one item per line starting with an hyphen '-'"
info: "all items listed bellow will not trigger xapi statements"
title: PLUGIN_XAPI.FILTER.TITLE
info: PLUGIN_XAPI.FILTER.INFO
icon: filter
collapsed: true # Initial state of fieldset (see collapsible option)
collapsible: true # Whether one can expand the fieldset or not
fields:
filter.template:
type: array
label: "Do not track these templates"
label: PLUGIN_XAPI.FILTER.TEMPLATE
value_only: true
filter.taxonomies:
type: taxonomy
label: Taxonomy filter
label: PLUGIN_XAPI.FILTER.TAXO
multiple: true
validate:
type: array
filter.users:
type: array
label: "Do not track these users"
label: PLUGIN_XAPI.FILTER.USERS
title: TITLE
value_only: true
filter.groups:
type: array
label: "Do not track users if they belong to these groups"
label: PLUGIN_XAPI.FILTER.GROUPS
value_only: true
uri:
type: fieldset
title: URL Filters (routes and queries)
title: PLUGIN_XAPI.FILTER.URI.TITLE
fields:
filter.uri.routes:
type: array
label: Routes that would not trigger statements
label: PLUGIN_XAPI.FILTER.URI.ROUTES
value_only: true
filter.uri.query:
type: list
label: Url queries that would not trigger statements
label: PLUGIN_XAPI.FILTER.URI.QUERY
style: horizontal
fields:
.key:
type: text
label: key
.value:
type: text
label: value
label: value
30 changes: 30 additions & 0 deletions classes/Verbs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace Grav\Plugin\XapiPlugin;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* Description of Verbs
*
* @author bbaudry
*/
use TinCan\Verb;

class Verbs {
//put your code here
static public $VERBS =[];
static public function Voided() {
self::$VERBS['voided'] = 'http://adlnet.gov/expapi/verbs/voided';
return new TinCan\Verb(
[
'id' => 'http://adlnet.gov/expapi/verbs/voided',
'display' => [
'en-US' => 'voided'
]
]
);
}
}
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"require": {
"rusticisoftware/tincan": "@stable"
},
"autoload": {
"psr-4": {
"Grav\\Plugin\\XapiPlugin\\": "classes/"
}
}
}
34 changes: 30 additions & 4 deletions languages.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,33 @@ en:
PLUGIN_XAPI:
ENABLE_PHP: Enable Tincan PHP
ENABLE_JS: Enable Tincan JS
TEXT_VARIABLE: Text Variable
TEXT_VARIABLE_HELP: Text to add to the top of a page
LRS_VAR: YAML Text Variable
LRS_HELP: Add your LRS
LRS:
LIST: "list of LRSs"
HELP: Add your LRS
FIELDS:
NAMING: Name (to be mapped to user's group)
ENDPOINT: Endpoint (LRS's url)
USERNAME: Username (LRS's username)
PASSWORD: Password (LRS's password)
VERSION: Version (LRS's version)
TEMPLATES:
ACTIVITYTYPE:
MAIN: "Activity types vs template"
NAMING: "Template (to be mapped to an ActivityType) "
IRI: "ActivityType IRI (custom or from the registry https://registry.tincanapi.com/)"
VERB:
MAIN: "Verbs vs template"
NAMING: "Template (to be mapped to a Verb) "
IRI: "Verb IRI (custom or from the registry https://registry.tincanapi.com/#home/verbs)"
FILTER:
TITLE: Filters
INFO: "all items listed bellow will not trigger xapi statements"
HELP: "Add one item per line starting with an hyphen"
TEMPLATE: "Do not track these templates"
TAXO: "Do not track pages with these taxonomies"
USERS: "Do no track these users' activities"
GROUPS: "Do not track users' activities if they belong to these groups"
URI:
TITLE: URL Filters (routes and queries)
ROUTES: "Routes that would not trigger statements"
QUERY: "Url queries' key/value pairs that would not trigger statements"
7 changes: 7 additions & 0 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_70
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.
9 changes: 9 additions & 0 deletions nbproject/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>xapi</name>
</data>
</configuration>
</project>
Loading