Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ name: Moodle Plugin CI

# Run this workflow every time a new commit pushed to your repository or PR
# created.
on: [push]
on:
push:
paths-ignore:
- 'node_modules/**'
pull_request:
paths-ignore:
- 'node_modules/**'

jobs:
# Set the job key. The key is displayed as the job name
Expand All @@ -15,7 +21,7 @@ jobs:
# DB services you need for testing.
services:
postgres:
image: postgres:14
image: postgres:15
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
Expand Down Expand Up @@ -43,9 +49,18 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.3'
- php: '8.4'
moodle-branch: 'main'
database: 'pgsql'
- php: '8.4'
moodle-branch: 'MOODLE_501_STABLE'
database: 'mariadb'
- php: '8.3'
moodle-branch: 'MOODLE_500_STABLE'
database: 'pgsql'
- php: '8.3'
moodle-branch: 'MOODLE_405_STABLE'
database: 'mariadb'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* Provides the steps to perform one complete backup of the panoptocourseembed instance
*/
class backup_panoptocourseembed_activity_task extends backup_activity_task {

/**
* No specific settings for this activity
*/
Expand All @@ -43,7 +42,11 @@ protected function define_my_settings() {
*/
protected function define_my_steps() {
$this->add_step(
new backup_panoptocourseembed_activity_structure_step('panoptocourseembed_structure', 'panoptocourseembed.xml'));
new backup_panoptocourseembed_activity_structure_step(
'panoptocourseembed_structure',
'panoptocourseembed.xml'
)
);
}

/**
Expand Down
8 changes: 5 additions & 3 deletions backup/moodle2/backup_panoptocourseembed_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* Define the complete panoptocourseembed structure for backup, with file and id annotations
*/
class backup_panoptocourseembed_activity_structure_step extends backup_activity_structure_step {

/**
* Define standard activity structure.
*/
Expand All @@ -41,8 +40,11 @@ protected function define_structure() {
$userinfo = $this->get_setting_value('userinfo');

// Define each element separated.
$panoptocourseembed = new backup_nested_element('panoptocourseembed', ['id'],
['name', 'intro', 'introformat', 'timemodified']);
$panoptocourseembed = new backup_nested_element(
'panoptocourseembed',
['id'],
['name', 'intro', 'introformat', 'timemodified']
);

// Build the tree.
// (love this).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
*
*/
class restore_panoptocourseembed_activity_task extends restore_activity_task {

/**
* Define (add) particular settings this activity can have
*/
Expand All @@ -48,7 +47,11 @@ protected function define_my_settings() {
protected function define_my_steps() {
// Panoptocourseembed only has one structure step.
$this->add_step(
new restore_panoptocourseembed_activity_structure_step('panoptocourseembed_structure', 'panoptocourseembed.xml'));
new restore_panoptocourseembed_activity_structure_step(
'panoptocourseembed_structure',
'panoptocourseembed.xml'
)
);
}

/**
Expand Down
1 change: 0 additions & 1 deletion backup/moodle2/restore_panoptocourseembed_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* Structure step to restore one panoptocourseembed activity
*/
class restore_panoptocourseembed_activity_structure_step extends restore_activity_structure_step {

/**
* Define standard activity structure.
*/
Expand Down
1 change: 0 additions & 1 deletion classes/admin/trim_configtext.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_configtext_trimmed_courseembed extends admin_setting_configtext {

/**
* write data to storage
*
Expand Down
1 change: 0 additions & 1 deletion classes/analytics/indicator/activity_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* @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 {

/**
* No need to fetch grades for resources.
*
Expand Down
1 change: 0 additions & 1 deletion classes/analytics/indicator/cognitive_depth.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cognitive_depth extends activity_base {

/**
* Returns the name.
*
Expand Down
1 change: 0 additions & 1 deletion classes/analytics/indicator/social_breadth.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class social_breadth extends activity_base {

/**
* Returns the name.
*
Expand Down
22 changes: 14 additions & 8 deletions classes/external/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,23 @@
* @since Moodle 3.3
*/
class external extends external_api {

/**
* Describes the parameters for get_panoptocourseembeds_by_courses.
*
* @return external_function_parameters
* @since Moodle 3.3
*/
public static function get_panoptocourseembeds_by_courses_parameters() {
return new external_function_parameters (
return new external_function_parameters(
[
'courseids' => new external_multiple_structure(
new external_value(PARAM_INT, 'Course id'), 'Array of course ids', VALUE_DEFAULT, []
new external_value(
PARAM_INT,
'Course id'
),
'Array of course ids',
VALUE_DEFAULT,
[]
),
]
);
Expand Down Expand Up @@ -90,8 +95,7 @@ public static function get_panoptocourseembeds_by_courses($courseids = []) {

// Ensure there are courseids to loop through.
if (!empty($params['courseids'])) {

list($courses, $warnings) = external_util::validate_courses($params['courseids'], $mycourses);
[$courses, $warnings] = external_util::validate_courses($params['courseids'], $mycourses);

// Get the panoptocourseembeds in this course, this function checks users visibility permissions.
// We can avoid then additional validate_context calls.
Expand All @@ -101,14 +105,16 @@ public static function get_panoptocourseembeds_by_courses($courseids = []) {
// Entry to return.
$panoptocourseembed->name = external_format_string($panoptocourseembed->name, $context->id);
$options = ['noclean' => true];
list($panoptocourseembed->intro, $panoptocourseembed->introformat) =
external_format_text($panoptocourseembed->intro,
[$panoptocourseembed->intro, $panoptocourseembed->introformat] =
external_format_text(
$panoptocourseembed->intro,
$panoptocourseembed->introformat,
$context->id,
'mod_panoptocourseembed',
'intro',
null,
$options);
$options
);
$panoptocourseembed->introfiles =
external_util::get_area_files($context->id, 'mod_panoptocourseembed', 'intro', false, false);

Expand Down
1 change: 0 additions & 1 deletion classes/search/activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class activity extends \core_search\base_activity {

/**
* Returns true if this area uses file indexing.
*
Expand Down
17 changes: 13 additions & 4 deletions contentitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
$ltiviewerurl = new moodle_url(COURSE_EMBED_PATH);
$resourcelinkid = sha1($ltiviewerurl->out(false) .
'&' . $courseid .
'&' . $course->timecreated
);
'&' . $course->timecreated);
$lti->id = $resourcelinkid;
}
if (!isset($SESSION->lti_initiatelogin_status)) {
Expand All @@ -83,8 +82,18 @@

// Prepare the request.
$request = lti_build_content_item_selection_request(
$toolid, $course, $returnurl, '', '', [], [],
false, false, false, false, false
$toolid,
$course,
$returnurl,
'',
'',
[],
[],
false,
false,
false,
false,
false
);

// Get the launch HTML.
Expand Down
4 changes: 2 additions & 2 deletions contentitem_return.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
* @copyright 2024 Panopto
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (count($errors) > 0): ?>
if (count($errors) > 0) : ?>
parent.document.CALLBACKS.handleError(<?php
/**
* JSON encode the errors array for the handleError callback.
Expand All @@ -147,7 +147,7 @@
* @copyright 2024 Panopto
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
else: ?>
else : ?>
/**
* Create and dispatch a custom event 'sessionSelected' with session details.
* This event should close the Panopto popup and pass the new content URL to the existing iframe.
Expand Down
2 changes: 0 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@
$PAGE->set_url('/mod/panoptocourseembed/index.php', ['id' => $id]);

redirect("$CFG->wwwroot/course/view.php?id=$id");


31 changes: 23 additions & 8 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ function panoptocourseembed_add_instance($panoptocourseembed) {

$completiontimeexpected = !empty($panoptocourseembed->completionexpected) ? $panoptocourseembed->completionexpected : null;
\core_completion\api::update_completion_date_event(
$panoptocourseembed->coursemodule, 'panoptocourseembed', $id, $completiontimeexpected);
$panoptocourseembed->coursemodule,
'panoptocourseembed',
$id,
$completiontimeexpected
);

return $id;
}
Expand Down Expand Up @@ -80,7 +84,11 @@ function panoptocourseembed_update_instance($panoptocourseembed, $mform) {

$completiontimeexpected = !empty($panoptocourseembed->completionexpected) ? $panoptocourseembed->completionexpected : null;
\core_completion\api::update_completion_date_event(
$panoptocourseembed->coursemodule, 'panoptocourseembed', $panoptocourseembed->id, $completiontimeexpected);
$panoptocourseembed->coursemodule,
'panoptocourseembed',
$panoptocourseembed->id,
$completiontimeexpected
);

return $DB->update_record("panoptocourseembed", $panoptocourseembed);
}
Expand Down Expand Up @@ -124,8 +132,13 @@ function panoptocourseembed_delete_instance($id) {
function panoptocourseembed_get_coursemodule_info($coursemodule) {
global $DB;

if ($panoptocourseembed = $DB->get_record('panoptocourseembed',
['id' => $coursemodule->instance], 'id, name, intro, introformat')) {
if (
$panoptocourseembed = $DB->get_record(
'panoptocourseembed',
['id' => $coursemodule->instance],
'id, name, intro, introformat'
)
) {
if (empty($panoptocourseembed->name)) {
// Panoptocourseembed name missing, fix it.
$panoptocourseembed->name = "panoptocourseembed{$panoptocourseembed->id}";
Expand Down Expand Up @@ -168,7 +181,7 @@ function panoptocourseembed_reset_userdata($data) {
* @return bool|null True if module supports feature, false if not, null if doesn't know
*/
function panoptocourseembed_supports($feature) {
switch($feature) {
switch ($feature) {
case FEATURE_IDNUMBER:
return true;
case FEATURE_GROUPS:
Expand Down Expand Up @@ -219,9 +232,11 @@ function panoptocourseembed_check_updates_since(cm_info $cm, $from, $filter = []
* @param int $userid User id to use for all capability checks, etc. Set to 0 for current user (default).
* @return \core_calendar\local\event\entities\action_interface|null
*/
function mod_panoptocourseembed_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory,
int $userid = 0) {
function mod_panoptocourseembed_core_calendar_provide_event_action(
calendar_event $event,
\core_calendar\action_factory $factory,
int $userid = 0
) {
$cm = get_fast_modinfo($event->courseid, $userid)->instances['panoptocourseembed'][$event->instance];

if (!$cm->uservisible) {
Expand Down
9 changes: 7 additions & 2 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
defined('MOODLE_INTERNAL') || die;

require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->dirroot.'/course/moodleform_mod.php');
require_once($CFG->dirroot . '/course/moodleform_mod.php');
require_once($CFG->dirroot . '/blocks/panopto/lib/lti/panoptoblock_lti_utility.php');
require_once($CFG->dirroot . '/blocks/panopto/lib/panopto_data.php');


require_login();

Expand All @@ -38,7 +40,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_panoptocourseembed_mod_form extends moodleform_mod {

/**
* Definition function for the form.
*/
Expand All @@ -58,6 +59,10 @@ public function definition() {
return;
}

// If configured we will provision the course for lti.
\panopto_data::provision_course_for_lti($COURSE->id);

// Start loading the form.
$mform = $this->_form;
$mform->addElement('header', 'generalhdr', get_string('general'));
$cimurlparams = ['courseid' => $COURSE->id];
Expand Down
1 change: 0 additions & 1 deletion tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_panoptocourseembed_generator extends testing_module_generator {

/**
* Definition function for create instance.
*
Expand Down
Loading