Commit ac08d455 authored by Dan Poltawski's avatar Dan Poltawski Committed by Andrew Nicols

Merge branch 'MDL-57300-master' of git://github.com/ankitagarwal/moodle

parents 7a6b7f0b 7f38d8f3
......@@ -385,7 +385,7 @@ class helper {
* Returns the url to launch the lti tool.
*
* @param int $toolid the id of the shared tool
* @return moodle_url the url to launch the tool
* @return \moodle_url the url to launch the tool
* @since Moodle 3.2
*/
public static function get_launch_url($toolid) {
......@@ -395,7 +395,7 @@ class helper {
/**
* Returns the name of the lti enrolment instance, or the name of the course/module being shared.
*
* @param stdClass $tool The lti tool
* @param \stdClass $tool The lti tool
* @return string The name of the tool
* @since Moodle 3.2
*/
......@@ -415,7 +415,7 @@ class helper {
/**
* Returns a description of the course or module that this lti instance points to.
*
* @param stdClass $tool The lti tool
* @param \stdClass $tool The lti tool
* @return string A description of the tool
* @since Moodle 3.2
*/
......@@ -438,8 +438,8 @@ class helper {
/**
* Returns the icon of the tool.
*
* @param stdClass $tool The lti tool
* @return moodle_url A url to the icon of the tool
* @param \stdClass $tool The lti tool
* @return \moodle_url A url to the icon of the tool
* @since Moodle 3.2
*/
public static function get_icon($tool) {
......@@ -453,7 +453,7 @@ class helper {
* If you have slash arguments enabled, this will be a nice url ending in cartridge.xml.
* If not it will be a php page with some parameters passed.
*
* @param stdClass $tool The lti tool
* @param \stdClass $tool The lti tool
* @return string The url to the cartridge representing the tool
* @since Moodle 3.2
*/
......@@ -482,7 +482,7 @@ class helper {
* If you have slash arguments enabled, this will be a nice url ending in cartridge.xml.
* If not it will be a php page with some parameters passed.
*
* @param stdClass $tool The lti tool
* @param \stdClass $tool The lti tool
* @return string The url to the cartridge representing the tool
*/
public static function get_proxy_url($tool) {
......@@ -616,7 +616,7 @@ class helper {
* Traverses a recursive associative array, setting the properties of the corresponding
* xpath element.
*
* @param DOMXPath $xpath The xpath with the xml to modify
* @param \DOMXPath $xpath The xpath with the xml to modify
* @param array $parameters The array of xpaths to search through
* @param string $prefix The current xpath prefix (gets longer the deeper into the array you go)
* @return void
......
......@@ -69,14 +69,14 @@ class manage_table extends \table_sql {
$this->define_columns(array(
'name',
'lti1',
'lti2',
'launch',
'registration',
'edit'
));
$this->define_headers(array(
get_string('name'),
get_string('lti1', 'enrol_lti'),
get_string('lti2', 'enrol_lti'),
get_string('launchdetails', 'enrol_lti'),
get_string('registrationurl', 'enrol_lti'),
get_string('edit')
));
$this->collapsible(false);
......@@ -87,6 +87,11 @@ class manage_table extends \table_sql {
$this->ltienabled = enrol_is_enabled('lti');
$this->canconfig = has_capability('moodle/course:enrolconfig', \context_course::instance($courseid));
$this->courseid = $courseid;
// Set help icons.
$launchicon = new \help_icon('launchdetails', 'enrol_lti');
$regicon = new \help_icon('registrationurl', 'enrol_lti');
$this->define_help_for_headers(['1' => $launchicon, '2' => $regicon]);
}
/**
......@@ -102,12 +107,12 @@ class manage_table extends \table_sql {
}
/**
* Generate the LTI1 column.
* Generate the launch column.
*
* @param \stdClass $tool instance data.
* @return string
*/
public function col_lti1($tool) {
public function col_launch($tool) {
global $OUTPUT;
$url = helper::get_cartridge_url($tool);
......@@ -119,8 +124,8 @@ class manage_table extends \table_sql {
$data = [
"rows" => [
[ "label" => $toolurllabel, "text" => $toolurl, "id" => "toolurl" ],
[ "label" => $secretlabel, "text" => $secret, "id" => "secret" ],
[ "label" => $toolurllabel, "text" => $toolurl, "id" => "toolurl", "hidelabel" => false ],
[ "label" => $secretlabel, "text" => $secret, "id" => "secret", "hidelabel" => false ],
]
];
......@@ -129,22 +134,22 @@ class manage_table extends \table_sql {
}
/**
* Generate the LTI2 column.
* Generate the Registration column.
*
* @param \stdClass $tool instance data.
* @return string
*/
public function col_lti2($tool) {
public function col_registration($tool) {
global $OUTPUT;
$url = helper::get_proxy_url($tool);
$toolurllabel = get_string('toolurl', 'enrol_lti');
$toolurllabel = get_string("registrationurl", "enrol_lti");
$toolurl = $url;
$data = [
"rows" => [
[ "label" => $toolurllabel, "text" => $toolurl, "id" => "toolurl" ],
[ "label" => $toolurllabel, "text" => $toolurl, "id" => "toolurl" , "hidelabel" => true],
]
];
......@@ -152,7 +157,6 @@ class manage_table extends \table_sql {
return $return;
}
/**
* Generate the edit column.
*
......
......@@ -99,7 +99,9 @@ if ($action) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('toolsprovided', 'enrol_lti'));
echo "<p>" . get_string('toolsprovided_help', 'enrol_lti') . "</p>";
echo "<p>" .get_string('toolsprovided_help', 'enrol_lti') . "</p>";
echo "<p class=helplink>" . $OUTPUT->doc_link('enrol/lti/index',
get_string('morehelp')) ."</p>";
if (\enrol_lti\helper::count_lti_tools(array('courseid' => $courseid)) > 0) {
$table = new \enrol_lti\manage_table($courseid);
......
......@@ -55,14 +55,16 @@ $string['membersyncmodeenrolandunenrol'] = 'Enrol new and unenrol missing users'
$string['membersyncmodeenrolnew'] = 'Enrol new users';
$string['membersyncmodeunenrolmissing'] = 'Unenrol missing users';
$string['notoolsprovided'] = 'No tools provided';
$string['lti1'] = 'LTI 1';
$string['lti2'] = 'LTI 2';
$string['launchdetails'] = 'Launch details';
$string['launchdetails_help'] = 'A tool URL (also called launch URL, cartridge URL or configuration URL) plus secret are required for configuring the tool.';
$string['lti:config'] = 'Configure \'Publish as LTI tool\' instances';
$string['lti:unenrol'] = 'Unenrol users from the course';
$string['opentool'] = 'Open tool';
$string['pluginname'] = 'Publish as LTI tool';
$string['pluginname_desc'] = 'The \'Publish as LTI tool\' plugin, together with the LTI authentication plugin, allows remote users to access selected courses and activities. In other words, Moodle functions as an LTI tool provider.';
$string['registration'] = 'Published tool registration';
$string['registrationurl'] = 'Registration URL';
$string['registrationurl_help'] = 'If a registration URL (also called proxy URL) is used, then the tool is automatically configured.';
$string['remotesystem'] = 'Remote system';
$string['requirecompletion'] = 'Require course or activity completion prior to grade synchronisation';
$string['returnurlnotset'] = 'Return URL was not set.';
......@@ -77,7 +79,7 @@ $string['successfulregistration'] = 'Successful registration';
$string['tasksyncgrades'] = 'Publish as LTI tool grade sync';
$string['tasksyncmembers'] = 'Publish as LTI tool users sync';
$string['toolsprovided'] = 'Published tools';
$string['toolsprovided_help'] = 'This is the information you need to paste into any system to add these tools. In other systems the Tool URL may be referred to as a configuration URL or a web link.';
$string['toolsprovided_help'] = 'A tool may be shared with another site by providing either launch details or a registration URL.';
$string['tooltobeprovided'] = 'Tool to be published';
$string['toolurl'] = 'Tool URL';
$string['userdefaultvalues'] = 'User default values';
......
......@@ -26,7 +26,7 @@
* none
Context variables required for this template:
* rows An array of objects with label, text and id
* rows An array of objects with label, hidelabel, text and id
Example context (json):
{
......@@ -34,19 +34,23 @@
{
"label": "Tool URL",
"text": "http://example.com/",
"id": "toolurl"
"id": "toolurl",
"hidelabel": false
},
{
"label": "Secret",
"text": "ABCDEF1234567890",
"id": "secret"
"id": "secret",
"hidelabel": true
}
]
}
}}
{{#rows}}
<div>
<label style="display: inline-block; width: 5em" {{#id}}for={{#quote}}{{{id}}}-{{{uniqid}}}{{/quote}}{{/id}}>{{label}}</label>
<label style="display: inline-block; width: 5em"
{{#id}}for={{#quote}}{{{id}}}-{{{uniqid}}}{{/quote}}{{/id}} {{#hidelabel}}
class="accesshide"{{/hidelabel}}>{{label}}</label>
<div style="display: inline-block">{{> core/copy_box }}</div>
</div>
{{/rows}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment