|
|
|
|
@ -199,7 +199,6 @@ class Plugin |
|
|
|
|
public function getSettingsForm() |
|
|
|
|
{ |
|
|
|
|
$result = new FormValidator($this->get_name()); |
|
|
|
|
|
|
|
|
|
$defaults = []; |
|
|
|
|
$checkboxGroup = []; |
|
|
|
|
$checkboxCollection = []; |
|
|
|
|
@ -213,6 +212,8 @@ class Plugin |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$disableSettings = $this->disableSettings(); |
|
|
|
|
|
|
|
|
|
foreach ($this->fields as $name => $type) { |
|
|
|
|
$options = null; |
|
|
|
|
if (is_array($type) && isset($type['type']) && $type['type'] === 'select') { |
|
|
|
|
@ -226,6 +227,12 @@ class Plugin |
|
|
|
|
$type = $type['type']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($disableSettings)) { |
|
|
|
|
if (in_array($name, $disableSettings)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$value = $this->get($name); |
|
|
|
|
$defaults[$name] = $value; |
|
|
|
|
$type = isset($type) ? $type : 'text'; |
|
|
|
|
@ -336,6 +343,16 @@ class Plugin |
|
|
|
|
*/ |
|
|
|
|
public function get($name) |
|
|
|
|
{ |
|
|
|
|
$settings = api_get_configuration_value('plugin_settings'); |
|
|
|
|
if (!empty($settings) && isset($settings[$this->get_name()])) { |
|
|
|
|
$prioritySettings = $settings[$this->get_name()]; |
|
|
|
|
if (!empty($prioritySettings)) { |
|
|
|
|
if (isset($prioritySettings[$name])) { |
|
|
|
|
return $prioritySettings[$name]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$settings = $this->get_settings(); |
|
|
|
|
foreach ($settings as $setting) { |
|
|
|
|
if ($setting['variable'] == $this->get_name().'_'.$name) { |
|
|
|
|
@ -1040,6 +1057,20 @@ class Plugin |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Disable the settings configured in configuration.php ($configuration[plugin_settings]) |
|
|
|
|
*/ |
|
|
|
|
public function disableSettings() |
|
|
|
|
{ |
|
|
|
|
$settings = api_get_configuration_value('plugin_settings'); |
|
|
|
|
if (!empty($settings) && isset($settings[$this->get_name()])) { |
|
|
|
|
|
|
|
|
|
return array_keys($settings[$this->get_name()]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Add an link for a course tool. |
|
|
|
|
* |
|
|
|
|
|