From be91a4c9b4e5d35f74208c45950ce70de659371b Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 22 Oct 2017 13:45:49 +0400 Subject: Forming the settings page --- settings.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'settings.php') diff --git a/settings.php b/settings.php index 0e9727f..ceb603a 100644 --- a/settings.php +++ b/settings.php @@ -22,15 +22,26 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); +defined("MOODLE_INTERNAL") || die(); +$settings = null; if ($hassiteconfig) { - $settings = new admin_settingpage('local_webhooks', get_string('pluginname', 'local_webhooks')); - $ADMIN->add('localplugins', $settings); + $settings = new admin_settingpage( + "local_webhooks", + new lang_string("pluginname", "local_webhooks") + ); - $settings->add(new admin_setting_configcheckbox('local_webhooks/enabled', get_string('enabled', 'local_webhooks'), - get_string('enabled_help', 'local_webhooks'), false)); + $ADMIN->add("localplugins", $settings); - $settings->add(new admin_setting_configtext('local_webhooks/url', get_string('url', 'local_webhooks'), - get_string('url_help', 'local_webhooks'), 'http://example.com/endpoint', PARAM_URL, 40)); + $settings->add(new admin_setting_configcheckbox( + "local_webhooks/enabled", + new lang_string("enableservice", "local_webhooks"), + new lang_string("enableservice_help", "local_webhooks"), + false + )); + + /* Link to the service manager */ + $linktext = new lang_string("linkmanagerservice", "local_webhooks"); + $link = "wwwroot . "/local/webhooks/managerservice.php\">" . $linktext . ""; + $settings->add(new admin_setting_heading("local_webhooks_addheading", "", $link)); } \ No newline at end of file -- cgit v1.2.3 From 54b20f13354b74dd7266645069961a5d8e215ee9 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 22 Oct 2017 16:45:08 +0400 Subject: Adding a title --- lang/en/local_webhooks.php | 1 + lang/ru/local_webhooks.php | 1 + settings.php | 7 +++++++ 3 files changed, 9 insertions(+) (limited to 'settings.php') diff --git a/lang/en/local_webhooks.php b/lang/en/local_webhooks.php index d2f33bd..9a3993a 100644 --- a/lang/en/local_webhooks.php +++ b/lang/en/local_webhooks.php @@ -28,5 +28,6 @@ $string["linkmanagerservice"] = "Service management manager"; $string["local_webhooksdescription"] = ""; $string["managementmanager"] = "Service Management Manager"; $string["managementmanageradd"] = "Add a service"; +$string["managementmanagerdescription"] = ""; $string["pluginname"] = "Moodle WebHooks"; $string["servicedeleted"] = "Service has been removed"; \ No newline at end of file diff --git a/lang/ru/local_webhooks.php b/lang/ru/local_webhooks.php index 2c8f0b7..30a5843 100644 --- a/lang/ru/local_webhooks.php +++ b/lang/ru/local_webhooks.php @@ -28,5 +28,6 @@ $string["linkmanagerservice"] = "Менеджер управления служ $string["local_webhooksdescription"] = ""; $string["managementmanager"] = "Менеджер управления службами"; $string["managementmanageradd"] = "Добавить службу"; +$string["managementmanagerdescription"] = ""; $string["pluginname"] = "Moodle WebHooks"; $string["servicedeleted"] = "Служба была удалена"; \ No newline at end of file diff --git a/settings.php b/settings.php index ceb603a..d893b98 100644 --- a/settings.php +++ b/settings.php @@ -40,6 +40,13 @@ if ($hassiteconfig) { false )); + /* Title Manager */ + $settings->add(new admin_setting_heading( + "defaultsettings", + new lang_string("linkmanagerservice", "local_webhooks"), + new lang_string("managementmanagerdescription", "local_webhooks") + )); + /* Link to the service manager */ $linktext = new lang_string("linkmanagerservice", "local_webhooks"); $link = "wwwroot . "/local/webhooks/managerservice.php\">" . $linktext . ""; -- cgit v1.2.3 From 2bee24931a95d0b5e0b2a95a15d2b30088ba562e Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Tue, 24 Oct 2017 04:07:29 +0400 Subject: Refactoring the settings page --- settings.php | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'settings.php') diff --git a/settings.php b/settings.php index d893b98..c2235c2 100644 --- a/settings.php +++ b/settings.php @@ -26,29 +26,20 @@ defined("MOODLE_INTERNAL") || die(); $settings = null; if ($hassiteconfig) { - $settings = new admin_settingpage( - "local_webhooks", - new lang_string("pluginname", "local_webhooks") - ); + $settings = new admin_settingpage("local_webhooks", + new lang_string("pluginname", "local_webhooks")); $ADMIN->add("localplugins", $settings); $settings->add(new admin_setting_configcheckbox( "local_webhooks/enabled", - new lang_string("enableservice", "local_webhooks"), - new lang_string("enableservice_help", "local_webhooks"), - false - )); - - /* Title Manager */ - $settings->add(new admin_setting_heading( - "defaultsettings", - new lang_string("linkmanagerservice", "local_webhooks"), - new lang_string("managementmanagerdescription", "local_webhooks") - )); + new lang_string("enable", "moodle"), + new lang_string("enablews", "webservice"), + false)); /* Link to the service manager */ - $linktext = new lang_string("linkmanagerservice", "local_webhooks"); - $link = "wwwroot . "/local/webhooks/managerservice.php\">" . $linktext . ""; - $settings->add(new admin_setting_heading("local_webhooks_addheading", "", $link)); + $linktext = new lang_string("managerservice", "local_webhooks"); + $linkurl = new moodle_url("/local/webhooks/managerservice.php"); + $settings->add(new admin_setting_heading("local_webhooks_managerservice", null, + html_writer::link($linkurl, $linktext))); } \ No newline at end of file -- cgit v1.2.3