Skip to content

Commit

Permalink
PHP documentation fixes required for Moodle linter
Browse files Browse the repository at this point in the history
  • Loading branch information
townxelliot committed Nov 27, 2017
1 parent acb2c4e commit e1980fc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
3 changes: 1 addition & 2 deletions callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
// 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.
* Callback handler for accepting media item selections from the RES Moodle search service.
*
* See https://docs.moodle.org/dev/Repository_plugins_embedding_external_file_chooser
*
Expand Down
15 changes: 15 additions & 0 deletions lang/en/repository_res.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/>.

/**
* English language strings for repository_res plugin.
*
Expand Down
34 changes: 26 additions & 8 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
// 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.
* Repository plugin which enables users to select RES media URLs as resources.
*
* This requires a RES Moodle plugin service to act as its back-end and to
* present the file chooser.
Expand All @@ -32,12 +31,17 @@
global $CFG;
require_once($CFG->dirroot . '/repository/lib.php');

/**
* Repository plugin providing access to the RES index for media searches.
*/
class repository_res extends repository {

/**
* Create a default instance of the plugin when the plugin starts.
* This will point at the default BBC-maintained RES Moodle plugin
* service.
*
* @return bool
*/
public static function plugin_init() {
$options = array(
Expand All @@ -54,15 +58,20 @@ public static function plugin_init() {

/**
* Expose the RES Moodle plugin service URL as a configuration option.
*
* @return array
*/
public static function get_instance_option_names() {
$optionNames = array('pluginservice_url');
return array_merge(parent::get_instance_option_names(), $optionNames);
$optionnames = array('pluginservice_url');
return array_merge(parent::get_instance_option_names(), $optionnames);
}

/**
* An instance can be configured to point at any RES Moodle plugin service
* instance, but defaults to the one maintained by the BBC.
*
* @param object $mform
* @param string $classname
*/
public static function instance_config_form($mform,
$classname = 'repository_res') {
Expand All @@ -82,26 +91,35 @@ public static function instance_config_form($mform,
/**
* The listing comes from an external file picker (provided by the RES
* Moodle plugin service).
*
* @param string $path
* @param int $page
* @return array
*/
public function get_listing($path = null, $page = null) {
// Load external filepicker.
$callbackUrl = new moodle_url('/') .
$callbackurl = new moodle_url('/') .
'repository/res/callback.php?repo_id=' . $this->id;

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

return array(
'nologin' => true,
'norefresh' => true,
'nosearch' => true,
'object' => array(
'type' => 'text/html',
'src' => $pluginserviceUrl
'src' => $pluginserviceurl
)
);
}

/**
* Return list of types of resource provided by this plugin.
*
* @return int
*/
public function supported_returntypes() {
return FILE_EXTERNAL;
}
Expand Down

0 comments on commit e1980fc

Please sign in to comment.