This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
509 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Panopto CourseCast for Moodle 2 | ||
|
||
## What is it? | ||
|
||
This is a block for Moodle 2, that allows courses in Moodle to link directly to Panopto Courses, and to display recordings in the sidebar. It also allows for SSO between Moodle and Panopto CourseCast, and automatically syncs user permissions between both systems | ||
|
||
## Credits | ||
|
||
The original Panopto CourseCast plugin was written by Panopto for Moodle 1.9. It has since been rewritten for Moodle 2, by [Spenser Jones](http://spenserjones.com), and subsequently made open-source for collaboration between the open-source community and Panopto. | ||
|
||
## How can I help? | ||
|
||
Fork the block, fix a bug or add a new feature, and send us a pull-request. Or, if you're not a developer, but you've found a bug, add it to our [issue tracker](https://github.com/SpenserJ/Moodle2-Panopto/issues). | ||
|
||
## To do: | ||
* Rewrite SSO.php | ||
* Optimize lib/PanoptoSoapClient.php | ||
* Rewrite db/install.xml to support Moodle 2 | ||
* Hook saving the block_config form, to auto-provision the course | ||
* Convert role_(un)assigned event to only adjust single user in the course | ||
* Move language-specific strings into lang/en/block_panopto.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
// | ||
// Capability definitions for the rss_client block. | ||
// | ||
// The capabilities are loaded into the database table when the block is | ||
// installed or updated. Whenever the capability definitions are updated, | ||
// the module version number should be bumped up. | ||
// | ||
// The system has four possible values for a capability: | ||
// CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set). | ||
// | ||
// | ||
// CAPABILITY NAMING CONVENTION | ||
// | ||
// It is important that capability names are unique. The naming convention | ||
// for capabilities that are specific to modules and blocks is as follows: | ||
// [mod/block]/<plugin_name>:<capabilityname> | ||
// | ||
// component_name should be the same as the directory name of the mod or block. | ||
// | ||
// Core moodle capabilities are defined thus: | ||
// moodle/<capabilityclass>:<capabilityname> | ||
// | ||
// Examples: mod/forum:viewpost | ||
// block/recent_activity:view | ||
// moodle/site:deleteuser | ||
// | ||
// The variable name for the capability definitions array is $capabilities | ||
|
||
|
||
$capabilities = array( | ||
|
||
'block/panopto:provision_course' => array( | ||
|
||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_BLOCK, | ||
'archetypes' => array( | ||
'teacher' => CAP_ALLOW, | ||
'editingteacher' => CAP_ALLOW, | ||
'manager' => CAP_ALLOW | ||
) | ||
), | ||
|
||
'block/panopto:provision_multiple' => array( | ||
|
||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_BLOCK, | ||
'archetypes' => array( | ||
'manager' => CAP_ALLOW | ||
) | ||
) | ||
|
||
); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
$sync_users = array ( | ||
'handlerfile' => '/blocks/panopto/event_callbacks.php', | ||
'handlerfunction' => 'sync_users', | ||
'schedule' => 'instant' | ||
); | ||
|
||
$handlers = array ( | ||
'role_assigned' => $sync_users, | ||
'roll_unassigned' => $sync_users | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
require_once("lib/panopto_data.php"); | ||
|
||
class block_panopto_edit_form extends block_edit_form { | ||
protected function specific_definition($mform) { | ||
global $COURSE, $CFG; | ||
|
||
// Construct the Panopto data proxy object | ||
$panopto_data = new panopto_data($COURSE->id); | ||
|
||
if(!empty($panopto_data->servername) && !empty($panopto_data->instancename) && !empty($panopto_data->applicationkey)) | ||
{ | ||
$mform->addElement('header', 'configheader', 'Select the Panopto CourseCast course to display in this block.'); | ||
|
||
$params->course_ids = $COURSE->id; | ||
$params->return_url = urlencode($_SERVER['REQUEST_URI']); | ||
$query_string = http_build_query($params); | ||
$provision_url = "$CFG->wwwroot/blocks/panopto/provision_course.php?" . $query_string; | ||
$course_list = $panopto_data->get_course_options($provision_url); | ||
$mform->addElement('selectgroups', 'config_course', 'Course', $course_list['courses']); | ||
$mform->setDefault('config_course', $course_list['selected']); | ||
} else { | ||
$mform->addElement('static', 'error', '', 'Cannot configure block instance: Global configuration incomplete. Please contact your system administrator.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
require_once('lib/panopto_data.php'); | ||
|
||
// Called by event handlers in Moodle 2 | ||
// Written by Spenser Jones (http://spenserjones.com) on behalf of Ambrose University College | ||
function sync_users($ra) { | ||
print_r($ra); | ||
$context = get_context_instance_by_id($ra->contextid); | ||
print_r($context); | ||
$panopto_data = new panopto_data(null); | ||
|
||
// Set the current Moodle course to retrieve info for / provision. | ||
$panopto_data->moodle_course_id = $context->instanceid; | ||
$provisioning_data = $panopto_data->get_provisioning_info(); | ||
print_r($provisioning_data); | ||
$provisioned_data = $panopto_data->provision_course($provisioning_data); | ||
print_r($provisioned_data); | ||
return !empty($provisioned_data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
$string['pluginname'] = 'Panopto'; | ||
$string['panopto:provision_course'] = 'Provision a course'; | ||
$string['panopto:provision_multiple'] = 'Provision multiple courses at once'; | ||
$string['provisioncourseselect'] = 'Select Courses to Provision.'; | ||
$string['provisioncourseselect_help'] = 'Multiple selections are possible by Ctrl-clicking (Windows) or Cmd-clicking (Mac).'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.