Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-43008 calendar: Allow calendar plugins to display setting pages.

  • Loading branch information...
commit 55b02e02e62f180800ae81428f33afbf9aea8349 1 parent ca3b210
@abgreeve abgreeve authored
View
10 admin/settings/plugins.php
@@ -485,6 +485,16 @@
}
}
+// Add Calendar type settings.
+if ($hassiteconfig) {
+ $ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar')));
+ foreach (core_component::get_plugin_list_with_file('calendartype', 'settings.php') as $plugin => $settingspath) {
+ $settings = new admin_settingpage('calendartype_' . $plugin . '_settings', new lang_string('pluginname', 'calendartype_' . $plugin), 'moodle/site:config');
+ include($settingspath);
+ $ADMIN->add('calendartype', $settings);
+ }
+}
+
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
View
1  lang/en/calendar.php
@@ -30,6 +30,7 @@
$string['calendar'] = 'Calendar';
$string['calendarheading'] = '{$a} Calendar';
$string['calendarpreferences'] = 'Calendar preferences';
+$string['calendartypes'] = 'Calendar types';
$string['calendarurl'] = 'Calendar URL: {$a}';
$string['clickhide'] = 'click to hide';
$string['clickshow'] = 'click to show';
View
29 lib/classes/plugininfo/calendartype.php
@@ -40,4 +40,33 @@ public function is_uninstall_allowed() {
return false;
}
+
+ public function get_settings_section_name() {
+ return 'calendartype_' . $this->name . '_settings';
+ }
+
+ public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
+ global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
+ $ADMIN = $adminroot; // May be used in settings.php.
+ $plugininfo = $this; // Also can be used inside settings.php.
+ $qtype = $this; // Also can be used inside settings.php.
+
+ if (!$this->is_installed_and_upgraded()) {
+ return;
+ }
+
+ $section = $this->get_settings_section_name();
+
+ $settings = null;
+ $systemcontext = \context_system::instance();
+ if (($hassiteconfig) &&
+ file_exists($this->full_path('settings.php'))) {
+ $settings = new admin_settingpage($section, $this->displayname,
+ 'moodle/site:config', $this->is_enabled() === false);
+ include($this->full_path('settings.php')); // This may also set $settings to null.
+ }
+ if ($settings) {
+ $ADMIN->add($parentnodename, $settings);
+ }
+ }
}
View
2  lib/upgrade.txt
@@ -59,6 +59,8 @@ information provided here is intended especially for developers.
* The library to interact with Box.net (class boxclient) is only compatible with their APIv1 which
reaches its end of life on the 14th of Dec. You should migrate your scripts to make usage of the
new class boxnet_client(). Note that the method names and return values have changed.
+* Settings pages are now possible for Calendar type plugins. Calendar type plugins that require a settings page to
+ work properly will need to set their requires version to a number that is equal to or grater than the 2.6.1 release version.
DEPRECATIONS:
Various previously deprecated functions have now been altered to throw DEBUG_DEVELOPER debugging notices
Please sign in to comment.
Something went wrong with that request. Please try again.