--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Payment gateway admin setting.
+ *
+ * @package core_admin
+ * @copyright 2020 Shamim Rezaie <shamim@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace core_admin\local\settings;
+
+/**
+ * Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin.
+ */
+class manage_payment_gateway_plugins extends \admin_setting_manage_plugins {
+ /**
+ * Get the admin settings section title (use get_string).
+ *
+ * @return string
+ */
+ public function get_section_title() {
+ return get_string('type_pg_plural', 'plugin');
+ }
+
+ /**
+ * Get the type of plugin to manage.
+ *
+ * @return string
+ */
+ public function get_plugin_type() {
+ return 'pg';
+ }
+
+ /**
+ * Get the name of the second column.
+ *
+ * @return string
+ */
+ public function get_info_column_name() {
+ return get_string('supportedcurrencies', 'core_payment');
+ }
+
+ /**
+ * Get the type of plugin to manage.
+ *
+ * @param plugininfo The plugin info class.
+ * @return string
+ */
+ public function get_info_column($plugininfo) {
+ $codes = $plugininfo->get_supported_currencies();
+
+ $currencies = [];
+ foreach ($codes as $c) {
+ $currencies[$c] = new \lang_string($c, 'core_currencies');
+ }
+
+ return implode(get_string('listsep', 'langconfig') . ' ', $currencies);
+ }
+}
$plugin->load_settings($ADMIN, 'mediaplayers', $hassiteconfig);
}
+ // Payment gateway plugins.
+ $ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_pg_plural', 'plugin')));
+ $temp = new admin_settingpage('managepaymentgateways', new lang_string('type_pgmanage', 'plugin'));
+ $temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
+ $ADMIN->add('paymentgateways', $temp);
+
+ $plugins = core_plugin_manager::instance()->get_plugins_of_type('pg');
+ core_collator::asort_objects_by_property($plugins, 'displayname');
+ foreach ($plugins as $plugin) {
+ /** @var \core\plugininfo\pg $plugin */
+ $plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig);
+ }
+
// Data format settings.
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
$temp = new admin_settingpage('managedataformats', new lang_string('managedataformats'));
--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Strings for component 'payment', language 'en'
+ *
+ * @package core_payment
+ * @copyright 2019 Shamim Rezaie <shamim@moodle.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+$string['supportedcurrencies'] = 'Supported currencies';
$string['type_mnetservice_plural'] = 'MNet services';
$string['type_mod'] = 'Activity module';
$string['type_mod_plural'] = 'Activity modules';
+$string['type_pgmanage'] = 'Manage payment gateways';
+$string['type_pg_plural'] = 'Payment gateways';
$string['type_plagiarism'] = 'Plagiarism plugin';
$string['type_plagiarism_plural'] = 'Plagiarism plugins';
$string['type_portfolio'] = 'Portfolio';