From 706b948be01d11e30675aabe7b2b6d62fb3434b6 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sun, 22 Oct 2017 14:10:07 +0400 Subject: Manager page template --- lang/en/local_webhooks.php | 5 +++- lang/ru/local_webhooks.php | 5 +++- managerservice.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 managerservice.php diff --git a/lang/en/local_webhooks.php b/lang/en/local_webhooks.php index b230a69..d2f33bd 100644 --- a/lang/en/local_webhooks.php +++ b/lang/en/local_webhooks.php @@ -26,4 +26,7 @@ $string["enableservice"] = "Enabled"; $string["enableservice_help"] = "Enable the Event Tracking service."; $string["linkmanagerservice"] = "Service management manager"; $string["local_webhooksdescription"] = ""; -$string["pluginname"] = "Moodle WebHooks"; \ No newline at end of file +$string["managementmanager"] = "Service Management Manager"; +$string["managementmanageradd"] = "Add a service"; +$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 8a2807a..2c8f0b7 100644 --- a/lang/ru/local_webhooks.php +++ b/lang/ru/local_webhooks.php @@ -26,4 +26,7 @@ $string["enableservice"] = "Включить"; $string["enableservice_help"] = "Включение службы отслеживания событий."; $string["linkmanagerservice"] = "Менеджер управления службами"; $string["local_webhooksdescription"] = ""; -$string["pluginname"] = "Moodle WebHooks"; \ No newline at end of file +$string["managementmanager"] = "Менеджер управления службами"; +$string["managementmanageradd"] = "Добавить службу"; +$string["pluginname"] = "Moodle WebHooks"; +$string["servicedeleted"] = "Служба была удалена"; \ No newline at end of file diff --git a/managerservice.php b/managerservice.php new file mode 100644 index 0000000..7f71a3a --- /dev/null +++ b/managerservice.php @@ -0,0 +1,64 @@ +. + +/** + * Service Management Manager. + * + * @package local_webhooks + * @copyright 2017 "Valentin Popov" + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +require_once(__DIR__ . "/../../config.php"); +$deleteservice = optional_param("deleteservice", 0, PARAM_INT); + +require_login(); +$baseurl = new moodle_url("/local/webhooks/managerservice.php"); +$PAGE->set_url($baseurl); + +$context = context_system::instance(); +$PAGE->set_context($context); + +/* Delete the service */ +if ($deleteservice && confirm_sesskey()) { + $DB->delete_records("local_webhooks_service", array("id" => $deleterssid)); + redirect($PAGE->url, new lang_string("servicedeleted", "local_webhooks")); +} + +/* Retrieving a list of services */ +$select = null; +$callbacks = $DB->get_records_select("local_webhooks_service", $select, null, $DB->sql_order_by_text("title")); + +/* Page template */ +$titlepage = new lang_string("managementmanager", "local_webhooks"); +$PAGE->set_pagelayout("standard"); +$PAGE->set_title($titlepage); +$PAGE->set_heading($titlepage); + +/* The page title */ +$PAGE->navbar->add(new lang_string("local")); +$PAGE->navbar->add(new lang_string("pluginname", "local_webhooks")); +$PAGE->navbar->add($titlepage, $baseurl); +echo $OUTPUT->header(); + +/* @todo: Place the formation table */ + +/* Add service button */ +$addurl = new moodle_url("/local/webhooks/editservice.php"); +$addurltext = new lang_string("managementmanageradd", "local_webhooks"); +echo "
" . $OUTPUT->single_button($addurl, $addurltext, "get") . "
"; + +echo $OUTPUT->footer(); \ No newline at end of file -- cgit v1.2.3