Skip to content

Commit

Permalink
Initial 1.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
manquer committed May 6, 2020
0 parents commit c57e179
Show file tree
Hide file tree
Showing 20 changed files with 858 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.gitattributes export-ignore
.gitignore export-ignore
build export-ignore
.github export-ignore
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
git archive --prefix=proview/ -o proview.zip HEAD
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./proview.zip
asset_name: proview.zip
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
2 changes: 2 additions & 0 deletions .release-it.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git:
requireCleanWorkingDir: false
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 1.0.0 (2020-05-05)

* Export Archive fix (6597182)
* Archive Fix (2b4e7e9)
* Move src to plugin directoryw (140a005)
* Support 3.5 LTS (208c535)
* Initial Commit (59eadd6)



11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `moodle-local_proview` -
A local Moodle Module adding Proview integration to Moodle

## Roadmap

- [x] Proview Version support
- [x] Moodle 3.5 LTS support
- [ ] Switch off Proview for some quizzes
- [ ] Integrated playback component into moodle admin view
- [ ] Candidate ID Correlation
- [ ] Moodle 2.x Support
110 changes: 110 additions & 0 deletions classes/api/analytics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?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/>.

/**
* Proview
*
* This module provides support for remote proctoring quizzes and assessments using Proview
*
* @package local_proview
* @copyright Talview, 2020
* @author Mani Ka <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_proview\api;

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

use core\session\manager;

/**
* Abstract local analytics class.
* @copyright Talview, 2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class analytics {
/**
* Encode a substring if required.
*
* @param string $input The string that might be encoded.
* @param boolean $encode Whether to encode the URL.
* @return string
*/
private static function might_encode($input, $encode) {
if (!$encode) {
return str_replace("'", "\'", $input);
}

return urlencode($input);
}

/**
* Get the Tracking URL for the request.
*
* @param bool|int $urlencode Whether to encode URLs.
* @param bool|int $leadingslash Whether to add a leading slash to the URL.
* @return string A URL to use for tracking.
*/
public static function trackurl($urlencode = false, $leadingslash = false) {
global $DB, $PAGE;
$pageinfo = get_context_info_array($PAGE->context->id);
$trackurl = "";

if ($leadingslash) {
$trackurl .= "/";
}

return $trackurl;
}

/**
* Whether to track this request.
*
* @return boolean
* The outcome of our deliberations.
*/
public static function should_track() {
if (!is_siteadmin()) {
return true;
}

$trackadmin = get_config('local_proview', 'trackadmin');
return ($trackadmin == 1);
}

/**
* Get the user full name to record in tracking, taking account of masquerading if necessary.
*
* @return string
* The full name to log for the user.
*/
public static function user_full_name() {
global $USER;
$user = $USER;
$ismasquerading = manager::is_loggedinas();

if ($ismasquerading) {
$usereal = get_config('local_proview', 'masquerade_handling');
if ($usereal) {
$user = manager::get_realuser();
}
}

$realname = fullname($user);
return $realname;
}
}
60 changes: 60 additions & 0 deletions classes/api/tracker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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/>.

/**
* Proview
*
* This module provides support for remote proctoring quizzes and assessments using Proview
*
* @package local_proview
* @copyright Talview, 2020
* @author Mani Ka <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_proview\api;

use stdClass;

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

/**
* Guniversal analytics class.
* @copyright Talview, 2020
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tracker {
/**
* Insert the actual tracking code.
*
* @return void As the insertion is done through the {js} template API.
*/
public static function insert_tracking() {
global $PAGE, $OUTPUT, $USER;
$pageinfo = get_context_info_array($PAGE->context->id);
$template = new stdClass();
$template->proview_url = get_config('local_proview', 'proview_url');
$template->token = get_config('local_proview', 'token');
$template->enabled = get_config('local_proview', 'enabled');
$template->profile_id = $USER->id;

if ($pageinfo && !empty($template->token)) {
// The templates only contains a "{js}" block; so we don't care about
// the output; only that the $PAGE->requires are filled.
$OUTPUT->render_from_template('local_proview/tracker', $template);
}
}
}
70 changes: 70 additions & 0 deletions classes/injector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
// This file is part of the Local Proview plugin for Moodle
//
// 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/>.

/**
* Class injector
*
* @package local_proview
* @author Mani Ka <[email protected]>
* @copyright 2020 Talview Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_proview;

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

/**
* Class injector
*
* @package local_proview
* @author Mani Ka <[email protected]>
* @copyright 2020 Talview Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class injector {
/** @var bool Keeps state for injection */
private static $injected = false;

/**
* Do the actual analytics code injection.
*
* @return null
*/
public static function inject() {
if (self::$injected) {
return;
}
self::$injected = true;


$enabled = get_config('local_proview', 'enabled');
if (!$enabled) {
return;
}
$t = new api\tracker();
$t::insert_tracking();
}

/**
* Toggle the state back to un-injected.
*
* @return null
*/
public static function reset() {
self::$injected = false;
}
}
50 changes: 50 additions & 0 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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/>.
/**
* Privacy Subsystem implementation for local_proview.
*
* @package local_proview
* @copyright 2020 Talview <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace local_proview\privacy;

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

/**
* Privacy Subsystem implementation for local_proview.
* @copyright 2020 Talview <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements
\core_privacy\local\metadata\null_provider {

use \core_privacy\local\legacy_polyfill;

/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* This function is compatible with old php version. (Diff is the underscore '_' in the beginning)
* But the get_reason is still available because of the trait legacy_polyfill.
*
* @return string
*/
public static function _get_reason() {
return 'privacy:no_data_reason';
}
}
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "talview/moodle-local_proview",
"type": "moodle-local",
"require": {
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "proview"
}
}
Loading

0 comments on commit c57e179

Please sign in to comment.