MDL-15402: refactor get_admin_option_names() into get_type_option_names()
This commit is contained in:
@@ -41,7 +41,7 @@ if (!empty($edit) || !empty($new)) {
|
||||
if (!empty($edit)) {
|
||||
$repositorytype = repository_get_type_by_typename($edit);
|
||||
$classname = 'repository_' . $repositorytype->get_typename();
|
||||
$configs = call_user_func(array($classname,'get_admin_option_names'));
|
||||
$configs = call_user_func(array($classname,'get_type_option_names'));
|
||||
$plugin = $repositorytype->get_typename();
|
||||
} else {
|
||||
$plugin = $new;
|
||||
@@ -56,7 +56,7 @@ if (!empty($edit) || !empty($new)) {
|
||||
//detect if we create a new type without config (in this case if don't want to display a setting page during creation)
|
||||
$createnewtype = false;
|
||||
if (!empty($new)) {
|
||||
$adminconfignames = repository_static_function($new, 'get_admin_option_names');
|
||||
$adminconfignames = repository_static_function($new, 'get_type_option_names');
|
||||
$createnewtype = empty($adminconfignames);
|
||||
}
|
||||
// end setup, begin output
|
||||
|
||||
@@ -232,7 +232,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
|
||||
as $repositorytype)
|
||||
{
|
||||
//display setup page for plugins with: general options or multiple instances
|
||||
$adminconfignames = repository_static_function($repositorytype->get_typename(), 'get_admin_option_names');
|
||||
$adminconfignames = repository_static_function($repositorytype->get_typename(), 'get_type_option_names');
|
||||
if (!empty($adminconfignames)
|
||||
|| repository_static_function($repositorytype->get_typename(), 'has_multiple_instances')) {
|
||||
$ADMIN->add('repositorysettings',
|
||||
|
||||
+1
-1
@@ -6155,7 +6155,7 @@ class admin_setting_managerepository extends admin_setting {
|
||||
foreach ($instances as $i) {
|
||||
$settings = '';
|
||||
//display edit link only if you can config the type or if it has multiple instances
|
||||
$adminconfignames = repository_static_function($i->get_typename(), 'get_admin_option_names');
|
||||
$adminconfignames = repository_static_function($i->get_typename(), 'get_type_option_names');
|
||||
if ( !empty($adminconfignames)
|
||||
|| repository_static_function($i->get_typename(), 'has_multiple_instances')) {
|
||||
$settings .= '<a href="' . $this->baseurl . '&edit=' . $i->get_typename() . '">'
|
||||
|
||||
@@ -161,7 +161,7 @@ class repository_boxnet extends repository {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function get_admin_option_names() {
|
||||
public static function get_type_option_names() {
|
||||
return array('api_key');
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ class repository_flickr extends repository {
|
||||
$mform->addRule('secret', $strrequired, 'required', null, 'client');
|
||||
}
|
||||
|
||||
public static function get_admin_option_names() {
|
||||
public static function get_type_option_names() {
|
||||
return array('api_key', 'secret');
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ class repository_flickr_public extends repository {
|
||||
$mform->addElement('static', null, '', get_string('information','repository_flickr_public'));
|
||||
}
|
||||
|
||||
public static function get_admin_option_names() {
|
||||
public static function get_type_option_names() {
|
||||
return array('api_key');
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -113,7 +113,7 @@ class repository_type {
|
||||
|
||||
//set options attribut
|
||||
$this->_options = array();
|
||||
$options = repository_static_function($typename,'get_admin_option_names');
|
||||
$options = repository_static_function($typename,'get_type_option_names');
|
||||
//check that the type can be setup
|
||||
if (!empty($options)) {
|
||||
//set the type options
|
||||
@@ -941,7 +941,7 @@ abstract class repository {
|
||||
* By default: no general option name
|
||||
* @return array
|
||||
*/
|
||||
public static function get_admin_option_names() {
|
||||
public static function get_type_option_names() {
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -1347,7 +1347,7 @@ final class repository_admin_form extends moodleform {
|
||||
// and set the data if we have some.
|
||||
if ($this->instance) {
|
||||
$data = array();
|
||||
$option_names = call_user_func(array($classname,'get_admin_option_names'));
|
||||
$option_names = call_user_func(array($classname,'get_type_option_names'));
|
||||
$instanceoptions = $this->instance->get_options();
|
||||
foreach ($option_names as $config) {
|
||||
if (!empty($instanceoptions[$config])) {
|
||||
|
||||
Reference in New Issue
Block a user