Skip to content

Commit 12ed8e4

Browse files
committed
trigger opencast: not only preconfigured lti tools to choose from
1 parent 6aae696 commit 12ed8e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

trigger/opencast/lib.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,21 @@ public function instance_settings() {
132132
* @throws \dml_exception
133133
*/
134134
public function extend_add_instance_form_definition($mform) {
135+
global $DB;
135136

136137
$mform->addElement('advcheckbox', 'activity',
137138
get_string('activity', 'lifecycletrigger_opencast'));
138139
$mform->setType('activity', PARAM_BOOL);
139140
$mform->addHelpButton('activity', 'activity', 'lifecycletrigger_opencast');
140141

141142
$types = lti_filter_get_types(get_site()->id);
142-
$configuredtools = lti_filter_tool_types($types, LTI_TOOL_STATE_CONFIGURED);
143+
$tools = lti_filter_tool_types($types, LTI_TOOL_STATE_ANY);
144+
$ltiinstances = $DB->get_fieldset_sql('SELECT DISTINCT(typeid) FROM {lti}');
143145
$ltitools = [];
144-
foreach ($configuredtools as $key => $tool) {
146+
foreach ($tools as $key => $tool) {
147+
if (!array_key_exists($tool->typeid, $ltiinstances)) {
148+
continue;
149+
}
145150
$ltitools[$key] = $tool->name." (".$tool->baseurl.")";
146151
}
147152
if ($ltitools) {

0 commit comments

Comments
 (0)