Comments added
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
68a1928a4c
commit
5115697a62
@ -38,11 +38,13 @@ $baseUrl = new moodle_url( $mainPage );
|
|||||||
admin_externalpage_setup( "local_webhooks", "", null, $baseUrl, array() );
|
admin_externalpage_setup( "local_webhooks", "", null, $baseUrl, array() );
|
||||||
$context = context_system::instance();
|
$context = context_system::instance();
|
||||||
|
|
||||||
|
/* Remove the service */
|
||||||
if ( !empty( $deleteId ) && confirm_sesskey() ) {
|
if ( !empty( $deleteId ) && confirm_sesskey() ) {
|
||||||
local_webhooks_api::delete_service( $deleteId );
|
local_webhooks_api::delete_service( $deleteId );
|
||||||
redirect( $PAGE->url, new lang_string( "deleted", "moodle" ) );
|
redirect( $PAGE->url, new lang_string( "deleted", "moodle" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Disable / Enable the service */
|
||||||
if ( !empty( $hideShowId ) && confirm_sesskey() ) {
|
if ( !empty( $hideShowId ) && confirm_sesskey() ) {
|
||||||
$service = local_webhooks_api::get_service( $hideShowId );
|
$service = local_webhooks_api::get_service( $hideShowId );
|
||||||
$service->status = !(bool) $service->status;
|
$service->status = !(bool) $service->status;
|
||||||
|
@ -40,10 +40,12 @@ $context = context_system::instance();
|
|||||||
$mForm = new local_webhooks_service_edit_form( $PAGE->url );
|
$mForm = new local_webhooks_service_edit_form( $PAGE->url );
|
||||||
$formData = (array) $mForm->get_data();
|
$formData = (array) $mForm->get_data();
|
||||||
|
|
||||||
|
/* Cancel */
|
||||||
if ( $mForm->is_cancelled() ) {
|
if ( $mForm->is_cancelled() ) {
|
||||||
redirect( $mainPage );
|
redirect( $mainPage );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Updating the data */
|
||||||
if ( !empty( $formData ) && confirm_sesskey() ) {
|
if ( !empty( $formData ) && confirm_sesskey() ) {
|
||||||
if ( isset( $formData[ "events" ] ) ) {
|
if ( isset( $formData[ "events" ] ) ) {
|
||||||
$formData[ "events" ] = array_keys( $formData[ "events" ] );
|
$formData[ "events" ] = array_keys( $formData[ "events" ] );
|
||||||
@ -59,6 +61,7 @@ if ( !empty( $formData ) && confirm_sesskey() ) {
|
|||||||
redirect( $mainPage, new lang_string( "changessaved", "moodle" ) );
|
redirect( $mainPage, new lang_string( "changessaved", "moodle" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Loading service data */
|
||||||
if ( !empty( $serviceId ) ) {
|
if ( !empty( $serviceId ) ) {
|
||||||
$service = local_webhooks_api::get_service( $serviceId );
|
$service = local_webhooks_api::get_service( $serviceId );
|
||||||
$service->events = array_fill_keys( $service->events, 1 );
|
$service->events = array_fill_keys( $service->events, 1 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user