mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-36224: Improving lti_get_types
If there are no LTI source plugins that need to be added to the activity chooser menu, then fallback to the default activity chooser display.
This commit is contained in:
parent
4d7a2c9e1c
commit
8cf7670e58
@ -188,6 +188,7 @@ $string['force_ssl_help'] = 'Selecting this option forces all launches to this t
|
||||
In addition, all web service requests from the tool provider will use SSL.
|
||||
|
||||
If using this option, confirm that this Moodle site and the tool provider support SSL.';
|
||||
$string['generaltool'] = 'General tool';
|
||||
$string['global_tool_types'] = 'Global tool types';
|
||||
$string['grading'] = 'Grade Routing';
|
||||
$string['icon_url'] = 'Icon URL';
|
||||
@ -267,7 +268,7 @@ External tool activities differ from URL resources in a few ways:
|
||||
* External tools support reading, updating, and deleting grades associated with the activity instance
|
||||
* External tool configurations create a trust relationship between your site and the tool provider, allowing secure communication between them';
|
||||
$string['modulename_link'] = 'mod/lti/view';
|
||||
$string['modulenameplural'] = 'basicltis';
|
||||
$string['modulenameplural'] = 'External Tools';
|
||||
$string['modulenamepluralformatted'] = 'LTI Instances';
|
||||
$string['never'] = 'Never';
|
||||
$string['new_window'] = 'New window';
|
||||
|
@ -173,18 +173,46 @@ function lti_delete_instance($id) {
|
||||
}
|
||||
|
||||
function lti_get_types() {
|
||||
$type = new stdClass();
|
||||
$type->modclass = MOD_CLASS_ACTIVITY;
|
||||
$type->type = 'lti';
|
||||
$type->typestr = get_string('modulename', 'mod_lti');
|
||||
|
||||
$types = array($type);
|
||||
global $OUTPUT;
|
||||
|
||||
$subtypes = array();
|
||||
foreach (get_plugin_list('ltisource') as $name => $dir) {
|
||||
if ($moretypes = component_callback("ltisource_$name", 'get_types')) {
|
||||
$types = array_merge($types, $moretypes);
|
||||
$subtypes = array_merge($subtypes, $moretypes);
|
||||
}
|
||||
}
|
||||
if (empty($subtypes)) {
|
||||
return MOD_SUBTYPE_NO_CHILDREN;
|
||||
}
|
||||
|
||||
$types = array();
|
||||
|
||||
$type = new stdClass();
|
||||
$type->modclass = MOD_CLASS_ACTIVITY;
|
||||
$type->type = 'lti_group_start';
|
||||
$type->typestr = '--'.get_string('modulenameplural', 'mod_lti');
|
||||
$types[] = $type;
|
||||
|
||||
$link = get_string('modulename_link', 'mod_lti');
|
||||
$linktext = get_string('morehelp');
|
||||
$help = get_string('modulename_help', 'mod_lti');
|
||||
$help .= html_writer::tag('div', $OUTPUT->doc_link($link, $linktext, true), array('class' => 'helpdoclink'));
|
||||
|
||||
$type = new stdClass();
|
||||
$type->modclass = MOD_CLASS_ACTIVITY;
|
||||
$type->type = 'lti';
|
||||
$type->typestr = get_string('generaltool', 'mod_lti');
|
||||
$type->help = $help;
|
||||
$types[] = $type;
|
||||
|
||||
$types = array_merge($types, $subtypes);
|
||||
|
||||
$type = new stdClass();
|
||||
$type->modclass = MOD_CLASS_ACTIVITY;
|
||||
$type->type = 'lti_group_end';
|
||||
$type->typestr = '--';
|
||||
$types[] = $type;
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class mod_lti_mod_form extends moodleform_mod {
|
||||
if ($type = optional_param('type', false, PARAM_ALPHA)) {
|
||||
component_callback("ltisource_$type", 'add_instance_hook');
|
||||
}
|
||||
|
||||
|
||||
$this->typeid = 0;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
Loading…
x
Reference in New Issue
Block a user