Skip to content

Commit

Permalink
Include Moodle licence header
Browse files Browse the repository at this point in the history
  • Loading branch information
townxelliot committed Nov 27, 2017
1 parent 94f472f commit acb2c4e
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 15 deletions.
21 changes: 19 additions & 2 deletions callback.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?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/>.

/**
* Implementation of a callback handler for accepting media item selections
* from the RES Moodle plugin service.
Expand Down Expand Up @@ -33,7 +48,9 @@
* @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt
*/

// extract and decode querystring
defined('MOODLE_INTERNAL') || die;

// Extract and decode querystring.
if (!isset($_GET['media'])) {
die('media parameter must be set');
}
Expand Down Expand Up @@ -76,6 +93,6 @@
</html>
HTML;

// Output the generated HTML
// Output the generated HTML.
header('Content-Type: text/html; charset=utf-8');
echo $html;
15 changes: 15 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?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/>.

/**
* Set plugin access permissions
*
Expand Down
17 changes: 17 additions & 0 deletions db/install.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?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/>.

/**
* Setup for repository_res plugin.
*
Expand All @@ -8,6 +23,8 @@
* @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt
*/

defined('MOODLE_INTERNAL') || die;

/**
* Install repository_res data into database.
*
Expand Down
38 changes: 27 additions & 11 deletions lib.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?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/>.

/**
* Repository plugin which uses an external application to enable users to
* select RES media URLs as resources.
Expand All @@ -11,6 +26,9 @@
* @author Elliot Smith <[email protected]>
* @license GPL v3 - https://www.gnu.org/licenses/gpl-3.0.txt
*/

defined('MOODLE_INTERNAL') || die;

global $CFG;
require_once($CFG->dirroot . '/repository/lib.php');

Expand All @@ -27,7 +45,7 @@ public static function plugin_init() {
'pluginservice_url' => getenv('PLUGINSERVICE_URL')
);

$id = repository::static_function('res','create', 'res', 0,
$id = repository::static_function('res', 'create', 'res', 0,
context_system::instance(),
$options, 0);

Expand All @@ -38,8 +56,8 @@ public static function plugin_init() {
* Expose the RES Moodle plugin service URL as a configuration option.
*/
public static function get_instance_option_names() {
$option_names = array('pluginservice_url');
return array_merge(parent::get_instance_option_names(), $option_names);
$optionNames = array('pluginservice_url');
return array_merge(parent::get_instance_option_names(), $optionNames);
}

/**
Expand All @@ -50,10 +68,8 @@ public static function instance_config_form($mform,
$classname = 'repository_res') {
parent::instance_config_form($mform, 'repository_res');

// name
$mform->setDefault('name', 'RES');

// pluginservice_url
$mform->addElement('text', 'pluginservice_url',
get_string('res:pluginservice_url', 'repository_res'),
array('size' => '60'));
Expand All @@ -68,20 +84,20 @@ public static function instance_config_form($mform,
* Moodle plugin service).
*/
public function get_listing($path = null, $page = null) {
// load external filepicker
$callback_url = new moodle_url('/') .
'repository/res/callback.php?repo_id=' . $this->id;
// Load external filepicker.
$callbackUrl = new moodle_url('/') .
'repository/res/callback.php?repo_id=' . $this->id;

$pluginservice_url = $this->get_option('pluginservice_url') .
'?callback=' . urlencode($callback_url);
$pluginserviceUrl = $this->get_option('pluginservice_url') .
'?callback=' . urlencode($callbackUrl);

return array(
'nologin' => true,
'norefresh' => true,
'nosearch' => true,
'object' => array(
'type' => 'text/html',
'src' => $pluginservice_url
'src' => $pluginserviceUrl
)
);
}
Expand Down
19 changes: 17 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?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/>.

/**
* Version data for repository_res plugin.
*
Expand All @@ -12,6 +27,6 @@

$plugin->component = 'repository_res';
$plugin->requires = 2017051500;
$plugin->version = 2017070500;
$plugin->version = 2017112700;
$plugin->maturity = MATURITY_BETA;
$plugin->release = '0.0.3';
$plugin->release = '0.0.4';

0 comments on commit acb2c4e

Please sign in to comment.